diff --git a/SpellCalc.toc b/SpellCalc.toc index 551497d..ad315f5 100644 --- a/SpellCalc.toc +++ b/SpellCalc.toc @@ -1,7 +1,7 @@ ## Interface: 30400 ## Title: SpellCalc ## Author: coolmodi -## Version: 0.18 +## Version: 0.19 ## Notes: Shows some numbers for spells ## SavedVariables: SpellCalc_settings ## OptionalDeps: Dominos, ElvUI, Bartender4 @@ -41,6 +41,7 @@ data/classes/rogue_spell.lua data/classes/shaman_spell.lua data/classes/warlock_spell.lua data/classes/warrior_spell.lua +data/classes/deathknight_spell.lua data/classes/druid_itemEffects.lua data/classes/hunter_itemEffects.lua data/classes/mage_itemEffects.lua @@ -69,6 +70,7 @@ data/classes/rogue.lua data/classes/shaman.lua data/classes/warlock.lua data/classes/warrior.lua +data/classes/deathknight.lua data/racials.lua diff --git a/data/classes/deathknight.lua b/data/classes/deathknight.lua new file mode 100644 index 0000000..7439f14 --- /dev/null +++ b/data/classes/deathknight.lua @@ -0,0 +1,9 @@ +---@class AddonEnv +local _addon = select(2, ...); +local _, playerClass = UnitClass("player"); +if playerClass ~= "DEATHKNIGHT" then + return; +end + +---@type TalentDataRawEntry[] +_addon.talentDataRaw = {} diff --git a/data/classes/deathknight_spell.lua b/data/classes/deathknight_spell.lua new file mode 100644 index 0000000..0154831 --- /dev/null +++ b/data/classes/deathknight_spell.lua @@ -0,0 +1,27 @@ +-- GENERATED + +---@class AddonEnv +local _addon = select(2, ...); +local _, playerClass = UnitClass("player"); +if playerClass ~= "DEATHKNIGHT" then + return; +end + +---@type SpellInfoTable +_addon.spellInfo = {}; + +---@type SpellClassSet +_addon.spellClassSet = { + [1] = { + }, + [2] = { + }, + [3] = { + }, + [4] = { + }, +}; + +---@type ClassGlyphs +_addon.classGlyphs = {}; + diff --git a/data/classes/hunter.lua b/data/classes/hunter.lua index b4d2499..aa0362f 100644 --- a/data/classes/hunter.lua +++ b/data/classes/hunter.lua @@ -5,3 +5,5 @@ if playerClass ~= "HUNTER" then return; end +---@type TalentDataRawEntry[] +_addon.talentDataRaw = {} diff --git a/data/classes/hunter_spell.lua b/data/classes/hunter_spell.lua index 7dee4e1..f95ca82 100644 --- a/data/classes/hunter_spell.lua +++ b/data/classes/hunter_spell.lua @@ -7,9 +7,21 @@ if playerClass ~= "HUNTER" then return; end -_addon.spellBaseInfo = {}; - +---@type SpellInfoTable _addon.spellInfo = {}; ---@type SpellClassSet -_addon.spellClassSet = {}; +_addon.spellClassSet = { + [1] = { + }, + [2] = { + }, + [3] = { + }, + [4] = { + }, +}; + +---@type ClassGlyphs +_addon.classGlyphs = {}; + diff --git a/data/classes/rogue.lua b/data/classes/rogue.lua index d0c79b5..d71bcb3 100644 --- a/data/classes/rogue.lua +++ b/data/classes/rogue.lua @@ -3,4 +3,7 @@ local _addon = select(2, ...); local _, playerClass = UnitClass("player"); if playerClass ~= "ROGUE" then return; -end \ No newline at end of file +end + +---@type TalentDataRawEntry[] +_addon.talentDataRaw = {} diff --git a/data/classes/rogue_spell.lua b/data/classes/rogue_spell.lua index 0d2e823..16281d8 100644 --- a/data/classes/rogue_spell.lua +++ b/data/classes/rogue_spell.lua @@ -7,9 +7,20 @@ if playerClass ~= "ROGUE" then return; end -_addon.spellBaseInfo = { -}; +---@type SpellInfoTable +_addon.spellInfo = {}; -_addon.spellInfo = { +---@type SpellClassSet +_addon.spellClassSet = { + [1] = { + }, + [2] = { + }, + [3] = { + }, + [4] = { + }, }; +---@type ClassGlyphs +_addon.classGlyphs = {}; diff --git a/data/classes/warrior.lua b/data/classes/warrior.lua index e8281dd..56acb06 100644 --- a/data/classes/warrior.lua +++ b/data/classes/warrior.lua @@ -3,4 +3,7 @@ local _addon = select(2, ...); local _, playerClass = UnitClass("player"); if playerClass ~= "WARRIOR" then return; -end \ No newline at end of file +end + +---@type TalentDataRawEntry[] +_addon.talentDataRaw = {} diff --git a/data/classes/warrior_spell.lua b/data/classes/warrior_spell.lua index 30e8eee..4070fce 100644 --- a/data/classes/warrior_spell.lua +++ b/data/classes/warrior_spell.lua @@ -7,10 +7,20 @@ if playerClass ~= "WARRIOR" then return; end -_addon.spellBaseInfo = { -}; - ---@type SpellInfoTable -_addon.spellInfo = { +_addon.spellInfo = {}; + +---@type SpellClassSet +_addon.spellClassSet = { + [1] = { + }, + [2] = { + }, + [3] = { + }, + [4] = { + }, }; +---@type ClassGlyphs +_addon.classGlyphs = {}; diff --git a/events.lua b/events.lua index 50baf28..33d95f0 100644 --- a/events.lua +++ b/events.lua @@ -3,14 +3,6 @@ local _addonName = select(1, ...); ---@class AddonEnv local _A = select(2, ...); --- dirty fix to "disable" the addon preventing errors on unsupported classes --- TODO: Remove when classes are supported -local _, class = UnitClass("player"); -if class == "WARRIOR" or class == "ROGUE" or class == "HUNTER" or class == "DEATHKNIGHT" then - _A.util.PrintError("Class not (yet) supported, addon won't work!"); - return; -end - local frame = CreateFrame("Frame"); ---@type table @@ -36,6 +28,13 @@ end); ---@param event string ---@param callback fun(...:any):boolean|nil local function Register(event, callback) + -- dirty fix to "disable" the addon preventing errors on unsupported classes + -- TODO: Remove when classes are supported + local _, class = UnitClass("player"); + if class == "WARRIOR" or class == "ROGUE" or class == "HUNTER" or class == "DEATHKNIGHT" then + return; + end + handlers[event] = handlers[event] or {}; table.insert(handlers[event], callback); if #handlers[event] == 1 then frame:RegisterEvent(event) end @@ -66,16 +65,12 @@ end Register("ADDON_LOADED", function (addonName) if addonName ~= _addonName then return end - if not loadedCallbacks then return end - for _, f in ipairs(loadedCallbacks) do - f(); - end - loadedCallbacks = nil; - - if _A.spellInfo == nil or _A.talentDataRaw == nil then - _A.util.PrintError(_addonName .. ": No data for this class (yet)! Addon won't work!"); + if loadedCallbacks then + for _, f in ipairs(loadedCallbacks) do + f(); + end + loadedCallbacks = nil; end - return true; end);