WoWInterface SVN ReadySpells

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 11 to Rev 12
    Reverse comparison

Rev 11 → Rev 12

trunk/ReadySpells/Init.lua
25,15 → 25,22
-- Declare the slash-command
SLASH_READYSPELLS = '/rs';
 
-- Create local aliases for LibSpellName2SID
-- Create local aliases for LibSpellName2SID and LibSpellName2SID-Passives
local LIBSN2SID = LibStub:GetLibrary("LibSpellName2SID");
local SID = LIBSN2SID.SID; -- Spell IDs
local LSN = LIBSN2SID.LSN; -- Localised Spell Names
-- Export LibSpellName2SID tokens to ReadySpell's environment
local LIBSN2SIDP = LibStub:GetLibrary("LibSpellName2SID-Passives");
local SIDP = LIBSN2SIDP.SID; -- Spell IDs
local LSNP = LIBSN2SIDP.LSN; -- Localised Spell Names
-- Export LibSpellName2SID and LibSpellName2SID-Passives tokens to ReadySpell's environment
AddonEnv.LIBSN2SID = LIBSN2SID;
AddonEnv.SID = SID;
AddonEnv.LSN = LSN;
AddonEnv.LIBSN2SIDP = LIBSN2SIDP;
AddonEnv.SIDP = SIDP;
AddonEnv.LSNP = LSNP;
 
 
-- AddonEnv-scope variables and tables; These two used to be set in Core.lua, called from therein.
-- I've now moved the functions that set them to this file instead.
AddonEnv.spellList = {};
49,22 → 56,25
---- Local helper functions, used only in this file ----
--------------------------------------------------------
 
-- TODO: This function is currently being used to validate both spells to display and spells to save
-- into the database; The later will not validate if, for example, they are inactive Talent spells;
-- This would better be a two-part validation:
-- - Spells to display now should work as bellow;
-- - Spells whjch might be activated during a given character session (talent change, spec change
-- and no auto-switch profiles for that spec, etc) should be validated for storing, but not for
-- display.
-- Implementing this will require changes in other parts!
local function validateSpell(spellname)
--[[ for k in pairs(spellList)do
if spellList[k] == spellname then
return true
end
end ]]--
spellname = SID[spellname] or spellname;
if ReadySpells.db.profile.spellList[spellname] == nil then
-- DBG Start
-- if LSN[spellname] then
-- print(AddonName.. ": did NOT validate (existing) ".. LSN[spellname]);
-- if spellname then
-- print(AddonName.. ": did NOT validate (existing) ".. tostring(spellname).. ": ".. tostring(SID[spellname]).. ": ".. tostring(LSN[spellname]));
-- end
-- DBG End
return false;
else
-- print(AddonName.. ": validated ".. tostring(LSN[spellname]).. " - ".. tostring(SID[spellname]));
-- print(AddonName.. ": validated ".. tostring(spellname).. ": ".. tostring(SID[spellname]).. ": ".. tostring(LSN[spellname]));
return true;
end
end
135,10 → 145,6
if newlineFoundAt == nil then -- No more spells in the list
-- The code bellow substitutes a value of 'nil' with a *non-'nil'* empty string, i.e. with ""
wspellNameFound = strsub(wspellsListString, beginStrFindAt);
-- if LSN[wspellNameFound] then -- If available, use the _Localised_ Spell Name
-- wspellNameFound = LSN[wspellNameFound];
-- end
-- wspellNameFound = LSN[wspellNameFound] or wspellNameFound;
wspellNameFound = SID[wspellNameFound] or wspellNameFound; -- Store as Spell ID
-- print("aallkkaa: wspellNameFound with newlineFoundAt == nil: ".. wspellNameFound);
if validateSpell(wspellNameFound) then -- Spell in the list of (available?) spells?
156,9 → 162,6
break
else
wspellNameFound = strsub(wspellsListString, beginStrFindAt, newlineFoundAt -1);
-- if LSN[wspellNameFound] then -- If available, use the _Localised_ Spell Name
-- wspellNameFound = LSN[wspellNameFound];
-- end
wspellNameFound = SID[wspellNameFound] or wspellNameFound;
-- print("aallkkaa: wspellNameFound with newlineFoundAt NOT nil: ".. wspellNameFound);
if validateSpell(wspellNameFound) then
244,6 → 247,12
-- condLine1stPart, condLine2ndPart = stringToTable(strsub(condListString, beginStrFindAt, newlineFoundAt), beginStrFindAt);
condLine1stPart, condLine2ndPart = stringToTable(strsub(condListString, beginStrFindAt, newlineFoundAt));
condLine1stPart = SID[condLine1stPart] or condLine1stPart;
-- The function we're in, setDbBuffCondition(...), is called to set whether
-- "spellToHide = stanceToHde" or "spellToCast = buffOrDebuffTo". Given that stance
-- numbers are only 1 digit long and spell IDs (incl. auras) are at least 3 digits
-- long, we can safely pass the stance numbers through our spell databases and let
-- them fall back to their original value
condLine2ndPart = SIDP[condLine2ndPart] or SID[condLine2ndPart] or condLine2ndPart;
addToTable(dadb, condLine1stPart, trim(condLine2ndPart));
newlineFoundAt = strfind(condListString, "\n", beginStrFindAt);
else
251,6 → 260,7
-- condLine1stPart, condLine2ndPart = stringToTable(strsub(condListString, beginStrFindAt, newlineFoundAt), beginStrFindAt);
condLine1stPart, condLine2ndPart = stringToTable(strsub(condListString, beginStrFindAt, newlineFoundAt));
condLine1stPart = SID[condLine1stPart] or condLine1stPart;
condLine2ndPart = SIDP[condLine2ndPart] or SID[condLine2ndPart] or condLine2ndPart;
addToTable(dadb, condLine1stPart, trim(condLine2ndPart));
beginStrFindAt = newlineFoundAt + 1;
newlineFoundAt = strfind(condListString, "\n", beginStrFindAt);
299,6 → 309,7
if dadb ~= nil then -- NB: The condition here is properly set, as opposed to what happens in getDBValue()
for j, k in pairs(dadb) do
j = LSN[j] or j;
k = LSNP[k] or LSN[k] or k;
if dString ~= nil then
dString = dString .. j .. " = " ..k .. "\n";
else
367,7 → 378,7
-- 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 it's old name.
-- 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);
479,16 → 490,13
-- ReadySpells:RefreshConfig()
ReadySpells.db.profile.reset = false;
else
 
