<?xml version="1.0" encoding="utf-8"?>
<waypoints>
	<onLoad>
		unregisterTimer("GMdetection");
		SetCharList({
			{account=5, chars= {}},
			{account=6, chars= {}},
			{account=7, chars= {}},
			{account=8, chars= {}},
			{account=9, chars= {}},
			{account=10, chars= {}},
		})
	
	
		-- V 3.5
		<![CDATA[
		
			--=== user options ===--
			-- it will stop once this score is reached, bonuses will be added afterwards though 
			-- so 2700 will probably be total score of 3100
			local requiredscore = 30
			
			-- alter to your local language, caps sensative, in english is "Go!!!", so "Go" is enough
			local goMessage = "Go"		
		
		
		
			if getZoneId() == 2 and 30 > inventory:itemTotalCount(203038) then
				LoginNextChar()
				loadProfile()
				loadPaths(__WPL.FileName)
				return
			end

			for k,v in pairs(settings.profile.skills) do
				v.AutoUse = false
			end

			id_kate		= 121035
			id_magelly	= 120687

			-- Move to Kate Wesker and enter
			if getZoneId() == 2 then
				repeat
					yrest(500)
				until player:target_NPC(id_kate)

				repeat
					yrest(500)
				until ChoiceOptionByName(getTEXT("SKWERL_MOBIUS_24")) 

				yrest(1000)
				waitForLoadingScreen()
			end
			
			-- Move to Magelly Basac
			repeat
				yrest(500)
			until player:target_NPC(id_magelly)

			-- Check if we already completed
			repeat
				yrest(500)
			until ChoiceOptionByName(getTEXT("SKWERL_MOBIUS_14")) 
			
 
			repeat
				yrest(500)
			until ChoiceOptionByName(getTEXT("SKWERL_MOBIUS_25")) 
			

			repeat
				yrest(500)
			until ChoiceOptionByName(getTEXT("SYS_OKAY")) 
			yrest(1000)

			local round = 0
			local score = 0

			function tort()
				local proc = getProc()
				
				local function checkclicked(address)
					local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
					if bitAnd(tmp,0x8) then
						return true
					else
						return false
					end
				end

				local function one(ID)
					--print("targeting: "..ID)
					local objectList = CObjectList();
					objectList:update();
					local objSize = objectList:size()
					for i = 0,objSize do 
						obj = objectList:getObject(i)
						obj:update()
						if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
							player:target(obj)
							RoMScript("UseExtraAction(1)")
							yrest(10)
							player:target(obj)
							RoMScript("UseExtraAction(1)")
							if ID == 106883 then
								yrest(10)
								player:target(obj)
								RoMScript("UseExtraAction(1)")	
							end
							yrest(100)
						end
					end
				end
				if player:findNearestNameOrId(106881,106882,106883,106884) then
					--== monitor chat
					EventMonitorStart("Tortevent", "SYSTEM_MESSAGE");
					local time, moreToCome, name, msg, _go 
					repeat
						time, moreToCome, name, msg = EventMonitorCheck("Tortevent",1)
						yrest(10)
						if name and string.find(name,goMessage) then
							_go = true
						end
					until _go == true
					EventMonitorStop("Tortevent")
					round = round + 1
					print("Wave: "..round..", Score: "..score)
					yrest(1000)
					one(106882)
					yrest(1000)
					one(106882)
					one(106884)
					one(106884)
					one(106884)
				end
			end

			repeat
				yrest(100)
			until  player:findNearestNameOrId(106881)
			print("OK event has started")
			tort()
			repeat yrest(1000) until not RoMScript("TimeKeeperFrame:IsVisible()")
			yrest(15000)
			logloot()
			LoginNextChar()
			loadProfile()
			loadPaths(__WPL.FileName)
		]]>
	</onLoad>
</waypoints>
