Removed blaze, old client side code
This commit is contained in:
1
app/.gitignore
vendored
1
app/.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
settings.json
|
||||
public/components
|
||||
public/_imports.html
|
||||
private/oldClient
|
||||
nohup.out
|
||||
node_modules
|
||||
dump
|
||||
|
||||
@@ -16,7 +16,6 @@ momentjs:moment
|
||||
dburles:mongo-collection-instances
|
||||
percolate:migrations
|
||||
ecwyne:mathjs
|
||||
useraccounts:polymer
|
||||
accounts-google@1.3.1
|
||||
splendido:accounts-meld
|
||||
email@1.2.3
|
||||
@@ -25,20 +24,17 @@ chuangbo:marked
|
||||
meteor-base@1.4.0
|
||||
mobile-experience@1.0.5
|
||||
mongo@1.5.0
|
||||
blaze-html-templates
|
||||
session@1.1.7
|
||||
jquery@1.11.10
|
||||
tracker@1.2.0
|
||||
logging@1.1.20
|
||||
reload@1.2.0
|
||||
ejson@1.1.0
|
||||
spacebars
|
||||
check@1.3.1
|
||||
wizonesolutions:canonical
|
||||
standard-minifier-js@2.3.4
|
||||
shell-server@0.3.1
|
||||
seba:minifiers-autoprefixer
|
||||
nikogosovd:multiple-uihooks
|
||||
templates:array
|
||||
ecmascript@0.11.1
|
||||
es5-shim@4.8.0
|
||||
@@ -54,3 +50,4 @@ meteortesting:mocha
|
||||
mdg:validated-method
|
||||
akryum:vue-component
|
||||
akryum:vue-router2
|
||||
static-html
|
||||
|
||||
@@ -21,7 +21,6 @@ babel-runtime@1.2.7
|
||||
base64@1.0.11
|
||||
binary-heap@1.0.10
|
||||
blaze@2.3.3
|
||||
blaze-html-templates@1.1.2
|
||||
blaze-tools@1.0.10
|
||||
boilerplate-generator@1.5.0
|
||||
caching-compiler@1.1.12
|
||||
@@ -86,7 +85,6 @@ momentjs:moment@2.22.2
|
||||
mongo@1.5.1
|
||||
mongo-dev-server@1.1.0
|
||||
mongo-id@1.0.7
|
||||
nikogosovd:multiple-uihooks@0.1.8
|
||||
npm-bcrypt@0.9.3
|
||||
npm-mongo@3.0.11
|
||||
oauth@1.2.3
|
||||
@@ -111,24 +109,21 @@ session@1.1.8
|
||||
sha@1.0.9
|
||||
shell-server@0.3.1
|
||||
socket-stream-client@0.2.2
|
||||
softwarerero:accounts-t9n@1.3.11
|
||||
spacebars@1.0.15
|
||||
spacebars-compiler@1.1.3
|
||||
splendido:accounts-emails-field@1.2.0
|
||||
splendido:accounts-meld@1.3.1
|
||||
srp@1.0.12
|
||||
standard-minifier-js@2.3.4
|
||||
static-html@1.2.2
|
||||
templates:array@1.0.3
|
||||
templating@1.3.2
|
||||
templating-compiler@1.3.3
|
||||
templating-runtime@1.3.2
|
||||
templating-tools@1.1.2
|
||||
tracker@1.2.0
|
||||
ui@1.0.13
|
||||
underscore@1.0.10
|
||||
url@1.2.0
|
||||
useraccounts:core@1.14.2
|
||||
useraccounts:polymer@1.14.2
|
||||
webapp@1.6.2
|
||||
webapp-hashing@1.0.9
|
||||
wizonesolutions:canonical@0.0.5
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
// jscs:disable
|
||||
// https://github.com/chunksnbits/jquery-quickfit
|
||||
(function ($) {
|
||||
var Quickfit, QuickfitHelper, defaults, pluginName;
|
||||
|
||||
pluginName = 'quickfit';
|
||||
|
||||
defaults = {
|
||||
min: 8,
|
||||
max: 12,
|
||||
tolerance: 0.02,
|
||||
truncate: false,
|
||||
width: null,
|
||||
sampleNumberOfLetters: 10,
|
||||
sampleFontSize: 12
|
||||
};
|
||||
QuickfitHelper = (function () {
|
||||
|
||||
var sharedInstance = null;
|
||||
|
||||
QuickfitHelper.instance = function (options) {
|
||||
if (!sharedInstance) {
|
||||
sharedInstance = new QuickfitHelper(options);
|
||||
}
|
||||
return sharedInstance;
|
||||
};
|
||||
|
||||
function QuickfitHelper(options) {
|
||||
this.options = options;
|
||||
|
||||
this.item = $('<span id="meassure"></span>');
|
||||
this.item.css({
|
||||
position: 'absolute',
|
||||
left: '-1000px',
|
||||
top: '-1000px',
|
||||
'font-size': "" + this.options.sampleFontSize + "px"
|
||||
});
|
||||
$('body').append(this.item);
|
||||
|
||||
this.meassures = {};
|
||||
}
|
||||
|
||||
QuickfitHelper.prototype.getMeassure = function (letter) {
|
||||
var currentMeassure;
|
||||
currentMeassure = this.meassures[letter];
|
||||
if (!currentMeassure) {
|
||||
currentMeassure = this.setMeassure(letter);
|
||||
}
|
||||
return currentMeassure;
|
||||
};
|
||||
|
||||
QuickfitHelper.prototype.setMeassure = function (letter) {
|
||||
var currentMeassure, index, sampleLetter, text, _ref;
|
||||
|
||||
text = '';
|
||||
sampleLetter = letter === ' ' ? ' ' : letter;
|
||||
|
||||
for (index = 0, _ref = this.options.sampleNumberOfLetters - 1; 0 <= _ref ? index <= _ref : index >= _ref; 0 <= _ref ? index++ : index--) {
|
||||
text += sampleLetter;
|
||||
}
|
||||
|
||||
this.item.html(text);
|
||||
currentMeassure = this.item.width() / this.options.sampleNumberOfLetters / this.options.sampleFontSize;
|
||||
this.meassures[letter] = currentMeassure;
|
||||
|
||||
return currentMeassure;
|
||||
};
|
||||
|
||||
return QuickfitHelper;
|
||||
|
||||
})();
|
||||
|
||||
Quickfit = (function () {
|
||||
|
||||
function Quickfit(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.$element = $(this.$element);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.quickfitHelper = QuickfitHelper.instance(this.options);
|
||||
}
|
||||
|
||||
Quickfit.prototype.fit = function () {
|
||||
var elementWidth;
|
||||
if (!this.options.width) {
|
||||
elementWidth = this.$element.width();
|
||||
this.options.width = elementWidth - this.options.tolerance * elementWidth;
|
||||
}
|
||||
if (this.text = this.$element.attr('data-quickfit')) {
|
||||
this.previouslyTruncated = true;
|
||||
} else {
|
||||
this.text = this.$element.text();
|
||||
}
|
||||
this.calculateFontSize();
|
||||
|
||||
if (this.options.truncate) this.truncate();
|
||||
|
||||
return {
|
||||
$element: this.$element,
|
||||
size: this.fontSize
|
||||
};
|
||||
};
|
||||
|
||||
Quickfit.prototype.calculateFontSize = function () {
|
||||
var letter, textWidth, i;
|
||||
|
||||
textWidth = 0;
|
||||
for (i = 0; i < this.text.length; ++i) {
|
||||
letter = this.text.charAt(i);
|
||||
textWidth += this.quickfitHelper.getMeassure(letter);
|
||||
}
|
||||
|
||||
this.targetFontSize = parseInt(this.options.width / textWidth);
|
||||
return this.fontSize = Math.max(this.options.min, Math.min(this.options.max, this.targetFontSize));
|
||||
};
|
||||
|
||||
Quickfit.prototype.truncate = function () {
|
||||
var index, lastLetter, letter, textToAdd, textWidth;
|
||||
|
||||
if (this.fontSize > this.targetFontSize) {
|
||||
textToAdd = '';
|
||||
textWidth = 3 * this.quickfitHelper.getMeassure('.') * this.fontSize;
|
||||
|
||||
index = 0;
|
||||
while (textWidth < this.options.width && index < this.text.length) {
|
||||
letter = this.text[index++];
|
||||
if (lastLetter) textToAdd += lastLetter;
|
||||
textWidth += this.fontSize * this.quickfitHelper.getMeassure(letter);
|
||||
lastLetter = letter;
|
||||
}
|
||||
|
||||
if (textToAdd.length + 1 === this.text.length) {
|
||||
textToAdd = this.text;
|
||||
} else {
|
||||
textToAdd += '...';
|
||||
}
|
||||
this.textWasTruncated = true;
|
||||
|
||||
return this.$element.attr('data-quickfit', this.text).html(textToAdd);
|
||||
|
||||
} else {
|
||||
if (this.previouslyTruncated) {
|
||||
return this.$element.html(this.text);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Quickfit;
|
||||
|
||||
})();
|
||||
|
||||
return $.fn.quickfit = function (options) {
|
||||
var measurements = [];
|
||||
|
||||
// Separate measurements from repaints
|
||||
// First calculate all measurements...
|
||||
var $elements = this.each(function () {
|
||||
var measurement = new Quickfit(this, options).fit();
|
||||
measurements.push(measurement);
|
||||
return measurement.$element;
|
||||
});
|
||||
|
||||
// ... then apply the measurements.
|
||||
for (var i = 0; i < measurements.length; i++) {
|
||||
var measurement = measurements[i];
|
||||
|
||||
measurement.$element.css({ fontSize: measurement.size + 'px' });
|
||||
}
|
||||
|
||||
return $elements;
|
||||
};
|
||||
|
||||
})(jQuery, window);
|
||||
@@ -1,38 +0,0 @@
|
||||
this.GlobalUI = (function() {
|
||||
function GlobalUI() {}
|
||||
var toast;
|
||||
GlobalUI.toast = function(opts) {
|
||||
if (!toast) toast = $("#global-toast")[0];
|
||||
if (_.isObject(opts)){
|
||||
toast.text = opts.text;
|
||||
Session.set("global.ui.toastTemplate", opts.template);
|
||||
Session.set("global.ui.toastData", opts.data);
|
||||
} else {
|
||||
toast.text = opts;
|
||||
Session.set("global.ui.toastTemplate");
|
||||
Session.set("global.ui.toastData");
|
||||
}
|
||||
return toast.show();
|
||||
};
|
||||
|
||||
GlobalUI.deletedToast = function(id, collection, itemName) {
|
||||
GlobalUI.toast({
|
||||
text: itemName ? itemName + " deleted" : "Deleted item from" + collection,
|
||||
template: "undoToast",
|
||||
data: {
|
||||
id: id,
|
||||
collection: collection,
|
||||
},
|
||||
});
|
||||
};
|
||||
return GlobalUI;
|
||||
})();
|
||||
|
||||
Template.layout.helpers({
|
||||
globalToastTemplate: function() {
|
||||
return Session.get("global.ui.toastTemplate");
|
||||
},
|
||||
globalToastData: function() {
|
||||
return Session.get("global.ui.toastData");
|
||||
},
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Template.registerHelper("canCast", function() {
|
||||
return Characters.find({_id: this._id, spells: {$size: 0}}).count() === 0;
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
Template.registerHelper("canEditCharacter", function(charId) {
|
||||
return canEditCharacter(charId);
|
||||
});
|
||||
|
||||
canEditCharacter = function(charId) {
|
||||
var char = Characters.findOne(charId);
|
||||
if (!char) return false;
|
||||
var userId = Meteor.userId();
|
||||
return char.owner === userId ||
|
||||
_.contains(char.writers, userId);
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
Template.registerHelper("characterPath", function(char) {
|
||||
return `\/character\/${char._id}\/${char.urlName || "-"}`;
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
Template.registerHelper("colorClass", function(color) {
|
||||
if (color) {
|
||||
return getColorClass(color);
|
||||
} else if (this.color) {
|
||||
return getColorClass(this.color);
|
||||
}
|
||||
});
|
||||
|
||||
Template.registerHelper("hexColor", function(color) {
|
||||
return getHexColor(color);
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
Template.registerHelper("detailHero", function(suffix, givenId) {
|
||||
var id = givenId || this._id;
|
||||
if (suffix) {
|
||||
id += suffix;
|
||||
}
|
||||
if (Session.equals("global.ui.detailHeroId", id)) {
|
||||
return "hero";
|
||||
}
|
||||
});
|
||||
@@ -1,37 +0,0 @@
|
||||
Template.registerHelper("evaluate", function(charId, string) {
|
||||
return evaluate(charId, string);
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateSigned", function(charId, string) {
|
||||
var number = evaluate(charId, string);
|
||||
if (_.isFinite(number)) {
|
||||
return number > 0 ? "+" + number : "" + number;
|
||||
} else {
|
||||
return number;
|
||||
}
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateSignedSpaced", function(charId, string) {
|
||||
var number = evaluate(charId, string);
|
||||
if (_.isFinite(number)) {
|
||||
return number > 0 ? "+ " + number : "- " + (-1 * number);
|
||||
} else {
|
||||
return number;
|
||||
}
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateString", function(charId, string) {
|
||||
return evaluateString(charId, string);
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateSpellString", function(charId, spellListId, string) {
|
||||
return evaluateSpellString(charId, spellListId, string);
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateShortString", function(charId, string) {
|
||||
if (_.isString(string)){
|
||||
return evaluateString(
|
||||
charId, string.split(/^( *[-*_]){3,} *(?:\n+|$)/m)[0]
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
openParentDialog = function({
|
||||
parent, charId, element, returnElement, callback,
|
||||
}) {
|
||||
let template;
|
||||
let data;
|
||||
if (parent.collection === "Characters" && parent.group === "racial") {
|
||||
template = "raceDialog";
|
||||
data = {charId: parent.id};
|
||||
} else if (parent.collection === "Features") {
|
||||
template = "featureDialog";
|
||||
data = {featureId: parent.id};
|
||||
} else if (parent.collection === "Classes") {
|
||||
template = "classDialog";
|
||||
data = {classId: parent.id};
|
||||
} else if (parent.collection === "Items") {
|
||||
template = "itemDialog";
|
||||
data = {itemId: parent.id};
|
||||
} else if (parent.collection === "Spells") {
|
||||
template = "spellDialog";
|
||||
data = {spellId: parent.id};
|
||||
} else if (parent.collection === "Buffs") {
|
||||
template = "buffDialog";
|
||||
data = {buffId: parent.id};
|
||||
}
|
||||
pushDialogStack({template, data, element, returnElement, callback});
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
Template.registerHelper("round", function(value, decimalPlaces) {
|
||||
decimalPlaces = +decimalPlaces || 2;
|
||||
var num = +value;
|
||||
var tens = Math.pow(10, decimalPlaces);
|
||||
return Math.round(num * tens) / tens;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Template.registerHelper("session", function(key) {
|
||||
return Session.get(key);
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Template.registerHelper("signedString", function(number) {
|
||||
return number >= 0 ? "+" + number : "" + number;
|
||||
});
|
||||
@@ -1,63 +0,0 @@
|
||||
Template.registerHelper("valueString", function(value) {
|
||||
var intValue = Math.round(value * 100);
|
||||
var cp = intValue % 10;
|
||||
intValue -= cp;
|
||||
cp = Math.round(cp);
|
||||
sp = intValue % 100;
|
||||
intValue -= sp;
|
||||
sp = Math.round(sp / 10)
|
||||
gp = Math.floor(value);
|
||||
|
||||
var resultArray = [];
|
||||
if (gp > 0) {
|
||||
resultArray.push(gp + " gp");
|
||||
}
|
||||
if (sp > 0) {
|
||||
resultArray.push(sp + " sp");
|
||||
}
|
||||
if (cp > 0) {
|
||||
resultArray.push(cp + " cp");
|
||||
}
|
||||
|
||||
//build string with correct spacing
|
||||
var result = "";
|
||||
for (var i = 0, l = resultArray.length; i < l; i++) {
|
||||
//add a space between values
|
||||
if (i !== 0) {
|
||||
result += " ";
|
||||
}
|
||||
result += resultArray[i];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
Template.registerHelper("longValueString", function(value) {
|
||||
var resultArray = [];
|
||||
//sp
|
||||
var gp = Math.floor(value);
|
||||
if (gp > 0) {
|
||||
resultArray.push(gp + " gp");
|
||||
}
|
||||
//sp
|
||||
var sp = Math.floor(10 * (value % 1));
|
||||
if (sp > 0 || resultArray.length) {
|
||||
resultArray.push(sp + " sp");
|
||||
}
|
||||
//cp
|
||||
var cp = 10 * ((value * 10) % 1);
|
||||
cp = Math.round(cp * 1000) / 1000;
|
||||
if (cp > 0 || resultArray.length) {
|
||||
resultArray.push(cp + " cp");
|
||||
}
|
||||
|
||||
//build string with correct spacing
|
||||
var result = "";
|
||||
for (var i = 0; i < resultArray.length; i++) {
|
||||
//add a space between values
|
||||
if (i !== 0) {
|
||||
result += " ";
|
||||
}
|
||||
result += resultArray[i];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
@@ -1,3 +1,38 @@
|
||||
<head>
|
||||
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width initial-scale=1.0, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png?v=lk6WXp6Pmj">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png?v=lk6WXp6Pmj">
|
||||
<link rel="icon" type="image/png" href="/favicon-32x32.png?v=lk6WXp6Pmj" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="/favicon-194x194.png?v=lk6WXp6Pmj" sizes="194x194">
|
||||
<link rel="icon" type="image/png" href="/favicon-96x96.png?v=lk6WXp6Pmj" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="/android-chrome-192x192.png?v=lk6WXp6Pmj" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="/favicon-16x16.png?v=lk6WXp6Pmj" sizes="16x16">
|
||||
<link rel="manifest" href="/manifest.json?v=lk6WXp6Pmj">
|
||||
<link rel="shortcut icon" href="/favicon.ico?v=lk6WXp6Pmj">
|
||||
<meta name="msapplication-TileColor" content="#b91d1d">
|
||||
<meta name="msapplication-TileImage" content="/mstile-144x144.png?v=lk6WXp6Pmj">
|
||||
<meta name="theme-color" content="#d12929">
|
||||
|
||||
<style type="text/css" media="print">
|
||||
@page {
|
||||
margin: 0mm;
|
||||
}
|
||||
html {
|
||||
margin: 0px;
|
||||
}
|
||||
* {
|
||||
-webkit-transition: none !important;
|
||||
transition: none !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Take in a map like this:
|
||||
* {
|
||||
* "#someId": {
|
||||
* proprty1() { return someReactiveValue()}
|
||||
* }
|
||||
* }
|
||||
* and bind the properties to the DOM on autorun.
|
||||
*
|
||||
* Useful for polymer components where you need to set the order of property updating
|
||||
* or alter properties that don't bind well to their attributes
|
||||
*/
|
||||
Blaze.Template.prototype.binding = function(bindingMap){
|
||||
this.onRendered(function(){
|
||||
_.each(bindingMap, (propertyMap, cssPattern) => {
|
||||
node = this.find(cssPattern);
|
||||
_.each(propertyMap, (func, property) => {
|
||||
this.autorun(() => {
|
||||
node[property] = func && func.call && func.call(this, node);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,195 +0,0 @@
|
||||
improvedInitiativeJson = function(charId, options){
|
||||
options = options || {
|
||||
features: true,
|
||||
attacks: true,
|
||||
description: true,
|
||||
};
|
||||
var char = Characters.findOne(charId);
|
||||
if (!char) return;
|
||||
var baseValue = function(attributeName){
|
||||
return Characters.calculate.attributeBase(charId, attributeName);
|
||||
};
|
||||
var skillMod = function(skillName){
|
||||
return Characters.calculate.skillMod(charId, skillName);
|
||||
};
|
||||
var damageMods = getDamageMods(charId);
|
||||
return JSON.stringify({
|
||||
"Id": char._id,
|
||||
"Name": char.name,
|
||||
"Source": "DiceCloud",
|
||||
"Type": char.race,
|
||||
"HP": {
|
||||
"Value": baseValue("hitPoints"),
|
||||
"Notes": getHitDiceString(charId) || "",
|
||||
},
|
||||
"AC": {
|
||||
"Value": baseValue("armor"),
|
||||
"Notes": getArmorString(charId) || "",
|
||||
},
|
||||
"InitiativeModifier": skillMod("initiative"),
|
||||
"Speed": ["" + baseValue("speed")],
|
||||
"Abilities": {
|
||||
"Str": baseValue("strength"),
|
||||
"Dex": baseValue("dexterity"),
|
||||
"Con": baseValue("constitution"),
|
||||
"Cha": baseValue("charisma"),
|
||||
"Int": baseValue("intelligence"),
|
||||
"Wis": baseValue("wisdom"),
|
||||
},
|
||||
"DamageVulnerabilities": damageMods.vulnerabilities,
|
||||
"DamageResistances": damageMods.resistances,
|
||||
"DamageImmunities": damageMods.immunities,
|
||||
"ConditionImmunities": [],
|
||||
"Saves": [
|
||||
{"Name": "Str", "Modifier": skillMod("strengthSave")},
|
||||
{"Name": "Dex", "Modifier": skillMod("dexteritySave")},
|
||||
{"Name": "Con", "Modifier": skillMod("constitutionSave")},
|
||||
{"Name": "Int", "Modifier": skillMod("intelligenceSave")},
|
||||
{"Name": "Wis", "Modifier": skillMod("wisdomSave")},
|
||||
{"Name": "Cha", "Modifier": skillMod("charismaSave")},
|
||||
],
|
||||
"Skills": getSkills(charId),
|
||||
"Senses": [
|
||||
"passive Perception " +
|
||||
Characters.calculate.passiveSkill(charId, "perception")
|
||||
],
|
||||
"Languages": getLanguages(charId),
|
||||
"Challenge": "",
|
||||
"Traits": options.features ? getTraits(charId) : [],
|
||||
"Actions": options.attacks ? getActions(charId) : [],
|
||||
"Reactions": [],
|
||||
"LegendaryActions": [],
|
||||
"Description": options.description ? char.description : "",
|
||||
"Player": Meteor.user().username,
|
||||
}, null, 2);
|
||||
}
|
||||
|
||||
var getHitDiceString = function(charId){
|
||||
var d6 = Characters.calculate.attributeBase(charId, "d6HitDice");
|
||||
var d8 = Characters.calculate.attributeBase(charId, "d8HitDice");
|
||||
var d10 = Characters.calculate.attributeBase(charId, "d10HitDice");
|
||||
var d12 = Characters.calculate.attributeBase(charId, "d12HitDice");
|
||||
var con = Characters.calculate.abilityMod(charId,"constitution");
|
||||
var string = "" +
|
||||
(d6 ? `${d6}d6 + ` : "") +
|
||||
(d8 ? `${d8}d8 + ` : "") +
|
||||
(d10 ? `${d10}d10 + ` : "") +
|
||||
(d12 ? `${d12}d12 + ` : "") +
|
||||
con;
|
||||
}
|
||||
|
||||
var getArmorString = function(charId){
|
||||
var bases = Effects.find({
|
||||
charId: charId,
|
||||
stat: "armor",
|
||||
operation: "base",
|
||||
enabled: true,
|
||||
}).map(e => ({
|
||||
ame: e.name,
|
||||
value: evaluateEffect(charId, e),
|
||||
}));
|
||||
var base = bases.length && _.max(bases, b => b.value).name || "";
|
||||
var effects = Effects.find({
|
||||
charId: charId,
|
||||
stat: "armor",
|
||||
operation: {$ne: "base"},
|
||||
enabled: true,
|
||||
}).map(e => e.name);
|
||||
var strings = base ? [base] : [];
|
||||
strings = strings.concat(effects);
|
||||
return strings.join(", ");
|
||||
}
|
||||
|
||||
var getDamageMods = function(charId){
|
||||
// jscs:disable maximumLineLength
|
||||
var multipliers = [
|
||||
{name: "Acid", value: Characters.calculate.attributeValue(charId, "acidMultiplier")},
|
||||
{name: "Bludgeoning", value: Characters.calculate.attributeValue(charId, "bludgeoningMultiplier")},
|
||||
{name: "Cold", value: Characters.calculate.attributeValue(charId, "coldMultiplier")},
|
||||
{name: "Fire", value: Characters.calculate.attributeValue(charId, "fireMultiplier")},
|
||||
{name: "Force", value: Characters.calculate.attributeValue(charId, "forceMultiplier")},
|
||||
{name: "Lightning", value: Characters.calculate.attributeValue(charId, "lightningMultiplier")},
|
||||
{name: "Necrotic", value: Characters.calculate.attributeValue(charId, "necroticMultiplier")},
|
||||
{name: "Piercing", value: Characters.calculate.attributeValue(charId, "piercingMultiplier")},
|
||||
{name: "Poison", value: Characters.calculate.attributeValue(charId, "poisonMultiplier")},
|
||||
{name: "Psychic", value: Characters.calculate.attributeValue(charId, "psychicMultiplier")},
|
||||
{name: "Radiant", value: Characters.calculate.attributeValue(charId, "radiantMultiplier")},
|
||||
{name: "Slashing", value: Characters.calculate.attributeValue(charId, "slashingMultiplier")},
|
||||
{name: "Thunder", value: Characters.calculate.attributeValue(charId, "thunderMultiplier")},
|
||||
];
|
||||
// jscs:enable maximumLineLength
|
||||
multipliers = _.groupBy(multipliers, "value");
|
||||
var names = o => o.name;
|
||||
return {
|
||||
"immunities": _.map(multipliers["0"], names),
|
||||
"resistances": _.map(multipliers["0.5"], names),
|
||||
"vulnerabilities": _.map(multipliers["2"], names),
|
||||
};
|
||||
}
|
||||
|
||||
var getSkills = function(charId){
|
||||
var allSkills = [
|
||||
{name: "acrobatics", attribute: "dexterity"},
|
||||
{name: "animalHandling", attribute: "wisdom"},
|
||||
{name: "arcana", attribute: "intelligence"},
|
||||
{name: "athletics", attribute: "strength"},
|
||||
{name: "deception", attribute: "charisma"},
|
||||
{name: "history", attribute: "intelligence"},
|
||||
{name: "insight", attribute: "wisdom"},
|
||||
{name: "intimidation", attribute: "charisma"},
|
||||
{name: "investigation", attribute: "intelligence"},
|
||||
{name: "medicine", attribute: "wisdom"},
|
||||
{name: "nature", attribute: "intelligence"},
|
||||
{name: "perception", attribute: "wisdom"},
|
||||
{name: "performance", attribute: "charisma"},
|
||||
{name: "persuasion", attribute: "charisma"},
|
||||
{name: "religion", attribute: "intelligence"},
|
||||
{name: "sleightOfHand", attribute: "dexterity"},
|
||||
{name: "stealth", attribute: "dexterity"},
|
||||
{name: "survival", attribute: "wisdom"},
|
||||
];
|
||||
var skills = [];
|
||||
_.each(allSkills, skill => {
|
||||
var value = Characters.calculate.skillMod(charId, skill.name);
|
||||
var mod = Characters.calculate.abilityMod(charId, skill.attribute);
|
||||
if (value !== mod){
|
||||
skills.push({Name: skill.name, Modifier: value});
|
||||
}
|
||||
});
|
||||
return skills;
|
||||
};
|
||||
|
||||
var getLanguages = function(charId){
|
||||
return Proficiencies.find({
|
||||
charId,
|
||||
enabled: true,
|
||||
type: "language",
|
||||
}).map(l => l.name);
|
||||
};
|
||||
|
||||
var getTraits = function(charId){
|
||||
return Features.find(
|
||||
{charId: charId},
|
||||
{sort: {color: 1, name: 1}}
|
||||
).map(f => ({
|
||||
Name: f.name,
|
||||
// evaluateShortString helper
|
||||
Content: evaluateString(
|
||||
charId, f.description && f.description.split(/^( *[-*_]){3,} *(?:\n+|$)/m)[0]
|
||||
) || "",
|
||||
Usage: "",
|
||||
}));
|
||||
}
|
||||
|
||||
var getActions = function(charId){
|
||||
return Attacks.find(
|
||||
{charId, enabled: true},
|
||||
{sort: {color: 1, name: 1}}
|
||||
).map(a => ({
|
||||
Name: a.name,
|
||||
Content: `+${evaluate(charId, a.attackBonus)} to hit, ` +
|
||||
`${evaluateString(charId, a.damage)} ${a.damageType} damage, ` +
|
||||
`${a.details}`,
|
||||
Usage: "",
|
||||
}));
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
Session.setDefault("isPrinting", false);
|
||||
if (window.matchMedia) {
|
||||
var mediaQueryList = window.matchMedia("print");
|
||||
mediaQueryList.addListener(function(mql) {
|
||||
if (mql.matches) {
|
||||
Session.set("isPrinting", true);
|
||||
Tracker.flush();
|
||||
} else {
|
||||
Session.set("isPrinting", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
removeDuplicateProficiencies = function(proficiencies) {
|
||||
dict = {};
|
||||
proficiencies.forEach(function(prof) {
|
||||
if (prof.name in dict) { //if we have already gone over another proficiency for the same thing
|
||||
if (dict[prof.name].value < prof.value) {
|
||||
dict[prof.name] = prof; //then take the new one if it's higher, otherwise leave it
|
||||
}
|
||||
} else {
|
||||
dict[prof.name] = prof; //if it wasn't already there, store it
|
||||
}
|
||||
});
|
||||
profs = []
|
||||
_.forEach(dict, function(prof) {
|
||||
profs.push(prof);
|
||||
})
|
||||
return profs;
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||
|
||||
// MIT license
|
||||
var lastTime = 0;
|
||||
var vendors = ["ms", "moz", "webkit", "o"];
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"];
|
||||
window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] ||
|
||||
window[vendors[x] + "CancelRequestAnimationFrame"];
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
@@ -1,2 +1,2 @@
|
||||
import "/imports/ui/vueSetup.js";
|
||||
import "/imports/styles/stylesIndex.js";
|
||||
import "/imports/ui/styles/stylesIndex.js";
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
@keyframes bounce {
|
||||
from {
|
||||
transform: translate(0px,0px);
|
||||
}
|
||||
to {
|
||||
transform: translate(0px,-16px);
|
||||
}
|
||||
}
|
||||
|
||||
.bounce{
|
||||
animation-name: bounce;
|
||||
animation-duration: 0.3s;
|
||||
animation-direction: alternate;
|
||||
animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||
animation-delay: 0s;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*Column layout*/
|
||||
.column-container {
|
||||
column-fill: balance;
|
||||
column-gap: 0px;
|
||||
column-width: 304px;
|
||||
padding: 4px;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.column-container.thin-columns {
|
||||
column-count: 4;
|
||||
column-width: 240px;
|
||||
}
|
||||
|
||||
.column-container > div {
|
||||
padding: 4px;
|
||||
-webkit-column-break-inside: avoid;
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
/*Cards*/
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 2px;
|
||||
position: initial;
|
||||
}
|
||||
|
||||
.card .top {
|
||||
cursor: pointer;
|
||||
padding: 16px;
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
|
||||
.card .top.white {
|
||||
cursor: auto;
|
||||
padding: 16px;
|
||||
border-bottom: rgba(0,0,0,0.12) solid 1px;
|
||||
}
|
||||
|
||||
.card .bottom {
|
||||
padding: 16px;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
|
||||
.card .bottom.list {
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.card .bottom.list .paper-font-subhead {
|
||||
color: rgba(0,0,0,0.54);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.010em;
|
||||
padding: 12px 16px 12px 16px;
|
||||
}
|
||||
|
||||
.card .bottom.text {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.card .left {
|
||||
padding: 16px;
|
||||
border-radius: 2px 0 0 2px;
|
||||
text-align: center;
|
||||
min-width: 72px;
|
||||
}
|
||||
|
||||
.card .right {
|
||||
padding: 16px;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
|
||||
.card .left paper-icon-button {
|
||||
display: block;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.card .left paper-icon-button[disabled] {
|
||||
color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.card img, .card iron-image {
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
.red {
|
||||
background-color: #F44336;
|
||||
}
|
||||
|
||||
.pink {
|
||||
background-color: #E91E63;
|
||||
}
|
||||
|
||||
.purple {
|
||||
background-color: #9C27B0;
|
||||
}
|
||||
|
||||
.deep-purple {
|
||||
background-color: #673AB7;
|
||||
}
|
||||
|
||||
.indigo {
|
||||
background-color: #3F51B5;
|
||||
}
|
||||
|
||||
.blue {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
.light-blue {
|
||||
background-color: #03A9F4;
|
||||
}
|
||||
|
||||
.cyan {
|
||||
background-color: #00BCD4;
|
||||
}
|
||||
|
||||
.teal {
|
||||
background-color: #009688;
|
||||
}
|
||||
|
||||
.green {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
.light-green {
|
||||
background-color: #8BC34A;
|
||||
}
|
||||
|
||||
.lime {
|
||||
background-color: #CDDC39;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
background-color: #FFEB3B;
|
||||
}
|
||||
|
||||
.amber {
|
||||
background-color: #FFC107;
|
||||
}
|
||||
|
||||
.orange {
|
||||
background-color: #FF9800;
|
||||
}
|
||||
|
||||
.deep-orange {
|
||||
background-color: #FF5722;
|
||||
}
|
||||
|
||||
.brown {
|
||||
background-color: #795548;
|
||||
}
|
||||
|
||||
.grey {
|
||||
background-color: #9E9E9E;
|
||||
}
|
||||
|
||||
.blue-grey {
|
||||
background-color: #607D8B;
|
||||
}
|
||||
|
||||
.app-grey {
|
||||
background-color: #424242;
|
||||
}
|
||||
|
||||
.white {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.black {
|
||||
background-color: #262626;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
List items
|
||||
*/
|
||||
.item-slot {
|
||||
background-color: rgb(232, 232, 232);
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.item {
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
margin: 1px 0 1px 0;
|
||||
padding: 0 16px 0 16px;
|
||||
position: relative;
|
||||
transition: box-shadow 0.3s ease, opacity 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
.item > .itemName {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.item.small {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.item.tall {
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.item.flexible {
|
||||
height: auto;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.item iron-icon, .item paper-icon-button {
|
||||
color: #747474;
|
||||
color: rgba(0,0,0,0.54);
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*apply a natural box layout model to all elements*/
|
||||
*, *:before, *:after {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
root {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial;
|
||||
margin: 0;
|
||||
overflow-x: hidden;
|
||||
background-color: #E0E0E0;
|
||||
}
|
||||
|
||||
/*Paragraphs*/
|
||||
p {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
//Horizontal rule
|
||||
hr {
|
||||
background-color: #444;
|
||||
opacity: 0.12;
|
||||
border-width: 0;
|
||||
color: #444;
|
||||
height: 1px;
|
||||
line-height: 0;
|
||||
margin: 16px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
font-size: 26px;
|
||||
font-color: rgba(255, 255, 255, 0.58) !important;
|
||||
}
|
||||
|
||||
/*
|
||||
temporary fix for https://github.com/PolymerElements/paper-item/issues/71
|
||||
*/
|
||||
paper-icon-item::shadow #contentIcon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/*FABs*/
|
||||
.floatyButton {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
right: 24px;
|
||||
/* stop the fab from flashing during animation */
|
||||
transform: scale(1) translateZ(0px);
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
paper-fab {
|
||||
background-color: #d13b2e;
|
||||
}
|
||||
|
||||
paper-fab.keyboard-focus {
|
||||
background: #630c05;
|
||||
}
|
||||
|
||||
.red-button:not([disabled]) {
|
||||
background: #d23f31;
|
||||
color: #fff;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
/*Buttons*/
|
||||
paper-button {
|
||||
color: #000;
|
||||
color: rgba(0,0,0,0.87);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.010;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
dicecloud-selector paper-item {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/*Style shortcuts*/
|
||||
.scroll-y {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.clickable, core-item, paper-tab {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.pre-wrap, .prewrap{
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.padded {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.fullwidth {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fab-buffer {
|
||||
height: 100px;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.strengthTable{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.strengthTable td:nth-child(2){
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.summaryTable td:nth-child(3){
|
||||
text-align: right;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
body .paper-font-display4, body .paper-font-display3, body .paper-font-title, body .paper-font-caption{
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.white-text {
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text .paper-font-display2{
|
||||
color: #8a8a8a;
|
||||
color: rgba(255,255,255,0.54);
|
||||
}
|
||||
|
||||
.white-text .paper-font-display1, .white-text.paper-font-display1{
|
||||
color: #8a8a8a;
|
||||
color: rgba(255,255,255,0.54);
|
||||
}
|
||||
|
||||
.white-text h1, .white-text .paper-font-headline, .white-text.paper-font-headline{
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text h2, .white-text .paper-font-title, .white-text.paper-font-title{
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text h3, .white-text .paper-font-subhead{
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text .paper-font-body2{
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text p, .white-text .paper-font-body1{
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
|
||||
.white-text .paper-font-caption{
|
||||
color: #8a8a8a;
|
||||
color: rgba(255,255,255,0.54);
|
||||
}
|
||||
|
||||
.black54 {
|
||||
color: #757575;
|
||||
color: rgba(0,0,0,0.54);
|
||||
}
|
||||
|
||||
.white54 {
|
||||
color: #8a8a8a;
|
||||
color: rgba(255,255,255,0.54);
|
||||
}
|
||||
|
||||
.black87 {
|
||||
color: #212121;
|
||||
color: rgba(0,0,0,0.87);
|
||||
}
|
||||
|
||||
.white87 {
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<template name="attackEdit">
|
||||
<div class="layout horizontal">
|
||||
<div class="layout vertical flex">
|
||||
<div class="layout horizontal wrap">
|
||||
<!--attackBonus-->
|
||||
<paper-input class="attackBonusInput flex" label="Attack Bonus" value={{attackBonus}}
|
||||
style="flex-basis: 200px; margin-right: 16px;">
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
<!--details-->
|
||||
<paper-input class="detailInput" label="Details" value={{details}} style="flex-basis: 200px;">
|
||||
</paper-input>
|
||||
</div>
|
||||
<div class="layout horizontal wrap">
|
||||
<!--damageBonus-->
|
||||
<paper-input class="damageInput flex" label="Damage" value={{damage}}
|
||||
style="flex-basis: 200px; margin-right: 16px;">
|
||||
{{> bracketSuffix}}
|
||||
</paper-input>
|
||||
<!--DamageType-->
|
||||
<paper-dropdown-menu label="Damage Type" dynamic-align>
|
||||
<dicecloud-selector class="dropdown-content damageTypeDropdown" selected={{damageType}}>
|
||||
{{#each damageTypes}}
|
||||
<paper-item name={{this}} class="containerMenuItem">{{this}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</div>
|
||||
</div>
|
||||
<!--Delete Button-->
|
||||
<paper-icon-button class="deleteAttack" icon="delete"></paper-icon-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,46 +0,0 @@
|
||||
var damageTypes = [
|
||||
"bludgeoning",
|
||||
"piercing",
|
||||
"slashing",
|
||||
"acid",
|
||||
"cold",
|
||||
"fire",
|
||||
"force",
|
||||
"lightning",
|
||||
"necrotic",
|
||||
"poison",
|
||||
"psychic",
|
||||
"radiant",
|
||||
"thunder",
|
||||
];
|
||||
|
||||
Template.attackEdit.events({
|
||||
"click .deleteAttack": function(event, instance) {
|
||||
Attacks.softRemoveNode(this._id);
|
||||
GlobalUI.deletedToast(this._id, "Attacks", "Attack");
|
||||
},
|
||||
"change .attackBonusInput": function(event) {
|
||||
var value = event.currentTarget.value;
|
||||
Attacks.update(this._id, {$set: {attackBonus: value}});
|
||||
},
|
||||
"change .damageInput": function(event) {
|
||||
var value = event.currentTarget.value;
|
||||
Attacks.update(this._id, {$set: {damage: value}});
|
||||
},
|
||||
"change .detailInput": function(event) {
|
||||
var value = event.currentTarget.value;
|
||||
Attacks.update(this._id, {$set: {details: value}});
|
||||
},
|
||||
"iron-select .damageTypeDropdown": function(event) {
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value == this.damageType) return;
|
||||
Attacks.update(this._id, {$set: {damageType: value}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.attackEdit.helpers({
|
||||
damageTypes: function() {
|
||||
return damageTypes;
|
||||
},
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
<!--needs to be given charId, parentId and parentCollection-->
|
||||
<template name="attackEditList">
|
||||
{{#if attacks.count}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div id="attacks">
|
||||
<div class="paper-font-title">Attacks</div>
|
||||
{{#each attacks}}
|
||||
{{>attackEdit}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<paper-button id="addAttackButton" class="red-button" raised>Add Attack</paper-button>
|
||||
</template>
|
||||
@@ -1,38 +0,0 @@
|
||||
Template.attackEditList.helpers({
|
||||
attacks: function() {
|
||||
var cursor = Attacks.find({"parent.id": this.parentId, charId: this.charId});
|
||||
return cursor;
|
||||
}
|
||||
});
|
||||
|
||||
Template.attackEditList.events({
|
||||
"tap #addAttackButton": function() {
|
||||
if (typeof this.isSpell !== 'undefined' && this.isSpell) {
|
||||
var parentSpell = Spells.findOne({"_id": this.parentId})
|
||||
if (parentSpell && parentSpell.parent.collection == "SpellLists") {
|
||||
var spellList = SpellLists.findOne({"_id":parentSpell.parent.id});
|
||||
if (spellList && spellList.attackBonus) {
|
||||
Attacks.insert({
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection
|
||||
},
|
||||
attackBonus: "attackBonus",
|
||||
damage: "1d10",
|
||||
damageType: "fire",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Attacks.insert({
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
<template name="attackView">
|
||||
<div class="attackView layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center" style="margin-right: 16px;">
|
||||
{{evaluateAttackBonus charId attack}}
|
||||
</div>
|
||||
<div class="layout vertical">
|
||||
<div>
|
||||
{{evaluateDamage charId attack}} {{attack.damageType}}
|
||||
</div>
|
||||
{{#if attack.details}}
|
||||
<div class="paper-font-caption">
|
||||
{{attack.details}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,28 +0,0 @@
|
||||
Template.attackView.helpers ({
|
||||
evaluateAttackBonus: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
bonus = evaluate(charId, attack.attackBonus, {"spellListId": spell.parent.id});
|
||||
}
|
||||
} else {
|
||||
var bonus = evaluate(charId, attack.attackBonus);
|
||||
}
|
||||
|
||||
if (_.isFinite(bonus)) {
|
||||
return bonus > 0 ? "+" + bonus : "" + bonus;
|
||||
} else {
|
||||
return bonus;
|
||||
}
|
||||
},
|
||||
evaluateDamage: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
return evaluateSpellString(charId, spell.parent.id, attack.damage);
|
||||
}
|
||||
} else {
|
||||
return evaluateString(charId, attack.damage);
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -1,11 +0,0 @@
|
||||
<template name="attacksViewList">
|
||||
{{#if attacks.count}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div class="attacks">
|
||||
<div class="spaceAfter paper-font-title">Attacks</div>
|
||||
{{#each attack in attacks}}
|
||||
{{> attackView attack=attack charId=charId}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
Template.attacksViewList.helpers({
|
||||
attacks: function() {
|
||||
return Attacks.find({"parent.id": this.parentId, charId: this.charId});
|
||||
}
|
||||
});
|
||||
@@ -1,33 +0,0 @@
|
||||
<!-- data is the CustomBuff -->
|
||||
<template name="applyBuffDialog">
|
||||
<div class="fit layout vertical applyBuffDialog">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
Apply Buff
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="flex layout horizontal" style="height:100%">
|
||||
<div class="flex" style="margin-right: 16px; height: 100%; max-width: 240px; overflow-y: auto;">
|
||||
{{> characterPicker selfId=buff.charId includeSelf=canApplyToSelf writableOnly=true}}
|
||||
</div>
|
||||
<div class="flex buff-description" style="height: 100%; overflow-y: auto">
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
{{#if buff.description}}
|
||||
<div>{{#markdown}}{{evaluateString buff.charId buff.description}}{{/markdown}}</div>
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=buff.charId parentId=buff._id}}
|
||||
{{> proficiencyViewList charId=buff.charId parentId=buff._id}}
|
||||
{{> attacksViewList charId=buff.charId parentId=buff._id}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button id="cancelButton">
|
||||
Cancel
|
||||
</paper-button>
|
||||
<paper-button id="applyButton" disabled={{cantApply}}>
|
||||
Apply
|
||||
</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,32 +0,0 @@
|
||||
Template.applyBuffDialog.onCreated(function(){
|
||||
this.selectedTarget = new ReactiveVar("default");
|
||||
});
|
||||
|
||||
Template.applyBuffDialog.helpers({
|
||||
cantApply: function() {
|
||||
return this.buff.target === "others" && Template.instance().selectedTarget.get() === "default"; //this is the only case where we can't apply a buff
|
||||
},
|
||||
canApplyToSelf: function() {
|
||||
return this.buff.target !== "others"; //i.e. it is "self" or "both"
|
||||
},
|
||||
});
|
||||
|
||||
Template.applyBuffDialog.events({
|
||||
"iron-select .characterPicker": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
Template.instance().selectedTarget.set(value);
|
||||
},
|
||||
"click #applyButton": function(event, instance){
|
||||
var targetId = Template.instance().selectedTarget.get();
|
||||
if (targetId === "default") {
|
||||
if (this.buff.target === "others") return; //since we have "Select a character" selected
|
||||
targetId = this.buff.charId; //otherwise, the default is to target self
|
||||
}
|
||||
|
||||
popDialogStack(targetId);
|
||||
},
|
||||
"click #cancelButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
<template name="buffDialog">
|
||||
{{#with buff}}
|
||||
{{#baseDialog title=name class="white" hideColor=true startEditing=true editOnly=true}}
|
||||
{{> buffDetails}}
|
||||
{{else}}
|
||||
{{> buffDetails}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="buffDetails">
|
||||
<div>
|
||||
{{appliedBy}}
|
||||
</div>
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
{{#if description}}
|
||||
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=charId parentId=_id}}
|
||||
{{> proficiencyViewList charId=charId parentId=_id}}
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
@@ -1,50 +0,0 @@
|
||||
Template.buffDialog.onCreated(function(){
|
||||
var buff = Buffs.findOne(this.buffId);
|
||||
Meteor.subscribe("singleCharacterName", buff.charId); //so we can access the names of public characters
|
||||
});
|
||||
|
||||
Template.buffDialog.helpers({
|
||||
buff: function(){
|
||||
return Buffs.findOne(this.buffId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.buffDialog.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Buffs.softRemoveNode(instance.data.buffId);
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
const typeDict = {
|
||||
"Features": "feature",
|
||||
"Items": "item",
|
||||
"Spells": "spell",
|
||||
}; //really, we should only need these three
|
||||
|
||||
Template.buffDetails.helpers({
|
||||
appliedBy: function() {
|
||||
if (this.type == "inate") {
|
||||
return "Innate.";
|
||||
} else {
|
||||
var myName = Characters.findOne(this.charId).name;
|
||||
var applierCharacter = Characters.findOne(this.appliedBy) || {name: "???"}
|
||||
// "???" indicates that either we do not have read access to the buff-giver, or that the buff-giver does not exist.
|
||||
|
||||
if (applierCharacter.name === myName) {
|
||||
var charName = "your "
|
||||
} else {
|
||||
if (applierCharacter.name && applierCharacter.name[applierCharacter.name.length - 1] === 's') {
|
||||
var charName = applierCharacter.name + "' ";
|
||||
} else {
|
||||
var charName = applierCharacter.name + "'s ";
|
||||
}
|
||||
}
|
||||
|
||||
var type = typeDict[this.appliedByDetails.collection] + " ";
|
||||
var applierThing = this.appliedByDetails.name;
|
||||
|
||||
return "Applied by " + charName + type + applierThing + ".";
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
<template name="buffListItem">
|
||||
<div class="item buffListItem layout horizontal center">
|
||||
<div class="flex">
|
||||
{{buff.name}}
|
||||
</div>
|
||||
|
||||
{{#if canEditCharacter buff.charId}}
|
||||
<paper-icon-button class="deleteButton"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,21 +0,0 @@
|
||||
Template.buffListItem.helpers({
|
||||
name: function() {
|
||||
return this.buff.name
|
||||
}
|
||||
});
|
||||
|
||||
Template.buffListItem.events({
|
||||
"click .buffListItem": function(event){
|
||||
var buffId = this.buff._id;
|
||||
var charId = this.buff.charId;
|
||||
pushDialogStack({
|
||||
template: "buffDialog",
|
||||
data: {buffId: buffId, charId: charId},
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
"tap .deleteButton": function(event){
|
||||
event.stopPropagation();
|
||||
Buffs.remove(this.buff._id);
|
||||
},
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
.condition-library-dialog .item.selected {
|
||||
background-color: #e4e4e4;
|
||||
}
|
||||
|
||||
.condition-library-dialog table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.condition-library-dialog .library-condition td, tr {
|
||||
position: relative;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<template name="conditionLibraryDialog">
|
||||
<div class="fit condition-library-dialog layout vertical">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button id="backButton"
|
||||
icon="arrow-back">
|
||||
</paper-icon-button>
|
||||
<div main-title>Conditions</div>
|
||||
</app-toolbar>
|
||||
<div class="flex scroll-y">
|
||||
<div class="conditions" style="padding:8px">
|
||||
<table style="width: 100%">
|
||||
<tbody>
|
||||
{{#each condition in conditions}}
|
||||
{{>libraryCondition condition=condition selected=(isSelected condition)}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout horizontal end-justified">
|
||||
<paper-button class="cancelButton">Cancel</paper-button>
|
||||
<paper-button class="okButton">OK</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="libraryCondition">
|
||||
<tr class="item library-condition {{#if selected}}selected{{/if}}">
|
||||
<td class="conditionName">
|
||||
{{conditionName condition}}
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -1,166 +0,0 @@
|
||||
Template.conditionLibraryDialog.onCreated(function(){
|
||||
this.selectedCondition = new ReactiveVar();
|
||||
});
|
||||
|
||||
Template.conditionLibraryDialog.helpers({
|
||||
conditions: function(){
|
||||
return Object.keys(LIBRARY_CONDITIONS)
|
||||
},
|
||||
isSelected(condition){
|
||||
const selected = Template.instance().selectedCondition.get();
|
||||
return selected && selected === condition;
|
||||
},
|
||||
});
|
||||
|
||||
Template.conditionLibraryDialog.events({
|
||||
"click .cancelButton": function(event, template){
|
||||
popDialogStack();
|
||||
},
|
||||
"click .okButton": function(event, template){
|
||||
popDialogStack(template.selectedCondition.get());
|
||||
},
|
||||
"click .library-condition": function(event, template){
|
||||
template.selectedCondition.set(this.condition);
|
||||
},
|
||||
"click #backButton": function(event, template){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
Template.libraryCondition.helpers({
|
||||
conditionName: function(name){
|
||||
return LIBRARY_CONDITIONS[name].buff.name;
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
LIBRARY_CONDITIONS = {
|
||||
//Conditions
|
||||
blind: {
|
||||
buff: {
|
||||
name: "Blind",
|
||||
description: "A blinded creature can’t see and automatically fails any ability check that requires sight.\n\nAttack rolls against the creature have advantage, and the creature’s attack rolls have disadvantage.",
|
||||
},
|
||||
},
|
||||
|
||||
deaf: {
|
||||
buff: {
|
||||
name: "Deaf",
|
||||
description: "A deafened creature can’t hear and automatically fails any ability check that requires hearing.",
|
||||
},
|
||||
},
|
||||
|
||||
frightened: {
|
||||
buff: {
|
||||
name: "Frightened",
|
||||
description: "A frightened creature has disadvantage on ability checks and attack rolls while the source of its fear is within line of sight.\n\nThe creature can’t willingly move closer to the source of its fear.",
|
||||
}
|
||||
},
|
||||
|
||||
grappled: {
|
||||
buff:{
|
||||
name: "Grappled",
|
||||
description: "A grappled creature’s speed becomes 0, and it can’t benefit from any bonus to its speed.\n\nThe condition ends if the grappler is incapacitated.\n\nThe condition also ends if an effect removes the grappled creature from the reach of the grappler or grappling effect, such as when a creature is hurled away by the thunder wave spell.",
|
||||
},
|
||||
},
|
||||
|
||||
incapacitated: {
|
||||
buff: {
|
||||
name: "Incapacitated",
|
||||
description: "An incapacitated creature can’t take actions or reactions.",
|
||||
}
|
||||
},
|
||||
|
||||
invisible: {
|
||||
buff: {
|
||||
name: "Invisible",
|
||||
description: "An invisible creature is impossible to see without the aid of magic or a special sense. For the purpose of hiding, the creature is heavily obscured. The creature’s location can be detected by any noise it makes or any tracks it leaves.\n\nAttack rolls against the creature have disadvantage, and the creature’s attack rolls have advantage.",
|
||||
}
|
||||
},
|
||||
|
||||
paralyzed: {
|
||||
buff: {
|
||||
name: "Paralyzed",
|
||||
description: "A paralyzed creature is **incapacitated** and can’t move or speak.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
|
||||
},
|
||||
},
|
||||
|
||||
petrified: {
|
||||
buff: {
|
||||
name: "Petrified",
|
||||
description: "A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone). Its weight increases by a factor of ten, and it ceases aging.\n\nA petrified creature is **incapacitated** and can’t move or speak, and is unaware of its surroundings.\n\nAttack rolls against the creature have advantage.\n\nThe creature is immune to poison and disease, although a poison or disease already in its system is suspended, not neutralized.",
|
||||
},
|
||||
},
|
||||
|
||||
poisoned: {
|
||||
buff: {
|
||||
name: "Poisoned",
|
||||
description: "A poisoned creature has disadvantage on attack rolls and ability checks.",
|
||||
},
|
||||
},
|
||||
|
||||
prone: {
|
||||
buff: {
|
||||
name: "Prone",
|
||||
description: "A prone creature’s only movement option is to crawl, unless it stands up and thereby ends the condition.\n\nThe creature has disadvantage on attack rolls.\n\nAn attack roll against the creature has advantage if the attacker is within 5 feet of the creature. Otherwise, the attack roll has disadvantage.",
|
||||
}
|
||||
},
|
||||
|
||||
restrained: {
|
||||
buff: {
|
||||
name: "Restrained",
|
||||
description: "A restrained creature’s speed becomes 0, and it can’t benefit from any bonus to its speed.\n\nAttack rolls against the creature have advantage, and the creature’s attack rolls have disadvantage.\n\nThe creature has disadvantage on Dexterity saving throws.",
|
||||
},
|
||||
},
|
||||
|
||||
stunned: {
|
||||
buff: {
|
||||
name: "Stunned",
|
||||
description: "A stunned creature is **incapacitated**, can’t move, and can speak only falteringly\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.",
|
||||
},
|
||||
},
|
||||
|
||||
unconscious: {
|
||||
buff: {
|
||||
name: "Unconscious",
|
||||
description: "An unconscious creature is **incapacitated**, can’t move or speak, and is unaware of its surroundings.\n\nThe creature drops whatever it’s holding and falls **prone**.\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
|
||||
},
|
||||
},
|
||||
|
||||
exhaustion1: {
|
||||
buff: {
|
||||
name: "Exhaustion - 1",
|
||||
description: "Disadvantage on ability checks\n\nFinishing a long rest reduces a creature’s exhaustion level by 1, provided that the creature has also ingested some food and drink.",
|
||||
},
|
||||
},
|
||||
exhaustion2: {
|
||||
buff: {
|
||||
name: "Exhaustion - 2",
|
||||
description: "Speed halved",
|
||||
},
|
||||
},
|
||||
exhaustion3: {
|
||||
buff: {
|
||||
name: "Exhaustion - 3",
|
||||
description: "Disadvantage on attack rolls and saving throws",
|
||||
},
|
||||
},
|
||||
exhaustion4: {
|
||||
buff: {
|
||||
name: "Exhaustion - 4",
|
||||
description: "Hit point maximum halved",
|
||||
},
|
||||
},
|
||||
exhaustion5: {
|
||||
buff: {
|
||||
name: "Exhaustion - 5",
|
||||
description: "Speed reduced to 0",
|
||||
},
|
||||
},
|
||||
exhaustion6: {
|
||||
buff: {
|
||||
name: "Exhaustion - 6",
|
||||
description: "You have died of exhaustion",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
<template name="conditionView">
|
||||
<div class="item conditionView layout horizontal center">
|
||||
<div class="flex">
|
||||
{{condition.name}}
|
||||
</div>
|
||||
|
||||
{{#if canEditCharacter condition.charId}}
|
||||
<paper-icon-button class="deleteButton"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,15 +0,0 @@
|
||||
Template.conditionView.events({
|
||||
"click .conditionView": function(event){
|
||||
var condition = this.condition;
|
||||
var charId = Template.parentData()._id;
|
||||
pushDialogStack({
|
||||
template: "conditionViewDialog",
|
||||
data: {condition: condition},
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
"tap .deleteButton": function(event){
|
||||
event.stopPropagation();
|
||||
Conditions.remove(this.condition._id);
|
||||
},
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
<template name="conditionViewDialog">
|
||||
{{#baseDialog title=condition.name class="white" hideColor=true startEditing=true editOnly=true}}}
|
||||
{{> conditionDetails condition=condition}}
|
||||
{{else}}
|
||||
{{> conditionDetails condition=condition}}
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
|
||||
<template name="conditionDetails">
|
||||
{{#if condition.description}}
|
||||
<div>{{#markdown}}{{evaluateString condition.charId condition.description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=condition.charId parentId=condition._id}}
|
||||
</template>
|
||||
@@ -1,6 +0,0 @@
|
||||
Template.conditionViewDialog.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Conditions.remove(instance.data.condition._id);
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,29 +0,0 @@
|
||||
<template name="customBuffEdit">
|
||||
{{#baseEditDialog title=buff.name hideColor=true}}
|
||||
<!--name-->
|
||||
<paper-input id="buffNameInput" class="fullwidth" label="Name" value={{buff.name}}></paper-input>
|
||||
|
||||
<div class="layout horizontal center wrap justified">
|
||||
<paper-dropdown-menu class=flex label="Target" style="flex-basis: 150px; max-width: 200px;">
|
||||
<dicecloud-selector selected={{buff.target}} class="dropdown-content target-dropdown">
|
||||
<paper-item name="self" style="width: 150px;">
|
||||
Self only
|
||||
</paper-item>
|
||||
<paper-item name="others">
|
||||
Others only
|
||||
</paper-item>
|
||||
<paper-item name="both">
|
||||
Both
|
||||
</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</div>
|
||||
|
||||
<!--description-->
|
||||
<paper-textarea label="Description" id="buffDescriptionInput" value={{buff.description}}></paper-textarea>
|
||||
|
||||
{{> effectsEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId name=name enabled=false}}
|
||||
{{> attackEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId name=name enabled=false}}
|
||||
{{> proficiencyEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId enabled=false}}
|
||||
{{/baseEditDialog}}
|
||||
</template>
|
||||
@@ -1,47 +0,0 @@
|
||||
Template.customBuffEdit.helpers({
|
||||
buff(){
|
||||
return CustomBuffs.findOne(this.customBuffId);
|
||||
},
|
||||
});
|
||||
|
||||
const debounce = (f) => _.debounce(f, 300);
|
||||
|
||||
Template.customBuffEdit.events({
|
||||
"input #buffNameInput": debounce(function(event){
|
||||
const input = event.currentTarget;
|
||||
var name = input.value;
|
||||
if (!name){
|
||||
input.invalid = true;
|
||||
input.errorMessage = "Name is required";
|
||||
} else {
|
||||
input.invalid = false;
|
||||
CustomBuffs.update(this.customBuffId, {
|
||||
$set: {name: name}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
}),
|
||||
"input #buffDescriptionInput": debounce(function(event){
|
||||
var description = event.currentTarget.value;
|
||||
CustomBuffs.update(this.customBuffId, {
|
||||
$set: {description: description}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"iron-select .target-dropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
const buff = CustomBuffs.findOne(this.customBuffId);
|
||||
if (value === buff.target) return;
|
||||
CustomBuffs.update(this.customBuffId, {$set: {target: value}});
|
||||
},
|
||||
"click #deleteButton": function(event, instance){
|
||||
CustomBuffs.softRemoveNode(instance.data.customBuffId);
|
||||
GlobalUI.deletedToast(instance.data.customBuffId, "Buffs", "Buff");
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
<!--needs to be given charId, parentId and parentCollection-->
|
||||
<template name="customBuffEditList">
|
||||
{{#if buffs.count}}
|
||||
<div class="buffs">
|
||||
<div class="paper-font-title" style="margin-bottom: 8px;">
|
||||
Buffs
|
||||
</div>
|
||||
<table class="wideTable" style="width: 100%;">
|
||||
{{#each buff in buffs}}
|
||||
{{> customBuffEditListItem buff=buff}}
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
{{/if}}
|
||||
<paper-button id="addBuffButton"
|
||||
class="red-button"
|
||||
raised>
|
||||
Add Buff
|
||||
</paper-button>
|
||||
</template>
|
||||
|
||||
<template name="customBuffEditListItem">
|
||||
<div class="buff layout horizontal center" data-id={{buff._id}}>
|
||||
{{> customBuffView buff=buff}}
|
||||
<div>
|
||||
<paper-icon-button class="edit-buff" icon="create">
|
||||
</paper-icon-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,41 +0,0 @@
|
||||
Template.customBuffEditList.helpers({
|
||||
buffs: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId,
|
||||
};
|
||||
return CustomBuffs.find(selector);
|
||||
}
|
||||
});
|
||||
|
||||
Template.customBuffEditList.events({
|
||||
"tap #addBuffButton": function(event, instance){
|
||||
if (!_.isBoolean(this.enabled)) {
|
||||
this.enabled = true;
|
||||
}
|
||||
const customBuffId = CustomBuffs.insert({
|
||||
name: this.name || "New Buff",
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection,
|
||||
},
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "customBuffEdit",
|
||||
data: {customBuffId},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => instance.find(`tr.buff[data-id='${customBuffId}']`),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.customBuffEditListItem.events({
|
||||
"tap .edit-buff": function(event, template){
|
||||
pushDialogStack({
|
||||
template: "customBuffEdit",
|
||||
data: {customBuffId: this.buff._id},
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,8 +0,0 @@
|
||||
<template name="customBuffView">
|
||||
<div class="flex">{{buff.name}}</div>
|
||||
<div class="flex">
|
||||
{{#if canEditCharacter buff.charId}}
|
||||
<paper-button class="apply-buff-button">Apply{{toSelf}}</paper-button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,82 +0,0 @@
|
||||
const applyBuff = function(targetId, buff) {
|
||||
var parent = global[buff.parent.collection].findOne(buff.parent.id);
|
||||
|
||||
//insert new buff
|
||||
newBuffId = Buffs.insert({
|
||||
charId: targetId,
|
||||
name: buff.name,
|
||||
description: buff.description,
|
||||
lifeTime: {total: buff.lifeTime.total},
|
||||
type: "custom",
|
||||
|
||||
appliedBy: buff.charId,
|
||||
appliedByDetails: {
|
||||
name: parent.name,
|
||||
collection: buff.parent.collection,
|
||||
},
|
||||
});
|
||||
|
||||
//insert children
|
||||
Attacks.find({"parent.id": buff._id}).forEach(function(doc){
|
||||
temp = _.clone(doc);
|
||||
temp.parent.id = newBuffId;
|
||||
temp.parent.collection = "Buffs";
|
||||
delete temp._id;
|
||||
|
||||
Attacks.insert(temp);
|
||||
});
|
||||
Effects.find({"parent.id": buff._id}).forEach(function(doc){
|
||||
temp = _.clone(doc);
|
||||
temp.parent.id = newBuffId;
|
||||
temp.parent.collection = "Buffs";
|
||||
delete temp._id;
|
||||
|
||||
Effects.insert(temp);
|
||||
});
|
||||
Proficiencies.find({"parent.id": buff._id}).forEach(function(doc){
|
||||
temp = _.clone(doc);
|
||||
temp.parent.id = newBuffId;
|
||||
temp.parent.collection = "Buffs";
|
||||
delete temp._id;
|
||||
|
||||
Proficiencies.insert(temp);
|
||||
});
|
||||
|
||||
let target;
|
||||
if (targetId == buff.charId) {
|
||||
target = "self";
|
||||
} else {
|
||||
target = Characters.findOne(targetId) || {};
|
||||
target = target && target.name || "target"
|
||||
}
|
||||
GlobalUI.toast(`${buff.name || "Buff"} applied to ${target}`);
|
||||
};
|
||||
|
||||
Template.customBuffView.helpers({
|
||||
toSelf: function() {
|
||||
if (this.buff.target === "self") {
|
||||
return " to self";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.customBuffView.events({
|
||||
"click .apply-buff-button": function(){
|
||||
if (this.buff.target !== "self") {
|
||||
pushDialogStack({
|
||||
template: "applyBuffDialog",
|
||||
data: {buff: this.buff},
|
||||
element: event.currentTarget,
|
||||
callback: (targetId) => {
|
||||
if (!targetId) return;
|
||||
applyBuff(targetId, this.buff);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
var targetId = this.buff.charId;
|
||||
applyBuff(targetId, this.buff);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
<template name="customBuffViewList">
|
||||
{{#if buffs.count}}
|
||||
<div class="buffs">
|
||||
<div class="paper-font-title" style="margin-bottom: 8px;">
|
||||
Buffs
|
||||
</div>
|
||||
{{#each buff in buffs}}
|
||||
<div class="layout horizontal center">
|
||||
{{> customBuffView buff=buff}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,9 +0,0 @@
|
||||
Template.customBuffViewList.helpers({
|
||||
buffs: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId,
|
||||
};
|
||||
return CustomBuffs.find(selector);
|
||||
}
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
<template name="characterSettings">
|
||||
{{#with character}}
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Character Settings</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
<paper-toggle-button id="hideSpellcasting" checked={{settings.hideSpellcasting}}>
|
||||
Hide Spells tab
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="variantEncumbrance" checked={{settings.useVariantEncumbrance}}>
|
||||
Use variant encumbrance
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="swapStatAndModifier" checked={{settings.swapStatAndModifier}}>
|
||||
Swap stats and modifiers on Stats page
|
||||
</paper-toggle-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
{{/with}}
|
||||
</template>
|
||||
@@ -1,38 +0,0 @@
|
||||
Template.characterSettings.helpers({
|
||||
character: function() {
|
||||
return Characters.findOne(this._id, {fields: {settings: 1}});
|
||||
}
|
||||
});
|
||||
|
||||
Template.characterSettings.events({
|
||||
"change #variantEncumbrance": function(event, instance){
|
||||
var value = instance.find("#variantEncumbrance").checked;
|
||||
if (this.settings.useVariantEncumbrance !== value){
|
||||
Characters.update(
|
||||
this._id,
|
||||
{$set: {"settings.useVariantEncumbrance": value}}
|
||||
);
|
||||
}
|
||||
},
|
||||
"change #hideSpellcasting": function(event, instance){
|
||||
var value = instance.find("#hideSpellcasting").checked;
|
||||
if (this.settings.hideSpellcasting !== value){
|
||||
Characters.update(
|
||||
this._id,
|
||||
{$set: {"settings.hideSpellcasting": value}}
|
||||
);
|
||||
}
|
||||
},
|
||||
"change #swapStatAndModifier": function(event, instance){
|
||||
var value = instance.find("#swapStatAndModifier").checked;
|
||||
if (this.settings.swapStatAndModifier !== value){
|
||||
Characters.update(
|
||||
this._id,
|
||||
{$set: {"settings.swapStatAndModifier": value}}
|
||||
);
|
||||
}
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
<template name="deleteCharacterConfirmation">
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Delete Character</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
Deleting a character cannot be undone.<br>
|
||||
To continue type "{{name}}" into the box below.<br>
|
||||
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
|
||||
<paper-button id="deleteButton" style={{getStyle}} disabled={{cantDelete}}>Delete Character</paper-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="cancelButton"> Cancel </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,29 +0,0 @@
|
||||
Template.deleteCharacterConfirmation.onCreated(function() {
|
||||
this.canDelete = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.deleteCharacterConfirmation.helpers({
|
||||
cantDelete: function() {
|
||||
return !Template.instance().canDelete.get();
|
||||
},
|
||||
getStyle: function() {
|
||||
if (Template.instance().canDelete.get()) {
|
||||
return "background: #d23f31; color: white;";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.deleteCharacterConfirmation.events({
|
||||
"change #nameInput, input #nameInput": function(event, instance) {
|
||||
var canDel = instance.find("#nameInput").value === this.name;
|
||||
instance.canDelete.set(canDel);
|
||||
},
|
||||
"click #deleteButton": function(event, instance) {
|
||||
if (instance.find("#nameInput").value === this.name) {
|
||||
popDialogStack(true);
|
||||
}
|
||||
},
|
||||
"click .cancelButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
<template name="shareDialog">
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Share</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
<paper-dropdown-menu label="Who can view this character">
|
||||
<dicecloud-selector class="visibilityDropdown dropdown-content" selected={{viewPermission}}>
|
||||
<paper-item name="whitelist">Only people I share with</paper-item>
|
||||
<paper-item name="public">Anyone with link</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<div class="layout horizontal center wrap">
|
||||
<paper-input class="flex" id="userNameOrEmailInput" label="Share with username or email" floatinglabel></paper-input>
|
||||
<paper-button id="shareButton"
|
||||
class="red-button"
|
||||
style="width: 80px; height: 37px; margin-top: 16px;"
|
||||
raised
|
||||
disabled={{shareButtonDisabled}}>Share</paper-button>
|
||||
<paper-radio-group id="accessLevelMenu" selected="read">
|
||||
<paper-radio-button name="read">View Only</paper-radio-button>
|
||||
<paper-radio-button name="write">Can Edit</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
<p style="color: red;">{{userFindError}}</p>
|
||||
<div>
|
||||
{{#if readers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can View
|
||||
</div>
|
||||
{{#each id in readers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if writers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can Edit
|
||||
</div>
|
||||
{{#each id in writers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,94 +0,0 @@
|
||||
Template.shareDialog.onCreated(function(){
|
||||
this.userId = new ReactiveVar();
|
||||
this.autorun(() => {
|
||||
var char = Characters.findOne(Template.currentData()._id, {
|
||||
fields: {readers: 1, writers: 1}
|
||||
});
|
||||
if (!char) return;
|
||||
this.subscribe("userNames", _.union(char.readers, char.writers));
|
||||
});
|
||||
});
|
||||
|
||||
Template.shareDialog.onRendered(function(){
|
||||
// Polymer not mirroring selected attribute properly
|
||||
this.$("paper-listbox").each(function(){
|
||||
this.selected = this.getAttribute("selected");
|
||||
});
|
||||
});
|
||||
|
||||
Template.shareDialog.helpers({
|
||||
viewPermission: function() {
|
||||
var char = Characters.findOne(this._id, {fields: {settings: 1}});
|
||||
return char.settings.viewPermission || "whitelist";
|
||||
},
|
||||
readers: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {readers: 1}});
|
||||
return char.readers;
|
||||
},
|
||||
writers: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {writers: 1}});
|
||||
//Meteor.users.find({_id: {$in: char.writers}});
|
||||
return char.writers
|
||||
},
|
||||
username: function(id){
|
||||
const user = Meteor.users.findOne(id);
|
||||
return user && user.username || "user: " + id;
|
||||
},
|
||||
shareButtonDisabled: function(){
|
||||
return !Template.instance().userId.get();
|
||||
},
|
||||
userFindError: function(){
|
||||
if (!Template.instance().userId.get()){
|
||||
return "User not found";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.shareDialog.events({
|
||||
"iron-select .visibilityDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
var char = Characters.findOne(this._id, {fields: {settings: 1}});
|
||||
if (value == char.settings.viewPermission) return;
|
||||
Characters.update(this._id, {$set: {"settings.viewPermission": value}});
|
||||
},
|
||||
"input #userNameOrEmailInput":
|
||||
function(event, instance){
|
||||
var userName = instance.find("#userNameOrEmailInput").value;
|
||||
instance.userId.set(undefined);
|
||||
Meteor.call("getUserId", userName, function(err, result) {
|
||||
if (err){
|
||||
console.error(err);
|
||||
} else {
|
||||
console.log(result);
|
||||
instance.userId.set(result);
|
||||
}
|
||||
});
|
||||
},
|
||||
"click #shareButton": function(event, instance){
|
||||
var self = this;
|
||||
var permission = instance.find("#accessLevelMenu").selected;
|
||||
if (!permission) throw "no permission set";
|
||||
var userId = instance.userId.get();
|
||||
if (!userId) return;
|
||||
if (permission === "write"){
|
||||
Characters.update(self._id, {
|
||||
$addToSet: {writers: userId},
|
||||
$pull: {readers: userId},
|
||||
});
|
||||
} else {
|
||||
Characters.update(self._id, {
|
||||
$addToSet: {readers: userId},
|
||||
$pull: {writers: userId},
|
||||
});
|
||||
}
|
||||
},
|
||||
"click .deleteShare": function(event, instance) {
|
||||
Characters.update(instance.data._id, {
|
||||
$pull: {writers: this.id, readers: this.id}
|
||||
});
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
<!-- shamelessly nicked and renamed from deleteCharacterConfirmation.html -->
|
||||
<template name="unshareCharacterConfirmation">
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Unshare Character</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
Removing (unsharing) a character does not delete it.<br>
|
||||
However, you will be no longer be able to access or view it, unless it is publicly visible.<br>
|
||||
The character's owner or anyone with write permissions for the character can return read access.<br><br>
|
||||
To continue type "{{name}}" into the box below.<br>
|
||||
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
|
||||
<paper-button id="unshareButton" style={{getStyle}} disabled={{cantUnshare}}>Unshare Character</paper-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="cancelButton"> Cancel </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,31 +0,0 @@
|
||||
Template.unshareCharacterConfirmation.onCreated(function() {
|
||||
this.canUnshare = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.unshareCharacterConfirmation.helpers({
|
||||
cantUnshare: function() {
|
||||
return !Template.instance().canUnshare.get();
|
||||
},
|
||||
getStyle: function() {
|
||||
if (Template.instance().canUnshare.get()) {
|
||||
return "background: #d23f31; color: white;";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.unshareCharacterConfirmation.events({
|
||||
"change #nameInput, input #nameInput": function(event, instance) {
|
||||
var can = instance.find("#nameInput").value === this.name;
|
||||
instance.canUnshare.set(can);
|
||||
},
|
||||
"click #unshareButton": function(event, instance) {
|
||||
if (instance.find("#nameInput").value === this.name) {
|
||||
setTimeout(popDialogStack, 100); //weird things happen without the delay.
|
||||
Router.go("/characterList");
|
||||
Meteor.call("removeMeFromReaders", this._id);
|
||||
}
|
||||
},
|
||||
"click .cancelButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
app-toolbar.medium-tall {
|
||||
height: 108px;
|
||||
}
|
||||
|
||||
.character-name {
|
||||
padding-left: 16px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.character-menu paper-icon-item{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.character-sheet app-header {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.character-sheet iron-pages > div {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<template name="characterSheet">
|
||||
<div class="fit layout vertical character-sheet">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar class="medium-tall {{colorClass}}" style="z-index: 2;">
|
||||
<div top-item class="layout horizontal center">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div class="flex character-name">
|
||||
{{name}}
|
||||
</div>
|
||||
{{#if canEditCharacter _id}}
|
||||
{{> colorDropdown}}
|
||||
<paper-menu-button class="character-menu" horizontal-align="right">
|
||||
<paper-icon-button icon="more-vert" class="dropdown-trigger"></paper-icon-button>
|
||||
<paper-menu class="dropdown-content black87">
|
||||
<paper-icon-item id="deleteCharacter">
|
||||
<iron-icon icon="delete" item-icon></iron-icon>
|
||||
Delete
|
||||
</paper-icon-item>
|
||||
<paper-icon-item id="shareCharacter">
|
||||
<iron-icon icon="social:share" item-icon></iron-icon>
|
||||
Share
|
||||
</paper-icon-item>
|
||||
<a href={{printUrl}}>
|
||||
<paper-icon-item id="printButton">
|
||||
<iron-icon icon="print" item-icon></iron-icon>
|
||||
Print
|
||||
</paper-icon-item>
|
||||
</a>
|
||||
<paper-icon-item id="characterSettings">
|
||||
<iron-icon icon="settings" item-icon></iron-icon>
|
||||
Settings
|
||||
</paper-icon-item>
|
||||
<paper-icon-item id="characterExport">
|
||||
<iron-icon icon="content-copy" item-icon></iron-icon>
|
||||
Export to Improved Initiative
|
||||
</paper-icon-item>
|
||||
</paper-menu>
|
||||
</paper-menu-button>
|
||||
{{else}}
|
||||
<paper-menu-button class="character-menu" horizontal-align="right">
|
||||
<paper-icon-button icon="more-vert" class="dropdown-trigger"></paper-icon-button>
|
||||
<paper-menu class="dropdown-content black87">
|
||||
<paper-icon-item id="unshareCharacter">
|
||||
<iron-icon icon="delete" item-icon></iron-icon>
|
||||
Unshare
|
||||
</paper-icon-item>
|
||||
</paper-menu>
|
||||
</paper-menu-button>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div bottom-item>
|
||||
<paper-tabs id="characterSheetTabs" selected={{selectedTab}} class="{{colorClass}}">
|
||||
<paper-tab name="stats" class="{{#if shouldBounce 0}}bounce{{/if}}">Stats</paper-tab>
|
||||
<paper-tab name="features" class="{{#if shouldBounce 1}}bounce{{/if}}">Features</paper-tab>
|
||||
<paper-tab name="inventory">Inventory</paper-tab>
|
||||
{{#unless hideSpellcasting}}
|
||||
<paper-tab name="spells">Spells</paper-tab>
|
||||
{{/unless}}
|
||||
<paper-tab name="persona">Persona</paper-tab>
|
||||
<paper-tab name="journal" class="{{#if shouldBounce 5}}bounce{{/if}}">Journal</paper-tab>
|
||||
</paper-tabs>
|
||||
</div>
|
||||
</app-toolbar>
|
||||
{{#if newUserExperience}}{{> newUserStepper}}{{/if}}
|
||||
</app-header>
|
||||
<div class="flex" style="position: relative;">
|
||||
<iron-pages id="tabPages" class="fit" selected={{selectedTab}}>
|
||||
<div name="stats" class="tab-page fit">{{> stats}}</div>
|
||||
<div name="features" class="tab-page fit">{{> features}}</div>
|
||||
<div name="inventory" class="tab-page fit">{{> inventory}}</div>
|
||||
{{#unless hideSpellcasting}}
|
||||
<div name="spells" class="tab-page fit">{{> spells}}</div>
|
||||
{{/unless}}
|
||||
<div name="persona" class="tab-page fit">{{> persona}}</div>
|
||||
<div name="journal" class="tab-page fit">{{> journal}}</div>
|
||||
</iron-pages>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,244 +0,0 @@
|
||||
let tabPages, tabSliders, tabFabs, tabFabMenus;
|
||||
Template.characterSheet.onRendered(function() {
|
||||
//default to the stats tab
|
||||
Session.setDefault(this.data._id + ".selectedTab", "0");
|
||||
|
||||
// Keep the header's scroll target up to date with the currently selected tab
|
||||
let header;
|
||||
this.autorun(() => {
|
||||
const tab = getTab(Template.currentData()._id);
|
||||
header = header || this.find("app-header");
|
||||
if (!header) return;
|
||||
Tracker.afterFlush(() => {
|
||||
header.scrollTarget = this.find("#tabPages .iron-selected");
|
||||
header._scrollHandler && header._scrollHandler();
|
||||
});
|
||||
});
|
||||
|
||||
_.defer(() => {
|
||||
// Store all the tab page components for use in animations
|
||||
tabPages = _.times(6, (n) =>
|
||||
this.$(`.tab-page:nth-child(${n + 1})`)
|
||||
);
|
||||
tabSliders = _.times(6, (n) =>
|
||||
tabPages[n].find(".animation-slider")
|
||||
);
|
||||
tabFabs = _.times(6, (n) =>
|
||||
tabPages[n].find(".floatyButton")
|
||||
);
|
||||
tabFabMenus = _.times(6, (n) =>
|
||||
tabPages[n].find(".mini-holder")
|
||||
);
|
||||
});
|
||||
|
||||
//watch this character and make sure their encumbrance is updated
|
||||
//trackEncumbranceConditions(this.data._id, this);
|
||||
});
|
||||
|
||||
/**
|
||||
* Page change animations that suck less than neon-animated-pages
|
||||
*/
|
||||
const tabAnimation = ({oldTab, newTab, duration}) => {
|
||||
if (newTab === oldTab) return;
|
||||
duration = duration || 400;
|
||||
const delay = (element, f) => {
|
||||
element.on(
|
||||
"transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",
|
||||
(event) => {
|
||||
if (event.target == event.currentTarget){
|
||||
f();
|
||||
$(this).off(event);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
const isForward = newTab > oldTab;
|
||||
const entryAnimation = {
|
||||
before: {
|
||||
transform: isForward ? "translateX(100%)" : "translateX(-100%)",
|
||||
},
|
||||
during: {
|
||||
transition: `transform ${duration}ms ease`,
|
||||
transform: "",
|
||||
},
|
||||
after: {
|
||||
transition: "",
|
||||
transform: "",
|
||||
},
|
||||
}
|
||||
const exitAnimation = {
|
||||
before: {
|
||||
transform: "translateZ(0)",
|
||||
},
|
||||
during: {
|
||||
transition: `transform ${duration}ms ease`,
|
||||
transform: isForward ? "translateX(-100%)" : "translateX(100%)",
|
||||
},
|
||||
after: {
|
||||
transition: "",
|
||||
transform: "",
|
||||
display: "",
|
||||
},
|
||||
}
|
||||
const oldPage = tabPages[oldTab];
|
||||
const newPage = tabPages[newTab];
|
||||
if (oldPage.length && newPage.length){
|
||||
oldPage[0].style.setProperty("display", "initial", "important");
|
||||
oldPage.css({zIndex: "1"});
|
||||
newPage.css({zIndex: "0"});
|
||||
_.defer(() => {
|
||||
oldPage.css({
|
||||
transition: `z-index ${duration}ms linear`,
|
||||
zIndex: "0",
|
||||
});
|
||||
newPage.css({
|
||||
transition: `z-index ${duration}ms linear`,
|
||||
zIndex: "1",
|
||||
});
|
||||
});
|
||||
delay(oldPage, () => oldPage.css({
|
||||
display: "",
|
||||
transition: "",
|
||||
zIndex: "",
|
||||
}));
|
||||
delay(newPage, () => newPage.css({
|
||||
transition: "",
|
||||
zIndex: "",
|
||||
}));
|
||||
}
|
||||
const oldSlider = tabSliders[oldTab];
|
||||
if (oldSlider.length){
|
||||
oldSlider.css(exitAnimation.before);
|
||||
_.defer(() => oldSlider.css(exitAnimation.during));
|
||||
delay(oldSlider, () => oldSlider.css(exitAnimation.after));
|
||||
}
|
||||
const newSlider = tabSliders[newTab];
|
||||
if (newSlider.length){
|
||||
newSlider.css(entryAnimation.before);
|
||||
_.defer(() => newSlider.css(entryAnimation.during));
|
||||
delay(newSlider, () => newSlider.css(entryAnimation.after));
|
||||
}
|
||||
slideDown = ({element, reverse}) => {
|
||||
element.css({
|
||||
transform: reverse ? "translateY(80px)" : "",
|
||||
});
|
||||
const fraction = duration / 4;
|
||||
_.defer(() => element.css({
|
||||
transition: reverse ?
|
||||
`transform ${fraction}ms ease-out ${duration - fraction}ms` :
|
||||
`transform ${fraction}ms ease-in`,
|
||||
transform: reverse ? "" : "translateY(80px)",
|
||||
}));
|
||||
delay(element, () => element.css({
|
||||
transition: "",
|
||||
}));
|
||||
}
|
||||
|
||||
const oldFab = tabFabs[oldTab];
|
||||
const newFab = tabFabs[newTab];
|
||||
if (oldFab.length && !newFab.length){
|
||||
slideDown({element: oldFab});
|
||||
}
|
||||
if (newFab.length && !oldFab.length){
|
||||
slideDown({element: newFab, reverse: true});
|
||||
}
|
||||
if (newFab.length && oldFab.length){
|
||||
newFab.css({transform: ""});
|
||||
}
|
||||
|
||||
const oldFabMenu = tabFabMenus[oldTab];
|
||||
if (oldFabMenu.length) {
|
||||
Blaze.getView(oldFabMenu[0]).templateInstance().active.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
var setTab = function(charId, tab){
|
||||
tabAnimation({
|
||||
oldTab: +Session.get(charId + ".selectedTab"),
|
||||
newTab: +tab,
|
||||
});
|
||||
return Session.set(charId + ".selectedTab", tab);
|
||||
};
|
||||
|
||||
var getTab = function(charId){
|
||||
return Session.get(charId + ".selectedTab");
|
||||
};
|
||||
|
||||
Template.characterSheet.helpers({
|
||||
printing: function(){
|
||||
return Session.get("isPrinting");
|
||||
},
|
||||
printUrl: function(){
|
||||
return `/character/${this._id}/${this.urlName || "-"}/print`
|
||||
},
|
||||
selectedTab: function(){
|
||||
return getTab(this._id);
|
||||
},
|
||||
hideSpellcasting: function() {
|
||||
var char = Characters.findOne(this._id);
|
||||
return char && char.settings.hideSpellcasting;
|
||||
},
|
||||
newUserExperience: function(){
|
||||
var char = Characters.findOne(this._id);
|
||||
return char && char.settings.newUserExperience;
|
||||
},
|
||||
shouldBounce: function(tab){
|
||||
const selected = Session.get(this._id + ".selectedTab")
|
||||
const step = Session.get("newUserExperienceStep");
|
||||
if (selected == tab) return false;
|
||||
return (tab === 1 && step === 0) ||
|
||||
(tab === 5 && step === 1) ||
|
||||
(tab === 0 && step === 2);
|
||||
},
|
||||
});
|
||||
|
||||
Template.characterSheet.events({
|
||||
"iron-select #characterSheetTabs": function(event, instance){
|
||||
setTab(this._id, event.target.selected);
|
||||
},
|
||||
"color-change": function(event, instance){
|
||||
console.log("character color change")
|
||||
Characters.update(this._id, {$set: {color: event.color}});
|
||||
},
|
||||
"click #deleteCharacter": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "deleteCharacterConfirmation",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
callback: (result) => {
|
||||
if (result === true){
|
||||
Router.go("/characterList");
|
||||
Tracker.afterFlush(() => Characters.remove(this._id));
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
"click #shareCharacter": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "shareDialog",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
"click #characterSettings": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "characterSettings",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
"click #characterExport": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "exportDialog",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
"click #unshareCharacter": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "unshareCharacterConfirmation",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,25 +0,0 @@
|
||||
.effectEdit .operationDropDown {
|
||||
width: 152px;
|
||||
}
|
||||
|
||||
.effectEdit .statDropDown {
|
||||
width: 152px;
|
||||
}
|
||||
|
||||
.effectEdit .damageMultiplierDropDown {
|
||||
width: 152px;
|
||||
}
|
||||
|
||||
.effectEdit .deleteEffect {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.effectEdit .effect-table-view {
|
||||
align-self: center;
|
||||
color: #757575;
|
||||
color: rgba(0,0,0,0.54);
|
||||
}
|
||||
|
||||
.effectEdit .iron-selected {
|
||||
color: #ad2a1f;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<template name="effectEdit">
|
||||
{{#with effect}}
|
||||
{{#baseEditDialog hideColor=true title="Effect"}}
|
||||
<div class="fit layout vertical effectEdit" style="padding: 24px;">
|
||||
<table class="paper-font-display1 effect-table-view">
|
||||
<tr>
|
||||
{{> effectView}}
|
||||
</tr>
|
||||
</table>
|
||||
<hr class="vertMargin" style="width: 100%;">
|
||||
{{#if showEffectValueInput}}
|
||||
<paper-input class="effectValueInput"
|
||||
label="Value"
|
||||
floatinglabel
|
||||
value={{effectValue}}>
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
{{else}}
|
||||
<div style="height: 62px;"></div>
|
||||
{{/if}}
|
||||
<div class="effectEdit layout horizontal flex">
|
||||
<dicecloud-selector class="statMenu flex" selected={{stat}} selectable="paper-item" style="height: 100%; overflow-y: auto;">
|
||||
{{#each statGroups}}
|
||||
<div class="statGroupTitle clickable" style="font-weight: bold; margin-top: 16px; padding-left: 8px;">
|
||||
{{this}}
|
||||
</div>
|
||||
<iron-collapse opened={{isGroupSelected this ../stat}}>
|
||||
{{#each stats}}
|
||||
<paper-item name={{stat}} class="clickable">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</iron-collapse>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
{{#if operations}}
|
||||
<dicecloud-selector class="operationMenu flex" selected={{operation}} style="height: 100%; overflow-y: auto;">
|
||||
{{#each operations}}
|
||||
<paper-item name={{operation}} class="clickable">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
{{else}} {{#if showMultiplierOperations}}
|
||||
<dicecloud-selector class="multiplierMenu flex"
|
||||
selected={{value}}>
|
||||
<paper-item name="0.5" class="clickable">Resistance</paper-item>
|
||||
<paper-item name="2" class="clickable">Vulnerability</paper-item>
|
||||
<paper-item name="0" class="clickable">Immunity</paper-item>
|
||||
</dicecloud-selector>
|
||||
{{else}}
|
||||
<div class="flex" style="height: 100%;"></div>
|
||||
{{/if}} {{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/baseEditDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="multiplierEffectValue">
|
||||
<paper-dropdown-menu class="damageMultiplierDropDown" label="Damage Multiplier" dynamic-align>
|
||||
<dicecloud-selector class="menu multiplierMenu dropdown-content"
|
||||
selected={{value}}>
|
||||
<paper-item name="0.5">Resistance</paper-item>
|
||||
<paper-item name="2">Vulnerability</paper-item>
|
||||
<paper-item name="0">Immunity</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</template>
|
||||
@@ -1,262 +0,0 @@
|
||||
//TODO add dexterity armor
|
||||
// jscs:disable maximumLineLength
|
||||
var stats = [
|
||||
{stat: "strength", name: "Strength", group: "Ability Scores"},
|
||||
{stat: "dexterity", name: "Dexterity", group: "Ability Scores"},
|
||||
{stat: "constitution", name: "Constitution", group: "Ability Scores"},
|
||||
{stat: "intelligence", name: "Intelligence", group: "Ability Scores"},
|
||||
{stat: "wisdom", name: "Wisdom", group: "Ability Scores"},
|
||||
{stat: "charisma", name: "Charisma", group: "Ability Scores"},
|
||||
|
||||
{stat: "strengthSave", name: "Strength Save", group: "Saving Throws"},
|
||||
{stat: "dexteritySave", name: "Dexterity Save", group: "Saving Throws"},
|
||||
{stat: "constitutionSave", name: "Constitution Save", group: "Saving Throws"},
|
||||
{stat: "intelligenceSave", name: "Intelligence Save", group: "Saving Throws"},
|
||||
{stat: "wisdomSave", name: "Wisdom Save", group: "Saving Throws"},
|
||||
{stat: "charismaSave", name: "Charisma Save", group: "Saving Throws"},
|
||||
|
||||
{stat: "acrobatics", name: "Acrobatics", group: "Skills"},
|
||||
{stat: "animalHandling", name: "Animal Handling", group: "Skills"},
|
||||
{stat: "arcana", name: "Arcana", group: "Skills"},
|
||||
{stat: "athletics", name: "Athletics", group: "Skills"},
|
||||
{stat: "deception", name: "Deception", group: "Skills"},
|
||||
{stat: "history", name: "History", group: "Skills"},
|
||||
{stat: "insight", name: "Insight", group: "Skills"},
|
||||
{stat: "intimidation", name: "Intimidation", group: "Skills"},
|
||||
{stat: "investigation", name: "Investigation", group: "Skills"},
|
||||
{stat: "medicine", name: "Medicine", group: "Skills"},
|
||||
{stat: "nature", name: "Nature", group: "Skills"},
|
||||
{stat: "perception", name: "Perception", group: "Skills"},
|
||||
{stat: "performance", name: "Performance", group: "Skills"},
|
||||
{stat: "persuasion", name: "Persuasion", group: "Skills"},
|
||||
{stat: "religion", name: "Religion", group: "Skills"},
|
||||
{stat: "sleightOfHand", name: "Sleight of Hand", group: "Skills"},
|
||||
{stat: "stealth", name: "Stealth", group: "Skills"},
|
||||
{stat: "survival", name: "Survival", group: "Skills"},
|
||||
{stat: "initiative", name: "Initiative", group: "Skills"},
|
||||
|
||||
{stat: "hitPoints", name: "Hit Points", group: "Stats"},
|
||||
{stat: "tempHP", name: "Temporary Hit Points", group: "Stats"},
|
||||
{stat: "armor", name: "Armor", group: "Stats"},
|
||||
{stat: "dexterityArmor", name: "Dexterity Armor Bonus", group: "Stats"},
|
||||
{stat: "speed", name: "Speed", group: "Stats"},
|
||||
{stat: "proficiencyBonus", name: "Proficiency Bonus", group: "Stats"},
|
||||
{stat: "ki", name: "Ki Points", group: "Stats"},
|
||||
{stat: "sorceryPoints", name: "Sorcery Points", group: "Stats"},
|
||||
{stat: "rages", name: "Rages", group: "Stats"},
|
||||
{stat: "rageDamage", name: "Rage Damage", group: "Stats"},
|
||||
{stat: "expertiseDice", name: "Expertise Dice", group: "Stats"},
|
||||
{stat: "superiorityDice", name: "Superiority Dice", group: "Stats"},
|
||||
{stat: "carryMultiplier", name: "Carry Capacity Multiplier", group: "Stats"},
|
||||
|
||||
{stat: "level1SpellSlots", name: "level 1", group: "Spell Slots"},
|
||||
{stat: "level2SpellSlots", name: "level 2", group: "Spell Slots"},
|
||||
{stat: "level3SpellSlots", name: "level 3", group: "Spell Slots"},
|
||||
{stat: "level4SpellSlots", name: "level 4", group: "Spell Slots"},
|
||||
{stat: "level5SpellSlots", name: "level 5", group: "Spell Slots"},
|
||||
{stat: "level6SpellSlots", name: "level 6", group: "Spell Slots"},
|
||||
{stat: "level7SpellSlots", name: "level 7", group: "Spell Slots"},
|
||||
{stat: "level8SpellSlots", name: "level 8", group: "Spell Slots"},
|
||||
{stat: "level9SpellSlots", name: "level 9", group: "Spell Slots"},
|
||||
|
||||
{stat: "d6HitDice", name: "d6 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d8HitDice", name: "d8 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d10HitDice", name: "d10 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d12HitDice", name: "d12 Hit Dice", group: "Hit Dice"},
|
||||
|
||||
{stat: "acidMultiplier", name: "Acid", group: "Weakness/Resistance"},
|
||||
{stat: "bludgeoningMultiplier", name: "Bludgeoning", group: "Weakness/Resistance"},
|
||||
{stat: "coldMultiplier", name: "Cold", group: "Weakness/Resistance"},
|
||||
{stat: "fireMultiplier", name: "Fire", group: "Weakness/Resistance"},
|
||||
{stat: "forceMultiplier", name: "Force", group: "Weakness/Resistance"},
|
||||
{stat: "lightningMultiplier", name: "Lightning", group: "Weakness/Resistance"},
|
||||
{stat: "necroticMultiplier", name: "Necrotic", group: "Weakness/Resistance"},
|
||||
{stat: "piercingMultiplier", name: "Piercing", group: "Weakness/Resistance"},
|
||||
{stat: "poisonMultiplier", name: "Poison", group: "Weakness/Resistance"},
|
||||
{stat: "psychicMultiplier", name: "Psychic", group: "Weakness/Resistance"},
|
||||
{stat: "radiantMultiplier", name: "Radiant", group: "Weakness/Resistance"},
|
||||
{stat: "slashingMultiplier", name: "Slashing", group: "Weakness/Resistance"},
|
||||
{stat: "thunderMultiplier", name: "Thunder", group: "Weakness/Resistance"},
|
||||
];
|
||||
|
||||
// jscs:enable maximumLineLength
|
||||
|
||||
var statsDict = _.indexBy(stats, "stat");
|
||||
var statGroups = _.groupBy(stats, "group");
|
||||
var statGroupNames = _.keys(statGroups);
|
||||
|
||||
var attributeOperations = [
|
||||
{name: "Base Value", operation: "base"},
|
||||
{name: "Add", operation: "add"},
|
||||
{name: "Multiply", operation: "mul"},
|
||||
{name: "Min", operation: "min"},
|
||||
{name: "Max", operation: "max"},
|
||||
];
|
||||
var skillOperations = [
|
||||
{name: "Add", operation: "add"},
|
||||
{name: "Multiply", operation: "mul"},
|
||||
{name: "Min", operation: "min"},
|
||||
{name: "Max", operation: "max"},
|
||||
{name: "Advantage", operation: "advantage"},
|
||||
{name: "Disadvantage", operation: "disadvantage"},
|
||||
{name: "Passive Bonus", operation: "passiveAdd"},
|
||||
{name: "Automatically Fail", operation: "fail"},
|
||||
{name: "Conditional Benefit", operation: "conditional"},
|
||||
];
|
||||
|
||||
Template.effectEdit.onRendered(function(){
|
||||
_.defer(() => {
|
||||
const statElement = this.find(".statMenu .iron-selected");
|
||||
statElement && statElement.scrollIntoView();
|
||||
const opElement = this.find(".operationMenu .iron-selected");
|
||||
opElement && opElement.scrollIntoView();
|
||||
});
|
||||
});
|
||||
|
||||
Template.effectEdit.helpers({
|
||||
effect: function(){
|
||||
return Effects.findOne(this.id);
|
||||
},
|
||||
statGroups: function(){
|
||||
return statGroupNames;
|
||||
},
|
||||
stats: function(){
|
||||
var group = this;
|
||||
return statGroups[group];
|
||||
},
|
||||
operations: function(){
|
||||
var stat = statsDict[this.stat];
|
||||
var group = stat && stat.group;
|
||||
if (group === "Weakness/Resistance") return null;
|
||||
if (group === "Saving Throws" || group === "Skills"){
|
||||
return skillOperations;
|
||||
} else {
|
||||
return attributeOperations;
|
||||
}
|
||||
},
|
||||
showMultiplierOperations: function(){
|
||||
var stat = statsDict[this.stat];
|
||||
return stat && stat.group === "Weakness/Resistance"
|
||||
},
|
||||
showEffectValueInput: function(){
|
||||
var stat = statsDict[this.stat];
|
||||
var group = stat && stat.group;
|
||||
if (
|
||||
group === "Weakness/Resistance"
|
||||
) return false;
|
||||
var op = this.operation;
|
||||
if (
|
||||
!op ||
|
||||
op === "advantage" ||
|
||||
op === "disadvantage" ||
|
||||
op === "fail"
|
||||
) return false;
|
||||
return true;
|
||||
},
|
||||
effectValue: function(){
|
||||
return this.calculation || this.value;
|
||||
},
|
||||
isGroupSelected: function(groupName, statName){
|
||||
var stat = statsDict[statName]
|
||||
return stat && (stat.group === groupName);
|
||||
},
|
||||
});
|
||||
|
||||
var setStat = function(statName, effectId){
|
||||
var setter = {stat: statName};
|
||||
var effect = Effects.findOne(this._id);
|
||||
var group = statsDict[statName].group;
|
||||
if (group === "Saving Throws" || group === "Skills"){
|
||||
// Skills must have a valid skill operation
|
||||
if (!_.contains(
|
||||
_.map(skillOperations, ao => ao.operation),
|
||||
effect.operation
|
||||
)){
|
||||
setter.operation = "add";
|
||||
}
|
||||
} else if (group !== "Weakness/Resistance"){
|
||||
// Attributes must have a valid attribute operation
|
||||
if (!_.contains(
|
||||
_.map(attributeOperations, ao => ao.operation),
|
||||
effect.operation
|
||||
)){
|
||||
setter.operation = "base";
|
||||
}
|
||||
} else {
|
||||
// Weakness/Resistance must have a mul operation and value
|
||||
if (effect.operation !== "mul"){
|
||||
setter.operation = "mul";
|
||||
}
|
||||
if (!_.contains([0, 0.5, 2], effect.value)){
|
||||
setter.value = 0.5;
|
||||
}
|
||||
}
|
||||
Effects.update(effectId, {$set: setter});
|
||||
};
|
||||
|
||||
var scrollAnimationId;
|
||||
var scrollElementToView = element => {
|
||||
var scrollFunction = function(){
|
||||
element.scrollIntoView();
|
||||
scrollAnimationId = requestAnimationFrame(scrollFunction);
|
||||
};
|
||||
return scrollFunction;
|
||||
}
|
||||
|
||||
Template.effectEdit.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Effects.softRemoveNode(instance.data.id);
|
||||
GlobalUI.deletedToast(instance.data.id, "Effects", "Effect");
|
||||
popDialogStack();
|
||||
},
|
||||
"click .statGroupTitle": function(event, instance){
|
||||
var groupName = this.toString();
|
||||
var firstStat = statGroups[groupName][0].stat;
|
||||
setStat(firstStat, instance.data.id);
|
||||
scrollAnimationId = requestAnimationFrame(scrollElementToView(event.target));
|
||||
_.delay(() => cancelAnimationFrame(scrollAnimationId), 300);
|
||||
},
|
||||
"iron-select .statMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var statName = detail.item.getAttribute("name");
|
||||
if (statName == this.stat) return;
|
||||
setStat(statName, this._id);
|
||||
},
|
||||
"iron-select .operationMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var opName = detail.item.getAttribute("name");
|
||||
if (opName == this.operation) return;
|
||||
Effects.update(this._id, {$set: {operation: opName}});
|
||||
},
|
||||
"iron-select .multiplierMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = +detail.item.getAttribute("name");
|
||||
if (value == this.value) return;
|
||||
Effects.update(this._id, {$set: {
|
||||
value: value,
|
||||
calculation: "",
|
||||
operation: "mul",
|
||||
}});
|
||||
},
|
||||
"change .effectValueInput, input .effectValueInput":
|
||||
_.debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
var numValue = value === "" ? NaN : +value;
|
||||
if (_.isFinite(numValue)){
|
||||
if (this.value === numValue) return;
|
||||
Effects.update(this._id, {
|
||||
$set: {value: numValue},
|
||||
$unset: {calculation: ""},
|
||||
});
|
||||
} else if (_.isString(value)){
|
||||
if (this.calculation === value) return;
|
||||
Effects.update(this._id, {
|
||||
$set: {calculation: value},
|
||||
$unset: {value: ""},
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
}, 400),
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
<template name="effectView">
|
||||
<td>{{statName}}</td>
|
||||
<td>{{operationName}}{{statValue}}</td>
|
||||
</template>
|
||||
@@ -1,179 +0,0 @@
|
||||
var stats = {
|
||||
"strength":{"name":"Strength"},
|
||||
"dexterity":{"name":"Dexterity"},
|
||||
"constitution":{"name":"Constitution"},
|
||||
"intelligence":{"name":"Intelligence"},
|
||||
"wisdom":{"name":"Wisdom"},
|
||||
"charisma":{"name":"Charisma"},
|
||||
|
||||
"strengthSave":{"name":"Strength Save"},
|
||||
"dexteritySave":{"name":"Dexterity Save"},
|
||||
"constitutionSave":{"name":"Constitution Save"},
|
||||
"intelligenceSave":{"name":"Intelligence Save"},
|
||||
"wisdomSave":{"name":"Wisdom Save"},
|
||||
"charismaSave":{"name":"Charisma Save"},
|
||||
|
||||
"acrobatics":{"name":"Acrobatics"},
|
||||
"animalHandling":{"name":"Animal Handling"},
|
||||
"arcana":{"name":"Arcana"},
|
||||
"athletics":{"name":"Athletics"},
|
||||
"deception":{"name":"Deception"},
|
||||
"history":{"name":"History"},
|
||||
"insight":{"name":"Insight"},
|
||||
"intimidation":{"name":"Intimidation"},
|
||||
"investigation":{"name":"Investigation"},
|
||||
"medicine":{"name":"Medicine"},
|
||||
"nature":{"name":"Nature"},
|
||||
"perception":{"name":"Perception"},
|
||||
"performance":{"name":"Performance"},
|
||||
"persuasion":{"name":"Persuasion"},
|
||||
"religion":{"name":"Religion"},
|
||||
"sleightOfHand":{"name":"Sleight of Hand"},
|
||||
"stealth":{"name":"Stealth"},
|
||||
"survival":{"name":"Survival"},
|
||||
"initiative":{"name":"Initiative"},
|
||||
|
||||
"hitPoints":{"name":"Hit Points"},
|
||||
"tempHP":{"name":"Temporary Hit Points"},
|
||||
"armor":{"name":"Armor"},
|
||||
"dexterityArmor":{"name":"Dexterity Armor Bonus"},
|
||||
"speed":{"name":"Speed"},
|
||||
"proficiencyBonus":{"name":"Proficiency Bonus"},
|
||||
"ki":{"name":"Ki Points"},
|
||||
"sorceryPoints":{"name":"Sorcery Points"},
|
||||
"rages":{"name":"Rages"},
|
||||
"rageDamage":{"name":"Rage Damage"},
|
||||
"expertiseDice":{"name":"Expertise Dice"},
|
||||
"superiorityDice":{"name":"Superiority Dice"},
|
||||
"carryMultiplier": {"name": "Carry Capacity Multiplier"},
|
||||
|
||||
"level1SpellSlots":{"name":"level 1 Spell Slots"},
|
||||
"level2SpellSlots":{"name":"level 2 Spell Slots"},
|
||||
"level3SpellSlots":{"name":"level 3 Spell Slots"},
|
||||
"level4SpellSlots":{"name":"level 4 Spell Slots"},
|
||||
"level5SpellSlots":{"name":"level 5 Spell Slots"},
|
||||
"level6SpellSlots":{"name":"level 6 Spell Slots"},
|
||||
"level7SpellSlots":{"name":"level 7 Spell Slots"},
|
||||
"level8SpellSlots":{"name":"level 8 Spell Slots"},
|
||||
"level9SpellSlots":{"name":"level 9 Spell Slots"},
|
||||
|
||||
"d6HitDice":{"name":"d6 Hit Dice"},
|
||||
"d8HitDice":{"name":"d8 Hit Dice"},
|
||||
"d10HitDice":{"name":"d10 Hit Dice"},
|
||||
"d12HitDice":{"name":"d12 Hit Dice"},
|
||||
|
||||
"acidMultiplier":{"name":"Acid damage", "group": "Weakness/Resistance"},
|
||||
"bludgeoningMultiplier":{
|
||||
"name":"Bludgeoning damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"coldMultiplier":{
|
||||
"name":"Cold damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"fireMultiplier":{
|
||||
"name":"Fire damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"forceMultiplier":{
|
||||
"name":"Force damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"lightningMultiplier":{
|
||||
"name":"Lightning damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"necroticMultiplier":{
|
||||
"name":"Necrotic damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"piercingMultiplier":{
|
||||
"name":"Piercing damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"poisonMultiplier":{
|
||||
"name":"Poison damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"psychicMultiplier":{
|
||||
"name":"Psychic damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"radiantMultiplier":{
|
||||
"name":"Radiant damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"slashingMultiplier":{
|
||||
"name":"Slashing damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
"thunderMultiplier":{
|
||||
"name":"Thunder damage", "group": "Weakness/Resistance",
|
||||
},
|
||||
};
|
||||
|
||||
var operations = {
|
||||
base: {name: "Base Value: "},
|
||||
proficiency: {name: "Proficiency"},
|
||||
add: {name: "+"},
|
||||
mul: {name: "×"},
|
||||
min: {name: "Min: "},
|
||||
max: {name: "Max: "},
|
||||
advantage: {name: "Advantage"},
|
||||
disadvantage: {name: "Disadvantage"},
|
||||
passiveAdd: {name: "Passive Bonus: "},
|
||||
fail: {name: "Automatically Fail"},
|
||||
};
|
||||
|
||||
Template.effectView.helpers({
|
||||
sourceName: function(){
|
||||
var id = this.parent.id;
|
||||
if (!id) return;
|
||||
switch (this.parent.collection){
|
||||
case "Features":
|
||||
return "Feature - " + Features.findOne(id, {fields: {name: 1}}).name;
|
||||
case "Classes":
|
||||
return Classes.findOne(id, {fields: {name: 1}}).name;
|
||||
case "Buffs":
|
||||
return "Buff - " + Buffs.findOne(id, {fields: {name: 1}}).name;
|
||||
case "Items":
|
||||
return "Equipment - " + Items.findOne(id, {fields: {name: 1}}).name;
|
||||
case "Characters":
|
||||
return Characters.findOne(this.charId, {fields: {race: 1}}).race;
|
||||
default:
|
||||
return "Inate";
|
||||
}
|
||||
},
|
||||
statName: function(){
|
||||
return stats[this.stat] && stats[this.stat].name || "No Stat";
|
||||
},
|
||||
operationName: function(){
|
||||
if (
|
||||
this.operation === "proficiency" ||
|
||||
this.operation === "conditional"
|
||||
) return null;
|
||||
if (stats[this.stat] && stats[this.stat].group === "Weakness/Resistance")
|
||||
return null;
|
||||
if (this.operation === "add" && evaluateEffect(this.charId, this) < 0)
|
||||
return null;
|
||||
return operations[this.operation] &&
|
||||
operations[this.operation].name || "No Operation";
|
||||
},
|
||||
statValue: function(){
|
||||
if (
|
||||
this.operation === "advantage" ||
|
||||
this.operation === "disadvantage" ||
|
||||
this.operation === "fail"
|
||||
){
|
||||
return null;
|
||||
}
|
||||
if (this.operation === "proficiency"){
|
||||
if (this.value == 0.5 || this.calculation == 0.5)
|
||||
return "Half Proficiency";
|
||||
if (this.value == 1 || this.calculation == 1)
|
||||
return "Proficiency";
|
||||
if (this.value == 2 || this.calculation == 2)
|
||||
return "Double Proficiency";
|
||||
}
|
||||
if (this.operation === "conditional"){
|
||||
return this.calculation || this.value;
|
||||
}
|
||||
if (stats[this.stat] && stats[this.stat].group === "Weakness/Resistance"){
|
||||
if (this.value === 0.5) return "Resistance";
|
||||
if (this.value === 2) return "Vulnerability";
|
||||
if (this.value === 0) return "Immunity";
|
||||
}
|
||||
var value = evaluateEffect(this.charId, this);
|
||||
if (_.isNumber(value)) return value;
|
||||
return this.calculation || this.value;
|
||||
},
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
.effectsEditList .effect {
|
||||
background: white;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<!--needs to be given charId, parentId and parentCollection-->
|
||||
<template name="effectsEditList">
|
||||
{{#if effects.length}}
|
||||
<div class="effectsEditList">
|
||||
<div class="paper-font-title">Effects</div>
|
||||
<table class="wideTable" style="width: 100%;">
|
||||
{{#each effects}}
|
||||
<tr class="effect" data-id={{_id}}>
|
||||
{{>effectView}}
|
||||
<td>
|
||||
<paper-icon-button class="edit-effect" icon="create">
|
||||
</paper-icon-button>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
{{/if}}
|
||||
<paper-button id="addEffectButton" class="red-button" raised>Add Effect</paper-button>
|
||||
</template>
|
||||
@@ -1,46 +0,0 @@
|
||||
Template.effectsEditList.helpers({
|
||||
effects: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"parent.collection": this.parentCollection,
|
||||
"charId": this.charId,
|
||||
};
|
||||
if (this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
var effects = Effects.find(selector).fetch();
|
||||
return _.sortBy(effects, effect => statOrder[effect.stat] || 999);
|
||||
}
|
||||
});
|
||||
|
||||
Template.effectsEditList.events({
|
||||
"tap #addEffectButton": function(event, instance){
|
||||
if (!_.isBoolean(this.enabled)) {
|
||||
this.enabled = true;
|
||||
}
|
||||
const effectId = Effects.insert({
|
||||
name: this.name,
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection,
|
||||
group: this.parentGroup,
|
||||
},
|
||||
operation: "add",
|
||||
enabled: this.enabled,
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "effectEdit",
|
||||
data: {id: effectId},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => instance.find(`tr.effect[data-id='${effectId}']`),
|
||||
});
|
||||
},
|
||||
"tap .edit-effect": function(event, template){
|
||||
pushDialogStack({
|
||||
template: "effectEdit",
|
||||
data: {id: this._id},
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
<!--needs to be given charId, (parentId or stat) and type-->
|
||||
<template name="effectsViewList">
|
||||
{{#if effects.length}}
|
||||
<div class="effects">
|
||||
<div class="spaceAfter paper-font-title">Effects</div>
|
||||
<table class="wideTable">
|
||||
{{#each effects}}
|
||||
<tr>{{>effectView}}</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,15 +0,0 @@
|
||||
Template.effectsViewList.helpers({
|
||||
effects: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId,
|
||||
};
|
||||
if (this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
let effects = Effects.find(selector, {
|
||||
fields: {parent: 0},
|
||||
}).fetch();
|
||||
return _.sortBy(effects, effect => statOrder[effect.stat] || 999);
|
||||
}
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
.exportDialog .iiexport {
|
||||
overflow-y: auto;
|
||||
width: 100% !important;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<template name="exportDialog">
|
||||
<div class="exportDialog fit layout vertical">
|
||||
{{#with character}}
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Export Character to Improved Initiative</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex layout vertical">
|
||||
<paper-toggle-button id="exportFeatures" checked={{settings.exportFeatures}}>
|
||||
Features
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="exportAttacks" checked={{settings.exportAttacks}}>
|
||||
Attacks
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="exportDescription" checked={{settings.exportDescription}}>
|
||||
Description
|
||||
</paper-toggle-button>
|
||||
<div class="paper-font-title padded">JSON</div>
|
||||
<textarea class="flex iiexport">{{improvedInitiativeJson}}</textarea>
|
||||
<paper-button id="copyExportButton" class="red-button" raised>
|
||||
<iron-icon icon="content-copy"></iron-icon>
|
||||
Copy to Clipboard
|
||||
</paper-button>
|
||||
</div>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
{{/with}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,60 +0,0 @@
|
||||
Template.exportDialog.helpers({
|
||||
character: function(){
|
||||
return Characters.findOne(this._id);
|
||||
},
|
||||
improvedInitiativeJson: function(){
|
||||
var options = {
|
||||
features: this.settings.exportFeatures,
|
||||
attacks: this.settings.exportAttacks,
|
||||
description: this.settings.exportDescription,
|
||||
}
|
||||
return improvedInitiativeJson(this._id, options);
|
||||
},
|
||||
});
|
||||
|
||||
Template.exportDialog.events({
|
||||
"change #exportFeatures": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportFeatures": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"change #exportAttacks": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportAttacks": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"change #exportDescription": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportDescription": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"click #copyExportButton": function(event, template){
|
||||
var copyTextarea = template.find(".iiexport");
|
||||
copyTextarea.select();
|
||||
var msg;
|
||||
try {
|
||||
var successful = document.execCommand("copy");
|
||||
var msg = successful ? "JSON copied to clipboard" : "Unable to copy JSON";
|
||||
} catch (err) {
|
||||
msg = "Unable to copy JSON";
|
||||
} finally {
|
||||
clearSelection();
|
||||
GlobalUI.toast(msg);
|
||||
}
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
var clearSelection = function(){
|
||||
if (window.getSelection) {
|
||||
if (window.getSelection().empty) { // Chrome
|
||||
window.getSelection().empty();
|
||||
} else if (window.getSelection().removeAllRanges) { // Firefox
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
} else if (document.selection) { // IE?
|
||||
document.selection.empty();
|
||||
}
|
||||
};
|
||||
@@ -1,95 +0,0 @@
|
||||
<template name="featureDialog">
|
||||
{{#with feature}}
|
||||
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
|
||||
{{> featureDetails}}
|
||||
{{else}}
|
||||
{{> featureEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="featureDetails">
|
||||
{{#if or canEnable hasUses}}
|
||||
<div class="layout horizontal center justified wrap">
|
||||
{{#if canEnable}}
|
||||
<paper-checkbox class="sideMargin" checked={{enabled}}>enabled</paper-checkbox>
|
||||
{{/if}}
|
||||
{{#if hasUses}}
|
||||
<div class="subhead" style="margin-right: 16px">
|
||||
Uses: {{usesLeft}}/{{usesValue}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if hasUses}}
|
||||
<div class="layout horizontal">
|
||||
<paper-button class="useFeature" disabled={{noUsesLeft}}>Use</paper-button>
|
||||
<paper-button class="resetFeature" disabled={{usesFull}}>Reset</paper-button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<hr class="vertMargin">
|
||||
{{/if}}
|
||||
|
||||
{{#if description}}
|
||||
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
|
||||
{{> effectsViewList charId=charId parentId=_id}}
|
||||
{{> proficiencyViewList charId=charId parentId=_id}}
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
|
||||
</template>
|
||||
|
||||
<template name="featureEdit">
|
||||
{{#if showNewUserExperience}}
|
||||
{{# infoBox}}
|
||||
<p>
|
||||
Features represent all the permanent things your character can do.
|
||||
</p><p>
|
||||
A feature can change a character's stats with effects,
|
||||
or give the character proficiencies, attacks, and buffs.
|
||||
</p><p>
|
||||
Give the feature a name, and close it to continue.
|
||||
</p>
|
||||
{{/infoBox}}
|
||||
{{/if}}
|
||||
<!--name-->
|
||||
<paper-input id="featureNameInput" class="fullwidth" label="Name" value={{name}}></paper-input>
|
||||
<div class="layout horizontal center wrap justified">
|
||||
<paper-dropdown-menu class=flex label="Enable Feature" style="flex-basis: 150px; max-width: 200px;">
|
||||
<dicecloud-selector selected={{enabledSelection}} class="dropdown-content enabled-dropdown">
|
||||
<paper-item name="alwaysEnabled" style="width: 150px;">
|
||||
Always Enabled
|
||||
</paper-item>
|
||||
<paper-item name="enabled">
|
||||
Enabled
|
||||
</paper-item>
|
||||
<paper-item name="disabled">
|
||||
Disabled
|
||||
</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<paper-toggle-button id="limitUseCheck" checked={{usesSet}} style="margin: 0 16px; height: 62px;">
|
||||
Limit uses
|
||||
</paper-toggle-button>
|
||||
{{#if usesSet}}
|
||||
<paper-input id="usesInput" class="flex" label="Uses" value={{uses}} style="flex-basis: 100px; max-width: 200px">
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
{{else}}
|
||||
<div class="flex" style="flex-basis: 100px; max-width: 200px"></div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="featureDescriptionInput" label="Description" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
{{> effectsEditList parentId=_id parentCollection="Features" charId=charId name=name enabled=enabled}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Features" charId=charId enabled=enabled}}
|
||||
{{> attackEditList parentId=_id parentCollection="Features" charId=charId enabled=enabled name=name}}
|
||||
{{> customBuffEditList parentId=_id parentCollection="Features" charId=charId}}
|
||||
</template>
|
||||
@@ -1,137 +0,0 @@
|
||||
Template.featureDialog.helpers({
|
||||
feature: function(){
|
||||
return Features.findOne(this.featureId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureDialog.events({
|
||||
"color-change": function(event, instance){
|
||||
Features.update(instance.data.featureId, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Features.softRemoveNode(instance.data.featureId);
|
||||
GlobalUI.deletedToast(instance.data.featureId, "Features", "Feature");
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureDetails.helpers({
|
||||
or: function(a, b){
|
||||
return a || b;
|
||||
},
|
||||
hasUses: function(){
|
||||
return this.usesValue() > 0;
|
||||
},
|
||||
noUsesLeft: function(){
|
||||
return this.usesLeft() <= 0;
|
||||
},
|
||||
usesFull: function(){
|
||||
return this.usesLeft() >= this.usesValue();
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureDetails.events({
|
||||
"click .useFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$inc: {used: 1}});
|
||||
},
|
||||
"click .resetFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$set: {used: 0}});
|
||||
},
|
||||
|
||||
"change .enabledCheckbox": function(event){
|
||||
var enabled = !this.enabled;
|
||||
Features.update(this._id, {$set: {enabled: enabled}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureEdit.helpers({
|
||||
showNewUserExperience: function(){
|
||||
return Session.get("newUserExperienceStep") === 0 ||
|
||||
Session.get("newUserExperienceStep") === 1;
|
||||
},
|
||||
usesSet: function(){
|
||||
return _.isString(this.uses);
|
||||
},
|
||||
enabledSelection: function(){
|
||||
if (this.enabled){
|
||||
if (this.alwaysEnabled){
|
||||
return "alwaysEnabled";
|
||||
} else {
|
||||
return "enabled";
|
||||
}
|
||||
} else if (this.enabled === false){ //make sure it is false, not just falsey
|
||||
return "disabled";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const debounce = (f) => _.debounce(f, 300);
|
||||
|
||||
Template.featureEdit.events({
|
||||
"input #featureNameInput": debounce(function(event){
|
||||
const input = event.currentTarget;
|
||||
var name = input.value;
|
||||
if (!name){
|
||||
input.invalid = true;
|
||||
input.errorMessage = "Name is required";
|
||||
} else {
|
||||
input.invalid = false;
|
||||
Features.update(this._id, {
|
||||
$set: {name: name}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
}),
|
||||
"input #featureDescriptionInput": debounce(function(event){
|
||||
var description = event.currentTarget.value;
|
||||
Features.update(this._id, {
|
||||
$set: {description: description}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"change #limitUseCheck": debounce(function(event){
|
||||
var currentUses = this.uses;
|
||||
var featureId = this._id;
|
||||
if (event.target.checked && !_.isString(currentUses)){
|
||||
Features.update(featureId, {
|
||||
$set: {uses: ""}
|
||||
}, {
|
||||
removeEmptyStrings: false
|
||||
});
|
||||
} else if (!event.target.checked && _.isString(currentUses)){
|
||||
Features.update(featureId, {
|
||||
$unset: {uses: ""}
|
||||
});
|
||||
}
|
||||
}),
|
||||
"input #usesInput, input #quantityInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {
|
||||
$set: {uses: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
});
|
||||
}),
|
||||
"iron-select .enabled-dropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
var setter;
|
||||
if (value === "enabled"){
|
||||
setter = {enabled: true, alwaysEnabled: false};
|
||||
} else if (value === "disabled"){
|
||||
setter = {enabled: false, alwaysEnabled: false};
|
||||
} else {
|
||||
setter = {enabled: true, alwaysEnabled: true};
|
||||
}
|
||||
if (setter.enabled === this.enabled &&
|
||||
setter.alwaysEnabled === this.alwaysEnabled) return;
|
||||
Features.update(this._id, {$set: setter});
|
||||
},
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
.containerTop {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.featureCardTop {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.card.featureCard .bottom {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.containerMain.featureDescription {
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.resourceCards paper-material.healthCard {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/*To change the ink color for checked state:*/
|
||||
.containerTop paper-checkbox::shadow #ink[checked] {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/*To change the checkbox checked color:*/
|
||||
.containerTop paper-checkbox::shadow #checkbox.checked {
|
||||
background-color: #ffffff;
|
||||
background-color: rgba(255,255,255,0.27);
|
||||
border-color: #ffffff;
|
||||
border-color: rgba(255,255,255,0.27);
|
||||
}
|
||||
|
||||
/*ensure the checkmark is shown when ticked*/
|
||||
.containerTop paper-checkbox::shadow #checkbox.checked #checkmark {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
/*To change the ink color for unchecked state:*/
|
||||
.containerTop paper-checkbox::shadow #ink {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/*To change the checkbox unchecked color:*/
|
||||
.containerTop paper-checkbox::shadow #checkbox {
|
||||
border-color: #ffffff;
|
||||
border-color: rgba(255,255,255,0.54);
|
||||
}
|
||||
|
||||
/*ensure checkmark isn't shown early*/
|
||||
.containerTop paper-checkbox::shadow #checkbox #checkmark {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
<template name="features">
|
||||
<div class="features">
|
||||
<div class="column-container animation-slider">
|
||||
<!--expertiseDice-->
|
||||
{{>resource name="expertiseDice" title="Expertise Dice" color="teal" char=this}}
|
||||
<!--ki-->
|
||||
{{>resource name="ki" title="Ki Points" color="teal" char=this}}
|
||||
<!--rages-->
|
||||
{{>resource name="rages" title="Rages" color="teal" char=this}}
|
||||
<!--sorceryPoints-->
|
||||
{{>resource name="sorceryPoints" title="Sorcery Points" color="teal" char=this}}
|
||||
<!--superiorityDice-->
|
||||
{{>resource name="superiorityDice" title="Superiority Dice" color="teal" char=this}}
|
||||
|
||||
<!--Attacks-->
|
||||
<div>
|
||||
<paper-material class="card">
|
||||
<div class="top white">
|
||||
Attacks
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
{{#each attack in attacks}}
|
||||
{{>attackListItem attack=attack charId=_id}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
|
||||
<!--Proficiencies-->
|
||||
<div>
|
||||
<paper-material class="card">
|
||||
<div class="white top">
|
||||
Proficiencies
|
||||
</div>
|
||||
<div flex class="bottom list">
|
||||
{{#if weaponProfs.length}}
|
||||
<div class="paper-font-subhead">Weapons</div>
|
||||
{{/if}}
|
||||
{{#each weaponProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if armorProfs.length}}
|
||||
<div class="paper-font-subhead">Armor</div>
|
||||
{{/if}}
|
||||
{{#each armorProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if toolProfs.length}}
|
||||
<div class="paper-font-subhead">Tools</div>
|
||||
{{/if}}
|
||||
{{#each toolProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
|
||||
<!--features-->
|
||||
{{#each features}}
|
||||
<div>
|
||||
<paper-material class="card featureCard" data-id={{_id}}>
|
||||
<div class="top {{colorClass}} paper-font-subhead layout horizontal">
|
||||
<div class="flex">
|
||||
{{name}}
|
||||
</div>
|
||||
{{#if hasUses}}
|
||||
<div style="margin-right: 8px">
|
||||
{{usesLeft}}/{{usesValue}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if canEnable}}
|
||||
<div>
|
||||
<paper-checkbox class="enabledCheckbox"
|
||||
checked={{enabled}}
|
||||
disabled={{#unless canEditCharacter charId}}true{{/unless}}>
|
||||
</paper-checkbox>
|
||||
{{#simpleTooltip}}Feature enabled{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if hasCharacters (evaluateShortString charId description)}}
|
||||
<div class="bottom flex">
|
||||
{{#markdown}}{{evaluateShortString charId description}}{{/markdown}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if hasUses}}
|
||||
<div class="layout horizontal center end-justified">
|
||||
<paper-button class="useFeature"
|
||||
disabled={{noUsesLeft}}>
|
||||
Use
|
||||
</paper-button>
|
||||
<paper-button class="resetFeature"
|
||||
disabled={{usesFull}}>
|
||||
Reset
|
||||
</paper-button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</paper-material>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if canEditCharacter _id}}
|
||||
<div class="floatyButton">
|
||||
<paper-fab id="addFeature"
|
||||
class="{{#if shouldFloatyButtonBounce}}bounce{{/if}}"
|
||||
icon="add">
|
||||
</paper-fab>
|
||||
{{#simpleTooltip}}Add Feature{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="resource">
|
||||
{{#if characterCalculate "attributeBase" char._id name}}
|
||||
<div>
|
||||
<paper-material class="card layout horizontal">
|
||||
<div class="left {{getColor}} paper-font-display1 white-text layout horizontal center">
|
||||
<div style="margin-right: 8px;">
|
||||
<paper-icon-button class="resourceUp"
|
||||
icon="arrow-drop-up"
|
||||
disabled={{cantIncrement}}>
|
||||
</paper-icon-button>
|
||||
<paper-icon-button class="resourceDown"
|
||||
icon="arrow-drop-down"
|
||||
disabled={{cantDecrement}}>
|
||||
</paper-icon-button>
|
||||
</div>
|
||||
<div>{{characterCalculate "attributeValue" char._id name}}</div>
|
||||
<!--<div>/{{char.attributeBase name}}</div>-->
|
||||
</div>
|
||||
<div class="right clickable flex layout horizontal center">
|
||||
{{title}}
|
||||
</div>
|
||||
<div class="layout horizontal center">
|
||||
<div class="layout vertical">
|
||||
<paper-button class="resourceResetMax" disabled={{cantIncrement}}>Reset</paper-button>
|
||||
<paper-button class="resourceResetZero" disabled={{cantDecrement}}>Clear</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
<template name="attackListItem">
|
||||
<div class="item-slot">
|
||||
<div class="flexible attack item">
|
||||
<div class="layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center"
|
||||
style="margin-right: 16px;">
|
||||
{{evaluateAttackBonus charId attack}}
|
||||
</div>
|
||||
<div class="flex layout vertical">
|
||||
<div class="paper-font-body2">
|
||||
{{attack.name}}
|
||||
</div>
|
||||
<div>
|
||||
{{evaluateDamage charId attack}} {{attack.damageType}}
|
||||
</div>
|
||||
{{#if attack.details}}
|
||||
<div>
|
||||
{{attack.details}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,188 +0,0 @@
|
||||
Template.features.helpers({
|
||||
features: function(){
|
||||
var features = Features.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
return features;
|
||||
},
|
||||
hasUses: function(){
|
||||
return this.usesValue() > 0;
|
||||
},
|
||||
noUsesLeft: function(){
|
||||
return this.usesLeft() <= 0 || !canEditCharacter(this.charId);
|
||||
},
|
||||
usesFull: function(){
|
||||
return this.usesLeft() >= this.usesValue() || !canEditCharacter(this.charId);
|
||||
},
|
||||
colorClass: function(){
|
||||
return getColorClass(this.color);
|
||||
},
|
||||
featureOrder: function(){
|
||||
return _.indexOf(_.keys(colorOptions), this.color);
|
||||
},
|
||||
attacks: function(){
|
||||
return Attacks.find(
|
||||
{charId: this._id, enabled: true},
|
||||
{sort: {color: 1, name: 1}});
|
||||
},
|
||||
canEnable: function(){
|
||||
return !this.alwaysEnabled;
|
||||
},
|
||||
weaponProfs: function(){
|
||||
var profs = Proficiencies.find({charId: this._id, type: "weapon"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
armorProfs: function(){
|
||||
var profs = Proficiencies.find({charId: this._id, type: "armor"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
toolProfs: function(){
|
||||
var profs = Proficiencies.find({charId: this._id, type: "tool"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
hasCharacters: function(string){
|
||||
return string && string.match(/\S/);
|
||||
},
|
||||
shouldFloatyButtonBounce: function(){
|
||||
const step = Session.get("newUserExperienceStep");
|
||||
return step === 0 && Features.find({charId: this._id}).count() <= 1;
|
||||
},
|
||||
});
|
||||
|
||||
Template.features.events({
|
||||
"click #addFeature": function(event, instance){
|
||||
var featureId = Features.insert({
|
||||
name: "New Feature",
|
||||
charId: this._id,
|
||||
enabled: true,
|
||||
alwaysEnabled: true,
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "featureDialog",
|
||||
data: {featureId: featureId, charId: this._id, startEditing: true},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => instance.find(`.featureCard[data-id='${featureId}']`),
|
||||
});
|
||||
},
|
||||
"click .featureCard .top": function(event){
|
||||
var featureId = this._id;
|
||||
var charId = Template.parentData()._id;
|
||||
pushDialogStack({
|
||||
template: "featureDialog",
|
||||
data: {featureId: featureId, charId: charId},
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .useFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$inc: {used: 1}});
|
||||
},
|
||||
"click .resetFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$set: {used: 0}});
|
||||
},
|
||||
"click .enabledCheckbox": function(event){
|
||||
event.stopPropagation();
|
||||
},
|
||||
"change .enabledCheckbox": function(event){
|
||||
var enabled = !this.enabled;
|
||||
Features.update(this._id, {$set: {enabled: enabled}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.resource.helpers({
|
||||
cantIncrement: function(){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
var base = Characters.calculate.attributeBase(this.char._id, this.name);
|
||||
var baseBigger = value < base;
|
||||
return !baseBigger || !canEditCharacter(this.char._id);
|
||||
},
|
||||
cantDecrement: function(){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
var valuePositive = value > 0;
|
||||
return !valuePositive || !canEditCharacter(this.char._id);
|
||||
},
|
||||
getColor: function(){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
if (value > 0){
|
||||
return this.color;
|
||||
} else {
|
||||
return "grey";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.resource.events({
|
||||
"click .resourceResetMax": function(event){
|
||||
var modifier = {$set: {}};
|
||||
modifier.$set[this.name + ".adjustment"] = 0;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
},
|
||||
"click .resourceResetZero": function(event){
|
||||
var base = Characters.calculate.attributeBase(this.char._id, this.name);
|
||||
var modifier = {$set: {}};
|
||||
modifier.$set[this.name + ".adjustment"] = -base;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
},
|
||||
"click .resourceUp": function(event){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
var base = Characters.calculate.attributeBase(this.char._id, this.name);
|
||||
if (value < base){
|
||||
var modifier = {$inc: {}};
|
||||
modifier.$inc[this.name + ".adjustment"] = 1;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
}
|
||||
},
|
||||
"click .resourceDown": function(event){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
if (value > 0){
|
||||
var modifier = {$inc: {}};
|
||||
modifier.$inc[this.name + ".adjustment"] = -1;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
}
|
||||
},
|
||||
"click .right": function(event, instance) {
|
||||
pushDialogStack({
|
||||
template: "attributeDialog",
|
||||
data: {name: this.title, statName: this.name, charId: this.char._id},
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.attackListItem.helpers({
|
||||
evaluateAttackBonus: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
bonus = evaluate(charId, attack.attackBonus, {"spellListId": spell.parent.id});
|
||||
}
|
||||
} else {
|
||||
var bonus = evaluate(charId, attack.attackBonus);
|
||||
}
|
||||
|
||||
if (_.isFinite(bonus)) {
|
||||
return bonus > 0 ? "+" + bonus : "" + bonus;
|
||||
} else {
|
||||
return bonus;
|
||||
}
|
||||
},
|
||||
evaluateDamage: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
return evaluateSpellString(charId, spell.parent.id, attack.damage);
|
||||
}
|
||||
} else {
|
||||
return evaluateString(charId, attack.damage);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.attackListItem.events({
|
||||
"click .attack": function(event, instance){
|
||||
openParentDialog({
|
||||
parent: instance.data.attack.parent,
|
||||
charId: instance.data.charId,
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
.carryCapacityBar {
|
||||
background-color: #7DC580;
|
||||
background-color: rgba(255,255,255,0.27);
|
||||
position: relative;
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
.carryCapacityBar div{
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
.carryCapacityBar .tick {
|
||||
border-right: solid 2px #E5E5E5;
|
||||
border-right-color: rgba(255,255,255,0.54);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<template name="carryCapacityBar">
|
||||
<div class="carryCapacityBar">
|
||||
<div class="carriedWeightBar"
|
||||
style="width: {{carriedPercent}}%;
|
||||
background-color: {{carriedColor}}">
|
||||
</div>
|
||||
<div class="tick"
|
||||
style="width: 33.333%;">
|
||||
</div>
|
||||
<div class="tick"
|
||||
style="width: 66.666%;">
|
||||
</div>
|
||||
</div>
|
||||
{{#if overCarriedPercent}}
|
||||
<div class="carryCapacityBar">
|
||||
<div class="carriedWeightBar"
|
||||
style="width: {{overCarriedPercent}}%;
|
||||
background-color: {{overCarriedColor}}">
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,67 +0,0 @@
|
||||
var getFractionCarried = function(char) {
|
||||
//find out the weight
|
||||
var weight = 0;
|
||||
Containers.find(
|
||||
{charId: char._id, isCarried: true}
|
||||
).forEach(function(container){
|
||||
weight += container.totalWeight();
|
||||
});
|
||||
Items.find(
|
||||
{charId: char._id, "parent.id": char._id},
|
||||
{fields: {weight : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
weight += item.totalWeight();
|
||||
});
|
||||
//get strength
|
||||
var strength = Characters.calculate.attributeValue(char._id, "strength");
|
||||
var carryMultiplier = Characters.calculate
|
||||
.attributeValue(char._id, "carryMultiplier");
|
||||
var capacity = strength * 15 * carryMultiplier;
|
||||
return weight / capacity;
|
||||
};
|
||||
|
||||
Template.carryCapacityBar.onCreated(function() {
|
||||
var self = this;
|
||||
self.carriedFraction = new ReactiveVar(0);
|
||||
self.autorun(function() {
|
||||
self.carriedFraction.set(getFractionCarried(Template.currentData()));
|
||||
});
|
||||
});
|
||||
|
||||
Template.carryCapacityBar.helpers({
|
||||
carriedPercent: function() {
|
||||
var percent = 100 * Template.instance().carriedFraction.get();
|
||||
return percent > 100 ? 100 : percent;
|
||||
},
|
||||
overCarriedPercent: function() {
|
||||
var percent = 100 * Template.instance().carriedFraction.get();
|
||||
var overPercent = percent - 100;
|
||||
if (overPercent < 0) return 0;
|
||||
if (overPercent > 100) return 100;
|
||||
return overPercent;
|
||||
},
|
||||
carriedColor: function() {
|
||||
var frac = Template.instance().carriedFraction.get();
|
||||
if (frac < 1 / 3){
|
||||
return "#2196F3";
|
||||
} else if (frac < 2 / 3){
|
||||
return "#CDDC39";
|
||||
} else if (frac < 1) {
|
||||
return "#FFC107";
|
||||
} else {
|
||||
return "#F44336";
|
||||
}
|
||||
},
|
||||
overCarriedColor: function() {
|
||||
var frac = Template.instance().carriedFraction.get();
|
||||
if (frac < 1 / 3){
|
||||
return "#2196F3";
|
||||
} else if (frac < 2 / 3){
|
||||
return "#CDDC39";
|
||||
} else if (frac < 1) {
|
||||
return "#FFC107";
|
||||
} else {
|
||||
return "#F44336";
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
<template name="carryDialog">
|
||||
{{#baseDialog title="Weight Carried" class=color hideEdit=true}}
|
||||
<div class="layout horizontal center-justified end">
|
||||
<div class="paper-font-display2">
|
||||
{{round carriedWeight 1}}
|
||||
</div>
|
||||
<div class="paper-font-display1">
|
||||
lbs
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="vertMargin">
|
||||
|
||||
{{> carryCapacityTable}}
|
||||
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
@@ -1,20 +0,0 @@
|
||||
Template.carryDialog.helpers({
|
||||
carriedWeight: function() {
|
||||
var weight = 0;
|
||||
Containers.find(
|
||||
{charId: this.charId, isCarried: true}
|
||||
).forEach(function(container){
|
||||
weight += container.totalWeight();
|
||||
});
|
||||
Items.find(
|
||||
{charId: this.charId, "parent.id": this.charId},
|
||||
{fields: {weight : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
weight += item.totalWeight();
|
||||
});
|
||||
return weight;
|
||||
},
|
||||
color: function() {
|
||||
if (this.color) return this.color + " white-text";
|
||||
},
|
||||
});
|
||||
@@ -1,45 +0,0 @@
|
||||
<template name="containerDialog">
|
||||
{{#with container}}
|
||||
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
|
||||
{{> containerView}}
|
||||
{{else}}
|
||||
{{> containerEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="containerEdit">
|
||||
<paper-input id="containerNameInput"
|
||||
label="Name"
|
||||
value={{name}}></paper-input>
|
||||
<div class="layout horizontal around-justified wrap">
|
||||
<paper-input id="weightInput" label="Weight" type="number" value={{weight}}>
|
||||
</paper-input>
|
||||
<paper-input id="valueInput" label="Value" type="number" value={{value}}>
|
||||
</paper-input>
|
||||
<paper-toggle-button id="carriedToggle" checked={{isCarried}}>
|
||||
Carried
|
||||
</paper-toggle-button>
|
||||
</div>
|
||||
|
||||
<hr class="vertMargin">
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea label="Description" id="containerDescriptionInput" value={{description}}>
|
||||
</paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="containerView">
|
||||
<div class="layout horizontal wrap center justified">
|
||||
<table class="summaryTable fullwidth">
|
||||
<tr><td>Container</td><td>{{round weight}} lbs</td><td>{{longValueString value}}</td></tr>
|
||||
<tr><td>Contents</td><td>{{round contentsWeight}} lbs</td><td>{{longValueString contentsValue}}</td></tr>
|
||||
<tr class="paper-font-body2"><td>Total</td><td>{{round totalWeight}} lbs</td><td>{{longValueString totalValue}}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
{{#if description}}
|
||||
<hr class="vertMargin">
|
||||
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,61 +0,0 @@
|
||||
Template.containerDialog.helpers({
|
||||
container: function(){
|
||||
return Containers.findOne(this.containerId);
|
||||
}
|
||||
});
|
||||
|
||||
Template.containerDialog.events({
|
||||
"color-change": function(event, instance){
|
||||
Containers.update(instance.data.containerId, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Containers.softRemoveNode(instance.data.containerId);
|
||||
GlobalUI.deletedToast(
|
||||
instance.data.containerId,
|
||||
"Containers", "Container and contents"
|
||||
);
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
Template.containerEdit.events({
|
||||
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
|
||||
"input #containerNameInput": function(event){
|
||||
var name = Template.instance().find("#containerNameInput").value;
|
||||
Containers.update(this._id, {
|
||||
$set: {name: name}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
},
|
||||
"change #weightInput, input #weightInput": function(event){
|
||||
var weight = +Template.instance().find("#weightInput").value;
|
||||
Containers.update(this._id, {
|
||||
$set: {weight: weight}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
});
|
||||
},
|
||||
"change #valueInput, input #valueInput": function(event){
|
||||
var value = +Template.instance().find("#valueInput").value;
|
||||
Containers.update(this._id, {
|
||||
$set: {value: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
});
|
||||
},
|
||||
"input #containerDescriptionInput": function(event, instance){
|
||||
var description = instance.find("#containerDescriptionInput").value;
|
||||
Containers.update(this._id, {
|
||||
$set: {description: description}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
},
|
||||
"change #carriedToggle": function(event, instance){
|
||||
var carried = !this.isCarried;
|
||||
Containers.update(this._id, {$set: {isCarried: carried}});
|
||||
}
|
||||
});
|
||||
@@ -1,180 +0,0 @@
|
||||
<template name="inventory">
|
||||
<div id="inventory" class="animation-slider">
|
||||
<div class="column-container">
|
||||
<!--Net Worth-->
|
||||
<div>
|
||||
<paper-material class="card">
|
||||
<div class="white top layout horizontal center">
|
||||
<div class="paper-font-subhead flex">
|
||||
Net Worth
|
||||
</div>
|
||||
<div>
|
||||
{{valueString netWorth}}
|
||||
</div>
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
<!--Weight Carried-->
|
||||
<div>
|
||||
<paper-material class="card">
|
||||
<div class="top green white-text weightCarried layout horizontal center">
|
||||
<div class="paper-font-subhead flex">
|
||||
Weight Carried
|
||||
</div>
|
||||
<div>
|
||||
{{round weightCarried}} lbs
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom green" style="padding: 0;">
|
||||
{{> carryCapacityBar}}
|
||||
</div>
|
||||
{{#if encumberedConditions.count}}
|
||||
<div class="bottom list">
|
||||
{{#each condition in encumberedConditions}}
|
||||
<div class="item-slot">
|
||||
<div class="item condition layout horizontal center">
|
||||
<div class="flex">
|
||||
<iron-icon icon="work"
|
||||
style="margin-right: 16px">
|
||||
</iron-icon>
|
||||
{{condition.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</paper-material>
|
||||
</div>
|
||||
<!--Equipment-->
|
||||
<div>
|
||||
<paper-material class="card equipmentContainer">
|
||||
<div class="white top layout horizontal center">
|
||||
<div class="paper-font-subhead flex">
|
||||
Equipment
|
||||
</div>
|
||||
<div class="paper-font-caption" style="margin-right: 8px">
|
||||
{{valueString equipmentValue}}
|
||||
</div>
|
||||
<div class="paper-font-caption">
|
||||
{{round equipmentWeight}} lbs
|
||||
</div>
|
||||
</div>
|
||||
<div flex class="bottom list">
|
||||
{{#if attuned.count}}
|
||||
<div class="paper-font-subhead">Attuned</div>
|
||||
{{/if}}
|
||||
{{#each attuned}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
{{#if attuned.count}}
|
||||
<div class="paper-font-subhead">Equipment</div>
|
||||
{{/if}}
|
||||
{{#each equipment}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
<!--Carried Items-->
|
||||
<div>
|
||||
<paper-material class="card carriedContainer">
|
||||
<div class="white top layout horizontal center">
|
||||
<div class="paper-font-subhead flex">
|
||||
Carried
|
||||
</div>
|
||||
<div class="paper-font-caption" style="margin-right: 8px">
|
||||
{{valueString carriedValue}}
|
||||
</div>
|
||||
<div class="paper-font-caption">
|
||||
{{round carriedWeight}} lbs
|
||||
</div>
|
||||
</div>
|
||||
<div flex class="bottom list">
|
||||
{{#each carriedItems}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
{{#each containers}}
|
||||
<div>
|
||||
<paper-material class="card itemContainer" data-id={{_id}}>
|
||||
<div class="top {{colorClass}} layout horizontal center">
|
||||
<div class="paper-font-subhead flex">
|
||||
{{name}}
|
||||
</div>
|
||||
<div class="paper-font-caption" style="margin-right: 8px">
|
||||
{{valueString totalValue}}
|
||||
</div>
|
||||
<div class="paper-font-caption" style="margin-right: 8px">
|
||||
{{round totalWeight}} lbs
|
||||
</div>
|
||||
<div style="position: relative;">
|
||||
<paper-checkbox class="carriedCheckbox"
|
||||
disabled={{#unless canEditCharacter charId}}true{{/unless}}
|
||||
checked={{isCarried}}>
|
||||
</paper-checkbox>
|
||||
{{#simpleTooltip}} Container carried{{/simpleTooltip}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
{{#each items ../_id _id}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="fab-buffer"></div>
|
||||
</div>
|
||||
{{#if canEditCharacter _id}}
|
||||
{{#fabMenu}}
|
||||
<div>
|
||||
<paper-fab icon="work"
|
||||
class="addContainer"
|
||||
mini>
|
||||
</paper-fab>
|
||||
{{#simpleTooltip class="always"}} Container {{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-fab icon="av:library-books"
|
||||
class="libraryItem"
|
||||
mini>
|
||||
</paper-fab>
|
||||
{{#simpleTooltip class="always"}} Item from library {{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-fab icon="note-add"
|
||||
class="addItem"
|
||||
mini>
|
||||
</paper-fab>
|
||||
{{#simpleTooltip class="always"}} Item {{/simpleTooltip}}
|
||||
</div>
|
||||
{{/fabMenu}}
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
<template name="inventoryItem">
|
||||
<div class="item-slot">
|
||||
<div class="item {{hidden}} inventoryItem layout horizontal center"
|
||||
draggable={{canEditCharacter charId}}
|
||||
data-id={{_id}}>
|
||||
<div class="itemName flex">
|
||||
{{#if ne1 quantity}}{{quantity}} {{/if}}{{pluralName}}
|
||||
</div>
|
||||
{{#if settings.showIncrement}}{{#if canEditCharacter charId}}
|
||||
<div class="incrementButtons">
|
||||
<paper-icon-button class="addItemQuantity"
|
||||
icon="add"
|
||||
style="margin-right: -8px"></paper-icon-button>
|
||||
<paper-icon-button class="subItemQuantity"
|
||||
disabled={{lt1 quantity}}
|
||||
icon="remove"
|
||||
style="margin-right: -8px"></paper-icon-button>
|
||||
</div>
|
||||
{{/if}}{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,353 +0,0 @@
|
||||
Template.inventory.created = function(){
|
||||
this.showAddButtons = new ReactiveVar(false);
|
||||
};
|
||||
|
||||
Template.inventory.helpers({
|
||||
containers: function(){
|
||||
return Containers.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
items: function(charId, containerId){
|
||||
return Items.find(
|
||||
{charId: charId, "parent.id": containerId},
|
||||
{sort: {color: 1, name: 1}}
|
||||
);
|
||||
},
|
||||
attuned: function(){
|
||||
return Items.find(
|
||||
{charId: this._id, enabled: true, requiresAttunement: true},
|
||||
{sort: {color: 1, name: 1}}
|
||||
);
|
||||
},
|
||||
equipment: function(){
|
||||
return Items.find(
|
||||
{charId: this._id, enabled: true, requiresAttunement: false},
|
||||
{sort: {color: 1, name: 1}}
|
||||
);
|
||||
},
|
||||
carriedItems: function(){
|
||||
return Items.find(
|
||||
{charId: this._id, enabled: false, "parent.id": this._id},
|
||||
{sort: {color: 1, name: 1}}
|
||||
);
|
||||
},
|
||||
showAddButtons: function(){
|
||||
return Template.instance().showAddButtons.get();
|
||||
},
|
||||
colorClass: function(){
|
||||
return getColorClass(this.color);
|
||||
},
|
||||
netWorth: function(){
|
||||
var worth = 0;
|
||||
Items.find(
|
||||
{charId: this._id},
|
||||
{fields: {value : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
worth += item.totalValue();
|
||||
});
|
||||
Containers.find(
|
||||
{charId: this._id},
|
||||
{fields: {value : 1}}
|
||||
).forEach(function(container) {
|
||||
if (container.value) worth += container.value;
|
||||
});
|
||||
return worth;
|
||||
},
|
||||
weightCarried: function(){
|
||||
var weight = 0;
|
||||
Containers.find(
|
||||
{charId: this._id, isCarried: true}
|
||||
).forEach(function(container){
|
||||
weight += container.totalWeight();
|
||||
});
|
||||
Items.find(
|
||||
{charId: this._id, "parent.id": this._id},
|
||||
{fields: {weight : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
weight += item.totalWeight();
|
||||
});
|
||||
return weight;
|
||||
},
|
||||
encumberedBuffs: function(){
|
||||
return Conditions.find({
|
||||
charId: this._id,
|
||||
name: {$in: [
|
||||
"Encumbered",
|
||||
"Heavily encumbered",
|
||||
"Over encumbered",
|
||||
"Can't move load",
|
||||
]},
|
||||
});
|
||||
},
|
||||
equipmentValue: function(){
|
||||
var value = 0;
|
||||
Items.find(
|
||||
{charId: this._id, enabled: true},
|
||||
{fields: {value : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
value += item.totalValue();
|
||||
});
|
||||
return value;
|
||||
},
|
||||
equipmentWeight: function(){
|
||||
var weight = 0;
|
||||
Items.find({
|
||||
charId: this._id, enabled: true,
|
||||
}, {
|
||||
fields: {weight : 1, quantity: 1}
|
||||
}).forEach(function(item){
|
||||
weight += item.totalWeight();
|
||||
});
|
||||
return weight;
|
||||
},
|
||||
carriedValue: function(){
|
||||
var value = 0;
|
||||
Items.find(
|
||||
{charId: this._id, enabled: false, "parent.id": this._id},
|
||||
{fields: {value : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
value += item.totalValue();
|
||||
});
|
||||
return value;
|
||||
},
|
||||
carriedWeight: function(){
|
||||
var weight = 0;
|
||||
Items.find(
|
||||
{charId: this._id, enabled: false, "parent.id": this._id},
|
||||
{fields: {weight : 1, quantity: 1}}
|
||||
).forEach(function(item){
|
||||
weight += item.totalWeight();
|
||||
});
|
||||
return weight;
|
||||
},
|
||||
});
|
||||
|
||||
Template.inventory.events({
|
||||
"click .addItem": function(event, instance){
|
||||
var charId = this._id;
|
||||
var itemId = Items.insert({
|
||||
charId: charId,
|
||||
parent:{
|
||||
id: charId,
|
||||
collection: "Characters",
|
||||
},
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "itemDialog",
|
||||
data: {itemId: itemId, charId: charId, startEditing: true},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => $(`[data-id='${itemId}']`).get(0),
|
||||
});
|
||||
},
|
||||
"click .libraryItem": function(event, instance){
|
||||
var charId = this._id;
|
||||
var itemId = Items.insert({
|
||||
charId: charId,
|
||||
parent:{
|
||||
id: charId,
|
||||
collection: "Characters",
|
||||
},
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "itemLibraryDialog",
|
||||
element: event.currentTarget,
|
||||
callback: (result) => {
|
||||
if (!result) {
|
||||
Items.remove(itemId);
|
||||
return;
|
||||
}
|
||||
// Make the library item into a regular item
|
||||
let item = _.omit(result, "libraryName", "library", "attacks", "effects");
|
||||
delete item.settings.category;
|
||||
// Update the item to match library item
|
||||
Items.update(itemId, {$set: item});
|
||||
// Copy over attacks and effects
|
||||
_.each(result.attacks, (attack) => {
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: itemId, collection: "Items"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(result.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: itemId, collection: "Items"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
},
|
||||
returnElement: () => $(`[data-id='${itemId}']`).get(0),
|
||||
})
|
||||
},
|
||||
"click .addContainer": function(event, instance){
|
||||
var containerId = Containers.insert({
|
||||
name: "New Container",
|
||||
isCarried: true,
|
||||
charId: this._id,
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "containerDialog",
|
||||
data: {
|
||||
containerId: containerId,
|
||||
charId: this.charId,
|
||||
startEditing: true,
|
||||
},
|
||||
element: event.currentTarget,
|
||||
returnElement: instance.find(`.itemContainer[data-id='${containerId}']`),
|
||||
});
|
||||
},
|
||||
"click .weightCarried": function(event, instance) {
|
||||
var charId = this._id;
|
||||
pushDialogStack({
|
||||
template: "carryDialog",
|
||||
data: {charId: charId, color: "green"},
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .condition": function(event, instance){
|
||||
pushDialogStack({
|
||||
template: "conditionViewDialogDialog",
|
||||
data: {condition: this.condition},
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
"click .inventoryItem": function(event, instance){
|
||||
var itemId = this._id;
|
||||
var charId = Template.parentData()._id;
|
||||
pushDialogStack({
|
||||
template: "itemDialog",
|
||||
data: {itemId: itemId, charId: charId},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => $(`[data-id='${itemId}']`).get(0),
|
||||
});
|
||||
},
|
||||
"click .incrementButtons": function(event, instance) {
|
||||
event.stopPropagation();
|
||||
},
|
||||
"click .addItemQuantity": function(event, instance) {
|
||||
var itemId = this._id;
|
||||
Items.update(itemId, {$set: {quantity: this.quantity + 1}});
|
||||
},
|
||||
"click .subItemQuantity": function(event, instance) {
|
||||
var itemId = this._id;
|
||||
Items.update(itemId, {$set: {quantity: this.quantity - 1}});
|
||||
},
|
||||
"click .itemContainer .top": function(event, instance){
|
||||
pushDialogStack({
|
||||
template: "containerDialog",
|
||||
data: {containerId: this._id, charId: this.charId},
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .carriedCheckbox": function(event, instance){
|
||||
event.stopPropagation();
|
||||
},
|
||||
"change .carriedCheckbox": function(event, instance){
|
||||
var carried;
|
||||
if (this.isCarried) carried = false;
|
||||
else carried = true;
|
||||
Containers.update(this._id, {$set: {isCarried: carried}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.inventoryItem.helpers({
|
||||
ne1: function(num){
|
||||
return num !== 1;
|
||||
},
|
||||
lt1: function(num) {
|
||||
return num < 1;
|
||||
},
|
||||
hidden: function(){
|
||||
return Session.equals("inventory.dragItemId", this._id) ? "hidden" : null;
|
||||
},
|
||||
});
|
||||
|
||||
Template.layout.events({
|
||||
"dragstart .inventoryItem": function(event, instance){
|
||||
event.originalEvent.dataTransfer.setData("dicecloud-id/items", this._id);
|
||||
Session.set("inventory.dragItemId", this._id);
|
||||
},
|
||||
"dragover .itemContainer, dragenter .itemContainer":
|
||||
function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"dragover .equipmentContainer, dragenter .equipmentContainer":
|
||||
function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"dragover .carriedContainer, dragenter .carriedContainer":
|
||||
function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"dragover .characterRepresentative, dragenter .characterRepresentative":
|
||||
function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"dragend .inventoryItem": function(event, instance){
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
"drop .itemContainer": function(event, instance){
|
||||
var itemId = event.originalEvent.dataTransfer.getData("dicecloud-id/items");
|
||||
if (event.ctrlKey){
|
||||
//split the stack to the container
|
||||
pushDialogStack({
|
||||
template: "splitStackDialog",
|
||||
data: {
|
||||
id: itemId,
|
||||
parentCollection: "Containers",
|
||||
parentId: this._id,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
//move item to the container
|
||||
Meteor.call("moveItemToContainer", itemId, this._id);
|
||||
}
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
"drop .equipmentContainer": function(event, instance){
|
||||
var itemId = event.originalEvent.dataTransfer.getData("dicecloud-id/items");
|
||||
Meteor.call("equipItem", itemId, this._id);
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
"drop .carriedContainer": function(event, instance){
|
||||
var itemId = event.originalEvent.dataTransfer.getData("dicecloud-id/items");
|
||||
if (event.ctrlKey){
|
||||
//split the stack to the container
|
||||
pushDialogStack({
|
||||
template: "splitStackDialog",
|
||||
data: {
|
||||
id: itemId,
|
||||
parentCollection: "Characters",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
//move item to the character
|
||||
Meteor.call("moveItemToCharacter", itemId, this._id);
|
||||
}
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
"drop .characterRepresentative": function(event, instance) {
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
|
||||
var itemId = event.originalEvent.dataTransfer.getData("dicecloud-id/items");
|
||||
if (event.ctrlKey){
|
||||
//split the stack to the container
|
||||
pushDialogStack({
|
||||
template: "splitStackDialog",
|
||||
data: {
|
||||
id: itemId,
|
||||
parentCollection: "Characters",
|
||||
parentId: this._id,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
//move item to the character
|
||||
Meteor.call("moveItemToCharacter", itemId, this._id);
|
||||
}
|
||||
Session.set("inventory.dragItemId", null);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
body /deep/ .itemDialogWidth {
|
||||
width: 560px;
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<template name="itemDialog">
|
||||
{{#with item}}
|
||||
{{#baseDialog title=itemHeading class=colorClass startEditing=../startEditing}}
|
||||
{{> itemDetails}}
|
||||
{{else}}
|
||||
{{> itemEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="itemDetails">
|
||||
<div class="paper-font-headline layout horizontal wrap center justified">
|
||||
{{#if weight}}<div class="sideMargin">{{round totalWeight}} lbs</div>{{/if}}
|
||||
{{#if value}}<div>{{valueString totalValue}}</div>{{/if}}
|
||||
</div>
|
||||
<div class="paper-font-caption layout horizontal wrap">
|
||||
{{#if enabled}}<div class="vertMargin" style="margin-right: 16px">Equipped</div>{{/if}}
|
||||
{{#if requiresAttunement}}<div class="vertMargin">Requires Attunement</div>{{/if}}
|
||||
</div>
|
||||
{{#if description}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=charId parentId=_id}}
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
|
||||
<template name="itemEdit">
|
||||
<paper-input class="fullwidth" id="itemNameInput" label="Name" value={{name}}></paper-input>
|
||||
<div class="layout horizontal center wrap">
|
||||
<paper-input id="quantityInput" type="number" label="Quantity" style="width: 80px" value={{quantity}}>
|
||||
</paper-input>
|
||||
{{# if ne1 quantity}}
|
||||
<paper-input class="flex" id="itemPluralInput" label="Plural Name" value={{plural}} style="flex-basis: 182px;">
|
||||
</paper-input>
|
||||
{{else}}
|
||||
<div class="flex" style="flex-basis: 182px;">
|
||||
</div>
|
||||
{{/if}}
|
||||
<paper-checkbox id="incrementCheckbox" checked={{settings.showIncrement}}>
|
||||
Show increment buttons
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="layout horizontal center wrap justified" style="margin-top: 16px;">
|
||||
{{> containerDropdown}}
|
||||
<paper-toggle-button id="equippedInput" checked={{enabled}}>
|
||||
Equipped
|
||||
</paper-toggle-button>
|
||||
<paper-checkbox id="attunementCheckbox" checked={{requiresAttunement}}>
|
||||
Requires Attunement
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="layout horizontal around-justified" style="margin-top: 16px;">
|
||||
<paper-input id="weightInput" type="number" value={{weight}} label="Weight Each (lbs)">
|
||||
</paper-input>
|
||||
<!--Value-->
|
||||
<paper-input id="valueInput" type="number" value={{value}} label="Value Each (GP)">
|
||||
</paper-input>
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="itemDescriptionInput" label="Description" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
<!--Effects-->
|
||||
{{> effectsEditList parentId=_id parentCollection="Items" charId=charId enabled=equipped name=name}}
|
||||
<!--Attacks-->
|
||||
{{> attackEditList parentId=_id parentCollection="Items" charId=charId enabled=equipped name=name}}
|
||||
<!-- Buffs -->
|
||||
{{> customBuffEditList parentId=_id parentCollection="Items" charId=charId}}
|
||||
</template>
|
||||
|
||||
<template name="containerDropdown">
|
||||
<paper-dropdown-menu label="Container">
|
||||
<dicecloud-selector class="dropdown-content" id="containerDropDown" selected={{parent.id}}>
|
||||
{{#each containers}}
|
||||
<paper-item name={{_id}} class="containerMenuItem">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</template>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user