Module:AbilityHints: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m add healingtempo automatic hint |
m Adjust to the new AbilityTable contracts. This restores abilityhints |
||
| Line 2: | Line 2: | ||
-- Used by Template:AbilitySection. Styles are there too. | -- Used by Template:AbilitySection. Styles are there too. | ||
local CONFIG = { | local CONFIG = { | ||
{ list = "melee", file = "Melee Lifesteal.png", tip = "Benefits from melee items (e.g. [[Melee Lifesteal]])" }, | { list = "melee", file = "Melee Lifesteal.png", tip = "Benefits from melee items (e.g. [[Melee Lifesteal]])" }, | ||
| Line 25: | Line 17: | ||
} | } | ||
-- Display order: item | local AbilityTable = require("Module:AbilityTable") | ||
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json") | |||
local item_data = mw.loadJsonData("Data:ItemData.json") | |||
local p = {} | |||
-- Display order: item type (Weapon => Vitality => Spirit), then cost, then name. | |||
local function sort_key(file) | local function sort_key(file) | ||
local base = mw.ustring.lower((file:gsub('%.%w+$', ''))) | local base = mw.ustring.lower((file:gsub('%.%w+$', ''))) | ||
| Line 93: | Line 91: | ||
local placed = {} | local placed = {} | ||
local num = tonumber(ability_num) | |||
for _, def in ipairs(CONFIG) do | |||
if AbilityTable.is_member(def.list, ability_key, num) then | |||
local key = mw.ustring.lower(def.file) | |||
local m = manual_by_file[key] | |||
if m ~= nil then | |||
table.insert(entries, { file = m.file, html = manual_icon(m) }) | |||
placed[key] = true | |||
else | |||
table.insert(entries, { file = def.file, html = hint_icon(def) }) | |||
end | end | ||
end | end | ||