Dota 2 Wiki
(Undo revision 1679667 by Litzsch (talk) Not faster)
mNo edit summary
Line 1: Line 1:
 
local error = require( 'Module:Error' ).main
 
local error = require( 'Module:Error' ).main
  +
local getArgs = require( 'Module:Arguments' ).main
 
local p = {}
 
local p = {}
   
Line 125: Line 126:
   
 
function p.main( frame )
 
function p.main( frame )
local args = frame:getParent().args
+
local args = getArgs()
 
return p._main( args )
 
return p._main( args )
 
end
 
end

Revision as of 11:14, 27 December 2017

Documentation for Module:Placement Jump to code ↴ [ edit | purge ]

Reality Rift icon
▶️ Planeshift.
The documentation for this module can be found at Template:Placement.
You may be forwarded to another wiki language, in case a translation is not available.


Dependencies

local error = require( 'Module:Error' ).main
local getArgs = require( 'Module:Arguments' ).main
local p = {}

dict = {
	["1"] = {"#FFD739", "A1", "1st"},
	["gold"] = {"#FFD739", "A1", "1st"},
	["2"] = {"#BEBEBE", "A2", "2nd"},
	["silver"] = {"#BEBEBE", "A2", "2nd"},
	["3"] = {"#BB8644", "A3", "3rd"},
	["bronze"] = {"#BB8644", "A3", "3rd"},
	["4"] = {"#0094B2", "A4", "4th"},
	["5"] = {"#007F99", "A5", "5th"},
	["1-2"] = {"#FFD739", "A1", "1st - 2nd"},
	["1-3"] = {"#FFD739", "A1", "1st - 3rd"},
	["2-4"] = {"#BEBEBE", "A2", "2nd - 4th"},
	["3-4"] = {"#D2B48C", "A3", "3rd - 4th"},
	["3-8"] = {"#D2B48C", "A3", "3rd - 8th"},
	["3-9"] = {"#D2B48C", "A3", "3rd - 9th"},
	["4-5"] = {"#007F99", "A4", "4th - 5th"},
	["4-6"] = {"#007F99", "A4", "4th - 6th"},
	["4-7"] = {"#007F99", "A4", "4th - 7th"},
	["4-8"] = {"#007F99", "A4", "4th - 8th"},
	["5-6"] = {"#007F99", "A5", "5th - 6th"},
	["5-8"] = {"#007F99", "A5", "5th - 8th"},
	["5-9"] = {"#007F99", "A5", "5th - 9th"},
	["5-10"] = {"#007F99", "A5", "5th - 10th"},
	["5-14"] = {"#007F99", "A5", "5th - 14th"},
	["6"] = {"#007F99", "A6", "6th"},
	["6-7"] = {"#007F99", "A6", "6th - 7th"},
	["6-16"] = {"#007F99", "A6", "6th - 16th"},
	["7"] = {"#007F99", "A7", "7th"},
	["7-8"] = {"#007F99", "A7", "7th - 8th"},
	["7-10"] = {"#007F99", "A7", "7th - 10th"},
	["7-11"] = {"#007F99", "A7", "7th - 11th"},
	["7-12"] = {"#007F99", "A7", "7th - 12th"},
	["8"] = {"#007F99", "A8", "8th"},
	["8-9"] = {"#007F99", "A8", "8th - 9th"},
	["9"] = {"#166F82", "A9", "9th"},
	["9-10"] = {"#166F82", "A9", "9th - 10th"},
	["9-12"] = {"#166F82", "A9", "9th - 12th"},
	["9-16"] = {"#166F82", "A9", "9th - 16th"},
	["10"] = {"#166F82", "B0", "10th"},
	["11"] = {"#166F82", "B1", "11th"},
	["12"] = {"#166F82", "B2", "12th"},
	["11-12"] = {"#166F82", "B1", "11th - 12th"},
	["ro12"] = {"#166F82", "B2", "Ro12"},
	["13"] = {"#166F82", "B3", "13th"},
	["13-14"] = {"#166F82", "B3", "13th - 14th"},
	["13-16"] = {"#166F82", "B3", "13th - 16th"},
	["13-18"] = {"#166F82", "B3", "13th - 18th"},
	["13-20"] = {"#166F82", "B3", "13th - 20th"},
	["14"] = {"#166F82", "B4", "14th"},
	["15"] = {"#166F82", "B5", "15th"},
	["16"] = {"#166F82", "B6", "16th"},
	["17"] = {"#2D606B", "B7", "17th"},
	["17-18"] = {"#2D606B", "B7", "17th - 18th"},
	["17-20"] = {"#2D606B", "B7", "17th - 20th"},
	["17-21"] = {"#2D606B", "B7", "17th - 21th"},
	["17-24"] = {"#2D606B", "B7", "17th - 24th"},
	["18"] = {"#2D606B", "B8", "18th"},
	["19"] = {"#2D606B", "B9", "19th"},
	["19-24"] = {"#2D606B", "B9", "19th - 24th"},
	["20"] = {"#2D606B", "C0", "20th"},
	["21"] = {"#2D606B", "C1", "21st"},
	["21-24"] = {"#2D606B", "C1", "21st - 24th"},
	["22"] = {"#2D606B", "C2", "22nd"},
	["22-31"] = {"#2D606B", "C2", "22nd - 31st"},
	["23"] = {"#2D606B", "C3", "23rd"},
	["24"] = {"#2D606B", "C4", "24th"},
	["ro24"] = {"#2D606B", "C4", "Ro24"},
	["25"] = {"#2D606B", "C5", "25th"},
	["25-28"] = {"#2D606B", "C5", "25th - 28th"},
	["25-32"] = {"#2D606B", "C5", "25th - 32nd"},
	["26"] = {"#2D606B", "C6", "26th"},
	["27"] = {"#2D606B", "C7", "27th"},
	["28"] = {"#2D606B", "C8", "28th"},
	["29"] = {"#2D606B", "C9", "29th"},
	["29-32"] = {"#2D606B", "C9", "29th - 32nd"},
	["29-36"] = {"#2D606B", "C9", "29th - 36th"},
	["30"] = {"#2D606B", "D0", "30th"},
	["31"] = {"#2D606B", "D1", "31st"},
	["32"] = {"#2D606B", "D2", "32nd"},
	["32-41"] = {"#2D606B", "D2", "32nd - 41st"},
	["32-51"] = {"#2D606B", "D2", "32nd - 51st"},
	["33"] = {"#445154", "D3", "33rd"},
	["33-36"] = {"#445154", "D3", "33rd - 36th"},
	["34"] = {"#445154", "D4", "34th"},
	["35"] = {"#445154", "D5", "35th"},
	["36"] = {"#445154", "D6", "36th"},
	["ro36"] = {"#445154", "D6", "Ro36"},
	["33-40"] = {"#445154", "D3", "33rd - 40th"},
	["37-44"] = {"#445154", "D7", "37th - 44th"},
	["37"] = {"#445154", "D7", "37th"},
	["38"] = {"#445154", "D8", "38th"},
	["39"] = {"#445154", "D9", "39th"},
	["40"] = {"#445154", "E1", "40th"},
	["40-47"] = {"#445154", "E1", "40th - 47th"},
	["41-48"] = {"#445154", "E1", "41st - 48th"},
	["41"] = {"#445154", "E1", "41st"},
	["42"] = {"#445154", "E2", "42nd"},
	["43"] = {"#445154", "E3", "43rd"},
	["44"] = {"#445154", "E4", "44th"},
	["45"] = {"#445154", "E5", "45th"},
	["45-52"] = {"#445154", "E5", "45th - 52nd"},
	["45-60"] = {"#445154", "E5", "45th - 60th"},
	["46"] = {"#445154", "E6", "46th"},
	["47"] = {"#445154", "E7", "47th"},
	["48"] = {"#44515", "E8", "48th"},
	["ro48"] = {"#44515", "E8", "Ro48"},
	["49"] = {"#445154", "E9", "49th"},
	["49+"] = {"#445154", "E9", "49+"},
	["50"] = {"#445154", "F0", "50th"},
	["64"] = {"#445154", "I0", "64th"},
	["53-68"] = {"#445154", "F3", "53rd - 68th"},
	["61+"] = {"#445156", "F4", "61+"},
	["div"] = {"#445154", "I1", "Div"},
	["group"] = {"#166F82", "I1", "Group"},
	["q"] = {"#009E60", "I1", "Q"},
	["nq"] = {"#FF0000", "I1", "NQ"},
	["nyp"] = {"white", "A0", "NYP", "black"},
	["?"] = {"white", "Z", "?", "black"},
	["-"] = {"white", "Y", "-", "black"},
	["fan favorite"] = {"white", "Y", "Fan Favorite", "black"},
}

function p.main( frame )
	local args = getArgs()
	return p._main( args )
end

function p._main( args )
	if args[1] then
		local data = dict[string.lower( args[1] )]
	
		if data then
			local text_color = data[4] or 'white'
			local text = mw.html.create( 'span' )
				:css( 'color', text_color )
				:css( 'font-weight', 'bold' )
				:wikitext( data[3] )
		
			return 'bgcolor="' .. data[1] .. '" align=center | <span style="display:none;">' .. data[2] .. '</span>' .. tostring( text )
		else
			return error( 'No data found in Module:Placement.' )
		end
	else
		error( 'Please check your input.' )
	end
end

return p