<?xml version="1.0" encoding="utf-8"?><waypoints type="RUN">
<onLoad><![CDATA[
	DOD_PARTY_LEADER = "LEADER_NAME"
	
	changeProfileOption("AUTO_ELITE_FACTOR",1000)
	changeProfileOption("LOOT",false) -- turn looting off, loot will be performed with custom fucntion in waypoint
	changeProfileOption("LOOT_IN_COMBAT",false)
	changeProfileOption("MAX_TARGET_DIST",180)
	changeProfileOption("RES_AUTOMATIC_AFTER_DEATH",false) -- res won't work well without adding some kind of party position tracking
	changeProfileOption("ANTI_KS",false) -- we want everyone to fight, not just the first one to get aggro
	
	settings.profile.friends = {"Hand of Truth","Rat for Experimentation"} -- do not engage these mobs, we will fly over them
	
	EventMonitorStart("DoD", "CHAT_MSG_PARTY")
		
	function waitForLeader(_jump)
		if getZoneId() ~= 127 and getZoneId() ~= 128 and getZoneId() ~= 209 then
			error("Not in DOD!",0) -- don't jump like an idiot in public, if we aren't in DoD or sewers at this point, something went very wrong!
		end
		yrest(100)
		cprintf(cli.lightred,"Waiting for leader...\n")
		while true do
			local time, moreToCome, _name, _message = EventMonitorCheck("DoD","4,1",true)
			if _message then
				string.lower(_message)
			end
			if _message and (_message == "enter" or _message == "ready" or _message == "boss") then
				break
			else
				if _jump then
					yrest(1500)
					keyboardPress(settings.hotkeys.JUMP.key)
				else
					yrest(500)
				end
			end
			player:update()
		end
		cprintf(cli.lightgreen,"Party is ready!\n")
	end
	
	function lootBoss(_nameOrId)
		local mentos = inventory:itemTotalCount(206879)
		local boss = player:findNearestNameOrId(_nameOrId)
		if boss then
			repeat
				yrest(500*math.random(4))
				boss = player:findNearestNameOrId(_nameOrId)
				if not boss then break end
				player:target(boss)
				player:update()
				Attack()
				printf("Looting...\n")
				yrest(1000)
				player:update()
			until inventory:itemTotalCount(206879) > mentos or inventory:itemTotalCount(206879) > 2993
		end
		cprintf(cli.lightgreen,GetIdName(206879)..": ")
		cprintf(cli.yellow,tostring(inventory:itemTotalCount(206879)).."\n")
	end
	
	function GoThroughPortalDialog(_range,_portalid)
		GoToPortal(_range,_portalid)
		yrest(500)
		local acceptPortal = RoMScript("StaticPopup_Visible('SET_REQUESTDIALOG')")
		if acceptPortal then
			RoMScript("StaticPopup_EnterPressed("..acceptPortal..")")
			waitForLoadingScreen(15)
			yrest(3000)
			player:update()
		end
		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
	end
	
	function ApplyPots()
		useGoodie("speed") -- Unbridled Enthusiasm
		useGoodie("casting") -- Clear Thought
		useGoodie("luck") --Turn of Luck Powder Dust
		useGoodie("defense") --Scarlet Love
		useGoodie("godspeed") --Godspeed
		useGoodie("pdmg") -- Housekeeper Special Salted Fish with Sauce
		useGoodie("critp") -- Housekeeper Special Caviar Sandwich
		useGoodie("patt2") -- Housekeeper Special Spicy Meatsauce Burrito
		useGoodie("patt3") -- Housekeeper Special Unimaginable Salad
		useGoodie("matt3")
	end
	
	npcName = GetIdName(115536) -- Isaac Haden
	function visitmerchant()
		while inventory:getMainHandDurability() < 95 or inventory:itemTotalCount(0) < 12 do
			player:merchant(npcName)
			inventory:update()
			player:clearTarget()
			RoMScript("CloseAllWindows()")
			yrest(500)
		end
	end
	
	startGMDetect()
	
	if getZoneId() == 127 or getZoneId() == 128 then -- we pretty much always fly in DoD, so turn on fly hack if waypoint is started in DoD
		fly()
	end
	
	boss1 = GetIdName(103169)	-- Okander "Mad Man" Mallen
	boss2 = GetIdName(103170)	-- Experiment No.81
	boss3 = GetIdName(103153)	-- Experiment No.203
	boss4 = 103171				-- Prototype No. 114
	boss5 = GetIdName(103155)	-- Maxim Erekat III
	
]]></onLoad>
	<!-- #  1 --><waypoint x="1645" z="-4908" y="752">
		__WPL:setDirection(WPT_FORWARD)
		changeProfileOption("WAYPOINT_DEVIATION", 50)
		visitmerchant()
	</waypoint>
	<!-- #  2 --><waypoint x="1662" z="-4970" y="760">	</waypoint>
	<!-- #  3 --><waypoint x="1660" z="-5072" y="760">	</waypoint>
	<!-- #  4 --><waypoint x="1667" z="-5100" y="761" tag="entrance">
		changeProfileOption("WAYPOINT_DEVIATION", 0)
		player:faceDirection(math.atan2(-5124 - player.Z, 1667 - player.X))
		waitForLeader()
		__WPL:setForcedWaypointType("RUN")
		GoThroughPortal()
		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
	</waypoint>
	<!-- #  5 --><waypoint x="1793" z="2880" y="433" tag="exit">
		changeProfileOption("WAYPOINT_DEVIATION", 0)
		ApplyPots()
		waitForLeader()
		__WPL:setForcedWaypointType("NORMAL")
	</waypoint>
	<!-- #  6 --><waypoint x="1892" z="2887" y="433">	</waypoint>
	<!-- #  7 --><waypoint x="2043" z="2699" y="433">	</waypoint>
	<!-- #  8 --><waypoint x="2124" z="2602" y="432">
		waitForLeader(true)
	</waypoint>
	<!-- #  9 --><waypoint x="2153" z="2569" y="421">	</waypoint>
	<!-- # 10 --><waypoint x="2331" z="2361" y="401" tag="okander">
		lootBoss(boss1)
	</waypoint>
	<!-- BOSS 2 -->
	<!-- #  1 --><waypoint x="2462" z="2338" y="401">
		waitForLeader(true)
		__WPL:setForcedWaypointType("RUN")
		fly()
	</waypoint>
	<!-- #  2 --><waypoint x="2596" z="2338" y="480">	</waypoint>
	<!-- #  3 --><waypoint x="2639" z="2339" y="490">	</waypoint>
	<!-- #  4 --><waypoint x="2711" z="2370" y="527">	</waypoint>
	<!-- #  5 --><waypoint x="2830" z="2434" y="544">	</waypoint>
	<!-- #  6 --><waypoint x="2867" z="2497" y="532">	</waypoint>
	<!-- #  7 --><waypoint x="2872" z="2616" y="490">	</waypoint>
	<!-- #  8 --><waypoint x="2871" z="2683" y="503">	</waypoint>
	<!-- #  9 --><waypoint x="2864" z="2783" y="536">	</waypoint>
	<!-- # 10 --><waypoint x="2872" z="2861" y="542">	</waypoint>
	<!-- # 11 --><waypoint x="2910" z="2884" y="541">	</waypoint>
	<!-- # 12 --><waypoint x="2955" z="2881" y="527">	</waypoint>
	<!-- # 13 --><waypoint x="3045" z="2877" y="492">	</waypoint>
	<!-- # 14 --><waypoint x="3100" z="2894" y="484">	</waypoint>
	<!-- # 15 --><waypoint x="3154" z="2987" y="436">	</waypoint>
	<!-- # 16 --><waypoint x="3227" z="2989" y="447">
		__WPL:setForcedWaypointType("NORMAL")
		flyoff()
		ApplyPots()
		waitForLeader(true)
	</waypoint>
	<!-- # 17 --><waypoint x="3421" z="2981" y="447">
		lootBoss(boss2)
	</waypoint>
	
	<!-- BOSS 3 -->
	<!-- #  1 --><waypoint x="3616" z="2981" y="472">
		waitForLeader(true)
		__WPL:setForcedWaypointType("RUN")
		fly()
	</waypoint>
	<!-- #  2 --><waypoint x="3685" z="2954" y="472">	</waypoint>
	<!-- #  3 --><waypoint x="3741" z="2886" y="482">	</waypoint>
	<!-- #  4 --><waypoint x="3745" z="2749" y="487">	</waypoint>
	<!-- #  5 --><waypoint x="3747" z="2676" y="531">	</waypoint>
	<!-- #  6 --><waypoint x="3751" z="2588" y="551">	</waypoint>
	<!-- #  7 --><waypoint x="3740" z="2536" y="551">	</waypoint>
	<!-- #  8 --><waypoint x="3686" z="2519" y="549">	</waypoint>
	<!-- #  9 --><waypoint x="3592" z="2529" y="546">	</waypoint>
	<!-- # 10 --><waypoint x="3500" z="2527" y="490">	</waypoint>
	<!-- # 11 --><waypoint x="3451" z="2526" y="489">	</waypoint>
	<!-- # 12 --><waypoint x="3408" z="2491" y="513">	</waypoint>
	<!-- # 13 --><waypoint x="3398" z="2419" y="536">	</waypoint>
	<!-- # 14 --><waypoint x="3403" z="2339" y="529">	</waypoint>
	<!-- # 15 --><waypoint x="3442" z="2325" y="528">	</waypoint>
	<!-- # 16 --><waypoint x="3552" z="2337" y="493">	</waypoint>
	<!-- # 17 --><waypoint x="3603" z="2337" y="506">	</waypoint>
	<!-- # 18 --><waypoint x="3704" z="2342" y="543">	</waypoint>
	<!-- # 19 --><waypoint x="3800" z="2342" y="543">	</waypoint>
	<!-- # 20 --><waypoint x="3831" z="2293" y="539">	</waypoint>
	<!-- # 21 --><waypoint x="3826" z="2216" y="506">	</waypoint>
	<!-- # 22 --><waypoint x="3826" z="2158" y="491">	</waypoint>
	<!-- # 23 --><waypoint x="3830" z="2111" y="499">	</waypoint>
	<!-- # 24 --><waypoint x="3881" z="2099" y="510">	</waypoint>
	<!-- # 25 --><waypoint x="3968" z="2102" y="492">	</waypoint>
	<!-- # 26 --><waypoint x="4019" z="2102" y="496">	</waypoint>
	<!-- # 27 --><waypoint x="4102" z="2103" y="489">	</waypoint>
	<!-- # 28 --><waypoint x="4258" z="2104" y="463">	</waypoint>
	<!-- # 29 --><waypoint x="4322" z="2104" y="433">
		__WPL:setForcedWaypointType("NORMAL")
		flyoff()
		ApplyPots()
		waitForLeader(true)
	</waypoint>
	<!-- # 30 --><waypoint x="4603" z="2104" y="432">
		lootBoss(boss3)
	</waypoint>
	
	<!-- BOSS 4 -->
	<!-- #  1 --><waypoint x="4836" z="2105" y="435">
		waitForLeader(true)
		__WPL:setForcedWaypointType("RUN")
		fly()
	</waypoint>
	<!-- #  2 --><waypoint x="4965" z="2103" y="489">	</waypoint>
	<!-- #  3 --><waypoint x="5038" z="2102" y="499">	</waypoint>
	<!-- #  4 --><waypoint x="5109" z="2102" y="493">	</waypoint>
	<!-- #  5 --><waypoint x="5169" z="2103" y="500">	</waypoint>
	<!-- #  6 --><waypoint x="5251" z="2105" y="532">	</waypoint>
	<!-- #  7 --><waypoint x="5343" z="2107" y="543">	</waypoint>
	<!-- #  8 --><waypoint x="5487" z="2106" y="547">	</waypoint>
	<!-- #  9 --><waypoint x="5491" z="2017" y="536">	</waypoint>
	<!-- # 10 --><waypoint x="5490" z="1936" y="515">	</waypoint>
	<!-- # 11 --><waypoint x="5490" z="1822" y="489">	</waypoint>
	<!-- # 12 --><waypoint x="5490" z="1734" y="453">	</waypoint>
	<!-- # 13 --><waypoint x="5491" z="1682" y="430">
		__WPL:setForcedWaypointType("NORMAL")
		flyoff()
		ApplyPots()
		waitForLeader(true)
	</waypoint>
	<!-- # 14 --><waypoint x="5493" z="1478" y="428">
		lootBoss(boss4)
	</waypoint>
	
	<!-- BOSS 5 -->
	<!-- #  1 --><waypoint x="5491" z="1349" y="431">
		waitForLeader(true)
		__WPL:setForcedWaypointType("RUN")
		fly()
	</waypoint>
	<!-- #  2 --><waypoint x="5491" z="1263" y="500">	</waypoint>
	<!-- #  3 --><waypoint x="5489" z="1115" y="500">	</waypoint>
	<!-- #  4 --><waypoint x="5490" z="1032" y="515">	</waypoint>
	<!-- #  5 --><waypoint x="5492" z="928" y="538">	</waypoint>
	<!-- #  6 --><waypoint x="5491" z="846" y="546">	</waypoint>
	<!-- #  7 --><waypoint x="5349" z="842" y="550">	</waypoint>
	<!-- #  8 --><waypoint x="5219" z="844" y="549">	</waypoint>
	<!-- #  9 --><waypoint x="5146" z="845" y="545">	</waypoint>
	<!-- # 10 --><waypoint x="5069" z="845" y="510">	</waypoint>
	<!-- # 11 --><waypoint x="5016" z="846" y="493">	</waypoint>
	<!-- # 12 --><waypoint x="4949" z="847" y="499">	</waypoint>
	<!-- # 13 --><waypoint x="4846" z="897" y="508">	</waypoint>
	<!-- # 14 --><waypoint x="4753" z="941" y="497">	</waypoint>
	<!-- # 15 --><waypoint x="4654" z="956" y="480">	</waypoint>
	<!-- # 16 --><waypoint x="4561" z="955" y="467">	</waypoint>
	<!-- # 17 --><waypoint x="4503" z="956" y="397">
		__WPL:setForcedWaypointType("NORMAL")
		flyoff()
		ApplyPots()
		waitForLeader(true)
	</waypoint>
	<!-- # 18 --><waypoint x="4330" z="956" y="381">
		lootBoss(boss5)
		GoThroughPortalDialog(300,103889) -- need to use id as there are fake portals in last boss room
	</waypoint>
	
	<!-- To the Sewers from res point -->
	<!-- #  1 --><waypoint x="-3813" z="5117" y="19" tag="res">
		__WPL:setForcedWaypointType("RUN")
		player:mount()
	</waypoint>
	<!-- #  2 --><waypoint x="-3722" z="5220" y="12">	</waypoint>
	<!-- #  3 --><waypoint x="-3664" z="5311" y="11">	</waypoint>
	<!-- #  4 --><waypoint x="-3564" z="5362" y="11">	</waypoint>
	<!-- #  5 --><waypoint x="-3458" z="5434" y="9">	</waypoint>
	<!-- #  6 --><waypoint x="-3356" z="5530" y="10">	</waypoint>
	<!-- #  7 --><waypoint x="-3252" z="5629" y="3">	</waypoint>
	<!-- #  8 --><waypoint x="-3164" z="5736" y="4">	</waypoint>
	<!-- #  9 --><waypoint x="-3025" z="5864" y="2">	</waypoint>
	<!-- # 10 --><waypoint x="-2903" z="5980" y="10">	</waypoint>
	<!-- # 11 --><waypoint x="-2842" z="6059" y="9">	</waypoint>
	<!-- # 12 --><waypoint x="-2782" z="6170" y="10">	</waypoint>
	<!-- # 13 --><waypoint x="-2712" z="6284" y="4">	</waypoint>
	<!-- # 14 --><waypoint x="-2622" z="6353" y="6">	</waypoint>
	<!-- # 15 --><waypoint x="-2524" z="6397" y="15">	</waypoint>
	<!-- # 16 --><waypoint x="-2469" z="6465" y="19">	</waypoint>
	<!-- # 17 --><waypoint x="-2472" z="6526" y="30">	</waypoint>
	<!-- # 18 --><waypoint x="-2517" z="6567" y="38">	</waypoint>
	<!-- # 19 --><waypoint x="-2595" z="6612" y="49">	</waypoint>
	<!-- # 20 --><waypoint x="-2726" z="6687" y="32">	</waypoint>
	<!-- # 21 --><waypoint x="-2786" z="6721" y="42">	</waypoint>
	<!-- # 22 --><waypoint x="-2847" z="6764" y="40">	</waypoint>
	<!-- # 23 --><waypoint x="-2865" z="6824" y="40">	</waypoint>
	<!-- # 24 --><waypoint x="-2826" z="6956" y="40">	</waypoint>
	<!-- # 25 --><waypoint x="-2851" z="7047" y="15">	</waypoint>
	<!-- # 26 --><waypoint x="-2838" z="7121" y="-24">	</waypoint>
	<!-- # 27 --><waypoint x="-2912" z="7231" y="-96">
		GoThroughPortal(200)
		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
		changeProfileOption("WAYPOINT_DEVIATION", 25)
	</waypoint>
	<!-- # 28 --><waypoint x="43" z="-882" y="857">
		local jake = GetIdName(115572)
		NPCTeleport(jake,"Please transport me.")
		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
	</waypoint>
</waypoints>