advancement consumption

now that I brought that up on #progress-reports @calego , could I maybe pester you later for some advice regarding how to consume advancements? I think I would not be relying on the nifty hooks you have been working on cause unless I go completely overboard with the refactoring, I would be just using the advancements for reference on what to show on the Hero Creation ui
30 Replies
Calego
Calego3y ago
I expect you'll be interested in the "before our advancment selection flow begins" hook to cancel out of it and substitute your own. Otherwise, you're probably not going to want those hooks yeah. All advancment data is stored on the Items with advancments, but I believe there's a 'summary' of sorts on the actor itself? I'm not 100% and it is undergoing some refactors at the moment which @arbron knows more about, so imma ping him to pull in his expert opinion (thanks for all the legwork you're putting in btw jeff)
Leo The League Lion
@calego gave vote LeaguePoints™ to @arbron (#70 • 25)
ccjmk
ccjmk3y ago
but that hook still happens when the advancement is triggered, right ? before selecting stuff, sure, but you need an Actor getting an advcamentment at least
Calego
Calego3y ago
It happens when a levelup happens or when a new item with advancements is added right.
ccjmk
ccjmk3y ago
fo real though, he's been killing it for 1.6x / 1.7.x
Calego
Calego3y ago
we're apparently adding in a "level up button" on the actor sheet RAW before we release, so that might be something you'll need to worry about
ccjmk
ccjmk3y ago
yeeeeah.. I don't even have an actor by the time I need to munch them
Calego
Calego3y ago
AHHH You mean for creation creation
ccjmk
ccjmk3y ago
yup liiiiiiiiiiiterally creation 😛 I don't know how familiar you are with the module though, but its basically roll20's charactermancer, only.. sexier ofc cause i did it 🕶️
Leo The League Lion
Package: hero-creation-tool
Author: Alex, Dan, Andrew, Coco, Roy, Lyle, ccjmk
Hero Creation Tool for DnD5E
A step-by-step tool for creating player characters on DnD5e-based games
Info:
Version: 1.7.1 Core: 9 Changelog
Stats:
Installs: 1.94% Endorsements: 2 Comments: 1
Calego
Calego3y ago
yeah I remember now Mmm that's trickier How do you populate class selection today? I'd probably try something like "trawl the compendia for class items". When a class is selected, get that document in full from the compendium so you have all its advancement info.
ccjmk
ccjmk3y ago
there's a couple module settings where the user selects compendia where I will search for the Class items, and Features that I should try to link too classes. I expect those Features to have the ${className} ${lv} as requirement, those compendia get indexed when the tool's opened (to fast-fetch the requirement), and then I show whatever matches ${selectedClass} ${selectedLv} when you click & confirm "Create" all those indexed items get rehydrated into actual getDocument shenanigans, there might be some extra nuisance somewhere there, I remember I had some issues that ghost helped me deal with
Calego
Calego3y ago
Features that I should try to link too classes
tell me more... I would expect this part to be unecessary now that Users have a UI to add features to classes
ccjmk
ccjmk3y ago
No description
ccjmk
ccjmk3y ago
right now I'm already adding all those to the actor fresh outta the oven, I guess sure, I could just add the class with appropriate levels, and the hooks would ask the user to add everything? but it would be a little crappy UX-wise.. showing the user what features they will get is part of the "preview" handiness, and asking them later to "acccept them" again feels crappy :/
arbron
arbron3y ago
Since each advancement type renders its own UI within the larger advancement interface, you could just render this components within your own interface Then use the advancement's apply methods yourself to make changes to the actor your building
ccjmk
ccjmk3y ago
but there's no actor when I show that UI yet hmm i could make make a synthetic actor and save it on "creation"..
arbron
arbron3y ago
Yeah, that's what we are doing with the advancement process We clone the original actor, make all of the changes to it, and then copy them over to the original actor when you click complete
Calego
Calego3y ago
The advancement data on the class item has a list of item uuids that you can use however you desire I would use that to power the thing you screenshotted Ultimately you'll do less guessing on your end and simply trust that the class item is configured with advancements correctly
ccjmk
ccjmk3y ago
ok, I don't recall how to make a synthetic actor but I can search for that, what I have no clue on is how will I render the advancement component. (i am finishing work soon so I'll be able to play with this some more) yeah that's a huge boon for me
Calego
Calego3y ago
I probably wouldn't need around with rendering the advancement manager for your use case
ccjmk
ccjmk3y ago
just show them as I am now ? it does make sense to hook onto advancements on a more clever way I think.. because for example, I understand we could remove or modify stuff on the actor on an advancement right ? so I would expect to for example, process all advancements from lv1-to-5 if the user selects say a Bard 5, and been able to show "ok, your whatever dice will be like this at that level" and so on so forth but maybe it's better to just use the basic advancements, and then maybe run the rest when the actor is created, else things might get muddy fast
Calego
Calego3y ago
Mmm, yeah that's true it would be smart to populate the advancement choices in the same way, otherwise stuff might get wierd Is HCT creating the actor with all of the things they choose, or creating the actor, then modifying it?
ccjmk
ccjmk3y ago
creating it with everything NOW if I need to change that to better fix advancements, so it be
Calego
Calego3y ago
your UX is a lot cleaner and more intuitive how you have it now
ccjmk
ccjmk3y ago
my concern originally was not doing a bunch of updates, but I was not fully aware of synthetic objects before, and I understand that would solve the issue the same way, right?
Calego
Calego3y ago
It does yeah, in theory at least you for sure make less DB calls, but you have to work around some things and the final call is really like 3-4 calls
ccjmk
ccjmk3y ago
so yea, I could make a synth when user opens the tool, and maybe toy with it as you advance, persist it on Create
Calego
Calego3y ago
that's an interesting idea
ccjmk
ccjmk3y ago
for creating a syn I need to send temporary: true to the Document.create right ? like
Actor.create(actorData, {temporary: true})
Actor.create(actorData, {temporary: true})
I will probably start by that, refactoring this to create an actor on popup, and persist that once, then I can play with Advancements 😆