Cantrip Charges 🧵

Cantrip Charges 🧵
E
Ethaks495d 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?
M
Mana495d ago
Yes. With added t
E
Ethaks495d 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"
M
Mana495d 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.
E
Ethaks495d ago
Yeah, I'd be fine with not adding it to the template to avoid unnecessary bloat
M
Mana495d ago
It gets added to the items tho because the input field is in the sheets, but it avoids the initial entry at least.
E
Ethaks495d 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 😄
M
Mana495d ago
It's better to edit the compendium entries and leave it at that.
E
Ethaks495d 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.
M
Mana495d 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.
E
Ethaks495d ago
Aye, that was mostly speaking about future slip-ups. Right now, everything looks 👌 @manaflower Thanks for the script and the MR btw!
LTL
Leo The League Lion495d ago
@ethaks gave vote LeaguePoints™ to @manaflower (#15 • 201)
M
Mana495d ago
No problem. The cantrip issue has been an annoyance for me for a long time now, so I kinda had to.
E
Ethaks495d 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 😄
M
Mana495d 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.
E
Ethaks495d 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
M
Mana495d ago
Yeah, it matters mostly for people with such data still in their world in actors, tokens or items directory.
E
Ethaks495d 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?
M
Mana495d 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.
E
Ethaks495d 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
M
Mana495d 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.
E
Ethaks495d 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
M
Mana495d ago
Oh, yeah, that will trash the action update. But that means some other action updates are being trashed by it also.
E
Ethaks495d 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? 😄
M
Mana495d 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).
E
Ethaks495d ago
Hmm, some non-cantrip spells seem to have item.system.uses.autoDeductChargesCost: "0", too
M
Mana495d ago
That should happen only if they had autoDeductCharges set to false, or it's some lingering old bad data?
E
Ethaks495d ago
Looks like some spells did indeed have preparation.autoDeductCharges: false
M
Mana495d ago
That will cause some annoyances for users who have those spells, but there's no good solution to fix it for them (automatically).
M
Mana495d ago
Yep, that's just bad data.
E
Ethaks495d ago
Well, it's also an issue for the system, as the compendium provides spells with bad data right now, right?
M
Mana495d 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.
E
Ethaks495d 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?
M
Mana495d ago
For the bundled spells, yes.
E
Ethaks495d ago
M
Mana495d ago
That might be undoing some compendium updates. Looks good for the cantrip, but range.value is changing in some places back to number.
UU
Unknown User495d ago
M
Mana495d ago
It stopped being an issue only because autoDeductCharges handling broke completely.
Want results from more Discord servers?
Add your server
More Posts
Item piles gridRough draft of a grid-based inventory system thing - it can't swap positions of entries yetMathJSas a javascript dependencyGet most matched Classes`const intersection = yourArray.filter(item1 => yourOtherArray.some(item2 => item2 === item1))`Application and EventsDoes anyone know if Foundry's `Application` (or the browser itself) does anything magical to clean uPopOut!Just starting a thread here for some discussion of "PopOut!" module in relation to my UI library / TPackage jam judge signup threadPackage jam judge signup thread (free league points inside)git filter troubleshootingI'm troubleshooting a new setup that my code contributors can benefit from. I'm using a .gitconfig fmultiroll damage roll messagesMessing with multiroll chat message in v10❓About Commissions**Do not post commissions in this thread.** This thread is for discussing the commissions process, gIssue Submission ToolI'm looking for suggestions for free ticket submission without signing into GitHub that go beyond BuMM+, manifest+, attributions, and moreWe can make a thread to keep the MM+ discussion seperate if you'd likeGlitterSuppose someone wanted to make a module which created a stylistic ~~defect~~ enhancement that never Here s an example No template data inHere's an example. No template data in the actor object, but the object is associated with a templatRolling Hooks**Rolling Hooks!** I am working on a couple of additions to one of the upcoming version of 5e to addWeight MRSure.2.0.0 explorationFrom Atropos in the mothership (in v10 Feedback) > Hello folks, for those of you testing V10 using tElectron ViteIt loads at least.early v10 compat testing@dnd5e - No action required Work is being done on fixing the core system compatibility with v10 in module.json helpYou have no manifest or download fields.TyphonJS Runtime Library - RC 0.0.12The TyphonJS Runtime Library / TRL release candidate version 0.0.12 is now available. This is a mass