<waypoints type="TRAVEL"><!-- Tier_Maker v1.0.3 by Bot_romka -->

	<onLoad>
<!-- Variables -->
		-- MailSenders Names
		MailSender1 = "Name1"							<!-- Name of Mail Sender -->
		MailSender2 = "Name2"							<!-- Name of Mail Sender -->
		MailSender3 = "Name3"							<!-- Name of Mail Sender -->
		MailSender4 = "Name4"							<!-- Name of Mail Sender -->
		MailSender5 = "Name5"							<!-- Name of Fusion stone Sender -->
		-- Tier Receivers Names
		TierRecs = {"TierRec1", "TierRec2", "TierRec2"}	<!-- Names table of Tier Receiver -->
		--TierRecs = {"TierRec4", "TierRec5", "TierRec6"}	<!-- Names table of Tier Receiver -->
		TierReceiver2 = "TierReceiver2"						<!-- Name of Tier Receiver2 -->
		-- Stone Receivers
		Charstone1 = "Charstone1"					<!-- Names of Stone Receiver -->
		Charstone2 = {"Charstone2", "Charstone3", "Charstone4",	"Charstone5", "Charstone6",
			"Charstone7", "Charstone8"}			<!-- Names table of Stone Receiver -->
		-- Messages
		text1 = "SendMe"							<!-- Message to Mail Sender -->
		text2 = "Go."								<!-- Message to Twink-Mail Receiver -->
		WhaitTime = 1200;								<!-- Set whait time in seconds -->
		TierTwinkClient = "C_TwinkClient"				<!-- Set Twink Client for restart. specify you client shortcut links name if it not contains *client* -->

		-- Set Ignored Chars
		IgnoredChars = {"1", "2", "21", "3", "4", "5", "6", "7", "8", "9", "10", "11",
			"P1", "P2", "P3", "P4",	"P5", "P6", "P7", "P8"}

		-- Set CharList
		SetCharList({ {
						{account=8,chars={}}, {account=9,chars={}}, {account=10,chars={}}, {account=11,chars={}},
						{account=12,chars={}}, {account=13,chars={}}, {account=14,chars={}},
						},
					{
						{account=27,chars={}}, {account=28,chars={}}, {account=29,chars={}}, {account=30,chars={}},
						{account=31,chars={}}, {account=32,chars={}}, {account=33,chars={}},
						},
					{
						{account=78,chars={}}, {account=79,chars={}}, {account=80,chars={}}, {account=81,chars={}},
						{account=82,chars={}}, {account=83,chars={}}, {account=84,chars={}},
						},
					{
						{account=97,chars={}}, {account=98,chars={}}, {account=99,chars={}}, {account=100,chars={}},
						{account=101,chars={}}, {account=102,chars={}}, {account=103,chars={}},
						},
					{
						{account=52,chars={1, 2}},
						},
					{
						{account=105,chars={1, 2, 3, 4}},
						},
					})
		PrintCharList();

		-- Variables for onClientCrash
		local currAcc = RoMScript("LogID");
		local currChar = RoMScript("CHARACTER_SELECT.selectedIndex");
		local dirPath = string.gsub( getExecutionPath()," ","\" \"" );
		local currPath = __WPL.FileName;
		local Clientlink = TierTwinkClient;		-- specify you client shortcut links name if it not contains *client*
		local AfterAllError = false;			-- set to false or true for restart after all error
		-- set Clientlink if not specify
		if( Clientlink == false or Clientlink == nil ) then
			local romdir = getDirectory(dirPath);
			for i,v in pairs(romdir) do
				local match = string.match(string.lower(v), "client(.*)%.lnk")
				if( match ~= nil ) then
					Clientlink = v
					break
				end
			end
		end;
		cprintf(cli.white, "Current Acc: %s, Char: %s, Path: %s, dirPath: %s, Client: %s\n\n", currAcc, currChar, currPath, dirPath, Clientlink)
		-- onClientCrash
		function onClientCrash()
			if AfterAllError then
				killClient()
			else
				yrest(5000)
			end
			if( not windowValid(getAttachedHwnd()) or  AfterAllError ) then
				-- write Crash Log
				local filename = ""..dirPath.."/logs/CrashLog.log";
				local file, err = io.open(filename, "a+");
				if file then
					file:write("Account: "..currAcc.." \tName: " ..string.format("%-10s",player.Name ).." \tDate: "..os.date().." \tPath: "..currPath.." \n")
					file:close()
				end
				-- Restart client and Bot
				os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/login acc:"..currAcc.." char:"..currChar.." client:"..Clientlink.." path:"..currPath.."")
				os.exit()
			end
		end;
		-- check Clientlink
		if( Clientlink ) then
			atError(onClientCrash)
		end;

		-- Start Crash Window Killer
		local name, version = "Crash Window Killer", "v0.1"
		local windowname = name.." ["..version.."] started."
		local crashwinkiller = findWindow(windowname)
		if( crashwinkiller == 0 ) then
			local a,b,c = os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/CrashWindowKiller.lua")
			if not a then
				error("Trouble executing file. Values returned were: "..(a or "nil")..", "..(b or "nil")..", "..(c or "nil"))
			end
		end;

	<!-- Include onLoad -->
		include("waypoints/Tier_Maker_onLoad.lua",true)
	</onLoad>
