ShowMessage("˿ű $Rev: 192 $")

--[[
[author]
descript="ÿ1"
]]--

script_name="˿"

local g_szMission = "˿"

local g_NpcInfo = {
	[0] = {szNpcName="º", fX=230, fY=350}
}

function _SMain(...)

	if GetQuestTimesInfo("˿") == 0 then
		ShowMessage("Ѿ˳齱!")
		return
	end

	if Player:GetData("LEVEL") < 20 then
		ShowMessage("˿ҵȼС20")
		return
	end

	local bDone = false

	while true do

		if UI:IsWindowShow("XingYun") == false then
			if bDone == true then
				QuestFrameSpeak(0, g_NpcInfo[0].szNpcName)
				QuestFrameOptionClicked("ȡ", CMP_PART_MATCH)
			else
				MoveToNPC(g_NpcInfo[0].fX, g_NpcInfo[0].fY, 1, g_NpcInfo[0].szNpcName)
				QuestFrameOptionClicked(g_szMission, CMP_PART_MATCH)
			end

			System:Sleep(1000)
			if bDone == true and FindDebugMessage("ռ䲻") == true then
				break
			end

			local strType,_,_,_,szText = DataPool:GetNPCEventList_Item(0);

			if strType == "text" then
				if string.find(szText, "ûн") then 
					break 
				elseif string.find(szText, "Ѿμ") then 
					bDone = true 
				elseif string.find(szText, "ٵ60") then
					break
				end
			end
		else
			DoLuaString("XingYun_Env", string.format("Play_Ani(%d)", 1))
			System:Sleep(1500)
			DoLuaString("XingYun_Env", string.format("Play_Ani(%d)", 2))
			System:Sleep(1500)
			DoLuaString("XingYun_Env", string.format("Play_Ani(%d)", 3))
			System:Sleep(3000)
			DoLuaString("XingYun_Env", "XingYun_Close()")
			bDone = true
			System:Sleep(1000)
		end

		System:Sleep(1000)
	end
end

_SMain()
