ShowMessage("百变脸谱 $Rev: 206 $")

--[[
[author]
descript="每天可以做1次"
]]--
perday_max=1
script_name="百变脸谱"

local szBuffName = ""
local buff_index = 0

function OnMission()
	while true do
		-- 移动到 苏州 文彦博 267 263 处
		MoveToNPC(267, 263, DataBase:GetSceneID("苏州"), "文彦博")
		--下坐骑
		szBuffName = "坐骑"
		buff_index = Player_GetBuff(szBuffName)
		Player_DispelBuffByIndex(buff_index)			
		-- 选择 百变脸谱 接任务
		local g_szMission = "百变脸谱"
		QuestFrameOptionClicked(g_szMission, CMP_PART_MATCH)
		
		local strType,_,_,_,szText = DataPool:GetNPCEventList_Item(0)		
		if strType == "text" then				
			if string.find(szText, "多谢大侠相助") then
				ShowMessage("百变脸谱：已经完成！")
				--取消变身
				szBuffName = "变身"
				buff_index = Player_GetBuff(szBuffName)
				Player_DispelBuffByIndex(buff_index)
				--break				
			elseif string.find(szText, "大侠还是明天再来吧") then
				ShowMessage("百变脸谱：已经完成！")
				System:UpdateRecord( script_name )
				break	
			end
		end
	end
end

function _SMain(...)
	OnMission()
end

_SMain()