<!-- ==================================================================================== -->

<!-- 1 -->
<!-- Auto MailSender1. Kampel Town -->
<!-- #  1 --><waypoint x="-3203" z="48882" y="176" tag="KampelTownMailbox">
		KampelTownMailbox();
	</waypoint>
<!-- #  2 --><waypoint x="-3164" z="48891" y="175"></waypoint>
<!-- #  3 --><waypoint x="-3138" z="48903" y="173" tag="FreudDinksStore">
		FreudDinksStore();
	</waypoint>
<!-- #  4 --><waypoint x="-3164" z="48891" y="175" tag="Go2KampelTownMailbox">
		__WPL:setWaypointIndex(__WPL:findWaypointTag("KampelTownMailbox"));
	</waypoint>

<!-- 2 -->
<!-- Auto MailSender2. Sascilia Steppes -->
<!-- #  5 --><waypoint x="-38220" z="1758" y="24" tag="SasciliaSteppesMailbox">
		SasciliaSteppesMailbox();
	</waypoint>

<!-- 3 -->
<!-- Auto MailSender3. Wailing Fjord -->
<!-- #  6 --><waypoint x="-10255" z="2260" y="19" tag="SpiderfootStore">
		SpiderfootStore();
	</waypoint>
<!-- #  7 --><waypoint x="-10144" z="2259" y="20">	</waypoint>
<!-- #  8 --><waypoint x="-10067" z="2260" y="23">	</waypoint>
<!-- #  9 --><waypoint x="-9974" z="2259" y="23">	</waypoint>
<!-- # 10 --><waypoint x="-9887" z="2262" y="23" tag="WailingFjordMailbox">
		if( CheckTierItems() >= 9 ) then
			WailingFjordMailbox();
		end;
	</waypoint>
<!-- # 11 --><waypoint x="-9958" z="2256" y="23">	</waypoint>
<!-- # 12 --><waypoint x="-10051" z="2253" y="23">	</waypoint>
<!-- # 13 --><waypoint x="-10192" z="2255" y="18">
		__WPL:setWaypointIndex(__WPL:findWaypointTag("SpiderfootStore"));
	</waypoint>

<!-- 4 -->
<!-- Auto MailReceiver -->
<!-- # 14 --><waypoint x="31954" z="3278" tag="StartTwink">
		StartTwink();
	</waypoint>
<!-- # 15 --><waypoint x="31925" z="3391"></waypoint>
<!-- # 16 --><waypoint x="31890" z="3511"></waypoint>
<!-- # 17 --><waypoint x="31844" z="3555"></waypoint>
<!-- # 18 --><waypoint x="31797" z="3597" tag="ElvenIslandMailbox">
		-- Check for Error
		if( player.free_counter1 > 10 ) then
			error("\a\a\a\a\a\a\aError. Error. Error. Error. Error.");
		end;
		-- Elven Island Mailbox
		ElvenIslandMailbox()
	</waypoint>

