-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raidboss: Support for objects in trigger outputStrings #5551
Conversation
@valarnin Thanks for your contribution! 🌵🚀 |
I think this is ready for general review now. I haven't tested the latest changes (ran out of time, I have another obligation in about 5 minutes), but the underlying code should be relatively complete. I ended up moving the |
resources/party.ts
Outdated
if (!partyMember) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me a little worried in the face of the OverlayPlugin bug. I think this function should never return undefined
. It should at least return what it can (name, shortName) and then elide other fields. And, ideally, if somebody asks for a property that doesn't exist, it should print a warning and pick ~some property rather than nothing. (Maybe shortName if that exists, and any key after that? Maybe these objects need a default: string
field in case somebody or some code asks for a non-existent property and we need to fall back on something?)
Doing this would also solve the TODO in the raidboss test.ts
where you don't get anything if you're not in a party.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of PRing the adjustments to OverlayPlugin as my next project, a general cleanup of the way the PartyChanged event works under the hood.
As for the other points in this comment, agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also wanted to add that there are some times where triggers might call out to "stack on (non-party member)" for things like hunts, and so in this case even if OP was 100% working for party members, we'd still want to have reasonable fallback behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final question (and maybe there's no good answer here) is what to do if somebody enters ${data.name} (${data.role})
(e.g. #5554) but role is unknown. I guess it would just say name twice? Do we need a separate nameAndRole
entry that could handle this? (Or maybe I am overthinking and this is overkill.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm holding off on this piece until I can look at the OP issue in general, but I think the fallback logic is fuzzy and I'm not 100% sure what would be the best behavior here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, what fallback should be used? Should job
/role
fall back to name
or shortName
, or just display ???
? If we're displaying something like ???
, should that be locale-'d e.g. Outputs.unknown
, and if so, passing current locale to this location is complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just fall back to shortName
always for all objects (and then pick any field after that if it doesn't exist?), but in a general sense where objects are not always players, that seems a little weird.
One thought is that the object should put a (required?) default
or fallback
field that specifies what value to be used if a user or code specifies a sub param that doesn't exist. Personally, I think shortName
is a reasonable choice to use for that value here. I think if there's always a valid fallback, then there's no need for ???
or locale plumbing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming back to this PR, I still think that this is the missing piece here that prevents me from landing this PR. I feel like there needs to be some story around "what happens if a sub param is specified that doesn't exist". I think in general, it would be better to show something reasonable rather than ???
regardless of the OP party bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is updated with the latest commit (also rebased to main
). Hopefully this makes sense and lines up with what you're looking for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, although I also needed to do e9fcc96 in order for the "no prop specified" case to work.
Extract the ShortName logic/functions to Util, clean up duplicate code Narrow the typedef for params objects Add helpers to get party member param object Add config option for default display label for players Clean up handling of param objects
Co-authored-by: Adrienne Walker <enne@quisquo.us>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@@ -42,6 +42,7 @@ export interface RaidbossData { | |||
CanCleanse: () => boolean; | |||
CanFeint: () => boolean; | |||
CanAddle: () => boolean; | |||
partyMemberParam: (name: string) => PartyMemberParamObject | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to avoid polluting data even more, what do you think about making this be a function on PartyTracker
since data.party
is already a thing? I'd be fine with data.party.member(name)
if you want to keep it brief.
I know this would require passing in nicknames and the default field as well, so maybe it's not ideal. Mostly curious if you think that's polluting party tracker with things it shouldn't know about or if that's cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only way I'd be okay with this would be to pass the whole RaidbossOptions
object in, rather than passing in individual values, and AFAIK that would cause issues with oopsy and jobs since their config options don't have that parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oopsy has a nicknames field. It could arguably grow the default field and so oopsy could say people's roles rather than names. jobs doesn't really have a need for either. So, maybe it could take an optional object that has nick name and default that both RaidbossOptions
and OopsyOptions
is shaped like. (Or an object with optional nick name and default?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies if I derailed this PR with these comments. Mostly I just am trying to be cautious about adding unnecessary things to data
since it's something shared with users. Happy to discuss more if you have time!
I'm guessing you're just very busy these days; please let me know if there's something I can do to help this along, as I'm still really excited about this change and being able to let users have more custom output for players.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've been very busy the last month or so, so I haven't had time to circle back around to this PR and figure out how to get things to pass through well.
I'm hoping to have time in the next week or two, but we'll see how work goes 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed this in c77169a
resources/party.ts
Outdated
id: '???', | ||
job: 'NONE', | ||
role: '???', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the fallbacks, do you think it would make sense to have all of these be optional other than the name/shortName. That way if somebody has a trigger that says ${player1.role}
and something has gone awry, they'll get player1's name instead of ???
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do a priority as well, sure. Some sort of const array at the top and then loop through until we find a value should work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was saying something different; there's only two states, either we know everything or we only know name. I'm suggesting to make all the fields but name/shortName optional and possibly undefined so that in the case where we only know name, we only need to fill in name and shortName. That way if somebody specifies a missing field (that would normally be filled in but maybe it's the OP bug so it's not) then instead of getting '???' or 'NONE' when that's not useful, they would at least get the name. In other words, only fill in real values and never use dummy values or said differently never add something to this object that you wouldn't want displayed in a trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed this in 5121b99
Closing. |
This is a preliminary PR to eventually allow more customization of outputStrings outputs by users. Eventually I'd like to see player names replaced with something like a player object with a default toString that returns player name, which could maybe be a helper on the
PartyTracker
object.I have simulated that extremely basically with the
data
object test trigger added intest.ts
. Users should be able to customize theoutputStrings
entry fortext
to print e.g.${data.role}
. I'm looking for feedback/thoughts on if this approach makes sense, or if this idea should be approached in a different way, before I fully flesh this out.I'm not super happy with the logic in
popup-text.ts
, feels like it could have benefited with a helper func or something rather than switch/casing over type in two separate spots like that, or maybe a recursive function?