WoWInterface SVN ReadySpells

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 18 to Rev 19
    Reverse comparison

Rev 18 → Rev 19

trunk/ReadySpells/Core.lua
1262,24 → 1262,14
mouseoverSlots[wspellsCell].texture:Hide();
-- mouseover displaySlot INIT end
 
-- for k = 1, #watchSpells[wspellsCell] do
if watchSpells[wspellsCell] then
-- for wsCellSpell = 1, #watchSpells[wspellsCell] do
for wsCellSpell in ipairs(watchSpells[wspellsCell]) do
local spellName = watchSpells[wspellsCell][wsCellSpell]
-- local id = self.db.profile.spellList[spellName] -- Once used to hold the value of the corresponding slot in the Spellbook.
-- local id = spellList[spellName]; -- As above but getting the (same) value from the session-only value (not saved to profile).
local id = spellName; -- Version above is slotIndexInSpellBook. New "spellName" is actually spellID.
local id = spellName; -- Old version was slotIndexInSpellBook. New "spellName" is actually spellID.
if id ~= nil then -- Sanity check, TODO: likely unneeded after full conversion of 'spellSlotInSpellbook, BOOKTYPE_SPELL' to 'spellID'.
-- print("Watching "..spellName.." slot = "..wspellsCell.." priority = "..wsCellSpell.." id = "..id)
-- local next = #displaySlots[wspellsCell].spells + 1 -- I believe "next" is a reserved word ...?
local nextDisplaySlot = #displaySlots[wspellsCell].spells + 1;
-- local icon = GetSpellTexture(id, BOOKTYPE_SPELL)
local icon = GetSpellTexture(id);
-- Wowpedia: icon = GetSpellTexture(spellId or "spellName")
-- Doens't even mention "indexInSpellbook, spellType". Probably all these funcs
-- we're getting info about spells from all accept the three ways to reference
-- said spells: name, ID or "spellIndex, spellType".
 
displaySlots[wspellsCell].spells[nextDisplaySlot] = {
["name"] = spellName,
["id"] = id,
1866,10 → 1856,9
end
 
function ReadySpells:LEARNED_SPELL_IN_TAB()
-- print("New Spell")
-- self.getSpellList()
self:getSpellList()
self.needCreate = 1
-- self:Print("New Spell(s)")
self:getSpellList();
self.needCreate = 1;
end
 
function ReadySpells:RAID_ROSTER_UPDATE()
trunk/ReadySpells/Init.lua
156,7 → 156,7
-- SID[wspellsCellIndex]: We'll save the spells by their IDs, so that we can
-- read them back regardless of the client language upon save (e.g. NOT enUS)
if ReadySpells.db.profile.watchSpells[wspellsCellIndex] == nil then
ReadySpells.db.profile.watchSpells[wspellsCellIndex] = {[wspellOrder] = wspellNameFound}; -- v = key actually, not value
ReadySpells.db.profile.watchSpells[wspellsCellIndex] = {[wspellOrder] = wspellNameFound};
else
ReadySpells.db.profile.watchSpells[wspellsCellIndex][wspellOrder] = wspellNameFound;
end
334,22 → 334,20
 
-- local addSpellList = function(spellName, indexInSpellList, indexInSpellbookTab)
local addSpellList = function(spellName, indexInSpellList, placeHolderFlag)
spellName = SID[spellName] or spellName;
spellName = SID[spellName] or spellName; -- Now spell ID
-- ReadySpells:Print("Now running addSpellList(".. tostring(spellName).. ", ".. tostring(indexInSpellList).. ", "..
-- tostring(placeHolderFlag).. ") for ".. (GetSpellInfo(spellName)));
-- spellList[indexInSpellList] = spellName;
-- if not spellList then
-- if spellList == nil then
-- spellList = {};
-- end
-- tinsert(spellList, indexInSpellList, spellName);
-- if ReadySpells.db.profile.spellList == nil then
-- ReadySpells.db.profile.spellList = {[spellName] = placeHolderFlag};
if spellList == nil then
spellList = {[spellName] = placeHolderFlag};
else
-- ReadySpells.db.profile.spellList[spellName] = placeHolderFlag;
spellList[spellName] = placeHolderFlag;
end
 
-- if ids == nil then
-- ids = {[spellName] = placeHolderFlag} -- "ids" is a wrong name for this ... EDIT: And is currently used NOWHERE
-- else
367,64 → 365,76
-- 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