Модуль:GameModes: различия между версиями

Нет описания правки
Нет описания правки
 
(не показано 11 промежуточных версий этого же участника)
Строка 387: Строка 387:
    :tag('th')
    :tag('th')
    :attr('colspan', 15)
    :attr('colspan', 15)
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Призовые места'))
:done()
tableNode:node(rowNode1):newline()
for k2, v2 in ipairs(v1) do
    local rowNode2 = mw.html.create('tr')
    rowNode2
    :tag('th')
            :wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
:done()
    for k3, v3 in ipairs(v2) do
local fieldNode = mw.html.create('td')
local str = ""
if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
if v2[k3][1] == "Магические бутылки" then
str = "бутылки"
elseif v2[k3][1] == "Изумруды" then
str = "изумруды"
else
str = "ранги"
end
fieldNode
:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
:done()
elseif v2[k3][2] == nil then
fieldNode
:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
else
fieldNode
:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
end
rowNode2:node(fieldNode):newline()
end
tableNode:node(rowNode2):newline()
end
elseif args['type'] == k1 and k1 == "top2" then
local rowNode1 = mw.html.create('tr')
    rowNode1
    :tag('th')
    :attr('colspan', 14)
    :cssText('height: 30px')
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Призовые места'))
            :wikitext(mw.ustring.format('Призовые места'))
Строка 435: Строка 484:
    rowNode1
    rowNode1
    :tag('th')
    :tag('th')
    :attr('colspan', 9)
    :attr('colspan', 10)
    :cssText('height: 30px')
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Набранные очки'))
            :wikitext(mw.ustring.format('Набранные очки'))
Строка 591: Строка 640:
if args['gm'] == k then
if args['gm'] == k then
if args['type'] == k1 and k1 == "top" then
if args['type'] == k1 and k1 == "top" then
local rowNode1 = mw.html.create('tr')
    rowNode1
    :tag('th')
    :attr('colspan', 14)
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Призовые места'))
:done()
tableNode:node(rowNode1):newline()
for k2, v2 in ipairs(v1) do
    local rowNode2 = mw.html.create('tr')
    rowNode2
    :tag('th')
            :wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
:done()
    for k3, v3 in ipairs(v2) do
local fieldNode = mw.html.create('td')
local str = ""
if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
if v2[k3][1] == "Магические бутылки" then
str = "бутылки"
elseif v2[k3][1] == "Изумруды" then
str = "изумруды"
else
str = "ранги"
end
fieldNode
:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
:done()
elseif v2[k3][2] == nil then
fieldNode
:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
else
fieldNode
:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
end
rowNode2:node(fieldNode):newline()
end
tableNode:node(rowNode2):newline()
end
elseif args['type'] == k1 and k1 == "top2" then
local rowNode1 = mw.html.create('tr')
local rowNode1 = mw.html.create('tr')
    rowNode1
    rowNode1
Строка 754: Строка 852:
    rowNode1
    rowNode1
    :tag('th')
    :tag('th')
    :attr('colspan', 9)
    :attr('colspan', 10)
    :cssText('height: 30px')
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Набранные очки'))
            :wikitext(mw.ustring.format('Набранные очки'))
Строка 858: Строка 956:
end
end
end
end
end
elseif gm_data[k]["type"] == 7 then
for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
if args['gm'] == k then
if args['type'] == k1 and k1 == "points" then
local rowNode1 = mw.html.create('tr')
    rowNode1
    :tag('th')
    :attr('colspan', 11)
    :cssText('height: 30px')
            :wikitext(mw.ustring.format('Набранные очки'))
:done()
tableNode:node(rowNode1):newline()
for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
    local rowNode2 = mw.html.create('tr')
   
    rowNode2
    :tag('th')
            :wikitext(mw.ustring.format('%s', lib.comma_value(k2)))
:done()
for k3, v3 in ipairs(v2) do
local fieldNode = mw.html.create('td')
local str = ""
if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
if v2[k3][1] == "Магические бутылки" then
str = "бутылки"
elseif v2[k3][1] == "Изумруды" then
str = "изумруды"
end
fieldNode
:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
:done()
elseif v2[k3][2] == nil then
fieldNode
:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
else
fieldNode
:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
:done()
end
rowNode2:node(fieldNode):newline()
end
tableNode:node(rowNode2):newline()
end
    end
    end
