Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45e9f491ff | ||
|
|
742b26b0de | ||
|
|
164ba78c81 | ||
|
|
e27211b24d | ||
|
|
30987752cc | ||
|
|
058ee2691f | ||
|
|
f0cf7f4956 | ||
|
|
75c8720b04 | ||
|
|
f73f2f670f | ||
|
|
c6e62e1cfa | ||
|
|
4e574c0f51 | ||
|
|
80b195b7f7 | ||
|
|
67956d9a42 | ||
|
|
64b3ca6066 | ||
|
|
8349f7da9b | ||
|
|
0636042878 | ||
|
|
6207ffa516 | ||
|
|
9d33612054 | ||
|
|
face6387a0 | ||
|
|
b308595dac | ||
|
|
1d2de197a4 | ||
|
|
a3d790b47d | ||
|
|
efe6dd87db | ||
|
|
5b33a6e783 | ||
|
|
8730fab40b | ||
|
|
992776bb40 | ||
|
|
bc9ec4421c | ||
|
|
4c31ab601c | ||
|
|
c4e77c7eae | ||
|
|
2cd6e27f70 | ||
|
|
f6b2dde479 | ||
|
|
44da62a962 | ||
|
|
4e96047e90 | ||
|
|
212986ac37 | ||
|
|
877f516565 | ||
|
|
750022f0f1 | ||
|
|
614284c73d | ||
|
|
6528fc8bab | ||
|
|
020930b2e4 | ||
|
|
dcd76e06e1 | ||
|
|
8a58002415 | ||
|
|
535fcd77cf | ||
|
|
7c2aed26a4 | ||
|
|
fab052050a | ||
|
|
b7bdb141c8 | ||
|
|
00a050d337 | ||
|
|
0b8fabde14 | ||
|
|
3336e177d9 | ||
|
|
2e9440e325 | ||
|
|
e4ac400cbd | ||
|
|
f600999c5f | ||
|
|
0af905699a | ||
|
|
6e900cfaae | ||
|
|
1f42d3c622 | ||
|
|
ee453d968f | ||
|
|
0850e59b30 | ||
|
|
f3e44cf033 | ||
|
|
907f9d15d4 | ||
|
|
4c3d5d40dd | ||
|
|
ef0deb20aa | ||
|
|
b43ee08d75 | ||
|
|
7e7f1ec997 | ||
|
|
0f652f5c74 | ||
|
|
3e02875eaf | ||
|
|
b9a5230344 | ||
|
|
28780b96c3 | ||
|
|
bec0b33805 | ||
|
|
ad9ccbe7ef | ||
|
|
e2933c2df5 | ||
|
|
87583fdac6 | ||
|
|
68e1382aed | ||
|
|
7b62c82e32 | ||
|
|
6dd92586a4 | ||
|
|
b3d0db1f02 | ||
|
|
5f35c71c9d | ||
|
|
85baf4e5d1 | ||
|
|
15d797131e | ||
|
|
06ac9f70c8 | ||
|
|
471a3e274e | ||
|
|
d4031dc4a7 | ||
|
|
18e5ab3f21 | ||
|
|
c9fe2f17a0 | ||
|
|
818cb3905f | ||
|
|
64ef426035 | ||
|
|
2b188f1a8d | ||
|
|
08735ea4f7 | ||
|
|
bce1b85600 | ||
|
|
0d023e2ba3 | ||
|
|
dad575de64 | ||
|
|
cb648b4a28 | ||
|
|
1279137362 | ||
|
|
3c06529906 | ||
|
|
a3b0c6cafd | ||
|
|
a1d9f7f5bb | ||
|
|
3b03e9c71c | ||
|
|
0eea6f2386 | ||
|
|
8f8714d3e5 | ||
|
|
7c38e8d70a | ||
|
|
826859ca3f | ||
|
|
2ca13fbb56 | ||
|
|
6d801e0178 | ||
|
|
9ddac7d5cd | ||
|
|
7a6f751e30 | ||
|
|
2389768234 | ||
|
|
c76fe99148 | ||
|
|
53afaa4f37 | ||
|
|
3599b5fbc4 | ||
|
|
275fb1ca65 | ||
|
|
d5d937b04a | ||
|
|
aa554adbce | ||
|
|
cb739eb207 | ||
|
|
66df2ea4aa | ||
|
|
bb95fe0d9a | ||
|
|
17a390a8aa | ||
|
|
b3ef43eb70 | ||
|
|
be92ef224c |
@@ -21,32 +21,40 @@
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"name": "Arrows (20)",
|
||||
"plural": "Arrows (20)",
|
||||
"libraryName": "Arrows (20)",
|
||||
"name": "Arrow",
|
||||
"plural": "Arrows",
|
||||
"description": "",
|
||||
"value": 1,
|
||||
"weight": 1
|
||||
"value": 0.05,
|
||||
"weight": 0.05,
|
||||
"quantity": 20
|
||||
},
|
||||
{
|
||||
"name": "Blowgun needles (5)",
|
||||
"plural": "Blowgun needles (5)",
|
||||
"libraryName": "Blowgun needles (5)",
|
||||
"name": "Blowgun needle",
|
||||
"plural": "Blowgun needles",
|
||||
"description": "",
|
||||
"value": 1,
|
||||
"weight": 1
|
||||
"value": 0.2,
|
||||
"weight": 0.2,
|
||||
"quantity": 5
|
||||
},
|
||||
{
|
||||
"name": "Crossbow bolts (20)",
|
||||
"plural": "Crossbow bolts (20)",
|
||||
"libraryName": "Crossbow bolts (20)",
|
||||
"name": "Crossbow bolt",
|
||||
"plural": "Crossbow bolts",
|
||||
"description": "",
|
||||
"value": 1,
|
||||
"weight": 1.5
|
||||
"value": 0.05,
|
||||
"weight": 0.075,
|
||||
"quantity": 20
|
||||
},
|
||||
{
|
||||
"name": "Sling bullets (20)",
|
||||
"plural": "Sling bullets (20)",
|
||||
"libraryName": "Sling bullets (20)",
|
||||
"name": "Sling bullet",
|
||||
"plural": "Sling bullets",
|
||||
"description": "",
|
||||
"value": 0.04,
|
||||
"weight": 1.5
|
||||
"value": 0.002,
|
||||
"weight": 0.075,
|
||||
"quantity": 20
|
||||
},
|
||||
{
|
||||
"name": "Antitoxin (vial)",
|
||||
@@ -651,11 +659,13 @@
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"name": "Spikes, iron (10)",
|
||||
"plural": "Spikes, iron (10)",
|
||||
"libraryName": "Spikes, iron (10)",
|
||||
"name": "Spike, iron",
|
||||
"plural": "Spikes, iron",
|
||||
"description": "",
|
||||
"value": 1,
|
||||
"weight": 5
|
||||
"value": 0.1,
|
||||
"weight": 0.5,
|
||||
"quantity": 10
|
||||
},
|
||||
{
|
||||
"name": "Spyglass",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,3 +13,5 @@ notices-for-facebook-graph-api-2
|
||||
1.3.0-split-minifiers-package
|
||||
1.4.0-remove-old-dev-bundle-link
|
||||
1.4.1-add-shell-server-package
|
||||
1.4.3-split-account-service-packages
|
||||
1.5-add-dynamic-import-package
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||
# but you can also edit it by hand.
|
||||
|
||||
iron:router
|
||||
accounts-password@1.3.3
|
||||
accounts-ui@1.1.9
|
||||
accounts-password@1.5.0
|
||||
accounts-ui@1.2.0
|
||||
random@1.0.10
|
||||
dburles:collection-helpers
|
||||
reactive-var@1.0.11
|
||||
@@ -18,35 +17,40 @@ dburles:mongo-collection-instances
|
||||
percolate:migrations
|
||||
ecwyne:mathjs
|
||||
useraccounts:polymer
|
||||
accounts-google@1.0.11
|
||||
accounts-google@1.3.0
|
||||
splendido:accounts-meld
|
||||
email@1.1.18
|
||||
email@1.2.3
|
||||
meteorhacks:subs-manager
|
||||
chuangbo:marked
|
||||
reywood:iron-router-ga
|
||||
meteor-base@1.0.4
|
||||
mobile-experience@1.0.4
|
||||
mongo@1.1.14
|
||||
meteor-base@1.2.0
|
||||
mobile-experience@1.0.5
|
||||
mongo@1.3.1
|
||||
blaze-html-templates
|
||||
session@1.1.7
|
||||
jquery@1.11.10
|
||||
tracker@1.1.1
|
||||
logging@1.1.16
|
||||
tracker@1.1.3
|
||||
logging@1.1.19
|
||||
reload@1.1.11
|
||||
ejson@1.0.13
|
||||
ejson@1.1.0
|
||||
spacebars
|
||||
check@1.2.4
|
||||
check@1.2.5
|
||||
useraccounts:iron-routing
|
||||
wizonesolutions:canonical
|
||||
standard-minifier-js@1.2.1
|
||||
shell-server@0.2.1
|
||||
standard-minifier-js@2.2.0
|
||||
shell-server@0.3.0
|
||||
seba:minifiers-autoprefixer
|
||||
nikogosovd:multiple-uihooks
|
||||
templates:array
|
||||
ecmascript@0.6.1
|
||||
ecmascript@0.9.0
|
||||
es5-shim@4.6.15
|
||||
differential:vulcanize
|
||||
reactive-dict
|
||||
reactive-dict@1.2.0
|
||||
percolate:synced-cron
|
||||
ongoworks:speakingurl
|
||||
service-configuration
|
||||
service-configuration@1.0.11
|
||||
google-config-ui@1.0.0
|
||||
dynamic-import@0.2.0
|
||||
ddp-rate-limiter@1.0.7
|
||||
rate-limit@1.0.8
|
||||
iron:router
|
||||
|
||||
@@ -1 +1 @@
|
||||
METEOR@1.4.2.6
|
||||
METEOR@1.6.0.1
|
||||
|
||||
@@ -1,53 +1,56 @@
|
||||
accounts-base@1.2.14
|
||||
accounts-google@1.0.11
|
||||
accounts-base@1.4.2
|
||||
accounts-google@1.3.1
|
||||
accounts-oauth@1.1.15
|
||||
accounts-password@1.3.3
|
||||
accounts-ui@1.1.9
|
||||
accounts-ui-unstyled@1.1.13
|
||||
accounts-password@1.5.0
|
||||
accounts-ui@1.2.0
|
||||
accounts-ui-unstyled@1.3.0
|
||||
aldeed:collection2@2.10.0
|
||||
aldeed:collection2-core@1.2.0
|
||||
aldeed:schema-deny@1.1.0
|
||||
aldeed:schema-index@1.1.1
|
||||
aldeed:simple-schema@1.5.3
|
||||
allow-deny@1.0.5
|
||||
allow-deny@1.1.0
|
||||
autoupdate@1.3.12
|
||||
babel-compiler@6.13.0
|
||||
babel-runtime@1.0.1
|
||||
babel-compiler@6.24.7
|
||||
babel-runtime@1.1.1
|
||||
base64@1.0.10
|
||||
binary-heap@1.0.10
|
||||
blaze@2.3.0
|
||||
blaze-html-templates@1.1.0
|
||||
blaze@2.3.2
|
||||
blaze-html-templates@1.1.2
|
||||
blaze-tools@1.0.10
|
||||
boilerplate-generator@1.0.11
|
||||
caching-compiler@1.1.9
|
||||
caching-html-compiler@1.1.0
|
||||
boilerplate-generator@1.3.1
|
||||
caching-compiler@1.1.11
|
||||
caching-html-compiler@1.1.2
|
||||
callback-hook@1.0.10
|
||||
check@1.2.4
|
||||
check@1.2.5
|
||||
chuangbo:marked@0.3.5_1
|
||||
coffeescript@1.11.1_4
|
||||
dburles:collection-helpers@1.1.0
|
||||
dburles:mongo-collection-instances@0.3.5
|
||||
ddp@1.2.5
|
||||
ddp-client@1.3.2
|
||||
ddp-common@1.2.8
|
||||
ddp-rate-limiter@1.0.6
|
||||
ddp-server@1.3.12
|
||||
ddp@1.4.0
|
||||
ddp-client@2.2.0
|
||||
ddp-common@1.3.0
|
||||
ddp-rate-limiter@1.0.7
|
||||
ddp-server@2.1.1
|
||||
deps@1.0.12
|
||||
diff-sequence@1.0.7
|
||||
differential:vulcanize@3.0.0
|
||||
ecmascript@0.6.1
|
||||
ecmascript-runtime@0.3.15
|
||||
dynamic-import@0.2.1
|
||||
ecmascript@0.9.0
|
||||
ecmascript-runtime@0.5.0
|
||||
ecmascript-runtime-client@0.5.0
|
||||
ecmascript-runtime-server@0.5.0
|
||||
ecwyne:mathjs@0.25.0
|
||||
ejson@1.0.13
|
||||
email@1.1.18
|
||||
ejson@1.1.0
|
||||
email@1.2.3
|
||||
es5-shim@4.6.15
|
||||
fastclick@1.0.13
|
||||
geojson-utils@1.0.10
|
||||
google@1.1.15
|
||||
google-config-ui@1.0.0
|
||||
google-oauth@1.2.5
|
||||
hot-code-push@1.0.4
|
||||
html-tools@1.0.11
|
||||
htmljs@1.0.11
|
||||
http@1.2.10
|
||||
http@1.3.0
|
||||
id-map@1.0.9
|
||||
iron:controller@1.0.12
|
||||
iron:core@1.0.11
|
||||
@@ -55,45 +58,46 @@ iron:dynamic-template@1.0.12
|
||||
iron:layout@1.0.12
|
||||
iron:location@1.0.11
|
||||
iron:middleware-stack@1.1.0
|
||||
iron:router@1.1.1
|
||||
iron:url@1.0.11
|
||||
iron:router@1.1.2
|
||||
iron:url@1.1.0
|
||||
jquery@1.11.10
|
||||
lai:collection-extensions@0.2.1_1
|
||||
launch-screen@1.1.0
|
||||
less@2.7.9
|
||||
launch-screen@1.1.1
|
||||
less@2.7.12
|
||||
livedata@1.0.18
|
||||
localstorage@1.0.12
|
||||
logging@1.1.16
|
||||
localstorage@1.2.0
|
||||
logging@1.1.19
|
||||
matb33:collection-hooks@0.8.4
|
||||
mdg:validation-error@0.5.1
|
||||
meteor@1.6.0
|
||||
meteor-base@1.0.4
|
||||
meteor@1.8.2
|
||||
meteor-base@1.2.0
|
||||
meteorhacks:subs-manager@1.6.4
|
||||
minifier-css@1.2.16
|
||||
minifier-js@1.2.17
|
||||
minimongo@1.0.19
|
||||
mobile-experience@1.0.4
|
||||
mobile-status-bar@1.0.13
|
||||
modules@0.7.7
|
||||
modules-runtime@0.7.8
|
||||
momentjs:moment@2.17.1
|
||||
mongo@1.1.14
|
||||
minifier-js@2.2.2
|
||||
minimongo@1.4.3
|
||||
mobile-experience@1.0.5
|
||||
mobile-status-bar@1.0.14
|
||||
modules@0.11.3
|
||||
modules-runtime@0.9.2
|
||||
momentjs:moment@2.20.1
|
||||
mongo@1.3.1
|
||||
mongo-dev-server@1.1.0
|
||||
mongo-id@1.0.6
|
||||
nikogosovd:multiple-uihooks@0.1.8
|
||||
npm-bcrypt@0.9.2
|
||||
npm-mongo@2.2.16_1
|
||||
oauth@1.1.12
|
||||
oauth2@1.1.11
|
||||
observe-sequence@1.0.14
|
||||
npm-bcrypt@0.9.3
|
||||
npm-mongo@2.2.34
|
||||
oauth@1.2.1
|
||||
oauth2@1.2.0
|
||||
observe-sequence@1.0.16
|
||||
ongoworks:speakingurl@9.0.0
|
||||
ordered-dict@1.0.9
|
||||
percolate:migrations@0.9.8
|
||||
percolate:synced-cron@1.3.2
|
||||
promise@0.8.8
|
||||
promise@0.10.1
|
||||
raix:eventemitter@0.1.3
|
||||
random@1.0.10
|
||||
rate-limit@1.0.6
|
||||
reactive-dict@1.1.8
|
||||
rate-limit@1.0.8
|
||||
reactive-dict@1.2.0
|
||||
reactive-var@1.0.11
|
||||
reload@1.1.11
|
||||
retry@1.0.9
|
||||
@@ -103,27 +107,27 @@ seba:minifiers-autoprefixer@1.0.1
|
||||
service-configuration@1.0.11
|
||||
session@1.1.7
|
||||
sha@1.0.9
|
||||
shell-server@0.2.1
|
||||
softwarerero:accounts-t9n@1.3.7
|
||||
spacebars@1.0.13
|
||||
spacebars-compiler@1.1.0
|
||||
shell-server@0.3.1
|
||||
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.10
|
||||
standard-minifier-js@1.2.2
|
||||
standard-minifier-js@2.2.3
|
||||
templates:array@1.0.3
|
||||
templating@1.3.0
|
||||
templating-compiler@1.3.0
|
||||
templating-runtime@1.3.0
|
||||
templating-tools@1.1.0
|
||||
tracker@1.1.1
|
||||
ui@1.0.12
|
||||
templating@1.3.2
|
||||
templating-compiler@1.3.3
|
||||
templating-runtime@1.3.2
|
||||
templating-tools@1.1.2
|
||||
tracker@1.1.3
|
||||
ui@1.0.13
|
||||
underscore@1.0.10
|
||||
url@1.0.11
|
||||
url@1.1.0
|
||||
useraccounts:core@1.14.2
|
||||
useraccounts:iron-routing@1.14.2
|
||||
useraccounts:polymer@1.14.2
|
||||
webapp@1.3.12
|
||||
webapp@1.4.0
|
||||
webapp-hashing@1.0.9
|
||||
wizonesolutions:canonical@0.0.5
|
||||
zimme:collection-behaviours@1.1.3
|
||||
|
||||
@@ -23,7 +23,7 @@ Schemas.Buff = new SimpleSchema({
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
"inate",
|
||||
"inate", //this should be "innate", but changing it could be problematic
|
||||
"custom",
|
||||
],
|
||||
},
|
||||
@@ -42,12 +42,26 @@ Schemas.Buff = new SimpleSchema({
|
||||
allowedValues: _.pluck(colorOptions, "key"),
|
||||
defaultValue: "q",
|
||||
},
|
||||
appliedBy: { //the charId of whoever applied the buff
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
},
|
||||
appliedByDetails: {//the name and collection of the thing that applied the buff
|
||||
type: Object,
|
||||
optional: true,
|
||||
},
|
||||
"appliedByDetails.name": {
|
||||
type: String,
|
||||
},
|
||||
"appliedByDetails.collection": {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
Buffs.attachSchema(Schemas.Buff);
|
||||
|
||||
Buffs.attachBehaviour("softRemovable");
|
||||
makeParent(Buffs, ["name", "enabled"]); //parents of effects
|
||||
makeParent(Buffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies
|
||||
|
||||
Buffs.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
Buffs.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
|
||||
@@ -27,6 +27,7 @@ Schemas.Character = new SimpleSchema({
|
||||
|
||||
//stats
|
||||
hitPoints: {type: Schemas.Attribute},
|
||||
tempHP: {type: Schemas.Attribute},
|
||||
experience: {type: Schemas.Attribute},
|
||||
proficiencyBonus: {type: Schemas.Attribute},
|
||||
speed: {type: Schemas.Attribute},
|
||||
@@ -163,9 +164,9 @@ Schemas.Character = new SimpleSchema({
|
||||
|
||||
//permissions
|
||||
party: {type: String, regEx: SimpleSchema.RegEx.Id, optional: true},
|
||||
owner: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
readers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: []},
|
||||
writers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: []},
|
||||
owner: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
readers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1},
|
||||
writers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1},
|
||||
color: {
|
||||
type: String,
|
||||
allowedValues: _.pluck(colorOptions, "key"),
|
||||
@@ -184,11 +185,13 @@ Schemas.Character = new SimpleSchema({
|
||||
type: String,
|
||||
defaultValue: "whitelist",
|
||||
allowedValues: ["whitelist", "public"],
|
||||
index: 1,
|
||||
},
|
||||
"settings.swapStatAndModifier": {type: Boolean, defaultValue: false},
|
||||
"settings.exportFeatures": {type: Boolean, defaultValue: true},
|
||||
"settings.exportAttacks": {type: Boolean, defaultValue: true},
|
||||
"settings.exportDescription": {type: Boolean, defaultValue: true},
|
||||
"settings.newUserExperience": {type: Boolean, optional: true},
|
||||
});
|
||||
|
||||
Characters.attachSchema(Schemas.Character);
|
||||
@@ -282,6 +285,7 @@ if (Meteor.isClient) {
|
||||
|
||||
//create a local memoize with a argument concatenating hash function
|
||||
var memoize = function(f) {
|
||||
if (Meteor.isServer) return f;
|
||||
return Tracker.memoize(f, function() {
|
||||
return _.reduce(arguments, function(memo, arg) {
|
||||
return memo + arg;
|
||||
@@ -295,6 +299,7 @@ Characters.calculate = {
|
||||
var fieldSelector = {};
|
||||
fieldSelector[fieldName] = 1;
|
||||
var char = Characters.findOne(charId, {fields: fieldSelector});
|
||||
if (!char) return;
|
||||
var field = char[fieldName];
|
||||
if (field === undefined){
|
||||
throw new Meteor.Error(
|
||||
@@ -328,6 +333,7 @@ Characters.calculate = {
|
||||
},
|
||||
attributeValue: memoize(function(charId, attributeName){
|
||||
var attribute = Characters.calculate.getField(charId, attributeName);
|
||||
if (!attribute) return;
|
||||
//base value
|
||||
var value = Characters.calculate.attributeBase(charId, attributeName);
|
||||
//plus adjustment
|
||||
@@ -339,6 +345,7 @@ Characters.calculate = {
|
||||
}),
|
||||
skillMod: memoize(preventLoop(function(charId, skillName){
|
||||
var skill = Characters.calculate.getField(charId, skillName);
|
||||
if (!skill) return;
|
||||
//get the final value of the ability score
|
||||
var ability = Characters.calculate.attributeValue(charId, skill.ability);
|
||||
|
||||
@@ -390,7 +397,6 @@ Characters.calculate = {
|
||||
return prof && prof.value || 0;
|
||||
}),
|
||||
passiveSkill: memoize(function(charId, skillName){
|
||||
var skill = Characters.calculate.getField(charId, skillName);
|
||||
var mod = +Characters.calculate.skillMod(charId, skillName);
|
||||
var value = 10 + mod;
|
||||
Effects.find(
|
||||
@@ -533,6 +539,7 @@ if (Meteor.isServer){
|
||||
Attacks .remove({charId: character._id});
|
||||
Buffs .remove({charId: character._id});
|
||||
Classes .remove({charId: character._id});
|
||||
CustomBuffs .remove({charId: character._id});
|
||||
Effects .remove({charId: character._id});
|
||||
Experiences .remove({charId: character._id});
|
||||
Features .remove({charId: character._id});
|
||||
@@ -550,6 +557,10 @@ if (Meteor.isServer){
|
||||
});
|
||||
Characters.before.insert(function(userId, doc) {
|
||||
doc.urlName = getSlug(doc.name, {maintainCase: true}) || "-";
|
||||
// The first character a user creates should have the new user experience
|
||||
if (!Characters.find({owner: userId}).count()){
|
||||
doc.settings.newUserExperience = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
42
rpg-docs/Model/Character/Conditions.js
Normal file
42
rpg-docs/Model/Character/Conditions.js
Normal file
@@ -0,0 +1,42 @@
|
||||
Conditions = new Mongo.Collection("conditions");
|
||||
|
||||
Schemas.Conditions = new SimpleSchema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
index: 1,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
"lifeTime.total": {
|
||||
type: Number,
|
||||
defaultValue: 0, //0 is infinite
|
||||
min: 0,
|
||||
},
|
||||
"lifeTime.spent": {
|
||||
type: Number,
|
||||
defaultValue: 0,
|
||||
min: 0,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
allowedValues: _.pluck(colorOptions, "key"),
|
||||
defaultValue: "q",
|
||||
},
|
||||
});
|
||||
|
||||
Conditions.attachSchema(Schemas.Conditions);
|
||||
|
||||
Conditions.attachBehaviour("softRemovable");
|
||||
makeParent(Conditions, ["name"]); //parents of effects, attacks, proficiencies
|
||||
|
||||
Conditions.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
Conditions.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
53
rpg-docs/Model/Character/CustomBuffs.js
Normal file
53
rpg-docs/Model/Character/CustomBuffs.js
Normal file
@@ -0,0 +1,53 @@
|
||||
CustomBuffs = new Mongo.Collection("customBuffs");
|
||||
|
||||
Schemas.CustomBuff = new SimpleSchema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
index: 1,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
"self",
|
||||
"others",
|
||||
"both"
|
||||
],
|
||||
defaultValue: "self",
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
autoValue: function(){
|
||||
return false;
|
||||
//enabled is ALWAYS false on these, so that its children are also not enabled, so that the buff templates have no effects.
|
||||
},
|
||||
},
|
||||
"lifeTime.total": {
|
||||
type: Number,
|
||||
defaultValue: 0, //0 is infinite
|
||||
min: 0,
|
||||
},
|
||||
//the id of the feature, buff or item that creates this buff
|
||||
parent: {
|
||||
type: Schemas.Parent,
|
||||
},
|
||||
});
|
||||
|
||||
CustomBuffs.attachSchema(Schemas.CustomBuff);
|
||||
|
||||
CustomBuffs.attachBehaviour("softRemovable");
|
||||
makeParent(CustomBuffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies. Since this represents a template, "enabled" is always false.
|
||||
makeChild(CustomBuffs); //children of lots of things
|
||||
|
||||
CustomBuffs.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
CustomBuffs.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
@@ -83,3 +83,170 @@ Spells.after.update(function (userId, spell, fieldNames) {
|
||||
|
||||
Spells.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
Spells.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
|
||||
|
||||
|
||||
|
||||
var checkMovePermission = function(spellId, parent, destinationOnly) {
|
||||
var spell = Spells.findOne(spellId);
|
||||
if (!spell)
|
||||
throw new Meteor.Error("No such spell",
|
||||
"An spell could not be found to move");
|
||||
//handle permissions
|
||||
var permission;
|
||||
|
||||
if (!destinationOnly) { //if we're not modifying the origin, only the destination
|
||||
permission = Meteor.call("canWriteCharacter", spell.charId);
|
||||
if (!permission){
|
||||
throw new Meteor.Error("Access denied",
|
||||
"Not permitted to move spells from this character");
|
||||
}
|
||||
}
|
||||
if (parent.collection === "Characters"){
|
||||
permission = Meteor.call("canWriteCharacter", parent.id);
|
||||
if (!permission){
|
||||
throw new Meteor.Error("Access denied",
|
||||
"Not permitted to move spells to this character");
|
||||
}
|
||||
} else {
|
||||
var parentCollectionObject = global[parent.collection];
|
||||
var parentObject = null;
|
||||
if (parentCollectionObject)
|
||||
parentObject = parentCollectionObject.findOne(
|
||||
parent.id, {fields: {_id: 1, charId: 1}}
|
||||
);
|
||||
if (!parentObject) throw new Meteor.Error(
|
||||
"Invalid parent",
|
||||
"The destination parent " + parent.id +
|
||||
" does not exist in the collection " + parent.collection
|
||||
);
|
||||
if (parentObject.charId){
|
||||
permission = Meteor.call("canWriteCharacter", parentObject.charId);
|
||||
if (!permission){
|
||||
throw new Meteor.Error("Access denied",
|
||||
"Not permitted to move spells to this character");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var moveSpell = function(spellId, targetCollection, targetId) {
|
||||
var spell = Spells.findOne(spellId);
|
||||
if (!spell) return;
|
||||
targetCollection = targetCollection || spell.parent.collection;
|
||||
targetId = targetId || spell.parent.id;
|
||||
|
||||
if (Meteor.isServer) {
|
||||
checkMovePermission(spellId, {collection: targetCollection, id: targetId}, false);
|
||||
}
|
||||
|
||||
if (targetCollection == "Characters") { //then we are copying the spell to a different character.
|
||||
targetList = SpellLists.findOne({"charId": targetId});
|
||||
targetListId = targetList && targetList._id;
|
||||
if (!targetListId) {
|
||||
targetListId = SpellLists.insert({ //create a spell list if we don't already have one
|
||||
name: "New SpellList",
|
||||
charId: targetId,
|
||||
saveDC: "8 + intelligenceMod + proficiencyBonus",
|
||||
attackBonus: "intelligenceMod + proficiencyBonus",
|
||||
});
|
||||
}
|
||||
|
||||
Spells.update(
|
||||
spellId,
|
||||
{$set: {
|
||||
charId: targetId,
|
||||
"parent.collection": "SpellLists",
|
||||
"parent.id": targetListId,
|
||||
}}
|
||||
);
|
||||
}
|
||||
else { //we are moving the spell within the same character
|
||||
//update the spell provided the update will actually change something
|
||||
if (
|
||||
spell.parent.collection !== targetCollection ||
|
||||
spell.parent.id !== targetId
|
||||
){
|
||||
Spells.update(
|
||||
spellId,
|
||||
{$set: {
|
||||
"parent.collection": targetCollection,
|
||||
"parent.id": targetId,
|
||||
}}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var copySpell = function(spellId, targetCollection, targetId) {
|
||||
var spell = Spells.findOne(spellId);
|
||||
if (!spell) return;
|
||||
targetCollection = targetCollection || spell.parent.collection;
|
||||
targetId = targetId || spell.parent.id;
|
||||
|
||||
if (Meteor.isServer) {
|
||||
checkMovePermission(spellId, {collection: targetCollection, id: targetId}, true); //we're only reading from the source character
|
||||
}
|
||||
|
||||
|
||||
if (targetCollection == "Characters") { //then we are copying the spell to a different character.
|
||||
targetList = SpellLists.findOne({"charId": targetId});
|
||||
targetListId = targetList && targetList._id;
|
||||
if (!targetListId) {
|
||||
targetListId = SpellLists.insert({ //create a spell list if we don't already have one
|
||||
name: "New SpellList",
|
||||
charId: targetId,
|
||||
saveDC: "8 + intelligenceMod + proficiencyBonus",
|
||||
attackBonus: "intelligenceMod + proficiencyBonus",
|
||||
});
|
||||
}
|
||||
|
||||
newSpell = _.clone(spell);
|
||||
delete newSpell._id;
|
||||
newSpellId = Spells.insert(newSpell); //add a new copy of the spell
|
||||
Spells.update(
|
||||
newSpellId,
|
||||
{$set: {
|
||||
charId: targetId,
|
||||
"parent.collection": "SpellLists",
|
||||
"parent.id": targetListId,
|
||||
}}
|
||||
);
|
||||
}
|
||||
else { //else we are copying the spell within the same character
|
||||
newSpell = _.clone(spell);
|
||||
delete newSpell._id;
|
||||
newSpellId = Spells.insert(newSpell); //add a new copy of the spell
|
||||
Spells.update(
|
||||
newSpellId,
|
||||
{$set: {
|
||||
"parent.collection": targetCollection,
|
||||
"parent.id": targetId,
|
||||
}}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Meteor.methods({
|
||||
moveSpellToList: function(spellId, spellListId) {
|
||||
check(spellId, String);
|
||||
check(spellListId, String);
|
||||
moveSpell(spellId, "SpellLists", spellListId);
|
||||
},
|
||||
copySpellToList: function(spellId, spellListId) {
|
||||
check(spellId, String);
|
||||
check(spellListId, String);
|
||||
copySpell(spellId, "SpellLists", spellListId);
|
||||
},
|
||||
moveSpellToCharacter: function(spellId, charId) {
|
||||
check(spellId, String);
|
||||
check(charId, String);
|
||||
moveSpell(spellId, "Characters", charId);
|
||||
},
|
||||
copySpellToCharacter: function(spellId, charId) {
|
||||
check(spellId, String);
|
||||
check(charId, String);
|
||||
copySpell(spellId, "Characters", charId);
|
||||
},
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
LibraryItems = new Mongo.Collection("libraryItems");
|
||||
|
||||
Schemas.LibraryItems = new SimpleSchema({
|
||||
libraryName:{type: String, optional: true, trim: false},
|
||||
name: {type: String, defaultValue: "New Item", trim: false},
|
||||
plural: {type: String, optional: true, trim: false},
|
||||
description:{type: String, optional: true, trim: false},
|
||||
|
||||
9
rpg-docs/Model/Meta/Blacklist.js
Normal file
9
rpg-docs/Model/Meta/Blacklist.js
Normal file
@@ -0,0 +1,9 @@
|
||||
Blacklist = new Mongo.Collection("blacklist");
|
||||
|
||||
Schemas.Blacklist = new SimpleSchema({
|
||||
userId: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
Blacklist.attachSchema(Schemas.Blacklist);
|
||||
@@ -1,3 +1,75 @@
|
||||
Schemas.UserProfile = new SimpleSchema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
Schemas.User = new SimpleSchema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
profile: {
|
||||
type: Schemas.UserProfile,
|
||||
optional: true,
|
||||
},
|
||||
emails: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
},
|
||||
"emails.$": {
|
||||
type: Object,
|
||||
},
|
||||
"emails.$.address": {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Email,
|
||||
},
|
||||
"emails.$.verified": {
|
||||
type: Boolean,
|
||||
},
|
||||
registered_emails: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
},
|
||||
"registered_emails.$": {
|
||||
type: Object,
|
||||
blackbox: true,
|
||||
},
|
||||
createdAt: {
|
||||
type: Date
|
||||
},
|
||||
services: {
|
||||
type: Object,
|
||||
optional: true,
|
||||
blackbox: true,
|
||||
},
|
||||
roles: {
|
||||
type: Object,
|
||||
optional: true,
|
||||
blackbox: true,
|
||||
},
|
||||
roles: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
},
|
||||
"roles.$": {
|
||||
type: String
|
||||
},
|
||||
// In order to avoid an 'Exception in setInterval callback' from Meteor
|
||||
heartbeat: {
|
||||
type: Date,
|
||||
optional: true,
|
||||
},
|
||||
apiKey: {
|
||||
type: String,
|
||||
index: 1,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.users.attachSchema(Schemas.User);
|
||||
|
||||
Meteor.users.allow({
|
||||
update: function(userId, doc, fields, modifier) {
|
||||
if (
|
||||
@@ -21,3 +93,13 @@ Meteor.users.allow({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Meteor.isServer) Meteor.methods({
|
||||
generateMyApiKey() {
|
||||
var user = Meteor.users.findOne(this.userId);
|
||||
if (!user) return;
|
||||
if (user && user.apiKey) return;
|
||||
var apiKey = Random.id(30);
|
||||
Meteor.users.update(this.userId, {$set: {apiKey}});
|
||||
},
|
||||
});
|
||||
|
||||
62
rpg-docs/Routes/API.js
Normal file
62
rpg-docs/Routes/API.js
Normal file
@@ -0,0 +1,62 @@
|
||||
Router.map(function() {
|
||||
this.route("vmixCharacter", {
|
||||
path: "/vmix-character/:_id/",
|
||||
where: "server",
|
||||
action: function() {
|
||||
this.response.setHeader("Content-Type", "application/json");
|
||||
var query = this.params.query;
|
||||
var key = query && query.key;
|
||||
ifKeyValid(key, this.response, () =>
|
||||
this.response.end(vMixCharacter(this.params._id))
|
||||
);
|
||||
},
|
||||
});
|
||||
this.route("vmixParty", {
|
||||
path: "/vmix-party/:_id/",
|
||||
where: "server",
|
||||
action: function() {
|
||||
this.response.setHeader("Content-Type", "application/json");
|
||||
var query = this.params.query;
|
||||
var key = query && query.key;
|
||||
ifKeyValid(key, this.response, () =>
|
||||
this.response.end(vMixParty(this.params._id))
|
||||
);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var ifKeyValid = function(apiKey, response, callback){
|
||||
if (!apiKey){
|
||||
response.writeHead(403, "You must use an api key to access this api");
|
||||
response.end();
|
||||
} else if (!isKeyValid(apiKey)){
|
||||
response.writeHead(403, "API key is invalid");
|
||||
response.end();
|
||||
} else if (isRateLimited(apiKey)){
|
||||
response.writeHead(429, "Too many requests");
|
||||
response.end();
|
||||
} else {
|
||||
rateLimiter.increment({apiKey})
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
var isKeyValid = function(apiKey){
|
||||
var user = Meteor.users.findOne({apiKey});
|
||||
if (!user) return false;
|
||||
var blackListed = Blacklist.findOne({userId: user._id});
|
||||
return !blackListed;
|
||||
};
|
||||
|
||||
var rateLimiter = new RateLimiter();
|
||||
rateLimiter.addRule({apiKey: String}, 2, 10000);
|
||||
|
||||
var isRateLimited = function(apiKey){
|
||||
const limited = !rateLimiter.check({apiKey}).allowed
|
||||
if (limited) {
|
||||
console.log(`Rate limit hit by API key ${apiKey}`);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,11 @@ Router.plugin("ensureSignedIn", {
|
||||
|
||||
Router.plugin("dataNotFound", {notFoundTemplate: "notFound"});
|
||||
|
||||
var handleSubError = function(e){
|
||||
Session.set("error", {reason: e.reason, href: location.href});
|
||||
Router.go("/error");
|
||||
};
|
||||
|
||||
Router.map(function() {
|
||||
this.route("/", {
|
||||
name: "home",
|
||||
@@ -36,7 +41,9 @@ Router.map(function() {
|
||||
path: "/character/:_id/",
|
||||
waitOn: function(){
|
||||
return [
|
||||
subsManager.subscribe("singleCharacter", this.params._id),
|
||||
subsManager.subscribe(
|
||||
"singleCharacter", this.params._id, {onError: handleSubError}
|
||||
),
|
||||
];
|
||||
},
|
||||
action: function(){
|
||||
@@ -52,7 +59,9 @@ Router.map(function() {
|
||||
path: "/character/:_id/:urlName",
|
||||
waitOn: function(){
|
||||
return [
|
||||
subsManager.subscribe("singleCharacter", this.params._id),
|
||||
subsManager.subscribe(
|
||||
"singleCharacter", this.params._id, {onError: handleSubError}
|
||||
),
|
||||
];
|
||||
},
|
||||
data: function() {
|
||||
@@ -78,6 +87,37 @@ Router.map(function() {
|
||||
fastRender: true,
|
||||
});
|
||||
|
||||
this.route("printedCharacterSheet", {
|
||||
path: "/character/:_id/:urlName/print",
|
||||
waitOn: function(){
|
||||
return [
|
||||
subsManager.subscribe(
|
||||
"singleCharacter", this.params._id, {onError: handleSubError}
|
||||
),
|
||||
];
|
||||
},
|
||||
data: function() {
|
||||
var data = Characters.findOne(
|
||||
{_id: this.params._id},
|
||||
{fields: {_id: 1, name: 1, color: 1, writers: 1, readers: 1}}
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onAfterAction: function() {
|
||||
var char = Characters.findOne({_id: this.params._id}, {fields: {name: 1}});
|
||||
var name = char && char.name;
|
||||
if (name){
|
||||
document.title = name + " - Printing";
|
||||
}
|
||||
},
|
||||
//analytics
|
||||
trackPageView: false,
|
||||
onRun: function() {
|
||||
window.ga && window.ga("send", "pageview", "/print-character");
|
||||
this.next();
|
||||
},
|
||||
});
|
||||
|
||||
this.route("library", {
|
||||
path: "/library",
|
||||
waitOn: function(){
|
||||
@@ -124,4 +164,11 @@ Router.map(function() {
|
||||
document.title = appName;
|
||||
},
|
||||
});
|
||||
|
||||
this.route("/error", {
|
||||
name: "error",
|
||||
onAfterAction: function() {
|
||||
document.title = `${appName} - Error`;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
174
rpg-docs/client/compatibility/jquery.quickfit.js
Normal file
174
rpg-docs/client/compatibility/jquery.quickfit.js
Normal file
@@ -0,0 +1,174 @@
|
||||
// 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);
|
||||
@@ -3,7 +3,8 @@ Template.registerHelper("canEditCharacter", function(charId) {
|
||||
});
|
||||
|
||||
canEditCharacter = function(charId) {
|
||||
var char = Characters.findOne(charId)
|
||||
var char = Characters.findOne(charId);
|
||||
if (!char) return false;
|
||||
var userId = Meteor.userId();
|
||||
return char.owner === userId ||
|
||||
_.contains(char.writers, userId);
|
||||
|
||||
@@ -18,6 +18,9 @@ openParentDialog = function({
|
||||
} 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});
|
||||
};
|
||||
|
||||
12
rpg-docs/client/lib/printing.js
Normal file
12
rpg-docs/client/lib/printing.js
Normal file
@@ -0,0 +1,12 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
17
rpg-docs/client/lib/removeDuplicateProficiencies.js
Normal file
17
rpg-docs/client/lib/removeDuplicateProficiencies.js
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
};
|
||||
17
rpg-docs/client/style/bounce.css
Normal file
17
rpg-docs/client/style/bounce.css
Normal file
@@ -0,0 +1,17 @@
|
||||
@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;
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
<div class="layout vertical">
|
||||
<div>
|
||||
{{evaluateDamage charId attack}} {{damageType}}
|
||||
{{evaluateDamage charId attack}} {{attack.damageType}}
|
||||
</div>
|
||||
{{#if attack.details}}
|
||||
<div class="paper-font-caption">
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<!-- 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>
|
||||
@@ -0,0 +1,32 @@
|
||||
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,15 +1,23 @@
|
||||
<template name="buffDialog">
|
||||
{{#with buff}}
|
||||
{{#baseDialog title=name class=colorClass hideEdit=true}}
|
||||
{{#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 class="pre-wrap">{{evaluateString charId description}}</div>
|
||||
<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,5 +1,50 @@
|
||||
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 + ".";
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
<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>
|
||||
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
.condition-library-dialog .item.selected {
|
||||
background-color: #e4e4e4;
|
||||
}
|
||||
|
||||
.condition-library-dialog table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.condition-library-dialog .library-condition td, tr {
|
||||
position: relative;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<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>
|
||||
@@ -0,0 +1,166 @@
|
||||
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",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
<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>
|
||||
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
<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>
|
||||
@@ -0,0 +1,6 @@
|
||||
Template.conditionViewDialog.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Conditions.remove(instance.data.condition._id);
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
<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>
|
||||
@@ -0,0 +1,47 @@
|
||||
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();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
<!--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>
|
||||
@@ -0,0 +1,41 @@
|
||||
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,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<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>
|
||||
@@ -0,0 +1,82 @@
|
||||
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);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
<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>
|
||||
@@ -0,0 +1,9 @@
|
||||
Template.customBuffViewList.helpers({
|
||||
buffs: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId,
|
||||
};
|
||||
return CustomBuffs.find(selector);
|
||||
}
|
||||
});
|
||||
@@ -10,7 +10,7 @@ Template.deleteCharacterConfirmation.helpers({
|
||||
if (Template.instance().canDelete.get()) {
|
||||
return "background: #d23f31; color: white;";
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.deleteCharacterConfirmation.events({
|
||||
@@ -20,9 +20,7 @@ Template.deleteCharacterConfirmation.events({
|
||||
},
|
||||
"click #deleteButton": function(event, instance) {
|
||||
if (instance.find("#nameInput").value === this.name) {
|
||||
popDialogStack();
|
||||
Router.go("/characterList");
|
||||
Characters.remove(this._id);
|
||||
popDialogStack(true);
|
||||
}
|
||||
},
|
||||
"click .cancelButton": function(event, instance){
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- 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>
|
||||
@@ -0,0 +1,31 @@
|
||||
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,7 +1,7 @@
|
||||
<template name="characterSheet">
|
||||
<div class="fit layout vertical character-sheet">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar class="medium-tall {{colorClass}}">
|
||||
<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">
|
||||
@@ -20,6 +20,12 @@
|
||||
<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
|
||||
@@ -30,21 +36,32 @@
|
||||
</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">Stats</paper-tab>
|
||||
<paper-tab name="features">Features</paper-tab>
|
||||
<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">Journal</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}}>
|
||||
|
||||
@@ -29,7 +29,7 @@ Template.characterSheet.onRendered(function() {
|
||||
tabFabMenus = _.times(6, (n) =>
|
||||
tabPages[n].find(".mini-holder")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
//watch this character and make sure their encumbrance is updated
|
||||
//trackEncumbranceConditions(this.data._id, this);
|
||||
@@ -165,6 +165,12 @@ var getTab = function(charId){
|
||||
};
|
||||
|
||||
Template.characterSheet.helpers({
|
||||
printing: function(){
|
||||
return Session.get("isPrinting");
|
||||
},
|
||||
printUrl: function(){
|
||||
return `/character/${this._id}/${this.urlName || "-"}/print`
|
||||
},
|
||||
selectedTab: function(){
|
||||
return getTab(this._id);
|
||||
},
|
||||
@@ -172,6 +178,18 @@ Template.characterSheet.helpers({
|
||||
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({
|
||||
@@ -187,6 +205,12 @@ Template.characterSheet.events({
|
||||
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){
|
||||
@@ -210,4 +234,11 @@ Template.characterSheet.events({
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
"click #unshareCharacter": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "unshareCharacterConfirmation",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7,32 +7,36 @@ var stats = [
|
||||
{stat: "intelligence", name: "Intelligence", group: "Ability Scores"},
|
||||
{stat: "wisdom", name: "Wisdom", group: "Ability Scores"},
|
||||
{stat: "charisma", name: "Charisma", group: "Ability Scores"},
|
||||
{name: "Strength Save", stat: "strengthSave", group: "Saving Throws"},
|
||||
{name: "Dexterity Save", stat: "dexteritySave", group: "Saving Throws"},
|
||||
{name: "Constitution Save", stat: "constitutionSave", group: "Saving Throws"},
|
||||
{name: "Intelligence Save", stat: "intelligenceSave", group: "Saving Throws"},
|
||||
{name: "Wisdom Save", stat: "wisdomSave", group: "Saving Throws"},
|
||||
{name: "Charisma Save", stat: "charismaSave", group: "Saving Throws"},
|
||||
{name: "Acrobatics", stat: "acrobatics", group: "Skills"},
|
||||
{name: "Animal Handling", stat: "animalHandling", group: "Skills"},
|
||||
{name: "Arcana", stat: "arcana", group: "Skills"},
|
||||
{name: "Athletics", stat: "athletics", group: "Skills"},
|
||||
{name: "Deception", stat: "deception", group: "Skills"},
|
||||
{name: "History", stat: "history", group: "Skills"},
|
||||
{name: "Insight", stat: "insight", group: "Skills"},
|
||||
{name: "Intimidation", stat: "intimidation", group: "Skills"},
|
||||
{name: "Investigation", stat: "investigation", group: "Skills"},
|
||||
{name: "Medicine", stat: "medicine", group: "Skills"},
|
||||
{name: "Nature", stat: "nature", group: "Skills"},
|
||||
{name: "Perception", stat: "perception", group: "Skills"},
|
||||
{name: "Performance", stat: "performance", group: "Skills"},
|
||||
{name: "Persuasion", stat: "persuasion", group: "Skills"},
|
||||
{name: "Religion", stat: "religion", group: "Skills"},
|
||||
{name: "Sleight of Hand", stat: "sleightOfHand", group: "Skills"},
|
||||
{name: "Stealth", stat: "stealth", group: "Skills"},
|
||||
{name: "Survival", stat: "survival", group: "Skills"},
|
||||
{name: "Initiative", stat: "initiative", group: "Skills"},
|
||||
|
||||
{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"},
|
||||
@@ -44,6 +48,7 @@ var 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"},
|
||||
@@ -53,10 +58,12 @@ var stats = [
|
||||
{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"},
|
||||
|
||||
@@ -5,12 +5,14 @@ var stats = {
|
||||
"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"},
|
||||
@@ -30,7 +32,9 @@ var stats = {
|
||||
"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"},
|
||||
@@ -42,6 +46,7 @@ var stats = {
|
||||
"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"},
|
||||
@@ -51,10 +56,12 @@ var stats = {
|
||||
"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",
|
||||
|
||||
@@ -36,12 +36,26 @@
|
||||
|
||||
{{> 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">
|
||||
@@ -76,4 +90,6 @@
|
||||
|
||||
{{> 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>
|
||||
|
||||
@@ -47,6 +47,10 @@ Template.featureDetails.events({
|
||||
});
|
||||
|
||||
Template.featureEdit.helpers({
|
||||
showNewUserExperience: function(){
|
||||
return Session.get("newUserExperienceStep") === 0 ||
|
||||
Session.get("newUserExperienceStep") === 1;
|
||||
},
|
||||
usesSet: function(){
|
||||
return _.isString(this.uses);
|
||||
},
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.card.featureCard .bottom {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.containerMain.featureDescription {
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
@@ -74,13 +74,14 @@
|
||||
checked={{enabled}}
|
||||
disabled={{#unless canEditCharacter charId}}true{{/unless}}>
|
||||
</paper-checkbox>
|
||||
<paper-tooltip position="left">Feature enabled</paper-tooltip>
|
||||
{{#simpleTooltip}}Feature enabled{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if description}}
|
||||
{{#if hasCharacters (evaluateShortString charId description)}}
|
||||
<div class="bottom flex">
|
||||
{{#markdown}}{{evaluateShortString charId description}}{{/markdown}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if hasUses}}
|
||||
@@ -100,11 +101,13 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if canEditCharacter _id}}
|
||||
<paper-fab id="addFeature"
|
||||
class="floatyButton"
|
||||
icon="add">
|
||||
<paper-tooltip position="left">Add Feature</paper-tooltip>
|
||||
</paper-fab>
|
||||
<div class="floatyButton">
|
||||
<paper-fab id="addFeature"
|
||||
class="{{#if shouldFloatyButtonBounce}}bounce{{/if}}"
|
||||
icon="add">
|
||||
</paper-fab>
|
||||
{{#simpleTooltip}}Add Feature{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -130,6 +133,12 @@
|
||||
<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}}
|
||||
@@ -159,4 +168,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
var 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;
|
||||
};
|
||||
|
||||
Template.features.helpers({
|
||||
features: function(){
|
||||
var features = Features.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
@@ -56,6 +38,13 @@ Template.features.helpers({
|
||||
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({
|
||||
@@ -122,6 +111,17 @@ Template.resource.helpers({
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
</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">
|
||||
|
||||
@@ -54,4 +54,8 @@ Template.containerEdit.events({
|
||||
trimStrings: false,
|
||||
});
|
||||
},
|
||||
"change #carriedToggle": function(event, instance){
|
||||
var carried = !this.isCarried;
|
||||
Containers.update(this._id, {$set: {isCarried: carried}});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
<div class="bottom green" style="padding: 0;">
|
||||
{{> carryCapacityBar}}
|
||||
</div>
|
||||
{{#if encumberedBuffs.count}}
|
||||
{{#if encumberedConditions.count}}
|
||||
<div class="bottom list">
|
||||
{{#each encumberedBuffs}}
|
||||
{{#each condition in encumberedConditions}}
|
||||
<div class="item-slot">
|
||||
<div class="item buff layout horizontal center">
|
||||
<div class="item condition layout horizontal center">
|
||||
<div class="flex">
|
||||
<iron-icon icon="work"
|
||||
style="margin-right: 16px">
|
||||
</iron-icon>
|
||||
{{name}}
|
||||
{{condition.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -110,12 +110,12 @@
|
||||
<div class="paper-font-caption" style="margin-right: 8px">
|
||||
{{round totalWeight}} lbs
|
||||
</div>
|
||||
<div>
|
||||
<div style="position: relative;">
|
||||
<paper-checkbox class="carriedCheckbox"
|
||||
disabled={{#unless canEditCharacter charId}}true{{/unless}}
|
||||
checked={{isCarried}}>
|
||||
</paper-checkbox>
|
||||
<paper-tooltip position="left"> Container carried</paper-tooltip>
|
||||
{{#simpleTooltip}} Container carried{{/simpleTooltip}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
@@ -136,21 +136,21 @@
|
||||
class="addContainer"
|
||||
mini>
|
||||
</paper-fab>
|
||||
<paper-tooltip position="left"> New container </paper-tooltip>
|
||||
{{#simpleTooltip class="always"}} Container {{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-fab icon="av:library-books"
|
||||
class="libraryItem"
|
||||
mini>
|
||||
</paper-fab>
|
||||
<paper-tooltip position="left"> Library item </paper-tooltip>
|
||||
{{#simpleTooltip class="always"}} Item from library {{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-fab icon="note-add"
|
||||
class="addItem"
|
||||
mini>
|
||||
</paper-fab>
|
||||
<paper-tooltip position="left"> New item </paper-tooltip>
|
||||
{{#simpleTooltip class="always"}} Item {{/simpleTooltip}}
|
||||
</div>
|
||||
{{/fabMenu}}
|
||||
{{/if}}
|
||||
|
||||
@@ -68,9 +68,8 @@ Template.inventory.helpers({
|
||||
return weight;
|
||||
},
|
||||
encumberedBuffs: function(){
|
||||
return Buffs.find({
|
||||
return Conditions.find({
|
||||
charId: this._id,
|
||||
type: "inate",
|
||||
name: {$in: [
|
||||
"Encumbered",
|
||||
"Heavily encumbered",
|
||||
@@ -157,7 +156,7 @@ Template.inventory.events({
|
||||
return;
|
||||
}
|
||||
// Make the library item into a regular item
|
||||
let item = _.omit(result, "library", "attacks", "effects");
|
||||
let item = _.omit(result, "libraryName", "library", "attacks", "effects");
|
||||
delete item.settings.category;
|
||||
// Update the item to match library item
|
||||
Items.update(itemId, {$set: item});
|
||||
@@ -201,12 +200,10 @@ Template.inventory.events({
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .buff": function(event, instance){
|
||||
var buffId = this._id;
|
||||
var charId = Template.parentData()._id;
|
||||
"click .condition": function(event, instance){
|
||||
pushDialogStack({
|
||||
template: "buffDialog",
|
||||
data: {buffId: buffId, charId: charId},
|
||||
template: "conditionViewDialogDialog",
|
||||
data: {condition: this.condition},
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
@@ -334,21 +331,23 @@ Template.layout.events({
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
"drop .characterRepresentative": 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",
|
||||
parentId: this._id,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
//move item to the character
|
||||
Meteor.call("moveItemToCharacter", itemId, this._id);
|
||||
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);
|
||||
}
|
||||
Session.set("inventory.dragItemId", null);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=charId parentId=_id}}
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
|
||||
<template name="itemEdit">
|
||||
@@ -65,10 +66,13 @@
|
||||
<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">
|
||||
|
||||
@@ -61,15 +61,15 @@
|
||||
<template name="libraryItem">
|
||||
<tr class="item library-item {{#if selected}}selected{{/if}}">
|
||||
<td class="itemName">
|
||||
{{item.name}}
|
||||
{{itemName}}
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
<td>
|
||||
{{item.weight}} lb.
|
||||
{{itemWeight}} lb.
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
<td>
|
||||
{{valueString item.value}}
|
||||
{{valueString itemValue}}
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -107,3 +107,24 @@ Template.itemLibraryDialog.events({
|
||||
template.searchTerm.set(value);
|
||||
},
|
||||
});
|
||||
|
||||
Template.libraryItem.helpers({
|
||||
itemName: function(){
|
||||
return this.item.libraryName || this.item.name;
|
||||
},
|
||||
itemWeight: function(){
|
||||
if (this.item.quantity) {
|
||||
return this.item.weight * this.item.quantity;
|
||||
} else {
|
||||
return this.item.weight;
|
||||
}
|
||||
},
|
||||
itemValue: function(){
|
||||
if (this.item.quantity) {
|
||||
return this.item.value * this.item.quantity;
|
||||
} else {
|
||||
return this.item.value;
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
<div class="item-slot">
|
||||
<div class="item race layout horizontal center">
|
||||
<div class="item race layout horizontal center {{#if shouldRaceBounce}}bounce{{/if}}">
|
||||
{{race}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,9 +83,12 @@
|
||||
</div>
|
||||
<div class="fab-buffer"></div>
|
||||
{{#if canEditCharacter _id}}
|
||||
<paper-fab id="addNote"
|
||||
class="floatyButton"
|
||||
icon="add"
|
||||
title="Add"></paper-fab>
|
||||
<div class="floatyButton">
|
||||
<paper-fab id="addNote"
|
||||
icon="add"
|
||||
title="Add">
|
||||
</paper-fab>
|
||||
{{#simpleTooltip}}Add Note{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
@@ -50,6 +50,9 @@ Template.journal.helpers({
|
||||
var char = Characters.findOne(this._id, {fields: {race: 1}});
|
||||
return char && char.race;
|
||||
},
|
||||
shouldRaceBounce: function(){
|
||||
return Session.get("newUserExperienceStep") === 1;
|
||||
},
|
||||
});
|
||||
|
||||
Template.journal.events({
|
||||
|
||||
@@ -1,11 +1,34 @@
|
||||
<template name="raceDialog">
|
||||
{{#baseDialog title="Race" class=color hideColor="true" hideDelete="true" startEditing=startEditing}}
|
||||
{{#if showNewUserExperience}}
|
||||
{{#infoBox}}
|
||||
{{#if stepComplete}}
|
||||
<p>You can add all the effects you need to represent how your race affects your character's attributes.</p>
|
||||
{{else}}
|
||||
<p>Click the edit button to edit your race and add a racial effect</p>
|
||||
{{/if}}
|
||||
{{/infoBox}}
|
||||
{{/if}}
|
||||
<div class="horizontal layout center-justified paper-font-display2">
|
||||
{{race}}
|
||||
</div>
|
||||
{{> effectsViewList charId=charId parentId=charId parentGroup="racial"}}
|
||||
{{> proficiencyViewList charId=charId parentId=charId parentGroup="racial"}}
|
||||
{{else}}
|
||||
{{#if showNewUserExperience}}
|
||||
{{#infoBox}}
|
||||
{{#if stepComplete}}
|
||||
<p>You can add all the effects you need to represent how your race affects your character's attributes.</p>
|
||||
{{else}}
|
||||
<p>
|
||||
Add an effect with the following options: <br>
|
||||
Attribute: <b>stats > speed</b> <br>
|
||||
Operation: <b>Base Value</b> <br>
|
||||
Value: <b>30</b> (might be different for some races)
|
||||
</p>
|
||||
{{/if}}
|
||||
{{/infoBox}}
|
||||
{{/if}}
|
||||
<paper-input id="raceInput" label="Race" value={{race}}></paper-input>
|
||||
{{> effectsEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
{{> proficiencyEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
|
||||
@@ -19,4 +19,10 @@ Template.raceDialog.helpers({
|
||||
var char = Characters.findOne(this.charId, {fields: {color: 1}});
|
||||
if (char) return getColorClass(char.color);
|
||||
},
|
||||
stepComplete: function(){
|
||||
return Session.get("newUserExperienceStep") > 1;
|
||||
},
|
||||
showNewUserExperience: function(){
|
||||
return Session.get("newUserExperienceStep") >= 1;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.newUserStepper {
|
||||
height: 180px !important;
|
||||
}
|
||||
|
||||
.newUserStepper paper-step .invalid-step-message {
|
||||
color: #d13b2e;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.newUserStepper paper-step[invalid] .invalid-step-message {
|
||||
visibility: visible;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<template name="newUserStepper">
|
||||
<paper-stepper linear selected="0" class="newUserStepper">
|
||||
<paper-step id="step0" label="Add a feature">
|
||||
<p>
|
||||
To get started, add a feature
|
||||
</p>
|
||||
</paper-step>
|
||||
<paper-step id="step1" label="Add an effect">
|
||||
<p>
|
||||
Add a racial effect to set your speed
|
||||
</p>
|
||||
</paper-step>
|
||||
<paper-step id="step2" label="See the effect in action">
|
||||
<p>
|
||||
View your speed stat
|
||||
</p>
|
||||
</paper-step>
|
||||
<paper-step id="step3" label="Finish">
|
||||
Done! If you get stuck, be sure to check out the <a href="/guide">guide</a>, or ask for help using the feedback form
|
||||
<div class="layout vertical end">
|
||||
<paper-button class="done-button" style="color: #d13b2e">Finish</paper-button>
|
||||
</div>
|
||||
</paper-step>
|
||||
</paper-stepper>
|
||||
</template>
|
||||
|
||||
<template name="newUserStepperPlaceholder">
|
||||
<div style="height: 300px"></div>
|
||||
</template>
|
||||
@@ -0,0 +1,58 @@
|
||||
Template.newUserStepper.onRendered(function(){
|
||||
Session.set("newUserExperienceStep", 0);
|
||||
let stepper = this.find("paper-stepper");
|
||||
_.defer(() => {
|
||||
this.autorun((c) => {
|
||||
var step = Session.get("newUserExperienceStep");
|
||||
var hasFeatures = Features.find({charId: this.data._id}).count() > 1;
|
||||
if (step === 0 && hasFeatures){
|
||||
stepper.continue();
|
||||
}
|
||||
});
|
||||
this.autorun((c) => {
|
||||
var step = Session.get("newUserExperienceStep");
|
||||
var hasEffect = !!Effects.find({
|
||||
charId: this.data._id,
|
||||
stat: "speed",
|
||||
"parent.group": "racial",
|
||||
operation: "base",
|
||||
value: {$gt: 0},
|
||||
}).count();
|
||||
if (step === 1 && hasEffect){
|
||||
stepper.continue();
|
||||
}
|
||||
});
|
||||
this.autorun((c) => {
|
||||
var step = Session.get("newUserExperienceStep");
|
||||
if (step === 2 && Session.get("viewedSpeed")){
|
||||
Session.set("viewedSpeed", undefined);
|
||||
stepper.continue();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Template.newUserStepper.events({
|
||||
"paper-stepper-progressed paper-stepper": function(event, template){
|
||||
const step = template.find("paper-stepper").selected;
|
||||
Session.set("newUserExperienceStep", step);
|
||||
},
|
||||
"paper-stepper-completed paper-stepper": function(event, template){
|
||||
Session.set("newUserExperienceStep", undefined);
|
||||
Session.set("showNewUserExperience", undefined);
|
||||
Characters.update(this._id, {$unset: {"settings.newUserExperience": 1}});
|
||||
},
|
||||
"click .done-button": function(event, instance){
|
||||
const stepper = instance.find("paper-stepper");
|
||||
stepper.continue();
|
||||
},
|
||||
});
|
||||
|
||||
Template.stats.events({
|
||||
"click .stat-card": function(event, instance){
|
||||
var step = Session.get("newUserExperienceStep");
|
||||
if (this.stat === "speed" && step === 2){
|
||||
Session.set("viewedSpeed", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
.printedAbility .title.paper-font-subhead {
|
||||
font-size: 2.5mm !important;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<template name="printedAbility">
|
||||
<div class="printedAbility layout vertical center double-border">
|
||||
<div class="paper-font-subhead title flex layout horizontal center">
|
||||
{{title}}
|
||||
</div>
|
||||
<div class="paper-font-display1 stat">
|
||||
{{characterCalculate "attributeValue" ../_id ability}}
|
||||
</div>
|
||||
<div class="paper-font-subhead modifier">
|
||||
{{abilityMod}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,9 @@
|
||||
Template.printedAbility.helpers({
|
||||
abilityMod: function() {
|
||||
return signedString(
|
||||
Characters.calculate.abilityMod(
|
||||
Template.parentData()._id, this.ability
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
<template name="printedAttack">
|
||||
<div class="printedAttack" style="margin-bottom: 2mm">
|
||||
<div class="layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center"
|
||||
style="margin-right: 1mm; min-width: 32px; text-align: right;">
|
||||
{{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>
|
||||
</template>
|
||||
@@ -0,0 +1,30 @@
|
||||
Template.printedAttack.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);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,190 @@
|
||||
.printed .page {
|
||||
width: 100%;
|
||||
padding: 6mm;
|
||||
page-break-inside: avoid;
|
||||
page-break-after: always;
|
||||
}
|
||||
|
||||
.printed .shrink-to-fit {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.printed p {
|
||||
margin-bottom: 1mm;
|
||||
}
|
||||
|
||||
.printed .double-border {
|
||||
position: relative;
|
||||
padding: 11px 10px;
|
||||
}
|
||||
|
||||
.printed .double-border > * {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.printed .double-border:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border: 16px solid transparent;
|
||||
border-image-source: url(/png/doubleLineImageBorder.png);
|
||||
border-image-slice: 110 126 fill;
|
||||
border-image-repeat: stretch;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.printed .double-border.printedAbility {
|
||||
padding: 11px 6px 0;
|
||||
margin-bottom: 3mm;
|
||||
}
|
||||
|
||||
.printed .double-border.printedAbility:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.printed .printedAbility .modifier {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
z-index: 1;
|
||||
padding: 2px 18px;
|
||||
background-image: url(/png/upwardPointingBorder.png);
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
print-color-adjust: exact;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
|
||||
.printed .octogon-border {
|
||||
position: relative;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.printed .octogon-border:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border: 22px solid transparent;
|
||||
border-image: url(/png/octogonBorder.png) 124 118 fill;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.printed iron-icon {
|
||||
width: 16px;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
min-height: 16px;
|
||||
}
|
||||
|
||||
.printed .proficiencies, .printed .attacks, .printed .background {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.printed .shield-background {
|
||||
background: url(/png/shieldBorder.png);
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
print-color-adjust: exact;
|
||||
-webkit-print-color-adjust: exact;
|
||||
padding: 4px 8px 8px;
|
||||
width: 80px;
|
||||
height: 91px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.printed .shield-background .paper-font-subhead {
|
||||
width: 64px;
|
||||
text-align: center;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.printed {
|
||||
font-size: 3mm;
|
||||
}
|
||||
|
||||
.printed .paper-font-body2 {
|
||||
font-size: 3mm;
|
||||
line-height: 4mm;
|
||||
}
|
||||
|
||||
.printed .paper-font-subhead {
|
||||
font-size: 3mm !important;
|
||||
line-height: 3.5mm !important;
|
||||
font-weight: bold !important;
|
||||
text-transform: uppercase !important;
|
||||
}
|
||||
|
||||
.printed .paper-font-subhead.modifier {
|
||||
font-size: 4mm !important;
|
||||
line-height: 6mm !important;
|
||||
}
|
||||
|
||||
.printed .paper-font-display1 {
|
||||
font-size: 7mm !important;
|
||||
line-height: 12mm !important;
|
||||
}
|
||||
|
||||
.printed .paper-font-headline {
|
||||
font-size: 5mm !important;
|
||||
line-height: 6mm !important;
|
||||
}
|
||||
|
||||
.printed .lined-background {
|
||||
background-image: url(/png/horizontalLine.png);
|
||||
background-size: 100% 4mm;
|
||||
print-color-adjust: exact;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.printed .page {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
background: white;
|
||||
margin: 8px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
||||
0 1px 5px 0 rgba(0, 0, 0, 0.12),
|
||||
0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.printed .page-holder {
|
||||
width: calc(210mm + 16px);
|
||||
}
|
||||
|
||||
.printed {
|
||||
overflow: auto;
|
||||
padding-left:
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
app-drawer {
|
||||
display: none;
|
||||
}
|
||||
app-header {
|
||||
display: none;
|
||||
}
|
||||
.printed {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
background: #fff;
|
||||
}
|
||||
.printed .page-holder {
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.printed .page {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
<template name="printedCharacterSheet">
|
||||
<div class="fit printed-character-sheet layout vertical">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar class="medium {{colorClass}} layout horizontal center" style="z-index: 2;">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<paper-icon-button icon="arrow-back" class="backButton"></paper-icon-button>
|
||||
<div class="flex character-name">
|
||||
{{name}}
|
||||
</div>
|
||||
<div style="position: relative;">
|
||||
<paper-icon-button icon="print" class="printButton"></paper-icon-button>
|
||||
{{#simpleTooltip}} Print {{/simpleTooltip}}
|
||||
</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="printed flex">
|
||||
<div class="page-holder">
|
||||
<div class="page">
|
||||
<div class="layout vertical" style="height: 100%;">
|
||||
<div class="layout horizontal center" style="margin-bottom: 4mm">
|
||||
<img src="/crown-dice-logo-cropped-transparent.png" style="width: 60px; margin-right: 2mm">
|
||||
<div class="characterName paper-font-title" style="margin-right: 4mm">
|
||||
{{name}}
|
||||
</div>
|
||||
<div class="paper-font-body2">
|
||||
<div>
|
||||
{{#each classes}}
|
||||
<span style="margin-right: 2mm;">
|
||||
{{name}} {{level}}
|
||||
</span>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div>
|
||||
{{character.alignment}} {{character.gender}} {{character.race}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex layout vertical end" style="margin-right: 2mm;">
|
||||
<div class="paper-font-body2 " style="font-size: 5mm !important;">
|
||||
dicecloud.com
|
||||
</div>
|
||||
<div>
|
||||
{{characterUrl}}
|
||||
</div>
|
||||
</div>
|
||||
<canvas id="qrCode"></canvas>
|
||||
</div>
|
||||
<div class="columns layout horizontal flex">
|
||||
<div class="col1 flex layout vertical">
|
||||
<div class="layout vertical center-justified" style="min-height: 100px; margin-bottom: 4mm;">
|
||||
<div class="initiative" style="margin-bottom: 2mm;">
|
||||
{{> printedLongStat stat="" name="Inspiration" prefix=""}}
|
||||
</div>
|
||||
<div class="proficiencyBonus">
|
||||
{{> printedLongStat stat="proficiencyBonus" name="Proficiency Bonus" prefix="+"}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout horizontal">
|
||||
<div class="abilities layout vertical justified" style="margin-right: 4mm;">
|
||||
{{> printedAbility ability="strength" title="Strength"}}
|
||||
{{> printedAbility ability="dexterity" title="Dexterity"}}
|
||||
{{> printedAbility ability="constitution" title="Constitution"}}
|
||||
{{> printedAbility ability="intelligence" title="Intelligence"}}
|
||||
{{> printedAbility ability="wisdom" title="Wisdom"}}
|
||||
{{> printedAbility ability="charisma" title="Charisma"}}
|
||||
</div>
|
||||
<div class="flex layout vertical">
|
||||
<div class="saves double-border" style="margin-bottom: 2mm">
|
||||
<div>
|
||||
{{> printedSkillRow name="Strength" skill="strengthSave"}}
|
||||
{{> printedSkillRow name="Dexterity" skill="dexteritySave"}}
|
||||
{{> printedSkillRow name="Constitution" skill="constitutionSave"}}
|
||||
{{> printedSkillRow name="Intelligence" skill="intelligenceSave"}}
|
||||
{{> printedSkillRow name="Wisdom" skill="wisdomSave"}}
|
||||
{{> printedSkillRow name="Charisma" skill="charismaSave"}}
|
||||
</div>
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Saving Throws
|
||||
</div>
|
||||
</div>
|
||||
<div class="skills double-border">
|
||||
<div>
|
||||
{{> printedSkillRow name="Acrobatics" skill="acrobatics"}}
|
||||
{{> printedSkillRow name="Animal Handling" skill="animalHandling"}}
|
||||
{{> printedSkillRow name="Arcana" skill="arcana"}}
|
||||
{{> printedSkillRow name="Athletics" skill="athletics"}}
|
||||
{{> printedSkillRow name="Deception" skill="deception"}}
|
||||
{{> printedSkillRow name="History" skill="history"}}
|
||||
{{> printedSkillRow name="Insight" skill="insight"}}
|
||||
{{> printedSkillRow name="Intimidation" skill="intimidation"}}
|
||||
{{> printedSkillRow name="Investigation" skill="investigation"}}
|
||||
{{> printedSkillRow name="Medicine" skill="medicine"}}
|
||||
{{> printedSkillRow name="Nature" skill="nature"}}
|
||||
{{> printedSkillRow name="Perception" skill="perception" showPassive="true"}}
|
||||
{{> printedSkillRow name="Performance" skill="performance"}}
|
||||
{{> printedSkillRow name="Persuasion" skill="persuasion"}}
|
||||
{{> printedSkillRow name="Religion" skill="religion"}}
|
||||
{{> printedSkillRow name="Sleight of Hand" skill="sleightOfHand"}}
|
||||
{{> printedSkillRow name="Stealth" skill="stealth"}}
|
||||
{{> printedSkillRow name="Survival" skill="survival"}}
|
||||
</div>
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Skills
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="proficiencies flex double-border" style="margin-top: 4mm">
|
||||
<div class="paper-font-subhead layout vertical center" style="margin-bottom: 2mm;">
|
||||
Proficiencies
|
||||
</div>
|
||||
<div class="layout horizontal">
|
||||
<div class="flex" style="margin-right: 2mm">
|
||||
{{#if armorProfs.length}}
|
||||
<div class="paper-font-subhead" style="margin-bottom: 1mm;">Armor</div>
|
||||
{{/if}}
|
||||
{{#each armorProfs}}
|
||||
{{> printedProficiency}}
|
||||
{{/each}}
|
||||
{{#if weaponProfs.length}}
|
||||
<div class="paper-font-subhead" style="margin: 2mm 0 1mm;">Weapons</div>
|
||||
{{/if}}
|
||||
{{#each weaponProfs}}
|
||||
{{> printedProficiency}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if toolProfs.length}}
|
||||
<div class="flex">
|
||||
<div class="paper-font-subhead" style="margin-bottom: 1mm;">Tools</div>
|
||||
{{#each toolProfs}}
|
||||
{{> printedProficiency}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col2 flex layout vertical" style="margin-left: 4mm; margin-right: 4mm;">
|
||||
<div class="layout horizontal center justified" style="min-height: 100px; margin-bottom: 4mm;">
|
||||
<div class="armor">
|
||||
{{> printedSquareStat stat="armor" name="Armor Class" class="shield-background"}}
|
||||
</div>
|
||||
<div class="inititive">
|
||||
{{> printedSquareStat stat="initiative" name="Initiative" isSkill="true" class="double-border"}}
|
||||
</div>
|
||||
<div class="speed">
|
||||
{{> printedSquareStat stat="speed" name="Speed" class="double-border"}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="hitpoints layout vertical double-border" style="margin-bottom: 2mm;">
|
||||
<div>
|
||||
Hit point maximum:
|
||||
<span class="paper-font-subhead">
|
||||
{{characterCalculate "attributeBase" _id "hitPoints"}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex" style="width: 3cm; height: 2cm;">
|
||||
<!-- Space for writing -->
|
||||
</div>
|
||||
<div class="layout vertical center paper-font-subhead">
|
||||
Hit Points
|
||||
</div>
|
||||
</div>
|
||||
<div class="tempHitpoints layout vertical double-border" style="margin-bottom: 2mm;">
|
||||
<div style="width: 3cm; height: 1.5cm;">
|
||||
<!-- Space for writing -->
|
||||
</div>
|
||||
<div class="layout vertical center paper-font-subhead">
|
||||
Temporary Hit Points
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout horizontal" style="margin-bottom: 4mm;">
|
||||
<div class="hitDice double-border flex layout vertical" style="margin-right: 2mm;">
|
||||
<div>
|
||||
Total:
|
||||
<span class="paper-font-subhead" style="text-transform: none !important;">
|
||||
{{hitDiceTotal}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex" style="min-height: 1cm;">
|
||||
<!-- Space for writing -->
|
||||
</div>
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Hit Dice
|
||||
</div>
|
||||
</div>
|
||||
<div class="deathSaves layout vertical center double-border">
|
||||
<div class="" style="margin-bottom: 1mm;">
|
||||
Successes
|
||||
</div>
|
||||
<div class="layout horizontal center">
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
</div>
|
||||
<div class="" style="margin: 1mm 0;">
|
||||
Failures
|
||||
</div>
|
||||
<div class="layout horizontal center">
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
<iron-icon icon="radio-button-unchecked"></iron-icon>
|
||||
</div>
|
||||
<div class="paper-font-subhead layout vertical center" style="margin-top: 2mm;">
|
||||
Death Saves
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="attacks double-border flex">
|
||||
<div class="paper-font-subhead layout vertical center" style="margin-bottom: 2mm;">
|
||||
Attacks
|
||||
</div>
|
||||
{{#each attack in attacks}}
|
||||
{{> printedAttack attack=attack charId=_id}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col3 flex layout vertical">
|
||||
<div class="Languages double-border" style="min-height: 100px; margin-bottom: 4mm;">
|
||||
<div class="paper-font-subhead layout vertical center" style="margin-bottom: 2mm;">
|
||||
Languages
|
||||
</div>
|
||||
<div class="layout horizontal">
|
||||
<div class="flex" style="margin-right: 2mm;">
|
||||
{{#each languageProfs.left}}
|
||||
{{> printedProficiency}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if languageProfs.right.length}}
|
||||
<div class="flex">
|
||||
{{#each languageProfs.right}}
|
||||
{{> printedProficiency}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="traits double-border">
|
||||
{{#markdown}}{{evaluateShortString character._id character.personality}}{{/markdown}}
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Personality traits
|
||||
</div>
|
||||
</div>
|
||||
<div class="ideals double-border" style="margin-top: 2mm">
|
||||
{{#markdown}}{{evaluateShortString character._id character.ideals}}{{/markdown}}
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Ideals
|
||||
</div>
|
||||
</div>
|
||||
<div class="bonds double-border" style="margin-top: 2mm">
|
||||
{{#markdown}}{{evaluateShortString character._id character.bonds}}{{/markdown}}
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Bonds
|
||||
</div>
|
||||
</div>
|
||||
<div class="flaws double-border" style="margin-top: 2mm">
|
||||
{{#markdown}}{{evaluateShortString character._id character.flaws}}{{/markdown}}
|
||||
<div class="paper-font-subhead layout vertical center">
|
||||
Flaws
|
||||
</div>
|
||||
</div>
|
||||
<div class="background double-border flex layout vertical" style="margin-top: 2mm">
|
||||
<div class="paper-font-subhead layout vertical center" style="margin-bottom: 4mm">
|
||||
Notes
|
||||
</div>
|
||||
<div class="flex lined-background">
|
||||
<!-- lined space for writing -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,80 @@
|
||||
import QRCode from "qrcode"
|
||||
|
||||
Template.printedCharacterSheet.onRendered(function(){
|
||||
// Quickfit is only called once on rendering, text will not resize reactively
|
||||
this.$(".shrink-to-fit").quickfit({
|
||||
min: 7,
|
||||
max: 36,
|
||||
truncate: true,
|
||||
});
|
||||
let url = `https://dicecloud.com/character/${this.data._id}`;
|
||||
let canvas = this.find("#qrCode");
|
||||
QRCode.toCanvas(canvas, url, {
|
||||
margin: 0,
|
||||
width: 200,
|
||||
}, function(error){
|
||||
$(canvas).css("width", "60px").css("height", "60px");
|
||||
if (error) console.error(error)
|
||||
});
|
||||
});
|
||||
|
||||
Template.printedCharacterSheet.helpers({
|
||||
character(){
|
||||
return Characters.findOne(this._id);
|
||||
},
|
||||
classes: function(){
|
||||
return Classes.find({charId: this._id}, {sort: {createdAt: 1}});
|
||||
},
|
||||
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);
|
||||
},
|
||||
languageProfs: function(){
|
||||
var profs = Proficiencies.find({charId: this._id, type: "language"});
|
||||
profs = removeDuplicateProficiencies(profs);
|
||||
if (profs.length > 3){
|
||||
var halfway = Math.floor(profs.length / 2);
|
||||
var left = profs.slice(0, halfway);
|
||||
var right = profs.slice(halfway);
|
||||
return {left, right};
|
||||
} else {
|
||||
return {left: profs, right: []};
|
||||
}
|
||||
},
|
||||
attacks: function(){
|
||||
return Attacks.find(
|
||||
{charId: this._id, enabled: true},
|
||||
{sort: {color: 1, name: 1}});
|
||||
},
|
||||
hitDiceTotal: function(){
|
||||
let d6 = Characters.calculate.attributeValue(this._id, "d6HitDice");
|
||||
let d8 = Characters.calculate.attributeValue(this._id, "d8HitDice");
|
||||
let d10 = Characters.calculate.attributeValue(this._id, "d10HitDice");
|
||||
let d12 = Characters.calculate.attributeValue(this._id, "d12HitDice");
|
||||
d6 = d6 ? d6 + "d6" : "";
|
||||
d8 = d8 ? d8 + "d8" : "";
|
||||
d10 = d10 ? d10 + "d10" : "";
|
||||
d12 = d12 ? d12 + "d12" : "";
|
||||
return [d6, d8, d10, d12].filter(Boolean).join(" ");
|
||||
},
|
||||
characterUrl: function(){
|
||||
return `/character/${this._id}`
|
||||
},
|
||||
});
|
||||
|
||||
Template.printedCharacterSheet.events({
|
||||
"click .printButton": function(event, instance){
|
||||
print();
|
||||
},
|
||||
"click .backButton": function(event, instance){
|
||||
history && history.back();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
.printedLongStat .title {
|
||||
white-space: nowrap;
|
||||
margin-left: 2mm;
|
||||
}
|
||||
|
||||
.printedLongStat .numbers {
|
||||
z-index: 1;
|
||||
min-width: 74px;
|
||||
min-height: 45px;
|
||||
}
|
||||
|
||||
.printed .printedLongStat.double-border{
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.printed .printedLongStat.double-border:before {
|
||||
top: 4px;
|
||||
bottom: 4px;
|
||||
left: 33px;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<template name="printedLongStat">
|
||||
<div class="printedLongStat layout horizontal double-border">
|
||||
<div class="numbers paper-font-display1 octogon-border">
|
||||
{{#if stat}}
|
||||
{{#if isSkill}}
|
||||
{{prefix}}{{skillMod}}
|
||||
{{else}}
|
||||
{{prefix}}{{characterCalculate "attributeValue" ../_id stat}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="paper-font-subhead title flex layout horizontal center">
|
||||
{{name}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,9 @@
|
||||
Template.printedLongStat.helpers({
|
||||
skillMod: function() {
|
||||
return signedString(
|
||||
Characters.calculate.skillMod(
|
||||
Template.parentData()._id, this.stat
|
||||
)
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
.printedProficiency iron-icon {
|
||||
margin-right: 2mm;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<template name="printedProficiency">
|
||||
<div class="printedProficiency layout horizontal center">
|
||||
<iron-icon icon="{{profIcon}}"></iron-icon>
|
||||
<div>{{getName}}</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,40 @@
|
||||
Template.printedProficiency.helpers({
|
||||
profIcon: function(){
|
||||
var prof = this.value;
|
||||
if (prof > 0 && prof < 1) return "image:brightness-2";
|
||||
if (prof === 1) return "image:brightness-1";
|
||||
if (prof > 1) return "av:album";
|
||||
return "radio-button-off";
|
||||
},
|
||||
getName: function(){
|
||||
if (this.type === "skill") return skills[this.name];
|
||||
if (this.type === "save") return saves[this.name];
|
||||
return this.name;
|
||||
},
|
||||
});
|
||||
|
||||
Template.printedProficiency.events({
|
||||
"click .proficiency": function(event, instance){
|
||||
if (this.parent.collection == "Characters") {
|
||||
if (this.parent.group == "background") {
|
||||
pushDialogStack({
|
||||
template: "backgroundDialog",
|
||||
data: {
|
||||
"charId": this.charId,
|
||||
"field":"background",
|
||||
"title":"Background",
|
||||
"color":"j",
|
||||
},
|
||||
element: event.currentTarget,
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
openParentDialog({
|
||||
parent: this.parent,
|
||||
charId: this.charId,
|
||||
element: event.currentTarget,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
.printedSkillRow {
|
||||
height: 24px;
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
.printedSkillRow .skill-mod {
|
||||
width: 36px;
|
||||
text-align: center;
|
||||
font-size: 3.5mm;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<template name="printedSkillRow">
|
||||
<div class="printedSkillRow layout horizontal center">
|
||||
<iron-icon icon="{{profIcon}}"></iron-icon>
|
||||
{{#if failSkill}}
|
||||
<div class="fail skill-mod">fail</div>
|
||||
{{else}}
|
||||
<div class="{{advantage}} skill-mod">
|
||||
{{skillMod}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div flex>
|
||||
{{name}}
|
||||
{{#if conditionalCount}}
|
||||
*
|
||||
{{/if}}
|
||||
{{#if showPassive}}
|
||||
({{characterCalculate "passiveSkill" ../_id skill}})
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,41 @@
|
||||
Template.printedSkillRow.helpers({
|
||||
skillMod: function() {
|
||||
return signedString(
|
||||
Characters.calculate.skillMod(
|
||||
Template.parentData()._id, this.skill
|
||||
)
|
||||
);
|
||||
},
|
||||
profIcon: function(){
|
||||
var charId = Template.parentData()._id;
|
||||
var prof = Characters.calculate.proficiency(charId, this.skill);
|
||||
if (prof > 0 && prof < 1) return "image:brightness-2";
|
||||
if (prof === 1) return "image:brightness-1";
|
||||
if (prof > 1) return "av:album";
|
||||
return "radio-button-unchecked";
|
||||
},
|
||||
failSkill: function(){
|
||||
var charId = Template.parentData()._id;
|
||||
return Effects.find({
|
||||
charId: charId,
|
||||
stat: this.skill,
|
||||
enabled: true,
|
||||
operation: "fail",
|
||||
}).count();
|
||||
},
|
||||
advantage: function(){
|
||||
var charId = Template.parentData()._id;
|
||||
var advantage = Characters.calculate.advantage(charId, this.skill);
|
||||
if (advantage > 0) return "advantage";
|
||||
if (advantage < 0) return "disadvantage";
|
||||
},
|
||||
conditionalCount: function(){
|
||||
var charId = Template.parentData()._id;
|
||||
return Effects.find({
|
||||
charId: charId,
|
||||
stat: this.skill,
|
||||
enabled: true,
|
||||
operation: "conditional",
|
||||
}).count();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
.printedSquareStat {
|
||||
min-width: 67px;
|
||||
}
|
||||
|
||||
.printedSquareStat .title.paper-font-subhead {
|
||||
font-size: 2.5mm !important;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<template name="printedSquareStat">
|
||||
<div class="printedSquareStat layout vertical center {{class}}">
|
||||
<div class="numbers paper-font-display1">
|
||||
{{#if isSkill}}
|
||||
{{prefix}}{{skillMod}}
|
||||
{{else}}
|
||||
{{prefix}}{{characterCalculate "attributeValue" ../_id stat}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="paper-font-subhead title">
|
||||
{{name}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,9 @@
|
||||
Template.printedSquareStat.helpers({
|
||||
skillMod: function() {
|
||||
return signedString(
|
||||
Characters.calculate.skillMod(
|
||||
Template.parentData()._id, this.stat
|
||||
)
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<template name="spellDetails">
|
||||
<div class="paper-font-body2">
|
||||
Level {{level}} {{school}} {{#if ritual}}ritual{{/if}}, {{preparedString}}
|
||||
{{schoolAndLevel}}{{#if ritual}} (ritual){{/if}}, {{preparedString}}
|
||||
</div>
|
||||
<div style="margin: 16px 0 16px 0;">
|
||||
{{#if castingTime}}
|
||||
@@ -38,6 +38,7 @@
|
||||
</div>
|
||||
<div>{{#markdown}}{{evaluateSpellString charId parent.id description}}{{/markdown}}</div>
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
|
||||
<template name="spellEdit">
|
||||
@@ -111,10 +112,12 @@
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="descriptionInput" label="Description" style="width: calc(100% - 24px)" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
{{> customBuffEditList parentId=_id parentCollection="Spells" charId=charId}}
|
||||
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name isSpell=true}}
|
||||
</template>
|
||||
|
||||
@@ -29,6 +29,13 @@ Template.spellDialog.events({
|
||||
});
|
||||
|
||||
Template.spellDetails.helpers({
|
||||
schoolAndLevel: function(){
|
||||
if (this.level == 0) {
|
||||
return this.school + " cantrip";
|
||||
} else {
|
||||
return "Level " + this.level + " " + this.school;
|
||||
}
|
||||
},
|
||||
getComponents: function(){
|
||||
var components = "";
|
||||
if (this.components.concentration) components += "C";
|
||||
|
||||
@@ -53,22 +53,22 @@
|
||||
{{numPrepared}} / {{evaluate charId maxPrepared}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
Done
|
||||
</paper-tooltip>
|
||||
<div style="position: relative;">
|
||||
<paper-icon-button class="finishPrep" icon="done">
|
||||
</paper-icon-button>
|
||||
{{#simpleTooltip}}
|
||||
Done
|
||||
{{/simpleTooltip}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
Change prepared spells
|
||||
</paper-tooltip>
|
||||
<div style="position: relative;">
|
||||
<paper-icon-button class="prepSpells"
|
||||
disabled={{#unless canEditCharacter charId}}true{{/unless}}
|
||||
icon="book">
|
||||
</paper-icon-button>
|
||||
{{#simpleTooltip}}
|
||||
Change prepared spells
|
||||
{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
@@ -83,7 +83,9 @@
|
||||
{{#each spells ../_id ../../_id}}
|
||||
{{#if showSpell ../../_id}}
|
||||
<div class="item-slot">
|
||||
<div class="tall spell item layout horizontal center" data-id={{_id}}>
|
||||
<div class="tall spell item layout horizontal center spellItem"
|
||||
data-id={{_id}}
|
||||
draggable={{canEditCharacter charId}}>
|
||||
<iron-icon icon="social:whatshot"
|
||||
style="color: {{hexColor color}};
|
||||
margin-right: 16px;"
|
||||
@@ -122,32 +124,31 @@
|
||||
{{#if canEditCharacter _id}}
|
||||
{{#fabMenu}}
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
New spell list
|
||||
</paper-tooltip>
|
||||
<paper-fab icon="work"
|
||||
class="addSpellList"
|
||||
mini>
|
||||
</paper-fab>
|
||||
|
||||
{{#simpleTooltip class="always"}}
|
||||
Spell list
|
||||
{{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
Spell library
|
||||
</paper-tooltip>
|
||||
<paper-fab icon="av:library-books"
|
||||
class="librarySpell"
|
||||
mini>
|
||||
</paper-fab>
|
||||
{{#simpleTooltip class="always"}}
|
||||
Spell from library
|
||||
{{/simpleTooltip}}
|
||||
</div>
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
New spell
|
||||
</paper-tooltip>
|
||||
<paper-fab icon="note-add"
|
||||
class="addSpell"
|
||||
mini>
|
||||
</paper-fab>
|
||||
{{#simpleTooltip class="always"}}
|
||||
Spell
|
||||
{{/simpleTooltip}}
|
||||
</div>
|
||||
{{/fabMenu}}
|
||||
{{/if}}
|
||||
|
||||
@@ -253,8 +253,8 @@ Template.spells.events({
|
||||
pushDialogStack({
|
||||
template: "spellLibraryDialog",
|
||||
element: event.currentTarget,
|
||||
callback: (result) => {
|
||||
if (!result) return;
|
||||
callback: (resultArray) => {
|
||||
if (!resultArray) return;
|
||||
if (!listId){
|
||||
listId = SpellLists.insert({
|
||||
name: "New SpellList",
|
||||
@@ -263,53 +263,59 @@ Template.spells.events({
|
||||
attackBonus: "intelligenceMod + proficiencyBonus",
|
||||
});
|
||||
}
|
||||
// Make the library spell into a regular spell
|
||||
let spell = _.omit(result, "library", "attacks", "effects");
|
||||
spell._id = spellId;
|
||||
spell.charId = charId;
|
||||
spell.parent = {
|
||||
id: listId,
|
||||
collection: "SpellLists",
|
||||
};
|
||||
spell.prepared = "prepared";
|
||||
Spells.insert(spell);
|
||||
// Copy over attacks and effects
|
||||
_.each(result.attacks, (attack) => {
|
||||
if (!("attackBonus" in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: spellId, collection: "Spells"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(result.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: spellId, collection: "Spells"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
|
||||
/******[UNCOMMENT ONCE BUFFS ARE ADDED]*******
|
||||
_.each(result.buffs, (buff) => {
|
||||
buff.charId = charId;
|
||||
buff.parent = {id: spellId, collection: "Spells"};
|
||||
buffId = Buffs.insert(buff);
|
||||
|
||||
_.each(buff.attacks, (attack) => {
|
||||
if (!(attackBonus in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
//loop through all returned spells
|
||||
_.each(resultArray, (rawSpell, index) =>{
|
||||
// Make the library spell into a regular spell
|
||||
let spell = _.omit(rawSpell, "_id", "library", "attacks", "effects");
|
||||
// Use the ID generated earlier for the first spell so we
|
||||
// can animate to it
|
||||
if (index == 0) {
|
||||
spell._id = spellId;
|
||||
}
|
||||
spell.charId = charId;
|
||||
spell.parent = {
|
||||
id: listId,
|
||||
collection: "SpellLists",
|
||||
};
|
||||
spell.prepared = "prepared";
|
||||
let insertedSpellId = Spells.insert(spell);
|
||||
// Copy over attacks and effects
|
||||
_.each(rawSpell.attacks, (attack) => {
|
||||
if (!("attackBonus" in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: buffId, collection: "Buffs"};
|
||||
attack.parent = {id: insertedSpellId, collection: "Spells"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(buff.effects, (effect) => {
|
||||
_.each(rawSpell.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: buffId, collection: "Buffs"};
|
||||
effect.parent = {id: insertedSpellId, collection: "Spells"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
_.each(buff.proficiencies, (prof) => {
|
||||
prof.charId = charId;
|
||||
prof.parent = {id: buffId, collection: "Buffs"};
|
||||
Proficiencies.insert(prof);
|
||||
|
||||
_.each(rawSpell.buffs, (buff) => {
|
||||
buff.charId = charId;
|
||||
buff.parent = {id: insertedSpellId, collection: "Spells"};
|
||||
buffId = Buffs.insert(buff);
|
||||
|
||||
_.each(buff.attacks, (attack) => {
|
||||
if (!(attackBonus in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: buffId, collection: "Buffs"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(buff.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: buffId, collection: "Buffs"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
_.each(buff.proficiencies, (prof) => {
|
||||
prof.charId = charId;
|
||||
prof.parent = {id: buffId, collection: "Buffs"};
|
||||
Proficiencies.insert(prof);
|
||||
});
|
||||
});
|
||||
});
|
||||
*******[UNCOMMENT ONCE BUFFS ARE ADDED]******/
|
||||
},
|
||||
returnElement: () => $(`[data-id='${spellId}']`).get(0),
|
||||
})
|
||||
@@ -333,3 +339,49 @@ Template.spells.events({
|
||||
event.stopPropagation();
|
||||
},
|
||||
});
|
||||
|
||||
Template.layout.events({
|
||||
"dragstart .spellItem": function(event, instance){
|
||||
event.originalEvent.dataTransfer.setData("dicecloud-id/spells", this._id);
|
||||
Session.set("spellLists.dragSpellId", this._id);
|
||||
},
|
||||
"dragend .spellItem": function(event, instance){
|
||||
Session.set("spellLists.dragSpellId", null);
|
||||
},
|
||||
|
||||
"dragover .spellList, dragenter .spellList": function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/spells")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"drop .spellList": function(event, instance){
|
||||
var spellId = event.originalEvent.dataTransfer.getData("dicecloud-id/spells");
|
||||
if (event.ctrlKey){
|
||||
//copy spell to new list
|
||||
Meteor.call("copySpellToList", spellId, this._id);
|
||||
} else {
|
||||
//move spell to new list
|
||||
Meteor.call("moveSpellToList", spellId, this._id);
|
||||
}
|
||||
Session.set("spellLists.dragSpellId", null);
|
||||
},
|
||||
|
||||
"dragover .characterRepresentative, dragenter .characterRepresentative": function(event, instance){
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/spells")){
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
"drop .characterRepresentative": function(event, instance) {
|
||||
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/spells")){ //to prevent conflicts with item drag/drop
|
||||
var spellId = event.originalEvent.dataTransfer.getData("dicecloud-id/spells");
|
||||
if (event.ctrlKey){
|
||||
//copy spell to character
|
||||
Meteor.call("copySpellToCharacter", spellId, this._id);
|
||||
} else {
|
||||
//move spell to character
|
||||
Meteor.call("moveSpellToCharacter", spellId, this._id);
|
||||
}
|
||||
Session.set("spellLists.dragSpellId", null);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
.spell-library-dialog .spell.selected {
|
||||
background-color: #e4e4e4;
|
||||
}
|
||||
|
||||
.spell-library-dialog .category-header {
|
||||
font-size: 16px;
|
||||
}
|
||||
@@ -13,11 +9,3 @@
|
||||
.spell-library-dialog .category-header iron-icon.open {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.spell-library-dialog table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.spell-library-dialog .library-spell td {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -13,15 +13,18 @@
|
||||
<div class="spells" style="padding:8px">
|
||||
{{#if searchTerm}}
|
||||
{{#if searchSpells.count}}
|
||||
<table style="width: 100%">
|
||||
<tbody>
|
||||
{{#each spell in searchSpells}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
{{#each spell in searchSpells}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{else}}{{#if searchReady}}
|
||||
No spells match "{{searchTerm}}"
|
||||
<p>
|
||||
No spells match "{{searchTerm}}"
|
||||
</p>
|
||||
<p class="paper-font-caption">
|
||||
DiceCloud only includes content provided by Wizards of the Coast in the official system reference document. If the spell you are looking for is not available in the system reference document, you will need to add it manually.
|
||||
</p>
|
||||
{{/if}}{{/if}}
|
||||
{{#unless searchReady}}
|
||||
<div class="layout vertical center" style="width: 100%; padding: 16px;">
|
||||
@@ -36,13 +39,11 @@
|
||||
{{name}}
|
||||
</div>
|
||||
<iron-collapse opened={{isOpen key}}>
|
||||
<table style="width: 100%">
|
||||
<tbody>
|
||||
{{#each spell in (spellsInCategory key)}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
{{#each spell in (spellsInCategory key)}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#unless ready key}}
|
||||
<paper-spinner active></paper-spinner>
|
||||
{{/unless}}
|
||||
@@ -59,10 +60,10 @@
|
||||
</template>
|
||||
|
||||
<template name="librarySpell">
|
||||
<tr class="spell library-spell {{#if selected}}selected{{/if}}">
|
||||
<td class="spellName">
|
||||
<div style="margin: ">
|
||||
<paper-checkbox class="spell library-spell" checked={{selected}} style="padding: 2px 0 2px 16px; width: 100%;">
|
||||
{{spell.name}}
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
</tr>
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,7 +14,7 @@ const categories = [
|
||||
];
|
||||
|
||||
Template.spellLibraryDialog.onCreated(function(){
|
||||
this.selectedSpell = new ReactiveVar();
|
||||
this.selectedSpells = new ReactiveVar([]); //this holds an array of the selected spells by ID
|
||||
this.searchTerm = new ReactiveVar();
|
||||
this.categoriesOpen = new ReactiveVar([]);
|
||||
this.readyDict = new ReactiveDict();
|
||||
@@ -59,8 +59,12 @@ Template.spellLibraryDialog.helpers({
|
||||
});
|
||||
},
|
||||
isSelected(spell){
|
||||
const selected = Template.instance().selectedSpell.get();
|
||||
return selected && selected._id === spell._id;
|
||||
const selected = Template.instance().selectedSpells.get();
|
||||
return _.contains(selected, spell._id);
|
||||
},
|
||||
selectedCount(){
|
||||
const selected = Template.instance().selectedSpells.get();
|
||||
return selected && selected.length;
|
||||
},
|
||||
isOpen(key){
|
||||
const cats = Template.instance().categoriesOpen.get();
|
||||
@@ -89,10 +93,26 @@ Template.spellLibraryDialog.events({
|
||||
popDialogStack();
|
||||
},
|
||||
"click .okButton": function(event, template){
|
||||
popDialogStack(template.selectedSpell.get());
|
||||
const selectedIds = template.selectedSpells.get();
|
||||
var returnSpells = [];
|
||||
_.each(selectedIds, (id) => {
|
||||
let spell = LibrarySpells.findOne(id);
|
||||
if (spell) {
|
||||
returnSpells.push(spell)
|
||||
}
|
||||
});
|
||||
popDialogStack(returnSpells);
|
||||
},
|
||||
"click .library-spell": function(event, template){
|
||||
template.selectedSpell.set(this.spell);
|
||||
let selected = template.selectedSpells.get();
|
||||
const spellId = this.spell._id;
|
||||
// Toggle whether this spellId is in the array or not
|
||||
if (_.contains(selected, spellId)){
|
||||
selected = _.without(selected, spellId);
|
||||
} else {
|
||||
selected.push(spellId);
|
||||
}
|
||||
template.selectedSpells.set(selected);
|
||||
},
|
||||
"click #backButton": function(event, template){
|
||||
popDialogStack();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!-- data just needs charId -->
|
||||
<template name="addTHPDialog">
|
||||
<template name="addEHPDialog">
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="new-character-dialog flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
@@ -1,8 +1,8 @@
|
||||
Template.addTHPDialog.onRendered(function(){
|
||||
Template.addEHPDialog.onRendered(function(){
|
||||
this.find("#quantityInput").focus();
|
||||
});
|
||||
|
||||
Template.addTHPDialog.events({
|
||||
Template.addEHPDialog.events({
|
||||
"tap .addButton": function(event, instance){
|
||||
popDialogStack();
|
||||
var max = +instance.find("#quantityInput").value;
|
||||
@@ -6,6 +6,16 @@
|
||||
</template>
|
||||
|
||||
<template name="attributeDialogView">
|
||||
{{#if showNewUserExperience}}
|
||||
{{#infoBox}}
|
||||
<p>
|
||||
This dialog shows how your speed is set by the effect you added to your character's race.
|
||||
</p>
|
||||
<p>
|
||||
In DiceCloud you don't change stats directly, rather you add effects which impact your stats in different ways. This way, you can always tell where your stats came from, and how they got to their current value.
|
||||
</p>
|
||||
{{/infoBox}}
|
||||
{{/if}}
|
||||
<div class="layout horizontal center-justified end">
|
||||
<div class="paper-font-display2">
|
||||
{{attributeValue}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user