<?xml version="1.0" encoding="utf-8"?>
<waypoints>
<onLoad>
  	questtype 		= "daily" -- "public" or "daily";
	swapClass 		= false;				-- Do ClassSwapping for levelling Second Class?
	minPlayerLevel	= 96;				-- minimum PlayerLevel to accept the Quest.
	questGiverId 	= (123949) -- Aidhar Luh
	questNameId 	= (427298) -- Bolster the Defenses!
	questName 		= GetIdName(questNameId);
	houseMaidId     = 110758 -- Housekeeper
	UseDailyTickets = false;              -- this needs home sweet home 7day or regular
	
	time = os.time();		-- Startingtime of Waypoint
sendMacro('SetFindPartyState(false)') 
sendMacro('SetLootMethod("freeforall","")');
sendMacro('SetInstanceLevel("hard")');
changeProfileOption("MAX_TARGET_DIST", 100)
changeProfileOption("LOOT_DISTANCE" ,130)  
changeProfileOption("WAYPOINT_DEVIATION", 20)
changeProfileOption("COMBAT_DISTANCE", 150)
 		changeOptionFriendMob("friend", "Rabbit", "Add"); 
		changeOptionFriendMob("friend", "Hare", "Add");
		changeOptionFriendMob("friend", "Scarlet Wing", "Add");
		changeOptionFriendMob("friend", "Cavy", "Add");	
		changeOptionFriendMob("friend", "Snake", "Add");
		changeOptionFriendMob("friend", "Ferdhoof Rat", "Add");
		changeOptionFriendMob("friend", "Cockroach", "Add");	
		changeOptionFriendMob("friend", "Beetle", "Add");
 		changeOptionFriendMob("friend", "Starving Wolf", "Add");
 		changeOptionFriendMob("friend", 109186, "Add");   --snake
		--- zone mobs to ignore
		changeOptionFriendMob("friend", 106468, "Add");   --omn fanged fish
		changeOptionFriendMob("friend", 109160, "Add");   --blood sucking swamp bat
		changeOptionFriendMob("friend", 105374, "Add");   --skeltion general
			
print ( "starting quest =", questName, "questtype =", questtype)
function questtohouse()
	yrest(500)
	--inventory:useItem(202435) -- home sweet home standard    -- comment out one you are not using.
   inventory:useItem(208785) -- home sweet home 7 days         -- comment out one you are not using.
	yrest(5000)
	waitForLoadingScreen(40);
end
function questsDone()
	local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
	print( dailyQuestCount, dailyQuestsPerDay)
	if (dailyQuestCount==dailyQuestsPerDay) then
		return true;
	else 
		return false;
	end
end	
function housetoquest()
	repeat
		yrest(500)
    until player:target_NPC(houseMaidId) -- Housekeeper
	ChoiceOptionByName(getTEXT("HOUSE_MAID_LEAVE_HOUSE")) -- 'Leave the house'
	waitForLoadingScreen(40);
end
function swClass()
	player:update();
	RoMScript("ExchangeClass("..(player.Class2+1)..","..(player.Class1+1)..")");
	yrest(1000);
	
end
function mountUp()
	if not player:hasBuff(506688) and inventory:itemTotalCount(207204) > 0 then
		inventory:useItem(207204)
		yrest(500);
	end
	player:mount()	
end
function quest()
	queststate = getQuestStatus(questNameId)
	if queststate == "complete" then
		mountUp()
		__WPL:setForcedWaypointType("TRAVEL")
	end
end

if not player:hasBuff(506684) then -- Unbridled Enthusiasm
inventory:useItem(207200)
end
	
