Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m Missing altbox number checks |
m Use resource lookup for faster hero key retrieval |
||
| Line 5: | Line 5: | ||
local p = {} | local p = {} | ||
local data = mw.loadJsonData("Data:AbilityCards.json") | local data = mw.loadJsonData("Data:AbilityCards.json") | ||
local resourceLookup = mw.loadJsonData("Data:ResourceLookup.json") | |||
-- Maps attr type to an appropriate image and page link | -- Maps attr type to an appropriate image and page link | ||
-- Optional icon size, will be defaulted on the template | -- Optional icon size, will be defaulted on the template | ||
local ATTR_TYPE_ICON_MAP = require("Module:Icon/attr") | local ATTR_TYPE_ICON_MAP = require("Module:Icon/attr") | ||
| Line 23: | Line 17: | ||
-- if name starts with "hero_", use it directly as the key | -- if name starts with "hero_", use it directly as the key | ||
if string.sub(hero_name, 1, 5) == "hero_" then return hero_name end | if string.sub(hero_name, 1, 5) == "hero_" then return hero_name end | ||
return resourceLookup[hero_name:lower()].key | |||
end | end | ||