From fa5a42b0fbfeaebcd1e67c2b8f991deb53fd3b14 Mon Sep 17 00:00:00 2001 From: 4n0n <4n0n@tinkr.site> Date: Thu, 2 Feb 2023 11:10:35 -0600 Subject: [PATCH] Spellbook emmy lua --- .gitignore | 6 ++++++ src/SpellBook/SpellBook.lua | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.gitignore b/.gitignore index 7bb1f9d..1c25d92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ ## Ignore mac files .DS_Store DS_Store + +## whitelist .gitkeep files +!.gitkeep + +## ignore all files in scripts +scripts/* diff --git a/src/SpellBook/SpellBook.lua b/src/SpellBook/SpellBook.lua index 952596f..c99fc8f 100644 --- a/src/SpellBook/SpellBook.lua +++ b/src/SpellBook/SpellBook.lua @@ -23,6 +23,24 @@ function SpellBook:GetSpell(id) return self.spells[id] end +---@param ... number[] +---@return Spell, ... Spell +function SpellBook:GetSpells(...) + local spells = {} + for _, id in ipairs({ ... }) do + table.insert(spells, self:GetSpell(id)) + end + + return unpack(spells) +end + +---@param name string +---@return Spell +function SpellBook:GetSpellByName(name) + local _, rank, icon, castTime, minRange, maxRange, spellID, originalIcon = GetSpellInfo(name) + return self:GetSpell(spellID) +end + ---@return Spell function SpellBook:GetIfRegistered(id) return self.spells[id]