Added spells to detect specs in Dragonflight
This commit is contained in:
+168
@@ -2770,4 +2770,172 @@ function Details.GetDragonflightTalentsAsHashTable()
|
||||
end
|
||||
|
||||
return allTalents
|
||||
end
|
||||
|
||||
|
||||
--called from inside the function Details.GenerateSpecSpellList()
|
||||
local getSpellList = function(specIndex, completeListOfSpells, sharedSpellsBetweenSpecs, specNames)
|
||||
|
||||
local specId, specName, _, specIconTexture = GetSpecializationInfo(specIndex)
|
||||
completeListOfSpells[specId] = {}
|
||||
specNames[specId] = specName
|
||||
|
||||
--get spells from talents
|
||||
local configId = C_ClassTalents.GetActiveConfigID()
|
||||
if (not configId) then
|
||||
return completeListOfSpells
|
||||
end
|
||||
|
||||
local configInfo = C_Traits.GetConfigInfo(configId)
|
||||
|
||||
--get the spells from the SPEC from talents
|
||||
for treeIndex, treeId in ipairs(configInfo.treeIDs) do
|
||||
local treeNodes = C_Traits.GetTreeNodes(treeId)
|
||||
for nodeIdIndex, treeNodeID in ipairs(treeNodes) do
|
||||
local traitNodeInfo = C_Traits.GetNodeInfo(configId, treeNodeID)
|
||||
if (traitNodeInfo and traitNodeInfo.posX > 9000) then
|
||||
local entryIds = traitNodeInfo.entryIDs
|
||||
for i = 1, #entryIds do
|
||||
local entryId = entryIds[i] --number
|
||||
local traitEntryInfo = C_Traits.GetEntryInfo(configId, entryId)
|
||||
local borderTypes = Enum.TraitNodeEntryType
|
||||
if (traitEntryInfo.type == borderTypes.SpendSquare) then
|
||||
local definitionId = traitEntryInfo.definitionID
|
||||
local traitDefinitionInfo = C_Traits.GetDefinitionInfo(definitionId)
|
||||
local spellId = traitDefinitionInfo.overriddenSpellID or traitDefinitionInfo.spellID
|
||||
local spellName, _, spellTexture = GetSpellInfo(spellId)
|
||||
if (spellName) then
|
||||
completeListOfSpells[specId][spellId] = specId
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--get spells of the SPEC from the spell book
|
||||
for i = 1, GetNumSpellTabs() do
|
||||
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(i)
|
||||
if (tabTexture == specIconTexture) then
|
||||
offset = offset + 1
|
||||
local tabEnd = offset + numSpells
|
||||
for entryOffset = offset, tabEnd - 1 do
|
||||
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
|
||||
if (spellId) then
|
||||
if (spellType == "SPELL") then
|
||||
spellId = C_SpellBook.GetOverrideSpell(spellId)
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
local isPassive = IsPassiveSpell(entryOffset, "player")
|
||||
if (spellName and not isPassive) then
|
||||
completeListOfSpells[specId][spellId] = specId
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--get shared spells from the spell book
|
||||
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(2)
|
||||
offset = offset + 1
|
||||
local tabEnd = offset + numSpells
|
||||
for entryOffset = offset, tabEnd - 1 do
|
||||
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
|
||||
if (spellId) then
|
||||
if (spellType == "SPELL") then
|
||||
spellId = C_SpellBook.GetOverrideSpell(spellId)
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
local isPassive = IsPassiveSpell(entryOffset, "player")
|
||||
if (spellName and not isPassive) then
|
||||
sharedSpellsBetweenSpecs[spellId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local classNameLoc = UnitClass("player")
|
||||
print(specName .. " " .. classNameLoc .. " spells recorded.")
|
||||
return completeListOfSpells, sharedSpellsBetweenSpecs, specNames
|
||||
end
|
||||
|
||||
function Details.GenerateSpecSpellList()
|
||||
local dumpSpellTable = 1
|
||||
|
||||
local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization())
|
||||
local classNameLoc, className, classId = UnitClass("player")
|
||||
|
||||
local completeListOfSpells = {}
|
||||
local sharedSpellsBetweenSpecs = {}
|
||||
local specNames = {}
|
||||
|
||||
_G.SPELLS_FROM_THIS_CLASS = _G.SPELLS_FROM_THIS_CLASS or {
|
||||
sharedSpells = {},
|
||||
specNames = {}
|
||||
}
|
||||
|
||||
local amountSpecs = GetNumSpecializationsForClassID(classId)
|
||||
|
||||
local totalTimeToWait = 0
|
||||
DetailsFramework.Schedules.NewTimer(0, function() SetSpecialization(1) end)
|
||||
DetailsFramework.Schedules.NewTimer(6, getSpellList, 1, completeListOfSpells, sharedSpellsBetweenSpecs, specNames)
|
||||
totalTimeToWait = 7
|
||||
DetailsFramework.Schedules.NewTimer(7, function() SetSpecialization(2) end)
|
||||
DetailsFramework.Schedules.NewTimer(13, getSpellList, 2, completeListOfSpells, sharedSpellsBetweenSpecs, specNames)
|
||||
totalTimeToWait = 14
|
||||
|
||||
if (amountSpecs >= 3) then
|
||||
DetailsFramework.Schedules.NewTimer(14, function() SetSpecialization(3) end)
|
||||
DetailsFramework.Schedules.NewTimer(20, getSpellList, 3, completeListOfSpells, sharedSpellsBetweenSpecs, specNames)
|
||||
totalTimeToWait = 21
|
||||
end
|
||||
|
||||
if (amountSpecs >= 4) then
|
||||
DetailsFramework.Schedules.NewTimer(21, function() SetSpecialization(4) end)
|
||||
DetailsFramework.Schedules.NewTimer(28, getSpellList, 4, completeListOfSpells, sharedSpellsBetweenSpecs, specNames)
|
||||
totalTimeToWait = 29
|
||||
end
|
||||
|
||||
print("Total Time to Wait:", totalTimeToWait)
|
||||
DetailsFramework.Schedules.NewTimer(totalTimeToWait, function()
|
||||
if (dumpSpellTable) then
|
||||
local parsedSpells = {}
|
||||
local sharedSpells = sharedSpellsBetweenSpecs
|
||||
|
||||
for specId, spellTable in pairs(completeListOfSpells) do
|
||||
parsedSpells[specId] = {}
|
||||
|
||||
--create a list of spells which is in use in the other spec talent tree
|
||||
local spellsInUse = {}
|
||||
for specId2, spellTable2 in pairs(completeListOfSpells) do
|
||||
if (specId2 ~= specId) then
|
||||
for spellId in pairs(spellTable2) do
|
||||
spellsInUse[spellId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for spellId in pairs(sharedSpells) do
|
||||
spellsInUse[spellId] = true
|
||||
end
|
||||
|
||||
--build the list of spells for this spec
|
||||
for spellId in pairs(spellTable) do
|
||||
if (not spellsInUse[spellId]) then
|
||||
parsedSpells[specId][spellId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local result = ""
|
||||
for specId, spellsTable in pairs(parsedSpells) do
|
||||
local specName = specNames[specId]
|
||||
result = result .. "\n--" .. specName .. " " .. classNameLoc .. ":\n"
|
||||
for spellId in pairs(spellsTable) do
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
result = result .. "[" .. spellId .. "] = " .. specId .. ", --" .. spellName .. "\n"
|
||||
end
|
||||
end
|
||||
|
||||
Details:Dump({result})
|
||||
end
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user