Module:Item Navbox: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) No edit summary |
Gammaton32 (talk | contribs) added codename navbox function |
||
| (One intermediate revision by the same user not shown) | |||
| Line 76: | Line 76: | ||
table.sort(items) | table.sort(items) | ||
end | |||
-- Append closing tags and bullets | |||
local total_items = #items | |||
for i = 1, total_items do | |||
if i == total_items then | |||
items[i] = items[i] .. '</span>' | |||
else | |||
items[i] = items[i] .. '<span class="item-nav-search-sep"> • </span></span>' | |||
end | |||
end | |||
return table.concat(items, '') | |||
end | |||
-- Gets list of item codenames | -- Gets list of item codenames | ||
local function get_item_codenames(slot, min_souls, max_souls, filter_mode) | local function get_item_codenames(slot, min_souls, max_souls, filter_mode, frame) | ||
if slot ~= 'Weapon' and slot ~= 'Armor' and slot ~= 'Tech' then return '' end | if slot ~= 'Weapon' and slot ~= 'Armor' and slot ~= 'Tech' then return '' end | ||
local lang_code = lang_module.get_lang_code() | local lang_code = lang_module.get_lang_code() | ||
local items = {} | local items = {} | ||
local slot_items = get_items_by_slot(slot) | local slot_items = get_items_by_slot(slot) | ||
| Line 104: | Line 116: | ||
local item_name_english = lang_module.get_string(item_key, "en") | local item_name_english = lang_module.get_string(item_key, "en") | ||
local item_name_local = lang_module.get_string(item_key, lang_code) | local item_name_local = lang_module.get_string(item_key, lang_code) | ||
local item_codename = items_module.get_codename( | |||
local codename_frame = { | |||
args = { item_name_english } | |||
} | |||
local item_codename = items_module.get_codename(codename_frame) | |||
local item_template | local item_template | ||
if lang_code == "en" then | if lang_code == "en" then | ||
item_template = "{{ItemIcon|" .. item_codename .. "|size=26px}}" | item_template = "{{ItemIcon|" .. item_name_english .. "|l1=" .. item_codename .. "|size=26px}}" | ||
else | else | ||
item_template = "{{ItemIcon|" .. item_name_english .. "|lang=" .. lang_code .. "|l1=" .. item_name_local .. "|size=26px}}" | item_template = "{{ItemIcon|" .. item_name_english .. "|lang=" .. lang_code .. "|l1=" .. item_name_local .. "|size=26px}}" | ||