remove minitalent use. not compatible with ascension
This commit is contained in:
+65
-54
@@ -5283,72 +5283,78 @@ Private.event_prototypes = {
|
|||||||
["Talent Known"] = {
|
["Talent Known"] = {
|
||||||
type = "unit",
|
type = "unit",
|
||||||
events = {
|
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"],
|
name = L["Talent Known"],
|
||||||
init = function(trigger)
|
init = function(trigger)
|
||||||
local ret = {}
|
local ret = {}
|
||||||
table.insert(ret, [[
|
local spellId = type(trigger.spellName) == "number" and trigger.spellName or 0
|
||||||
local active = true
|
table.insert(ret, ([[
|
||||||
|
local spellId = %s
|
||||||
|
local inverse = %s
|
||||||
|
local active = false
|
||||||
local activeName, activeIcon, _
|
local activeName, activeIcon, _
|
||||||
]])
|
local function GetCATalentState(spellId)
|
||||||
if (trigger.use_talent) then
|
if not spellId or spellId == 0 then
|
||||||
-- Single selection
|
return false, nil, nil
|
||||||
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;
|
|
||||||
end
|
end
|
||||||
]]):format(tier or 0, column or 0))
|
local internalId = C_CharacterAdvancement.GetInternalID(spellId)
|
||||||
elseif (trigger.use_talent == false) then
|
if not internalId then
|
||||||
if (trigger.talent.multi) then
|
return false, nil, nil
|
||||||
table.insert(ret, [[
|
end
|
||||||
local tier
|
local rank = select(1, C_CharacterAdvancement.GetTalentRankByID(internalId))
|
||||||
local column
|
local isActive = (rank and rank > 0) or false
|
||||||
]])
|
local name, icon
|
||||||
for index, value in pairs(trigger.talent.multi) do
|
local entry = C_CharacterAdvancement.GetEntryByInternalID(internalId)
|
||||||
local tier = index and ceil(index / MAX_NUM_TALENTS)
|
if entry then
|
||||||
local column = index and ((index - 1) % MAX_NUM_TALENTS + 1)
|
name = entry.Name
|
||||||
table.insert(ret, ([[
|
if entry.Icon then
|
||||||
tier = %s
|
icon = "Interface\\Icons\\" .. entry.Icon
|
||||||
column = %s
|
end
|
||||||
local shouldBeActive = %s
|
end
|
||||||
local rank
|
if not name or not icon then
|
||||||
activeName, activeIcon, _, _, rank = GetTalentInfo(tier, column)
|
name, _, icon = GetSpellInfo(spellId)
|
||||||
if ((rank and rank > 0) ~= shouldBeActive) then
|
end
|
||||||
active = false
|
return isActive, name, icon
|
||||||
end
|
end
|
||||||
]]):format(tier, column, value and "true" or "false"))
|
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
|
||||||
end
|
end
|
||||||
|
local name, _, icon = GetSpellInfo(spellId)
|
||||||
|
return name, icon
|
||||||
end
|
end
|
||||||
return table.concat(ret)
|
|
||||||
end,
|
end,
|
||||||
args = {
|
args = {
|
||||||
{
|
{
|
||||||
name = "talent",
|
name = "spellName",
|
||||||
|
required = true,
|
||||||
display = L["Talent"],
|
display = L["Talent"],
|
||||||
type = "multiselect",
|
type = "talent",
|
||||||
values = function()
|
test = "true",
|
||||||
local class = select(2, UnitClass("player"));
|
},
|
||||||
return Private.talentInfo[class]
|
{
|
||||||
end,
|
name = "inverse",
|
||||||
multiUseControlWhenFalse = true,
|
display = WeakAuras.newFeatureString .. L["Inverse"],
|
||||||
multiAll = true,
|
type = "toggle",
|
||||||
multiNoSingle = true,
|
test = "true",
|
||||||
multiTristate = true, -- values can be true/false/nil
|
|
||||||
control = "WeakAurasMiniTalent",
|
|
||||||
test = "active",
|
|
||||||
reloadOptions = true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hidden = true,
|
hidden = true,
|
||||||
@@ -5362,7 +5368,12 @@ Private.event_prototypes = {
|
|||||||
name = "name",
|
name = "name",
|
||||||
init = "activeName",
|
init = "activeName",
|
||||||
store = "true",
|
store = "true",
|
||||||
test = "true"
|
test = "true",
|
||||||
|
conditionType = "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hidden = true,
|
||||||
|
test = "active"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
automaticrequired = true,
|
automaticrequired = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user