Module:ItemData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m Fix string to number conversion |
Pull item type from lang files |
||
| Line 1: | Line 1: | ||
local lang = require "Module:Lang" | |||
local p = {}; | local p = {}; | ||
local data = mw.loadJsonData("Data:ItemData.json") | local data = mw.loadJsonData("Data:ItemData.json") | ||
| Line 32: | Line 34: | ||
-- Adds commas delimiter to the thousands place | -- Adds commas delimiter to the thousands place | ||
local function Format(amount) | local function Format(amount) | ||
local contentLanguage = mw.language.getContentLanguage() | |||
local formatted = amount | local formatted = amount | ||
if(type(formatted) ~= "number") then return "<span style=\"color:red;\">Cannot format non-number value.</span>" end | if(type(formatted) ~= "number") then return "<span style=\"color:red;\">Cannot format non-number value.</span>" end | ||
return | return contentLanguage:formatNum(tonumber(formatted)) | ||
end | end | ||
| Line 58: | Line 60: | ||
if (item["Slot"] == "Weapon") then | if (item["Slot"] == "Weapon") then | ||
return | return lang.get_string('CitadelCategoryWeapon') | ||
elseif (item["Slot"] == "Armor") then | elseif (item["Slot"] == "Armor") then | ||
return | return lang.get_string('CitadelCategoryArmor') | ||
elseif (item["Slot"] == "Tech") then | elseif (item["Slot"] == "Tech") then | ||
return | return lang.get_string('CitadelCategoryTech') | ||
else | else | ||
return nil | return nil | ||