</onLoad>
	<!-- #  1 --><waypoint x="-11342" z="-2227" y="343">

		local empties = inventory:itemTotalCount(0);
		if 1 &gt; empties then
			-- Wait for user to make some space in inventory.
			cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
			player:sleep();
		end;

		local dqCount, dqPerDay = RoMScript("Daily_count()");
		if 	questsDone()== true then 
			inventory:update();
			player:update();
			if inventory:itemTotalCount(202434) > 0 and UseDailyTickets == true then
				inventory:useItem(202434);
				yrest(2000)
			else
				error("dailys are done and no resets are left")
			end		
		end
		repeat
			yrest(500)
        until player:target_NPC(questGiverId) 
		AcceptQuestByName(questNameId,questtype) 
		if not player:hasBuff(506684) then -- Unbridled Enthusiasm
			inventory:useItem(207200)
		end
		__WPL:setForcedWaypointType("NORMAL")
	</waypoint>
	<!-- #  2 --><waypoint x="-11359" z="-2195" y="338">	</waypoint>
	<!-- #  3 --><waypoint x="-11471" z="-2045" y="308">	</waypoint>
	<!-- #  4 --><waypoint x="-11507" z="-1913" y="287">	</waypoint>
	<!-- #  5 --><waypoint x="-11498" z="-1436" y="296">	</waypoint>
	<!-- #  6 --><waypoint x="-11526" z="-1389" y="303">	</waypoint>
	<!-- #  7 --><waypoint x="-11825" z="-1613" y="296">	</waypoint>
	<!-- #  8 --><waypoint x="-11848" z="-1488" y="304">	</waypoint>
	<!-- #  9 --><waypoint x="-12065" z="-1398" y="323">	</waypoint>
	<!-- # 10 --><waypoint x="-12100" z="-1533" y="292">	</waypoint>
	<!-- # 11 --><waypoint x="-12286" z="-1555" y="291">	</waypoint>
	<!-- # 12 --><waypoint x="-12404" z="-1633" y="308">	</waypoint>
	<!-- # 13 --><waypoint x="-12456" z="-1754" y="316">	</waypoint>
	<!-- # 14 --><waypoint x="-12331" z="-1986" y="287">	</waypoint>
	<!-- # 15 --><waypoint x="-12232" z="-2092" y="294">	</waypoint>
	<!-- # 16 --><waypoint x="-12198" z="-1953" y="272">	</waypoint>
	<!-- # 17 --><waypoint x="-12101" z="-1938" y="264">	</waypoint>
	<!-- # 18 --><waypoint x="-12175" z="-1947" y="270">	</waypoint>
	<!-- # 19 --><waypoint x="-12282" z="-1981" y="268">quest()	</waypoint>
	<!-- # 20 --><waypoint x="-12048" z="-2239" y="285">quest()	</waypoint>
	<!-- # 21 --><waypoint x="-11889" z="-2506" y="286">quest()	</waypoint>
	<!-- # 22 --><waypoint x="-11860" z="-2573" y="300">quest()	</waypoint>
	<!-- # 23 --><waypoint x="-11810" z="-2557" y="306">quest()	</waypoint>
	<!-- # 24 --><waypoint x="-11769" z="-2566" y="312">quest()	</waypoint>
	<!-- # 25 --><waypoint x="-11697" z="-2603" y="315">quest()	</waypoint>
	<!-- # 26 --><waypoint x="-11636" z="-2597" y="316">quest()	</waypoint>
	<!-- # 27 --><waypoint x="-11607" z="-2593" y="319">quest()	</waypoint>
	<!-- # 28 --><waypoint x="-11546" z="-2584" y="328">quest()	</waypoint>
	<!-- # 29 --><waypoint x="-11476" z="-2477" y="337">quest()	</waypoint>
	<!-- # 30 --><waypoint x="-11459" z="-2216" y="325">quest()	</waypoint>
	<!-- # 31 --><waypoint x="-11362" z="-2184" y="335">
					if swapClass == true then	
			yrest(2500)  -- wait for agro to drop
			yrest(2500)  -- wait for agro to drop
			questtohouse()
			repeat
				yrest(500)
            until player:target_NPC(houseMaidId) -- housemaid 
			yrest(150);
			ChoiceOptionByName(getTEXT("HOUSE_MAID_HOUSE_CHANGEJOB")) -- 'Change class'
			yrest(150);
			swClass()	
			housetoquest()
		end	
		repeat
			yrest(500)
        until player:target_NPC(questGiverId)
		CompleteQuestByName(questName) 
		if swapClass == true then
			questtohouse()
			repeat
				yrest(500)
            until player:target_NPC(houseMaidId) -- housemaid 
			yrest(150);
			ChoiceOptionByName(getTEXT("HOUSE_MAID_HOUSE_CHANGEJOB")) -- 'Change class'
			yrest(150);
			swClass()	
			yrest(300);
			housetoquest()
		end
	</waypoint>
</waypoints>