Bastion aims to serve as a highly performant, simplisitic, and expandable World of Warcraft data visualization framework.
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.
Bastion/src/Class/Class.lua

75 lines
1.3 KiB

2 years ago
local Tinkr, Bastion = ...
-- Create a new Class class
---@class Class
2 years ago
local Class = {}
function Class:__index(k)
local response = Bastion.ClassMagic:Resolve(Class, k)
if response == nil then
response = rawget(self, k)
end
if response == nil then
error("Class:__index: " .. k .. " does not exist")
end
return response
end
1 year ago
---@class Class
---@field class Class.class
---@class Class.class
---@field locale string
---@field name string
---@field id number
2 years ago
-- Constructor
2 years ago
---@param locale string
---@param name string
---@param id number
2 years ago
function Class:New(locale, name, id)
local self = setmetatable({}, Class)
1 year ago
2 years ago
self.class = {
locale = locale,
name = name,
id = id
}
return self
end
-- Get the classes locale
2 years ago
---@return string
2 years ago
function Class:GetLocale()
return self.class.locale
end
-- Get the classes name
2 years ago
---@return string
2 years ago
function Class:GetName()
return self.class.name
end
-- Get the classes id
2 years ago
---@return number
2 years ago
function Class:GetID()
return self.class.id
end
1 year ago
---@class ColorMixin
---@field r number
---@field g number
---@field b number
2 years ago
-- Return the classes color
2 years ago
---@return ColorMixin classColor
2 years ago
function Class:GetColor()
return C_ClassColor.GetClassColor(self.class.name)
end
1 year ago
2 years ago
return Class