-- therefore, as I'm not sure what it really is, we'll leave this var have it's old name. |
local indexInSpellbookTab = 1; |
local indexInSpellList = 1; |
local specIndex = 1; |
local offset = 1; |
local lastItem = 1; |
local specIndexInSpellbook = 1; |
-- local offset = 1; |
-- local lastItem = 1; |
|
-- print ("boink : " .. indexInSpellbookTab ) |
-- ReadySpells.db.profile.spellList = nil; |
if spellList then |
wipe(spellList); |
end |
-- local Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero = GetSpellTabInfo(specIndex); |
-- local Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero = GetSpellTabInfo(specIndexInSpellbook); |
local Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero; |
-- if ReadySpells.db.profile.playerSpecName == "none" then |
if ReadySpells.db.profile.playerSpecName == "none" or ReadySpells.db.profile.playerSpecName == nil then |
Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero = GetSpellTabInfo(2); |
else |
while Spec ~= ReadySpells.db.profile.playerSpecName do |
specIndex = specIndex + 1; |
Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero = GetSpellTabInfo(specIndex); |
end |
-- while Spec ~= ReadySpells.db.profile.playerSpecName do |
repeat |
specIndexInSpellbook = specIndexInSpellbook + 1; |
Spec, icon, offset, lastItem, isGuildPerk, offspecIDorZero = GetSpellTabInfo(specIndexInSpellbook); |
-- end |
until Spec == ReadySpells.db.profile.playerSpecName |
end |
offset = offset + 1; |
lastItem = lastItem + offset; |
|
for indexInSpellbookTab = offset, lastItem do |
local spellName = (GetSpellBookItemName(indexInSpellbookTab, BOOKTYPE_SPELL)); |
|
-- TODO: If we're excluding "Auto Attack" (which should be LSN["Auto Attack"] we should exclude "Auto Shoot" and "Shoot" as well. |
-- Also... "Shapeshift" spells might be useful to track (e.g. to break roots). And (not so useful but still, maybe) "Auto Attack" |
-- could be used to track whether a target can be attacked (not all hostile targets can, of course...) |
-- if IsPassiveSpell(indexInSpellbookTab, BOOKTYPE_SPELL) or spellRank == "Shapeshift" or spellName == LSN["Auto Attack"] then |
-- else |
-- if not IsPassiveSpell(indexInSpellbookTab, BOOKTYPE_SPELL) then |
if not IsPassiveSpell(spellName) then |
if ReadySpells.db.profile.spellListFilter then |
-- local sType; -- As returned by GetSpellBookItemInfo(...): "SPELL", "PETACTION", "FUTURESPELL", "FLYOUT" |
-- local spNum; -- According to wowpedia, this would be the spellID returned by GetSpellBookItemInfo BUT |
-- my experience in LibSpellName2SID-Populator tells me it's something else (or bugged); |
-- therefore, as I'm not sure what it really is, we'll leave this var have its old name. |
local sType, spNum = GetSpellBookItemInfo(spellName); |
if sType == nil then |
print(AddonName.. ": SpellName NOT : " .. spellName); |
else |
-- if sType ~= nil then |
-- print(AddonName.. ": SpellName (type: ".. sType.. "): " .. spellName) |
-- if (sType == "PETACTION" and IsSpellKnown(spNum, true)) or IsSpellKnown(spNum, false) then -- NO need. sType is nil for unknown spells and something else for known ones. |
-- print(AddonName.. "... known. Adding.") |
-- spellName = LSN[spellName] or spellName; -- No need, done inside addSpellList. |
-- addSpellList(spellName, indexInSpellList, indexInSpellbookTab) |
addSpellList(spellName, indexInSpellList, sType); -- As we're not using the Spellbook to reference spells at runtime (rather spellID), |
-- we currently have no need for the 'indexInSpellbookTab'; we might as well just use |
-- true (and false/nil), but we'll use 'sType' (and false/nil) instead. |
indexInSpellList = indexInSpellList + 1; |
-- end |
end |
else |
-- addSpellList(spellName, indexInSpellList, indexInSpellbookTab); |
addSpellList(spellName, indexInSpellList, BOOKTYPE_SPELL); -- Given as we don't have 'sType' in this case, we'll use BOOKTYPE_SPELL instead. |
indexInSpellList = indexInSpellList + 1; |
-- local spellName = (GetSpellBookItemName(indexInSpellbookTab, BOOKTYPE_SPELL)); |
-- if spellName then |
local sType, spNum = GetSpellBookItemInfo(indexInSpellbookTab, BOOKTYPE_SPELL); |
if spNum then -- Sanity check #1/2 |
local _, _, _, _, _, _, spellID = GetSpellInfo(spNum); -- Double check on the above; somehow, |
-- GetSpellBookItemInfo() sometimes |
-- returns non existing spNums/spIDs. |
-- print(AddonName.. ": spNum=".. tostring(spNum).. " spellID=".. tostring(spellID)); |
if spellID then -- Sanity check #2/2 |
-- if IsPassiveSpell(indexInSpellbookTab, BOOKTYPE_SPELL) or spellRank == "Shapeshift" or spellName == LSN["Auto Attack"] then |
-- else |
-- if not IsPassiveSpell(indexInSpellbookTab, BOOKTYPE_SPELL) then |
-- if not IsPassiveSpell(spellName) then |
if not IsPassiveSpell(spellID) then |
-- if ReadySpells.db.profile.spellListFilter then |
if IsSpellKnown(spellID) then |
-- self:Print("We know ".. spellID.. " - ".. spellName); |
-- local sType, spNum = GetSpellBookItemInfo(spellName); |
-- local sType; -- As returned by GetSpellBookItemInfo(...): "SPELL", "PETACTION", "FUTURESPELL", "FLYOUT" |
-- local spNum; -- According to wowpedia, this would be the spellID returned by GetSpellBookItemInfo BUT |
-- my experience in LibSpellName2SID-Populator tells me it's something else (or bugged); |
-- therefore, as I'm not sure what it really is, we'll leave this var have its old name. |
-- if sType == nil then |
-- print(AddonName.. ": SpellName NOT : " .. spellName); |
-- else |
-- if sType ~= nil then |
-- print(AddonName.. ": SpellName (type: ".. sType.. "): " .. spellName) |
-- if (sType == "PETACTION" and IsSpellKnown(spNum, true)) or IsSpellKnown(spNum, false) then -- NO need. sType is nil for unknown spells and something else for known ones. |
-- print(AddonName.. "... known. Adding.") |
-- spellName = LSN[spellName] or spellName; -- No need, done inside addSpellList. |
-- addSpellList(spellName, indexInSpellList, indexInSpellbookTab) |
addSpellList(spellID, indexInSpellList, sType); -- As we're not using the Spellbook to reference spells at runtime (rather spellID), |
-- we currently have no need for the 'indexInSpellbookTab'; we might as well just use |
-- true (and false/nil), but we'll use 'sType' (and false/nil) instead. |
indexInSpellList = indexInSpellList + 1; |
-- end |
-- end |
else |
-- self:Print("We DON'T know ".. tostring(spellID).. " - ".. tostring(spellName)); |
-- addSpellList(spellName, indexInSpellList, indexInSpellbookTab); |
addSpellList(spellID, indexInSpellList, BOOKTYPE_SPELL); -- Given as we don't have 'sType' in this case, we'll use BOOKTYPE_SPELL instead. |
indexInSpellList = indexInSpellList + 1; |
end |
end |
end |
end |
end |