Skip to content
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

Implement programmatic ActionID level filtering for pickers #8

Merged
merged 10 commits into from
Feb 2, 2024

Conversation

kayla-glick
Copy link
Collaborator

No description provided.

Comment on lines 1304 to 1327
getMatchingSpellActionId(src: number[][]): ActionId | null {
const match = src.find(([_, minLevel, maxLevel]) =>
(!minLevel || minLevel <= this.getLevel()) &&
(!maxLevel || maxLevel >= this.getLevel())
)

console.log(this.getLevel(), match)

if (match) return ActionId.fromSpellId(match[0])
return null
}

// Filter a matrix of item IDs, min and max levels for a matching item ID
getMatchingItemActionId(src: number[][]): ActionId | null {
const match = src.find(([_, minLevel, maxLevel]) =>
(!minLevel || minLevel <= this.getLevel()) &&
(!maxLevel || maxLevel >= this.getLevel())
)

console.log(this.getLevel(), match)

if (match) return ActionId.fromItemId(match[0])
return null
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions take in a matrix of up to 3-length arrays representing the item ID, a minimum level to display the buff, and a maximum level to display the buff (if applicable) and finds the correct entry corresponding to the player's current level and returns the ActionID from that entry.

Comment on lines 31 to 39
actionId: (player) => player.getMatchingSpellActionId([
[1126, 1, 9],
[5232, 10, 19],
[6756, 20, 29],
[5234, 30, 39],
[8907, 40, 49],
[9884, 50, 59],
[9885, 60]
]), impId: ActionId.fromSpellId(17055), fieldName: 'giftOfTheWild'}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some examples of how this is used to conditionally display the correct buff ranks

Comment on lines 84 to 89
const fillActionid = () => this.config.actionId(this.modObject)?.fillAndSet(this.rootAnchor, true, true);
this.config.changedEvent(this.modObject).on(() => {
console.log('good')
fillActionid()
})
fillActionid()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We change this to a function so that we can key off of the changedEvent to update Action IDs each time

@kayla-glick kayla-glick changed the title Working on UI buff levels Implement programmatic ActionID level filtering for pickers Feb 2, 2024
@kayla-glick kayla-glick marked this pull request as ready for review February 2, 2024 17:38
@kayla-glick kayla-glick merged commit fde8927 into master Feb 2, 2024
1 check passed
@kayla-glick kayla-glick deleted the buff-debuff-consumes-levels branch February 2, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant