You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
59 lines
1.8 KiB
local addonName, addon = ...
|
|
|
|
-- Mage Polymorph Tomes tab
|
|
|
|
PolymorphsMixin = CreateFromMixins(ShapeshiftsMixin)
|
|
|
|
function PolymorphsMixin:OnLoad()
|
|
if select(2, UnitClass("player")) ~= "MAGE" then return end
|
|
self.shapeshiftEntryFrames = {};
|
|
|
|
self.shapeshiftLayoutData = {};
|
|
|
|
if not self.numKnownShapeshifts then self.numKnownShapeshifts = 0 end
|
|
if not self.numPossibleShapeshifts then self.numPossibleShapeshifts = 0 end
|
|
|
|
-- Note: tried using Spell:CreateFromSpellID and Spell:ContinueOnSpellLoad
|
|
-- this led to taint issues with the spellbook frame
|
|
-- I guess this addon calling those functions tainted the whole chain
|
|
-- which the spellbook frame tried to use later on
|
|
-- Have to use the more... primitive version instead
|
|
|
|
local name = GetSpellInfo(118)
|
|
self.tabName = name
|
|
if not name then
|
|
local ticker = C_Timer.NewTicker(1, function()
|
|
name = GetSpellInfo(118)
|
|
if name then
|
|
self.tabName = name
|
|
ticker:Cancel()
|
|
end
|
|
end)
|
|
end
|
|
|
|
addon.ParentMixin.OnLoad(self)
|
|
end
|
|
|
|
function PolymorphsMixin:SortShapeshiftsIntoEquipmentBuckets()
|
|
-- Sort them into equipment buckets
|
|
local equipBuckets = {};
|
|
|
|
for _, shapeshiftData in pairs(addon.PolymorphTomesDB) do
|
|
if not equipBuckets[1] then
|
|
equipBuckets[1] = {}
|
|
end
|
|
|
|
table.insert(equipBuckets[1], shapeshiftData)
|
|
|
|
if self:IsCollected(shapeshiftData) then
|
|
self.numKnownShapeshifts = self.numKnownShapeshifts + 1
|
|
end
|
|
self.numPossibleShapeshifts = self.numPossibleShapeshifts + 1
|
|
end
|
|
|
|
return equipBuckets;
|
|
end
|
|
|
|
function PolymorphsMixin:IsCollected(data)
|
|
return IsPlayerSpell(data.spellID)
|
|
end
|
|
|