From cab5aa07f3f0d656f607ca86f5762f4506e3fe24 Mon Sep 17 00:00:00 2001 From: Anthony Murphy Date: Sun, 18 Sep 2022 21:31:15 +1000 Subject: [PATCH] Add New Ranks chceckboxes Fix Updates for Skill/Skill Category Totals Inventory Implementation --- rmss/README.md | 2 +- rmss/TODO | 17 +- rmss/lang/en.json | 7 +- rmss/less/actor-sheet/actor-sheet-armor.less | 44 +++ rmss/less/actor-sheet/actor-sheet-herbs.less | 44 +++ rmss/less/actor-sheet/actor-sheet-items.less | 42 ++ rmss/less/actor-sheet/actor-sheet-money.less | 9 + .../actor-sheet/actor-sheet-skillcat.less | 49 +++ rmss/less/actor-sheet/actor-sheet-skills.less | 48 +++ .../less/actor-sheet/actor-sheet-weapons.less | 46 +++ rmss/less/actor-sheet/actor-sheet.less | 157 ++++++++ rmss/less/rmss.less | 25 +- .../skillcat-sheet/applicable-stats-grid.less | 19 + rmss/less/skillcat-sheet/skillcat-sheet.less | 23 ++ rmss/module/config.js | 8 +- rmss/module/documents/actor.js | 23 +- .../module/sheets/actors/rmss_player_sheet.js | 76 +++- .../skills/rmss_skill_category_sheet.js | 78 ++-- rmss/module/sheets/skills/rmss_skill_sheet.js | 80 ++-- rmss/rmss.css | 360 ++++++++++++------ rmss/rmss.js | 138 ++++--- rmss/template.json | 34 +- .../sheets/actors/parts/actor-armor.html | 29 ++ .../sheets/actors/parts/actor-herbs.html | 25 ++ .../sheets/actors/parts/actor-items.html | 39 +- .../sheets/actors/parts/actor-skills.html | 10 +- .../sheets/actors/parts/actor-stats.html | 22 +- .../sheets/actors/parts/actor-weapons.html | 33 ++ .../sheets/actors/rmss-character-sheet.html | 9 + .../sheets/items/rmss-armor-sheet.html | 4 + .../sheets/items/rmss-weapon-sheet.html | 4 + .../sheets/skills/rmss-skill-sheet.html | 9 +- 32 files changed, 1180 insertions(+), 333 deletions(-) create mode 100644 rmss/less/actor-sheet/actor-sheet-armor.less create mode 100644 rmss/less/actor-sheet/actor-sheet-herbs.less create mode 100644 rmss/less/actor-sheet/actor-sheet-items.less create mode 100644 rmss/less/actor-sheet/actor-sheet-money.less create mode 100644 rmss/less/actor-sheet/actor-sheet-skillcat.less create mode 100644 rmss/less/actor-sheet/actor-sheet-skills.less create mode 100644 rmss/less/actor-sheet/actor-sheet-weapons.less create mode 100644 rmss/less/actor-sheet/actor-sheet.less create mode 100644 rmss/less/skillcat-sheet/applicable-stats-grid.less create mode 100644 rmss/less/skillcat-sheet/skillcat-sheet.less create mode 100644 rmss/templates/sheets/actors/parts/actor-armor.html create mode 100644 rmss/templates/sheets/actors/parts/actor-herbs.html create mode 100644 rmss/templates/sheets/actors/parts/actor-weapons.html diff --git a/rmss/README.md b/rmss/README.md index 2e536ec..89bb64e 100644 --- a/rmss/README.md +++ b/rmss/README.md @@ -1,4 +1,4 @@ -This tutorial is based on the video tutorials by Cédric Hauteville you can watch them here: https://www.youtube.com/playlist?list=PLFV9z59nkHDccUbRXVt623UdloPTclIrz parts of it were also lifted from the Foundry VTT Boilerplate system by XXX. +This system is based on the video tutorials by Cédric Hauteville you can watch them here: https://www.youtube.com/playlist?list=PLFV9z59nkHDccUbRXVt623UdloPTclIrz parts of it were also lifted from the Foundry VTT Boilerplate system by XXX. Icons have been sourced from https://game-icons.net diff --git a/rmss/TODO b/rmss/TODO index 7d64476..57ce342 100644 --- a/rmss/TODO +++ b/rmss/TODO @@ -1,27 +1,28 @@ Small 1. DONE - Add Relationship between skills and skill categories -2. Remove Tables and replace with CSS Grid -3. Fix unaligned CSS +2. DONE - Remove Tables from Player Sheet and replace with CSS Grid +3. DONE - Fix unaligned CSS 4. Prevent Duplication on Drag and Drop for Skills and Skill Categories, possibly spells too. DONE - Overriden _onDropItem on Player Sheet DONE - Skill Categories cannot be renamed if they are owned. DONE - Skills and Skill Categories are now seperate checks for Drag and Drop as some share names Spells ? -5. Fix New Ranks Clickboxes - https://discord.com/channels/170995199584108546/670336275496042502/1018530650980102195 +5. DONE - Fix New Ranks Clickboxes - https://discord.com/channels/170995199584108546/670336275496042502/1018530650980102195 https://github.com/megastruktur/foundryvtt-blades-in-the-dark/blob/master/templates/actor-sheet.html#L97 https://github.com/megastruktur/foundryvtt-blades-in-the-dark/blob/00bed1cb1d222eab3ece62960941c54f3c272aac/module/blades.js#L69 6. DONE - Fix Favorites Clickboxes on Actor Page DONE - Better Icon DONE - Make Clickable 7. Create Default Values for Character sheet +8. Make a Localization Pass for Missed Text Medium -1. Inventory sorted by types - i. Drag and drop should increment an item if it already exists. - ii. Equipables - iii. Favorites +1. DONE Inventory sorted by types - Maybe Seperate Sections for now + DONE (Will not Do - Not needed) - i. Drag and drop should increment an item if it already exists. + DONE ii. Equipables + DONE (Will not Do - Not Needed)iii. Favorites 2. Creature Sheet 3. Finish Character Sheet Inventory @@ -29,7 +30,7 @@ Medium Status Record (Possibly large) XP 4. Button to add all Skill Categories -5. Revisit Skill and Skill Category Progression (Pg 33) +5. Revisit Skill and Skill Category Progression (Pg 33, 69) 6. DONE - Add occupational, everyman, and restricted skill categories Large diff --git a/rmss/lang/en.json b/rmss/lang/en.json index aad52f7..bb9fd85 100644 --- a/rmss/lang/en.json +++ b/rmss/lang/en.json @@ -130,6 +130,7 @@ "add_skillcat": "Add Skill Category" }, "pc_sheet_items": { + "equipped": "Equipped", "favorite": "Favorite", "quantity": "Quantity", "item_name": "Item Name", @@ -163,7 +164,8 @@ "quantity": "Quantity", "weight": "Weight", "cost": "Cost", - "prod_time": "Production Time" + "prod_time": "Production Time", + "equipped": "Equipped" }, "armor": { "at": "AT", @@ -178,7 +180,8 @@ "weight": "Weight", "breakage_range": "B#s", "strength": "Str", - "fumble_range": "Fumble" + "fumble_range": "Fumble", + "equipped": "Equipped" }, "herb_or_poison": { "codes": "Codes", diff --git a/rmss/less/actor-sheet/actor-sheet-armor.less b/rmss/less/actor-sheet/actor-sheet-armor.less new file mode 100644 index 0000000..e65941f --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-armor.less @@ -0,0 +1,44 @@ +.armor-grid-container { + display: grid; + grid-template-columns: [name] 30% [equipped] 12% [at] 12% [quantity] 12% [weight] 12% [cost] 12% [controls] 10%; +} + +.armor-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} + +.armor-grid-container > div:nth-child(14n+1), +.armor-grid-container > div:nth-child(14n+2), +.armor-grid-container > div:nth-child(14n+3), +.armor-grid-container > div:nth-child(14n+4), +.armor-grid-container > div:nth-child(14n+5), +.armor-grid-container > div:nth-child(14n+6), +.armor-grid-container > div:nth-child(14n+7) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.armor-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-herbs.less b/rmss/less/actor-sheet/actor-sheet-herbs.less new file mode 100644 index 0000000..04ad2f1 --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-herbs.less @@ -0,0 +1,44 @@ +.herbs-grid-container { + display: grid; + grid-template-columns: [name] 30% [quantity] 11% [codes] 12% [af] 12% [weight] 12% [cost] 11% [controls] 12%; +} + +.herbs-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} + +.herbs-grid-container > div:nth-child(14n+1), +.herbs-grid-container > div:nth-child(14n+2), +.herbs-grid-container > div:nth-child(14n+3), +.herbs-grid-container > div:nth-child(14n+4), +.herbs-grid-container > div:nth-child(14n+5), +.herbs-grid-container > div:nth-child(14n+6), +.herbs-grid-container > div:nth-child(14n+7) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.herbs-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-items.less b/rmss/less/actor-sheet/actor-sheet-items.less new file mode 100644 index 0000000..cb4e4fc --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-items.less @@ -0,0 +1,42 @@ +.items-grid-container { + display: grid; + grid-template-columns: [name] 30% [quantity] 17% [weight] 17% [cost] 18% [controls] 18%; +} + +.items-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} + +.items-grid-container > div:nth-child(10n+1), +.items-grid-container > div:nth-child(10n+2), +.items-grid-container > div:nth-child(10n+3), +.items-grid-container > div:nth-child(10n+4), +.items-grid-container > div:nth-child(10n+5) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.items-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-money.less b/rmss/less/actor-sheet/actor-sheet-money.less new file mode 100644 index 0000000..9403788 --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-money.less @@ -0,0 +1,9 @@ +.money-column { + flex-direction: column; +} + +.money-container { + flex-direction: column; + flex-shrink: 1; + padding-left: 10px; + } \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-skillcat.less b/rmss/less/actor-sheet/actor-sheet-skillcat.less new file mode 100644 index 0000000..c3794e6 --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-skillcat.less @@ -0,0 +1,49 @@ +.skillcat-grid-container { + display: grid; + grid-template-columns: [skill-category-name] 10% [applicable-stats] 10% [dev-cost] 8% [num-ranks] 8% [new-ranks] 8% [rank-bonus] 8% [stat-bonus] 8% [prof-bonus] 8% [special-bonus-1] 8% [special-bonus-2] 8% [total-bonus] 8% [controls] 8%; +} + +.skillcat-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; +} + +.skillcat-grid-container > div:nth-child(24n+1), +.skillcat-grid-container > div:nth-child(24n+2), +.skillcat-grid-container > div:nth-child(24n+3), +.skillcat-grid-container > div:nth-child(24n+4), +.skillcat-grid-container > div:nth-child(24n+5), +.skillcat-grid-container > div:nth-child(24n+6), +.skillcat-grid-container > div:nth-child(24n+7), +.skillcat-grid-container > div:nth-child(24n+8), +.skillcat-grid-container > div:nth-child(24n+9), +.skillcat-grid-container > div:nth-child(24n+10), +.skillcat-grid-container > div:nth-child(24n+11), +.skillcat-grid-container > div:nth-child(24n+12) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.skillcat-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-skills.less b/rmss/less/actor-sheet/actor-sheet-skills.less new file mode 100644 index 0000000..090627f --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-skills.less @@ -0,0 +1,48 @@ +.skills-grid-container { + display: grid; + grid-template-columns: [favorite] 9% [skill-name] 11% [num-ranks] 9% [new-ranks] 9% [rank-bonus] 9% [category-bonus] 9% [item-bonus] 9% [special-bonus-1] 9% [special-bonus-2] 9% [total-bonus] 9% [controls] 8%; +} + +.skills-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; +} + +.skills-grid-container > div:nth-child(22n+1), +.skills-grid-container > div:nth-child(22n+2), +.skills-grid-container > div:nth-child(22n+3), +.skills-grid-container > div:nth-child(22n+4), +.skills-grid-container > div:nth-child(22n+5), +.skills-grid-container > div:nth-child(22n+6), +.skills-grid-container > div:nth-child(22n+7), +.skills-grid-container > div:nth-child(22n+8), +.skills-grid-container > div:nth-child(22n+9), +.skills-grid-container > div:nth-child(22n+10), +.skills-grid-container > div:nth-child(22n+11) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.skills-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet-weapons.less b/rmss/less/actor-sheet/actor-sheet-weapons.less new file mode 100644 index 0000000..91426e9 --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet-weapons.less @@ -0,0 +1,46 @@ +.weapons-grid-container { + display: grid; + grid-template-columns: [name] 30% [equipped] 8% [breakage_range] 9% [fumble_range] 9% [strength] 9% [quantity] 9% [weight] 9% [cost] 9% [controls] 8%; +} + +.weapons-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} + +.weapons-grid-container > div:nth-child(18n+1), +.weapons-grid-container > div:nth-child(18n+2), +.weapons-grid-container > div:nth-child(18n+3), +.weapons-grid-container > div:nth-child(18n+4), +.weapons-grid-container > div:nth-child(18n+5), +.weapons-grid-container > div:nth-child(18n+6), +.weapons-grid-container > div:nth-child(18n+7), +.weapons-grid-container > div:nth-child(18n+8), +.weapons-grid-container > div:nth-child(18n+9) +{ + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} + +.weapons-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} \ No newline at end of file diff --git a/rmss/less/actor-sheet/actor-sheet.less b/rmss/less/actor-sheet/actor-sheet.less new file mode 100644 index 0000000..6ef0db4 --- /dev/null +++ b/rmss/less/actor-sheet/actor-sheet.less @@ -0,0 +1,157 @@ +// General Elements + +.container { + display: flex; + } + +// Header CSS + +.actor-icon { + flex-shrink: 1; + } + + +.header-container { + flex-grow: 2; + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.header-text { + display: flex; + align-items: center; + padding: 1px; + } + +// Resource Elements in Headers + +.resource-container { + display: flex; + flex-direction: row; + flex-grow: 3; + text-align: -webkit-center; +} + +.resource-container > * { + flex: 1 1 0; +} + +.resource-entry { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.resource-entry input{ + width: 50px; + border: none; +} + +.stat-container { + flex-direction: column; + flex-shrink: 1; + } + +.stat-row { + align-items: center; +} + +.equipment-container { + flex-direction: column; + flex-grow: 1; + } + +.stat-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.stat-name, .money-name { + width: 75px; + border: none; + font-family: Signika, sans-serif; + font-size: 12px; +} + +.stat-name input { + border: none; +} + +.stat-header { + font-family: Signika, sans-serif; + font-size: 12px; +} + +// Fixed Info CSS + +.fixed-info-container { + flex-grow: 3; + flex-direction: row; + font-family: Signika, sans-serif; + font-size: 12px; +} + +.fixed-info-section { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.armor-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.race-stat-fixed-info-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.role-traits-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.background-info-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +.resistance-block { + outline: 1px solid; /* use instead of border */ + margin-top: 1px; + margin-left: 1px; + padding: 5px; +} + +// Debugging + +.red { + background-color: orangered; +} + +.blue { + background-color: lightblue; +} + +.grey { + background-color: lightgrey; +} + +.green { + background-color: lightseagreen; +} \ No newline at end of file diff --git a/rmss/less/rmss.less b/rmss/less/rmss.less index c81e97d..dea34f7 100644 --- a/rmss/less/rmss.less +++ b/rmss/less/rmss.less @@ -1,6 +1,21 @@ + +// Actor Sheet +@import "./actor-sheet/actor-sheet-skillcat.less"; +@import "./actor-sheet/actor-sheet.less"; +@import "./actor-sheet/actor-sheet-skills.less"; +@import "./actor-sheet/actor-sheet-money.less"; +@import "./actor-sheet/actor-sheet-items.less"; +@import "./actor-sheet/actor-sheet-weapons.less"; +@import "./actor-sheet/actor-sheet-armor.less"; +@import "./actor-sheet/actor-sheet-herbs.less"; + + + +//Skill Category Sheet + +@import "./skillcat-sheet/skillcat-sheet.less"; +@import "./skillcat-sheet/applicable-stats-grid.less"; + +// Generics @import "./item-sheet.less"; -@import "./actor-sheet.less"; -@import "./skillcat-sheet.less"; -@import "./money-sheet.less"; -@import "./table.less"; -@import "./grid.less"; \ No newline at end of file +//@import "./table.less"; diff --git a/rmss/less/skillcat-sheet/applicable-stats-grid.less b/rmss/less/skillcat-sheet/applicable-stats-grid.less new file mode 100644 index 0000000..c6fa27f --- /dev/null +++ b/rmss/less/skillcat-sheet/applicable-stats-grid.less @@ -0,0 +1,19 @@ + + +.applicable-stats-grid-container { + display: grid; + grid-template-columns: [app-stat-1] 33% [app-stat-2] 33% [app-stat-3] 33%; +} + +.applicable-stats-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; +} \ No newline at end of file diff --git a/rmss/less/skillcat-sheet/skillcat-sheet.less b/rmss/less/skillcat-sheet/skillcat-sheet.less new file mode 100644 index 0000000..0399a73 --- /dev/null +++ b/rmss/less/skillcat-sheet/skillcat-sheet.less @@ -0,0 +1,23 @@ +.skillcat-name, .skill-name, .item-name { + font-family: Signika, sans-serif; + font-size: 12px; + font-weight: bold; + text-align: center; +} + +.skillcat-entry, .skill-entry, .item-entry { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; +} + +.skillcat-headeritem, .skill-headeritem, .item-headeritem { + text-align: center; + font-weight: bold; +} + +.skillcat-controls, .skill-controls, .item-controls { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; +} \ No newline at end of file diff --git a/rmss/module/config.js b/rmss/module/config.js index 6f88887..3561be5 100644 --- a/rmss/module/config.js +++ b/rmss/module/config.js @@ -53,8 +53,8 @@ rmss.stats = { }; rmss.skill_designations = { - none: "None", - occupational: "Occupational", - everyman: "Everyman", - restricted: "Restricted" + None: "None", + Occupational: "Occupational", + Everyman: "Everyman", + Restricted: "Restricted" }; diff --git a/rmss/module/documents/actor.js b/rmss/module/documents/actor.js index 3e13c82..814d0a0 100644 --- a/rmss/module/documents/actor.js +++ b/rmss/module/documents/actor.js @@ -146,26 +146,17 @@ export class RMSSActor extends Actor { // For each skill category return an object in this format. // {{ _id: "skill category name"}} // This is the format that the select helper on the skill sheet needs - getOwnedSkillCategories() { - var ownedSkillCategories = {None: "None"}; - console.log("rmss | actor.js | Getting owned skill categories for: " + this.name); + + getOwnedItemsByType(item_type) { + var ownedItems = {None: "None"}; + console.log("rmss | actor.js | Getting owned " + item_type + " for: " + this.name); for (const item of this.items) { - if (item.type === "skill_category") { - ownedSkillCategories[item._id] = item.name; + if (item.type === item_type) { + ownedItems[item._id] = item.name; } } - return(ownedSkillCategories); + return(ownedItems); } - getOwnedSkills() { - var ownedSkills = {None: "None"}; - console.log("rmss | actor.js | Getting owned skills for: " + this.name); - for (const item of this.items) { - if (item.type === "skill") { - ownedSkills[item._id] = item.name; - } - } - return(ownedSkills); - } } \ No newline at end of file diff --git a/rmss/module/sheets/actors/rmss_player_sheet.js b/rmss/module/sheets/actors/rmss_player_sheet.js index fcb0421..f2df6ee 100644 --- a/rmss/module/sheets/actors/rmss_player_sheet.js +++ b/rmss/module/sheets/actors/rmss_player_sheet.js @@ -45,9 +45,7 @@ export default class RMSSPlayerSheet extends ActorSheet { if (itemData.type === "skill_category"){ // Get the already owned Items from the actor and push into an array - const owneditems = this.object.getOwnedSkillCategories(); - - console.log(owneditems); + const owneditems = this.object.getOwnedItemsByType("skill_category"); var ownedskillcatlist = Object.values(owneditems); @@ -58,9 +56,7 @@ export default class RMSSPlayerSheet extends ActorSheet { } } else if ( itemData.type === "skill") { // Get the already owned Items from the actor and push into an array - const owneditems = this.object.getOwnedSkills(); - - console.log(owneditems); + const owneditems = this.object.getOwnedItemsByType("skill"); var ownedskilllist = Object.values(owneditems); @@ -84,14 +80,23 @@ export default class RMSSPlayerSheet extends ActorSheet { const gear = []; const playerskill= []; const skillcat = []; + const weapons = []; + const equipables = []; + const herbs = []; // Iterate through items, allocating to containers for (let i of context.items) { i.img = i.img || DEFAULT_TOKEN; // Append to gear. - if (i.type === 'item' || i.type === 'armor' || i.type === 'weapon' || i.type === 'herb_or_poison') { + if (i.type === 'item') { gear.push(i); } + else if (i.type === 'weapon') { + weapons.push(i); + } + else if (i.type === 'herb_or_poison') { + herbs.push(i); + } // Append to skill categories. else if (i.type === 'skill_category') { skillcat.push(i); @@ -99,9 +104,13 @@ export default class RMSSPlayerSheet extends ActorSheet { // Append to playerskill else if (i.type === 'skill') { playerskill.push(i); + } + else if (i.type === 'armor') { + equipables.push(i); } } + // Sort Skill/Skillcat Arrays skillcat.sort(function (a, b){ if (a.name < b.name) { @@ -128,13 +137,14 @@ export default class RMSSPlayerSheet extends ActorSheet { context.gear = gear; context.skillcat = skillcat; context.playerskill = playerskill; + context.weapons = weapons; + context.equipables = equipables; + context.herbs = herbs; } activateListeners(html) { super.activateListeners(html); - // NOTE: Can you do skill/item favorites this way? - // Render the item sheet for viewing/editing prior to the editable check. html.find('.item-edit').click(ev => { const item = this.actor.items.get(ev.currentTarget.getAttribute("data-item-id")); @@ -151,8 +161,8 @@ export default class RMSSPlayerSheet extends ActorSheet { // Delete Item html.find('.item-delete').click(ev => { + console.log(ev.currentTarget.getAttribute("data-item-id")); const item = this.actor.items.get(ev.currentTarget.getAttribute("data-item-id")); - //console.log(ev.currentTarget.getAttribute("data-item-id")); item.delete(); }); @@ -170,6 +180,52 @@ export default class RMSSPlayerSheet extends ActorSheet { } console.log("After change: " + item.system.favorite); }); + + // Equip/Unequip Item + html.find('.equippable').click(ev => { + const item = this.actor.items.get(ev.currentTarget.getAttribute("data-item-id")); + console.log(item); + console.log("Before change: " + item.system.equipped); + if (item.system.equipped === true) { + console.log("Setting False"); + item.update({system: {"equipped": false}}); + } else { + console.log("Setting True"); + item.update({system: {"equipped": true}}); + } + console.log("After change: " + item.system.equipped); + }); + + // Change New Ranks value when clicked in player sheet. From 0-3. + html.find('.skill-newrank').click(ev => { + const item = this.actor.items.get(ev.currentTarget.getAttribute("data-item-id")); + + console.log("Firing in the Player Sheet"); + console.log(ev.currentTarget.getAttribute("value")); + console.log(ev.currentTarget.getAttribute("data-item-id")); + + switch(ev.currentTarget.getAttribute("value")) { + case "0": + console.log("Skill NewRanks is 0 setting to 1"); + item.update({system: {new_ranks:{ "value": 1 }}}); + break; + + case "1": + console.log("Skill NewRanks is 1 setting to 2"); + item.update({system: {new_ranks:{ "value": 2 }}}); + break; + + case "2": + console.log("Skill NewRanks is 2 setting to 3"); + item.update({system: {new_ranks:{ "value": 3 }}}); + break; + + case "3": + console.log("Skill NewRanks is 3 setting to 0"); + item.update({system: {new_ranks:{ "value": 0 }}}); + break; + } + }); } async _onItemCreate(event) { diff --git a/rmss/module/sheets/skills/rmss_skill_category_sheet.js b/rmss/module/sheets/skills/rmss_skill_category_sheet.js index 01bcc02..191c989 100644 --- a/rmss/module/sheets/skills/rmss_skill_category_sheet.js +++ b/rmss/module/sheets/skills/rmss_skill_category_sheet.js @@ -21,17 +21,16 @@ export default class RMSSSkillCategorySheet extends ItemSheet { const context = await super.getData(); // Get a list of stats that can be used as applicable stats - var applicable_stat_list = this.prepareApplicableStatValues(CONFIG); + var applicableStatList = this.prepareApplicableStatNames(CONFIG); //Get the currently selected value for all three applicable stats - var applicable_stat_1_selected = this.prepareApplicableSelectedStat("app_stat_1"); - var applicable_stat_2_selected = this.prepareApplicableSelectedStat("app_stat_2"); - var applicable_stat_3_selected = this.prepareApplicableSelectedStat("app_stat_3"); + var firstApplicableStat = this.prepareApplicableSelectedStat("app_stat_1"); + var secondApplicableStat = this.prepareApplicableSelectedStat("app_stat_2"); + var thirdApplicableStat = this.prepareApplicableSelectedStat("app_stat_3"); // Build and apply the display string for Applicable Stats - var applicable_stat_text = this.buildApplicableStatsText(applicable_stat_1_selected, applicable_stat_2_selected, applicable_stat_3_selected); - //context.item.system['applicable_stats'] = applicable_stat_text; - context.item.system.applicable_stats = applicable_stat_text; + var applicableStatText = this.buildApplicableStatsText(firstApplicableStat, secondApplicableStat, thirdApplicableStat); + context.item.system.applicable_stats = applicableStatText; var enrichedDescription = await TextEditor.enrichHTML(this.item.system.description, {async: true}); @@ -41,55 +40,57 @@ export default class RMSSSkillCategorySheet extends ItemSheet { item: context.item, system: context.item.system, config: CONFIG.rmss, - applicable_stat_list: applicable_stat_list, - applicable_stat_1_selected: applicable_stat_1_selected, - applicable_stat_2_selected: applicable_stat_2_selected, - applicable_stat_3_selected: applicable_stat_3_selected, + applicable_stat_list: applicableStatList, + applicable_stat_1_selected: firstApplicableStat, + applicable_stat_2_selected: secondApplicableStat, + applicable_stat_3_selected: thirdApplicableStat, enrichedDescription: enrichedDescription }; return sheetData; } async _setApplicableStat(item, ev) { - // Build a JSON Object from the select tag value and select name (item data attribute key) - var update_key = ev.currentTarget.getAttribute("name"); - var update_data = ev.target.value; + // Build a JSON Object from the selected tag value and selected name (item data attribute key) + var updateKey = ev.currentTarget.getAttribute("name"); + var updateData = ev.target.value; // Update Item Data - await item.update({[update_key]: update_data}); + await item.update({[updateKey]: updateData}); } - prepareApplicableStatValues(CONFIG) { - var applicable_stat_list = {None: "None"}; - - // Get a list of stat shortnames from the config - for (const item in CONFIG.rmss.stats) { - applicable_stat_list[CONFIG.rmss.stats[item].shortname] = CONFIG.rmss.stats[item].shortname; + // Each Skill Category can have up to three Applicable Stats that apply to it. We need to get a list of + // the Stat Shortnames from Config so the user can select which stats are applicable to this Skill Category + prepareApplicableStatNames(config) { + var applicableStatList = {None: "None"}; + for (const item in config.rmss.stats) { + applicableStatList[config.rmss.stats[item].shortname] = config.rmss.stats[item].shortname; } - return applicable_stat_list; + return applicableStatList; } - // Determine which Stat is selected for applicable stats - prepareApplicableSelectedStat(app_stat) { - var applicable_stat_selected = ""; - applicable_stat_selected = this.item.system[app_stat]; - return applicable_stat_selected; + // Get the values for the currently selected Applicable Stat so we can display it on the Skill Category Sheet + // If nothing is selected return an empty string. + prepareApplicableSelectedStat(appStat) { + var applicableStatSelected = ""; + applicableStatSelected = this.item.system[appStat]; + return applicableStatSelected; } - // Build the text that is displayed in the Applicable Stats field - buildApplicableStatsText(app_stat_1, app_stat_2, app_stat_3) { - - if (app_stat_1 === "None") { + // The character sheet has an information field that displays the applicable stats in the following format + // St/Ag/St. This method checks the current applicable stats and builds that field so + // it can be displayed to the user. + buildApplicableStatsText(firstAppStat, secondAppStat, thirdAppStat) { + if (firstAppStat === "None") { return("None"); } - else if (app_stat_1 !== "None" && app_stat_2 === "None") { - return(app_stat_1); + else if (firstAppStat !== "None" && secondAppStat === "None") { + return(firstAppStat); } - else if (app_stat_1 !== "None" && app_stat_2 !== "None" && app_stat_3 === "None" ) { - return(app_stat_1 + "/" + app_stat_2 ); + else if (firstAppStat !== "None" && secondAppStat !== "None" && thirdAppStat === "None" ) { + return(firstAppStat + "/" + secondAppStat ); } - else if (app_stat_1 !== "None" && app_stat_2 !== "None" && app_stat_3 !== "None" ) { - return(app_stat_1 + "/" + app_stat_2 + "/" + app_stat_3 ); + else if (firstAppStat !== "None" && secondAppStat !== "None" && thirdAppStat !== "None" ) { + return(firstAppStat + "/" + secondAppStat + "/" + thirdAppStat ); } else { return("None"); @@ -103,7 +104,8 @@ export default class RMSSSkillCategorySheet extends ItemSheet { // Everything below here is only needed if the sheet is editable if (!this.isEditable) return; - // Update Applicable Stats for Skill Categories + // Every time the user selects one of the Applicable Stat dropdowns + // fire an event to change the value in the Skill Category html.find('.stat-selector').change(ev => { this._setApplicableStat(this.item, ev); }); diff --git a/rmss/module/sheets/skills/rmss_skill_sheet.js b/rmss/module/sheets/skills/rmss_skill_sheet.js index 71cdf09..9970f1e 100644 --- a/rmss/module/sheets/skills/rmss_skill_sheet.js +++ b/rmss/module/sheets/skills/rmss_skill_sheet.js @@ -22,16 +22,11 @@ export default class RMSSSkillSheet extends ItemSheet { var enrichedDescription = await TextEditor.enrichHTML(this.item.system.description, {async: true}); - // Get a list of stats that can be used as applicable stats - var designations = this.getSkillDesignations(CONFIG); - // Get a list of the parent item's skill categories for the dropdown - var owned_skillcats = this.prepareSkillCategoryValues(); + var ownedSkillCategories = this.prepareSkillCategoryValues(); // Figure out if a valid Skill Category is already selected - var selected_skillcat = this.prepareSelectedSkillCategory(owned_skillcats, this.object.system.category); - - //this.prepareSelectedSkillCategoryBonus(selected_skillcat); + var selectedSkillCategory = this.prepareSelectedSkillCategory(ownedSkillCategories, this.object.system.category); let sheetData = { owner: this.item.isOwner, @@ -39,53 +34,68 @@ export default class RMSSSkillSheet extends ItemSheet { item: baseData.item, system: baseData.item.system, config: CONFIG.rmss, - owned_skillcats: owned_skillcats, + owned_skillcats: ownedSkillCategories, enrichedDescription: enrichedDescription, - selected_skillcat: selected_skillcat, - designations: designations + selected_skillcat: selectedSkillCategory, + designations: CONFIG.rmss.skill_designations }; return sheetData; } + + activateListeners(html) { + super.activateListeners(html); + // Catch the event when the user clicks one of the New Ranks Checkboxes. + // It will increment by one or wrap back to zero on a value of three + html.find('.skillsheet-newrank').click(ev => { + switch(ev.currentTarget.getAttribute("value")) { + case "0": + this.object.update({system: {new_ranks:{ "value": 1 }}}); + break; + case "1": + this.object.update({system: {new_ranks:{ "value": 2 }}}); + break; + case "2": + this.object.update({system: {new_ranks:{ "value": 3 }}}); + break; + case "3": + this.object.update({system: {new_ranks:{ "value": 0 }}}); + break; + } + }); + } + + // Skills are related to Skill Categories so we need something to allow the user to choose that relationship + // If this Skill is owned then we will return a list of Skill Categories and allow them to choose + // Otherwise we'll just return 'Skill has no owner' prepareSkillCategoryValues() { - // If there is no player owning this Skill then we cannot assign a category. - var skillcat_list = {None: "Skill Has No Owner", }; + var skillNoOwner = {None: "Skill Has No Owner", }; if (this.item.isEmbedded === null) { - return(skillcat_list); + return(skillNoOwner); } else { - const skillcats = this.item.parent.getOwnedSkillCategories(); - return(skillcats); + const skillCategories = this.item.parent.getOwnedItemsByType("skill_category"); + return(skillCategories); } } - getSkillDesignations(CONFIG) { - var designations = {}; - - // Get a list of designations from the config - for (const item in CONFIG.rmss.skill_designations) { - designations[CONFIG.rmss.skill_designations[item]] = CONFIG.rmss.skill_designations[item]; - } - return designations; - } - - // Determine which Stat is selected and test that it is in the current list of categories. - prepareSelectedSkillCategory(ownedskillcats, selected_category) { - - // Start By setting the owned category to None, if nothing happens this will be the default - var default_selected_category = "None"; - - // Get a list of keys from the currently owned skill categories and compare to the current value - if (Object.keys(ownedskillcats).includes(selected_category)) { - return(selected_category); + // Determine which Skill Category is selected and test that it is in the current list of categories. + // If it isn't set it to None. + prepareSelectedSkillCategory(ownedSkillCategories, selectedSkillCategory) { + var defaultSelectedCategory = "None"; + if (Object.keys(ownedSkillCategories).includes(selectedSkillCategory)) { + return(selectedSkillCategory); } else { - return(default_selected_category); + return(defaultSelectedCategory); } } + // Populate the Skill Category Bonus field on the Skill Sheet. + // Iterate through the owned skill categories and if one of them matches the item id of currently select skill category + // then set the Skill Category Bonus field to the Total Bonus field of the Skill Category prepareSelectedSkillCategoryBonus(selected_skillcat) { if (this.item.isEmbedded === null) { console.log("Skill has no owner"); diff --git a/rmss/rmss.css b/rmss/rmss.css index 2577191..8a38264 100644 --- a/rmss/rmss.css +++ b/rmss/rmss.css @@ -1,14 +1,47 @@ -.sheet form { - display: flex; - flex-direction: column; +.skillcat-grid-container { + display: grid; + grid-template-columns: [skill-category-name] 10% [applicable-stats] 10% [dev-cost] 8% [num-ranks] 8% [new-ranks] 8% [rank-bonus] 8% [stat-bonus] 8% [prof-bonus] 8% [special-bonus-1] 8% [special-bonus-2] 8% [total-bonus] 8% [controls] 8%; } -.sheet .sheet-content { - height: 100%; +.skillcat-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; display: flex; + justify-content: flex-end; flex-direction: column; + justify-content: center; } -.sheet .sheet-content .editor { - height: 100%; +.skillcat-grid-container > div:nth-child(24n+1), +.skillcat-grid-container > div:nth-child(24n+2), +.skillcat-grid-container > div:nth-child(24n+3), +.skillcat-grid-container > div:nth-child(24n+4), +.skillcat-grid-container > div:nth-child(24n+5), +.skillcat-grid-container > div:nth-child(24n+6), +.skillcat-grid-container > div:nth-child(24n+7), +.skillcat-grid-container > div:nth-child(24n+8), +.skillcat-grid-container > div:nth-child(24n+9), +.skillcat-grid-container > div:nth-child(24n+10), +.skillcat-grid-container > div:nth-child(24n+11), +.skillcat-grid-container > div:nth-child(24n+12) { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: column; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.skillcat-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); } .container { display: flex; @@ -26,8 +59,8 @@ } .header-text { display: flex; - flex-direction: row; - justify-content: center; + align-items: center; + padding: 1px; } .resource-container { display: flex; @@ -53,6 +86,9 @@ flex-direction: column; flex-shrink: 1; } +.stat-row { + align-items: center; +} .equipment-container { flex-direction: column; flex-grow: 1; @@ -138,102 +174,6 @@ .green { background-color: lightseagreen; } -.skillcat-name, -.skill-name, -.item-name { - font-family: Signika, sans-serif; - font-size: 12px; - font-weight: bold; - text-align: center; -} -.skillcat-entry, -.skill-entry, -.item-entry { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; -} -.skillcat-headeritem, -.skill-headeritem, -.item-headeritem { - text-align: center; - font-weight: bold; -} -.skillcat-controls, -.skill-controls, -.item-controls { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; -} -.money-column { - flex-direction: column; -} -.money-container { - flex-direction: column; - flex-shrink: 1; -} -.table-font { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; -} -.table-bold { - font-weight: bold; -} -.table-center { - text-align: center; -} -.table-controls { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; -} -.skillcat-grid-container { - display: grid; - grid-template-columns: [skill-category-name] 10% [applicable-stats] 10% [dev-cost] 8% [num-ranks] 8% [new-ranks] 8% [rank-bonus] 8% [stat-bonus] 8% [prof-bonus] 8% [special-bonus-1] 8% [special-bonus-2] 8% [total-bonus] 8% [controls] 8%; -} -.skillcat-grid-container > div { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; - border-bottom: 1px solid; - padding-top: 3px; - padding-bottom: 3px; - display: flex; - justify-content: flex-end; - flex-direction: column; - justify-content: center; -} -.skillcat-grid-container > div:nth-child(24n+1), -.skillcat-grid-container > div:nth-child(24n+2), -.skillcat-grid-container > div:nth-child(24n+3), -.skillcat-grid-container > div:nth-child(24n+4), -.skillcat-grid-container > div:nth-child(24n+5), -.skillcat-grid-container > div:nth-child(24n+6), -.skillcat-grid-container > div:nth-child(24n+7), -.skillcat-grid-container > div:nth-child(24n+8), -.skillcat-grid-container > div:nth-child(24n+9), -.skillcat-grid-container > div:nth-child(24n+10), -.skillcat-grid-container > div:nth-child(24n+11), -.skillcat-grid-container > div:nth-child(24n+12) { - font-family: Signika, sans-serif; - font-size: 12px; - text-align: center; - border-bottom: 1px solid; - padding-top: 3px; - padding-bottom: 3px; - display: flex; - justify-content: flex-end; - flex-direction: column; - justify-content: center; - background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); -} -.skillcat-grid-heading { - font-weight: bold; - border-bottom: 1px solid; - background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); -} .skills-grid-container { display: grid; grid-template-columns: [favorite] 9% [skill-name] 11% [num-ranks] 9% [new-ranks] 9% [rank-bonus] 9% [category-bonus] 9% [item-bonus] 9% [special-bonus-1] 9% [special-bonus-2] 9% [total-bonus] 9% [controls] 8%; @@ -278,9 +218,205 @@ border-bottom: 1px solid; background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); } +.money-column { + flex-direction: column; +} +.money-container { + flex-direction: column; + flex-shrink: 1; + padding-left: 10px; +} +.items-grid-container { + display: grid; + grid-template-columns: [name] 30% [quantity] 17% [weight] 17% [cost] 18% [controls] 18%; +} +.items-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} +.items-grid-container > div:nth-child(10n+1), +.items-grid-container > div:nth-child(10n+2), +.items-grid-container > div:nth-child(10n+3), +.items-grid-container > div:nth-child(10n+4), +.items-grid-container > div:nth-child(10n+5) { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.items-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.weapons-grid-container { + display: grid; + grid-template-columns: [name] 30% [equipped] 8% [breakage_range] 9% [fumble_range] 9% [strength] 9% [quantity] 9% [weight] 9% [cost] 9% [controls] 8%; +} +.weapons-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} +.weapons-grid-container > div:nth-child(18n+1), +.weapons-grid-container > div:nth-child(18n+2), +.weapons-grid-container > div:nth-child(18n+3), +.weapons-grid-container > div:nth-child(18n+4), +.weapons-grid-container > div:nth-child(18n+5), +.weapons-grid-container > div:nth-child(18n+6), +.weapons-grid-container > div:nth-child(18n+7), +.weapons-grid-container > div:nth-child(18n+8), +.weapons-grid-container > div:nth-child(18n+9) { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.weapons-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.armor-grid-container { + display: grid; + grid-template-columns: [name] 30% [equipped] 12% [at] 12% [quantity] 12% [weight] 12% [cost] 12% [controls] 10%; +} +.armor-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} +.armor-grid-container > div:nth-child(14n+1), +.armor-grid-container > div:nth-child(14n+2), +.armor-grid-container > div:nth-child(14n+3), +.armor-grid-container > div:nth-child(14n+4), +.armor-grid-container > div:nth-child(14n+5), +.armor-grid-container > div:nth-child(14n+6), +.armor-grid-container > div:nth-child(14n+7) { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.armor-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.herbs-grid-container { + display: grid; + grid-template-columns: [name] 30% [quantity] 11% [codes] 12% [af] 12% [weight] 12% [cost] 11% [controls] 12%; +} +.herbs-grid-container > div { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; +} +.herbs-grid-container > div:nth-child(14n+1), +.herbs-grid-container > div:nth-child(14n+2), +.herbs-grid-container > div:nth-child(14n+3), +.herbs-grid-container > div:nth-child(14n+4), +.herbs-grid-container > div:nth-child(14n+5), +.herbs-grid-container > div:nth-child(14n+6), +.herbs-grid-container > div:nth-child(14n+7) { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; + border-bottom: 1px solid; + padding-top: 3px; + padding-bottom: 3px; + display: flex; + justify-content: flex-end; + flex-direction: row; + justify-content: center; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.herbs-grid-heading { + font-weight: bold; + border-bottom: 1px solid; + background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); +} +.skillcat-name, +.skill-name, +.item-name { + font-family: Signika, sans-serif; + font-size: 12px; + font-weight: bold; + text-align: center; +} +.skillcat-entry, +.skill-entry, +.item-entry { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; +} +.skillcat-headeritem, +.skill-headeritem, +.item-headeritem { + text-align: center; + font-weight: bold; +} +.skillcat-controls, +.skill-controls, +.item-controls { + font-family: Signika, sans-serif; + font-size: 12px; + text-align: center; +} .applicable-stats-grid-container { display: grid; - grid-template-columns: [app-stat-1] 33% [app-stat-2] 33% [dapp-stat-3] 33%; + grid-template-columns: [app-stat-1] 33% [app-stat-2] 33% [app-stat-3] 33%; } .applicable-stats-grid-container > div { font-family: Signika, sans-serif; @@ -294,3 +430,15 @@ flex-direction: column; justify-content: center; } +.sheet form { + display: flex; + flex-direction: column; +} +.sheet .sheet-content { + height: 100%; + display: flex; + flex-direction: column; +} +.sheet .sheet-content .editor { + height: 100%; +} diff --git a/rmss/rmss.js b/rmss/rmss.js index 775ee3d..93b7dab 100644 --- a/rmss/rmss.js +++ b/rmss/rmss.js @@ -22,70 +22,86 @@ import RMSSPlayerSheet from "./module/sheets/actors/rmss_player_sheet.js"; // Preload handlebars templates for character sheets async function preloadHandlebarsTemplates() { - const templatePaths = [ - "systems/rmss/templates/sheets/actors/parts/actor-stats.html", - "systems/rmss/templates/sheets/actors/parts/actor-fixed-info.html", - "systems/rmss/templates/sheets/actors/parts/actor-armor-info.html", - "systems/rmss/templates/sheets/actors/parts/actor-resistance.html", - "systems/rmss/templates/sheets/actors/parts/actor-race-stat-fixed-info.html", - "systems/rmss/templates/sheets/actors/parts/actor-role-traits.html", - "systems/rmss/templates/sheets/actors/parts/actor-background-info.html", - "systems/rmss/templates/sheets/actors/parts/actor-skill-categories.html", - "systems/rmss/templates/sheets/actors/parts/actor-skills.html", - "systems/rmss/templates/sheets/actors/parts/actor-fav-skills.html", - "systems/rmss/templates/sheets/actors/parts/actor-items.html", - "systems/rmss/templates/sheets/actors/parts/actor-money.html", - "systems/rmss/templates/sheets/actors/parts/actor-skill-categories.html", - "systems/rmss/templates/sheets/actors/parts/actor-skills.html" - ]; - return loadTemplates(templatePaths); + const templatePaths = [ + "systems/rmss/templates/sheets/actors/parts/actor-stats.html", + "systems/rmss/templates/sheets/actors/parts/actor-fixed-info.html", + "systems/rmss/templates/sheets/actors/parts/actor-armor-info.html", + "systems/rmss/templates/sheets/actors/parts/actor-resistance.html", + "systems/rmss/templates/sheets/actors/parts/actor-race-stat-fixed-info.html", + "systems/rmss/templates/sheets/actors/parts/actor-role-traits.html", + "systems/rmss/templates/sheets/actors/parts/actor-background-info.html", + "systems/rmss/templates/sheets/actors/parts/actor-skill-categories.html", + "systems/rmss/templates/sheets/actors/parts/actor-skills.html", + "systems/rmss/templates/sheets/actors/parts/actor-fav-skills.html", + "systems/rmss/templates/sheets/actors/parts/actor-items.html", + "systems/rmss/templates/sheets/actors/parts/actor-weapons.html", + "systems/rmss/templates/sheets/actors/parts/actor-money.html", + "systems/rmss/templates/sheets/actors/parts/actor-skill-categories.html", + "systems/rmss/templates/sheets/actors/parts/actor-skills.html", + "systems/rmss/templates/sheets/actors/parts/actor-armor.html", + "systems/rmss/templates/sheets/actors/parts/actor-herbs.html" + ]; + return loadTemplates(templatePaths); } // Hook the init function and set up our system Hooks.once("init", function () { - console.log("rmss | Initialising Rolemaster Standard System"); + console.log("rmss | Initialising Rolemaster Standard System"); + + // Load our custom actor and item classes + console.log("rmss | Loading Rolemaster Actor and Item classes"); + game.rmss = { + RMSSActor, + RMSSItem + }; + + // Define custom Document classes + CONFIG.Actor.documentClass = RMSSActor; + CONFIG.Item.documentClass = RMSSItem; + + // Make Config Data Available + CONFIG.rmss = rmss; + + // Unregister Default Sheets + console.log("rmss | Unregistering core sheets"); + + Items.unregisterSheet("core", ItemSheet); + Actors.unregisterSheet("core", ActorSheet); + + // Register RMSS Sheets + console.log("rmss | Registering RMSS sheets"); + + // Items + Items.registerSheet("rmss", RMSSItemSheet, {makeDefault: true, label: "rmss.entity_sheet.item", types: ['item']}); + Items.registerSheet("rmss", RMSSArmorSheet, {makeDefault: true, label: "rmss.entity_sheet.armor", types: ['armor']}); + Items.registerSheet("rmss", RMSSTransportSheet, {makeDefault: true, label: "rmss.entity_sheet.transport", types: ['transport']}); + Items.registerSheet("rmss", RMSSWeaponSheet, {makeDefault: true, label: "rmss.entity_sheet.weapon", types: ['weapon']}); + Items.registerSheet("rmss", RMSSHerbOrPoisonSheet, {makeDefault: true, label: "rmss.entity_sheet.herb_or_poison", types: ['herb_or_poison']}); + + // Spells + Items.registerSheet("rmss", RMSSSpellSheet, {makeDefault: true, label: "rmss.entity_sheet.spell", types: ['spell']}); + + // Skills + Items.registerSheet("rmss", RMSSSkillCategorySheet, {makeDefault: true, label: "rmss.entity_sheet.skill_category", types: ['skill_category']}); + Items.registerSheet("rmss", RMSSSkillSheet, {makeDefault: true, label: "rmss.entity_sheet.skill", types: ['skill']}); + + // Actors + Actors.registerSheet("rmss", RMSSPlayerSheet, {makeDefault: true, label: "rmss.entity_sheet.player_characrer", types: ['character']}); + + // Preload Handlebars Templates + console.log("rmss | Preloading Handlebars Templates"); + preloadHandlebarsTemplates(); + + // Handlebars Helpers - // Load our custom actor and item classes - console.log("rmss | Loading Rolemaster Actor and Item classes"); - game.rmss = { - RMSSActor, - RMSSItem - }; - - // Define custom Document classes - CONFIG.Actor.documentClass = RMSSActor; - CONFIG.Item.documentClass = RMSSItem; - - // Make Config Data Available - CONFIG.rmss = rmss; - - // Unregister Default Sheets - console.log("rmss | Unregistering core sheets"); - - Items.unregisterSheet("core", ItemSheet); - Actors.unregisterSheet("core", ActorSheet); - - // Register RMSS Sheets - console.log("rmss | Registering RMSS sheets"); - - // Items - Items.registerSheet("rmss", RMSSItemSheet, {makeDefault: true, label: "rmss.entity_sheet.item", types: ['item']}); - Items.registerSheet("rmss", RMSSArmorSheet, {makeDefault: true, label: "rmss.entity_sheet.armor", types: ['armor']}); - Items.registerSheet("rmss", RMSSTransportSheet, {makeDefault: true, label: "rmss.entity_sheet.transport", types: ['transport']}); - Items.registerSheet("rmss", RMSSWeaponSheet, {makeDefault: true, label: "rmss.entity_sheet.weapon", types: ['weapon']}); - Items.registerSheet("rmss", RMSSHerbOrPoisonSheet, {makeDefault: true, label: "rmss.entity_sheet.herb_or_poison", types: ['herb_or_poison']}); - - // Spells - Items.registerSheet("rmss", RMSSSpellSheet, {makeDefault: true, label: "rmss.entity_sheet.spell", types: ['spell']}); - - // Skills - Items.registerSheet("rmss", RMSSSkillCategorySheet, {makeDefault: true, label: "rmss.entity_sheet.skill_category", types: ['skill_category']}); - Items.registerSheet("rmss", RMSSSkillSheet, {makeDefault: true, label: "rmss.entity_sheet.skill", types: ['skill']}); - - // Actors - Actors.registerSheet("rmss", RMSSPlayerSheet, {makeDefault: true, label: "rmss.entity_sheet.player_characrer", types: ['character']}); - - // Preload Handlebars Templates - console.log("rmss | Preloading Handlebars Templates"); - preloadHandlebarsTemplates(); + Handlebars.registerHelper('switch', function(value, options) { + this.switch_value = value; + return options.fn(this); + }); + + Handlebars.registerHelper('case', function(value, options) { + if (value == this.switch_value) { + return options.fn(this); + } + }); }); \ No newline at end of file diff --git a/rmss/template.json b/rmss/template.json index 97029bb..ae6f076 100644 --- a/rmss/template.json +++ b/rmss/template.json @@ -171,15 +171,17 @@ } } }, - "money": { - "mithril": 1, - "platinum": 2, - "gold": 3, - "silver": 4, - "bronze": 5, - "copper": 6, - "tin": 7, - "iron": 8 + "money": { + "money": { + "mithril": 1, + "platinum": 2, + "gold": 3, + "silver": 4, + "bronze": 5, + "copper": 6, + "tin": 7, + "iron": 8 + } } }, @@ -234,6 +236,7 @@ }, "armor": { "templates": ["base"], + "equipped": false, "quantity": 1, "weight": 0, "cost": 0, @@ -242,6 +245,7 @@ }, "weapon": { "templates": ["base"], + "equipped": false, "quantity": 1, "cost": 0, "weight": 0, @@ -265,7 +269,11 @@ "templates": ["base"], "category" : "", "ranks": 0, - "new_ranks": 0, + "new_ranks": { + "value": [0], + "max": 3, + "max_default": 3 + }, "rank_bonus": -15, "category_bonus": 0, "item_bonus": 0, @@ -283,7 +291,11 @@ "app_stat_3": "None", "development_cost": "0", "ranks": 0, - "new_ranks": 0, + "new_ranks": { + "value": 0, + "max": 3, + "max_default": 3 + }, "rank_bonus": -15, "stat_bonus": 0, "prof_bonus": 0, diff --git a/rmss/templates/sheets/actors/parts/actor-armor.html b/rmss/templates/sheets/actors/parts/actor-armor.html new file mode 100644 index 0000000..5bfb427 --- /dev/null +++ b/rmss/templates/sheets/actors/parts/actor-armor.html @@ -0,0 +1,29 @@ +
+ + +
{{ localize "rmss.pc_sheet_items.item_name" }}
+
{{ localize "rmss.pc_sheet_items.equipped" }}
+
{{ localize "rmss.armor.at" }}
+
{{ localize "rmss.pc_sheet_items.quantity" }}
+
{{ localize "rmss.pc_sheet_items.weight" }}
+
{{ localize "rmss.pc_sheet_items.cost" }}
+ + {{#each equipables as |equipable id|}} +
{{equipable.name}}
+ {{#if equipable.system.equipped}} +
+ {{else}} +
+ {{/if}} +
{{equipable.system.at}}
+
{{equipable.system.quantity}}
+
{{equipable.system.weight}}
+
{{equipable.system.cost}}
+
+ + +
+ {{/each}} +
\ No newline at end of file diff --git a/rmss/templates/sheets/actors/parts/actor-herbs.html b/rmss/templates/sheets/actors/parts/actor-herbs.html new file mode 100644 index 0000000..e992891 --- /dev/null +++ b/rmss/templates/sheets/actors/parts/actor-herbs.html @@ -0,0 +1,25 @@ +
+ + +
{{ localize "rmss.pc_sheet_items.item_name" }}
+
{{ localize "rmss.pc_sheet_items.quantity" }}
+
{{ localize "rmss.herb_or_poison.codes" }}
+
{{ localize "rmss.herb_or_poison.af" }}
+
{{ localize "rmss.pc_sheet_items.weight" }}
+
{{ localize "rmss.pc_sheet_items.cost" }}
+ + {{#each herbs as |herb id|}} +
{{herb.name}}
+
{{herb.system.quantity}}
+
{{herb.system.codes}}
+
{{herb.system.af}}
+
{{herb.system.weight}}
+
{{herb.system.cost}}
+
+ + +
+ {{/each}} +
\ No newline at end of file diff --git a/rmss/templates/sheets/actors/parts/actor-items.html b/rmss/templates/sheets/actors/parts/actor-items.html index 19a6424..4e77b39 100644 --- a/rmss/templates/sheets/actors/parts/actor-items.html +++ b/rmss/templates/sheets/actors/parts/actor-items.html @@ -1,28 +1,21 @@ - +
- -
- - - - - + {{#each gear as |item id|}} - - - - - - - - +
{{item.name}}
+
{{item.system.quantity}}
+
{{item.system.weight}}
+
{{item.system.cost}}
+
+ + +
{{/each}} -
{{ localize "rmss.pc_sheet_items.favorite" }}
{{ localize "rmss.pc_sheet_items.quantity" }}
{{ localize "rmss.pc_sheet_items.item_name" }}
{{ localize "rmss.pc_sheet_items.weight" }}
{{ localize "rmss.pc_sheet_items.cost" }}
+
{{ localize "rmss.pc_sheet_items.item_name" }}
+
{{ localize "rmss.pc_sheet_items.quantity" }}
+
{{ localize "rmss.pc_sheet_items.weight" }}
+
{{ localize "rmss.pc_sheet_items.cost" }}
+
{{item.system.quantity}}
-

{{item.name}}

-
{{item.system.weight}}
{{item.system.cost}}
- - -
\ No newline at end of file + \ No newline at end of file diff --git a/rmss/templates/sheets/actors/parts/actor-skills.html b/rmss/templates/sheets/actors/parts/actor-skills.html index 69af325..2fe94cd 100644 --- a/rmss/templates/sheets/actors/parts/actor-skills.html +++ b/rmss/templates/sheets/actors/parts/actor-skills.html @@ -21,7 +21,15 @@
{{skill.name}}
{{skill.system.ranks}}
-
{{skill.system.new_ranks}}
+
+ {{#switch skill.system.new_ranks.value}} + {{#case 0}} {{/case}} + {{#case 1}} {{/case}} + {{#case 2}} {{/case}} + {{#case 3}} {{/case}} + {{/switch}} + +
{{skill.system.rank_bonus}}
{{skill.system.category_bonus}}
{{skill.system.item_bonus}}
diff --git a/rmss/templates/sheets/actors/parts/actor-stats.html b/rmss/templates/sheets/actors/parts/actor-stats.html index 9e3b8b6..98cb4fd 100644 --- a/rmss/templates/sheets/actors/parts/actor-stats.html +++ b/rmss/templates/sheets/actors/parts/actor-stats.html @@ -1,6 +1,6 @@
    -
  1. +
  2. {{ localize "rmss.player_character.attribute_headers.stat" }}
    {{ localize "rmss.player_character.attribute_headers.temp" }}
    {{ localize "rmss.player_character.attribute_headers.pot" }}
    @@ -10,7 +10,7 @@
    {{ localize "rmss.player_character.attribute_headers.stat_bonus" }}
  3. -
  4. +
  5. {{ localize "rmss.player_character.attribute.agility" }}
    @@ -40,7 +40,7 @@
  6. -
  7. +
  8. {{ localize "rmss.player_character.attribute.constitution" }}
    @@ -70,7 +70,7 @@
  9. -
  10. +
  11. {{ localize "rmss.player_character.attribute.memory" }}
    @@ -100,7 +100,7 @@
  12. -
  13. +
  14. {{ localize "rmss.player_character.attribute.reasoning" }}
    @@ -130,7 +130,7 @@
  15. -
  16. +
  17. {{ localize "rmss.player_character.attribute.self_discipline" }}
    @@ -160,7 +160,7 @@
  18. -
  19. +
  20. {{ localize "rmss.player_character.attribute.empathy" }}
    @@ -190,7 +190,7 @@
  21. -
  22. +
  23. {{ localize "rmss.player_character.attribute.intuition" }}
    @@ -220,7 +220,7 @@
  24. -
  25. +
  26. {{ localize "rmss.player_character.attribute.presence" }}
    @@ -250,7 +250,7 @@
  27. -
  28. +
  29. {{ localize "rmss.player_character.attribute.quickness" }}
    @@ -280,7 +280,7 @@
  30. -
  31. +
  32. {{ localize "rmss.player_character.attribute.strength" }}
    diff --git a/rmss/templates/sheets/actors/parts/actor-weapons.html b/rmss/templates/sheets/actors/parts/actor-weapons.html new file mode 100644 index 0000000..e4cec1c --- /dev/null +++ b/rmss/templates/sheets/actors/parts/actor-weapons.html @@ -0,0 +1,33 @@ +
    + + +
    {{ localize "rmss.pc_sheet_items.item_name" }}
    +
    {{ localize "rmss.pc_sheet_items.equipped" }}
    +
    {{ localize "rmss.weapon.breakage_range" }}
    +
    {{ localize "rmss.weapon.fumble_range" }}
    +
    {{ localize "rmss.weapon.strength" }}
    +
    {{ localize "rmss.pc_sheet_items.quantity" }}
    +
    {{ localize "rmss.pc_sheet_items.weight" }}
    +
    {{ localize "rmss.pc_sheet_items.cost" }}
    + + {{#each weapons as |weapon id|}} +
    {{weapon.name}}
    + {{#if weapon.system.equipped}} +
    + {{else}} +
    + {{/if}} +
    {{weapon.system.breakage_range}}
    +
    {{weapon.system.fumble_range}}
    +
    {{weapon.system.strength}}
    +
    {{weapon.system.quantity}}
    +
    {{weapon.system.weight}}
    +
    {{weapon.system.cost}}
    +
    + + +
    + {{/each}} +
    \ No newline at end of file diff --git a/rmss/templates/sheets/actors/rmss-character-sheet.html b/rmss/templates/sheets/actors/rmss-character-sheet.html index f902ebf..cf4e4f8 100644 --- a/rmss/templates/sheets/actors/rmss-character-sheet.html +++ b/rmss/templates/sheets/actors/rmss-character-sheet.html @@ -96,9 +96,18 @@
    +

    Items

    {{> "systems/rmss/templates/sheets/actors/parts/actor-items.html" }} +

    Weapons

    + {{> "systems/rmss/templates/sheets/actors/parts/actor-weapons.html" }} +

    Armor and Equipables

    + {{> "systems/rmss/templates/sheets/actors/parts/actor-armor.html" }} +

    Herbs and Poisons

    + {{> "systems/rmss/templates/sheets/actors/parts/actor-herbs.html" }}
    +
    +

    Wealth

    {{> "systems/rmss/templates/sheets/actors/parts/actor-money.html" }}
    diff --git a/rmss/templates/sheets/items/rmss-armor-sheet.html b/rmss/templates/sheets/items/rmss-armor-sheet.html index 40529df..ab5e9d3 100644 --- a/rmss/templates/sheets/items/rmss-armor-sheet.html +++ b/rmss/templates/sheets/items/rmss-armor-sheet.html @@ -7,12 +7,16 @@
    + + diff --git a/rmss/templates/sheets/items/rmss-weapon-sheet.html b/rmss/templates/sheets/items/rmss-weapon-sheet.html index 4899dd1..52cb0f0 100644 --- a/rmss/templates/sheets/items/rmss-weapon-sheet.html +++ b/rmss/templates/sheets/items/rmss-weapon-sheet.html @@ -7,6 +7,7 @@
    {{localize "rmss.item.equipped"}} {{localize "rmss.item.quantity"}} {{localize "rmss.armor.weight"}} {{localize "rmss.armor.cost"}} {{localize "rmss.armor.prod_time"}} {{localize "rmss.armor.at"}}
    + +
    + @@ -17,6 +18,9 @@ + diff --git a/rmss/templates/sheets/skills/rmss-skill-sheet.html b/rmss/templates/sheets/skills/rmss-skill-sheet.html index 93c0727..e926ce5 100644 --- a/rmss/templates/sheets/skills/rmss-skill-sheet.html +++ b/rmss/templates/sheets/skills/rmss-skill-sheet.html @@ -36,7 +36,14 @@
    {{localize "rmss.weapon.equipped"}} {{localize "rmss.item.quantity"}} {{localize "rmss.weapon.cost"}} {{localize "rmss.weapon.type"}}{{localize "rmss.weapon.fumble_range"}}
    + + - +
    + {{#switch system.new_ranks.value}} + {{#case 0}} {{/case}} + {{#case 1}} {{/case}} + {{#case 2}} {{/case}} + {{#case 3}} {{/case}} + {{/switch}} +