<!-- CoastOpp -->
<!-- # 19 --><waypoint x="-6323" z="-3907" tag="CoastOpp">
		-- Tp to Varanas
		player:target_NPC(118002); yrest(1000);						-- Упрямый снуп
		RoMScript("ChoiceOption(1);"); yrest(1000);
		RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
		print("		Tp to Varanas");
		waitForLoadingScreen(60);
		player:update();

		-- Check error
		Cur_Gold = memoryReadInt( getProc(), addresses.moneyPtr )
		if( 20 > Cur_Gold ) then
			inventory:update();
			inventory:useItem(201843);								-- 1 Lvl Giftbag
			inventory:useItem(201844);								-- 2 Lvl Giftbag
			yrest(1500);
		end;
		if ( getZoneId() ~= 2 and getZoneId() ~= 1002 ) then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("CoastOpp"));
		end;
	</waypoint>
<!-- # 20 --><waypoint x="2296" z="1161" tag="VaranasSnup">
		inventory:update();
		player:mount();
	</waypoint>
<!-- # 21 --><waypoint x="2458" z="1107"></waypoint>
<!-- # 22 --><waypoint x="2603" z="1036"></waypoint>
<!-- # 23 --><waypoint x="2765" z="964" tag="TwinkUnstick">
		-- Check for Varanas Error
		if not player:findNearestNameOrId(110755) then TirodelUnstick() end
		local LieveA = player:findNearestNameOrId(110755)
		if (LieveA.Y-player.Y) > 30 then TirodelUnstick() end

		-- Tp to XBZ
		if RoMScript("AdvancedMagicBoxFrame == true") or RoMScript("MagicBoxFrame == true") then
			player:target_NPC(110755); yrest(1500);						-- Лив
			RoMScript("ChoiceOption(2);");  yrest(1500);
			RoMScript("ChoiceOption(2);");
			waitForLoadingScreen(60);
			player:update()
			__WPL:setWaypointIndex(__WPL:findWaypointTag("MakeMS"));
		else
			player:target_NPC(110755); yrest(1500);						-- Лив
			RoMScript("ChoiceOption(1);");
			waitForLoadingScreen(60);
			player:update()
			__WPL:setWaypointIndex(__WPL:findWaypointTag("Transmutor"));
		end;
	</waypoint>
	
<!-- Escape1 -->
<!-- # 24 --><waypoint x="31649" z="3582" tag="Esc1"></waypoint>
<!-- # 25 --><waypoint x="31540" z="3552"></waypoint>
<!-- # 26 --><waypoint x="31497" z="3527"></waypoint>
<!-- # 27 --><waypoint x="31472" z="3420"></waypoint>
<!-- # 28 --><waypoint x="31531" z="3351"></waypoint>
<!-- # 29 --><waypoint x="31644" z="3256">__WPL:setWaypointIndex(__WPL:findWaypointTag("Escape"));</waypoint>
	
<!-- Escape2 -->
<!-- # 30 --><waypoint x="31732" z="3562" tag="Esc2"></waypoint>
<!-- # 31 --><waypoint x="31636" z="3507"></waypoint>
<!-- # 32 --><waypoint x="31558" z="3475"></waypoint>
<!-- # 33 --><waypoint x="31483" z="3434"></waypoint>
<!-- # 34 --><waypoint x="31485" z="3384"></waypoint>
<!-- # 35 --><waypoint x="31603" z="3282"></waypoint>
<!-- # 36 --><waypoint x="31734" z="3197">__WPL:setWaypointIndex(__WPL:findWaypointTag("Escape"));</waypoint>

