-- Create an empty Attribute object
local Attribute = {
name = nil,
link = nil,
nonStandard = nil,
uppercase = true
}
-- Table with data on each Attribute
local attributesData = {
['LIGHT'] = { link = 'LIGHT' },
['DARK'] = { link = 'DARK' },
['WATER'] = { link = 'WATER' },
['FIRE'] = { link = 'FIRE' },
['EARTH'] = { link = 'EARTH' },
['WIND'] = { link = 'WIND' },
['DIVINE'] = { link = 'DIVINE' },
['THUNDER'] = { link = 'THUNDER' },
['WOOD'] = { link = 'WOOD' },
['LAUGH'] = { link = 'Attribute#LAUGH', nonStandard = true },
['DRAGON'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['PRESS'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['PHOTO'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['MONEY'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['BATTLE'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['LOVE'] = { link = 'Attribute#Newspaper Club', nonStandard = true },
['?'] = { link = '?' },
['???'] = { link = '???' }
}
-- Add aliases
attributesData['ELECTRIC'] = attributesData['THUNDER']
attributesData['FOREST'] = attributesData['WOOD']
-- Create a new instance of an Attribute object
function Attribute:new(name)
-- Create a new instance of the Attribute class with all the default values
local a = mw.clone(Attribute)
-- Look up data based on the supplied name
local data = attributesData[string.upper(name)] or {}
-- Populate the instance with found data
a.name = data.name or name
a.link = data.link or string.upper(a.name)
a.nonStandard = data.nonStandard or false
if (a.uppercase) then
a.name = string.upper(a.name)
end
return a
end
return Attribute