(feat/Prototypes) use WeakAurasMiniTalent in the Talent Known Trigger
(cherry picked from commit 0d025ff3813119b51a3d57157a18c47b96f9704a)
This commit is contained in:
@@ -1207,7 +1207,6 @@ function HandleEvent(frame, event, arg1, arg2, ...)
|
||||
end
|
||||
if (event == "PLAYER_ENTERING_WORLD") then
|
||||
timer:ScheduleTimer(function()
|
||||
Private.CreateTalentCache()
|
||||
WeakAuras.WatchForMounts()
|
||||
HandleEvent(frame, "WA_DELAYED_PLAYER_ENTERING_WORLD");
|
||||
Private.ScanForLoads(nil, "WA_DELAYED_PLAYER_ENTERING_WORLD")
|
||||
|
||||
+21
-37
@@ -5288,8 +5288,11 @@ Private.event_prototypes = {
|
||||
force_events = "PLAYER_TALENT_UPDATE",
|
||||
name = L["Talent Known"],
|
||||
init = function(trigger)
|
||||
local inverse = trigger.use_inverse
|
||||
local ret = {}
|
||||
table.insert(ret, [[
|
||||
local active = true
|
||||
local activeName, activeIcon, _
|
||||
]])
|
||||
if (trigger.use_talent) then
|
||||
-- Single selection
|
||||
local index = trigger.talent and trigger.talent.single;
|
||||
@@ -5298,7 +5301,7 @@ Private.event_prototypes = {
|
||||
table.insert(ret, ([[
|
||||
local tier = %s;
|
||||
local column = %s;
|
||||
local active = false
|
||||
active = false
|
||||
local name, icon, _, _, rank = GetTalentInfo(tier, column)
|
||||
if rank and rank > 0 then
|
||||
active = true;
|
||||
@@ -5306,17 +5309,8 @@ Private.event_prototypes = {
|
||||
activeIcon = icon;
|
||||
end
|
||||
]]):format(tier or 0, column or 0))
|
||||
if (inverse) then
|
||||
table.insert(ret, [[
|
||||
active = not (active);
|
||||
]])
|
||||
end
|
||||
elseif (trigger.use_talent == false) then
|
||||
if (trigger.talent.multi) then
|
||||
table.insert(ret, [[
|
||||
local active = true
|
||||
local activeIcon, activeName, _
|
||||
]])
|
||||
table.insert(ret, [[
|
||||
local tier
|
||||
local column
|
||||
@@ -5325,22 +5319,15 @@ Private.event_prototypes = {
|
||||
local tier = index and ceil(index / MAX_NUM_TALENTS)
|
||||
local column = index and ((index - 1) % MAX_NUM_TALENTS + 1)
|
||||
table.insert(ret, ([[
|
||||
if (not active) then
|
||||
tier = %s
|
||||
column = %s
|
||||
local name, icon, _, _, rank = GetTalentInfo(tier, column)
|
||||
if rank > 0 then
|
||||
active = true;
|
||||
activeName = name;
|
||||
activeIcon = icon;
|
||||
end
|
||||
tier = %s
|
||||
column = %s
|
||||
local shouldBeActive = %s
|
||||
local rank
|
||||
activeName, activeIcon, _, _, rank = GetTalentInfo(tier, column)
|
||||
if ((rank and rank > 0) ~= shouldBeActive) then
|
||||
active = false
|
||||
end
|
||||
]]):format(tier, column))
|
||||
end
|
||||
if (inverse) then
|
||||
table.insert(ret, [[
|
||||
active = not (active);
|
||||
]])
|
||||
]]):format(tier, column, value and "true" or "false"))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -5351,20 +5338,17 @@ Private.event_prototypes = {
|
||||
name = "talent",
|
||||
display = L["Talent"],
|
||||
type = "multiselect",
|
||||
values = function(trigger)
|
||||
values = function()
|
||||
local class = select(2, UnitClass("player"));
|
||||
if Private.talent_types_specific and Private.talent_types_specific[class] then
|
||||
return Private.talent_types_specific[class];
|
||||
end
|
||||
return Private.talentInfo[class]
|
||||
end,
|
||||
multiUseControlWhenFalse = true,
|
||||
multiAll = true,
|
||||
multiNoSingle = true,
|
||||
multiTristate = true, -- values can be true/false/nil
|
||||
control = "WeakAurasMiniTalent",
|
||||
test = "active",
|
||||
reloadOptions = true,
|
||||
},
|
||||
{
|
||||
name = "inverse",
|
||||
display = L["Inverse"],
|
||||
type = "toggle",
|
||||
test = "true",
|
||||
reloadOptions = true
|
||||
},
|
||||
{
|
||||
hidden = true,
|
||||
|
||||
@@ -956,23 +956,6 @@ local function LoadCustomActionFunctions(data)
|
||||
end
|
||||
end
|
||||
|
||||
Private.talent_types_specific = {}
|
||||
function Private.CreateTalentCache()
|
||||
local _, player_class = UnitClass("player")
|
||||
|
||||
Private.talent_types_specific[player_class] = Private.talent_types_specific[player_class] or {};
|
||||
|
||||
for tab = 1, GetNumTalentTabs() do
|
||||
for num_talent = 1, GetNumTalents(tab) do
|
||||
local talentName, talentIcon = GetTalentInfo(tab, num_talent);
|
||||
local talentId = (tab - 1) * MAX_NUM_TALENTS + num_talent
|
||||
if (talentName and talentIcon) then
|
||||
Private.talent_types_specific[player_class][talentId] = "|T"..talentIcon..":0|t "..talentName
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Private.CompanionData = {}
|
||||
-- use this function to not overwrite data from other companion compatible addons
|
||||
-- when using this function, do not name your global data table "WeakAurasCompanion"
|
||||
|
||||
Reference in New Issue
Block a user