From fa7b03109fa9ad23c89d00e166df27f1c86471de Mon Sep 17 00:00:00 2001 From: supervj <64861570+supervj@users.noreply.github.com> Date: Tue, 13 Apr 2021 23:01:03 -0400 Subject: [PATCH] Add Skills to Starships Added skills to the starship sheets and made them rollable. Sorry about the direct commit to Develop, but I forgot to branch it off... --- module/actor/entity.js | 2 +- module/actor/sheets/newSheet/base.js | 14 +- module/actor/sheets/newSheet/starship.js | 4 +- module/actor/sheets/oldSheets/base.js | 1 + sw5e.js | 4 +- template.json | 158 +++++++++++------------ templates/actors/newActor/starship.html | 2 +- 7 files changed, 95 insertions(+), 90 deletions(-) diff --git a/module/actor/entity.js b/module/actor/entity.js index f23d2240..441dc87d 100644 --- a/module/actor/entity.js +++ b/module/actor/entity.js @@ -860,7 +860,7 @@ export default class Actor5e extends Actor { const rollData = mergeObject(options, { parts: parts, data: data, - title: game.i18n.format("SW5E.SkillPromptTitle", {skill: CONFIG.SW5E.skills[skillId]}), + title: game.i18n.format("SW5E.SkillPromptTitle", {skill: CONFIG.SW5E.skills[skillId] || CONFIG.SW5E.starshipSkills[skillId]}), halflingLucky: this.getFlag("sw5e", "halflingLucky"), reliableTalent: reliableTalent, messageData: {"flags.sw5e.roll": {type: "skill", skillId }} diff --git a/module/actor/sheets/newSheet/base.js b/module/actor/sheets/newSheet/base.js index fc74cc8d..2575dad9 100644 --- a/module/actor/sheets/newSheet/base.js +++ b/module/actor/sheets/newSheet/base.js @@ -67,7 +67,7 @@ export default class ActorSheet5e extends ActorSheet { cssClass: isOwner ? "editable" : "locked", isCharacter: this.entity.data.type === "character", isNPC: this.entity.data.type === "npc", - isStarship: this.entity.data.type === "starship", + isStarship: this.entity.data.type === "starship", isVehicle: this.entity.data.type === 'vehicle', config: CONFIG.SW5E, }; @@ -96,7 +96,11 @@ export default class ActorSheet5e extends ActorSheet { skl.ability = CONFIG.SW5E.abilityAbbreviations[skl.ability]; skl.icon = this._getProficiencyIcon(skl.value); skl.hover = CONFIG.SW5E.proficiencyLevels[skl.value]; - skl.label = CONFIG.SW5E.skills[s]; + if (data.actor.type === "starship") { + skl.label = CONFIG.SW5E.starshipSkills[s]; + }else{ + skl.label = CONFIG.SW5E.skills[s]; + } } } @@ -409,11 +413,11 @@ export default class ActorSheet5e extends ActorSheet { html.find('.item-create').click(this._onItemCreate.bind(this)); html.find('.item-edit').click(this._onItemEdit.bind(this)); html.find('.item-delete').click(this._onItemDelete.bind(this)); - html.find('.item-collapse').click(this._onItemCollapse.bind(this)); + html.find('.item-collapse').click(this._onItemCollapse.bind(this)); html.find('.item-uses input').click(ev => ev.target.select()).change(this._onUsesChange.bind(this)); html.find('.slot-max-override').click(this._onPowerSlotOverride.bind(this)); - html.find('.increment-class-level').click(this._onIncrementClassLevel.bind(this)); - html.find('.decrement-class-level').click(this._onDecrementClassLevel.bind(this)); + html.find('.increment-class-level').click(this._onIncrementClassLevel.bind(this)); + html.find('.decrement-class-level').click(this._onDecrementClassLevel.bind(this)); // Active Effect management html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.entity)); diff --git a/module/actor/sheets/newSheet/starship.js b/module/actor/sheets/newSheet/starship.js index d137ab27..d0a65076 100644 --- a/module/actor/sheets/newSheet/starship.js +++ b/module/actor/sheets/newSheet/starship.js @@ -38,8 +38,8 @@ export default class ActorSheet5eStarship extends ActorSheet5e { weapons: { label: game.i18n.localize("SW5E.ItemTypeWeaponPl"), items: [], hasActions: true, dataset: {type: "weapon", "weapon-type": "natural"} }, passive: { label: game.i18n.localize("SW5E.Features"), items: [], dataset: {type: "feat"} }, equipment: { label: game.i18n.localize("SW5E.StarshipEquipment"), items: [], dataset: {type: "equipment"}}, - starshipfeatures: { label: game.i18n.localize("SW5E.StarshipfeaturePl"), items: [], hasActions: true, dataset: {type: "starshipfeature"} }, - starshipmods: { label: game.i18n.localize("SW5E.StarshipmodPl"), items: [], hasActions: false, dataset: {type: "starshipmod"} } + starshipfeatures: { label: game.i18n.localize("SW5E.StarshipfeaturePl"), items: [], hasActions: true, dataset: {type: "starshipfeature"} }, + starshipmods: { label: game.i18n.localize("SW5E.StarshipmodPl"), items: [], hasActions: false, dataset: {type: "starshipmod"} } }; // Start by classifying items into groups for rendering diff --git a/module/actor/sheets/oldSheets/base.js b/module/actor/sheets/oldSheets/base.js index c97dd95a..aaabc84e 100644 --- a/module/actor/sheets/oldSheets/base.js +++ b/module/actor/sheets/oldSheets/base.js @@ -65,6 +65,7 @@ export default class ActorSheet5e extends ActorSheet { cssClass: isOwner ? "editable" : "locked", isCharacter: this.entity.data.type === "character", isNPC: this.entity.data.type === "npc", + isStarship: this.entity.data.type === "starship", isVehicle: this.entity.data.type === 'vehicle', config: CONFIG.SW5E, }; diff --git a/sw5e.js b/sw5e.js index 3d54b6e9..74ee37bc 100644 --- a/sw5e.js +++ b/sw5e.js @@ -161,8 +161,8 @@ Hooks.once("setup", function() { "armorProficiencies", "armorPropertiesTypes", "conditionTypes", "consumableTypes", "cover", "currencies", "damageResistanceTypes", "damageTypes", "distanceUnits", "equipmentTypes", "healingTypes", "itemActionTypes", "languages", "limitedUsePeriods", "movementTypes", "movementUnits", "polymorphSettings", "proficiencyLevels", "senses", "skills", - "powerComponents", "powerLevels", "powerPreparationModes", "powerScalingModes", "powerSchools", "targetTypes", - "timePeriods", "toolProficiencies", "weaponProficiencies", "weaponProperties", "weaponTypes" + "starshipSkills", "powerComponents", "powerLevels", "powerPreparationModes", "powerScalingModes", "powerSchools", "targetTypes", + "timePeriods", "toolProficiencies", "weaponProficiencies", "weaponProperties", "weaponTypes", "weaponSizes" ]; // Exclude some from sorting where the default order matters diff --git a/template.json b/template.json index 49679290..995ee36d 100644 --- a/template.json +++ b/template.json @@ -404,86 +404,86 @@ } }, "starship": { - "templates": ["common"], - "attributes": { - "hp": { - "value": 10, - "max": 10, - "formula": "", - "temp": 0, - "tempmax": 0 - }, - "sp": { - "formula": "" - } - }, - "details": { - "tier": 0, - "role": "", - "source": "" - }, - "skills": { - "ast": { - "value": 0, - "ability": "int" - }, - "bst": { - "value": 0, - "ability": "str" - }, - "dat": { - "value": 0, - "ability": "int" + "templates": ["common"], + "attributes": { + "hp": { + "value": 10, + "max": 10, + "formula": "", + "temp": 0, + "tempmax": 0 + }, + "sp": { + "formula": "" + } }, - "hid": { - "value": 0, - "ability": "dex" - }, - "imp": { - "value": 0, - "ability": "cha" - }, - "int": { - "value": 0, - "ability": "cha" - }, - "man": { - "value": 0, - "ability": "dex" - }, - "men": { - "value": 0, - "ability": "cha" - }, - "pat": { - "value": 0, - "ability": "con" - }, - "prb": { - "value": 0, - "ability": "int" - }, - "ram": { - "value": 0, - "ability": "str" - }, - "reg": { - "value": 0, - "ability": "con" - }, - "scn": { - "value": 0, - "ability": "wis" - }, - "swn": { - "value": 0, - "ability": "cha" - } - }, - "traits": { - "size": "med" - } - }, + "details": { + "tier": 0, + "role": "", + "source": "" + }, + "skills": { + "ast": { + "value": 0, + "ability": "int" + }, + "bst": { + "value": 0, + "ability": "str" + }, + "dat": { + "value": 0, + "ability": "int" + }, + "hid": { + "value": 0, + "ability": "dex" + }, + "imp": { + "value": 0, + "ability": "cha" + }, + "int": { + "value": 0, + "ability": "cha" + }, + "man": { + "value": 0, + "ability": "dex" + }, + "men": { + "value": 0, + "ability": "cha" + }, + "pat": { + "value": 0, + "ability": "con" + }, + "prb": { + "value": 0, + "ability": "int" + }, + "ram": { + "value": 0, + "ability": "str" + }, + "reg": { + "value": 0, + "ability": "con" + }, + "scn": { + "value": 0, + "ability": "wis" + }, + "swn": { + "value": 0, + "ability": "cha" + } + }, + "traits": { + "size": "med" + } + }, "vehicle": { "templates": ["common"], "abilities": { diff --git a/templates/actors/newActor/starship.html b/templates/actors/newActor/starship.html index 7a8fcd01..2caf38a0 100644 --- a/templates/actors/newActor/starship.html +++ b/templates/actors/newActor/starship.html @@ -123,7 +123,7 @@

{{localize "SW5E.Skills"}}

    - {{#each CONFIG.starshipSkills as |skill s|}} + {{#each data.skills as |skill s|}}