<!-- Escape3 -->
<!-- # 37 --><waypoint x="31815" z="3604" tag="Esc3"></waypoint>
<!-- # 38 --><waypoint x="31858" z="3579"></waypoint>
<!-- # 39 --><waypoint x="31965" z="3510"></waypoint>
<!-- # 40 --><waypoint x="32055" z="3399"></waypoint>
<!-- # 41 --><waypoint x="32121" z="3288"></waypoint>
<!-- # 42 --><waypoint x="32156" z="3184"></waypoint>
<!-- # 43 --><waypoint x="32123" z="3144"></waypoint>
<!-- # 44 --><waypoint x="31981" z="3143"></waypoint>
<!-- # 45 --><waypoint x="31843" z="3156">__WPL:setWaypointIndex(__WPL:findWaypointTag("Escape"));</waypoint>	
	
<!-- Rove -->
<!-- # 46 --><waypoint x="31859" z="3160" tag="Rove"></waypoint>
<!-- # 47 --><waypoint x="32029" z="3147"></waypoint>
<!-- # 48 --><waypoint x="32143" z="3159"></waypoint>
<!-- # 49 --><waypoint x="32147" z="3207"></waypoint>
<!-- # 50 --><waypoint x="32094" z="3262"></waypoint>
<!-- # 51 --><waypoint x="32025" z="3280">__WPL:setWaypointIndex(__WPL:findWaypointTag("StartTwink"));</waypoint>

<!-- Elf_Escape -->
<!-- # 52 --><waypoint x="31780" z="3149" tag="Escape">
		-- Move to first WP if not receive 10 Level or Excellent Belt.
		player:update(); inventory:update();
		Cur_Gold = memoryReadInt( getProc(), addresses.moneyPtr )
		if( ErrorSendStone ~= true ) then
			if( 8 > inventory:itemTotalCount(202999) and 15840 > Cur_Gold ) or ( 10 > player.Level ) or ( 8 > CheckTierItems() ) then
				__WPL:setWaypointIndex(__WPL:findWaypointTag("Rove"));
			end
		end;
		player:mount();
	</waypoint>
<!-- # 53 --><waypoint x="31746" z="3040"></waypoint>
<!-- # 54 --><waypoint x="31720" z="2951"></waypoint>
<!-- # 55 --><waypoint x="31608" z="2696"></waypoint>
<!-- # 56 --><waypoint x="31419" z="2384"></waypoint>
<!-- # 57 --><waypoint x="31336" z="2269"></waypoint>
<!-- # 58 --><waypoint x="31120" z="2134"></waypoint>
<!-- # 59 --><waypoint x="30780" z="2147"></waypoint>
<!-- # 60 --><waypoint x="30639" z="2154"></waypoint>
<!-- # 61 --><waypoint x="30422" z="2170"></waypoint>
<!-- # 62 --><waypoint x="30263" z="2259"></waypoint>
<!-- # 63 --><waypoint x="30056" z="2399"></waypoint>
<!-- # 64 --><waypoint x="29934" z="2542"></waypoint>
<!-- # 65 --><waypoint x="29817" z="2674"></waypoint>
<!-- # 66 --><waypoint x="29631" z="2883"></waypoint>
<!-- # 67 --><waypoint x="29557" z="3070"></waypoint>
<!-- # 68 --><waypoint x="29513" z="3240"></waypoint>
<!-- # 69 --><waypoint x="29474" z="3373"></waypoint>
<!-- # 70 --><waypoint x="29427" z="3510"></waypoint>
<!-- # 71 --><waypoint x="29350" z="3739"></waypoint>
<!-- # 72 --><waypoint x="29273" z="3969"></waypoint>
<!-- # 73 --><waypoint x="29173" z="4205"></waypoint>
<!-- # 74 --><waypoint x="29071" z="4441"></waypoint>
<!-- # 75 --><waypoint x="28829" z="4631"></waypoint>
<!-- # 76 --><waypoint x="28641" z="4706"></waypoint>
<!-- # 77 --><waypoint x="28382" z="4791"></waypoint>
<!-- # 78 --><waypoint x="28148" z="4518"></waypoint>
<!-- # 79 --><waypoint x="27955" z="4420"></waypoint>
<!-- # 80 --><waypoint x="27842" z="4361"></waypoint>
<!-- # 81 --><waypoint x="27860" z="4254"></waypoint>
<!-- # 82 --><waypoint x="27967" z="4212"></waypoint>
<!-- # 83 --><waypoint x="28176" z="4097"></waypoint>
<!-- # 84 --><waypoint x="28392" z="3981"></waypoint>
<!-- # 85 --><waypoint x="28416" z="3787"></waypoint>
<!-- # 86 --><waypoint x="28439" z="3589"></waypoint>
<!-- # 87 --><waypoint x="28451" z="3450"></waypoint>
<!-- # 88 --><waypoint x="28324" z="3433"></waypoint>
<!-- # 89 --><waypoint x="28189" z="3432"></waypoint>
<!-- # 90 --><waypoint x="27985" z="3430"></waypoint>
<!-- # 91 --><waypoint x="27937" z="3427">
		-- Tp to Varanas
		player:target_NPC(112797);player:rest(1);			-- Сидкло
		RoMScript("ChoiceOption(1);");
		waitForLoadingScreen(30); yrest(2500);
		player:update();
	</waypoint>
	