ReadySpells.db.profile.reset = true; -- added by aallkkaa
end
end,
}, -- redo
knownFilter = { -- TODO: Check whether there is, in the current version,
-- any point to this. I believe this is the default and only
-- implemented mode. ON actually, even if the desc of this
-- option here says it's OFF by default, as it actually does
-- nothing at all here, and displayed spells are ALWAYS checked
-- against the list of known ("available") spells.
knownFilter = { -- DONE: Correctly displays only spells in the Spellbook if
-- enabled. I still don't know what the "Blizzard Bug" is.
-- TODO: Ask benots4 !
name = 'Known Filter',
desc = 'Only list Known Spells \n default off for Blizzard Bug',
type = 'toggle',
507,9 → 515,8
end
end,
}, -- knownFilter
dpsfeatures = { -- There is something done on this
-- subject, at the bottom of Core.lua.
-- TODO: Check it out!
dpsfeatures = { -- There is stuff done on this subject, at the bottom of
-- Core.lua. TODO: Check it out!
name = 'DPS Features',
desc = 'In development DPS features',
type = 'toggle',
578,18 → 585,17
local v , dString
-- if spellList ~= nil then
for k, v in pairs(ReadySpells.db.profile.spellList) do
-- for k in ipairs(ReadySpells.db.profile.spellList) do
-- LSN[k] gets the localized spell name of the saved spell,
-- regardless of what language the spell was saved in, or
-- whether it's even a spell name or rather a spell ID.
-- The values of k here were saved as SID[k] by function
-- getSpellList().
-- 'v' is the order index in the spell list and was already
-- being correctly handled, namely it's sorted in set func.
k = LSN[k] or k;
if dString ~= nil then
-- dString = dString .. k .. "\n";
dString = dString .. k .. "\n"
dString = dString .. k .. "\n"
else
-- dString = k .. "\n";
dString = k .. "\n";
end
end
598,7 → 604,7
end,
set = function()
-- print(AddonName.. ": In spelllist->set()");
ReadySpells.getSpellList();
ReadySpells:getSpellList();
end,
}, -- spelllist
}, -- args
841,7 → 847,7
end
end,
set = function(_, f)
setWatchSpells(i, f)
setWatchSpells(i, f);
end,
} -- ReadySpells.options.args.spellsels.args["spellcell"..i]
end -- for i = 1, 9 do
861,7 → 867,7
},
hidespells ={ -- For Shaman, this can be used with "Ghost Wolf = 1"
-- to hide it while already in Ghost Wolf; otherwise
-- the icon is shown, with a cooldown number!
-- the icon is shown, with a cooldown begative number!
name = 'Hide Spells',
type = 'group',
-- inline = true,
875,8 → 881,7
get = function()
-- local v , dString; -- 'v' is not used in this function
local dString;
-- if ReadySpells.db.profile.hideNForm == nil then
-- elseif ReadySpells.db.profile.hideNForm ~= nil then
 
if ReadySpells.db.profile.hideNForm ~= nil then
for j, k in pairs(ReadySpells.db.profile.hideNForm) do
-- LSN[j] == localized name of spell to hide; k == form num
894,7 → 899,6
if ReadySpells.db.profile.hideNForm == nil then
ReadySpells.db.profile.hideNForm = {}
end
-- TODO: Similar to getDbPair bellow (see note in spellselfbuff)
setDbBuffCondition(ReadySpells.db.profile.hideNForm, f)
end,
}, -- hideSpell
939,15 → 943,15
width = 'full',
get = function()
if ReadySpells.db.profile.selfBuffStacks ~= nil then
-- TODO: Currently, getDBPair is set to fetch the localized
-- name of "Self Buff Spell" (and the two others bellow) via
-- LSN[spell], but gets the unchanged "Buff"; Implement the
-- getting the localized "Buff" (NB: LibSpellName2SID-Passives
-- should contains all possible Player cast buffs and debuffs
-- but NOT the NPC ones, which the player might want to track.
-- IIRC there is a BabbleFish library for Boss spells (likely
-- not for all NPC spells...), so we might want to use both
-- libs with a fallback to untranslated (NPC) abilities.
-- DONE: getDBPair is set to fetch the localized name of "Self
-- Buff Spell" (and the two others bellow) via LSN[spell]; and
-- "Buff" is fetched via "LSNP[spell] or LSN[spell];
-- TODO: LibSpellName2SID-Passives should contain all possible
-- Player cast buffs and debuffs (I think), but NOT the NPC
-- ones, which the player might want to track.
-- IIRC there is a Babble library for Boss spells (likely none
-- for all NPC spells...), so we might want to use both libs
-- with a fallback to untranslated (NPC) abilities.
return getDbPair(ReadySpells.db.profile.selfBuffStacks);
end
end,
955,7 → 959,6
if ReadySpells.db.profile.selfBuffStacks == nil then
ReadySpells.db.profile.selfBuffStacks = {};
end
-- TODO: Similar to getDbPair above but using SID instead of LSN
setDbBuffCondition(ReadySpells.db.profile.selfBuffStacks, f);
end,
}, -- spellselfbuff
976,7 → 979,6
if ReadySpells.db.profile.buffStacks == nil then
ReadySpells.db.profile.buffStacks = {}
end
-- TODO: See TODO note on spellselfbuff above
setDbBuffCondition(ReadySpells.db.profile.buffStacks,f)
end,
}, -- spellbuff
998,7 → 1000,6
width = 'full',
get = function()
if ReadySpells.db.profile.debuffStacks ~= nil then
-- TODO: See TODO note on spellselfbuff above
return getDbPair(ReadySpells.db.profile.debuffStacks);
end
end,
1006,7 → 1007,6
if ReadySpells.db.profile.debuffStacks == nil then
ReadySpells.db.profile.debuffStacks = {}
end
-- TODO: See TODO note on spellselfbuff above
setDbBuffCondition(ReadySpells.db.profile.debuffStacks, f);
end,
}, -- spelldebuff
trunk/ReadySpells/Core.lua
18,8 → 18,11
AddonName, AddonEnv = ...;
local ReadySpells = AddonEnv.ReadySpells;
local LIBSN2SID = AddonEnv.LIBSN2SID;
local SID = LIBSN2SID.SID; -- Spell IDs
local LSN = LIBSN2SID.LSN; -- Localised Spell Names
local SID = AddonEnv.SID; -- Spell IDs
local LSN = AddonEnv.LSN; -- Localised Spell Names
local LIBSN2SIDP = AddonEnv.LIBSN2SIDP;
local SIDP = AddonEnv.SIDP; -- Spell IDs
local LSNP = AddonEnv.LSNP; -- Localised Spell Names
 
-- NB: 'failcode2' was used in several instances but was NEVER defined anywhere!
-- Thus I replaced all occurrences of 'failcode2' with 'failCode2',which was
trunk/ReadySpells/Classes.lua
19,8 → 19,11
 
local ReadySpells = AddonEnv.ReadySpells;
local LIBSN2SID = AddonEnv.LIBSN2SID;
local SID = LIBSN2SID.SID; -- Spell IDs
local LSN = LIBSN2SID.LSN; -- Localised Spell Names
local SID = AddonEnv.SID; -- Spell IDs
local LSN = AddonEnv.LSN; -- Localised Spell Names
local LIBSN2SIDP = AddonEnv.LIBSN2SIDP;
local SIDP = AddonEnv.SIDP; -- Spell IDs
local LSNP = AddonEnv.LSNP; -- Localised Spell Names
 
 
--------------------