Module:Abilities

-- local p = {}

local data = require("Module:Abilities/Data")

- Ability Infobox - local infobox_template = [=[

]=]

function p.Infobox(frame) local ability_name = frame.args[1] or mw.title.getCurrentTitle.text local ability = data.abilities[ability_name] if ability == nil then return "Ability infobox data not found for \"" .. ability_name .. "\". Check the parameter or add the data to Module:Abilities/Data." end local category = "" return frame:preprocess(string.format(infobox_template, ability_name, ability_name, ability.Class or "", ability.Movement and "✓" or "", ability.Damage or "", ability.Heal or "", ability.Shield or "", ability.Effect or "", ability.Duration or "", ability.Cooldown or "", ability.CooldownDelay and " * " or "", ability.Description, category )) end

- Ability List - function AbilityList local abilities = {} for ability_name, ability in pairs(data.abilities) do   ability.Name = ability_name table.insert(abilities, ability) end table.sort(abilities, function(a, b) return a.Class == b.Class and a.Name < b.Name or a.Class < b.Class end) return abilities end

- Ability Table - local abilities_table_head = [=[ {| class="article-table sortable" style="text-align:center;font-size:75%" width="100%" ! style="text-align:center" class="unsortable" | Icon ! style="text-align:center" | Abilitiy ! style="text-align:center" | Class ! style="text-align:center" | Movement ! style="text-align:center" data-sort-type="number" | Cooldown ! style="text-align:center" data-sort-type="number" | Damage ! style="text-align:center" class="unsortable" | Description ]=]

local abilities_table_row = [=[ ]=]
 * Ability_%s.png
 * %s
 * %s
 * %s
 * %s%s
 * %s
 * %s
 * %s

function p.List(frame) local list = abilities_table_head for _, ability in pairs(AbilityList) do   list = list .. string.format(abilities_table_row,     ability.Name,      ability.Name,      ability.Name,      ability.Class,      ability.Movement and "✓" or "",      ability.Cooldown or "",      ability.CooldownDelay and " * " or "",      ability.Damage or "",      ability.Description    ) end list = list .. "|}" return list end

return p --