<!-- Varanas -->
<!-- # 92 --><waypoint x="4406" z="-3621" tag="Varanas"></waypoint>
<!-- # 93 --><waypoint x="4550" z="-3508"></waypoint>
<!-- # 94 --><waypoint x="4755" z="-3529"></waypoint>
<!-- # 95 --><waypoint x="4845" z="-3541"></waypoint>
<!-- # 96 --><waypoint x="4948" z="-3624"></waypoint>
<!-- # 97 --><waypoint x="5095" z="-3735"></waypoint>
<!-- # 98 --><waypoint x="5230" z="-3850"></waypoint>
	
<!-- Arcane Transmutor -->
<!-- # 99 --><waypoint x="5284" z="-3927" tag="Transmutor">
		-- Take Giftbags
		--inventory:useItem(201849);									-- 7 Lvl Giftbag
	</waypoint>
<!-- #100 --><waypoint x="5266" z="-3971"></waypoint>
<!-- #101 --><waypoint x="5238" z="-4023"></waypoint>
<!-- #102 --><waypoint x="5321" z="-4120"></waypoint>
<!-- #103 --><waypoint x="5431" z="-4238"></waypoint>
<!-- #104 --><waypoint x="5503" z="-4343">
		-- Check for Error Send Stone
		if( ErrorSendStone == true ) then
			if( player.Class1 == CLASS_ROGUE ) then
				player:target_NPC(110008); yrest(1000);						-- Энгер
				RoMScript("ChoiceOption(1);"); yrest(500);
				RoMScript("ChoiceOption(1);");
			else
				player:target_NPC(110307); yrest(1000);						-- Эльсон
				RoMScript("ChoiceOption(1);"); yrest(500);
				RoMScript("ChoiceOption(1);");
			end
			__WPL:setWaypointIndex(__WPL:findWaypointTag("ErrorSendMail"));
		end;
	</waypoint>
<!-- #105 --><waypoint x="5540" z="-4422" tag="VaranasCharges">
		-- Check for Varanas Error
		if not player:findNearestNameOrId(111367) then TirodelUnstick() end
		local Lehman = player:findNearestNameOrId(111367)
		if( Lehman.Y-player.Y ) > 30 then TirodelUnstick() end;

		-- Take Giftbags
		--inventory:useItem(201849);									-- 8 Lvl Giftbag

		-- Varanas Charges
		VaranasCharges();
	</waypoint>
<!-- #106 --><waypoint x="5523" z="-4377"></waypoint>
<!-- #107 --><waypoint x="5401" z="-4208" tag="ErrorSendMail"></waypoint>
<!-- #108 --><waypoint x="5307" z="-4103"></waypoint>
<!-- #109 --><waypoint x="5238" z="-4024"></waypoint>
<!-- #110 --><waypoint x="5270" z="-3973"></waypoint>
<!-- #111 --><waypoint x="5285" z="-3905" tag="VaranasLyeve">
		VaranasLyeve();
	</waypoint>
	
