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

fix: properly check for known spells in InUsableSpell() #811

Merged
merged 2 commits into from Jan 20, 2021

Conversation

johnnylam88
Copy link
Contributor

Revert 86439eb and fix the
underlying problem in a different way. That commit used the WoW
IsUsableSpell() API function to determine whether a spell is known,
but that returns false if the spell is genuinely not usable due to
either cooldown or power requirements. Fix this in a better way by
teaching SpellBook.ts:IsKnownSpell() to check for a spell being
known to the player even if it's not in the spellbook by using the
WoW IsSpellKnown() API function.

While here, adjust IsUsableSpell() so that there is only a single
exit point from the function to make the profiler stats work
correctly.

Revert 86439eb and fix the
underlying problem in a different way. That commit used the WoW
IsUsableSpell() API function to determine whether a spell is known,
but that returns false if the spell is genuinely not usable due to
either cooldown or power requirements. Fix this in a better way by
teaching SpellBook.ts:IsKnownSpell() to check for a spell being
known to the player even if it's not in the spellbook by using the
WoW IsSpellKnown() API function.

While here, adjust IsUsableSpell() so that there is only a single
exit point from the function to make the profiler stats work
correctly.
src/states/Spells.ts Outdated Show resolved Hide resolved
The WoW API function IsUsableSpell() can just directly take a spell
ID as a valid parameter now, so remove the special lookup of a
spell by (index, bookType) or by name.
@Sidoine Sidoine merged commit 305c5bf into Sidoine:master Jan 20, 2021
@johnnylam88 johnnylam88 deleted the fix/is-usable-spell branch January 20, 2021 18:41
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.

None yet

2 participants