end
end
     end
     end
Строка 892: Строка 1044:
str = "#2001-5000"
str = "#2001-5000"
end
end
elseif type == 2 and form ~= "clan" then
elseif type == 2 and form == "top" then
if place == 1 then
if place == 1 then
str = "#1"
str = "#1"
Строка 910: Строка 1062:
str = "#501-2000"
str = "#501-2000"
elseif place == 9 then
elseif place == 9 then
str = "#2001-5000"
end
elseif type == 2 and form == "top2" then
if place == 1 then
str = "#1"
elseif place == 2 then
str = "#2-10"
elseif place == 3 then
str = "#11-35"
elseif place == 4 then
str = "#36-100"
elseif place == 5 then
str = "#101-250"
elseif place == 6 then
str = "#251-500"
elseif place == 7 then
str = "#501-2000"
elseif place == 8 then
str = "#2001-5000"
str = "#2001-5000"
end
end
Строка 921: Строка 1091:
elseif place == 4 then
elseif place == 4 then
str = "#36-100"
str = "#36-100"
elseif place == 5 then
str = "#101-250"
end
end
elseif type == 3 and form == "top" then
elseif type == 3 and form == "top" then
Строка 939: Строка 1111:
elseif place == 8 then
elseif place == 8 then
str = "#76-100"
str = "#76-100"
end
elseif type == 3 and form == "top2" then
if place == 1 then
str = "#1"
elseif place == 2 then
str = "#2-3"
elseif place == 3 then
str = "#4-10"
elseif place == 4 then
str = "#11-25"
elseif place == 5 then
str = "#26-35"
elseif place == 6 then
str = "#36-50"
elseif place == 7 then
str = "#51-100"
elseif place == 8 then
str = "#101-200"
elseif place == 9 then
str = "#201-500"
elseif place == 10 then
str = "#501-2000"
elseif place == 11 then
str = "#2001-5000"
end
end
elseif type == 4 and form == "top" then
elseif type == 4 and form == "top" then
Строка 952: Строка 1148:
str = "#36-100"
str = "#36-100"
elseif place == 6 then
elseif place == 6 then
str = "#101-250"
str = "#101-200"
elseif place == 7 then
elseif place == 7 then
str = "#251-500"
str = "#201-300"
elseif place == 8 then
elseif place == 8 then
str = "#501-200"
str = "#301-500"
elseif place == 9 then
elseif place == 9 then
str = "#501-1000"
elseif place == 10 then
str = "#1001-2000"
elseif place == 11 then
str = "#2001-5000"
str = "#2001-5000"
elseif place == 10 then
elseif place == 12 then
str = "#5001-50000"
str = "#5001-50000"
end
end

Текущая версия от 06:35, 8 января 2024

Данная группа модулей хранит информацию обо всех героях из Крушителей подземелий. Перечень модулей:

Информация из Модуль:GameModes/doc


local p = {}

local lib = require('Module:Feature')
local libItem = require('Module:ItemData')
local libHero = require('Module:HeroData')

