<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>

	ZZfusionName = "XXXXXXX" -- Name of the character you are sending fusion stones from.

	local beltVendorId
	--player:target_NPC(123010) -- Didide Spiderfoot
	--player:target_NPC(122487) -- Cholman Hooktail
	local FjordNpc = player:findNearestNameOrId(123010)
	local SarloNpc = player:findNearestNameOrId(122487)
	if FjordNpc and 300 > distance(FjordNpc, player) then
		beltVendorId = FjordNpc.Id
	elseif SarloNpc and 300 > distance(SarloNpc, player) then
		beltVendorId = SarloNpc.Id
	else
		error("No belt NPC nearby");
	end
		

	EventMonitorStart("BeltBuy", "CHAT_MSG_WHISPER");

	function ZZbuyBelts()
		local gold = RoMScript('GetPlayerMoney("copper");')
		local charges = RoMScript("GetMagicBoxEnergy()")
		if gold > (60*6124) and charges >= 88 then
			local fusionDone = false
			sendMacro("/w "..ZZfusionName.." send");
			local beltCount = inventory:itemTotalCount(228966)
			if 60 > beltCount then
				local toBuy = 60 - beltCount
				repeat
					RoMCode("CloseAllWindows()");
					player:openStore(beltVendorId)
					store:buyItem(228966, toBuy)
					repeat
						yrest(100);
					until RoMScript("GetItemQueueInfo(1)") == nil
					inventory:update()
					beltCount = inventory:itemTotalCount(228966)
					toBuy = 60 - beltCount
				until inventory:itemTotalCount(228966) >= 60
			end
			RoMCode("CloseWindows()");
			repeat
				yrest(50);
				local time, moreToCome, _name, _msg = EventMonitorCheck("BeltBuy","4,1")
				if (_name == ZZfusionName and _msg == "1stsent") then
					print("Getting stones from mail")
					repeat
						RoMCode("CloseWindows()"); UMM_TakeMail();
						repeat
							yrest(100);
						until RoMScript("GetItemQueueInfo(1)") == nil
					until inventory:itemTotalCount(202999) >= 30
					Fusion_MakeMaxManaStones()
					
					repeat
						yrest(50);
						local time, moreToCome, _name, _msg = EventMonitorCheck("BeltBuy","4,1")
						if (_name == ZZfusionName and _msg == "2ndsent") then
							print("Getting stones from mail")
							repeat
								RoMCode("CloseWindows()"); UMM_TakeMail();
								repeat
									yrest(100);
								until RoMScript("GetItemQueueInfo(1)") == nil
							until inventory:itemTotalCount(202999) >= 30
							Fusion_MakeMaxManaStones()
							fusionDone = true
						end
					until fusionDone
				elseif (_name == ZZfusionName and _msg == "quit") then
					error("Partner out of Gold")
				end
			until fusionDone
			ZZbuyBelts()
		else
			sendMacro("/w "..ZZfusionName.." quit");
			error("Out of Gold or Charges")
		end
	end
	
	while true do
		if getZoneId() == 27 then
			player:moveTo(CWaypoint(-10317,2231,26),true);
			ZZbuyBelts()
		elseif getZoneId() == 26 then
			player:moveTo(CWaypoint(-21369,-2861,521),true);
			ZZbuyBelts()
		else
			error("Not in the correct zone")
		end
	end
</onLoad>
</waypoints>