Commit 308ef46e authored by Ivaria's avatar Ivaria
Browse files

Add talent cache maps for new large Dragonflight talent trees

parent c88bf00b
......@@ -124,8 +124,9 @@ function VUHDO_initFromSpellbook()
if tHotCfg["" .. tCnt]["others"] then VUHDO_ACTIVE_HOTS_OTHERS[tHotName] = true; end
end
end
VUHDO_setKnowsSwiftmend(VUHDO_isSpellKnown(VUHDO_SPELL_ID.SWIFTMEND));
-- toggle whether we should track Holy Priest "Trail of Light"
VUHDO_initTalentSpellCaches();
VUHDO_setKnowsSwiftmend(VUHDO_isSpellKnown(VUHDO_SPELL_ID.SWIFTMEND));
VUHDO_setKnowsTrailOfLight(VUHDO_isTalentKnown(VUHDO_SPELL_ID.TRAIL_OF_LIGHT));
end
......@@ -39,6 +39,15 @@ local pairs = pairs;
local type = type;
local abs = abs;
-- talent cache maps for new large Dragonflight talent trees
local VUHDO_TALENT_SPELL_ID_CACHE = {
-- [<spell ID>] = <spell name>,
};
local VUHDO_TALENT_SPELL_NAME_CACHE = {
-- [<spell name>] = <spell ID>,
};
local sEmpty = { };
setmetatable(sEmpty, { __newindex = function(aTable, aKey, aValue) VUHDO_xMsg("WARNING: newindex on dummy array: ", aKey, aValue); end });
......@@ -539,7 +548,8 @@ end
--
function VUHDO_getTalentSpellId(aTalentName)
function VUHDO_initTalentSpellCaches()
local tActiveConfigId = C_ClassTalents.GetActiveConfigID();
-- on initial PLAYER_ENTER_WORLD talents are not yet available
......@@ -547,6 +557,9 @@ function VUHDO_getTalentSpellId(aTalentName)
return;
end
twipe(VUHDO_TALENT_SPELL_ID_CACHE);
twipe(VUHDO_TALENT_SPELL_NAME_CACHE);
local tConfigInfo = C_Traits.GetConfigInfo(tActiveConfigId);
for _, tTreeId in pairs(tConfigInfo.treeIDs) do
......@@ -559,23 +572,33 @@ function VUHDO_getTalentSpellId(aTalentName)
local tEntryInfo = C_Traits.GetEntryInfo(tActiveConfigId, tNodeInfo.entryIDs[1]);
local tDefinitionInfo = C_Traits.GetDefinitionInfo(tEntryInfo.definitionID);
if type(aTalentName) == "number" and tDefinitionInfo.spellID == aTalentName then
return tDefinitionInfo.spellID;
else
local tSpellName = GetSpellInfo(tDefinitionInfo.spellID);
local tSpellName = GetSpellInfo(tDefinitionInfo.spellID);
if tSpellName == aTalentName then
return tDefinitionInfo.spellID;
end
end
VUHDO_TALENT_SPELL_ID_CACHE[tDefinitionInfo.spellID] = tSpellName;
VUHDO_TALENT_SPELL_NAME_CACHE[tSpellName] = tDefinitionInfo.spellID;
end
end
end
return nil;
return;
end
--
function VUHDO_getTalentSpellId(aTalentName)
if type(aTalentName) == "number" then
return VUHDO_TALENT_SPELL_ID_CACHE[aTalentName] or nil;
else
return VUHDO_TALENT_SPELL_NAME_CACHE[aTalentName] or nil;
end
end
--
function VUHDO_isTalentKnown(aTalentName)
return VUHDO_getTalentSpellId(aTalentName) and true or false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment