---@type Tinkr, Bastion local Tinkr, Bastion = ... ---@alias itemId integer -- Create a new ItemBook class ---@class Bastion.ItemBook ---@field items table local ItemBook = {} ItemBook.__index = ItemBook -- Constructor ---@return Bastion.ItemBook function ItemBook:New() local self = setmetatable({}, ItemBook) self.items = {} ---@param itemId itemId ---@param success boolean Bastion.Globals.EventManager:RegisterEvent("ITEM_DATA_LOAD_RESULT", function(itemId, success) if itemId and success and self.items[itemId] then self.items[itemId]:Update() end end) return self end -- Get a spell from the ItemBook ---@param id number ---@return Bastion.Item function ItemBook:GetItem(id) if self.items[id] == nil then self.items[id] = Bastion.Item:New(id) end return self.items[id] end return ItemBook