Модуль:ItemData

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

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


local p = {}

local lib = require('Module:Feature')

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:ItemData/getter')
    local item     = args['item'] or args[1]
    local datatype = args['datatype'] or args[2]
    local output   = args['output'] or args[3] or nil
    
    local result = get[datatype](item)
    
    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.getItemAbility(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get     = require ('Module:ItemData/getter')
	local item    = args['item'] or args[1]
	local ability = "abilities"
	local str     = ""
	
	local result = get[ability](item)
	
	for k, v in ipairs(result) do
    	if tonumber(args['index']) == k then
    		str = mw.ustring.format('%s/%s/%s/%s', v[1], v[2], v[3], v[4])
    	end
    end
    
    return str
end

function p.getLoot(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get       = require ('Module:ItemData/getter')
	local item      = args['item'] or args[1]
	local str       = ""
	
	local source = get["source"](item)

	str = mw.ustring.format('{{Chest|%s|source=%s|used_in_craft=%s}}', item, source, item)
    
    return frame:preprocess(tostring(str))
end

function p.getLootPack(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get       = require ('Module:ItemData/getter')
	local item      = args['item'] or args[1]
	local loot_data = "loot_data"
	local count

	local result = get[loot_data](item)
	for k, v in ipairs(result) do
    	if tonumber(args['index']) == k then
			count = mw.ustring.format('%d', v[2])
		end
    end
    
    return tonumber(count)
end

function p.getLootType(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get       = require ('Module:ItemData/getter')
	local loot_type = require('Module:ItemData/loot/types')
	local item      = args['item'] or args[1]
	local loot_data = "loot_data"
	local type      = ""

	local result = get[loot_data](item)
	for k, v in ipairs(result) do
    	if tonumber(args['index']) == k then
			type = mw.ustring.format('%s', loot_type[v[3]])
		end
    end
    
    return tostring(type)
end

function p.getLootItems(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get     = require ('Module:ItemData/getter')
	local item    = args['item'] or args[1]
	local loot    = "loot"
	local divNode = mw.html.create('div')
	
	divNode
		:cssText('display: flex; flex-flow: row wrap; justify-content: center;')
		:newline()

	local result = get[loot](item)
	for k, v in ipairs(result) do
    	if tonumber(args['index']) == k then
			for k2, v2 in ipairs(v) do
    			divNode
	    			:tag('div')
	    				:addClass('loot-item')
			    		:wikitext(mw.ustring.format('%s', p.getItemIcon(v[k2][1], "60px", v[k2][2])))
			    		:done()
		    end
		end
    end
    
    return frame:preprocess(tostring(divNode))
end

function p.getItemSource(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get         = require ('Module:ItemData/getter')
	local recipe_data = require ('Module:RecipeData/data')
	local loot_data   = require ('Module:ItemData/loot')
	local boss_data   = require ('Module:BossData/data')
	local item_data   = require ('Module:ItemData/data')
	local gm_data     = require ('Module:GameModes/data')
	local item        = args['item'] or args[1]
	local i           = 0
	local l           = 0
	local m           = 0
	local n           = 0
	local str         = ""
	local checkpoint  = ""
	local checkpoint2 = nil
	local checkpoint3 = nil
	local checkpoint4 = nil
	local checkpoint5 = nil
	local checkpoint6 = nil
	
	local result     = get["source"](item)
	local data       = recipe_data[item]
	
	if (result ~= "Добыча") then
		str = str .. mw.ustring.format('<h2>Способ получения</h2>')
	end
	
	if (result == "Крафт") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Сундук") then
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								i = i + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Босс") then
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					i = i + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Награда") then
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									i = i + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										i = i + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									i = i + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Сундук") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								l = l + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Босс") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					l = l + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Награда") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									l = l + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										l = l + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									l = l + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Награда/Сундук") then
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									i = i + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										i = i + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									i = i + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								l = l + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Награда/Босс") then
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									i = i + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										i = i + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									i = i + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					l = l + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Сундук/Босс") then
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in pairs(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								i = i + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					l = l + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Награда/Сундук") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									l = l + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										l = l + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									l = l + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								m = m + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if m == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Награда/Босс") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									l = l + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										l = l + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									l = l + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					m = m + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if m == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Награда/Сундук/Босс") then
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									i = i + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										i = i + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									i = i + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								i = i + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in pairs(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								l = l + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					m = m + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if m == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	elseif (result == "Крафт/Сундук/Босс") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								l = l + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					m = m + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		str = str .. mw.ustring.format('</div>')
		if m == 0 then
			str = str .. "Нет данных"
		end
	elseif (result == "Крафт/Награда/Босс/Сундук") then
		str = str .. mw.ustring.format('<div class="recipes">')
		if data ~= nil then
			for k, v in ipairs(data) do
				i = i + 1
				str = str .. mw.ustring.format('{{RecipeImage|%s|%d}}', item, k)
			end
		end
		if i == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="awards" style="width:fit-content; width: -moz-fit-content">')
		for k, v in lib.pairsByAlphabeticalKeys(gm_data) do
			for k2, v2 in pairs(gm_data[k]["rewards"]) do
				if gm_data[k]["type"] == 1 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							for k5, v5 in pairs(gm_data[k]["rewards"][k2][k3][k4]) do
								if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
									l = l + 1
									if checkpoint ~= k then
										checkpoint = k
										str = str .. mw.ustring.format('[[Файл:%s|x100px|ссылка=%s]]', gm_data[k]["medals"][1], "События")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 2 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						if k2 == "clan" then
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								for k5, v5 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3][k4]) do
									if (gm_data[k]["rewards"][k2][k3][k4][k5][1] == item) then
										l = l + 1
										if checkpoint2 ~= gm_data[k]["type"] then
											checkpoint2 = gm_data[k]["type"]
											str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
										end
									end
								end
							end
						else
							for k4, v4 in pairs(gm_data[k]["rewards"][k2][k3]) do
								if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
									l = l + 1
									if checkpoint2 ~= gm_data[k]["type"] then
										checkpoint2 = gm_data[k]["type"]
										str = str .. mw.ustring.format('[[Файл:Иконка_осады.png|x100px|ссылка=%s]]', "Осады")
									end
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 3 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint3 ~= gm_data[k]["type"] then
									checkpoint3 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_league.png|x100px|ссылка=%s]]', "Лига Чемпионов")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 4 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint4 ~= gm_data[k]["type"] then
									checkpoint4 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:ДД Драфт.png|100px|ссылка=%s]]', "Драконий драфт")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 5 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in lib.pairsByAlphabeticalKeys(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint5 ~= gm_data[k]["type"] then
									checkpoint5 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_hunt.png|98px|ссылка=%s]]', "Королевская охота")
								end
							end
						end
					end
				elseif gm_data[k]["type"] == 6 then
					for k3, v3 in pairs(gm_data[k]["rewards"][k2]) do
						for k4, v4 in ipairs(gm_data[k]["rewards"][k2][k3]) do
							if (gm_data[k]["rewards"][k2][k3][k4][1] == item) then
								l = l + 1
								if checkpoint6 ~= gm_data[k]["type"] then
									checkpoint6 = gm_data[k]["type"]
									str = str .. mw.ustring.format('[[Файл:icon_lairs.png|80px|ссылка=%s]]', "Логова")
								end
							end
						end
					end
				end
			end
		end
		if l == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			for k2, v2 in pairs(boss_data[k]["loot"]) do
				if (v2[1] == item) then
					m = m + 1
					str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
				end
			end
		end
		if m == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
		str = str .. mw.ustring.format('<div class="chests" style="width:fit-content; width: -moz-fit-content">')
		for k, v in ipairs(loot_data) do
			for k1, v1 in ipairs(v) do
				if (v[k1][1] == item) then
					for k2, v2 in lib.pairsByAlphabeticalKeys(item_data) do
						for k3, v3 in pairs(item_data[k2]["loot"]) do
							if (v3[1] == k) then
								n = n + 1
								if checkpoint ~= k2 then
									checkpoint = k2
									str = str .. mw.ustring.format('%s', p.getItemIcon(k2, "75px"))
								end
							end
						end
					end
				end
			end
		end
		if n == 0 then
			str = str .. "Нет данных"
		end
		str = str .. mw.ustring.format('</div>')
	end

	return frame:preprocess(tostring(str))	
