Module:ItemData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
added raw variable to get_type for non-localized item_type return |
proper item_type output instead of codenames |
||
| Line 62: | Line 62: | ||
local function get_type(item_name, raw) | local function get_type(item_name, raw) | ||
local item = get_json_item(item_name) | local item = get_json_item(item_name) | ||
if | if not item then | ||
return "<span style=\"color:red;\">Item Not Found.</span>" | |||
end | |||
local slot = item["Slot"] | local slot = item["Slot"] | ||
if not slot then return nil end | if not slot then return nil end | ||
local key_map = { | |||
Weapon = 'CitadelCategoryWeapon', | |||
Armor = 'CitadelCategoryArmor', | |||
Tech = 'CitadelCategoryTech' | |||
} | |||
local key = key_map[slot] | |||
if not key then return nil end | |||
if raw then | if raw then | ||
return lang.get_string(key, "en") | |||
else | |||
return lang.get_string(key) | |||
return lang.get_string( | |||
return lang.get_string( | |||
end | end | ||
end | end | ||