<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<!--**************************************************************************************************************************************************************
******************************************************************************************************************************************************************
**																Goblin Mines - Potion farm v.2.0																**
**																		by AlterEgo95																			**																																								**																														**
**																																								**
******************************************************************************************************************************************************************
***************************************************************************************************************************************************************-->
<onLoad>
	Invite_Last_Group 	= true					-- set to true if you want to use the addon "Invite Last Group"
	Invite_By_Name 		= false					-- set to true if you don't want to use any addon; you have to use ONE particular character
	Invite_Char 		= "Your_invite_char"	-- name of your invite character. Only need to change this option if Invite_By_Name is true

	Speed 				= true

	changeProfileOption("EGGPET_ENABLE_ASSIST", false)

	function invite()
		if Invite_Last_Group and Invite_By_Name then
			error("Choose Invite_Last_Group OR (!) Invite_By_Name")		
		elseif Invite_Last_Group then		
			repeat
				SlashCommand("ILG inv")
				yrest(2000)
			until RoMScript("GetNumPartyMembers()") > 1
		elseif Invite_By_Name then
			repeat
				RoMScript("InviteByName('"..Invite_Char.."')")
				yrest(2000)
			until RoMScript("GetNumPartyMembers()") > 1
		end
	end

	function speed_buff()
		if Speed then
			if not player:hasBuff("506684") then   
				inventory:useItem(207200);
			end
			yrest(250)
			RoMScript("SetTitleRequest(530427)")
			yrest(250)
		end
	end

	if fly == nil or teleport == nil then
		error("You have to install the 'swimhack' and/or 'teleport' userfunction")
	end

	function inventory_check()
		player:update()
		local zoneid = RoMScript("GetZoneID()")
		if zoneid == 4 then	
			if 1 > inventory:itemTotalCount(0) then
				cprintf(cli.yellow,"You should get empty inventory spaces.")
				player:sleep()
			end
			if 30 > inventory:itemTotalCount(203038) then
				print("You need to have 30 Phirius Tokens to enter Goblin Mines")
				player:sleep()
			end
		end
	end
	
	function settings.profile.events.onUnstickFailure()
		logInfo("Goblins_Stuck", "We got stuck", true, nil, add)
		RoMScript("LeaveParty()")
		waitForLoadingScreen()
		__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
	end
	
	teleport_SetStepSize(25)
	
	local function evalClickable(address)
		local chest = memoryReadRepeat("byte", getProc(), address + 0x2F0) or 0
		if chest ~= 0 then
			return true
		else
			return false
		end
	end
	
	function chest()
		local chest
		repeat
			chest = player:findNearestNameOrId(113164,nil,evalClickable)
			if chest then
				yrest(300)
				teleport(chest.X,chest.Z,chest.Y-40)
				keyboardPress(settings.hotkeys.STRAFF_RIGHT.key)
				keyboardPress(settings.hotkeys.STRAFF_LEFT.key)
				repeat
					player:target_Object(chest.Id, nil, nil, true, evalClickable);
				until evalClickable(chest.Address) ~= true
			end
		until chest == nil
		if chest == nil then
			teleport(nil, nil, -50, false)
			yrest(300)
		end
	end
</onLoad>
	<!-- #  1 --><waypoint x="-5852" z="3326" y="572" tag="start">
		inventory_check()
		speed_buff()
		invite()
		repeat
			player:target_NPC("112651");			-- Mahler Palo
			yrest(1000)
			sendMacro("ChoiceOption(1);");
			yrest(1000)
			RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
			waitForLoadingScreen(15)
			local zoneid = RoMScript("GetZoneID()")
		until zoneid == 352
	</waypoint>
	<!-- #  2 --><waypoint x="1932" z="2231" y="308">
		fly()
		yrest(100)
		teleportToWP()
		yrest(300)
	</waypoint>
	<!-- #  3 --><waypoint x="1960" z="2231" y="328">
		teleportToWP()
		yrest(300)	
	</waypoint>
	<!-- #  4 --><waypoint x="1996" z="2231" y="355">
		teleportToWP()
		yrest(300)	
	</waypoint>
	<!-- #  5 --><waypoint x="2015" z="2232" y="369">
		teleportToWP()
		yrest(300)	
	</waypoint>
	<!-- #  6 --><waypoint x="2036" z="2235" y="379">
		teleportToWP()
		yrest(500)	
	</waypoint>
	<!-- #  7 --><waypoint x="2062" z="2237" y="378">	</waypoint>
	<!-- #  8 --><waypoint x="2255" z="2247" y="334">
		repeat
			yrest(1000)
		until RoMScript("TimeKeeperFrame:IsVisible()")		
	</waypoint>
	<!-- #  9 --><waypoint x="2250" z="2385" y="469">	</waypoint>
	<!-- # 10 --><waypoint x="2389" z="2423" y="331">	</waypoint>
	<!-- # 11 --><waypoint x="2284" z="2469" y="222">	</waypoint>
	<!-- # 12 --><waypoint x="1782" z="2763" y="222">	</waypoint>
	<!-- # 13 --><waypoint x="1691" z="2804" y="253">
		chest()
	</waypoint> 
	<!-- # 14 --><waypoint x="2502" z="2997" y="222">	</waypoint>
	<!-- # 15 --><waypoint x="2606" z="2981" y="239">
		chest()
	</waypoint>
	<!-- # 16 --><waypoint x="2446" z="3289" y="41">	</waypoint>
	<!-- # 17 --><waypoint x="2471" z="3445" y="41">	</waypoint>
	<!-- # 18 --><waypoint x="2487" z="3502" y="43">
		chest()
	</waypoint>
	<!-- # 19 --><waypoint x="2480" z="3365" y="41">	</waypoint>
	<!-- # 20 --><waypoint x="2843" z="3419" y="41">	</waypoint>
	<!-- # 21 --><waypoint x="4282" z="4259" y="41">	</waypoint>
	<!-- # 22 --><waypoint x="4400" z="4322" y="182">
		chest()
	</waypoint>
	<!-- # 23 --><waypoint x="4389" z="4158" y="41">	</waypoint>
	<!-- # 24 --><waypoint x="4500" z="3471" y="41">	</waypoint>
	<!-- # 25 --><waypoint x="4386" z="3460" y="149">
		chest()
		RoMScript("LeaveParty()")
		waitForLoadingScreen()
	</waypoint>
</waypoints>