Editing Module:AbilityInteraction

Jump to navigation Jump to search
Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-- Renders a standard interaction box for the interactions tab of {{AbilitySection}}.
-- Entry point: {{#invoke:AbilityInteraction|box}}, via Template:AbilityInteraction.
--
-- Presentation for each interaction lives in REGISTRY below. Call sites pick an
-- interaction by name and supply body text only; nothing else is customisable.
-- Anything bespoke should use {{IconBox}} directly rather than growing parameters here.
--
-- To add an interaction, add a REGISTRY entry:
-- To add an interaction, add a REGISTRY entry:
--  aliases  = other names resolving to this entry
--  aliases  = other names resolving to this entry; assumed not to overlap
--  title    = header text
--  title    = header text
--  type    = positive | negative | info
--  type    = positive | negative | info
--  iconfile = image file name, without the "File:" prefix
--  iconfile = image file name, without the File: prefix
--  link    = wiki page name, or a full URL
--  link    = wiki page name, or a full URL
local p = {}
local getArgs = require('Module:Arguments').getArgs


local REGISTRY = {
local REGISTRY = {
['ability duration'] = {
aliases  = { 'duration', 'duration extender' },
title    = 'Ability Duration',
type    = 'positive',
iconfile = 'Duration Extender.png',
link    = 'Ability Duration',
},
['ability range'] = {
aliases  = { 'range', 'greater expansion' },
title    = 'Ability Range',
type    = 'positive',
iconfile = 'Greater Expansion.png',
link    = 'Ability Range',
},
['cooldown'] = {
aliases  = {'ability cooldown', 'superior cooldown' },
title    = 'Ability Cooldown Reduction',
type    = 'positive',
iconfile = 'Superior Cooldown.png',
link    = 'Ability Cooldown',
},
['debuff resist'] = {
['debuff resist'] = {
aliases  = { 'debuff reducer' },
aliases  = { 'debuff reducer' },
Line 42: Line 32:
link    = 'Dispel Magic',
link    = 'Dispel Magic',
},
},
['echo shard'] = {
['unstoppable'] = {
aliases  = {},
aliases  = {},
title    = 'Echo Shard',
title    = 'Unstoppable',
type    = 'positive',
iconfile = 'Echo Shard.png',
link    = 'Echo Shard',
},
['heal'] = {
aliases  = {'healing', 'healing booster'},
title    = 'Healing',
type    = 'positive',
iconfile = 'Healing Booster.png',
link    = 'Healing',
},
['heroic aura'] = {
aliases  = {},
title    = 'Heroic Aura',
type    = 'positive',
iconfile = 'Heroic Aura.png',
link    = 'Heroic Aura',
},
['indomitable'] = {
aliases  = {},
title    = 'Indomitable',
type    = 'negative',
type    = 'negative',
iconfile = 'Indomitable.png',
iconfile = 'Unstoppable.png',
link    = 'Indomitable',
link    = 'Unstoppable',
},
['interrupt'] = {
aliases  = { 'knockdown', 'stun' },
title    = 'Interrupt',
type    = 'negative',
iconfile = 'Knockdown.png',
link    = 'Knockdown',
},
['monster rounds'] = {
aliases  = {},
title    = 'Monster Rounds',
type    = 'negative',
iconfile = 'Monster Rounds.png',
link    = 'Monster Rounds',
},
['plated armor'] = {
aliases  = {},
title    = 'Plated Armor',
type    = 'negative',
iconfile = 'Plated Armor.png',
link    = 'Plated Armor',
},
['reactive barrier'] = {
aliases  = {},
title    = 'Reactive Barrier',
type    = 'negative',
iconfile = 'Reactive Barrier.png',
link    = 'Reactive Barrier',
},
},
['slowing hex'] = {
['slowing hex'] = {
aliases  = {},
aliases  = {},
title    = 'Slowing Hex',
title    = 'Slowing Hex',
type    = 'negative',
type    = 'info',
iconfile = 'Slowing Hex.png',
iconfile = 'Slowing Hex.png',
link    = 'Slowing Hex',
link    = 'Slowing Hex',
},
},
['stealth'] = {
['indomitable'] = {
aliases  = {'Veil Walker'},
title    = 'Stealth',
type    = 'positive',
iconfile = 'Veil Walker.png',
link    = 'Stealth',
},
['unstoppable'] = {
aliases  = {},
aliases  = {},
title    = 'Unstoppable',
title    = 'Indomitable',
type    = 'negative',
type    = 'negative',
iconfile = 'Unstoppable.png',
iconfile = 'Indomitable.png',
link    = 'Unstoppable',
link    = 'Indomitable',
},
},
}
}


local p = {}
-- Lookup index of aliases plus canonical keys, built once.
local getArgs = require('Module:Arguments').getArgs
-- Canonical keys are registered last so they always win.
 
local index = {}
local index = {}
for _, entry in pairs(REGISTRY) do
for _, entry in pairs(REGISTRY) do
for _, alias in ipairs(entry.aliases or {}) do
for _, alias in ipairs(entry.aliases or {}) do
index[mw.ustring.lower(mw.text.trim(alias))] = entry
index[alias] = entry
end
end
end
end
for key, entry in pairs(REGISTRY) do
for key, entry in pairs(REGISTRY) do
index[mw.ustring.lower(mw.text.trim(key))] = entry
index[key] = entry
end
end


Line 173: Line 106:
end
end


-- A function to be used on the Template Doc page to list all available Interactions
-- Registry table for the documentation page. Not used in article space.
function p.list(frame)
function p.list(frame)
local keys = {}
local keys = {}
Line 181: Line 114:
table.sort(keys)
table.sort(keys)


local out = { '{| class="wikitable"', '! Interaction !! Example' }
local out = { '{| class="wikitable"', '! Interaction !! Aliases !! Type !! Example' }
for _, key in ipairs(keys) do
for _, key in ipairs(keys) do
local entry = REGISTRY[key]
local entry = REGISTRY[key]
local names = { '<code>' .. key .. '</code>' }
local aliases = {}
for _, alias in ipairs(entry.aliases or {}) do
for _, alias in ipairs(entry.aliases or {}) do
table.insert(names, '<code>' .. alias .. '</code>')
table.insert(aliases, '<code>' .. alias .. '</code>')
end
end
table.insert(out, '|-')
table.insert(out, '|-')
table.insert(out, '| ' .. table.concat(names, ' / '))
table.insert(out, '| <code>' .. key .. '</code>')
table.insert(out, '| ' .. (#aliases > 0 and table.concat(aliases, ', ') or '—'))
table.insert(out, '| ' .. entry.type)
table.insert(out, '| ' .. frame:expandTemplate{
table.insert(out, '| ' .. frame:expandTemplate{
title = 'AbilityInteraction',
title = 'AbilityInteraction',
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: