Module:PlayerInfobox

local utils = require("Module:Utils") local infobox_utils = require('Module:InfoboxUtils') local yesno = require('Dev:Yesno') local staffData = require('Module:RobloxStaff')

local categorize = utils.categorize('Community')

local p = {}

function p._format_activity(args) local activity = args.activity:lower if activity == 'active' then return "Active" .. categorize("Active players") elseif activity == 'inactive' then return "Inactive" .. categorize("Inactive players") elseif activity == 'banned' then return "Banned" .. categorize("Banned players") elseif activity == "terminated" or activity == "permanently banned" or activity == "deleted" then return "Terminated" .. categorize("Terminated players") elseif activity == "deceased" then return "Deceased" .. categorize("Deceased players") else return infobox_utils.error_message(" must be 'active', 'inactive', 'banned', 'terminated' or 'deceased'") end end

p.format_activity = utils.make_wrapper_function(p._format_activity)

function p._format_month_joined(args) local month, year = args['month joined']:match("(%a+) (%d%d%d%d)") if month and year then return year > "2003" and month .. ' ' .. year .. categorize(year .. " users") or error("ROBLOX has only existed since 2004. You cannot put a date before this.") else return infobox_utils.error_message("invalid value for ; try something like \"October 2015\"") end end

p.format_month_joined = utils.make_wrapper_function(p._format_month_joined)

function p._format_staff(args) local t = staffData.getRole(args.name or mw.title.getCurrentTitle.text) if not t then return "" end local rString = "" for i,job in pairs(t) do	   if job == "Admin" then rString = rString.. " Administrator" .. categorize("Administrators") elseif job == "Former_Admin" then rString = rString.. " Former Administrator" .. categorize("Former Administrators") elseif job == "Intern" then rString = rString.. " Intern" .. categorize("Interns") elseif job == "Former_Intern" then rString = rString.. " Former Intern" .. categorize("Former Interns") elseif job == "Accelerator" then rString = rString.. " Accelerator" .. categorize("Accelerators") elseif job == "Incubator" then rString = rString.. " Incubator" .. categorize("Incubators") elseif job == "Former_Accelerator" then rString = rString.. " Former Accelerator" .. categorize("Former Accelerators") elseif job == "Former_Incubator" then rString = rString.. " Former Incubator" .. categorize("Former Incubators") end rString = rString .. " "   end return t end p.format_staff = utils.make_wrapper_function(p._format_staff)

function p._format_membership(args) local membership = args.membership:lower

if membership == 'obc' or membership == 'outrageous builders club' or membership == 'outrageous builder\'s club' then return "Outrageous Builders Club " .. categorize("Outrageous Builders Club players") elseif membership == 'tbc' or membership == 'turbo builders club' or membership == 'turbo builder\'s club' then return "Turbo Builders Club " .. categorize("Turbo Builders Club players") elseif membership == 'bc' or membership == 'builders club' or membership == 'builder\'s club' then return "Builders Club " .. categorize("Builders Club players") else return infobox_utils.error_message(" must be 'bc', 'tbc' or 'obc''") end end

p.format_membership = utils.make_wrapper_function(p._format_membership)

function p._format_place_visits(args) if args["place visits"] == "0" then return 'None FLAG::SUSPECTED_NCU '..categorize("Players with less than 1000000 place visits") else return "Around "..infobox_utils.format_number(args["place visits"], 10000,"Players with less than 1000000 place visits", 1000000, "SUSPECTED_NCU") end end

p.format_place_visits = utils.make_wrapper_function(p._format_place_visits)

return p