From 40a050d88facd88fcdfa2bfe7255b931bc3f54cf Mon Sep 17 00:00:00 2001 From: Thaum Date: Fri, 6 Mar 2015 11:03:09 +0000 Subject: [PATCH] Implemented Effect View for skills --- rpg-docs/Model/Character/SubSchemas/Skill.js | 2 +- rpg-docs/client/globalHelpers/GlobalUI.js | 9 +- rpg-docs/client/globalHelpers/detailHero.js | 5 +- rpg-docs/client/views/GeneralCSS/color.css | 44 ++-- .../client/views/GeneralCSS/globalDetail.css | 2 +- .../client/views/GeneralCSS/typography.css | 2 +- .../views/character/characterSheet.html | 4 +- .../client/views/character/characterSheet.js | 5 +- .../effects/effectView/effectView.html | 12 ++ .../effects/effectView/effectView.js | 133 ++++++++++++ .../effectsViewList/effectsViewList.html | 12 ++ .../effectsViewList/effectsViewList.js | 10 + .../features/featureDialog/featureDialog.js | 3 - .../views/character/persona/persona.html | 6 +- .../stats/abilityCards/abilityCards.html | 4 +- .../stats/skillDialog/skillDialog.html | 81 ++++++++ .../stats/skillDialog/skillDialog.js | 195 ++++++++++++++++++ .../character/stats/skillRow/skillRow.css | 1 + .../character/stats/skillRow/skillRow.html | 2 +- .../client/views/character/stats/stats.html | 59 +++--- .../client/views/character/stats/stats.js | 20 +- rpg-docs/client/views/layout/layout.css | 12 ++ rpg-docs/client/views/layout/layout.html | 38 +++- rpg-docs/client/views/layout/layout.js | 25 +++ .../colorDropdown/colorDropdown.html | 2 +- rpg-docs/public/png/paper-dice-crown.png | Bin 0 -> 78980 bytes rpg-docs/public/png/paperd20-256.png | Bin 0 -> 10677 bytes rpg-docs/public/png/paperd20-768.png | Bin 0 -> 60954 bytes 28 files changed, 602 insertions(+), 86 deletions(-) create mode 100644 rpg-docs/client/views/character/effects/effectView/effectView.html create mode 100644 rpg-docs/client/views/character/effects/effectView/effectView.js create mode 100644 rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.html create mode 100644 rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.js create mode 100644 rpg-docs/client/views/character/stats/skillDialog/skillDialog.html create mode 100644 rpg-docs/client/views/character/stats/skillDialog/skillDialog.js create mode 100644 rpg-docs/client/views/layout/layout.css create mode 100644 rpg-docs/public/png/paper-dice-crown.png create mode 100644 rpg-docs/public/png/paperd20-256.png create mode 100644 rpg-docs/public/png/paperd20-768.png diff --git a/rpg-docs/Model/Character/SubSchemas/Skill.js b/rpg-docs/Model/Character/SubSchemas/Skill.js index 21600fee..7ffa88a5 100644 --- a/rpg-docs/Model/Character/SubSchemas/Skill.js +++ b/rpg-docs/Model/Character/SubSchemas/Skill.js @@ -1,4 +1,4 @@ Schemas.Skill = new SimpleSchema({ //attribute name that this skill used as base mod for roll ability: { type: String, defaultValue: "" }, -}); \ No newline at end of file +}); diff --git a/rpg-docs/client/globalHelpers/GlobalUI.js b/rpg-docs/client/globalHelpers/GlobalUI.js index 8aeaf85e..64336d17 100644 --- a/rpg-docs/client/globalHelpers/GlobalUI.js +++ b/rpg-docs/client/globalHelpers/GlobalUI.js @@ -98,14 +98,7 @@ Template.layout.events({ }, "core-animated-pages-transition-end [detail-pages]": function(e) { var detailOpened = Session.get("global.ui.detailShow"); - if(detailOpened){ - //HACK by putting core-selected back on the main content section - //we stop it being hidden while the detail section is shown - $("#mainContentSection").addClass("core-selected"); - //but we still want to track whether it is or isn't actually selected - //so we can hide hero elements, since they are technically now shown as detail - $("#mainContentSection").addClass("fake-selected"); - } else { + if(!detailOpened){ Session.set("global.ui.detailData", null); Session.set("global.ui.detailTemplate", null); Session.set("global.ui.detailHeroId", null); diff --git a/rpg-docs/client/globalHelpers/detailHero.js b/rpg-docs/client/globalHelpers/detailHero.js index ad24922f..8ab5cfc3 100644 --- a/rpg-docs/client/globalHelpers/detailHero.js +++ b/rpg-docs/client/globalHelpers/detailHero.js @@ -1,5 +1,6 @@ -Template.registerHelper("detailHero", function(suffix){ - var id = suffix? this._id + suffix : this._id; +Template.registerHelper("detailHero", function(suffix, givenId){ + var id = givenId || this._id; + if(suffix) id += suffix; if ( Session.equals("global.ui.detailHeroId", id) ) { return "hero"; } diff --git a/rpg-docs/client/views/GeneralCSS/color.css b/rpg-docs/client/views/GeneralCSS/color.css index 4d5c88f6..f98b53d3 100644 --- a/rpg-docs/client/views/GeneralCSS/color.css +++ b/rpg-docs/client/views/GeneralCSS/color.css @@ -1,83 +1,83 @@ -html /deep/ .red { +.red { background-color: #F44336; } -html /deep/ .pink { +.pink { background-color: #E91E63; } -html /deep/ .purple { +.purple { background-color: #9C27B0; } -html /deep/ .deep-purple { +.deep-purple { background-color: #673AB7; } -html /deep/ .indigo { +.indigo { background-color: #3F51B5; } -html /deep/ .blue { +.blue { background-color: #2196F3; } -html /deep/ .light-blue { +.light-blue { background-color: #03A9F4; } -html /deep/ .cyan { +.cyan { background-color: #00BCD4; } -html /deep/ .teal { +.teal { background-color: #009688; } -html /deep/ .green { +.green { background-color: #4CAF50; } -html /deep/ .light-green { +.light-green { background-color: #8BC34A; } -html /deep/ .lime { +.lime { background-color: #CDDC39; } -html /deep/ .yellow { +.yellow { background-color: #FFEB3B; } -html /deep/ .amber { +.amber { background-color: #FFC107; } -html /deep/ .orange { +.orange { background-color: #FF9800; } -html /deep/ .deep-orange { +.deep-orange { background-color: #FF5722; } -html /deep/ .brown { +.brown { background-color: #795548; } -html /deep/ .grey { +.grey { background-color: #9E9E9E; } -html /deep/ .blue-grey { +.blue-grey { background-color: #607D8B; } -html /deep/ .white { +.white { background-color: #ffffff; } -html /deep/ .black { - background-color: #000000; +.black { + background-color: #262626; } \ No newline at end of file diff --git a/rpg-docs/client/views/GeneralCSS/globalDetail.css b/rpg-docs/client/views/GeneralCSS/globalDetail.css index 850317fa..ebcf6a11 100644 --- a/rpg-docs/client/views/GeneralCSS/globalDetail.css +++ b/rpg-docs/client/views/GeneralCSS/globalDetail.css @@ -63,6 +63,6 @@ } } -.fake-selected [hero] { +.not-selected [hero] { visibility: hidden; } diff --git a/rpg-docs/client/views/GeneralCSS/typography.css b/rpg-docs/client/views/GeneralCSS/typography.css index 015b724f..d4c1c273 100644 --- a/rpg-docs/client/views/GeneralCSS/typography.css +++ b/rpg-docs/client/views/GeneralCSS/typography.css @@ -82,7 +82,7 @@ p, .body1, body { letter-spacing: 0.010em; } -.white-text p{ +.white-text p, .white-text .body1{ color: rgba(255,255,255,0.87); } diff --git a/rpg-docs/client/views/character/characterSheet.html b/rpg-docs/client/views/character/characterSheet.html index ee111a06..24e58deb 100644 --- a/rpg-docs/client/views/character/characterSheet.html +++ b/rpg-docs/client/views/character/characterSheet.html @@ -5,7 +5,9 @@
{{name}}
- +
+ {{> colorDropdown}} +
Stats diff --git a/rpg-docs/client/views/character/characterSheet.js b/rpg-docs/client/views/character/characterSheet.js index c603c1b0..1f4ec519 100644 --- a/rpg-docs/client/views/character/characterSheet.js +++ b/rpg-docs/client/views/character/characterSheet.js @@ -22,5 +22,8 @@ Template.characterSheet.events({ }, "tap #characterSheetTabs paper-tab": function(event, instance){ setTab(this._id, event.currentTarget.getAttribute("name")); - } + }, + "color-change": function(event, instance){ + Characters.update(this._id, {$set: {color: event.color}}); + }, }); diff --git a/rpg-docs/client/views/character/effects/effectView/effectView.html b/rpg-docs/client/views/character/effects/effectView/effectView.html new file mode 100644 index 00000000..4208b334 --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectView/effectView.html @@ -0,0 +1,12 @@ + diff --git a/rpg-docs/client/views/character/effects/effectView/effectView.js b/rpg-docs/client/views/character/effects/effectView/effectView.js new file mode 100644 index 00000000..b803f8ad --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectView/effectView.js @@ -0,0 +1,133 @@ +//TODO add dexterity armor +var stats = { + "strength":{"name":"Strength"}, + "dexterity":{"name":"Dexterity"}, + "constitution":{"name":"Constitution"}, + "intelligence":{"name":"Intelligence"}, + "wisdom":{"name":"Wisdom"}, + "charisma":{"name":"Charisma"}, + "strengthSave":{"name":"Strength Save",}, + "dexteritySave":{"name":"Dexterity Save",}, + "constitutionSave":{"name":"Constitution Save",}, + "intelligenceSave":{"name":"Intelligence Save",}, + "wisdomSave":{"name":"Wisdom Save",}, + "charismaSave":{"name":"Charisma Save",}, + "acrobatics":{"name":"Acrobatics",}, + "animalHandling":{"name":"Animal Handling",}, + "arcana":{"name":"Arcana",}, + "athletics":{"name":"Athletics",}, + "deception":{"name":"Deception",}, + "history":{"name":"History",}, + "insight":{"name":"Insight",}, + "intimidation":{"name":"Intimidation",}, + "investigation":{"name":"Investigation",}, + "medicine":{"name":"Medicine",}, + "nature":{"name":"Nature",}, + "perception":{"name":"Perception",}, + "performance":{"name":"Performance",}, + "persuasion":{"name":"Persuasion",}, + "religion":{"name":"Religion",}, + "sleightOfHand":{"name":"Sleight of Hand",}, + "stealth":{"name":"Stealth",}, + "survival":{"name":"Survival",}, + "initiative":{"name":"Initiative",}, + "hitPoints":{"name":"Hit Points"}, + "armor":{"name":"Armor"}, + "dexterityArmor":{"name":"Dexterity Armor Bonus"} + ,"speed":{"name":"Speed"}, + "proficiencyBonus":{"name":"Proficiency Bonus"}, + "ki":{"name":"Ki Points"}, + "sorceryPoints":{"name":"Sorcery Points"}, + "rages":{"name":"Rages"}, + "rageDamage":{"name":"Rage Damage"}, + "expertiseDice":{"name":"Expertise Dice"}, + "superiorityDice":{"name":"Superiority Dice"}, + "level1SpellSlots":{"name":"level 1 Spell Slots"}, + "level2SpellSlots":{"name":"level 2 Spell Slots"}, + "level3SpellSlots":{"name":"level 3 Spell Slots"}, + "level4SpellSlots":{"name":"level 4 Spell Slots"}, + "level5SpellSlots":{"name":"level 5 Spell Slots"}, + "level6SpellSlots":{"name":"level 6 Spell Slots"}, + "level7SpellSlots":{"name":"level 7 Spell Slots"}, + "level8SpellSlots":{"name":"level 8 Spell Slots"}, + "level9SpellSlots":{"name":"level 9 Spell Slots"}, + "d6HitDice":{"name":"d6 Hit Dice"}, + "d8HitDice":{"name":"d8 Hit Dice"}, + "d10HitDice":{"name":"d10 Hit Dice"}, + "d12HitDice":{"name":"d12 Hit Dice"}, + "acidMultiplier":{"name":"Acid", "group": "Weakness/Resistance"}, + "bludgeoningMultiplier":{"name":"Bludgeoning", "group": "Weakness/Resistance"}, + "coldMultiplier":{"name":"Cold", "group": "Weakness/Resistance"}, + "fireMultiplier":{"name":"Fire", "group": "Weakness/Resistance"}, + "forceMultiplier":{"name":"Force", "group": "Weakness/Resistance"}, + "lightningMultiplier":{"name":"Lightning", "group": "Weakness/Resistance"}, + "necroticMultiplier":{"name":"Necrotic", "group": "Weakness/Resistance"}, + "piercingMultiplier":{"name":"Piercing", "group": "Weakness/Resistance"}, + "poisonMultiplier":{"name":"Poison", "group": "Weakness/Resistance"}, + "psychicMultiplier":{"name":"Psychic", "group": "Weakness/Resistance"}, + "radiantMultiplier":{"name":"Radiant", "group": "Weakness/Resistance"}, + "slashingMultiplier":{"name":"Slashing", "group": "Weakness/Resistance"}, + "thunderMultiplier":{"name":"Thunder", "group": "Weakness/Resistance"} +}; + +var operations = { + base: {name: "Base Value"}, + proficiency: {name: "Proficiency"}, + add: {name: "Add"}, + mul: {name: "Multiply"}, + min: {name: "Min"}, + max: {name: "Max"}, + advantage: {name: "Advantage"}, + disadvantage: {name: "Disadvantage"}, + passiveAdd: {name: "Passive Bonus"}, + fail: {name: "Automatically Fail"}, + conditional: {name: "Conditional Benefit"} +}; + +Template.effectView.helpers({ + sourceName: function(){ + var id = this.sourceId; + if(!id) return; + switch(this.type){ + case "feature": + return "Feature - " + Features.findOne(id, {fields: {name: 1}}).name; + case "class": + return Classes.findOne(id, {fields: {name: 1}}).name; + case "buff": + return "Buff - " + Buffs.findOne(id, {fields: {name: 1}}).name; + case "equipment": + return "Equipment - " + Items.findOne(id, {fields: {name: 1}}).name; + case "racial": + return Characters.findOne(this.charId, {fields: {race: 1}}).race; + case "inate": + return "Inate" + } + }, + statName: function(){ + return stats[this.stat] && stats[this.stat].name || "No Stat" + }, + operationName: function(){ + if(this.operation === "proficiency") return null; + if(stats[this.stat].group === "Weakness/Resistance") return null; + return operations[this.operation] && operations[this.operation].name || "No Operation" + }, + statValue: function(){ + if(this.operation === "advantage" || + this.operation === "disadvantage" || + this.operation === "fail" || + this.operation === "conditional"){ + return null; + } + if(this.operation === "proficiency"){ + if(this.value == 0.5 || this.calculation == 0.5) return "Half Proficiency"; + if(this.value == 1 || this.calculation == 1) return "Proficiency"; + if(this.value == 2 || this.calculation == 2) return "Double Proficiency"; + } + if(stats[this.stat].group === "Weakness/Resistance"){ + if(this.value == 0.5 || this.calculation == 0.5) return "Resistance"; + if(this.value == 2 || this.calculation == 2) return "Vulnerability"; + if(this.value == 0 || this.calculation == 0) return "Immunity"; + } + return this.calculation || this.value; + } +}); diff --git a/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.html b/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.html new file mode 100644 index 00000000..173e780c --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.html @@ -0,0 +1,12 @@ + + diff --git a/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.js b/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.js new file mode 100644 index 00000000..92427188 --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectsViewList/effectsViewList.js @@ -0,0 +1,10 @@ +Template.effectsViewList.helpers({ + effects: function(){ + if(this.sourceId){ + return Effects.find({sourceId: this.sourceId, type: this.type, charId: this.charId}, {fields: {sourceId: 0}}); + } else if(this.stat){ + return Effects.find({charId: this.charId, stat: this.stat}); + } + + } +}); diff --git a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js index 6770f9d1..7af79601 100644 --- a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js +++ b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js @@ -36,8 +36,5 @@ Template.featureDialog.helpers({ }, usesSet: function(){ return _.isString(this.uses); - }, - colorClass: function(){ - return getColorClass(this.color) } }); \ No newline at end of file diff --git a/rpg-docs/client/views/character/persona/persona.html b/rpg-docs/client/views/character/persona/persona.html index b67e2153..85f69e82 100644 --- a/rpg-docs/client/views/character/persona/persona.html +++ b/rpg-docs/client/views/character/persona/persona.html @@ -22,9 +22,9 @@