From 9d3b769422c10acb4638298d60f951daa8d5d266 Mon Sep 17 00:00:00 2001 From: Matt Stoolman Date: Tue, 26 Mar 2024 18:06:33 +0000 Subject: [PATCH 01/10] Prep for release 1.807 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 11d9a56d..95307134 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "starwarsffg", "title": "Star Wars FFG", "description": "A system for playing Star Wars FFG games.", - "version": "1.806", + "version": "1.807", "compatibility": { "minimum": 10, "verified": 11 @@ -47,6 +47,6 @@ "secondaryTokenAttribute": "strain", "url": "https://github.com/StarWarsFoundryVTT/StarWarsFFG", "manifest": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/latest/download/system.json", - "download": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/download/v1.806/starwarsffg_1.806.zip", + "download": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/download/v1.807/starwarsffg_1.807.zip", "license": "LICENSE.txt" } From fee77ccba639791a0d0b267e93003ef48824b015 Mon Sep 17 00:00:00 2001 From: wrycu Date: Wed, 27 Mar 2024 12:11:19 -0700 Subject: [PATCH 02/10] fix(items): fix item qualities on items (#1387) * properly escapes content and loads it #1385 --- modules/actors/actor-sheet-ffg.js | 32 +++++++++++++++++++++++++------ modules/items/item-ffg.js | 2 +- modules/swffg-main.js | 2 +- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/modules/actors/actor-sheet-ffg.js b/modules/actors/actor-sheet-ffg.js index f4ce7b02..d3980339 100644 --- a/modules/actors/actor-sheet-ffg.js +++ b/modules/actors/actor-sheet-ffg.js @@ -529,13 +529,33 @@ export class ActorSheetFFG extends ActorSheet { html.find("li.item-pill").on("click", async (event) => { event.preventDefault(); event.stopPropagation(); - const li = event.currentTarget; - - let itemId = li.dataset.itemId; - let modifierType = li.dataset.modifierType; - let modifierId = li.dataset.modifierId; + const li = $(event.currentTarget); + const itemType = li.attr("data-item-embed-type"); + let itemData = {}; + const newEmbed = li.attr("data-item-embed"); + + if (newEmbed === "true" && itemType === "itemmodifier") { + itemData = { + img: li.attr('data-item-embed-img'), + name: li.attr('data-item-embed-name'), + type: li.attr('data-item-embed-type'), + system: { + description: unescape(li.attr('data-item-embed-description')), + attributes: JSON.parse(li.attr('data-item-embed-modifiers')), + rank: li.attr('data-item-embed-rank'), + rank_current: li.attr('data-item-embed-rank'), + }, + }; + const tempItem = await Item.create(itemData, {temporary: true}); + tempItem.sheet.render(true); + } else { + CONFIG.logger.debug(`Unknown item type: ${itemType}, or lacking new embed system`); + let itemId = li.dataset.itemId; + let modifierType = li.dataset.modifierType; + let modifierId = li.dataset.modifierId; - await EmbeddedItemHelpers.displayOwnedItemItemModifiersAsJournal(itemId, modifierType, modifierId, this.actor.id, this.actor.compendium); + await EmbeddedItemHelpers.displayOwnedItemItemModifiersAsJournal(itemId, modifierType, modifierId, this.actor.id, this.actor.compendium); + } }); } }); diff --git a/modules/items/item-ffg.js b/modules/items/item-ffg.js index 4c540d5c..058db6a6 100644 --- a/modules/items/item-ffg.js +++ b/modules/items/item-ffg.js @@ -491,7 +491,7 @@ export class ItemFFG extends ItemBaseFFG { // General equipment properties else if (this.type !== "talent") { if (data.hasOwnProperty("adjusteditemmodifier")) { - const qualities = data.adjusteditemmodifier?.map((m) => `
  • ${m.name} ${m.system?.rank_current > 0 ? m.system.rank_current : ""} ${m.adjusted ? "
    " + game.i18n.localize("SWFFG.FromAttachment") + "
    " : ""}
  • `); + const qualities = data.adjusteditemmodifier?.map((m) => `
  • ${m.name} ${m.system?.rank_current > 0 ? m.system.rank_current : ""} ${m.adjusted ? "
    " + game.i18n.localize("SWFFG.FromAttachment") + "
    " : ""}
  • `); props.push(`
    ${game.i18n.localize("SWFFG.ItemDescriptors")}:
      ${qualities.join("")}
      `); } diff --git a/modules/swffg-main.js b/modules/swffg-main.js index c778283a..0312d3b4 100644 --- a/modules/swffg-main.js +++ b/modules/swffg-main.js @@ -546,7 +546,7 @@ Hooks.on("renderChatMessage", (app, html, messageData) => { name: li.attr('data-item-embed-name'), type: li.attr('data-item-embed-type'), system: { - description: li.attr('data-item-embed-description'), + description: unescape(li.attr('data-item-embed-description')), attributes: JSON.parse(li.attr('data-item-embed-modifiers')), rank: li.attr('data-item-embed-rank'), rank_current: li.attr('data-item-embed-rank'), From 2280521e21dc33c9f62bfd8179e3d21583c05fee Mon Sep 17 00:00:00 2001 From: Matt Stoolman Date: Wed, 27 Mar 2024 21:36:48 +0000 Subject: [PATCH 03/10] Prep for release v1.808 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 95307134..0ad2a13d 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "starwarsffg", "title": "Star Wars FFG", "description": "A system for playing Star Wars FFG games.", - "version": "1.807", + "version": "1.808", "compatibility": { "minimum": 10, "verified": 11 @@ -47,6 +47,6 @@ "secondaryTokenAttribute": "strain", "url": "https://github.com/StarWarsFoundryVTT/StarWarsFFG", "manifest": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/latest/download/system.json", - "download": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/download/v1.807/starwarsffg_1.807.zip", + "download": "https://github.com/StarWarsFoundryVTT/StarWarsFFG/releases/download/v1.808/starwarsffg_1.808.zip", "license": "LICENSE.txt" } From 84a36ff01cb6427e5c460aefc5f88921c75834ee Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 12:50:15 -0700 Subject: [PATCH 04/10] fix(items): correct opening items with blank qualities (#1399) #1397 --- modules/items/item-ffg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/items/item-ffg.js b/modules/items/item-ffg.js index 058db6a6..46f67746 100644 --- a/modules/items/item-ffg.js +++ b/modules/items/item-ffg.js @@ -491,7 +491,8 @@ export class ItemFFG extends ItemBaseFFG { // General equipment properties else if (this.type !== "talent") { if (data.hasOwnProperty("adjusteditemmodifier")) { - const qualities = data.adjusteditemmodifier?.map((m) => `
    • ${m.name} ${m.system?.rank_current > 0 ? m.system.rank_current : ""} ${m.adjusted ? "
      " + game.i18n.localize("SWFFG.FromAttachment") + "
      " : ""}
    • `); + const modifiers = data.adjusteditemmodifier?.filter(i => Object.keys(i).length > 0); + const qualities = modifiers?.map((m) => `
    • ${m.name} ${m.system?.rank_current > 0 ? m.system.rank_current : ""} ${m.adjusted ? "
      " + game.i18n.localize("SWFFG.FromAttachment") + "
      " : ""}
    • `); props.push(`
      ${game.i18n.localize("SWFFG.ItemDescriptors")}:
        ${qualities.join("")}
        `); } From 504ab5464c6ffea9cecae5d31a47d8cb63c3251d Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 12:51:49 -0700 Subject: [PATCH 05/10] fix(rolls): fix for giant dice again (#1401) #1395 --- styles/mandar.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/styles/mandar.css b/styles/mandar.css index 19895fca..5e7583ea 100644 --- a/styles/mandar.css +++ b/styles/mandar.css @@ -4004,3 +4004,8 @@ img { max-width: 24px; max-height: 24px; } + +.starwarsffg .dice-tooltip .dice-rolls .roll { + width: 24px; + float: left; +} From b293ff31cc8546ba55f440d97d1df72db89bb017 Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 12:53:26 -0700 Subject: [PATCH 06/10] refactor(macros): macro improvements (#1402) * macros now capture the image of the document they came from * you can now create display macros for all item types #1389 --- modules/helpers/macros.js | 104 ++++++++++++++++++++++++++++---------- modules/swffg-main.js | 8 ++- 2 files changed, 84 insertions(+), 28 deletions(-) diff --git a/modules/helpers/macros.js b/modules/helpers/macros.js index c3a681d2..44a291fd 100644 --- a/modules/helpers/macros.js +++ b/modules/helpers/macros.js @@ -8,44 +8,96 @@ const createMacroItem = async (macro) => { }; // Simple function for handling the creation of rollable weapon macros on hotbarDrop event. -export async function createFFGMacro(data, slot) { - if (data.type !== "Transfer" && data.type !== "CreateMacro") return; - if (data.data.type !== "weapon" && data.data.type !== "skill") return; - +export async function createFFGMacro(bar, data, slot) { let macro; - if (data.data.type === "weapon") { - if (!("data" in data)) return ui.notifications.warn("You can only create macro buttons for owned weapon items."); - const item = data.data; - // Create the macro command - const command = ` - // game.ffg.DiceHelpers.rollItem(itemid, actorid, flavortext, sound); + if (["Item", "Actor"].includes(data.type)) { + const entity = await fromUuid(data.uuid); + if (!entity) { + return; + } + if (entity.type === "weapon") { + let command; + if (!entity?.flags?.starwarsffg?.ffgIsOwned) { + command = `await Hotbar.toggleDocumentSheet("${data.uuid}");`; + } else { + command = ` + game.ffg.DiceHelpers.rollItem(\"${item._id}\", \"${entity.actorId}\"); + `; + } + macro = await createMacroItem({ + name: entity.name, + type: "script", + img: entity.img, + command: command, + }); + } else if (entity.type === "skill") { + const actor = game.actors.get(data.actorId); + const command = ` + const ffgactor = game.actors.get("${data.actorId}"); + const skill = ffgactor.data.data.skills["${data.data.skill}"]; + const characteristic = ffgactor.data.data.characteristics["${data.data.characteristic}"]; + const actorSheet = ffgactor.sheet.getData(); + game.ffg.DiceHelpers.rollSkillDirect(skill, characteristic, 2, actorSheet);`; + macro = await createMacroItem({ + name: `${actor.name}-${data.data.skill}`, + type: "script", + command: command, + }); + } + + + } else if (data.type === "Transfer") { + if (data.data.type !== "weapon" && data.data.type !== "skill") { + return; + } + if (data.data.type === "weapon") { + if (!("data" in data)) return ui.notifications.warn("You can only create macro buttons for owned weapon items."); + const item = data.data; + // Create the macro command + const command = ` game.ffg.DiceHelpers.rollItem(\"${item._id}\", \"${data.actorId}\"); `; - macro = await createMacroItem({ - name: item.name, - type: "script", - img: item.img, - command: command, - }); - } else if (data.data.type === "skill") { - const actor = game.actors.get(data.actorId); - const command = ` + macro = await createMacroItem({ + name: `Attack with ${item.name}`, + type: "script", + img: item.img, + command: command, + }); + } else if (data.data.type === "skill") { + const actor = game.actors.get(data.actorId); + const command = ` // game.ffg.DiceHelpers.rollSkillDirect(skill, characteristic, difficulty, actorSheet, flavortext, sound); const ffgactor = game.actors.get("${data.actorId}"); const skill = ffgactor.data.data.skills["${data.data.skill}"]; const characteristic = ffgactor.data.data.characteristics["${data.data.characteristic}"]; const actorSheet = ffgactor.sheet.getData(); game.ffg.DiceHelpers.rollSkillDirect(skill, characteristic, 2, actorSheet);`; - macro = await createMacroItem({ - name: `${actor.name}-${data.data.skill}`, - type: "script", - command: command, - }); + macro = await createMacroItem({ + name: `${actor.name}-${data.data.skill}`, + type: "script", + command: command, + }); + } } - if (macro) { game.user.assignHotbarMacro(macro, slot); } - return false; } + +/** + * Update a macro with the image of the entity in the macro + * @param macro + * @returns {Promise<*>} + */ +export async function updateMacro(macro) { + let uuid = macro.command.split("\""); + if (uuid.length >= 1) { + const document = await fromUuid(uuid[1]); + if (document?.img) { + macro.img = document?.img; + await macro.update({img: document.img}); + } + } + return macro; +} diff --git a/modules/swffg-main.js b/modules/swffg-main.js index 0312d3b4..2b36f5f3 100644 --- a/modules/swffg-main.js +++ b/modules/swffg-main.js @@ -32,7 +32,7 @@ import {register_crew} from "./helpers/crew.js"; // Import Dice Types import { AbilityDie, BoostDie, ChallengeDie, DifficultyDie, ForceDie, ProficiencyDie, SetbackDie } from "./dice-pool-ffg.js"; -import { createFFGMacro } from "./helpers/macros.js"; +import { createFFGMacro, updateMacro } from "./helpers/macros.js"; import EmbeddedItemHelpers from "./helpers/embeddeditem-helpers.js"; import DataImporter from "./importer/data-importer.js"; import PauseFFG from "./apps/pause-ffg.js"; @@ -840,7 +840,11 @@ Hooks.once("ready", async () => { } // Wait to register hotbar drop hook on ready so that modules could register earlier if they want to - Hooks.on("hotbarDrop", (bar, data, slot) => createFFGMacro(data, slot)); + Hooks.on("hotbarDrop", async (bar, data, slot) => await createFFGMacro(bar, data, slot)); + Hooks.on("createMacro", async function (...args) { + args[0] = await updateMacro(args[0]); + return args; + }); Hooks.on("closeItemSheetFFG", (item) => { Hooks.call(`closeAssociatedTalent_${item.object._id}`, item); From 007378f30435346e4fd7c1d280dba31faa4d5a31 Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 12:54:01 -0700 Subject: [PATCH 07/10] fix(gm): correct GM detection (#1403) * uses activeGM instead of trying to find one #1388 --- modules/swffg-main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swffg-main.js b/modules/swffg-main.js index 2b36f5f3..f17f6b02 100644 --- a/modules/swffg-main.js +++ b/modules/swffg-main.js @@ -894,7 +894,7 @@ Hooks.once("ready", async () => { game.socket.on("system.starwarsffg", async (...args) => { const event_type = args[0].event; - if (game.user.id === game.users.find(i => i.isGM)?.id) { + if (game.user.id === game.users.activeGM?.id) { if (event_type === "combat") { CONFIG.logger.debug("Processing combat event from player"); const data = args[0]?.data; From 48d2cb758121dc48427516d8616bebdf17018429 Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 12:56:18 -0700 Subject: [PATCH 08/10] feat(items): sheet options (#1404) * add settings for gear, weapons, armor price and rarity #1326 --- lang/en.json | 5 ++ modules/items/item-ffg-options.js | 93 +++++++++++++++++++++++++++ modules/items/item-sheet-ffg.js | 18 ++++++ templates/items/ffg-armour-sheet.html | 6 +- templates/items/ffg-gear-sheet.html | 8 ++- templates/items/ffg-weapon-sheet.html | 6 +- 6 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 modules/items/item-ffg-options.js diff --git a/lang/en.json b/lang/en.json index 03ea8ac3..621875d5 100644 --- a/lang/en.json +++ b/lang/en.json @@ -315,6 +315,10 @@ "SWFFG.Cost": "COST:", "SWFFG.EnableSoakCalc": "Enable Soak Auto-Calculation", "SWFFG.EnableSoakCalcHint": "Enable soak auto-calculation and unload field for manual entry", + "SWFFG.SheetOptions2.EnablePrice.Name": "Enable Price", + "SWFFG.SheetOptions2.EnablePrice.Hint": "Shows price on item sheets", + "SWFFG.SheetOptions2.enableRarity.Name": "Enable Rarity", + "SWFFG.SheetOptions2.enableRarity.Hint": "Shows rarity on item sheets", "SWFFG.DefaultMedicalItemName": "Stimpacks", "SWFFG.MedicalItemName": "Healing Item Name", "SWFFG.MedicalItemNameHint": "Name of the item characters use to heal.", @@ -341,6 +345,7 @@ "SWFFG.Delete": "Delete", "SWFFG.SheetOptions": "Sheet Options", "SWFFG.CharacterSheet": "Character Sheet", + "SWFFG.ItemSheet": "Item Sheet", "SWFFG.Options": "Options", "SWFFG.TalentSource": "Talent Rank Sources for", "SWFFG.EnableStrainThreshold": "Enable Strain Threshold", diff --git a/modules/items/item-ffg-options.js b/modules/items/item-ffg-options.js new file mode 100644 index 00000000..90b8ba71 --- /dev/null +++ b/modules/items/item-ffg-options.js @@ -0,0 +1,93 @@ +export default class ItemOptions { + constructor(data, html) { + this.data = data; + this.options = {}; + this.init(html); + } + + init(html) { + const options = $(`.starwarsffg.sheet.item[data-appid='${this.data.appId}'] .ffg-sheet-options`); + if (options.length === 0) { + const button = $(`${game.i18n.localize("SWFFG.SheetOptions")}`); + button.insertBefore(`.starwarsffg.sheet.item[data-appid='${this.data.appId}'] header a:first`); + button.on("click", this.handler.bind(this)); + } + } + + handler(event) { + const title = `${game.i18n.localize("SWFFG.ItemSheet")} ${game.i18n.localize("SWFFG.Options")}: ${this.data.item.name}`; + + new Dialog( + { + title, + content: { + options: this.options, + }, + buttons: { + one: { + icon: '', + label: game.i18n.localize("SWFFG.ButtonAccept"), + callback: (html) => { + const controls = html.find("input, select"); + + let updateObject = {}; + + for (let i = 0; i < controls.length; i += 1) { + const control = controls[i]; + let value; + if (control.dataset["dtype"] === "Boolean") { + value = control.checked; + } else { + value = control.value; + } + + updateObject[control.name] = value; + this.options[control.id].value = value; + } + + this.data.object.update(updateObject); + this.data.object.sheet.render(true); + }, + }, + two: { + icon: '', + label: game.i18n.localize("SWFFG.Cancel"), + }, + }, + }, + { + classes: ["dialog", "starwarsffg"], + template: "systems/starwarsffg/templates/dialogs/ffg-sheet-options.html", + } + ).render(true); + } + + async register(optionName, options) { + if (!this.options[optionName]) { + this.options[optionName] = { ...options }; + } + if (typeof this.data.object.flags?.starwarsffg?.config == "undefined") { + await this.data.object.setFlag("starwarsffg", "config", {}); + } + + if (typeof this.data.object.flags?.starwarsffg?.config[optionName] !== "undefined") { + this.options[optionName].value = this.data.object.flags?.starwarsffg?.config[optionName]; + } else { + this.options[optionName].value = this.options[optionName].default; + } + } + + registerMany(optionsArray) { + optionsArray.forEach((option) => { + this.register(option.name, option.options); + }); + } + + unregister(optionName) { + delete this.options[optionName]; + } + + clear() { + this.options = {}; + } +} diff --git a/modules/items/item-sheet-ffg.js b/modules/items/item-sheet-ffg.js index b74b004d..cc07ff1c 100644 --- a/modules/items/item-sheet-ffg.js +++ b/modules/items/item-sheet-ffg.js @@ -6,6 +6,7 @@ import ImportHelpers from "../importer/import-helpers.js"; import DiceHelpers from "../helpers/dice-helpers.js"; import item from "../helpers/embeddeditem-helpers.js"; import EmbeddedItemHelpers from "../helpers/embeddeditem-helpers.js"; +import ItemOptions from "./item-ffg-options.js"; /** * Extend the basic ItemSheet with some very simple modifications @@ -270,6 +271,23 @@ export class ItemSheetFFG extends ItemSheet { activateListeners(html) { super.activateListeners(html); + // register sheet options + if (["gear", "weapon", "armour"].includes(this.object.type)) { + this.sheetoptions = new ItemOptions(this, html); + this.sheetoptions.register("enablePrice", { + name: game.i18n.localize("SWFFG.SheetOptions2.EnablePrice.Name"), + hint: game.i18n.localize("SWFFG.SheetOptions2.EnablePrice.Hint"), + type: "Boolean", + default: true, + }); + this.sheetoptions.register("enableRarity", { + name: game.i18n.localize("SWFFG.SheetOptions2.enableRarity.Name"), + hint: game.i18n.localize("SWFFG.SheetOptions2.enableRarity.Hint"), + type: "Boolean", + default: true, + }); + } + // TODO: This is not needed in Foundry 0.6.0 // Activate tabs let tabs = html.find(".tabs"); diff --git a/templates/items/ffg-armour-sheet.html b/templates/items/ffg-armour-sheet.html index 905aded2..e42d998b 100644 --- a/templates/items/ffg-armour-sheet.html +++ b/templates/items/ffg-armour-sheet.html @@ -62,6 +62,7 @@

        + {{#if (or (eq item.flags.starwarsffg.config.enableRarity undefined) (eq item.flags.starwarsffg.config.enableRarity true) )}}
        @@ -75,10 +76,13 @@

        + {{/if}}
        - {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value adjusted=data.price.adjusted)}} + {{#if (or (eq item.flags.starwarsffg.config.enablePrice undefined) (eq item.flags.starwarsffg.config.enablePrice true) )}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value adjusted=data.price.adjusted)}} + {{/if}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponQuantity" type="Number" name="data.quantity.value" value=data.quantity.value)}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.IsRestricted" type="Boolean" name="data.rarity.isrestricted" value=data.rarity.isrestricted)}}
        diff --git a/templates/items/ffg-gear-sheet.html b/templates/items/ffg-gear-sheet.html index 30ccd3cb..ecfd6e05 100644 --- a/templates/items/ffg-gear-sheet.html +++ b/templates/items/ffg-gear-sheet.html @@ -20,6 +20,7 @@

        + {{#if (or (eq item.flags.starwarsffg.config.enableRarity undefined) (eq item.flags.starwarsffg.config.enableRarity true) )}}
        @@ -30,10 +31,15 @@

        + {{/if}}
        - {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value)}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponQuantity" type="Number" name="data.quantity.value" value=data.quantity.value)}}{{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.IsRestricted" type="Boolean" name="data.rarity.isrestricted" value=data.rarity.isrestricted)}} + {{#if (or (eq item.flags.starwarsffg.config.enablePrice undefined) (eq item.flags.starwarsffg.config.enablePrice true) )}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value)}} + {{/if}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponQuantity" type="Number" name="data.quantity.value" value=data.quantity.value)}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.IsRestricted" type="Boolean" name="data.rarity.isrestricted" value=data.rarity.isrestricted)}}
        diff --git a/templates/items/ffg-weapon-sheet.html b/templates/items/ffg-weapon-sheet.html index 1cecacb9..a95c34cf 100644 --- a/templates/items/ffg-weapon-sheet.html +++ b/templates/items/ffg-weapon-sheet.html @@ -61,6 +61,7 @@

        + {{#if (or (eq item.flags.starwarsffg.config.enableRarity undefined) (eq item.flags.starwarsffg.config.enableRarity true) )}}
        @@ -74,13 +75,16 @@

        + {{/if}}
        {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponSkill" type="Dropdown" name="data.skill.value" value=data.skill.value options=this.FFG.skills)}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponRange" type="Dropdown" name="data.range.value" value=data.range.value options=this.FFG.ranges adjusted=data.range.label) }} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponStatus" type="Dropdown" name="data.status" value=data.status options=this.FFG.itemstatus)}} - {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value adjusted=data.price.adjusted)}} + {{#if (or (eq item.flags.starwarsffg.config.enablePrice undefined) (eq item.flags.starwarsffg.config.enablePrice true) )}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponPrice" type="Number" name="data.price.value" value=data.price.value adjusted=data.price.adjusted)}} + {{/if}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemWeaponSpecial" type="PopoutEditor" name="data.special.value" value=data.special.value )}}
        From cfede2184be3783acfc019ff13dc9b7bbbca5423 Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 13:01:16 -0700 Subject: [PATCH 09/10] feat(crew): show remsetback (#1406) * show remove setback dice on vehicle * correct bug where handling was not included #1380 --- modules/helpers/crew.js | 2 +- modules/helpers/dice-helpers.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/helpers/crew.js b/modules/helpers/crew.js index fdb31892..2f5f3e50 100644 --- a/modules/helpers/crew.js +++ b/modules/helpers/crew.js @@ -164,7 +164,7 @@ export function build_crew_roll(vehicle, crew_id, crew_role) { } // check if the pool uses handling if (role_info[0].use_handling) { - const handling = vehicle?.system?.stats?.handling?.value; + const handling = vehicle_actor?.system?.stats?.handling?.value; // add modifiers from the vehicle handling if (handling > 0) { starting_pool['boost'] = handling; diff --git a/modules/helpers/dice-helpers.js b/modules/helpers/dice-helpers.js index d3b46574..e08fef47 100644 --- a/modules/helpers/dice-helpers.js +++ b/modules/helpers/dice-helpers.js @@ -286,6 +286,7 @@ export function get_dice_pool(actor_id, skill_name, incoming_roll) { triumph: skill.triumph + incoming_roll.triumph, despair: skill.despair + incoming_roll.despair, upgrades: skill.upgrades + incoming_roll.upgrades, + remsetback: skill.remsetback + incoming_roll.remsetback, difficulty: +incoming_roll.difficulty, }); return dicePool; From 09eb95b83daeccf39a5e3375473123d47991e1ff Mon Sep 17 00:00:00 2001 From: wrycu Date: Sat, 6 Apr 2024 13:06:07 -0700 Subject: [PATCH 10/10] Mandar css 1386 (#1407) * fix(css): correct name not centered * also fixes talent activation #1386 * fix(css): remove attachment deadspace #1386 * fix(css): clipped crit labels #1386 * fix(css): fix height for description #1386 --- modules/items/item-sheet-ffg.js | 5 +- styles/mandar.css | 55 +++++++++++++++---- templates/items/ffg-ability-sheet.html | 2 +- templates/items/ffg-armour-sheet.html | 2 +- templates/items/ffg-criticaldamage-sheet.html | 2 +- templates/items/ffg-criticalinjury-sheet.html | 2 +- templates/items/ffg-gear-sheet.html | 2 +- .../items/ffg-homesteadupgrade-sheet.html | 2 +- templates/items/ffg-itemattachment-sheet.html | 2 +- templates/items/ffg-shipattachment-sheet.html | 2 +- templates/items/ffg-shipweapon-sheet.html | 2 +- templates/items/ffg-species-sheet.html | 2 +- templates/items/ffg-talent-sheet.html | 16 +++++- templates/items/ffg-weapon-sheet.html | 2 +- 14 files changed, 73 insertions(+), 25 deletions(-) diff --git a/modules/items/item-sheet-ffg.js b/modules/items/item-sheet-ffg.js index cc07ff1c..0db728ba 100644 --- a/modules/items/item-sheet-ffg.js +++ b/modules/items/item-sheet-ffg.js @@ -108,8 +108,11 @@ export class ItemSheetFFG extends ItemSheet { this.position.height = 350; break; case "armour": - case "ability": case "gear": + this.position.width = 385; + this.position.height = 750; + break; + case "ability": case "shipattachment": case "homesteadupgrade": this.position.width = 385; diff --git a/styles/mandar.css b/styles/mandar.css index 5e7583ea..c0ec600a 100644 --- a/styles/mandar.css +++ b/styles/mandar.css @@ -618,7 +618,8 @@ img { } .starwarsffg.sheet .sheet-body { - height: calc(100% - 15.75rem); + /*height: 60px;*/ + height: calc(100% - 30.75rem); min-height: 100px; display: flex; flex-direction: column; @@ -631,6 +632,43 @@ img { border-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(73, 12, 11, 0.85), rgba(0, 0, 0, 0)) 5%; } +/* confirmed good */ +.starwarsffg.sheet .sheet-body.gear { + height: calc(100% - 24rem); +} + +.starwarsffg.sheet .sheet-body.weapon, .starwarsffg.sheet .sheet-body.armour { + height: calc(100% - 32rem); +} + +.starwarsffg.sheet .sheet-body.shipweapon { + height: calc(100% - 40rem); +} + +.starwarsffg.sheet .sheet-body.itemattachment { + height: calc(100% - 18rem); +} + +.starwarsffg.sheet .sheet-body.ability { + height: calc(100% - 1.5rem); +} + +.starwarsffg.sheet .sheet-body.shipattachment { + height: calc(100% - 22.75rem); +} + +.starwarsffg.sheet .sheet-body.homesteadupgrade { + height: calc(100% - 20rem); +} + +.starwarsffg.sheet .sheet-body.talent { + height: calc(100% - 26rem); +} + +.starwarsffg.sheet .sheet-body.species { + height: calc(100% - 24rem); +} + .starwarsffg.sheet .sheet-body .tab { height: 100%; padding: 0; @@ -646,11 +684,7 @@ img { .starwarsffg.sheet .sheet-body .editor { width: 100%; - height: calc(100% - 1.5rem); -} - -.starwarsffg.sheet.v2 .sheet-body { - height: calc(100% - 14rem); + /*height: calc(100% - 1.5rem);*/ } .starwarsffg.sheet.v2.minion .sheet-body { @@ -1781,8 +1815,11 @@ img { font-size: 1rem; } +.starwarsffg .item-sheet-criticalinjury .crit-label { + padding-top: 5px; +} + .starwarsffg .item-sheet-talent .header-fields h1 input, .starwarsffg .item-sheet-gear .header-fields h1 input, .starwarsffg .item-sheet-weapon .header-fields h1 input, .starwarsffg .item-sheet-armor .header-fields h1 input, .starwarsffg .item-sheet-vehicle-weapon .header-fields h1 input, .starwarsffg .item-sheet-vehicle-attachment .header-fields h1 input, .starwarsffg .item-sheet-criticalinjury .header-fields h1 input { - padding-left: 3rem; margin: 0; width: 100%; text-align: center; @@ -3758,10 +3795,6 @@ img { height: auto; } -.starwarsffg .item-sheet-itemattachment .sheet-body { - height: calc(100% - 19rem); -} - .starwarsffg .item-sheet-itemattachment .sheet-body table th:first-child { text-align: left; padding-left: 3px; diff --git a/templates/items/ffg-ability-sheet.html b/templates/items/ffg-ability-sheet.html index 4359b595..5e71d574 100644 --- a/templates/items/ffg-ability-sheet.html +++ b/templates/items/ffg-ability-sheet.html @@ -11,7 +11,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-armour-sheet.html b/templates/items/ffg-armour-sheet.html index e42d998b..c2f8cb7b 100644 --- a/templates/items/ffg-armour-sheet.html +++ b/templates/items/ffg-armour-sheet.html @@ -102,7 +102,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-criticaldamage-sheet.html b/templates/items/ffg-criticaldamage-sheet.html index 5539d752..eecabd72 100644 --- a/templates/items/ffg-criticaldamage-sheet.html +++ b/templates/items/ffg-criticaldamage-sheet.html @@ -11,7 +11,7 @@

        "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="split" title="d100 Roll" fields=(array (object name="data.min" value=data.min type="Number" label="Low") (object name="data.max" value=data.max type="Number" label="High") ))}}

        -
        +
        {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.Severity" type="Dropdown" name="data.severity" value=data.severity options=this.FFG.difficulty)}}
        diff --git a/templates/items/ffg-criticalinjury-sheet.html b/templates/items/ffg-criticalinjury-sheet.html index 5539d752..eecabd72 100644 --- a/templates/items/ffg-criticalinjury-sheet.html +++ b/templates/items/ffg-criticalinjury-sheet.html @@ -11,7 +11,7 @@

        "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="split" title="d100 Roll" fields=(array (object name="data.min" value=data.min type="Number" label="Low") (object name="data.max" value=data.max type="Number" label="High") ))}}

        -
        +
        {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.Severity" type="Dropdown" name="data.severity" value=data.severity options=this.FFG.difficulty)}}
        diff --git a/templates/items/ffg-gear-sheet.html b/templates/items/ffg-gear-sheet.html index ecfd6e05..4ef6c4ed 100644 --- a/templates/items/ffg-gear-sheet.html +++ b/templates/items/ffg-gear-sheet.html @@ -47,7 +47,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-homesteadupgrade-sheet.html b/templates/items/ffg-homesteadupgrade-sheet.html index f300006e..cd011006 100644 --- a/templates/items/ffg-homesteadupgrade-sheet.html +++ b/templates/items/ffg-homesteadupgrade-sheet.html @@ -18,7 +18,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-itemattachment-sheet.html b/templates/items/ffg-itemattachment-sheet.html index 90c7ac99..437955b3 100644 --- a/templates/items/ffg-itemattachment-sheet.html +++ b/templates/items/ffg-itemattachment-sheet.html @@ -48,7 +48,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabBaseModifiers" icon="fas fa-cog" cls=classType) (object tab="additional" label="SWFFG.TabAdditionalModifiers" icon="fas fa-cog" cls=classType) (object tab="configuration" label="SWFFG.TabConfiguration" icon="fas fa-cog" isHidden=isTemp cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-shipattachment-sheet.html b/templates/items/ffg-shipattachment-sheet.html index 983e12c2..7ca61ba3 100644 --- a/templates/items/ffg-shipattachment-sheet.html +++ b/templates/items/ffg-shipattachment-sheet.html @@ -42,7 +42,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-shipweapon-sheet.html b/templates/items/ffg-shipweapon-sheet.html index ca32f3c6..4f7085af 100644 --- a/templates/items/ffg-shipweapon-sheet.html +++ b/templates/items/ffg-shipweapon-sheet.html @@ -101,7 +101,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) (object tab="configuration" label="SWFFG.TabConfiguration" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-species-sheet.html b/templates/items/ffg-species-sheet.html index 54579d69..c22c96a1 100644 --- a/templates/items/ffg-species-sheet.html +++ b/templates/items/ffg-species-sheet.html @@ -44,7 +44,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-talent-sheet.html b/templates/items/ffg-talent-sheet.html index f04030e7..06d00ff2 100644 --- a/templates/items/ffg-talent-sheet.html +++ b/templates/items/ffg-talent-sheet.html @@ -9,13 +9,25 @@

        - {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsActivation" type="Dropdown" name="data.activation.value" value=data.activation.value options=this.FFG.activations) }} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemTalentRanked" type="Boolean" name="data.ranks.ranked" value=data.ranks.ranked)}} {{#if data.ranks.ranked}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsRank" type="Number" name="data.ranks.current" value=data.ranks.current)}} {{/if}} {{#if (ne this.FFG.theme "starwars" )}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentTier" type="Dropdown" name="data.tier" value=data.tier options=(array (object label="1" value=1) (object label="2" value=2) (object label="3" value=3) (object label="4" value=4) (object label="5" value=5) )) }} {{else}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsForce" type="Boolean" name="data.isForceTalent" value=data.isForceTalent)}} {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsConflict" type="Boolean" name="data.isConflictTalent" value=data.isConflictTalent)}} {{/if}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsActivation" type="Dropdown" name="data.activation.value" value=data.activation.value options=this.FFG.activations) }} +
        +
        + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.ItemTalentRanked" type="Boolean" name="data.ranks.ranked" value=data.ranks.ranked)}} + {{#if data.ranks.ranked}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsRank" type="Number" name="data.ranks.current" value=data.ranks.current)}} + {{/if}} + {{#if (ne this.FFG.theme "starwars" )}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentTier" type="Dropdown" name="data.tier" value=data.tier options=(array (object label="1" value=1) (object label="2" value=2) (object label="3" value=3) (object label="4" value=4) (object label="5" value=5) )) }} + {{else}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsForce" type="Boolean" name="data.isForceTalent" value=data.isForceTalent)}} + {{> "systems/starwarsffg/templates/parts/shared/ffg-block.html" (object blocktype="single" title="SWFFG.TalentsConflict" type="Boolean" name="data.isConflictTalent" value=data.isConflictTalent)}} + {{/if}}

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}} diff --git a/templates/items/ffg-weapon-sheet.html b/templates/items/ffg-weapon-sheet.html index a95c34cf..6e372d27 100644 --- a/templates/items/ffg-weapon-sheet.html +++ b/templates/items/ffg-weapon-sheet.html @@ -104,7 +104,7 @@

        {{!-- Sheet Tab Navigation --}} {{> "systems/starwarsffg/templates/parts/shared/ffg-tabs.html" displayLimited=true limited=limited items=(array (object tab="description" label="SWFFG.TabDescription" icon="far fa-file-alt" cls=classType) (object tab="attributes" label="SWFFG.TabModifiers" icon="fas fa-cog" cls=classType) (object tab="configuration" label="SWFFG.TabConfiguration" icon="fas fa-cog" cls=classType) )}} {{!-- Sheet Body --}} -
        +
        {{!-- Description Tab --}}
        {{editor data.renderedDesc target="system.description" button=true owner=owner editable=editable}}