﻿<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
	time = os.time();		-- Startingtime of Waypoint
	questItemId 	= 209974;	-- WaluPilz
	batchieGras 	= 209975;		
	questGiverId 	= 123217; -- Gulali;
	questid 		= 426848;
	buffid			= 625116;
	questName 		= GetIdName(questid);
	questtype 		= "daily"; -- "public" or "daily";
	
	if not player:hasBuff(622537) then
		cprintf (cli.pink,"Pet for morer XP/TP not summoned. Continue?\n");
		player:sleep();
	end

	
	__WPL:setForcedWaypointType("TRAVEL")	
	
	pilztable = {}
	local objectList = CObjectList();
	objectList:update();
	local objSize = objectList:size()
	for i = 0,objSize do 
		obj = objectList:getObject(i)
		obj:update();
		if obj.Id == 123218 then
			table.insert(pilztable,obj)
		end
	end
	
	function questsDone()
		local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
		if (dailyQuestCount==dailyQuestsPerDay) then
			return true;
		else 
			cprintf(cli.pink,"Noch %s Dailys uebrig\n",dailyQuestsPerDay-dailyQuestCount);
			return false;
		end
	end	
	
function pilzeSammeln() 

		if inventory:itemTotalCount(batchieGras) == 0 then
			print ("Kein BatchieGrass - Quest neu annehmen!");
--			player:sleep();
			return false;
		end
	
		repeat 
			for k,v in pairs(pilztable) do 
				player:target(v)
				target = player:getTarget();
				if target:hasBuff("Insektenbiss") then
					inventory:useItem(GetIdName(batchieGras));
				end
			end
		until  getQuestStatus(GetIdName(questid)) == "complete" 

end
	

</onload>
	<!-- #  1 --><waypoint x="22116" z="25905" y="853" tag="questGiver">
		player:target_NPC(questGiverId) -- Koka Li
		if getQuestStatus(questName) == "complete" then
			CompleteQuestByName(questName);
			yrest(150);
			__WPL:setWaypointIndex(__WPL:findWaypointTag("questGiver"));
		else
			AcceptQuestByName(questName,questtype) 
		end
			
		if (questsDone() and questtype == "daily") or keyPressed(key.VK_SHIFT)  then
			cprintf (cli.pink,"Time spend for this daily: %s Minutes\n",(os.time()-time)/60);
			sendMacro("Logout();");
			error("TQ done.",0);
			
		end
	</waypoint>

<!-- #  2 --><waypoint x="22116" z="25905" y="855" tag="feld">pilzeSammeln();</waypoint>	
</waypoints>
