RuneScape Wiki
Advertisement

Documentation for this module may be created at Module:Userbox/bosspet/doc

-- <pre>
local p = {}
local userbox = require('Module:Userbox')

local lang = mw.language.getContentLanguage()
local commas = function (n) return lang:formatNum(n) end

local data = {
	['oops'] = { img = '???', imgbg = '#fff', clr = '#555', bg = '#AAA', border = '#eee' },
	['chick\'arra'] = { img = '[[File:Chick\'arra icon.png]]', imgbg = '#0073E5', clr = '#C0C0C0', bg = '#FFD700', border = '#B0E0F6' },
	['commander miniana'] = { img = '[[File:Commander Miniana icon.png]]', imgbg = '#E5BB00', clr = '#C0C0C0', bg = '#0000FF', border = '#B0E0F6' },
	['general awwdor'] = { img = '[[File:General Awwdor icon.png]]', imgbg = '#6C4824', clr = '#006400', bg = '#20B2AA', border = '#B0E0F6' },
	['k\'ril tinyroth'] = { img = '[[File:K\'ril Tinyroth icon.png]]', imgbg = '#EB0200', clr = '#FFD700', bg = '#000000', border = '#B0E0F6' },
	['kalphite grublet'] = { img = '[[File:Kalphite Grublet icon.png]]', imgbg = '#7C433E', clr = '#63793E', bg = '#722EBA', border = '#995931' },
	['kalphite grubling'] = { img = '[[File:Kalphite Grubling icon.png]]', imgbg = '#066B4E', clr = '#8F3C00', bg = '#004375', border = '#995931' },
	['king black dragonling'] = { img = '[[File:King Black Dragonling icon.png]]', imgbg = '#484337', clr = '#23252F', bg = '#7D8982', border = '#856E54' },
	['legio primulus'] = { img = '[[File:Legio Primulus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#983E15', border = '#983E15' },
	['legio quartulus'] = { img = '[[File:Legio Quartulus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#158A98', border = '#158A98' },
	['legio quintulus'] = { img = '[[File:Legio Quintulus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#8B1493', border = '#8B1493' },
	['legio secundulus'] = { img = '[[File:Legio Secundulus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#159847', border = '#159847' },
	['legio sextulus'] = { img = '[[File:Legio Sextulus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#262525', border = '#262525' },
	['legio tertiolus'] = { img = '[[File:Legio Tertiolus icon.png]]', imgbg = '#9DA193', clr = '#47DFD9', bg = '#938814', border = '#938814' },
	['nexterminator'] = { img = '[[File:Nexterminator icon.png]]', imgbg = '#56397C', clr = '#000000', bg = '#FFD700', border = '#B0E0F6' },
	['prime hatchling'] = { img = '[[File:Prime hatchling icon.png]]', imgbg = '#42211A', clr = '#424742', bg = '#2B89E2', border = '#7D8982' },
	['queen black dragonling'] = { img = '[[File:Queen Black Dragonling icon.png]]', imgbg = '#484337', clr = '#ACA083', bg = '#874E43', border = '#402D2F' },
	['rex hatchling'] = { img = '[[File:Rex hatchling icon.png]]', imgbg = '#58553A', clr = '#4D4634', bg = '#FFAD23', border = '#7D8982' },
	['supreme hatchling'] = { img = '[[File:Supreme hatchling icon.png]]', imgbg = '#08150E', clr = '#3A4232', bg = '#6FAF1A', border = '#7D8982' },
}

function p.main(frame)
	local args = frame:getParent().args
	local pet = string.lower(args[1] or '')
	local kc = args[2] or '1'

	kc = kc:gsub('%D','')
	kc = tonumber(kc) or 1
	kc = commas(kc)

	local _pet = data[pet]
	if not _pet then
		_pet = data.oops
		pet = 'UNDEFINED'
	else
		-- Uppercase each first letter
		local pet_temp = mw.text.split(pet,' ')
		pet = {}
		for _, v in ipairs(pet_temp) do
			local _v = mw.text.split(v,'')
			_v[1] = _v[1]:upper()
			_v = table.concat(_v,'')
			table.insert(pet,_v)
		end
		pet = table.concat(pet,' ')
	end

	local ret = userbox.new()

	ret:setLeft(_pet.img)
		:setLeftBG(_pet.imgbg)
		:setRight(string.format('This user obtained [[%s]] with a killcount of %s!',pet,kc))
		:setRightBG(_pet.bg)
		:setRightColor(_pet.clr)
		:setBorderColor(_pet.border)

	return ret:tostring()
end

return p
Advertisement