FANDOM


local Infobox = {}
local HF = require('Module:HF')
local FormatNum = require('Module:FormatNum')
local lang = mw.language.new('en')
 
function Infobox.Quantify( field, vars )
    local unit = field.Unit or ''
    local value = field.Value or field.Default or '?'
    if HF.isempty(value) then 
        return '---'
    else
        return value .. ' ' .. unit
    end
end
 
-- fixes numbers with commas, e.g: 4323 to 4,323
function Infobox.FormatCost( field, vars )
    if HF.isempty(field.Value) then
        return '---'
    else
        field.Value = FormatNum.commavalue(field.Value:gsub(',',''))
        return Infobox.Quantify(field, vars)
    end
end
 
-- if a variable is required, this logic hides them if variable is empty
function Infobox.IsRare( field, vars )
    -- Rather than ParserFunctions, try passing your variables this way. 
    local output = ''
    if not HF.isempty(field.Requirement) then
        if field.Requirement:find("Rare") or field.Requirement:find("rare") then
            return Infobox.Quantify(field, vars)
        end
    end
    return output
end  
 
return Infobox

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.