function p.get(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
	
	local get      = require ('Module:GameModes/getter')
    local gm       = args['gm'] or args[1]
    local datatype = args['datatype'] or args[2]
    local output   = args['output'] or args[3] or nil
    
    local result = get[datatype](gm)
    
    if output ~= nil and type(result) == "table" then
        if output == "csv" then
            return lib.tbl_concat{result}
        elseif output == "custom" then 
            return frame:preprocess(lib.tbl_concat({result, prepend = args['prepend'], append = args['append'], separator = args['separator'], index = args["index"]}))
        elseif output == "template" then 
            return frame:preprocess(lib.tbl_concat{result, prepend = "{{" .. args['t_name'] .. "|", append = "}}", separator = args['separator']})
        end
    elseif result == nil then
        return ""
    else
        return result
    end
end

function p.getGameModeMedal(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get    = require ('Module:GameModes/getter')
	local gm     = args['gm'] or args[1]
	local medals = "medals"
	local str    = ""
	
	local result = get[medals](gm)
	
	for k, v in ipairs(result) do
    	if tonumber(args['index']) == k then
    		str = mw.ustring.format('%s', v)
    	end
    end
    
    return str
end

function p.getGameModeRewards(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get       = require ('Module:GameModes/getter')
	local gm_data   = require ('Module:GameModes/data')
	local gm        = args['gm'] or args[1]
	local tableNode = mw.html.create('table')
	
	tableNode
        :addClass('custom-table')
        :cssText('width: fit-content; width: -moz-fit-content; text-align: center;')
        :newline()
	
	for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
		if gm_data[k]["type"] == 1 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "science" then
						for k2, v2 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k1]) do
							if args['form'] == k2 and k2 == "top" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 14)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Призовые места'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in ipairs(v2) do
							    	local rowNode2 = mw.html.create('tr')
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k3, gm_data[k]["type"], args['type'])))
										:done()
										
							    		for k4, v4 in ipairs(v3) do
											local fieldNode = mw.html.create('td')
											local str = ""
											
											if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
												if v3[k4][1] == "Магические бутылки" then
													str = "бутылки"
												elseif v3[k4][1] == "Изумруды" then
													str = "изумруды"
												else
													str = "ранги"
												end
												
												fieldNode
													:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
													:done()
											elseif v3[k4][2] == nil then
												fieldNode
													:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											else
												fieldNode
													:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											end
													
											rowNode2:node(fieldNode):newline()
										end
										
									tableNode:node(rowNode2):newline()
								end
							elseif args['form'] == k2 and k2 == "points" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 10)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Набранные очки'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in lib.pairsByAlphabeticalKeys(v2, function(a, b) return a > b end) do
							    	local rowNode2 = mw.html.create('tr')
							    	
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', lib.comma_value(k3)))
										:done()
									
									for k4, v4 in ipairs(v3) do
										local fieldNode = mw.html.create('td')
										local str = ""
										
										if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
											if v3[k4][1] == "Магические бутылки" then
												str = "бутылки"
											elseif v3[k4][1] == "Изумруды" then
												str = "изумруды"
											else
												str = "ранги"
											end
											
											fieldNode
												:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
												:done()
										elseif v3[k4][2] == nil then
											fieldNode
												:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										else
											fieldNode
												:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										end
										
										rowNode2:node(fieldNode):newline()
									end	
									
									tableNode:node(rowNode2):newline()
								end
							end
						end
					elseif args['type'] == k1 and k1 == "bosses" then
						for k2, v2 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k1]) do
							if args['form'] == k2 and k2 == "top" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 14)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Призовые места'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in ipairs(v2) do
							    	local rowNode2 = mw.html.create('tr')
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k3, gm_data[k]["type"], args['type'])))
										:done()
										
							    		for k4, v4 in ipairs(v3) do
											local fieldNode = mw.html.create('td')
											local str = ""
											
											if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
												if v3[k4][1] == "Магические бутылки" then
													str = "бутылки"
												elseif v3[k4][1] == "Изумруды" then
													str = "изумруды"
												else
													str = "ранги"
												end
												
												fieldNode
													:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
													:done()
											elseif v3[k4][2] == nil then
												fieldNode
													:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											else
												fieldNode
													:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											end
													
											rowNode2:node(fieldNode):newline()
										end
										
									tableNode:node(rowNode2):newline()
								end
							elseif args['form'] == k2 and k2 == "points" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 10)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Набранные очки'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in lib.pairsByAlphabeticalKeys(v2, function(a, b) return a > b end) do
							    	local rowNode2 = mw.html.create('tr')
							    	
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', lib.comma_value(k3)))
										:done()
									
									for k4, v4 in ipairs(v3) do
										local fieldNode = mw.html.create('td')
										local str = ""
										
										if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
											if v3[k4][1] == "Магические бутылки" then
												str = "бутылки"
											elseif v3[k4][1] == "Изумруды" then
												str = "изумруды"
											else
												str = "ранги"
											end
											
											fieldNode
												:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
												:done()
										elseif v3[k4][2] == nil then
											fieldNode
												:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										else
											fieldNode
												:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										end
										
										rowNode2:node(fieldNode):newline()
									end	
									
									tableNode:node(rowNode2):newline()
								end
							end
						end
					elseif args['type'] == k1 and k1 == "clan" then
						for k2, v2 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k1]) do
							if args['form'] == k2 and k2 == "science" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 10)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Набранные очки'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in lib.pairsByAlphabeticalKeys(v2, function(a, b) return a > b end) do
							    	local rowNode2 = mw.html.create('tr')
							    	
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', lib.comma_value(k3)))
										:done()
									
									for k4, v4 in ipairs(v3) do
										local fieldNode = mw.html.create('td')
										local str = ""
										
										if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
											if v3[k4][1] == "Магические бутылки" then
												str = "бутылки"
											elseif v3[k4][1] == "Изумруды" then
												str = "изумруды"
											else
												str = "ранги"
											end
											
											fieldNode
												:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
												:done()
										elseif v3[k4][2] == nil then
											fieldNode
												:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										else
											fieldNode
												:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										end
										
										rowNode2:node(fieldNode):newline()
									end	
									
									tableNode:node(rowNode2):newline()
								end
							elseif args['form'] == k2 and k2 == "bosses" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 10)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Набранные очки'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in lib.pairsByAlphabeticalKeys(v2, function(a, b) return a > b end) do
							    	local rowNode2 = mw.html.create('tr')
							    	
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', lib.comma_value(k3)))
										:done()
									
									for k4, v4 in ipairs(v3) do
										local fieldNode = mw.html.create('td')
										local str = ""
										
										if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
											if v3[k4][1] == "Магические бутылки" then
												str = "бутылки"
											elseif v3[k4][1] == "Изумруды" then
												str = "изумруды"
											else
												str = "ранги"
											end
											
											fieldNode
												:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
												:done()
										elseif v3[k4][2] == nil then
											fieldNode
												:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										else
											fieldNode
												:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										end
										
										rowNode2:node(fieldNode):newline()
									end	
									
									tableNode:node(rowNode2):newline()
								end
							end
						end
					end
				end
			end
		elseif gm_data[k]["type"] == 2 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "top" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 15)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Призовые места'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in ipairs(v1) do
					    	local rowNode2 = mw.html.create('tr')
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
								:done()
								
					    		for k3, v3 in ipairs(v2) do
									local fieldNode = mw.html.create('td')
									local str = ""
									
									if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
										if v2[k3][1] == "Магические бутылки" then
											str = "бутылки"
										elseif v2[k3][1] == "Изумруды" then
											str = "изумруды"
										else
											str = "ранги"
										end
										
										fieldNode
											:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
											:done()
									elseif v2[k3][2] == nil then
										fieldNode
											:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									else
										fieldNode
											:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									end
											
									rowNode2:node(fieldNode):newline()
								end
								
							tableNode:node(rowNode2):newline()
						end
					elseif args['type'] == k1 and k1 == "top2" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 14)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Призовые места'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in ipairs(v1) do
					    	local rowNode2 = mw.html.create('tr')
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
								:done()
								
					    		for k3, v3 in ipairs(v2) do
									local fieldNode = mw.html.create('td')
									local str = ""
									
									if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
										if v2[k3][1] == "Магические бутылки" then
											str = "бутылки"
										elseif v2[k3][1] == "Изумруды" then
											str = "изумруды"
										else
											str = "ранги"
										end
										
										fieldNode
											:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
											:done()
									elseif v2[k3][2] == nil then
										fieldNode
											:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									else
										fieldNode
											:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									end
											
									rowNode2:node(fieldNode):newline()
								end
								
							tableNode:node(rowNode2):newline()
						end
					elseif args['type'] == k1 and k1 == "points" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 10)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Набранные очки'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
					    	local rowNode2 = mw.html.create('tr')
					    	
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', lib.comma_value(k2)))
								:done()
							
							for k3, v3 in ipairs(v2) do
								local fieldNode = mw.html.create('td')
								local str = ""
								
								if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
									if v2[k3][1] == "Магические бутылки" then
										str = "бутылки"
									elseif v2[k3][1] == "Изумруды" then
										str = "изумруды"
									else
										str = "ранги"
									end
									
									fieldNode
										:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
										:done()
								elseif v2[k3][2] == nil then
									fieldNode
										:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								else
									fieldNode
										:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								end
								
								rowNode2:node(fieldNode):newline()
							end	
							
							tableNode:node(rowNode2):newline()
						end
					elseif args['type'] == k1 and k1 == "clan" then
						for k2, v2 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k1]) do
							if args['form'] == k2 and k2 == "top" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 14)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Призовые места'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in ipairs(v2) do
							    	local rowNode2 = mw.html.create('tr')
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k3, gm_data[k]["type"], args['type'])))
										:done()
										
							    		for k4, v4 in ipairs(v3) do
											local fieldNode = mw.html.create('td')
											local str = ""
											
											if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
												if v3[k4][1] == "Магические бутылки" then
													str = "бутылки"
												elseif v3[k4][1] == "Изумруды" then
													str = "изумруды"
												else
													str = "ранги"
												end
												
												fieldNode
													:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
													:done()
											elseif v3[k4][2] == nil then
												fieldNode
													:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											else
												fieldNode
													:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
													:done()
											end
													
											rowNode2:node(fieldNode):newline()
										end
										
									tableNode:node(rowNode2):newline()
								end
							elseif args['form'] == k2 and k2 == "points" then
								local rowNode1 = mw.html.create('tr')
						    	rowNode1
							    	:tag('th')
							    		:attr('colspan', 10)
							    		:cssText('height: 30px')
					            		:wikitext(mw.ustring.format('Набранные очки'))
										:done()
										
								tableNode:node(rowNode1):newline()
								
								for k3, v3 in lib.pairsByAlphabeticalKeys(v2, function(a, b) return a > b end) do
							    	local rowNode2 = mw.html.create('tr')
							    	
							    	rowNode2
							    		:tag('th')
					            		:wikitext(mw.ustring.format('%s', lib.comma_value(k3)))
										:done()
									
									for k4, v4 in ipairs(v3) do
										local fieldNode = mw.html.create('td')
										local str = ""
										
										if v3[k4][1] == "Магические бутылки" or v3[k4][1] == "Изумруды" or v3[k4][1] == "Ранги" then
											if v3[k4][1] == "Магические бутылки" then
												str = "бутылки"
											elseif v3[k4][1] == "Изумруды" then
												str = "изумруды"
											else
												str = "ранги"
											end
											
											fieldNode
												:wikitext(mw.ustring.format('{{%s}}%d', str, v3[k4][2]))
												:done()
										elseif v3[k4][2] == nil then
											fieldNode
												:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										else
											fieldNode
												:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v3[k4][1], "35px", v3[k4][2])))
												:done()
										end
										
										rowNode2:node(fieldNode):newline()
									end	
									
									tableNode:node(rowNode2):newline()
								end
							end
						end
	    			end
	    		end
			end
		elseif gm_data[k]["type"] == 3 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "top" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 14)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Призовые места'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in ipairs(v1) do
					    	local rowNode2 = mw.html.create('tr')
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
								:done()
								
					    		for k3, v3 in ipairs(v2) do
									local fieldNode = mw.html.create('td')
									local str = ""
									
									if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
										if v2[k3][1] == "Магические бутылки" then
											str = "бутылки"
										elseif v2[k3][1] == "Изумруды" then
											str = "изумруды"
										else
											str = "ранги"
										end
										
										fieldNode
											:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
											:done()
									elseif v2[k3][2] == nil then
										fieldNode
											:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									else
										fieldNode
											:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									end
											
									rowNode2:node(fieldNode):newline()
								end
								
							tableNode:node(rowNode2):newline()
						end
					elseif args['type'] == k1 and k1 == "top2" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 14)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Призовые места'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in ipairs(v1) do
					    	local rowNode2 = mw.html.create('tr')
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
								:done()
								
					    		for k3, v3 in ipairs(v2) do
									local fieldNode = mw.html.create('td')
									local str = ""
									
									if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
										if v2[k3][1] == "Магические бутылки" then
											str = "бутылки"
										elseif v2[k3][1] == "Изумруды" then
											str = "изумруды"
										else
											str = "ранги"
										end
										
										fieldNode
											:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
											:done()
									elseif v2[k3][2] == nil then
										fieldNode
											:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									else
										fieldNode
											:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									end
											
									rowNode2:node(fieldNode):newline()
								end
								
							tableNode:node(rowNode2):newline()
						end
					end
				end
			end
		elseif gm_data[k]["type"] == 4 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "top" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 8)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Призовые места'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in ipairs(v1) do
					    	local rowNode2 = mw.html.create('tr')
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', p.setPlacesRewards(k2, gm_data[k]["type"], args['type'])))
								:done()
								
					    		for k3, v3 in ipairs(v2) do
									local fieldNode = mw.html.create('td')
									local str = ""
									
									if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
										if v2[k3][1] == "Магические бутылки" then
											str = "бутылки"
										elseif v2[k3][1] == "Изумруды" then
											str = "изумруды"
										else
											str = "ранги"
										end
										
										fieldNode
											:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
											:done()
									elseif v2[k3][2] == nil then
										fieldNode
											:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									else
										fieldNode
											:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
											:done()
									end
											
									rowNode2:node(fieldNode):newline()
								end
								
							tableNode:node(rowNode2):newline()
						end
					elseif args['type'] == k1 and k1 == "points" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 10)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Набранные очки'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
					    	local rowNode2 = mw.html.create('tr')
					    	
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', lib.comma_value(k2)))
								:done()
							
							for k3, v3 in ipairs(v2) do
								local fieldNode = mw.html.create('td')
								local str = ""
								
								if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
									if v2[k3][1] == "Магические бутылки" then
										str = "бутылки"
									elseif v2[k3][1] == "Изумруды" then
										str = "изумруды"
									else
										str = "ранги"
									end
									
									fieldNode
										:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
										:done()
								elseif v2[k3][2] == nil then
									fieldNode
										:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								else
									fieldNode
										:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								end
								
								rowNode2:node(fieldNode):newline()
							end	
							
							tableNode:node(rowNode2):newline()
						end
					end
				end
			end
		elseif gm_data[k]["type"] == 5 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "points" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 10)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Набранные очки'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
					    	local rowNode2 = mw.html.create('tr')
					    	
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', lib.comma_value(k2)))
								:done()
							
							for k3, v3 in ipairs(v2) do
								local fieldNode = mw.html.create('td')
								local str = ""
								
								if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
									if v2[k3][1] == "Магические бутылки" then
										str = "бутылки"
									elseif v2[k3][1] == "Изумруды" then
										str = "изумруды"
									else
										str = "ранги"
									end
									
									fieldNode
										:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
										:done()
								elseif v2[k3][2] == nil then
									fieldNode
										:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								else
									fieldNode
										:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								end
								
								rowNode2:node(fieldNode):newline()
							end	
							
							tableNode:node(rowNode2):newline()
						end
					end
				end
			end
		elseif gm_data[k]["type"] == 6 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "level" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 10)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Уровни логова'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
					    	local rowNode2 = mw.html.create('tr')
					    	
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', k2))
								:done()
							
							for k3, v3 in ipairs(v2) do
								local fieldNode = mw.html.create('td')
								local str = ""
								
								if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
									if v2[k3][1] == "Магические бутылки" then
										str = "бутылки"
									elseif v2[k3][1] == "Изумруды" then
										str = "изумруды"
									else
										str = "ранги"
									end
									
									fieldNode
										:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
										:done()
								elseif v2[k3][2] == nil then
									fieldNode
										:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								else
									fieldNode
										:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								end
								
								rowNode2:node(fieldNode):newline()
							end	
							
							tableNode:node(rowNode2):newline()
						end
					end
				end
			end
		elseif gm_data[k]["type"] == 7 then
			for k1, v1 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"]) do
				if args['gm'] == k then
					if args['type'] == k1 and k1 == "points" then
						local rowNode1 = mw.html.create('tr')
				    	rowNode1
					    	:tag('th')
					    		:attr('colspan', 11)
					    		:cssText('height: 30px')
			            		:wikitext(mw.ustring.format('Набранные очки'))
								:done()
								
						tableNode:node(rowNode1):newline()
						
						for k2, v2 in lib.pairsByAlphabeticalKeys(v1, function(a, b) return a > b end) do
					    	local rowNode2 = mw.html.create('tr')
					    	
					    	rowNode2
					    		:tag('th')
			            		:wikitext(mw.ustring.format('%s', lib.comma_value(k2)))
								:done()
							
							for k3, v3 in ipairs(v2) do
								local fieldNode = mw.html.create('td')
								local str = ""
								
								if v2[k3][1] == "Магические бутылки" or v2[k3][1] == "Изумруды" or v2[k3][1] == "Ранги" then
									if v2[k3][1] == "Магические бутылки" then
										str = "бутылки"
									elseif v2[k3][1] == "Изумруды" then
										str = "изумруды"
									end
									
									fieldNode
										:wikitext(mw.ustring.format('{{%s}}%d', str, v2[k3][2]))
										:done()
								elseif v2[k3][2] == nil then
									fieldNode
										:wikitext(mw.ustring.format('%s', libHero.getHeroIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								else
									fieldNode
										:wikitext(mw.ustring.format('%s', libItem.getItemIcon(v2[k3][1], "35px", v2[k3][2])))
										:done()
								end
								
								rowNode2:node(fieldNode):newline()
							end	
							
							tableNode:node(rowNode2):newline()
						end
	    			end
	    		end
			end
    	end
    end
    
    return frame:preprocess(tostring(tableNode))
end

function p.setPlacesRewards(place, type, form)
	local str = ""
	
	if type == 1 then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-3"
		elseif place == 3 then
			str = "#4-10"
		elseif place == 4 then
			str = "#11-20"
		elseif place == 5 then
			str = "#21-30"
		elseif place == 6 then
			str = "#31-50"
		elseif place == 7 then
			str = "#51-100"
		elseif place == 8 then
			str = "#101-200"
		elseif place == 9 then
			str = "#201-500"
		elseif place == 10 then
			str = "#501-2000"
		elseif place == 11 then
			str = "#2001-5000"
		end
	elseif type == 2 and form == "top" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-5"
		elseif place == 3 then
			str = "#6-10"
		elseif place == 4 then
			str = "#11-35"
		elseif place == 5 then
			str = "#36-100"
		elseif place == 6 then
			str = "#101-250"
		elseif place == 7 then
			str = "#251-500"
		elseif place == 8 then
			str = "#501-2000"
		elseif place == 9 then
			str = "#2001-5000"
		end
	elseif type == 2 and form == "top2" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-10"
		elseif place == 3 then
			str = "#11-35"
		elseif place == 4 then
			str = "#36-100"
		elseif place == 5 then
			str = "#101-250"
		elseif place == 6 then
			str = "#251-500"
		elseif place == 7 then
			str = "#501-2000"
		elseif place == 8 then
			str = "#2001-5000"
		end
	elseif type == 2 and form == "clan" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-10"
		elseif place == 3 then
			str = "#11-35"
		elseif place == 4 then
			str = "#36-100"
		elseif place == 5 then
			str = "#101-250"
		end
	elseif type == 3 and form == "top" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-3"
		elseif place == 3 then
			str = "#4-10"
		elseif place == 4 then
			str = "#11-25"
		elseif place == 5 then
			str = "#26-35"
		elseif place == 6 then
			str = "#36-50"
		elseif place == 7 then
			str = "#51-75"
		elseif place == 8 then
			str = "#76-100"
		end
	elseif type == 3 and form == "top2" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-3"
		elseif place == 3 then
			str = "#4-10"
		elseif place == 4 then
			str = "#11-25"
		elseif place == 5 then
			str = "#26-35"
		elseif place == 6 then
			str = "#36-50"
		elseif place == 7 then
			str = "#51-100"
		elseif place == 8 then
			str = "#101-200"
		elseif place == 9 then
			str = "#201-500"
		elseif place == 10 then
			str = "#501-2000"
		elseif place == 11 then
			str = "#2001-5000"
		end
	elseif type == 4 and form == "top" then
		if place == 1 then
			str = "#1"
		elseif place == 2 then
			str = "#2-5"
		elseif place == 3 then
			str = "#6-10"
		elseif place == 4 then
			str = "#11-35"
		elseif place == 5 then
			str = "#36-100"
		elseif place == 6 then
			str = "#101-200"
		elseif place == 7 then
			str = "#201-300"
		elseif place == 8 then
			str = "#301-500"
		elseif place == 9 then
			str = "#501-1000"
		elseif place == 10 then
			str = "#1001-2000"
		elseif place == 11 then
			str = "#2001-5000"
		elseif place == 12 then
			str = "#5001-50000"
		end
	end
	
	return str
end

return p