<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad><![CDATA[
	DOD_SOLO = false
	DOD_PARTY_MEMBERS = {""}
	
	if not DOD_SOLO then
		SlashCommand("ILG on")
	end

	loadProfile("Main")
	setwindow(206879)
	changeProfileOption("INV_AUTOSELL_FROMSLOT", 1)
	changeProfileOption("INV_AUTOSELL_TOSLOT", 30)
	changeProfileOption("EGGPET_ENABLE_ASSIST", "true")
	changeProfileOption("INV_AUTOSELL_ENABLE", "true")
	changeProfileOption("AUTO_ELITE_FACTOR", 1000)	
	changeProfileOption("AUTO_ELITE_FACTOR",1000)
	changeProfileOption("LOOT_IN_COMBAT",false)
	changeProfileOption("LOOT_ALL",false)
	changeProfileOption("LOOT",false)
	
	if DOD_SOLO then
		if player.Name == "Char1" then
			joinname = "Char2"
		elseif player.Name == "Char3" then
			joinname = "Char4"
		else
			error("No party match!",0)
		end
	end

	function Countround()
		Count = Count+1;
		cprintf(cli.pink, "Round Number: %s\n\n", Count)
	end
	
	function CleanBagDOD()
	   for i, item in pairs(inventory.BagSlot) do
		if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
 	        settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then

	         if item:isType("Materials") then
	            item:delete()
	         end
	         if item:isType("Arrows") then
	            item:delete()
	         end
	         if item:isType("Projectiles") then
	            item:delete()
	         end
	         if ( item:isType("Weapons") or item:isType("Armor") ) and (1000 > item.Worth and 5 > item.Quality)then
	            item:delete()
	         end
		if item:isType("Equipment Enhancement") then
	            item:delete()
	         end
		if item.Name  == "Wild Boar Meat" then
	            item:delete()
	         end 
		if item:isType("Potions") then
	            item:delete()
	         end          
	      end
	   end
	end 

	function autoInvite()
		if DOD_SOLO then
			while ( RoMScript("GetNumPartyMembers()") > 1 ) do
				RoMScript("LeaveParty()")
				yrest(2000)
			end
			for i = 1, 3 do
				if( RoMScript("GetNumPartyMembers()") < 2 ) then
					RoMScript("InviteByName('"..joinname.."')")
					printf("Waiting for party join...\n")
				end
				yrest(2000)
				if RoMScript("GetNumPartyMembers()") > 1 then
					break
				end
				if i == 3 then
					error("Party join failed!",0)
				end
			end
		else
			while RoMScript("GetNumPartyMembers()") > 1 do
				SlashCommand("ILG destroy")
				cprintf(cli.yellow,"ILG destroy\n")
				yrest(2000)
			end
			SlashCommand("ILG inv")
			cprintf(cli.yellow,"ILG inv\n")
			yrest(2000)
			if RoMScript("GetNumPartyMembers()") <= #DOD_PARTY_MEMBERS then
				for i = 1, #DOD_PARTY_MEMBERS do
					cprintf(cli.yellow,"Inviting "..DOD_PARTY_MEMBERS[i].."\n")
					RoMScript("InviteByName('"..DOD_PARTY_MEMBERS[i].."')")
					yrest(2000)
				end
			end
		end
		RoMScript("SetInstanceLevel('normal')")
	end
	
	function waitForParty()
		repeat
			local we_ready = true
			player:update()
			for i = 1, #DOD_PARTY_MEMBERS do
				local _partymember = player:findNearestNameOrId(DOD_PARTY_MEMBERS[i])
				if not _partymember or (_partymember and distance(player.X,player.Z,player.Y,_partymember.X,_partymember.Z,_partymember.Y) > 150) then
					we_ready = false
					cprintf(cli.lightred,"Waiting for "..DOD_PARTY_MEMBERS[i].."\n")
				end
			end
			yrest(500)
		until we_ready
		cprintf(cli.lightgreen,"Party is ready!\n")
	end
	
	function ApplyPots()
	if Magic_Tambourine == true then
		if inventory:itemTotalCount(204463) >= 1 then
			inventory:useItem(204463) -- 3 days
			yrest(5500)
		elseif inventory:itemTotalCount(204571) >= 1 then
			inventory:useItem(204571) -- 7 days
			yrest(5500)
		elseif inventory:itemTotalCount(206420) >= 1 then
			inventory:useItem(206420) -- 30 days
			yrest(5500)
		end
		elseif Magic_Tambourine == party_true then
			yrest(5500)
		end
	if Magic_Guitar == true then
		if inventory:itemTotalCount(204461) >= 1 then
			inventory:useItem(204461) -- 3 days
			yrest(5500)
		elseif inventory:itemTotalCount(206418) >= 1 then
			inventory:useItem(206418) -- 7 days
			yrest(5500)
		elseif inventory:itemTotalCount(204569) >= 1 then
			inventory:useItem(204569) -- 30 days
			yrest(5500)
		end
		elseif Magic_Tambourine == party_true then
			yrest(5500)
		end
		changeProfileSkill("MAGE_FLAME", "AutoUse", true);
		changeProfileSkill("MAGE_FIREBALL", "AutoUse", true);
		changeProfileSkill("MAGE_FLAME", "Priority", 90);
		changeProfileSkill("MAGE_FIREBALL", "Priority", 100);
		useGoodie("mdmg1");
		useGoodie("mdmg2");
		useGoodie("mdmg1");
		useGoodie("casting");
		useGoodie("speed");
		useGoodie("matt1");
		useGoodie("matt2");
		useGoodie("matt3");
		useGoodie("defense");
		player:cast("MAGE_ESSENCE_OF_MAGIC");
		player:cast("PRIEST_MAGIC_BARRIER");
		player:cast("MAGE_ENERGY_INFLUX");
		player:cast("MAGE_ELECTROSTATIC_CHARGE");
		player:cast("MAGE_INTENSIFICATION");
		player:cast("MAGE_ELEMENTAL_CATALYSIS");
		player:cast("PRIEST_REGENERATE");
	end
	
	function trash_boss()
		local target = player:getTarget()
		local _tb = false
		local spawnboss = player:findNearestNameOrId("Okander \"Mad Man\" Mallen")
		if spawnboss then
			ApplyPots()
			player:target(spawnboss)
			cprintf(cli.pink, "!!! Papatayin kita hayop ka !!!\n")
		if target.HP > 0 then
			player:update();
			player:cast("MAGE_FLAME");
			yrest(500);
			cprintf(cli.pink, "Kame Hame Wave!!!\n")
		if( arg1.Name == "MAGE_FLAME" ) then
			player:cast("MAGE_FLAME");
			cprintf(cli.pink, "Kame Hame Wave!!!!!\n")
			end
			player:cast("MAGE_FLAME");
			yrest(500);
			cprintf(cli.pink, "Kame Hame Wave!!!\n")
			player:cast("MAGE_FLAME");
			yrest(500);
			keyboardPress( key.VK_1 );
			  _tb = false
			else
 			   _tb = true
			end
			else
			  _tb = true
			end
			  return _tb
			end

	function CountObjectsNearPoint(_nameorid, _point, inrange, printnames)
		if type(_point) ~= "table" then _point = {player.X,player.Z,player.Y} end
		local objectList = CObjectList();
		local detected = {}
	
		objectList:update()
		for i = 0,objectList:size() do
			local obj = objectList:getObject(i)
			if obj ~= nil and (obj.Id == _nameorid or obj.Name == _nameorid) and obj.Address ~= player.Address and obj.Name ~= "<UNKNOWN>" and (inrange == nil or inrange >= distance(_point.X,_point.Z,_point.Y,obj.X,obj.Z,obj.Y) ) then
				if printnames then
					table.insert(detected,obj.Name)
				end
			end
		end
		if #detected > 0 then
			cprintf(cli.yellow,"Objects in range:\n")
			for i = 1, #detected do
				cprintf(cli.pink,detected[i].."\t")
			end
			printf("\n")
		end
		return #detected
	end
	
	npcName = GetIdName(115536) -- Isaac Haden
	function visitmerchant()
		if inventory:getMainHandDurability() < 95 or inventory:itemTotalCount(0) < 12 then
			return true
		else
			return false
		end
	end
	mentos = 0
]]></onLoad>
	<!-- #  1 --><waypoint x="1645" z="-4908" y="752">
		__WPL:setDirection(WPT_FORWARD)
		if visitmerchant() then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("merchant"))
		end
	</waypoint>
	<!-- #  2 --><waypoint x="1662" z="-4970" y="760" tag="start">
	</waypoint>
	<!-- #  3 --><waypoint x="1660" z="-5072" y="760">	</waypoint>
	<!-- #  4 --><waypoint x="1667" z="-5124" y="761" tag="entrance">
		if not DOD_SOLO then waitForParty() end
		__WPL:setForcedWaypointType("RUN")
		autoInvite()
		if not DOD_SOLO then sendPartyChat("enter") end
		GoThroughPortal(200)
		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
	</waypoint>
	<!-- #  5 --><waypoint x="1793" z="2880" y="433" tag="exit">
		if __WPL.Direction == WPT_BACKWARD then
			__WPL:setForcedWaypointType("RUN")
			GoThroughPortal(200)
			player:update()
			if getZoneId() ~= 209 then
				if RoMScript("GetNumPartyMembers()") > 1 then
					RoMScript("LeaveParty()")
					waitForLoadingScreen(15)
				else
					RoMScript("SendWedgePointReport()")
					waitForLoadingScreen(75)
				end
				__WPL:setDirection(WPT_FORWARD)
			end
			__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
		else
			if not DOD_SOLO then waitForParty() end
			if not DOD_SOLO then sendPartyChat("ready") end
			__WPL:setForcedWaypointType("TRAVEL")
		end
	</waypoint>
	<waypoint x="1793" z="2880" y="433" tag="instance">
		fly()
		__WPL:setForcedWaypointType("TRAVEL")			</waypoint>
	<waypoint x="1889" z="2880" y="560">				</waypoint>
	<waypoint x="1952" z="2814" y="560">teleportToWP()		</waypoint>
	<waypoint x="2019" z="2737" y="560">teleportToWP()		</waypoint>
	<waypoint x="2061" z="2675" y="463">teleportToWP()		</waypoint>
	<waypoint x="2124" z="2597" y="463">flyoff()			</waypoint>
	<waypoint x="2123" z="2598" y="432">teleportToWP()		</waypoint>
	<waypoint x="2192" z="2526" y="401">
		CleanBagDOD()
		__WPL:setForcedWaypointType("NORMAL")
		settings.profile.friends = {"Incomplete Bloody Beast"}
		changeProfileOption("LOOT_ALL",true)
		changeProfileOption("LOOT",true)
		if __WPL.Direction == WPT_FORWARD then
			mentos = inventory:itemTotalCount("Ancient Memento")
			if not DOD_SOLO then
				waitForParty()
				sendPartyChat("okander")
			end
		end
	</waypoint>
	<!-- # 10 --><waypoint x="2204" z="2510" y="401" tag="okander">
		if CountObjectsNearPoint("Okander") > 0 then
			if not player.Battling then
				yrest(250)
			end
			__WPL:setWaypointIndex(__WPL:findWaypointTag("okander"))
		else
			__WPL:setWaypointIndex(__WPL:findWaypointTag("out"))
			repeat
				yrest(500*math.random(4))
				local okander = player:findNearestNameOrId("Okander")
				if not okander then break end
				player:target(okander)
				player:update()
				player:loot()
			until inventory:itemTotalCount("Ancient Memento") > mentos
		end
	</waypoint>
	<waypoint x="2192" z="2526" y="401" tag="out">
		settings.profile.friends = {"Incomplete Bloody Beast"}
		useGoodie("godspeed");
		CleanBagDOD()
		fly()
	</waypoint>
	<waypoint x="2123" z="2598" y="432">teleportToWP()			</waypoint>
	<waypoint x="2061" z="2675" y="463">teleportToWP()			</waypoint>
	<waypoint x="2019" z="2737" y="560">teleportToWP()			</waypoint>
	<waypoint x="1952" z="2814" y="560">teleportToWP()			</waypoint>	
	<waypoint x="1889" z="2880" y="560">flyoff() 
		speed(73)							</waypoint>
	<waypoint x="1891" z="2876" y="433" tag="exit" type="TRAVEL">		</waypoint>
	<waypoint x="1700" z="2886" y="433" type="TRAVEL">
		GoThroughPortal(200)
		player:update()
		local zoneid = RoMScript("GetZoneID()")
			if zoneid == zid then
				ireset()
				waitForLoadingScreen()
				__WPL:setWaypointIndex(__WPL:findWaypointTag("return"))
			else
				__WPL:setWaypointIndex(__WPL:findWaypointTag("start"))
						end
				</waypoint>
	
	<!-- # 11 --><waypoint x="1704" z="-4756" y="752" tag="merchant">
					CleanBagDOD()
					local bcount = inventory:getItemCount(0)
					player:update()
					player:merchant(115536)				--== no more works on Chapter IV ==--
					yrest(500)
					local cbcount = inventory:getItemCount(0)
					if bcount == cbcount then
						if player:openStore(115536) then
							for i, item in pairs(inventory.BagSlot) do
							if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT +60 and settings.profile.options.INV_AUTOSELL_TOSLOT +60 >= item.SlotNumber then
								item:use() -- sells it to the store
							end
						end
					end
				end
		__WPL:setWaypointIndex(__WPL:findWaypointTag("start"))
	</waypoint>
	
	<!-- To the Sewers -->
	<!-- #  1 --><waypoint x="-3813" z="5117" y="19" tag="return">
		__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))
	</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>