<!-- Varanas VCS Error Way. -->
<!-- #112 --><waypoint x="2846" z="-853" tag="IPV"></waypoint>
<!-- #113 --><waypoint x="2682" z="-998"></waypoint>
<!-- #114 --><waypoint x="2501" z="-1164"></waypoint>
<!-- #115 --><waypoint x="2480" z="-1229"></waypoint>
<!-- #116 --><waypoint x="2633" z="-1460">
		__WPL:setWaypointIndex(__WPL:findWaypointTag("VaranasBuyFusionStone"));
	</waypoint>
	
<!-- 1st Way. Buy Random Fusion Stone -->
<!-- #117 --><waypoint x="4535" z="-1956" tag="BuyFS"></waypoint>
<!-- #118 --><waypoint x="4307" z="-1927"></waypoint>
<!-- #119 --><waypoint x="4218" z="-1868"></waypoint>
<!-- #120 --><waypoint x="3835" z="-1692"></waypoint>
<!-- #121 --><waypoint x="3666" z="-1722"></waypoint>
<!-- #122 --><waypoint x="3448" z="-1621"></waypoint>
<!-- #123 --><waypoint x="3036" z="-1727"></waypoint>
<!-- #124 --><waypoint x="2846" z="-1608"></waypoint>
<!-- #125 --><waypoint x="2753" z="-1637" tag="VaranasBuyFusionStone">
		-- Check for Varanas Error
		if not player:findNearestNameOrId(110576) then TirodelUnstick() end
		local Odeley = player:findNearestNameOrId(110576)
		if (Odeley.Y - player.Y) > 30 then TirodelUnstick() end
		-- Varanas Buy Fusion Stone
		VaranasBuyFusionStone()
	</waypoint>
<!-- #126 --><waypoint x="2912" z="-1639"></waypoint>
<!-- #127 --><waypoint x="3064" z="-1740"></waypoint>
<!-- #128 --><waypoint x="3498" z="-1619"></waypoint>
<!-- #129 --><waypoint x="3711" z="-1731"></waypoint>
<!-- #130 --><waypoint x="3840" z="-1691"></waypoint>
<!-- #131 --><waypoint x="4202" z="-1856"></waypoint>
<!-- #132 --><waypoint x="4334" z="-1941"></waypoint>
<!-- #133 --><waypoint x="4440" z="-2060">
		__WPL:setWaypointIndex(__WPL:findWaypointTag("VaranasMailbox"));
	</waypoint>
	
	
<!-- 2nd Way. Make Mana Stones -->
<!-- #134 --><waypoint x="4673" z="-2004" tag="MakeMS"></waypoint>
<!-- #135 --><waypoint x="4621" z="-2059"></waypoint>
<!-- #136 --><waypoint x="4595" z="-2115"></waypoint>
<!-- #137 --><waypoint x="4575" z="-2175" tag="VaranasMailbox">
		-- Check for Error Send Stone
		if( ErrorSendStone == true ) then
			<!-- Wait for Login next toon -->
			LoginNextChar()
			settings.load()
	--		settings.loadProfile("Tirodel_Pr") yrest (4000)
			loadPaths(__WPL.FileName)
		end;

		-- Check for Varanas Error
		if not player:findNearestNameOrId(110538) then TirodelUnstick() end
		local Mailbox = player:findNearestNameOrId(110538)
		if( Mailbox.Y - player.Y ) > 30 then TirodelUnstick() end

		-- Varanas Mailbox
		VaranasMailbox();
	</waypoint>


<!-- 3nd Way. Make Mana Stones -->
<!-- #138 --><waypoint x="31954" z="3278" tag="ELF10Lvl">
		-- Set faceDirection and Rotation
		local angle = math.atan2(31925 - player.Z, 3391 - player.X)
		player:faceDirection(angle)
		camera:setRotation(angle)
	</waypoint>
<!-- #139 --><waypoint x="31925" z="3391"></waypoint>
<!-- #140 --><waypoint x="31890" z="3511"></waypoint>
<!-- #141 --><waypoint x="31844" z="3555"></waypoint>
<!-- #142 --><waypoint x="31797" z="3597" tag="ElvenIslandMailbox2">
		-- Elven Island Mailbox2
		ElvenIslandMailbox2();
	</waypoint>
</waypoints>
