-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoulbindsTalentButton.lua
64 lines (47 loc) · 1.59 KB
/
soulbindsTalentButton.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-------------------------------------------------------------------------------
-- init
LoadAddOn("Blizzard_TalentUI")
LoadAddOn("Blizzard_Soulbinds")
if aura_env.button == nil then
local button = CreateFrame("Button")
local buttonScript = function()
if SoulbindViewer:IsVisible() then
SoulbindViewer.CloseButton:Click()
else
SoulbindViewer:Open()
end
end
button:RegisterForClicks("LeftButtonDown", "RightButtonDown")
button:SetScript("OnClick", buttonScript)
button:SetParent(aura_env.region)
button:SetAllPoints()
aura_env.button = button
end
-------------------------------------------------------------------------------
-- trigger: SOULBIND_ACTIVATED, WA_SOULBINDSTALENTWINDOWBUTTON_DEFERRED
function(event)
local model = aura_env.region.model
if model == nil then
-- Schedule a retrigger on the next rendered frame, when 'model' is not
-- 'nil'.
if event == 'SOULBIND_ACTIVATED' then
C_Timer.After(0, function() WeakAuras.ScanEvents("WA_SOULBINDSTALENTWINDOWBUTTON_DEFERRED") end)
end
return true
end
local soulbindId = C_Soulbinds.GetActiveSoulbindID()
local modelId
if soulbindId == 0 then
modelId = 46720
else
local soulbindData = C_Soulbinds.GetSoulbindData(soulbindId)
modelId = soulbindData.modelSceneData.creatureDisplayInfoID
end
model:SetDisplayInfo(modelId)
return true
end
-------------------------------------------------------------------------------
-- untrigger
function()
return false
end