/
local NumberOfPVPTalentSlots = 4; -- Current number of PVP talent tiers - WoW-8.x.y |
-- (Usually) One-time ferched values |
local generalTabName, universalRaceName; |
local generalTabName, universalRaceName, universalClassName; |
-- https://www.wowhead.com/battle-for-azeroth-hunter-pet-guide#hunter-pet-family-list-tenacity |
-- "Manually" added/modified spells - normally AFTER regular update functions were called |
local postUpdate_Spells2Add = { |
["General"] = { |
-- We categorize Hunter Pet spells mainly by their specialiZations, but some pet |
-- families also have Special abilites. And yes, same-name diff-ID spells do occur. |
-- Spell types: Special, Bonus and Exotic |
-- NB: The comment "8.x" bellow denotes I checked the pet on wowhead.com during WoW 8.x, |
-- NOT that they were introduced only in WoW 8.x (though of course some were). |
["Basilisk"] = { |
["Stone Scales"] = 159733, |
}, |
["Cat"] = { |
["Prowl"] = 24450, |
}, |
["Chimaera"] = { |
["Chimaera"] = { -- 8.x |
["Frost Breath"] = 54644, |
["Froststorm Breath"] = 92380, |
}, |
["Clefthoof"] = { |
["Clefthoof"] = { -- 8.x |
["Thick Hide"] = 160057, |
["Blood of the Rhino"] = 280069, |
}, |
["Core Hound"] = { |
["Ancient Hysteria"] = 90355, |
["Core Hound"] = { -- 8.x |
["Obsidian Skin"] = 263867, |
["Molten Hide"] = 159788, |
}, |
["Crab"] = { |
["Agile Reflexes"] = 160011, |
["Play"] = 90347, |
}, |
["Hyena"] = { -- 8.x |
["Infected Bite"] = 263853, |
}, |
["Krolusk"] = { -- 8.x |
["Bulwark"] = 279410, |
}, |
["Lizard"] = { -- 8.x |
["Grievous Bite"] = 279362, |
}, |
["Mechanical"] = { -- 8.x |
["Defense Matrix"] = 263868, |
}, |
["Monkey"] = { |
["Primal Agility"] = 160044, |
}, |
["Nether Ray"] = { |
["Netherwinds"] = 160452, |
}, |
["Quilen"] = { |
["Eternal Guardian"] = 126393, |
["Oxen"] = { -- 8.x |
["Niuzao's Fortitude"] = 264023, |
}, |
["Pterrordax"] = { -- 8.x |
["Ancient Hide"] = 279399, |
["Updraft"] = 160007, |
}, |
["Quilen"] = { -- 8.x |
["Eternal Guardian"] = 267922, |
["Stone Armor"] = 160049, |
}, |
["Riverbeast"] = { |
["Gruesome Bite"] = 160018, |
}, |
["Rodent"] = { |
["Rodent"] = { -- 8.x |
["Gnaw"] = 263856, |
["Rest"] = 126364, |
}, |
["Rylak"] = { |
["Updraft"] = 160007, |
}, |
-- ["Rylak"] = { -- Rylak have been merged into Chimaera in 8.x |
-- ["Updraft"] = 160007, |
-- }, |
["Scorpid"] = { |
["Deadly Sting"] = 160060, |
}, |
["Shale Spider"] = { |
["Shale Spider"] = { -- 8.x |
["Solid Shell"] = 160063, |
}, |
["Silithid"] = { |
["Silithid"] = { -- 8.x |
["Tendon Rip"] = 160065, |
["Dune Strider"] = 280151, |
}, |
["Spider"] = { |
["Web Spray"] = 160067, |
}, |
["Spirit Beast"] = { |
["Spirit Beast"] = { -- 8.x |
["Spirit Shock"] = 264265, |
["Spirit Mend"] = 90361, |
["Spirit Walk"] = 90328, |
}, |
["Toad"] = { |
["Swarm of Flies"] = 279336, |
}, |
["Turtle"] = { |
["Shell Shield"] = 26064, |
}, |
["Warp Stalker"] = { |
["Warp Time"] = 35346, |
}, |
["Water Strider"] = { |
["Water Strider"] = { -- 8.x |
["Soothing Water"] = 264262, |
["Surface Trot"] = 126311, |
}, |
["Worm"] = { |
["Worm"] = { -- 8.x |
["Acid Spit"] = 263446, |
["Burrow Attack"] = 93433, |
}, |
}, |
["Portal: Orgrimmar"] = 11417, -- Horde only |
["Portal: Ironforge"] = 11416, -- Alliance only |
["Portal: Dalaran - Broken Isles"] = 224871, |
["Portal: Boralus"] = 281400, -- Alliance only |
["Portal: Dazar'alor"] = 281402, -- Horde only |
}, |
["Teleport"] = { |
["Teleport: Vale of Eternal Blossoms(Alliance)"] = 132621, -- Added: "(Alliance)" |
["Ancient Teleport: Dalaran"] = 120145, -- Dalaran Crater (way ABOVE it! -> FALL!) |
["Teleport: Exodar"] = 32271, -- Alliance only |
["Teleport: Thunder Bluff"] = 3566, -- Horde only |
["Teleport: Boralus"] = 281403, -- Alliance only |
["Teleport: Dazar'alor"] = 281404, -- Horde only |
}, |
}, |
-- NB: Only the Frost spec has a pet ('Water Elemental') |
}, |
--[[ |
["ROGUE"] = { |
["Flyouts"] = { |
["Poisons"] = { -- Got some weird Lua error upon fecthing these. Consequently, this list |
-- would sometimes be empty, sometimes get only one spell and. at best, |
-- get only three ('Leeching Poison' would always be missing). The same |
-- code works fine for Hunter flyouts (and the other classes as well). |
["Poisons"] = { -- Since WoW 7.0, Assassintation specialization only; Adding here so |
-- that the character doesn't need to have that spec active upon fetch. |
["Wound Poison"] = 8679, |
["Crippling Poison"] = 3408, |
["Deadly Poison"] = 2823, |
["Leeching Poison"] = 108211, |
-- ["Leeching Poison"] = 108211, -- Now only a Passive Assassination talent, with |
-- different spell ID? |
}, |
}, |
}, |
]]-- |
["SHAMAN"] = { |
["Elemental"] = { |
["Bloodlust"] = 2825, -- Horde |
-- }, |
}, |
}, |
["HUNTER"] = { |
["Pets"] = { |
-- NB: The comment "8.x" bellow denotes I checked the pet on wowhead.com during WoW 8.x, |
-- NOT that they were introduced only in WoW 8.x (though of course some were). |
["Krolusk"] = { -- 8.x |
["Calcified Carapace"] = 279254, |
}, |
["Shale Spider"] = { -- 8.x |
["Shimmering Shale"] = 279259, |
}, |
}, |
}, |
["WARLOCK"] = { |
["Pets"] = { -- Spells of the glyph-enhanced versions of the regular Warlock Demons. |
-- NB: We're including spells that remain the same on both versions. |
-- Update the Class dataSource -- |
-- local updateClassMetadata_func = function(SN2SID_table, SN2SID_PASSIVES_table, curLocale, gameBuild, universalClassName, charLevel) |
local updateClassMetadata_func = function(curLocale, gameBuild, universalClassName, charLevel) |
-- local updateClassMetadata_func = function(curLocale, gameBuild, universalClassName, charLevel) |
local updateClassMetadata_func = function(curLocale, gameBuild, charLevel) |
if not updateClassMetadata then |
return; |
end |
-- Update the Talents' lists of spells |
-- local updateTalentSpells_func = function(SN2SID_table, SN2SID_PASSIVES_table, universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updateTalentSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
-- local updateTalentSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updateTalentSpells_func = function(ClassNumSpecs, ClassSpecNames2IDs) |
if not updateClassSpells then -- Sanity check |
return; |
end |
end |
-- local updatePVPTalentSpells_func = function(SN2SID_table, SN2SID_PASSIVES_table, universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updatePVPTalentSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
-- local updatePVPTalentSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updatePVPTalentSpells_func = function(ClassNumSpecs, ClassSpecNames2IDs) |
if not updateClassSpells then -- Sanity check |
return; |
end |
-- Update the Spellbook's GeneralTab and ClassTabs lists of spells |
-- local updateSpellbookSpells_func = function(SN2SID_table, SN2SID_PASSIVES_table, generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
-- local updateSpellbookSpells_func = function(generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updateSpellbookSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
-- local updateSpellbookSpells_func = function(universalClassName, ClassNumSpecs, ClassSpecNames2IDs) |
local updateSpellbookSpells_func = function(ClassNumSpecs, ClassSpecNames2IDs) |
-- "Armor Skills" and "Weapon Skills" are found on the Spellbook's General tab, but are indeed |
-- different from one class to the other. Therefore, we'll save them into local variables upon |
-- fetching the General tab spells and then insert them into the Class Specialisations' tables. |
-- Class spells |
if updateClassSpells then |
-- updateTalentSpells_func(SN2SID_table, SN2SID_PASSIVES_table, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateTalentSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateTalentSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateTalentSpells_func(ClassNumSpecs, ClassSpecNames2IDs); |
-- updatePVPTalentSpells_func(SN2SID_table, SN2SID_PASSIVES_table, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updatePVPTalentSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updatePVPTalentSpells_func(ClassNumSpecs, ClassSpecNames2IDs); |
for i = 2, (ClassNumSpecs +1) do |
-- Get the current tab's first spell's index, total number of spells therein and specID |
local _, _, offset, numEntries, _, _, _, specID = GetSpellTabInfo(i); |
SN2SID_table[universalClassName].Flyouts = {}; |
end |
-- if SN2SID_table[universalClassName].Flyouts[spellName] == nil then |
-- if not SN2SID_table[universalClassName].Flyouts[spellName] then |
-- if (not SN2SID_table[universalClassName].Flyouts[spellName]) and |
-- (spellName ~= "Hex Variants") and (spellName ~= "Poisons") then |
-- if (spellName == "Portal" or spellName == "Teleport") and |
-- (strfind(flyoutSpellName, "Shattrath") or strfind(flyoutSpellName, "Tol Barad") or |
-- strfind(flyoutSpellName, "Vale of Eternal Blossoms")) then |
-- Don't add this spell; will be added in post. |
-- else |
-- tinsert(SN2SID_table[universalClassName].Flyouts, spellName); |
-- SN2SID_table[universalClassName].Flyouts[spellName] = {}; |
-- end |
-- end |
if (spellName == "Hex Variants") or (spellName == "Poisons") |
or (spellName == "Portal") or (spellName == "Teleport") then |
-- if (spellName == "Hex Variants") or (spellName == "Poisons") |
if (spellName == "Hex Variants") or (spellName == "Portal") or |
(spellName == "Teleport") then |
break; -- Do mothing; for different reasons all of these flyouts |
-- are added only in post. |
else |
tinsert(SN2SID_table[universalClassName].Flyouts, spellName); |
SN2SID_table[universalClassName].Flyouts[spellName] = {}; |
if not SN2SID_table[universalClassName].Flyouts[spellName] then |
-- print(AddonName.. ": Adding Flyouts.".. spellName.. " to ".. universalClassName); |
-- tinsert(SN2SID_table[universalClassName].Flyouts, spellName); |
-- NOTE: Looks like only the tables in the toplevel table need |
-- a "tinsert(table, subtable);" before the "table = {};" |
-- assignment/declaration. Further nested-down tables or vars |
-- do not need it and will indeed produce extra array-like |
-- items of the same name if you try to. |
SN2SID_table[universalClassName].Flyouts[spellName] = {}; |
else |
-- print(AddonName.. ": Flyouts.".. spellName.. " is already in ".. universalClassName); |
end |
local _, _, numFlyouts, flyoutKnown = GetFlyoutInfo(spellID); |
-- if flyoutKnown then |
for flyoutSlot = 1, numFlyouts do |
local flyoutSpellID, _, _, _ = GetFlyoutSlotInfo(spellID, flyoutSlot); |
local flyoutSpellName, flyoutSpellSubname, _, _, _, _, _ = GetSpellInfo(flyoutSpellID); |
-- print(AddonName.. ": ".. tostring(flyoutSpellID).. " = ".. tostring(flyoutSpellName)); |
-- if spellName == "Hex Variants" then -- Shaman "Hex Variants" are |
-- all called "Hex"; therefore we'll use the |
-- hardcoded 'Hex(<variant>)' values, from the |
-- table 'postUpdate_Spells2Add' above, instead. |
-- if SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellID] == nil then |
-- print(AddonName.. "Adding flyout spellID ".. flyoutSpellID.. " = ".. flyoutSpellName); |
-- SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellID] = flyoutSpellName; |
-- end |
-- elseif spellName == "Polymorph Variants" then -- Mage "Polymorph |
if spellName == "Polymorph Variants" then -- Mage "Polymorph |
-- Variants", like Shaman Hex Variants, are all |
-- called "Polymorph". But they are different |
-- in that they, unlike Hex's, have a subname |
-- specifying the variant AND can be called by |
-- suffixing the subname in parenthesis, as in |
-- e.g. "Polymorph(Sheep)". We'll do just that. |
if spellName == "Polymorph Variants" then -- Mage "Polymorph |
-- Variants", like Shaman Hex Variants, are all called |
-- "Polymorph". But they are different in that they, |
-- unlike Hex's, have a subname specifying the variant |
-- AND can be called by suffixing the subname in |
-- parenthesis, as in e.g. "Polymorph(Sheep)". We'll do |
-- just that. |
-- NEW for 1.0.14 -- |
if (flyoutSpellSubname == nil) or (flyoutSpellSubname == "") then |
local delayedFlyoutSpellInfo = Spell:CreateFromSpellID(flyoutSpellID); |
addMagePolymorphFlyoutSpell_func(spellName, flyoutSpellName, flyoutSpellSubname, flyoutSpellID); |
end |
-- -- |
--[[ |
local flyoutSpellFullName = flyoutSpellName.. "(".. flyoutSpellSubname.. ")"; |
-- if SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellFullName] == nil |
if not SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellFullName] |
or SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellFullName] ~= flyoutSpellID then |
-- print(AddonName.. "Adding flyout spellFullName ".. flyoutSpellFullName.. " = ".. flyoutSpellID); |
SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellFullName] = flyoutSpellID; |
end |
]]-- |
-- elseif (spellName == "Portal" or spellName == "Teleport") and |
-- (strfind(flyoutSpellName, "Shattrath") or strfind(flyoutSpellName, "Tol Barad") or |
-- strfind(flyoutSpellName, "Vale of Eternal Blossoms")) then |
-- These spells have Alliance and Horde versions (same spell |
-- name, different spell IDs). We hardcoded them into post. |
elseif not SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName] then |
-- elseif flyoutSpellName and not SN2SID_table[universalClassName].Flyouts[spellName] then |
-- SN2SID_table[universalClassName].Flyouts[spellName] = { [flyoutSpellName] = flyoutSpellID }; |
elseif flyoutSpellName and (not SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName]) then |
-- print(AddonName.. ": ".. tostring(flyoutSpellName).. " = ".. tostring(flyoutSpellID)); |
-- tinsert(SN2SID_table[universalClassName].Flyouts[spellName], flyoutSpellName); |
SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName] = flyoutSpellID; |
elseif SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName] ~= flyoutSpellID then |
-- print(AddonName.. "Adding flyout spellName ".. flyoutSpellName.. " = ".. flyoutSpellID); |
elseif flyoutSpellName and (SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName] ~= flyoutSpellID) then |
-- print(AddonName.. ": ".. tostring(flyoutSpellName).. " = ".. tostring(flyoutSpellID)); |
SN2SID_table[universalClassName].Flyouts[spellName][flyoutSpellName] = flyoutSpellID; |
end |
end |
-- spells are not actually available in the UI spellbook but we're |
-- leaving them on the table anyway. Note: Also makes it possible to |
-- implement the 'Flyouts' table per Class instead of per Spec. |
-- |
-- NB2: The above applies to Rogue Poisons which, since 7.0, are |
-- Assassination spec only, but get fetched for the other specs as |
-- well. |
end |
end |
end |
-- which names would be the tokens (string) above? |
-- Pet Spells update function |
-- local updatePetSpellNames = function(SN2SID_table, SN2SID_PASSIVES_table, universalClassName) |
local updatePetSpellNames = function(universalClassName) |
local updatePetSpellNames = function() |
-- print(AddonName.. ": Fetching Pet spells"); |
-- local petHasSpellsConfirmed = false; |
-- NOTES: |
-- local generalTabName = (GetSpellTabInfo(1)); -- Tab#1 = General |
generalTabName = (GetSpellTabInfo(1)); -- Tab#1 = General |
-- Class stuff -- |
local universalClassName = select(2, UnitClass("player")); -- Locale-independent Class name |
-- local universalClassName = select(2, UnitClass("player")); -- Locale-independent Class name |
stubVal, universalClassName = UnitClass("player"); -- Locale-independent Class name |
local ClassNumSpecs = GetNumSpecializations(false, false); -- Number of Specialisations |
-- Ordered list of Class specs' IDs and Names -- Do we still use this? |
local specID, specName = GetSpecializationInfo(1); |
-- Do the actual update of the Class Metadata (dataSource only now; Specs will be handled next) |
-- updateClassMetadata_func(SN2SID_table, SN2SID_PASSIVES_table, curLocale, gameBuild, universalClassName, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, universalClassName, charLevel); |
-- updateClassMetadata_func(curLocale, gameBuild, universalClassName, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, charLevel); |
-- If needed, create and populate Class Specs' Active and Passive Spells -- |
-- Flag spell-lists for update if applicable -- |
updateClassSpells = true; |
-- updateSpellbookSpells_func(SN2SID_table, SN2SID_PASSIVES_table, generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateSpellbookSpells_func(generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(ClassNumSpecs, ClassSpecNames2IDs); |
-- Pet spells will only be available when a pet is out, so wait for it, i.e. wait for UNIT_PET |
-- to fire for "player". |
updateClassSpells = true; |
-- updateSpellbookSpells_func(SN2SID_table, SN2SID_PASSIVES_table, generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateSpellbookSpells_func(generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(ClassNumSpecs, ClassSpecNames2IDs); |
end |
function SN2SID_events:PLAYER_LEVEL_UP(self, ...) |
updateGeneralTabMetadata = true; -- Maybe useful. |
updateClassMetadata = true; -- Stuff like talents only become available at level 10. |
-- updateClassMetadata_func(SN2SID_table, SN2SID_PASSIVES_table, curLocale, gameBuild, universalClassName, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, universalClassName, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, charLevel); |
updateGeneralTabMetadata = true; -- Maybe useful. |
updateClassMetadata = true; -- Stuff like talents only become available at level 10. |
end |
SN2SID_PASSIVES_table[universalClassName].Pets = {}; |
end |
-- updatePetSpellNames(SN2SID_table, SN2SID_PASSIVES_table, universalClassName); |
updatePetSpellNames(universalClassName); |
-- updatePetSpellNames(universalClassName); |
updatePetSpellNames(); |
-- end |
end |
SN2SID_table[universalClassName].Pets = {}; |
end |
-- updatePetSpellNames(SN2SID_table, SN2SID_PASSIVES_table, universalClassName); |
updatePetSpellNames(universalClassName); |
-- updatePetSpellNames(universalClassName); |
updatePetSpellNames(); |
-- end |
end |
-- updateGeneralTabMetadata_func(curLocale, gameBuild, universalRaceName, generalTabName, charLevel); |
-- updateGeneralTabMetadata_func(curLocale, gameBuild, universalRaceName, charLevel); |
updateGeneralTabMetadata_func(curLocale, gameBuild, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, universalClassName, charLevel); |
-- updateClassMetadata_func(curLocale, gameBuild, universalClassName, charLevel); |
updateClassMetadata_func(curLocale, gameBuild, charLevel); |
-- updateSpellbookSpells_func(generalTabName, universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
-- updateSpellbookSpells_func(universalClassName, ClassNumSpecs, ClassSpecNames2IDs); |
updateSpellbookSpells_func(ClassNumSpecs, ClassSpecNames2IDs); |
-- NB: UNIT_PET fires upon summoning new pets; but NOT upon switching Hunters' Pet-Specs. |
if SN2SID_table[universalClassName].Pets or SN2SID_PASSIVES_table[universalClassName].Pets then |
-- updatePetSpellNames(SN2SID_table, SN2SID_PASSIVES_table, universalClassName); |
updatePetSpellNames(universalClassName); |
-- updatePetSpellNames(universalClassName); |
updatePetSpellNames(); |
end |
-- "Manually" add spells we cannot (or is not convenient to) get automatically |
-- PLAYER_LOGIN event handler; we set up the other events when this one fires -- |
SN2SID_frame:SetScript("OnEvent", function(self, event) |
C_Timer.After(3, lsn2sidpStartup); |
end); |