diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 0092025..98f5744 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -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") diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 0a6fc99..72cab6e 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -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, diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 5cc7fbe..850bdf9 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -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"