ShowMessage(" $Rev: 214 $")

--[[
[author]
descript="ÿԽ1,Ͻӱ 4 "
]]--

script_name=""

function _SMain(...)

	local bDone = false

	local lv = Player:GetData("LEVEL")
	if lv < 30 then
		ShowMessage("ȼ30˽ű")
		return
	end

	while true do

		System:Sleep(500)

		if GetActiveDataSceneID() == 0xf3 then

			if Player_GetBuff("Ĺй") ~= -1 then
				PushDebugMessage("ȴ..." , 1)
			else
				if DataPool:UserBag_CountItemByIDTable( 30700200 ) > 0 and bDone == false then
					UseItemById(30700200)
					System:Sleep(1000)
				else
					MoveToNPC( 27 , 26 , 0xf3 , "ֳ")
					QuestFrameOptionClicked("ص", CMP_PART_MATCH)
					System:Sleep(1000)
				end
			end
		else
			if bDone == true then
				ShowMessage("!")
				return
			end

			if GetQuestTimesInfo("") == 0 then
				ShowMessage("պѾ!")
				return
			end

			MoveToNPC(271, 222, DataBase:GetSceneID(""), "ֳ")

			if DataPool:UserBag_CountItemByIDTable( 30700200 ) > 0 then
				QuestFrameOptionClicked("뺮", CMP_PART_MATCH)
				System:Sleep(1000)
			else
				local money = Player:GetData("JIAOZI")
				if money < 40000 then
					ShowMessage("Ͻ 4 ,ִֹͣнű")
					return
				end
				
				QuestFrameOptionClicked("ĹйҪ", CMP_PART_MATCH)
				QuestFrameOptionClicked( "ȷ" , CMP_PART_MATCH)
				System:Sleep(1000)
				local strType,_,_,_,szText = DataPool:GetNPCEventList_Item(0);
				if strType == "text" then
					if string.find(szText, "ռ䲻") then
						ShowMessage("ռ䲻㣬˳ű")
						return	-- ˳ѭű
					end
				end
			end
		end

		
		local isNext,szMsg = GetDebugMessage()

		while isNext == 1 do

			if string.find(szMsg, "Ѿʹù") then
				bDone = true 				
				break
			end
			isNext,szMsg = GetDebugMessage()

		end
	end

end

_SMain()