AdiAddons / LibSpellbook-1.0

WoW addon library: tracks the spellbook to parry to IsSpellKnown discrepancies.
0 stars 2 forks source link

Battle for Azeroth #6

Closed Rainrider closed 5 years ago

Rainrider commented 6 years ago

Azerite traits

Event independent code:

local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem()
if (not azeriteItemLocation) then return end

local azeritePowerLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation)
local specID = GetSpecializationInfo(GetSpecialization())

for slot = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED - 1 do -- exclude tabard
    local item = Item:CreateFromEquipmentSlot(slot)
    if (not item:IsItemEmpty()) then
        local itemLocation = item:GetItemLocation()
        if (C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLocation)) then
            local tierInfo = C_AzeriteEmpoweredItem.GetAllTierInfo(itemLocation)
            for tier, info in next, tierInfo do
                if (info.unlockLevel <= azeritePowerLevel) then
                    for _, powerID in next, info.azeritePowerIDs do
                        local powerInfo = C_AzeriteEmpoweredItem.GetPowerInfo(itemLocation, powerID)
                        if (powerInfo.selected and C_AzeriteEmpoweredItem.IsPowerAvailableForSpec(powerID, specID)) then
                            print('Azerite power:', powerID, powerInfo.spellID)
                        end
                    end
                end
            end
        end
    end
end