Module:Mazunki/Dungeons

From Melvor Idle
Revision as of 14:06, 13 April 2022 by Mazunki (talk | contribs)

Documentation for this module may be created at Module:Mazunki/Dungeons/doc

local p = require("Module:CombatAreas/AreaTables")
local pm = {}

local AreaData = mw.loadData('Module:CombatAreas/data')
local Constants = require('Module:Constants')
local Shared = require('Module:Shared')
local Icons = require('Module:Icons')
local Items = require('Module:Items')
local Monsters = require('Module:Monsters')
local CombatAreas = require('Module:CombatAreas')
local Pets = require('Module:Pets')


function pm.getDungeonTable(frame)
	local result = '{| class="wikitable sortable stickyHeader"'
	result = result..'\r\n|-class="headerRow-0"'
	result = result..'\r\n!Icon!!Dungeon!!Monsters!!Boss Level!!Total HP!!Min. DR!!Reward(s)!!Boss Pet'

	for i, dungIdx in ipairs(AreaData.displayOrder.dungeons) do
		local dung = CombatAreas.getAreaByID('dungeon', dungIdx)
		result = result..'\r\n|-'
		result = result..'\r\n|data-sort-value="'..dung.name..'"|'..Icons.Icon({dung.name, type='dungeon', size='50', notext=true})
		result = result..'||'..Icons.Icon({dung.name, type='dungeon', noicon=true})
		result = result..'||'..Shared.tableCount(dung.monsters)

		local boss = Monsters.getMonsterByID(dung.monsters[Shared.tableCount(dung.monsters)])
		result = result..'||'..Monsters._getMonsterCombatLevel(boss)
		result = result..'||'..pm.getDungeonTotalHP(dung)
		result = result..'||'..p.getDungeonDRTable(dung)

		result = result..'||'..p._getDungeonRewards(dung, false)
		if dung.petID ~= nil then
			local pet = Pets.getPetByID(dung.petID)
			result = result..'||data-sort-value="'..pet.name..'"|'..Icons.Icon({pet.name, type='pet'})
		else
			result = result..'|| '
		end
	end

	result = result..'\r\n|}'
	return result
end

function pm.getDungeonTotalHP(frame)
	return "N/A"
end

return pm