<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
--[[
						"toat" by Rock5
						  Version 2.0

		Takes character from Malatina to Ancient Treasure (AT) mini game
				and optionally buys diamonds along the way
		http://www.solarstrike.net/phpBB3/viewtopic.php?p=35357#p35357
]]

	AccountsToBuyDiamonds = "" 		-- table of account numbers or names to buy max possible diamonds from Cedric.
									-- "all" -- all accounts.
									-- "" -- Do not buy diamonds on any account
									-- {34,37,38} -- Buy diamonds with characters on account numbers 34, 37 and 38
									-- {"accname1","accname3","accname4"} -- Buy diamonds on accounts "accname1","accname3" and "accname4"
	NumberOfTimesToBuyDiamonds = 1  -- Number of times you can buy diamonds per day.

	function IsOnAccountList()
		if type(AccountsToBuyDiamonds) ~= "table" then return false end
		local logid = RoMScript("LogID")
		local accname = RoMScript("GetAccountName()")
		for k,v in pairs(AccountsToBuyDiamonds) do
			if v == logid or v == accname then
				return true
			end
		end
		return false
	end
</onload>
	<!-- #  1 --><waypoint x="4883" z="-1904" y="109">	</waypoint>
	<!-- #  2 --><waypoint x="4999" z="-1946" y="104">	</waypoint>
	<!-- #  3 --><waypoint x="5173" z="-2039" y="109">	</waypoint>
	<!-- #  4 --><waypoint x="5257" z="-2087" y="121">
		if AccountsToBuyDiamonds ~= "" and AccountsToBuyDiamonds ~= nil then
			if AccountsToBuyDiamonds == "all" or IsOnAccountList() then
				local c = 0
				repeat
					if player:target_NPC(115815) then -- Cedric
						c=c+1
						yrest(500)
						RoMScript("ChoiceOption(1)") yrest(500)
					end
				until c >= NumberOfTimesToBuyDiamonds
			end
		end
		--[[local zone, channel = getZoneId()
		if channel ~= 1 then
			RoMScript("ChangeParallelID(1)")
			yrest(30)
		end]]
		--[[if player.Level > 49 then
			player:target_NPC("Tina") yrest(1000)
			RoMScript("ChoiceOption(1)") yrest(1000)
			local hammer = inventory:findItem("Grand Golden Repair Hammer","bags")
			if hammer then
				hammer:moveTo("itemshop")
			end
			yrest(1000)
		end]]
		--[[if player.Level > 79 then
			player:target_NPC("Sophia") yrest(1000)
			RoMScript("ChoiceOption(1)") yrest(2000)
			local puri = inventory:findItem("Purified Fusion Stone","bags")
			if puri then
				puri:moveTo("itemshop")
			end
			yrest(1000)
		end]]
	</waypoint>
	<!-- # 13 --><waypoint x="5281" z="-2202" y="103">
		if 21 > player.Level then
			print("player level is too low to teleport to AT")
			player:sleep()
		end
		if inventory:itemTotalCount(240181) > 970 then
			print("Too many Phirius Shells. Please spend some before continuing.")
			player:sleep()
		end
		yrest(2000)
		player:target_NPC(114087); yrest(2000) -- Kat Rojo
		AcceptQuestByName(GetIdName(422958)) yrest(2000) -- Proceed to the Scar of Despair Camp
		player:target_NPC(114087); yrest(2000) -- Kat Rojo
		if ChoiceOptionByName(RoMScript("TEXT(\"ZONE_SCAR OF DESPAIR\")")) then
			ChoiceOptionByName(RoMScript("TEXT(\"SC_LOSTTREASURE_08\")")) -- "I Am"
			waitForLoadingScreen() yrest(3000)
		else
			print("Can't teleport to AT")
			player:sleep()
		end
	</waypoint>
	<!-- # 10 --><waypoint x="-35783" z="5436" y="161">
		player:target_NPC(113689); yrest(2000) -- Ange Rasa
		CompleteQuestByName(GetIdName(422958)) -- Proceed to the Scar of Despair Camp
		loadPaths("AT")
	</waypoint>
</waypoints>
