From 5bbf5dcd659dddaf7ceeb1137c204b5374d9b495 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Mon, 16 Feb 2026 11:32:12 -0700 Subject: [PATCH] remove minitalent use. not compatible with ascension --- WeakAuras/Prototypes.lua | 119 +++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 54 deletions(-) diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 72cab6e..75fc54e 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -5283,72 +5283,78 @@ Private.event_prototypes = { ["Talent Known"] = { type = "unit", events = { - ["events"] = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"} + ["events"] = {"ASCENSION_KNOWN_ENTRIES_UPDATED", "PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"} }, - force_events = "PLAYER_TALENT_UPDATE", + force_events = "ASCENSION_KNOWN_ENTRIES_UPDATED", name = L["Talent Known"], init = function(trigger) local ret = {} - table.insert(ret, [[ - local active = true + local spellId = type(trigger.spellName) == "number" and trigger.spellName or 0 + table.insert(ret, ([[ + local spellId = %s + local inverse = %s + local active = false local activeName, activeIcon, _ - ]]) - if (trigger.use_talent) then - -- Single selection - local index = trigger.talent and trigger.talent.single; - local tier = index and ceil(index / MAX_NUM_TALENTS) - local column = index and ((index - 1) % MAX_NUM_TALENTS + 1) - table.insert(ret, ([[ - local tier = %s; - local column = %s; - active = false - local name, icon, _, _, rank = GetTalentInfo(tier, column) - if rank and rank > 0 then - active = true; - activeName = name; - activeIcon = icon; + local function GetCATalentState(spellId) + if not spellId or spellId == 0 then + return false, nil, nil end - ]]):format(tier or 0, column or 0)) - elseif (trigger.use_talent == false) then - if (trigger.talent.multi) then - table.insert(ret, [[ - local tier - local column - ]]) - for index, value in pairs(trigger.talent.multi) do - local tier = index and ceil(index / MAX_NUM_TALENTS) - local column = index and ((index - 1) % MAX_NUM_TALENTS + 1) - table.insert(ret, ([[ - 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, value and "true" or "false")) + local internalId = C_CharacterAdvancement.GetInternalID(spellId) + if not internalId then + return false, nil, nil + end + local rank = select(1, C_CharacterAdvancement.GetTalentRankByID(internalId)) + local isActive = (rank and rank > 0) or false + local name, icon + local entry = C_CharacterAdvancement.GetEntryByInternalID(internalId) + if entry then + name = entry.Name + if entry.Icon then + icon = "Interface\\Icons\\" .. entry.Icon + end + end + if not name or not icon then + name, _, icon = GetSpellInfo(spellId) + end + return isActive, name, icon + end + if spellId and spellId ~= 0 then + local isActive, name, icon = GetCATalentState(spellId) + activeName = name + activeIcon = icon + active = inverse and not isActive or isActive + end + ]]):format(spellId, trigger.use_inverse and "true" or "false")) + return table.concat(ret) + end, + GetNameAndIcon = function(trigger) + local spellId = type(trigger.spellName) == "number" and trigger.spellName or 0 + if spellId and spellId ~= 0 then + local internalId = C_CharacterAdvancement.GetInternalID(spellId) + if internalId then + local entry = C_CharacterAdvancement.GetEntryByInternalID(internalId) + if entry then + local icon = entry.Icon and ("Interface\\Icons\\" .. entry.Icon) or nil + return entry.Name, icon end end + local name, _, icon = GetSpellInfo(spellId) + return name, icon end - return table.concat(ret) end, args = { { - name = "talent", + name = "spellName", + required = true, display = L["Talent"], - type = "multiselect", - values = function() - local class = select(2, UnitClass("player")); - 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 + type = "talent", + test = "true", + }, + { + name = "inverse", + display = WeakAuras.newFeatureString .. L["Inverse"], + type = "toggle", + test = "true", }, { hidden = true, @@ -5362,7 +5368,12 @@ Private.event_prototypes = { name = "name", init = "activeName", store = "true", - test = "true" + test = "true", + conditionType = "string" + }, + { + hidden = true, + test = "active" }, }, automaticrequired = true,