<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>

--[v1.0]--

--====== User Options ======--

	gettreat = true			-- set to true to get the free treats Lindemannen offers. Note the script will not check your bag space so be sure you have lots of space left if you set this true or else you will not be able to get the quest.

	nextwp = "juicedelivery"	-- sets the next waypoint file you want to load after this waypoint finishes.

--==========================--


questid = 422916
questdone = false
juststarted = true
participate = getTEXT("SC_BEER_2011_FN02")
freetreat = getTEXT("SC_BEER_2011_FN06")

function quest()
	return getQuestStatus(questid)
end

function isDrunk(addr)
	local constable = CPawn(addr) 
	return not constable:hasBuff(620785) and 150 > distance(player, constable)
end


</onLoad>
	<!-- #  1 --><waypoint x="-29084" z="29322" y="-152">
	if juststarted then
		player:target_NPC(111365)
		yrest(500)
		ChoiceOptionByName(participate)
		yrest(500)
		if gettreat then
			player:target_NPC(111365)
			print("targeted 111365")
			yrest(500)
			ChoiceOptionByName(freetreat)
			yrest(500)
		end
		juststarted = false
	end     
	if quest() == "not accepted" then
		if 1 > inventory:itemTotalCount(0) then
			cprintf(cli.lightred,"\nThere Is Not Enough Bag Space For The Quest Item/s.\n\n")
			error("Not enough Bag Space.")
		end
		local retries = 0
		repeat
			player:target_NPC(111365);	-- Lindemannen
			yrest(500)
			AcceptQuestByName(questid)
			yrest(500)
			retries = retries + 1
		until quest() ~= "not accepted" or retries == 8
		if retries == 8 then
			print("Seems like the char has already done the quest for today.")
			loadPaths(nextwp)
		end
	elseif quest() == "complete" then
		repeat
			player:target_NPC(111365);
			yrest(500)
			CompleteQuestByName(questid)
			yrest(500)
		until quest() ~= "complete"
		questdone = true
	end
	if questdone then
		loadPaths(nextwp)
	end
	player:mount()
	</waypoint>
	<!-- #  3 --><waypoint x="-29785" z="29118" y="-97">
	local keg = inventory:findItem(209959)
	local guard;
	while quest() == "incomplete" do
		repeat
			consta = player:findNearestNameOrId(119380,nil,isDrunk)	-- Lechif Constable
			yrest(1000)
		until consta
		player:target(consta)
		if keg then
			 keg:use()
		end
	end
	player:mount()
	print("mounting")
	__WPL:setDirection(WPT_BACKWARD)		
	</waypoint>
</waypoints>