end

function p.getItemSummon(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local get       = require ('Module:ItemData/getter')
	local boss_data = require ('Module:BossData/data')
	local item      = args['item'] or args[1]
	local summon    = "summon"
	local str       = ""
	
	local result    = get[summon](item)
	
	if (result == true) then
		str = str .. mw.ustring.format('<h2>Используется для вызова</h2><div class="bosses" style="width:fit-content; width: -moz-fit-content">')
		for k, v in pairs(boss_data) do
			if (boss_data[k]["summon"] == item) then
				str = str .. mw.ustring.format('[[Файл:%s|100px|ссылка=%s/босс]]', boss_data[k]["icon"], k)
			end
		end
		str = str .. mw.ustring.format('</div>')
	end
	
	return frame:preprocess(tostring(str))
end

function p.getItemUsedInCraft(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local recipe_data = require ('Module:RecipeData/data')
	local item        = args['item'] or args[1]
	local str         = ""
	local checkpoint  = nil
	
	if p.checkItemUsedInCraft(item) then
		str = str .. mw.ustring.format('<h2>Используется в крафте</h2><div class="used-in-craft" style="width:fit-content; width: -moz-fit-content">')
	end
	
	for k, v in lib.pairsByAlphabeticalKeys(recipe_data) do
		for k2, v2 in ipairs(recipe_data[k]) do
			for k3, v3 in ipairs(recipe_data[k][k2]["ingredients"]) do
				if (recipe_data[k][k2]["ingredients"][k3][1] == item) then
					if checkpoint ~= k then
						checkpoint = k
						str = str .. mw.ustring.format('%s', p.getItemIcon(k, "50px"))
					end
				end
			end
		end
	end
	
	if p.checkItemUsedInCraft(item) then
		str = str .. mw.ustring.format('</div>')
	end
	
	return frame:preprocess(tostring(str))
end

function p.checkItemUsedInCraft(item)
	local recipe_data = require ('Module:RecipeData/data')
	
	for k, v in lib.pairsByAlphabeticalKeys(recipe_data) do
		for k2, v2 in ipairs(recipe_data[k]) do
			for k3, v3 in ipairs(recipe_data[k][k2]["ingredients"]) do
				if (recipe_data[k][k2]["ingredients"][k3][1] == item) then
					return true
				end
			end
		end
	end
end

function p.getItemIcon(item, size, count, link)
	local item_data    = require ('Module:ItemData/data')
	local rarity_data  = require ('Module:ItemData/rarities')
	local rarity, icon = ""
	
	if size == nil then
		size = "30px"
	end
	
	if count == nil then
		count = ""
	end
	
	if link == nil then
		link = ""
	end
	
	if item == "Нет шлема" then
		return mw.ustring.format('{{ii|Нет шлема|no_helmet.png|обычный|size=40px|link=}}')
	elseif item == "Нет доспеха" then
		return mw.ustring.format('{{ii|Нет доспеха|no_armor.png|обычный|size=40px|link=}}')
	elseif item == "Нет оружия" then
		return mw.ustring.format('{{ii|Нет оружия|no_weapon.png|обычный|size=40px|link=}}')
	elseif item == "Нет обуви" then
		return mw.ustring.format('{{ii|Нет обуви|no_shoes.png|обычный|size=40px|link=}}')
	elseif item == "Нет кольца" then
		return mw.ustring.format('{{ii|Нет кольца|no_ring.png|обычный|size=40px|link=}}')
	elseif item == "Нет ожерелья" then
		return mw.ustring.format('{{ii|Нет ожерелья|no_necklace.png|обычный|size=40px|link=}}')
	end
	
	if lib.lookup(item_data, item) then
		icon = item_data[item]["icon"]
	else
		return item
	end
	
	if rarity_data[item_data[item]["rarity"]] and rarity_data[item_data[item]["rarity"]] ~= nil then
		rarity = rarity_data[item_data[item]["rarity"]]
	else
		rarity = "обычный"
	end
	
	return mw.ustring.format('{{ii|%s|%s|%s|size=%s|count=%s|link=%s}}', item, icon, rarity, size, count, link)
end

function p.getIconItem(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local item_data    = require ('Module:ItemData/data')
	local rarity_data  = require ('Module:ItemData/rarities')
	local rarity, icon, size, count = ""
	
	if args['size'] == nil then
		size = "30px"
	else
		size = args['size']
	end
	
	if args['count'] == nil then
		count = ""
	else
		count = args['count']
	end
	
	if args['link'] == nil then
		link = ""
	else
		link = args['link']
	end
	
	if args['item'] == "Нет шлема" then
		return mw.ustring.format('{{ii|Нет шлема|no_helmet.png|обычный|size=40px|link=}}')
	elseif args['item'] == "Нет доспеха" then
		return mw.ustring.format('{{ii|Нет доспеха|no_armor.png|обычный|size=40px|link=}}')
	elseif args['item'] == "Нет оружия" then
		return mw.ustring.format('{{ii|Нет оружия|no_weapon.png|обычный|size=40px|link=}}')
	elseif args['item'] == "Нет обуви" then
		return mw.ustring.format('{{ii|Нет обуви|no_shoes.png|обычный|size=40px|link=}}')
	elseif args['item'] == "Нет кольца" then
		return mw.ustring.format('{{ii|Нет кольца|no_ring.png|обычный|size=40px|link=}}')
	elseif args['item'] == "Нет ожерелья" then
		return mw.ustring.format('{{ii|Нет ожерелья|no_necklace.png|обычный|size=40px|link=}}')
	end
	
	if lib.lookup(item_data, args['item']) then
		icon = item_data[args['item']]["icon"]
	else
		return args['item']
	end
	
	if rarity_data[item_data[args['item']]["rarity"]] and rarity_data[item_data[args['item']]["rarity"]] ~= nil then
		rarity = rarity_data[item_data[args['item']]["rarity"]]
	else
		rarity = "обычный"
	end
	
	return frame:preprocess(mw.ustring.format('{{ii|%s|%s|%s|size=%s|count=%s|link=%s}}', args['item'], icon, rarity, size, count, link))
end

function p.getItemCategoriesTable(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local item_data       = require ('Module:ItemData/data')
	local categories_data = require ('Module:ItemData/categories')
	local ability_data    = require ('Module:ItemData/abilities')
	local category        = args['category'] or args[1]
	local items           = {}
	local type            = 0
	local property1       = ""
	local property2       = ""
	local property3       = ""
    local tableNode       = mw.html.create('table')
    
    for k, v in lib.pairsByAlphabeticalKeys(item_data) do
    	if item_data[k]['categories'] ~= nil then
	    	for k1, v1 in ipairs(item_data[k]['categories']) do
	    		if category == categories_data[item_data[k]['categories'][k1]] then
	    			table.insert(items, k)
	    		end
	    	end
	    end
    end
    
    for _, v2 in lib.pairsByAlphabeticalKeys(items) do
    	if item_data[v2]['type'] == 1 then
    		type = 1
    	elseif item_data[v2]['type'] == 2 then
    		type = 2
    	elseif item_data[v2]['type'] == 3 then
    		type = 3
    	elseif item_data[v2]['type'] == 4 then
    		type = 4
    	end
    end
    
    tableNode
        :addClass('wikitable sortable')
        :cssText('width: 100%; text-align: center; display: table;')
        :newline()
    
    if type == 3 then
		tableNode
	        :tag('tr')
	            :css('white-space', 'nowrap')
	            :tag('th')
	            	:css('width', '100px')
	                :wikitext('Название')
	                :done()
	            :tag('th')
	                :attr('class', 'unsortable')
	                :css('width', '60px')
	                :wikitext('Иконка')
	                :done()
	            :tag('th')
	            	:attr('class', 'unsortable')
	                :wikitext('Способности')
	                :done()
	            :done()
    end
    
    for k3, v3 in lib.pairsByAlphabeticalKeys(items) do
        local rowNode = mw.html.create('tr')
        
        if item_data[v3]['abilities'][2] ~= nil then
        	property1 = ability_data[item_data[v3]['abilities'][2]][2]
        	property2 = ability_data[item_data[v3]['abilities'][2]][3]
        	property3 = ability_data[item_data[v3]['abilities'][2]][4]
        end
        
        rowNode
            :tag('td')
                :attr('data-sort-value', k3)
                :wikitext(mw.ustring.format('[[%s]]', item_data[v3]['name']))
                :done()
            :tag('td')
                :wikitext(mw.ustring.format('%s', p.getItemIcon(item_data[v3]['name'], "50px")))
                :done()
            :tag('td')
                :wikitext(mw.ustring.format('<div><strong>%s (%s)</strong>: %s</div>%s',
                	ability_data[item_data[v3]['abilities'][1]][2],
                	ability_data[item_data[v3]['abilities'][1]][3],
                	ability_data[item_data[v3]['abilities'][1]][4],
                	lib.ternary(property1 == "", "",
                		mw.ustring.format('<div><strong>%s (%s)</strong>: %s</div>', property1, property2, property3)
                		)
                	))
                :done()
        	:done()
        tableNode:node(rowNode):newline()
    end
    
    return frame:preprocess(tostring(tableNode))
end

function p.getItemCategories(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
		
	local item_data       = require ('Module:ItemData/data')
	local categories_data = require ('Module:ItemData/categories')
	local item            = args['item'] or args[1]
	local categories      = {}
	local str             = ""
	local divNode         = mw.html.create('div')
	
	if item_data[item]["categories"] ~= nil then
    	for _, v in ipairs(item_data[item]["categories"]) do
			divNode
				:wikitext(string.format('[[Категория:%s]]', categories_data[v])):newline()
				:done()
		end
	end
	
	return frame:preprocess(tostring(divNode))
end

return p