Module:UtilsStatus

local p = {} local utilsCode = require("Module:UtilsCode") local utilsDisplay = require("Module:UtilsDisplay") local utilsIcons = require("Module:UtilsIcons") local utilsCargo = require("Module:UtilsCargo") local utilsString = require("Module:UtilsString")

local FIELDS = { {name = "name", type = "String"}, {name = "description", type = "String"}, {name = "effects", type = "List of String"}, }

function p.GetStatus(name) local query = {tables = 'Status', fields = FIELDS, args = { where = 'name = "' .. name .. '"', }   			}    local results = utilsCargo.Query(query)

return results[1] end

function p._DisplayDetails(frame) local args = frame:getParent.args return p.DisplayDetails(args[1]) end

function p.DisplayDetails(statusName) local status = p.GetStatus(statusName) -- Formatting effects local firstEffect = true local effects = "" for key, effect in ipairs(status["effects"]) do			if firstEffect == true then firstEffect = false else effects = effects .. " "			end effects = effects .. effect end local result = mw.html.create("div") :addClass("status-details-container") :node(mw.html.create("div")			:addClass("status-details-image")			:wikitext("")) :node(mw.html.create("div")			:addClass("status-details-name")			:wikitext(status["name"])) :node(mw.html.create("div")			:addClass("status-details-level")			:wikitext("Lvl. 1")) :node(mw.html.create("div")			:addClass("status-details-description")			:wikitext(status["description"])) :node(mw.html.create("div")			:addClass("status-details-effects")			:wikitext(effects)) return result end

return p