A repository for a FoundryVTT plugin for Kingmaker homebrew.

Fixing some issues with the localization and how it would show up in the sheet, and also adding the results localization/enrichment to the sheet

+44 -4
+2 -2
public/lang/en.json
··· 417 417 "msg": "@{gainLose gainLose=gain amount=1 amountType=value resource=krp label=\"Gain 1 KRP\"}" 418 418 }, 419 419 { 420 - "msg": "@{gainLose gainLose=gain amount=1 amountType=value resource=krp label=\"Gain 1 KRP\"}, and @{gainLose gainLose=gain amount=1 amountType=value-next-turn resource=krp label=\"Gain 1 KRP Next Turn\"}. @{gainLose gainLose=gain amount=2 amountType=value resource=resource-dice-rolled label=\"Gain 2 Rolled Resource Dice\"}" 420 + "msg": "@{gainLose gainLose=gain amount=1 amountType=value resource=krp label=\"Gain 1 KRP\"}, and @{gainLose gainLose=gain amount=1 amountType=valueNextTurn resource=krp label=\"Gain 1 KRP Next Turn\"}. @{gainLose gainLose=gain amount=2 amountType=value resource=resourceDiceRolled label=\"Gain 2 Rolled Resource Dice\"}" 421 421 } 422 422 ] 423 423 }, ··· 573 573 "msg": "You gain no Commodities." 574 574 }, 575 575 { 576 - "msg": "You gain 1 Commodity of the chosen type.\n\n* @{gainLose gainLose=gain amount=1 amountType=value resource=food label=\"Gain 1 Food\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=ore label=\"Gain 1 Ore\"}\b* @{gainLose gainLose=gain amount=1 amountType=value resource=lumber label=\"Gain 1 Lumber\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=stone label=\"Gain 1 Stone\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=luxuries>Gain 1 Luxury\"}" 576 + "msg": "You gain 1 Commodity of the chosen type.\n\n* @{gainLose gainLose=gain amount=1 amountType=value resource=food label=\"Gain 1 Food\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=ore label=\"Gain 1 Ore\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=lumber label=\"Gain 1 Lumber\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=stone label=\"Gain 1 Stone\"}\n* @{gainLose gainLose=gain amount=1 amountType=value resource=luxuries label=\"Gain 1 Luxury\"}" 577 577 }, 578 578 { 579 579 "msg": "You gain 2 Commodities of the chosen type.\n\n* @{gainLose gainLose=gain amount=2 amountType=value resource=food label=\"Gain 2 Food\"}\n* @{gainLose gainLose=gain amount=2 amountType=value resource=ore label=\"Gain 2 Ore\"}\n* @{gainLose gainLose=gain amount=2 amountType=value resource=lumber label=\"Gain 2 Lumber\"}\n* @{gainLose gainLose=gain amount=2 amountType=value resource=stone label=\"Gain 2 Stone\"}\n* @{gainLose gainLose=gain amount=2 amountType=value resource=luxuries label=\"Gain 2 Luxuries\"}"
+42 -2
src/svelte/kingdom-desc.svelte
··· 23 23 if (!container) return; 24 24 25 25 const descEl = container.querySelector(".kmhb-desc"); 26 + const cfEl = container.querySelector(".kmhb-cf"); 27 + const fEl = container.querySelector(".kmhb-f"); 28 + const sEl = container.querySelector(".kmhb-s"); 29 + const csEl = container.querySelector(".kmhb-cs"); 26 30 27 - if (descEl !== null) { 28 - enrichAndLocalize(true, "activities", activityData.id, "description").then((desc: string): void => { 31 + if ((descEl !== null) && (cfEl !== null) && (fEl !== null) && (sEl !== null) && (csEl !== null)) { 32 + enrichAndLocalize(true, "activities", activityData.id, "description").then((desc: string): Promise<string> => { 29 33 (descEl as HTMLElement).innerHTML = desc; 34 + 35 + return enrichAndLocalize(true, "activities", activityData.id, "results", "0", "msg"); 36 + }).then((cf: string): Promise<string> => { 37 + (cfEl as HTMLElement).innerHTML = cf; 38 + const child = cfEl.firstChild; 39 + 40 + if (child !== null) { 41 + (child as HTMLElement).innerHTML = (game as foundry.Game).i18n!.localize("PF2E.CritFailure") + " " + (child as HTMLElement).innerHTML; 42 + } 43 + 44 + return enrichAndLocalize(true, "activities", activityData.id, "results", "1", "msg"); 45 + }).then((f: string): Promise<string> => { 46 + (fEl as HTMLElement).innerHTML = f; 47 + const child = fEl.firstChild; 48 + 49 + if (child !== null) { 50 + (child as HTMLElement).innerHTML = (game as foundry.Game).i18n!.localize("PF2E.Failure") + " " + (child as HTMLElement).innerHTML; 51 + } 52 + 53 + return enrichAndLocalize(true, "activities", activityData.id, "results", "2", "msg"); 54 + }).then((s: string): Promise<string> => { 55 + (sEl as HTMLElement).innerHTML = s; 56 + const child = sEl.firstChild; 57 + 58 + if (child !== null) { 59 + (child as HTMLElement).innerHTML = (game as foundry.Game).i18n!.localize("PF2E.Success") + " " + (child as HTMLElement).innerHTML; 60 + } 61 + 62 + return enrichAndLocalize(true, "activities", activityData.id, "results", "3", "msg"); 63 + }).then((cs: string): void => { 64 + (csEl as HTMLElement).innerHTML = cs; 65 + const child = csEl.firstChild; 66 + 67 + if (child !== null) { 68 + (child as HTMLElement).innerHTML = (game as foundry.Game).i18n!.localize("PF2E.CritSuccess") + " " + (child as HTMLElement).innerHTML; 69 + } 30 70 }); 31 71 } 32 72 })