diff --git a/src/module/feature/damageHandler/index.ts b/src/module/feature/damageHandler/index.ts index 6f7a14ffc..f03760ab8 100644 --- a/src/module/feature/damageHandler/index.ts +++ b/src/module/feature/damageHandler/index.ts @@ -25,7 +25,7 @@ export async function autoRollDamage(message: ChatMessagePF2e) { ["all", "gm"].includes(settings.autoRollDamageAllow), ) ) { - const pf2eFlags = message.flags.pf2e; + const pf2eFlags = message.flags.pf2e; const originUuid = pf2eFlags?.origin?.uuid; if (originUuid) { @@ -63,8 +63,7 @@ export async function autoRollDamage(message: ChatMessagePF2e) { const degreeOfSuccess = degreeOfSuccessWithRerollHandling(message); const isFailure = ["criticalFailure", "failure"].includes(degreeOfSuccess); const isSuccess = ["criticalSuccess", "success"].includes(degreeOfSuccess); - const context: any = pf2eFlags.context; - const isBasicSave = context?.options?.includes("item:defense:basic"); + const isBasicSave = pf2eFlags.context?.options?.includes("item:defense:basic"); const originMessage = await getLatestChatMessageWithOrigin(5, originUuid); const flags = originMessage?.flags; diff --git a/src/module/feature/qolHandler/handlePrivateSpellcasting.ts b/src/module/feature/qolHandler/handlePrivateSpellcasting.ts index bf5602ed8..b18129c95 100644 --- a/src/module/feature/qolHandler/handlePrivateSpellcasting.ts +++ b/src/module/feature/qolHandler/handlePrivateSpellcasting.ts @@ -73,8 +73,7 @@ async function generateMessageData(message: ChatMessagePF2e, origin, spellUUID: const type = message.flags?.pf2e.origin?.type ?? "spell"; const traditionString = message.flags?.pf2e.casting?.tradition ?? ""; - const context = message.flags.pf2e.context; - const isBasicSave = context?.options?.includes("item:defense:basic"); + const isBasicSave = message.flags.pf2e.context?.options?.includes("item:defense:basic"); const content = buildSpellMessage(origin, tokenName, type, traditionString, spellUUID, data, isBasicSave); const flags = { @@ -160,7 +159,15 @@ function isShiftModifierActive(): boolean { return game?.keyboard?.isModifierActive(KeyboardManager.MODIFIER_KEYS.SHIFT); } -function buildSpellMessage(origin, tokenName: string, type, traditionString: string, spellUUID: string, data, basic) { +function buildSpellMessage( + origin, + tokenName: string, + type, + traditionString: string, + spellUUID: string, + data, + isBasicSave, +) { let content = ""; if (origin) { content = game.i18n.localize( @@ -212,12 +219,12 @@ function buildSpellMessage(origin, tokenName: string, type, traditionString: str .map((trait: any) => game.pf2e.system.sluggify(trait.valueOf())) .sort() .join(","), - basic, + basic: isBasicSave ? "|basic:true" : "", }); } else { content += game.i18n.format(`${MODULENAME}.SETTINGS.castPrivateSpellWithPublicMessage.noButtonSavePart`, { dataSave: dataSave, - basic: basic + basic: isBasicSave ? game.i18n.localize(`${MODULENAME}.SETTINGS.castPrivateSpellWithPublicMessage.basic`) : "", }); diff --git a/static/lang/en.json b/static/lang/en.json index d46dbad70..f8a4a802b 100644 --- a/static/lang/en.json +++ b/static/lang/en.json @@ -388,7 +388,7 @@ "name": "Post public message that a spell has been cast.", "basic": "Basic", "noButtonSavePart": "
{basic} {dataSave} save", - "savePart": "
Save for the unknown spell is: @Check[type:{dataSave}|dc:{dataDC}|traits:{traits}|basic:{basic}}]", + "savePart": "
Save for the unknown spell is: @Check[type:{dataSave}|dc:{dataDC}|traits:{traits}{basic}}]", "secondPartNoRk": ".
You can try using one of @UUID[Compendium.pf2e.feats-srd.MjQyTcV8Jiv1Jtln] or @UUID[Compendium.pf2e.feats-srd.2rSyTfPgAmNAo01r] to recognize it. Or, on your turn, spend an action to try to identify it (ask your gm for details).", "secondPartRK": ".
You can try using one of @UUID[Compendium.pf2e.feats-srd.MjQyTcV8Jiv1Jtln] or @UUID[Compendium.pf2e.feats-srd.2rSyTfPgAmNAo01r] to recognize it. Or, on your turn, spend an action to try to identify it with @Check[type:{skill}|dc:{dcRK}|traits:secret,action:recall-knowledge] @UUID[Compendium.pf2e.actionspf2e.Item.1OagaWtBpVXExToo] (or 10 minutes with @Check[type:{skill}|dc:{dcRK}|traits:secret,action:identify-magic] @UUID[Compendium.pf2e.actionspf2e.Item.eReSHVEPCsdkSL4G] )", "spell": "Spell",