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

Added support for ACTIVE_TALENT_GROUP_CHANGED #296

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions ItemRack/ItemRack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function ItemRack.IsCata()
return wowtoc > 40000 and wowtoc < 50000
end

function ItemRack.IsSod()
return wowtoc >= 11500 and wowtoc < 20000
end

-- [[ Season of Discovery Runes ]]
function ItemRack.IsEngravingActive()
return C_Engraving and C_Engraving.IsEngravingEnabled()
Expand Down Expand Up @@ -261,7 +265,8 @@ function ItemRack.InitEventHandlers()
handler.PLAYER_TALENT_UPDATE = ItemRack.UpdateClassSpecificStuff
handler.PLAYER_ENTERING_WORLD = ItemRack.OnEnterWorld
handler.PLAYER_LOGOUT = ItemRack.OnPlayerLogout
handler.ACTIVE_TALENT_GROUP_CHANGED = ItemRack.UpdateClassSpecificStuff
handler.ACTIVE_TALENT_GROUP_CHANGED = { ItemRack.UpdateClassSpecificStuff, ItemRack.OnActiveTalentGroupChanged }
--handler.ACTIVE_TALENT_GROUP_CHANGED = ItemRack.OnActiveTalentGroupChanged
-- handler.PET_BATTLE_OPENING_START = ItemRack.OnEnteringPetBattle
-- handler.PET_BATTLE_CLOSE = ItemRack.OnLeavingPetBattle
end
Expand All @@ -278,7 +283,14 @@ do
end

function ItemRack.OnEvent(self,event,...)
ItemRack.EventHandlers[event](self,event,...)
local handlers = ItemRack.EventHandlers[event];
if #(handlers) > 0 then
for _, handler in pairs(handlers) do
handler(self,event,...)
end
else
handlers[event](self,event,...)
end
end

--- Allows third-party addons to listen to ItemRack events, like saving and deleting a set.
Expand Down Expand Up @@ -359,6 +371,10 @@ function ItemRack.OnCastingStop(self,event,unit)
end
end

function ItemRack.OnActiveTalentGroupChanged()
ItemRack.StartTimer("ActiveTalentGroupChanged")
end

function ItemRack.OnItemLockChanged()
ItemRack.StartTimer("LocksChanged")
ItemRack.LocksHaveChanged = 1
Expand Down Expand Up @@ -562,6 +578,7 @@ function ItemRack.InitCore()
ItemRack.CreateTimer("TooltipUpdate",ItemRack.TooltipUpdate,1,1)
ItemRack.CreateTimer("CooldownUpdate",ItemRack.CooldownUpdate,1,1)
ItemRack.CreateTimer("LocksChanged",ItemRack.LocksChanged,.2)
ItemRack.CreateTimer("ActiveTalentGroupChanged", ItemRack.ActiveTalentGroupChanged, 1)
ItemRack.CreateTimer("DelayedCombatQueue",ItemRack.DelayedCombatQueue,.1)

for i=-2,11 do
Expand All @@ -587,6 +604,10 @@ function ItemRack.InitCore()
ItemRackFrame:RegisterEvent("PLAYER_TALENT_UPDATE")
ItemRackFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
end

if ItemRack.IsSod() then
ItemRackFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
end
-- ItemRackFrame:RegisterEvent("PET_BATTLE_OPENING_START")
-- ItemRackFrame:RegisterEvent("PET_BATTLE_CLOSE")
--if not disable_delayed_swaps then
Expand Down Expand Up @@ -946,6 +967,13 @@ function ItemRack.IsSoulbound(bag,slot)
end
end

function ItemRack.ActiveTalentGroupChanged()
print("ActiveTalentGroupChanged")
if #(ItemRack.SetsWaiting)>0 and not ItemRack.AnythingLocked() then
ItemRack.ProcessSetsWaiting()
end
end

-- function happens .2 seconds after last ITEM_LOCK_CHANGE
function ItemRack.LocksChanged()
ItemRack.UpdateButtonLocks()
Expand Down