Cantrip Charges 🧵

Cantrip Charges 🧵
39 Replies
Ethaks
EthaksOP•2y ago
@manaflower Just to check, as I've not followed the charges MR that closely: item.system.uses.autoDeductChargesCost should be "0" for cantrips, and persisted in their data, right?
Mana
Mana•2y ago
Yes. With added t
Ethaks
EthaksOP•2y ago
And having the data filled in via template is not necessary, since the default charge formula uses that value when available, but provides the usual default of "1"
Mana
Mana•2y ago
Yeah. It could be just empty string in the template.json I didn't add it there simply because filling the data in was unnecessary.
Ethaks
EthaksOP•2y ago
Yeah, I'd be fine with not adding it to the template to avoid unnecessary bloat
Mana
Mana•2y ago
It gets added to the items tho because the input field is in the sheets, but it avoids the initial entry at least.
Ethaks
EthaksOP•2y ago
Might be interesting to prevent such default values from being added, but I'm not sure I'm worried enough about this to tack it onto this milestone 😄
Mana
Mana•2y ago
It's better to edit the compendium entries and leave it at that.
Ethaks
EthaksOP•2y ago
I just checked the pack extraction, and the field is removed because it's not part of the template. Instead of adding it there however, I opted to except the field from pruning for now. As long as it's not unnecessarily added to other spells through migrations or sheet actions, that should work. Can't say I'm totally happy with this though.
Mana
Mana•2y ago
They shouldn't. Unless there's old data, which should be equivalent with the "0" formula. The migrations currently also clean away that old data, so it shouldn't linger.
Ethaks
EthaksOP•2y ago
Aye, that was mostly speaking about future slip-ups. Right now, everything looks 👌 @manaflower Thanks for the script and the MR btw!
Leo The League Lion
Leo The League Lion•2y ago
@ethaks gave vote LeaguePoints™ to @manaflower (#15 • 201)
Mana
Mana•2y ago
No problem. The cantrip issue has been an annoyance for me for a long time now, so I kinda had to.
Ethaks
EthaksOP•2y ago
Not sure whether I broke something, but when I run the migration from your MR on the compendium contents, the check
defaultAction?.uses.autoDeductCharges === true
defaultAction?.uses.autoDeductCharges === true
fails because that field is "" Oh, wait, might've been the wrong field. Let me check again 😄
Mana
Mana•2y ago
If that field is empty string, it's just corrupt data at that point. And it matching or not doesn't matter much at that point.
Ethaks
EthaksOP•2y ago
Yeah, misread the name Anyways, for the spell Scoop (level 0/Cantrip; random example, same for all cantrips), the field item.system.actions[0].uses.autoDeductCharges does not exist in the current pack data, so
updateData["system.uses.autoDeductChargesCost"] = "0";
updateData["system.uses.autoDeductChargesCost"] = "0";
is never added. From a quick glance, it looks like that action data field is deleted in _migrateItemActionChargesCost, and that migration was already applied
Mana
Mana•2y ago
Yeah, it matters mostly for people with such data still in their world in actors, tokens or items directory.
Ethaks
EthaksOP•2y ago
After reverting the previous migration and re-running the current one, I get
action.uses = {
autoDeductCharges: true,
autoDeductChargesCost: "1"
}
action.uses = {
autoDeductCharges: true,
autoDeductChargesCost: "1"
}
and
item.uses = {
per: "",
autoDeductCharges: "0"
}
item.uses = {
per: "",
autoDeductCharges: "0"
}
for a cantrip. Does that look right?
Mana
Mana•2y ago
The boolean should be gone. It is no longer used for anything. And the action autodeductchargescost should be empty string by default for everything, even after migration. It being "1" is especially wrong for cantrips.
Ethaks
EthaksOP•2y ago
Hmm, in that case it looks like the current migration, when applied to pack data as it was before the spell cost MR, produces unwanted results
Mana
Mana•2y ago
The migration doesn't set it to "1" ever, it only changes it to empty string. With that data actually, it should be deleting the boolean and setting the "1" to "" It's like the migration isn't happening as such? At least not fully I honestly don't see a reason for the migration to be failing.
Ethaks
EthaksOP•2y ago
Ah, I think I see the issue Changes to updateData["system.actions"] in the item migration are ignored in favour of specialised migrations from migrateItemActionData IIRC
Mana
Mana•2y ago
Oh, yeah, that will trash the action update. But that means some other action updates are being trashed by it also.
Ethaks
EthaksOP•2y ago
That I can check when done with this issue 😫 So, after running migrations, I now get action.uses.autoDeductChargesCost: "" and item.uses.autoDeducChargesCost: "0" for a cantrip No autoDeductCharges boolean in the action, no autoDeductCharges in the item Does that finally look right? 😄
Mana
Mana•2y ago
Yep. All other autodeduchargecost formulas should be empty strings in the included compendiums (with the actions they provide, maybe someday in the future they'll have more variety).
Ethaks
EthaksOP•2y ago
Hmm, some non-cantrip spells seem to have item.system.uses.autoDeductChargesCost: "0", too
Mana
Mana•2y ago
That should happen only if they had autoDeductCharges set to false, or it's some lingering old bad data?
Ethaks
EthaksOP•2y ago
Looks like some spells did indeed have preparation.autoDeductCharges: false
Mana
Mana•2y ago
That will cause some annoyances for users who have those spells, but there's no good solution to fix it for them (automatically).
Mana
Mana•2y ago
Yep, that's just bad data.
Ethaks
EthaksOP•2y ago
Well, it's also an issue for the system, as the compendium provides spells with bad data right now, right?
Mana
Mana•2y ago
The compendium needs to be fixed, yes. But the migration can't fix the spells for users who've already added them to actors or the like, as that fix might break them more. Mostly due to homebrew or something.
Ethaks
EthaksOP•2y ago
Yeah, for spells in worlds it's too late to automatically fix them Since my brain's already fried: Is it safe to delete item.system.uses.autoDeductChargesCost for non-level-0 spells?
Mana
Mana•2y ago
For the bundled spells, yes.
Mana
Mana•2y ago
That might be undoing some compendium updates. Looks good for the cantrip, but range.value is changing in some places back to number.
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Mana
Mana•2y ago
It stopped being an issue only because autoDeductCharges handling broke completely.
Want results from more Discord servers?
Add your server