From 35a225050ed0a7e5305ed2163337aa7a1825b9bd Mon Sep 17 00:00:00 2001 From: Forien Date: Thu, 30 Nov 2023 16:15:33 +0100 Subject: [PATCH 1/4] CSS compatibility for module Chat Commander --- static/css/wfrp4e.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/css/wfrp4e.css b/static/css/wfrp4e.css index 0560f8354..0517eee2e 100644 --- a/static/css/wfrp4e.css +++ b/static/css/wfrp4e.css @@ -1430,8 +1430,10 @@ font-weight: var(--actor-input-font-weight); color: var(--actor-input-color); line-height: normal; - border: 3px double #3e000078; } + #chat-form textarea#chat-message { + border: 3px double #3e000078; + } #chat-form textarea:focus { outline: none; box-shadow: none; @@ -17696,4 +17698,4 @@ blockquote.foundry-note::before { li.message.flexcol.whisper:has(div > p.requestmessage) { display: none; -} \ No newline at end of file +} From 23e615f5abc101d74db6ff410cd9e2989c9a8158 Mon Sep 17 00:00:00 2001 From: Forien Date: Sat, 2 Dec 2023 01:48:20 +0100 Subject: [PATCH 2/4] invisible border is needed --- static/css/wfrp4e.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/css/wfrp4e.css b/static/css/wfrp4e.css index 0517eee2e..b37887758 100644 --- a/static/css/wfrp4e.css +++ b/static/css/wfrp4e.css @@ -1422,7 +1422,7 @@ margin: 11px 11px 11px 11px; padding: 5px; resize: none; - border: none; + border: 3px solid #00000000; border-radius: 0px; background: none; font-family: var(--actor-input-font-family); From e3435dba9a355a358588822ccc1f3ff2bb98b6a7 Mon Sep 17 00:00:00 2001 From: Forien Date: Tue, 5 Dec 2023 08:58:20 +0100 Subject: [PATCH 3/4] add clickable property link for rich text editors --- modules/actor/sheet/actor-sheet.js | 1 + modules/hooks/journal.js | 1 + modules/item/item-sheet.js | 1 + modules/system/chat-wfrp4e.js | 1 + modules/system/config-wfrp4e.js | 12 ++++++++++++ modules/system/utility-wfrp4e.js | 22 ++++++++++++++++++++++ static/css/wfrp4e.css | 1 + 7 files changed, 39 insertions(+) diff --git a/modules/actor/sheet/actor-sheet.js b/modules/actor/sheet/actor-sheet.js index 50ae5f755..b8262edd1 100644 --- a/modules/actor/sheet/actor-sheet.js +++ b/modules/actor/sheet/actor-sheet.js @@ -721,6 +721,7 @@ export default class ActorSheetWfrp4e extends ActorSheet { html.on("click", ".chat-roll", WFRP_Utility.handleRollClick.bind(WFRP_Utility)) html.on("click", ".symptom-tag", WFRP_Utility.handleSymptomClick.bind(WFRP_Utility)) html.on("click", ".condition-chat", WFRP_Utility.handleConditionClick.bind(WFRP_Utility)) + html.on("click", ".property-chat", WFRP_Utility.handlePropertyClick.bind(WFRP_Utility)) html.on('mousedown', '.table-click', WFRP_Utility.handleTableClick.bind(WFRP_Utility)) html.on('mousedown', '.pay-link', WFRP_Utility.handlePayClick.bind(WFRP_Utility)) html.on('mousedown', '.credit-link', WFRP_Utility.handleCreditClick.bind(WFRP_Utility)) diff --git a/modules/hooks/journal.js b/modules/hooks/journal.js index 94bd1db6f..7f221cb34 100644 --- a/modules/hooks/journal.js +++ b/modules/hooks/journal.js @@ -27,6 +27,7 @@ export default function() { html.find(".chat-roll").click(WFRP_Utility.handleRollClick.bind(WFRP_Utility)) html.find(".symptom-tag").click(WFRP_Utility.handleSymptomClick.bind(WFRP_Utility)) html.find(".condition-chat").click(WFRP_Utility.handleConditionClick.bind(WFRP_Utility)) + html.find(".property-chat").click(WFRP_Utility.handlePropertyClick.bind(WFRP_Utility)) html.find('.table-click').mousedown(WFRP_Utility.handleTableClick.bind(WFRP_Utility)) html.find('.pay-link').mousedown(WFRP_Utility.handlePayClick.bind(WFRP_Utility)) html.find('.credit-link').mousedown(WFRP_Utility.handleCreditClick.bind(WFRP_Utility)) diff --git a/modules/item/item-sheet.js b/modules/item/item-sheet.js index ac0346412..136c86314 100644 --- a/modules/item/item-sheet.js +++ b/modules/item/item-sheet.js @@ -230,6 +230,7 @@ export default class ItemSheetWfrp4e extends ItemSheet { html.on("click", ".chat-roll", WFRP_Utility.handleRollClick.bind(WFRP_Utility)) html.on("click", ".symptom-tag", WFRP_Utility.handleSymptomClick.bind(WFRP_Utility)) html.on("click", ".condition-chat", WFRP_Utility.handleConditionClick.bind(WFRP_Utility)) + html.on("click", ".property-chat", WFRP_Utility.handlePropertyClick.bind(WFRP_Utility)) html.on('mousedown', '.table-click', WFRP_Utility.handleTableClick.bind(WFRP_Utility)) html.on('mousedown', '.pay-link', WFRP_Utility.handlePayClick.bind(WFRP_Utility)) html.on('mousedown', '.credit-link', WFRP_Utility.handleCreditClick.bind(WFRP_Utility)) diff --git a/modules/system/chat-wfrp4e.js b/modules/system/chat-wfrp4e.js index 2b17fc8ec..fb9c4f523 100644 --- a/modules/system/chat-wfrp4e.js +++ b/modules/system/chat-wfrp4e.js @@ -80,6 +80,7 @@ export default class ChatWFRP { html.on("click", ".symptom-tag", WFRP_Utility.handleSymptomClick.bind(WFRP_Utility)) html.on("click", ".condition-chat", WFRP_Utility.handleConditionClick.bind(WFRP_Utility)) + html.on("click", ".property-chat", WFRP_Utility.handlePropertyClick.bind(WFRP_Utility)) html.on('mousedown', '.table-click', WFRP_Utility.handleTableClick.bind(WFRP_Utility)) html.on('mousedown', '.pay-link', WFRP_Utility.handlePayClick.bind(WFRP_Utility)) html.on('mousedown', '.credit-link', WFRP_Utility.handleCreditClick.bind(WFRP_Utility)) diff --git a/modules/system/config-wfrp4e.js b/modules/system/config-wfrp4e.js index 5737bb866..160dcd511 100644 --- a/modules/system/config-wfrp4e.js +++ b/modules/system/config-wfrp4e.js @@ -167,6 +167,18 @@ CONFIG.TextEditor.enrichers = CONFIG.TextEditor.enrichers.concat([ return a } }, + { + pattern : /@Property\[(.+?)](?:{(.+?)})?/gm, + enricher : (match) => { + const a = document.createElement("a"); + a.classList.add("property-chat"); + a.dataset.cond = match[1]; + let id = match[1]; + let label = match[2]; + a.innerHTML = `${label ? label : id}`; + return a; + } + }, { pattern : /@Pay\[(.+?)\](?:{(.+?)})?/gm, enricher : (match, options) => { diff --git a/modules/system/utility-wfrp4e.js b/modules/system/utility-wfrp4e.js index a1aa4d9f3..eed3c9a8e 100644 --- a/modules/system/utility-wfrp4e.js +++ b/modules/system/utility-wfrp4e.js @@ -906,6 +906,28 @@ export default class WFRP_Utility { ChatMessage.create(chatData); } + /** + * Post property description when clicked. + * + * @param {Object} event click event + */ + static handlePropertyClick(event) { + let prop = event.target.text.trim(); + + // If property rating is present, remove it + if (!isNaN(prop.split(" ").pop())) + prop = prop.split(" ").slice(0, -1).join(" "); + + const allProps = game.wfrp4e.utility.allProperties(); + const propKey = WFRP_Utility.findKey(prop, allProps, { caseInsensitive: true }); + const propName = allProps[propKey]; + const description = game.wfrp4e.config.qualityDescriptions[propKey] || game.wfrp4e.config.flawDescriptions[propKey]; + const messageContent = `${propName}
${description}`; + + const chatData = WFRP_Utility.chatDataSetup(messageContent, null); + ChatMessage.create(chatData); + } + /** * Post symptom when clicked * diff --git a/static/css/wfrp4e.css b/static/css/wfrp4e.css index 0560f8354..a2935dee4 100644 --- a/static/css/wfrp4e.css +++ b/static/css/wfrp4e.css @@ -14803,6 +14803,7 @@ button.capture-position { .aoe-template, .condition-chat, +.property-chat, .chat-roll, .table-click, .travel-click, From 1dbb7d6a41500bcdf50f8ce69ca865e640668ccb Mon Sep 17 00:00:00 2001 From: Forien Date: Wed, 13 Dec 2023 22:08:39 +0100 Subject: [PATCH 4/4] Show ammunition's location in the ammo select dropdown menu (#1838) * added container name to ammo selection * remove debugs --- modules/actor/sheet/actor-sheet.js | 6 ++++++ modules/actor/sheet/character-sheet.js | 2 +- static/templates/actors/actor-combat.hbs | 2 +- static/templates/actors/vehicle/vehicle-main.hbs | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/actor/sheet/actor-sheet.js b/modules/actor/sheet/actor-sheet.js index b8262edd1..c946947e1 100644 --- a/modules/actor/sheet/actor-sheet.js +++ b/modules/actor/sheet/actor-sheet.js @@ -311,6 +311,12 @@ export default class ActorSheetWfrp4e extends ActorSheet { inContainers = this._filterItemCategory(money, inContainers) inContainers = this._filterItemCategory(containers, inContainers) + // Add names of containers to item.location object. Used for ammo selection + inContainers.forEach(i => { + const container = this.actor.getItemTypes("container").find(c => c.id === i.location.value); + i.location.name = container.name || false; + }); + misc.totalShieldDamage = categories["weapons"].items.reduce((prev, current) => prev += current.damageToItem.shield, 0) money.total = money.items.reduce((prev, current) => { return prev + (current.coinValue.value * current.quantity.value) }, 0) diff --git a/modules/actor/sheet/character-sheet.js b/modules/actor/sheet/character-sheet.js index e363d9270..2b4a71b96 100644 --- a/modules/actor/sheet/character-sheet.js +++ b/modules/actor/sheet/character-sheet.js @@ -44,7 +44,7 @@ export default class ActorSheetWfrp4eCharacter extends ActorSheetWfrp4e { async getData() { const sheetData = await super.getData(); - this.addCharacterData(sheetData) + this.addCharacterData(sheetData); return sheetData; } diff --git a/static/templates/actors/actor-combat.hbs b/static/templates/actors/actor-combat.hbs index 7d14b3f24..458949120 100644 --- a/static/templates/actors/actor-combat.hbs +++ b/static/templates/actors/actor-combat.hbs @@ -128,7 +128,7 @@ {{#select item.currentAmmo.value}} {{#each item.ammoList as |ammo a|}} - + {{/each}} {{/select}} diff --git a/static/templates/actors/vehicle/vehicle-main.hbs b/static/templates/actors/vehicle/vehicle-main.hbs index 60a51ec59..e357083c2 100644 --- a/static/templates/actors/vehicle/vehicle-main.hbs +++ b/static/templates/actors/vehicle/vehicle-main.hbs @@ -207,7 +207,7 @@ {{#select item.currentAmmo.value}} {{#each item.ammoList as |ammo a|}} - + {{/each}} {{/select}}