Module:Resource/data
Jump to navigation
Jump to search
Defines all the information about each resource type including name, icon, aliases, link, category, etc.
This is separated out into its own file to take advantage of mw.loadData. This table will be loaded and processed once per page rather than once per module invocation.
File tree
- Module:Resource
- Module:Resource/data: Defines all the resources and their associated icons, links, categories, etc.
- Module:Resource/doc: Documentation page
- Template:Resource: Wrapper template for end users
-- Table of reaction resources
-- Required values
-- name: Formatted wikitext to display for this reaction
-- icon: Icon file associated with the resource
-- Optional values:
-- plural: If the plural form of the resource name is not just appending "s" to the end, specify it here
-- aliases: Any additional aliases that can be used to refer to this resource
-- category: Category for actions that consume this resource
-- cropping: Crop this percentage from each side of the icon. This is for icons with excessive whitespace
local resources = {
-- Common resources
{
aliases = {"action"},
name = "Action",
link = "Actions#Resources",
icon = "Action Icon.png",
cropping = 15,
category = "Actions"
},
{
aliases = {"bonus", "ba", "bonus action"},
name = "Bonus Action",
link = "Actions#Resources",
icon = "Bonus Action Icon.png",
cropping = 15,
category = "Bonus actions"
},
{
aliases = {"reaction"},
name = "Reaction",
link = "Actions#Reactions",
icon = "Reaction Icon.png",
cropping = 15,
category = "Reactions"
},
{
aliases = {"movement", "movement m", "m"},
name = "Movement Speed",
plural = "Movement Speed",
link = "Resources#Movement speed",
icon = "Movement Speed Icon.png",
cropping = 15,
category = "Movement-expending actions"
},
{
aliases = {"half movement", "1/2 movement"},
name = "Movement Speed (Half cost)",
plural = "Movement Speed (Half cost)",
link = "Resources#Movement speed",
icon = "Movement Speed Icon.png",
cropping = 15,
category = "Movement-expending actions"
},
{
aliases = {"spell1", "s1", "level1", "l1"},
name = "Level 1 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"spell2", "s2", "level2", "l2"},
name = "Level 2 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"spell3", "s3", "level3", "l3"},
name = "Level 3 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"spell4", "s4", "level4", "l4"},
name = "Level 4 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"spell5", "s5", "level5", "l5"},
name = "Level 5 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"spell6", "s6", "level6", "l6"},
name = "Level 6 Spell Slot",
link = "Spells#Spell slots",
icon = "Spell Slot Icon.png",
},
{
aliases = {"shadowspell3", "shadow spell", "ss3", "shadowlevel3", "sl3"},
name = "Level 3 Shadow Spell Slot",
link = "Permanent bonuses#Consumed Shadow Weave",
icon = "Shadow Spell Slot Icon.png",
},
{
aliases = {"wspell", "wsp"},
name = "Warlock Spell Slot",
link = "Spells#Pact Magic",
icon = "Warlock Spell Slot Icon.webp",
},
-- Class resources
{
aliases = {"arcarr", "aa", "arcane arrow"},
name = "Arcane Arrow",
link = "Arcane Archer#Arcane Arrow",
icon = "Arcane Arrow Resource Icon.png",
},
{
aliases = {"arcrec", "ar", "arcane recovery"},
name = "Arcane Recovery Charge",
link = "Arcane Recovery",
icon = "Arcane Recovery Charges Icons.png",
},
{
aliases = {"bi", "bardin", "bardic inspiration"},
name = "Bardic Inspiration",
link = "Bardic Inspiration (resource)",
icon = "Bardic Inspiration Resource Icon.png",
category = "Bardic Inspiration actions"
},
{
aliases = {"bladesong", "bs", "bsp", "bladesong power"},
name = "Bladesong Power",
plural = "Bladesong Power",
link = "Bladesinging#Level 2",
icon = "Bladesong Resource Icon.png",
},
{
aliases = {"cd", "chadiv", "channel divinity"},
name = "Channel Divinity Charge",
link = "Channel Divinity Charge",
icon = "Channel Divinity Charges Icons.png",
category = "Channel Divinity actions",
},
{
aliases = {"co", "oath", "chao", "chaoat", "channel oath"},
name = "Channel Oath Charge",
link = "Channel Oath Charge",
icon = "Channel Oath Icon.png",
category = "Channel Oath actions"
},
{
aliases = {"cos", "cosmic", "omen", "cosmic omen"},
name = "Cosmic Omen",
link = "Circle of the Stars#Level 6",
icon = "Cosmic Omen Resource Icon.png",
},
{
aliases = {"es", "eyestalk", "eyestalk action"},
name = "Eyestalk action",
link = "Spectator#Combat",
icon = "Eyestalk Action Icon.png",
},
{
aliases = {"fi", "fnginf", "fungal infestation"},
name = "Fungal Infestation Charge",
link = "Circle of the Spores#Level 6",
icon = "Fungal Infestation Charge Icon.png",
},
{
aliases = {"ki"},
name = "Ki Point",
icon = "Monk Ki Icon.png",
link = "Ki Point",
category = "Ki actions"
},
{
aliases = {"loh", "lh", "layonh", "lay on hands"},
name = "Lay on Hands Charge",
link = "Paladin#Level 1",
icon = "Lay on Hands Resource Icon.png",
},
{
aliases = {"luck", "lp", "lukpnt", "luck point"},
name = "Luck Point",
link = "Lucky",
icon = "Luck Point Resource Icon.png",
},
{
aliases = {"natrec", "nr", "natural recovery"},
name = "Natural Recovery Charge",
link = "Natural Recovery",
icon = "Natural Recovery Charges Icon.png",
},
{
aliases = {"rage", "rg"},
name = "Rage Charge",
link = "Rage Charge",
icon = "Rage Charges Icons.png",
category = "Rage actions"
},
{
aliases = {"sp", "srcpnt", "sorcery", "sorcery point"},
name = "Sorcery Point",
link = "Sorcery Point",
icon = "Sorcery Points Icons.png",
category = "Sorcery Points actions"
},
{
aliases = {"starmap", "sm", "star map"},
name = "Star Map",
link = "Circle of the Stars#Level 2",
icon = "Star Map Resource Icon.png",
},
{
aliases = {"supdie", "sd", "superiority die"},
name = "Superiority Die",
plural = "Superiority Dice",
link = "Battle Master#Level 3",
icon = "Superiority Die d8 Icon.png",
category = "Combat manoeuvres"
},
{
aliases = {"toc", "tides", "tides of chaos"},
name = "Tides of Chaos Charge",
link = "Tides of Chaos",
icon = "Tides of Chaos Resource Icon.png",
},
{
aliases = {"wc", "writhing", "writhing current"},
name = "Writhing Current",
link = "Swarmkeeper#Level 7",
icon = "Writhing Current Resource Icon.png",
},
{
aliases = {"ws", "wldshp", "wildshape", "wild shape"},
name = "Wild Shape Charge",
link = "Druid#Level 2",
icon = "Wild Shape Charges Icon.png",
category = "Wild Shape actions"
},
{
aliases = {"wp", "warpri", "war priest"},
name = "War Priest Charge",
link = "War Domain#Level 1",
icon = "War Priest Charges Icon.png",
},
}
local aliases = {}
local alias_warnings = {}
for idx, resource in ipairs(resources) do
for _, alias in ipairs(resource.aliases or {}) do
if aliases[alias] ~= nil then
table.insert(
alias_warnings,
string.format("Alias \"%s\" defined for \"%s\" and \"%s\".",
alias,
resources[aliases[alias]].name,
resource.name
)
)
end
aliases[alias] = idx
end
end
return {
resources = resources,
aliases = aliases,
alias_warnings = alias_warnings
}