Module:ItemData/nav: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) changed street brawl tag to use soul color |
Gammaton32 (talk | contribs) added override for Bullet Lifesteal and Spirit Lifesteal in ItemBox |
||
| Line 4: | Line 4: | ||
local generic_module = require('Module:GenericData') | local generic_module = require('Module:GenericData') | ||
local util_module = require('Module:Utilities') | local util_module = require('Module:Utilities') | ||
--exceptions if the link is different from the item name | |||
local linkOverrides = { | |||
["Bullet Lifesteal"] = "Bullet Lifesteal (item)", | |||
["Spirit Lifesteal"] = "Spirit Lifesteal (item)" | |||
} | |||
--With debug_mode on, it outputs unprocessed wikitext | --With debug_mode on, it outputs unprocessed wikitext | ||
| Line 54: | Line 60: | ||
if slot == this_slot and this_cost >= min_souls and this_cost < max_souls then | if slot == this_slot and this_cost >= min_souls and this_cost < max_souls then | ||
local item_name_english = lang_module.get_string(item_key, "en") -- Get the English name | local item_name_english = lang_module.get_string(item_key, "en") -- Get the English name | ||
local item_link = linkOverrides[item_name_english] or item_name_english -- Use override link if available | |||
local lang_code = lang_module.get_lang_code() -- Get the language code from the subpage | local lang_code = lang_module.get_lang_code() -- Get the language code from the subpage | ||
local item_name_local = lang_module.get_string(item_key, lang_code) -- Get the localized name | local item_name_local = lang_module.get_string(item_key, lang_code) -- Get the localized name | ||
| Line 70: | Line 77: | ||
if lang_code == "en" then | if lang_code == "en" then | ||
-- For English pages, do not include item_loc or link | -- For English pages, do not include item_loc or link | ||
item_template = "{{ItemBox|item_name=" .. item_name_english .. "}}" | item_template = "{{ItemBox|item_name=" .. item_name_english .. "|link=" .. item_link .. "}}" | ||
else | else | ||
-- For non-English pages, include item_loc and link | -- For non-English pages, include item_loc and link | ||
local | local link_local = item_link .. "/" .. lang_code -- Add subpage for non-English languages | ||
item_template = "{{ItemBox|item_name=" .. item_name_english .. "|item_loc=" .. item_name_local .. "|link=" .. | item_template = "{{ItemBox|item_name=" .. item_name_english .. "|item_loc=" .. item_name_local .. "|link=" .. link_local .. "}}" | ||
end | end | ||
else | else | ||