From aca53785bbd82ca079caa3ccf441e6bebade267e Mon Sep 17 00:00:00 2001 From: Alex Okafor <45021773+AlexOkafor@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:51:08 -0400 Subject: [PATCH 1/5] fix: update gitignore --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e7fd16fc..3d75f4e5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,10 @@ foundry.js foundry_07.js # OS -.DS_Store \ No newline at end of file +.DS_Store +packs/ship-sheet-instructions/CURRENT +.gitignore +packs/ship-sheet-instructions/LOG +packs/ship-sheet-instructions/LOCK +packs/ship-sheet-instructions/000003.log +packs/ship-sheet-instructions/MANIFEST-000002 From c302c503899128baeba10195f6229499ec96d09e Mon Sep 17 00:00:00 2001 From: Alex Okafor <45021773+AlexOkafor@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:53:19 -0400 Subject: [PATCH 2/5] fix: errors when doing standard rolls in v11 --- module/coriolis-roll.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/module/coriolis-roll.js b/module/coriolis-roll.js index 05781173..fea7f34a 100644 --- a/module/coriolis-roll.js +++ b/module/coriolis-roll.js @@ -189,7 +189,7 @@ export async function coriolisRoll(chatOptions, rollData) { await roll.evaluate({ async: false }); await showDiceSoNice(roll, chatOptions.rollMode); const result = evaluateCoriolisRoll(rollData, roll); - await showChatMessage(chatOptions, result); + await showChatMessage(chatOptions, result, roll); } /** @@ -295,7 +295,7 @@ export function evaluateCoriolisRoll(rollData, roll) { criticalSuccess: successes >= 3, failure: isDesparation ? successes < 2 : successes === 0, rollData: rollData, - roll: roll, + // roll: roll, pushed: rollData.pushed, }; @@ -326,10 +326,10 @@ function getTotalDice(rollData) { return 0; } -async function showChatMessage(chatMsgOptions, resultData) { +async function showChatMessage(chatMsgOptions, resultData, roll) { let tooltip = await renderTemplate( "systems/yzecoriolis/templates/sidebar/dice-results.html", - getTooltipData(resultData) + getTooltipData(resultData, roll) ); let chatData = { title: getRollTitle(resultData.rollData), @@ -366,7 +366,7 @@ async function showChatMessage(chatMsgOptions, resultData) { else if (chatMsgOptions.rollMode === "selfroll") chatMsgOptions["whisper"] = [game.user]; - chatMsgOptions.roll = resultData.roll; + chatMsgOptions.roll = roll; const html = await renderTemplate(chatMsgOptions.template, chatData); chatMsgOptions["content"] = html; const msg = await ChatMessage.create(chatMsgOptions, false); @@ -434,13 +434,13 @@ function getRollIconKey(rollData) { return icon ? CONFIG.YZECORIOLIS.icons[icon] : ""; } -function getTooltipData(results) { +function getTooltipData(results, roll) { const rollData = { - formula: results.roll.formula, + formula: roll.formula, total: results.successes, }; // Prepare dice parts - rollData["parts"] = results.roll.dice.map((d) => { + rollData["parts"] = roll.dice.map((d) => { let maxRoll = CONFIG.YZECORIOLIS.maxRoll; // Generate tooltip data return { From 4c9384dd0653dc355773b5aeb91e9c5c138fdfad Mon Sep 17 00:00:00 2001 From: Alex Okafor <45021773+AlexOkafor@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:05:11 -0400 Subject: [PATCH 3/5] ci: amend gitignore --- .gitignore | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 3d75f4e5..79f9dcb5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,11 +9,10 @@ module/foundry.js foundry.js foundry_07.js +# foundry +packs/ship-sheet-instructions/ + # OS .DS_Store -packs/ship-sheet-instructions/CURRENT .gitignore -packs/ship-sheet-instructions/LOG -packs/ship-sheet-instructions/LOCK -packs/ship-sheet-instructions/000003.log -packs/ship-sheet-instructions/MANIFEST-000002 + From 8576f7e3f152ffb0179340265fc3a770ff66f63e Mon Sep 17 00:00:00 2001 From: Alex Okafor <45021773+AlexOkafor@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:07:45 -0400 Subject: [PATCH 4/5] fix: pushing rolls as GM or a player previously, when the custom flag was set on a chat message it was also serializing the Roll object. I wasn't able to hunt down the specifics, but it seemed to be an issue with the doc updater trying to change a value on a roll via sync when the value is only a getter in v11. Rather than send the Roll object entirely, I instead pull the roll object out and just pass it in as a parameter as needed in the roll functions. Then the results data has coriolis specific data that can serialize properly across the wire. --- module/coriolis-roll.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/module/coriolis-roll.js b/module/coriolis-roll.js index fea7f34a..9068a7d9 100644 --- a/module/coriolis-roll.js +++ b/module/coriolis-roll.js @@ -227,7 +227,7 @@ export async function coriolisPushRoll(chatMessage, origRollData, origRoll) { await showDiceSoNice(origRoll, chatMessage.rollMode); const result = evaluateCoriolisRoll(origRollData, origRoll); - await updateChatMessage(chatMessage, result, bonus); + await updateChatMessage(chatMessage, result, bonus, origRoll); if (origRollData.actorType === "npc") { await spendDarknessPoints(1); } else { @@ -295,7 +295,6 @@ export function evaluateCoriolisRoll(rollData, roll) { criticalSuccess: successes >= 3, failure: isDesparation ? successes < 2 : successes === 0, rollData: rollData, - // roll: roll, pushed: rollData.pushed, }; @@ -375,10 +374,15 @@ async function showChatMessage(chatMsgOptions, resultData, roll) { return msg; } -async function updateChatMessage(chatMessage, resultData, prayerBonus) { +async function updateChatMessage( + chatMessage, + resultData, + prayerBonus, + origRoll +) { let tooltip = await renderTemplate( "systems/yzecoriolis/templates/sidebar/dice-results.html", - getTooltipData(resultData) + getTooltipData(resultData, origRoll) ); let chatData = { title: getRollTitle(resultData.rollData), @@ -553,7 +557,8 @@ export async function coriolisChatListeners(html) { messageId = button.parents(".message").attr("data-message-id"), message = game.messages.get(messageId); let results = message.getFlag("yzecoriolis", "results"); - coriolisPushRoll(message, results.rollData, message.roll); + let originalRoll = message.rolls[0]; // TODO: handle this in a safer manner. + coriolisPushRoll(message, results.rollData, originalRoll); }); } /** From 2eb57a672145412b92b0a53272faac6694232d3e Mon Sep 17 00:00:00 2001 From: Alex Okafor <45021773+AlexOkafor@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:09:15 -0400 Subject: [PATCH 5/5] feat: updated compatibility for Foundry v11 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index acb45725..af469273 100644 --- a/system.json +++ b/system.json @@ -2,10 +2,10 @@ "name": "yzecoriolis", "title": "Coriolis", "description": "Coriolis System for Foundry VTT.", - "version": "3.3.1", + "version": "3.4.0", "compatibility": { "minimum": "10", - "verified": "10" + "verified": "11" }, "templateVersion": 2, "authors": [