Jump to content

Module:StationInfobox

From Elite Dangerous Wiki
Revision as of 13:21, 26 May 2015 by Fandom>SpyTec

Documentation for this module may be created at Module:StationInfobox/doc

local Infobox = {}
local HF = require('Module:HF')

local lang = mw.language.new('en')

local stations = {
	["orbis"] = "[[File:OrbisStation_001.jpg|285px]]",
	["ocellus"] = "[[File:OcellusStation_001.jpg|285px]]",
	["coriolis"] = "[[File:CoriolisStation_001.jpg|285px]]",
	["outpost"] = "[[File:Outpost_001.jpg|285px]]",
}

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

function Infobox.MainImage( field, vars )
    local output = ''
    local station = field.Station
    
    if HF.isempty(field.Value) and not HF.isempty(station) then
        if stations[station] ~= nil then
            output = "Testing" .. stations[station]
        else
            output = "[[File:Placeholder.png|285px]]"
        end
        return output
    else
        output = "[[File:Placeholder.png|285px]]"
        return output
    end
end

return Infobox