Closed trioderegion closed 4 years ago
After digging a bit, it seems that when the sheet is rendered, the data-label and actual label text are simply missing:
<label for="data.stats.str.value" class="resource-label rollable" data-roll="1d20+2" data-label=""></label>
I think should be:
<label for="data.stats.str.value" class="resource-label rollable" data-roll="1d20+2" data-label="STR">STR</label>
When I edit this HTML on the fly, the STR label pops up and the sheet looks correct. That is, until I change the modifier and the sheet re-renders.
It is unfortunate to hear you're experiencing issues with ICRPG 1.0.1 in combination with FoundryVTT 0.6.6. I tried several clients (FoundryVTT, Microsoft Edge, Mozilla Firefox and Google Chrome) but could not reproduce the issue you're facing.
The labels get generated server-side using Handlebars. For character sheets, this looks like this:
{{#each data.stats as |stat id|}}
...
<label for="data.stats.{{id}}.value" class="resource-label rollable"
data-roll='1d20+{{stat.value}}'
data-label='{{localize (concat "ICRPG." (toUpperCase id))}}'>
{{localize (concat "ICRPG." (toUpperCase id))}}
</label>
...
{{/each}}
For NPC sheets, this looks slightly different and no each
was used to iterate over the stats, because of layout reasons as I wanted the stats in two columns next to each other. All six stats are simply written out in full there:
<label for="data.stats.str.value" class="resource-label rollable"
data-roll='1d20+{{data.stats.str.value}}'
data-label='{{localize "ICRPG.STR"}}'>{{localize "ICRPG.STR"}}</label>
So, it looks as if for some reason, your server-side execution is able to handle {{localize "ICRPG.STR"}}
but not Handlebars subexpressions like {{localize (concat "ICRPG." (toUpperCase id))}}
.
To test this a bit further, can you comment out the <label />
element around line 43 of templates/actor/npc-sheet.html
, and put some test code in, as shown below? Important to not do this "on-the-fly" in HTML as you'd be modifying client-side code, but this needs to be executed server-side, so you'll have to temporarily modify that file on disk.
{{id}}
{{toUpperCase id}}
{{concat "ICRPG." (toUpperCase id)}}
{{localize (concat "ICRPG." (toUpperCase id))}}
{{localize "ICRPG.STR"}}
{{!--
<label for="data.stats.{{id}}.value" class="resource-label rollable"
data-roll='1d20+{{stat.value}}'
data-label='{{localize (concat "ICRPG." (toUpperCase id))}}'>
{{localize (concat "ICRPG." (toUpperCase id))}}
</label>
--}}
When you Ctrl+F5
in FoundryVTT, this should result in:
Note that the last one will always just be STR, because we're just looking up the localization of "ICRPG.STR" every time.
So for STR:
str <-- the id of the stat
STR <-- the uppercase id
ICRPG.STR <-- the uppercase id prefixed (i.e. the localization key)
STR <-- this key localized in the language you're running, for English this becomes STR
STR <-- trying to look up localization for ICRPG.STR without subexpressions
Hopefully, we'll learn some more from these test results.
Thanks for the reply. I made the modifications to the character-sheet.html (not the npc-sheet), as your code snippets and screen shoots seem to be indicated the character.
Modifications are as follows:
<div class="resource stat {{id}}">
{{id}}
{{toUpperCase id}}
{{concat "ICRPG." (toUpperCase id)}}
{{localize (concat "ICRPG." (toUpperCase id))}}
{{localize "ICRPG.STR"}}
{{!--
<label for="data.stats.{{id}}.value" class="resource-label rollable"
data-roll='1d20+{{stat.value}}'
data-label='{{localize (concat "ICRPG." (toUpperCase id))}}'>
{{localize (concat "ICRPG." (toUpperCase id))}}
</label>
--}}
and the result definitely misses the subexpression concat of localization keys.
Hold up. I was running this test on the standalone client 0.6.6 (ICRPG 1.0.1 and then 1.0.2)
I just created a new world on my hosted server (0.6.6) with ICRPG (1.0.2) and everything is fine...
Edit: I normally use my hosted servers, so this works for me, but I am happy to help debug. I connected to my standalone client via a webbrowser and got the same erroneous result. It appears its bound tightly to the standalone client?
I actually tested this locally using the Windows version of FoundryVTT 0.6.6 which worked fine. I then used a bunch of different browsers to connect to it, and these tests all passed successfully.
What OS are you running? Maybe the FoundryVTT for your OS doesn't contain the same Handlebars version and doesn't support subexpressions, although I would find that unlikely actually.
Or maybe you have an add-on enabled that comes bundled with its own (lower) version of Handlebars, that doesn't support subexpressions yet, thereby replacing the one that comes with FoundryVTT or something? Maybe try disabling all add-ons (or creating a new world without any enabled) on your local "stand-alone" FoundryVTT and see if that solves the issue.
I am glad to hear that using a hosted server seems to solve the issue for you, at least partially. I will however close this issue, since nobody else seems to have this problem currently. I'm afraid that until more information or reproducible steps are available, there's very little I can do for now.
The offending module is Combat Utility Belt (CUB) 1.2.1. It is fully updated and while enabled, I get the issue as reported. When disabled, everything renders correctly.
https://github.com/death-save/combat-utility-belt
😩 sorry for wasting your time, but thank you.
@TomCosaert My concat
implementation is better... ;) lol jk
This is caused by us both adding a new concat method to the Handlebars helpers. I'll think about the best way to resolve this, but I suspect we should both namespace our concat methods to avoid this issue and future issues. I don't think it's fair to wash your hands of this issue, so I hope you'll be willing to consider what you can do to resolve it as well.
I think the best solution is that Atropos implements this: https://github.com/helpers/handlebars-helpers in core. I will open an issue on the Foundry tracker. https://gitlab.com/foundrynet/foundryvtt/-/issues/3533
Thanks for spotting the exact problem @eclarke12!
Indeed, adding handlebars-helpers
to FoundryVTT itself would be a great addition 👍 .
For the time being, I just released a new version in which I prefixed all my Handlebars helpers with icrpg-
to avoid any collisions.
Glad we got to the bottom of this one!
I will do the same in CUB. Invariably other well meaning devs will implement these helpers like we did!
Using foundry 0.6.6 and latest ICRPG. The labels STR/DEX/etc and Basic/Weapon/Magic/etc do not render, however, they are still clickable and will roll correctly. Attached is a comparison of two character sheets (created a new one in case I did it) and a partially working NPC sheet (just has the Stats labels, but not Effort labels)