Editing Module:Item Navbox

Jump to navigation Jump to search
Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 60: Line 60:
                 if lang_code == "en" then
                 if lang_code == "en" then
                     item_template = "{{ItemIcon|" .. item_name_english .. "|size=26px}}"
                     item_template = "{{ItemIcon|" .. item_name_english .. "|size=26px}}"
                else
                    item_template = "{{ItemIcon|" .. item_name_english .. "|lang=" .. lang_code .. "|l1=" .. item_name_local .. "|size=26px}}"
                end
               
                local search_data = item_name_english
                if lang_code ~= "en" and item_name_local then
                    search_data = search_data .. " " .. item_name_local
                end
               
                item_template = '<span class="item-nav-search-wrapper"><span class="item-nav-search-item" data-item-name="' .. search_data .. '">' .. item_template .. '</span>'
                table.insert(items, item_template)
            end
        end
    end
   
    table.sort(items)
end   
   
-- Gets list of item codenames
local function get_item_codenames(slot, min_souls, max_souls, filter_mode)
    if slot ~= 'Weapon' and slot ~= 'Armor' and slot ~= 'Tech' then return '' end
   
    local lang_code = lang_module.get_lang_code()
    local items = {}
    local slot_items = get_items_by_slot(slot)
   
    for _, item_entry in ipairs(slot_items) do
        local item_key = item_entry.key
        local item_data = item_entry.data
       
        local this_cost = tonumber(item_data["Cost"])
        local is_street_brawl = item_data["StreetBrawl"] == true
        local should_include = true
       
        if filter_mode == "street_brawl_only" and not is_street_brawl then
            should_include = false
        elseif filter_mode == "exclude_street_brawl" and is_street_brawl then
            should_include = false
        end
       
        if should_include and item_data["Name"] ~= nil and item_data["IsDisabled"] == false and this_cost ~= nil then
            if this_cost >= min_souls and this_cost < max_souls then
                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_codename = items_module.get_codename(item_key, item_name_english)
               
                local item_template
                if lang_code == "en" then
                    item_template = "{{ItemIcon|" .. 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}}"
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: