FANDOM


local categorization = require("Module:Categorization")
local utils = require("Module:Utils")
local infobox_utils = require('Module:InfoboxUtils')
local yesno = require('Dev:Yesno')
local staffData = require('Module:RobloxStaff')
local names = require('Module:Names')
 
local categorize = categorization.categorize_in_namespaces('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("<code>activity</code> 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 <code>month joined</code>; 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
	if args.name == "Shedletsky" then
	    return "[[File:Epic Face Icon.png|30px|link=Administrator]] Former administrator" .. categorize("Former administrators")
	end
	local rString = ""
	for i,job in pairs(t) do
	    if job == "Admin" then
            rString = rString.. "[[File:Admin2.png|30px|link=Administrator]] Administrator" .. categorize("Administrators")
       elseif job == "Former_Admin" then
           rString = rString.. "[[File:Admin2.png|30px|link=Administrator]] Former administrator" .. categorize("Former administrators")
    	elseif job == "Intern" then
    	   rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Intern" .. categorize("Interns")
       elseif job == "Former_Intern" then
           rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Former intern" .. categorize("Former interns")
       elseif job == "Accelerator" then
           rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Accelerator" .. categorize("Accelerators")
       elseif job == "Incubator" then
           rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Incubator" .. categorize("Incubators")
       elseif job == "Former_Accelerator" then
           rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Former accelerator" .. categorize("Former accelerators")
       elseif job == "Former_Incubator" then
           rString = rString.. "[[File:Intern2.png|30px|link=Intern]] Former incubator" .. categorize("Former incubators")
       elseif job == "Community_Champion" then
           rString = rString.." [[File:Community Champion.png|30px|link=Community Champions]] Community Champion" .. categorize("Community Champions")
       elseif job == "Top_Contributor" then
           rString = rString .. " [[File:TopContributor.png|30px|link=Top Contributor]] Top Contributor" .. categorize("Top Contributors")
        elseif job == "Community_Sage" then
            rString = rString .. "[[File:CommunitySage.png|30px|link=Community Sage]] Community Sage" .. categorize("Community Sages")
       elseif job == "Video_Star" then
           rString = rString .. "[[File:Video Star.png|20px|link=Roblox Video Stars]] Video Star" .. categorize("Video Stars")
       elseif job == "Former_Video_Star" then
           rString = rString .. "[[File:Video Star.png|20px|link=Roblox Video Stars]] Former Video Star"
       elseif job == "Former_Moderator" then
           rString = rString.." [[File:Super Moderator.png|30px|link=Moderator]] Former Moderator" .. categorize("Former moderators")
       elseif job == "QA_Tester" then
           rString = rString.." [[File:QA logo.png|30px|link=QA Testers of Robloxia]] QA Tester" .. categorize("QA testers")
        elseif job:sub(1,7) == "Custom:" then
            local data = mw.text.split(job,":",true)
            rString = rString .. (data[3] and " [[File:" .. data[3] .. "|30px|link=]] " or "") .. data[2]
    	end
    	rString = rString .. "<br>"
    end
    return rString
end
 
p.format_staff = utils.make_wrapper_function(p._format_staff)
 
function p._format_rname(args)
    if names[(args.name or mw.title.getCurrentTitle().text):lower()] then
        return names[(args.name or mw.title.getCurrentTitle().text):lower()]
    end
end
 
p.format_rname = utils.make_wrapper_function(p._format_rname)
 
function p._format_staff_position_label(args)
    local t = staffData.getRole(args.name or mw.title.getCurrentTitle().text)
    if not t then return "Position" end
    for i,job in pairs(t) do
        if job == "Admin" then
            return "Position"
        elseif job == "Former_Admin" then
            return "Former position"
        end
    end
end
 
p.format_staff_position_label = utils.make_wrapper_function(p._format_staff_position_label)
 
function p._format_staff_position(args)
    local t = staffData.getStaffPosition(args.name or mw.title.getCurrentTitle().text)
	if not t then return "" end
	local rString = ""
	if #t == 1 then
	    rString = t[1]
	else
	    for i,v in pairs(t) do
	        rString = rString.."*"..v.."\n"
	    end
	end
	if t[1] == "Shared staff account" then
	    rString = rString .. categorize("Shared staff accounts")
	end
	return rString
end
 
p.format_staff_position = utils.make_wrapper_function(p._format_staff_position)
 
function p._format_membership(args)
	local membership = args.membership:lower()
    if membership == 'premium' or membership == 'p' then
        return '[[File:PremiumIcon.png|20px|link=Roblox Premium]] [[Roblox Premium|Premium]]' .. categorize("Premium players")
	elseif membership == 'obc' or membership == 'outrageous builders club' or membership == 'outrageous builder\'s club' then
		return "[[Outrageous Builders Club]] [[File:OBC.Icon.png|20px|link=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]] [[File:TBC.Icon.png|20px|link=Turbo Builders Club]]" .. categorize("Turbo Builders Club players")
	elseif membership == 'bc' or membership == 'builders club' or membership == 'builder\'s club' then
		return "[[Builders Club]] [[File:BC.Icon.png|20px|link=Builders Club]]" .. categorize("Builders Club players")
	else
		return infobox_utils.error_message("<code>membership</code> 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" and p._format_staff(args) == nil then
        return 'None <span style="display:none">FLAG::SUSPECTED_NCU</span>'..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)
 
local social_media_list = {
    {"twitter","External Twitter.png","https://twitter.com/%s"},
    {"deviantart","External DA.png","http://%s.deviantart.com"},
    {"youtube","External YouTube.png","https://www.youtube.com/%s"},
    {"facebook","External Facebook.png","https://www.facebook.com/%s"},
    {"instagram","External Instagram.png","https://instagram.com/%s"},
    {"twitch","External Twitch.png","https://www.twitch.tv/%s"},
    {"rwikia","External RWikia.png","https://roblox.fandom.com/wiki/User:%s"},
 
}
 
function p._format_social_media(args)
    local retString = ""
    for i,v in pairs(social_media_list) do
        if args[v[1]] then
            retString = retString .. " [[File:" .. v[2] .. "|30px|link=" .. v[3]:format(args[v[1]]) .. "]]"
        end
    end
    if retString ~= "" then retString = retString .. categorize("Pages with social links") end
    return retString
end
 
p.format_social_media = utils.make_wrapper_function(p._format_social_media,true)
 
return p
Community content is available under CC-BY-SA unless otherwise noted.