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

Abandoned #6

Open
Rainrider opened this issue May 21, 2018 · 0 comments
Open

Abandoned #6

Rainrider opened this issue May 21, 2018 · 0 comments

Comments

@Rainrider
Copy link
Member

Rainrider commented May 21, 2018

The dependency of AdiButtonAuras on LibDispellable-1.0 was removed in AdiAddons/AdiButtonAuras#281. The reasons for this are:

  • AdiButtonAuras' aura cache is more efficient than using the iterators of LD
  • it makes more sense to define dispels in LibPlayerSpells-1.0 rather then splitting it into two libraries
  • AdiButtonAuras uses LibSpellbook-1.0 to check for spells known by the player

Because of this, there are no more reasons for me to keep LD updated.

What is lost

The aura iterators of LD are not ported over to LPS as they don't make sense there. Thus there are no alternatives to:

  • LibDispellable:CanDispel
  • LibDispellable:CanDispelWith

You will also have to check by yourself if you know the dispelling spells.
The rest of LD's API is replaced by LPS as below.

Getting the list of dispels for a given class

local LPS = LibStub('LibPlayerSpells-1.0')
if not LPS then return end
local _, playerClass = UnitClass('player')
for spell, flags, _, _, _, dispelFlags in LPS:IterateSpells('DISPEL', playerClass) do
	-- your code
end
  • spell - number - is the spell id of the dispelling spell (in most case, see below)
  • flags - bitmask - can be used to query targeting information (see below)
  • dispelFlags can be used to get dispel types (see below)

Getting the targeting

Use bit.band with LPS.constants.PERSONAL, LPS.constants.HARMFUL and LPS.constants.HELPFUL to find out if it an offensive, defensive or self-dispel.

if bit.band(flags, LPS.constants.HARMFUL) > 0 then
	-- it is an offensive dispel like Shamans' "Purge" or Mages' "Stellsteal"
end

You can also use LPS.masks.TARGETING if you need to filter the targeting mask out of flags.

Getting the dispel type

Use bit.band with LPS.constants.CURSE, LPS.constants.DISEASE, LPS.constants.ENRAGE, LPS.constants.MAGIC, LPS.constants.POISON.

if bit.band(dispelFlags, LPS.constants.MAGIC) > 0 then
	-- it can dispel magic
end

Limitations

In almost all cases spell from above is the dispelling spell - the one you place on your action bars and cast. Due to spell mechanics and LPS semantincs, there are some exceptions:

  • "Feign Death" is a self-dispel when the honor talent "Survival Tactics" is known and active.
  • "Immolation Aura" is a self-dispel when the honor talent "Cleansed by Flame" is known and active.
    In those cases spell is the spell id of the honor talent.

Basically what LPS tells you is "if you know spell, then you can dispel what's in dispelFlags".

Higher abstraction API

If you'd prefer some higher abstraction API to somewhat mimic LibDispellable, feel free to open an issue for LibPlayerSpells-1.0.

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

No branches or pull requests

1 participant