<?xml version="1.0" encoding="utf-8"?>
<waypoints type="TRAVEL">
  <onload>


for k,v in pairs(settings.profile.skills) do
	v.AutoUse = false
end
-- ---------------functions ---------------------
local doRelog = true; 
function relog()
	SetCharList({
	 -- enter account number and char numbers that you like to run this script
	{account=1 , chars= {1,2,3,4,5,6,7,8}},  
	{account=2 , chars= {1,2,3,4,5,6,7,8}},  
	{account=3 , chars= {1,2,3,5,6,7,8}}, 
	{account=4 , chars= {1,2,3,4,6,7}}, 
	{account=20 , chars= {1,2,3,4,5,6,7,8}}, 
	{account=21 , chars= {1,4,5,6,7,8}}, 
	{account=42 , chars= {4,5,6,7,8}}, 
	 {account=54 , chars= {1,3,4,5,7,8}}, 
	 {account=64 , chars= {1,4,8}}, 
	 {account=44 , chars= {1,2,3,4,5,6,7}}, 
	 {account=45 , chars= {2,3,4,5,6,7,8}}, 
	 {account=46 , chars= {2,3,5,8}}, 
	  {account=84 , chars= {1,3,4,5,6,}}, 
	 });
	LoginNextChar();
	loadProfile();  
end	
function KillNewbiePet()
	if player:findNearestNameOrId(113199,nil,evalfunc ) then  -- search vicinity for your Newbie Pet
      local newbEgg = inventory:findItem(207051); -- Newbie Pet Egg
		if newbEgg then
			newbEgg:use()
			newbEgg:delete()
		end
	end
end
 

function gethonorindrillground()
	waitForLoadingScreen();
	repeat
		yrest(500)
	until	player:target_NPC(112066) -- Special Training Manager
			ChoiceOptionByName(getTEXT("SC_205764_2")) -- 'Next Page'
				yrest(1000)
			ChoiceOptionByName("|off00ffffSpirit Warrior|r")
				yrest(1000)
			ChoiceOptionByName(getTEXT("LOGIN_OKAY")) -- 'Confirm'
				yrest(1000)
	repeat
		yrest(500)
	until		player:target_NPC(114332) -- Drillmaster
			ChoiceOptionByName(getTEXT("SC_CLICKFUNGO04")) -- 'Leave training ground'
				yrest(1000)
	repeat
		yrest(500)
	until   player:target_NPC(112066) -- Special Training Manager
			ChoiceOptionByName(getTEXT("SC_205764_2")) -- 'Next Page'
				yrest(2000)
			ChoiceOptionByName("|off00ffffMass Barrage|r")			
			ChoiceOptionByName(getTEXT("LOGIN_OKAY")) -- 'Confirm'
				yrest(2000)
	repeat
		yrest(500)
	until		player:target_NPC(116472) -- Drillmaster
			ChoiceOptionByName(getTEXT("SC_CLICKFUNGO04")) -- 'Leave training ground'
				yrest(2000)
	repeat
		yrest(500)
	until	player:target_NPC(112066) -- Special Training Manager
			ChoiceOptionByName(getTEXT("SC_205764_2")) -- 'Next Page'
				yrest(1000)
			ChoiceOptionByName("|off00ffffWolf!|r")
			ChoiceOptionByName(getTEXT("LOGIN_OKAY")) -- 'Confirm'
				yrest(1000)
	repeat
		yrest(500)
	until		player:target_NPC(117051) -- Leed
			ChoiceOptionByName(getTEXT("SC_TRAIN10_NPC_SPEAK09")) -- 'Leave this Game'
				yrest(1000)
	repeat
		yrest(8000)
	until player:target_NPC(112066) -- Special Training Manager
	ChoiceOptionByName("|off00ffffLeave drill ground and return to guild castle.|r")
	waitForLoadingScreen();
	--player:update();
end
-- -----end of functions-----------------------------------------------
	yrest(5000)    -- wait for zone to load when logging new char.
KillNewbiePet()

	if getZoneId() ~= 6  and getZoneId() ~= 401 then
		travelTo("ObsidianCastle")
	else 
		if  getZoneId() == 354 then
			error("leave the drill ground first")
		end
	end	
	yrest(500)
	travelTo("ObsidianCastle")
	player:target_NPC(111731) -- Guild Castle Manager
	sendMacro("ChoiceOption(2);");
	waitForLoadingScreen(40);
	
	
	GotoGuild("Drill Ground"); -- Any level drill ground
	yrest(500)
	repeat
		yrest(500)
	until player:target_Object("Drill Ground"); -- Drill Ground
	sendMacro("ChoiceOption(1);");
	gethonorindrillground()
	portal = player:findNearestNameOrId("Guild Castle Transport Point");
	player:moveTo(portal,true) 
	sendMacro('StaticPopup_OnClick(StaticPopup1, 1);')
	waitForLoadingScreen();
	player:update();
	travelTo("GlorySquare")
	--relog()

return loadPaths(__WPL.FileName);		
</onload>
</waypoints>