Module:Infobox Player: Difference between revisions
Appearance
Created player infobox module  |
Adds player stats to infobox  |
||
| (19 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local infobox = require("Module:Infobox") | |||
function p.infobox(frame) | 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',   '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',   '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 | end | ||
return p | return p | ||
Latest revision as of 21:14, 30 March 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', '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', '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