advancement consumption

Cccjmk4/7/2022
now that I brought that up on #progress-reports @Calego (ElfFriend) , 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
Ccalego4/7/2022
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.
Ccalego4/7/2022
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)
LTLLLeo The League Lion4/7/2022
@Calego (ElfFriend) gave :vote: LeaguePoints™ to @arbron (#70 • 25)
Cccjmk4/7/2022
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
Ccalego4/7/2022
It happens when a levelup happens or when a new item with advancements is added right.
Cccjmk4/7/2022
fo real though, he's been killing it for 1.6x / 1.7.x
Ccalego4/7/2022
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
Cccjmk4/7/2022
yeeeeah.. I don't even have an actor by the time I need to munch them
Ccalego4/7/2022
AHHH
Ccalego4/7/2022
You mean for creation creation
Cccjmk4/7/2022
yup
Cccjmk4/7/2022
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 🕶️
LTLLLeo The League Lion4/7/2022
Package: hero-creation-tool
Ccalego4/7/2022
yeah I remember now
Ccalego4/7/2022
Mmm that's trickier
Ccalego4/7/2022
How do you populate class selection today?
Ccalego4/7/2022
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.
Cccjmk4/7/2022
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}
Cccjmk4/7/2022
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
Ccalego4/7/2022
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
Cccjmk4/7/2022
Cccjmk4/7/2022
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 :/
Aarbron4/7/2022
Since each advancement type renders its own UI within the larger advancement interface, you could just render this components within your own interface
Aarbron4/7/2022
Then use the advancement's apply methods yourself to make changes to the actor your building
Cccjmk4/7/2022
but there's no actor when I show that UI yet
Cccjmk4/7/2022
hmm
Cccjmk4/7/2022
i could make make a synthetic actor and save it on "creation"..
Aarbron4/7/2022
Yeah, that's what we are doing with the advancement process
Aarbron4/7/2022
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
Ccalego4/7/2022
The advancement data on the class item has a list of item uuids that you can use however you desire
Ccalego4/7/2022
I would use that to power the thing you screenshotted
Ccalego4/7/2022
Ultimately you'll do less guessing on your end and simply trust that the class item is configured with advancements correctly
Cccjmk4/7/2022
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)
Cccjmk4/7/2022
yeah that's a huge boon for me
Ccalego4/7/2022
I probably wouldn't need around with rendering the advancement manager for your use case
Cccjmk4/7/2022
just show them as I am now ?
Cccjmk4/7/2022
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 ?
Cccjmk4/7/2022
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
Cccjmk4/7/2022
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
Ccalego4/7/2022
Mmm, yeah that's true it would be smart to populate the advancement choices in the same way, otherwise stuff might get wierd
Ccalego4/7/2022
Is HCT creating the actor with all of the things they choose, or creating the actor, then modifying it?
Cccjmk4/7/2022
creating it with everything
Cccjmk4/7/2022
NOW
Cccjmk4/7/2022
if I need to change that to better fix advancements, so it be
Ccalego4/7/2022
your UX is a lot cleaner and more intuitive how you have it now
Cccjmk4/7/2022
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?
Ccalego4/7/2022
It does yeah, in theory at least
Ccalego4/7/2022
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
Cccjmk4/7/2022
so yea, I could make a synth when user opens the tool, and maybe toy with it as you advance, persist it on Create
Ccalego4/7/2022
that's an interesting idea
Cccjmk4/7/2022
for creating a syn I need to send temporary: true to the Document.create right ? like

Actor.create(actorData, {temporary: true})
Cccjmk4/7/2022
I will probably start by that, refactoring this to create an actor on popup, and persist that once, then I can play with Advancements 😆