<?xml version="1.0" encoding="utf-8"?>
<!--
	Crazy Bartender v0.1
	
	$Revision$
	$Date$
-->
<waypoints>
	<onLoad>
		<![CDATA[
			-- ID's of quests
			q_bartender = 000000	-- Tailor's Commission (XXX: Find it)
			
			-- NPC ID's 
			q_npc      = 113961	-- Shela Berit
			
			-- Villagers
			q_villager = {121357, 121358, 121359}
			
			-- Bartender recipes (Hmm non-english speakers?)
			bar_mix = {}
			bar_mix['Jodka Lime']    = {113964, 120343}
			bar_mix['Juba Libre']    = {120340, 121153}
			bar_mix['Juicy Sours']   = {113980, 121166}
			bar_mix['Vanilla Juice'] = {121167, 120336}

			changeProfileOption("QUICK_TURN", true)
			changeProfileOption("WAYPOINT_DEVIATION", 0)
		]]>
	</onLoad>
	<!-- #000 --><waypoint x="4953" z="-1777" y="103">
		<![CDATA[
			player:target_NPC(q_npc); yrest(1000)
			AcceptQuestByName("Crazy Bartender") -- q_bartender?
			
			player:target_NPC(q_npc); yrest(1000)
			ChoiceOptionByName("The guests are arriving") -- non-english speakers?
			
			-- Handle event
			arg1 = nil
			repeat
				arg1 = memoryReadString( getProc(), 0x00186860)	-- How to find this permanenty...
				if arg1 and arg1 ~= oarg1 then

					-- Are we done?
					if string.match(arg1, "Game over!") then
						break
					end
					
					-- Make drinks
					for n,r in pairs(bar_mix) do
						if string.match(arg1, n) then
							cprintf(cli.lightblue, "\nFound %s\n", n)
							
							-- Mix drink
							player:target_Object(r[1]); yrest(50)
							player:target_Object(r[2]); yrest(50)
							
							-- Serve drink
							player:target_Object(q_villager); yrest(50)
							ExtraActionButton_Click(1); yrest(50)
							break
						end
					end
					oarg1 = arg1
				end
				yrest(50)
			until false
			
			-- Deliver quest
			player:target_NPC(q_npc); yrest(100)
			CompleteQuestByName("Crazy Bartender"); yrest(100)
			error("Finished", 0)
		]]>
	</waypoint>
</waypoints>
