Jump to content

📢 Please make sure to read our Style Guide before editing. For questions, suggestions, or technical issues, please contact Noah.

Module:Infobox Player: Difference between revisions

From CrabCraft Wiki
added skin image
Not sure how exactly this works, but added 'Date Joined' and 'Left Office'
 
(4 intermediate revisions by one other user not shown)
Line 5: Line 5:
function p.infobox(frame)
function p.infobox(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args
     local used = {} -- track which keys we’ve output
     -- Determine which identifier to use for the head image: prefer UUID if provided
     local out = {}
     local head_id = args.uuid and args.uuid ~= '' and args.uuid or args.username
   
 
     local player_args = {
     local player_args = {
    {'t', args.username},
        {'t',       args.username},
    {'i', 'https://mc-heads.net/player/' .. args.username .. '/100.png'},
        {'i',       'https://mc-heads.net/player/' .. head_id .. '/110.png'},
    {'s', 'About'},
        {'s',       'Biography'},
    {'f', 'Nationality', args.nationality},
        {'f',       'Username',      args.username},
    {'f', 'Season Joined', args.seasonjoined},
        {'f',      'Alias',         args.alias},
    {'f', 'Quote', args.quote},
        {'f',       'Season Joined', args.seasonjoined},
    {'s', 'Socials'},
        {'f',      'Date Joined',  args.datejoined},
    {'f', 'Alias', args.alias},
        {'f',       'Nationality',    args.nationality},
    {'f', 'Discord', args.discord},
        {'f',      'Discord',       args.discord},
    {'s', 'Government'},
        {'s',       'Personality'},
    {'f', 'Minister Role', args.ministerrole},
        {'f',       'Quote',          args.quote},
    {'f', 'Assumed Office', args.assumedoffice},
        {'f',      'Favourite Item', args.favouriteitem},
    {'f', 'Preceded By', args.precededby},
        {'f',       'Favourite Block', args.favouriteblock},
    {'s', 'Favourite:'},
        {'s',       'Government'},
    {'f', 'Item', args.favouriteitem},
        {'f',       'Minister Role',   args.ministerrole},
    {'f', 'Block', args.favouriteblock},
        {'f',       'Assumed Office', args.assumedoffice},
        {'f',       'Left Office',    args.leftoffice},
        {'f',      'Preceded By',     args.precededby},
        {'s',       'Links'},
        {'f', 'Player Stats', args.uuid and args.uuid ~= '' and ('[https://www.crabcraft.net/stats/' .. args.uuid .. ' Link]') or nil},
     }
     }


     return infobox.infobox {
     return infobox.infobox {
    getParent = function() return { args = player_args } end
        getParent = function() return { args = player_args } end
     }
     }
end
end


return p
return p

Latest revision as of 08:23, 27 July 2026

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

local p = {}

local infobox = require("Module:Infobox")

function p.infobox(frame)
    local args = frame:getParent().args
    -- Determine which identifier to use for the head image: prefer UUID if provided
    local head_id = args.uuid and args.uuid ~= '' and args.uuid or args.username

    local player_args = {
        {'t',       args.username},
        {'i',       'https://mc-heads.net/player/' .. head_id .. '/110.png'},
        {'s',       'Biography'},
        {'f',       'Username',       args.username},
        {'f',       'Alias',          args.alias},
        {'f',       'Season Joined',  args.seasonjoined},
        {'f',       'Date Joined',  args.datejoined},
        {'f',       'Nationality',     args.nationality},
        {'f',       'Discord',        args.discord},
        {'s',       'Personality'},
        {'f',       'Quote',           args.quote},
        {'f',       'Favourite Item',  args.favouriteitem},
        {'f',       'Favourite Block', args.favouriteblock},
        {'s',       'Government'},
        {'f',       'Minister Role',   args.ministerrole},
        {'f',       'Assumed Office',  args.assumedoffice},
        {'f',       'Left Office',     args.leftoffice},
        {'f',       'Preceded By',     args.precededby},
        {'s',       'Links'},
        {'f', 'Player Stats', args.uuid and args.uuid ~= '' and ('[https://www.crabcraft.net/stats/' .. args.uuid .. ' Link]') or nil},
    }

    return infobox.infobox {
        getParent = function() return { args = player_args } end
    }
end

return p