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

--[[
[author]
descript="ÿ1"
]]--
perday_max=1
script_name="˿"

local g_szMission = "˿"

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

while true do

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

	if UI:IsWindowShow("XingYun") == false then
		MoveToNPC(g_NpcInfo[0].fX, g_NpcInfo[0].fY, 1, g_NpcInfo[0].szNpcName)
		QuestFrameOptionClicked(g_szMission, CMP_PART_MATCH)
		System:Sleep(1000)
		local strType,_,_,_,szText = DataPool:GetNPCEventList_Item(0);
		
		if strType == "text" then
			if string.find(szText, "Ѿμ") then 
				System:UpdateRecord( script_name )
				break
			elseif string.find(szText, "ٵ60") then
				break
			end
		end
	else
		local i = Get_XParam_INT(1999986, 0)

		if i == 3 then
			DoLuaString("XingYun_Env", "XingYun_Close()")
			System:Sleep(1000)

			local lastNum = DataPool:UserBag_CountItemByName("ԸȪ")

			while true do
				if lastNum < DataPool:UserBag_CountItemByName("ԸȪ") then
					UI:WindowHide("XingYun")
					break
				end

				QuestFrameSpeak(0, g_NpcInfo[0].szNpcName)
				QuestFrameOptionClicked("ȡ", CMP_PART_MATCH)
				local strType,_,_,_,szText = DataPool:GetNPCEventList_Item(0);

				if strType == "text" then
					if string.find(szText, "ûн") then break end
				end
				System:Sleep(1000)
			end
		else
			DoLuaString("XingYun_Env", string.format("Play_Ani(%d)", i+1))
			System:Sleep(2000)
		end
	end

	System:Sleep(1000)
end