ShowMessage("新手任务10-30级 $Rev: 187 $")

-- 奔赴敦煌
function OnMission_210810()
	
	local strMission = "奔赴敦煌"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then
		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(252, 144, DataBase:GetSceneID("敦煌"), "杨文广")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
	return false
end

-- 救治伤患
function OnMission_210811()

	local strMission = "救治伤患"

	if DataPool:IsMissionOutline(strMission) then
		MissionMoveToNPC("杨文广")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()

		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then
		MoveToNPC(258, 163, DataBase:GetSceneID("敦煌"), "张全祥")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end

-- 月牙泉水
function OnMission_210812()
	
	local strMission = "月牙泉水"

	if DataPool:IsMissionOutline(strMission) then
		MissionMoveToNPC("杨文广")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()

		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then
		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:IsMissionCanCommit(idMission) then
			MoveToNPC(258, 163, DataBase:GetSceneID("敦煌"), "张全祥")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(257, 178, DataBase:GetSceneID("敦煌"), "", 1)
			Dismount()
			UseItem("空竹筒", "")
		end

		return true
	end

	return false
end

-- 驱逐群狼
function OnMission_210813()
	
	
	local strMission = "驱逐群狼"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(258, 163, nSceneID, "张全祥")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()

		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:IsMissionCanCommit(idMission) then
			MoveToNPC(258, 163, nSceneID, "张全祥")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "沙坡狼")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 237, 165)
			AI:Start(false)

			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end

			AI:Stop()
		end

		return true
	end

	return false
end

--火线支援
function OnMission_210814()
	
	local strMission = "火线支援"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		
		MoveToNPC(258, 163, nSceneID, "张全祥")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(141, 126, nSceneID, "吴长风")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end

	return false
end

-- 牛刀小试
function OnMission_210815()
	
	local strMission = "牛刀小试"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(141, 126, nSceneID, "吴长风")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:IsMissionCanCommit(idMission) then
			MoveToNPC(141, 126, nSceneID, "吴长风")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(163, 58, nSceneID)
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "西夏士兵")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 163, 58)
			AI:SetParameter("坐标", "添加", 125, 89)
			AI:SetParameter("坐标", "添加", 103, 122)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--乔装准备
function OnMission_210816()
	
	local strMission = "乔装准备"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		
		MoveToNPC(141, 126, nSceneID, "吴长风")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		
		local item = 
		{
			[1] = {x=98, y=136, name="西夏士兵的头盔"},
			[2] = {x=87, y=144, name="西夏士兵的铠甲"},
			[3] = {x=107, y=146, name="西夏士兵的长刀"}
		}

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(141, 126, nSceneID, "吴长风")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			for i=1, 3 do
				if DataPool:GetPlayerMission_Variable(nSelIndex, i) == 0 then
					MoveTo(item[i].x, item[i].y, nSceneID)
					Dismount()
					Player_UseSkill_Collect(3, item[i].name)
					break
				end
			end
		end
		return true
	end

	return false
end

-- 深入敌营
function OnMission_210817()

	local strMission = "深入敌营"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(141, 126, nSceneID, "吴长风")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked("我易容", CMP_PART_MATCH)
		QuestFrameOptionClicked("宝塔镇河妖", CMP_PART_MATCH)
		QuestFrameOptionClicked("长老身体可还无恙", CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end

	return false
end

-- 虎口夺药
function OnMission_210818()
	
	local strMission = "虎口夺药"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(139, 232, nSceneID, "奚三祁")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(108, 277, nSceneID)
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "一品堂前锋")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 108, 277)
			AI:SetParameter("坐标", "添加", 145, 279)
			AI:SetParameter("坐标", "添加", 68, 272)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--还施彼身
function OnMission_210819()
	
	local strMission = "还施彼身"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(139, 232, nSceneID, "奚三祁")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(187, 248, nSceneID, "", 1)
			Dismount()
			UseItem("蛇毒", "")
		end
		return true
	end

	return false
end

--焚毁粮草
function OnMission_210820()
	
	local strMission = "焚毁粮草"
	local nSceneID = DataBase:GetSceneID("敦煌")
	
	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end
	
	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(139, 232, nSceneID, "奚三祁")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(176, 270, nSceneID, "", 1)
			Dismount()
			UseItem("火石", "")
		end

		return true
	end

	return false
end

--破坏弩车
function OnMission_210821()
	
	local strMission = "破坏弩车"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(139, 232, nSceneID, "奚三祁")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(232, 235, nSceneID)
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "弩车")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 232, 235)
			AI:SetParameter("坐标", "添加", 179, 214)
			AI:SetParameter("坐标", "添加", 173, 239)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end

		return true
	end

	return false
end

--刺杀大将
function OnMission_210822()
	
	local strMission = "刺杀大将"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(139, 232, nSceneID, "奚三祁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(141, 126, nSceneID, "吴长风")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(94, 211, nSceneID)
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "李重烈")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 94, 211)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end

		return true
	end

	return false
end

--首战告捷
function OnMission_210823()
	
	local strMission = "首战告捷"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(141, 126, nSceneID, "吴长风")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(252, 144, nSceneID, "杨文广")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成

		return true
	end

	return false
end

--洛阳游医
function OnMission_210824()
	
	local strMission = "洛阳游医"
	local nSceneID = DataBase:GetSceneID("敦煌")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(252, 144, nSceneID, "杨文广")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(255, 372, 0, "韩银叶")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end

--惊闻变故
function OnMission_890235()
	
	local strMission = "惊闻变故"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(255, 372, 0, "韩银叶")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(168, 217, DataBase:GetSceneID("嵩山"), "空闻大师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end

--收集狼血
function OnMission_890222()
	
	local strMission = "收集狼血"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(168, 217, nSceneID, "空闻大师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(168, 217, nSceneID, "空闻大师")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "颍水狼")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 165, 165)
			AI:SetParameter("坐标", "添加", 134, 200)
			AI:SetParameter("坐标", "添加", 194, 198)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end

		return true
	end

	return false
end

--采集草药
function OnMission_890221()
	
	local strMission = "采集草药"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(168, 217, nSceneID, "空闻大师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(168, 217, nSceneID, "空闻大师")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("采集")
			AI:SetParameter("初始化")
			AI:SetParameter("目标", "添加", "养心草")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 179, 174)
			AI:SetParameter("坐标", "添加", 134, 202)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--熬制良药
function OnMission_890223()
	
	local strMission = "熬制良药"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(168, 217, nSceneID, "空闻大师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(168, 217, nSceneID, "空闻大师")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			if DataPool:UserBag_CountItemByName("伤药") == 1 then
				MoveTo(168, 216, nSceneID, "", 1)
				Dismount()
				UseItem("伤药", "")
			else
				MoveToNPC(166, 200, nSceneID, "陶土罐")
				QuestFrameOptionClicked("将药液倒入罐中", CMP_PART_MATCH)
				QuestFrameOptionClicked("使用小火慢慢熬制", CMP_PART_MATCH)
				QuestFrameOptionClicked("待火慢慢燃起", CMP_PART_MATCH)
				QuestFrameOptionClicked("将火力加大", CMP_PART_MATCH)
				QuestFrameOptionClicked("取出伤药", CMP_PART_MATCH)
			end
		end
		return true
	end

	return false
end

--解救少女
function OnMission_890225()
	
	local strMission = "解救少女"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(168, 217, nSceneID, "空闻大师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(63, 136, nSceneID, "林影儿")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "衣衫褴褛的恶汉")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 86, 117)
			AI:SetParameter("坐标", "添加", 88, 75)
			AI:SetParameter("坐标", "添加", 47, 89)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--真真假假
function OnMission_890226()
	
	local strMission = "真真假假"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(63, 136, nSceneID, "林影儿")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(60, 128, nSceneID, "马三")
		QuestFrameOptionClicked("询问空闻大师一事", CMP_PART_MATCH)
		QuestFrameOptionClicked("你说的话可有凭证", CMP_PART_MATCH)
		QuestFrameOptionClicked("我便暂且信你一回", CMP_PART_MATCH)
		QuestFrameOptionClicked("真真假假", CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end

--嵩阳一探
function OnMission_890227()
	
	local strMission = "嵩阳一探"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(60, 128, nSceneID, "马三")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(200, 67, nSceneID, "柴进")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
			MoveToNPC(139, 106, nSceneID, "空闻大师之墓")
			QuestFrameOptionClicked("细细探察此处", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--美若天仙
function OnMission_890228()
	
	local strMission = "美若天仙"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(200, 67, nSceneID, "柴进")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(200, 67, nSceneID, "柴进")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(241, 60, nSceneID, "伤愈的空闻大师")
			QuestFrameOptionClicked("不知阁下是否便是空闻大师", CMP_PART_MATCH)
			QuestFrameOptionClicked("小妇人来求", CMP_PART_MATCH)
			QuestFrameOptionClicked("恭候大师", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--迷魂汤
function OnMission_890229()
	
	local strMission = "迷魂汤"
	local nSceneID = DataBase:GetSceneID("嵩山")
	local nItemTableID = 38000786
	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(200, 67, nSceneID, "柴进")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:UserBag_CountItemByIDTable(nItemTableID) >= 1 then
			MoveToNPC(200, 67, nSceneID, "柴进")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(181, 63, nSceneID, "黑市商人")
			QuestFrameOptionClicked("黑市商铺", CMP_PART_MATCH)
			ShopBuy(nItemTableID, 1)
			System:Sleep(1000)
		end

		return true
	end

	return false
end

--智计擒贼
function OnMission_890230()
	
	local strMission = "智计擒贼"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(200, 67, nSceneID, "柴进")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(200, 67, nSceneID, "柴进")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(241, 60, nSceneID, "伤愈的空闻大师")
			QuestFrameOptionClicked("第一杯酒", CMP_PART_MATCH)
			QuestFrameOptionClicked("第二杯酒", CMP_PART_MATCH)
			QuestFrameOptionClicked("最后一杯酒", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--拜祭英魂
function OnMission_890231()
	
	local strMission = "拜祭英魂"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(200, 67, nSceneID, "柴进")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(90, 42, nSceneID, "乔峰")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(123, 51, nSceneID, "", 1)
			Dismount()
			UseItem("上等黄酒", "")
		end

		return true
	end

	return false
end

--江湖救急
function OnMission_890236()
	
	local strMission = "江湖救急"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(90, 42, nSceneID, "乔峰")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(160, 159, 2, "赵天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		return true
	end
	return false
end

--西湖分舵
function OnMission_890233()
	
	local strMission = "西湖分舵"
	local nSceneID = DataBase:GetSceneID("嵩山")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(90, 42, nSceneID, "乔峰")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(45, 59, DataBase:GetSceneID("西湖"), "乔小喜")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			if "嵩山" == GetActiveSceneName() then
				MoveToNPC(90, 42, nSceneID, "乔峰")
				QuestFrameOptionClicked("前往西湖", CMP_PART_MATCH)
				System:Sleep(1000)
			else
				MoveToNPC(45, 59, DataBase:GetSceneID("西湖"), "乔小喜")
			end
		end

		return true
	end

	return false
end

--西湖寻踪
function OnMission_890207()
	
	local strMission = "西湖寻踪"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(45, 59, nSceneID, "乔小喜")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(104, 80, nSceneID, "悬挂的尸体")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		end

		return true
	end

	return false
end

--节外生枝
function OnMission_890208()
	
	local strMission = "节外生枝"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(104, 80, nSceneID, "悬挂的尸体")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(116, 98, nSceneID, "刘浩然")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(104, 80, nSceneID, "悬挂的尸体")
			QuestFrameOptionClicked("检查尸体", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--蜂毒毁尸
function OnMission_890209()
	
	local strMission = "蜂毒毁尸"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(116, 98, nSceneID, "刘浩然")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(116, 98, nSceneID, "刘浩然")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "花港毒蜂")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 106, 75)
			AI:SetParameter("坐标", "添加", 81, 51)
			AI:SetParameter("坐标", "添加", 58, 88)
			
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end

		return true
	end

	return false
end

--毒草灭迹
function OnMission_890210()
	
	local strMission = "毒草灭迹"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(116, 98, nSceneID, "刘浩然")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(116, 98, nSceneID, "刘浩然")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("采集")
			AI:SetParameter("初始化")
			AI:SetParameter("目标", "添加", "溶尸草")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 114, 116)
			AI:SetParameter("坐标", "添加", 184, 106)
			AI:SetParameter("坐标", "添加", 78, 89)
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--抽丝剥茧
function OnMission_890211()
	
	local strMission = "抽丝剥茧"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(116, 98, nSceneID, "刘浩然")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(83, 163, nSceneID, "包不同")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			local item = 
			{
				[1] = {x=141, y=111, name="新鲜的血迹"},
				[2] = {x=131, y=123, name="遗落的暗器"},
				[3] = {x=106, y=146, name="树上的剑痕"},
			}

			for i=1,3 do
				if DataPool:GetPlayerMission_Variable(nSelIndex, i) == 0 then
					MoveToNPC(item[i].x, item[i].y, nSceneID, item[i].name)
					QuestFrameOptionClicked("检查线索", CMP_PART_MATCH)
					break
				end
			end
		end

		return true
	end

	return false
end

--非也非也
function OnMission_890212()
	
	local strMission = "非也非也"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(83, 163, nSceneID, "包不同")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(83, 163, nSceneID, "包不同")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(83, 163, nSceneID, "包不同")
			QuestFrameOptionClicked("非也非也", CMP_PART_MATCH)
			QuestFrameOptionClicked("非也非也", CMP_PART_MATCH)
			QuestFrameOptionClicked("非也非也", CMP_PART_MATCH)
			QuestFrameOptionClicked("非也非也", CMP_PART_MATCH)
			QuestFrameOptionClicked("藏头露尾", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--见面大礼
function OnMission_890213()
	
	local strMission = "见面大礼"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(83, 163, nSceneID, "包不同")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(97, 171, nSceneID, "风波恶")
			Dismount()
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "白堤柳鬼")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 44, 138)
			AI:SetParameter("坐标", "添加", 88, 145)
			AI:SetParameter("坐标", "添加", 65, 127)
			
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--陈年佳酿
function OnMission_890214()
	
	local strMission = "陈年佳酿"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(97, 171, nSceneID, "风波恶")
		Dismount()
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(97, 171, nSceneID, "风波恶", false)
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(76, 193, nSceneID, "美酒酒桶", false)
			QuestFrameOptionClicked("偷取陈年佳酿", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--杯中恩怨
function OnMission_890215()
	
	local strMission = "杯中恩怨"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(97, 171, nSceneID, "风波恶")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(97, 171, nSceneID, "风波恶")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			if FindCharacterByName("风波恶的仇敌") == INVALID_ID then
				MoveTo(133, 169, nSceneID)
				Dismount()
				UseItem("喝剩的绝世美酒", "")
			else
				AI:SetAI("杀怪")
				AI:SetParameter("目标", "添加", "风波恶的仇敌")
				AI:SetParameter("地图", nSceneID)
				AI:SetParameter("坐标", "添加", 133, 169)
				
				AI:Start(false)
				while DataPool:IsMissionCanCommit(idMission) == false do
					if FindCharacterByName("风波恶的仇敌") == INVALID_ID then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()
			end
		end

		return true
	end

	return false
end

--杯中恩怨
function OnMission_890215()
	
	local strMission = "杯中恩怨"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(97, 171, nSceneID, "风波恶")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(97, 171, nSceneID, "风波恶")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			if FindCharacterByName("风波恶的仇敌") == INVALID_ID then
				MoveTo(133, 169, nSceneID)
				Dismount()
				UseItem("喝剩的绝世美酒", "")
			else
				AI:SetAI("杀怪")
				AI:SetParameter("目标", "添加", "风波恶的仇敌")
				AI:SetParameter("地图", nSceneID)
				AI:SetParameter("坐标", "添加", 133, 169)
				
				AI:Start(false)
				while DataPool:IsMissionCanCommit(idMission) == false do
					if FindCharacterByName("风波恶的仇敌") == INVALID_ID then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()
			end
		end

		return true
	end

	return false
end

--姑苏慕容
function OnMission_890216()
	
	local strMission = "姑苏慕容"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(97, 171, nSceneID, "风波恶")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(101, 218, nSceneID, "慕容复")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end


--真相大白
function OnMission_890217()
	
	local strMission = "真相大白"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(101, 218, nSceneID, "慕容复")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(101, 218, nSceneID, "慕容复")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(104, 212, nSceneID, "一动不动的飞贼")
			QuestFrameOptionClicked("自生自灭", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--洱海玉虚
function OnMission_890218()
	
	local strMission = "洱海玉虚"
	local nSceneID = DataBase:GetSceneID("西湖")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(101, 218, nSceneID, "慕容复")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if "西湖" == GetActiveSceneName() then
			MoveToNPC(101, 218, nSceneID, "慕容复")
			QuestFrameOptionClicked("送我去洱海", CMP_PART_MATCH)
			System:Sleep(1000)
		else
			MoveToNPC(243, 42, DataBase:GetSceneID("洱海"), "刀白凤")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		end

		return true
	end

	return false
end

--洱海寻医
function OnMission_890219()
	
	local strMission = "洱海寻医"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(243, 42, nSceneID, "刀白凤")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(176, 78, nSceneID, "木铃儿")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end

	return false
end

--望闻问切
function OnMission_890660()
	
	local strMission = "望闻问切"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(176, 78, nSceneID, "木铃儿")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(180, 36, nSceneID, "木柯隆")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(177, 45, nSceneID, "木赫")
			QuestFrameOptionClicked("查看他的病症", CMP_PART_MATCH)
			QuestFrameOptionClicked("双眼", CMP_PART_MATCH)
			QuestFrameOptionClicked("继续观察", CMP_PART_MATCH)	
		end

		return true
	end

	return false
end

--怪病真相
function OnMission_890659()
	
	local strMission = "怪病真相"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(180, 36, nSceneID, "木柯隆")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(180, 36, nSceneID, "木柯隆")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(178, 45, nSceneID, "", 1)
			Dismount()
			UseItem("金针", "")
		end
		return true
	end

	return false
end

--洱海仙虫
function OnMission_890662()
	
	local strMission = "洱海仙虫"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(180, 36, nSceneID, "木柯隆")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(180, 36, nSceneID, "木柯隆")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			if FindCharacterByName("仙海虫") == INVALID_ID then
				MoveTo(111, 100, nSceneID)
				Dismount()
				UseItem("蝶香粉", "")
			else
				AI:SetAI("杀怪")
				AI:SetParameter("目标", "添加", "仙海虫")
				AI:SetParameter("地图", nSceneID)
				AI:SetParameter("坐标", "添加", 111, 100)
				
				AI:Start(false)
				while true do
					if FindCharacterByName("仙海虫") == INVALID_ID then break end
					System:Sleep(200)
				end
				AI:Stop()
			end
		end

		return true
	end

	return false
end

--情人之血
function OnMission_890663()
	
	local strMission = "情人之血"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(180, 36, nSceneID, "木柯隆")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(180, 36, nSceneID, "木柯隆")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(176, 78, nSceneID, "木铃儿")
			QuestFrameOptionClicked("鲜血救人", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--以蛊制蛊
function OnMission_890664()
	
	local strMission = "以蛊制蛊"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(180, 36, nSceneID, "木柯隆")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(180, 36, nSceneID, "木柯隆")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveToNPC(177, 45, nSceneID, "木赫")
			QuestFrameOptionClicked("令其服下", CMP_PART_MATCH)
		end

		return true
	end

	return false
end

--痴爱
function OnMission_890665()
	
	local strMission = "痴爱"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(180, 36, nSceneID, "木柯隆")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(176, 78, nSceneID, "木铃儿")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false
end

--蛊巫真身
function OnMission_890666()
	
	local strMission = "蛊巫真身"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(176, 78, nSceneID, "木铃儿")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(280, 205, nSceneID, "纳塔")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "风豹")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 164, 185)
			AI:SetParameter("坐标", "添加", 110, 218)
			AI:SetParameter("坐标", "添加", 182, 191)
			
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end

		return true
	end

	return false
end

--心结
function OnMission_890667()
	
	local strMission = "心结"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(280, 205, nSceneID, "纳塔")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(280, 205, nSceneID, "纳塔")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			AI:SetAI("采集")
			AI:SetParameter("目标", "添加", "情人草")
			AI:SetParameter("地图", nSceneID)
			AI:SetParameter("坐标", "添加", 262, 179)
			AI:SetParameter("坐标", "添加", 247, 224)
			AI:SetParameter("坐标", "添加", 280, 205)
			
			AI:Start(false)
			while DataPool:IsMissionCanCommit(idMission) == false do
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end

	return false
end

--活着的仙药
function OnMission_890668()
	
	local strMission = "活着的仙药"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(280, 205, nSceneID, "纳塔")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(257, 133, nSceneID, "云端")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		else
			MoveTo(272, 207, nSceneID, "", 1)
			Dismount()
			UseItem("熏香", "")
		end

		return true
	end

	return false
end

--神秘棋局
function OnMission_890669()
	
	local strMission = "神秘棋局"
	local nSceneID = DataBase:GetSceneID("洱海")

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(257, 133, nSceneID, "云端")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(160, 159, 2, "赵天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--大理棋圣
function OnMission_1018702()
	
	local strMission = "大理棋圣"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
	
		MoveToNPC(287, 138, 2, "刘仲甫")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--苏州棋圣
function OnMission_1018703()
	
	local strMission = "苏州棋圣"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(267, 243, 1, "张弈国")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--洛阳棋圣
function OnMission_1018704()
	
	local strMission = "洛阳棋圣"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(366, 228, 0, "王积薪")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--黑白
function OnMission_1018705()
	
	local strMission = "黑白"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(356, 208, 0, "卜悔琪")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--生死棋局
function OnMission_500601()

	local strMission = "生死棋局"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		local szSceneName = GetActiveSceneName()

		if szSceneName == "珍珑棋局" then

			MoveToNPC(40, 40, -1, "齐圣")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()

		else
			MoveToNPC(366, 228, 0, "王积薪")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	
		end

		return true
	end
end

--棋局试炼
function OnMission_402060()

	local strMission = "棋局试炼"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		local szSceneName = GetActiveSceneName()

		if szSceneName == "珍珑棋局" then

			if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
				MoveToNPC(40, 40, -1, "齐圣")
				QuestFrameOptionClicked("确定", CMP_PART_MATCH)
			else
				AI:SetAI("杀怪")
				AI:SetParameter("目标", "添加", "黑棋子")
				AI:SetParameter("目标", "添加", "白棋子")
				AI:SetParameter("目标", "添加", "黑棋魂")
				AI:SetParameter("目标", "添加", "白棋魂")
				AI:SetParameter("目标", "添加", "珍珑棋魂")
				AI:SetParameter("坐标", "添加", 64, 46)
				AI:SetParameter("坐标", "添加", 81, 46)
				AI:SetParameter("坐标", "添加", 81, 61)
				AI:SetParameter("坐标", "添加", 81, 81)
				AI:SetParameter("坐标", "添加", 64, 81)
				AI:SetParameter("坐标", "添加", 44, 81)
				AI:SetParameter("坐标", "添加", 44, 64)
				AI:SetParameter("坐标", "添加", 64, 61)
				AI:SetParameter("拾取", PM_NOPICKUP)
				AI:SetParameter("地图", -1)

				AI:Start(false)
				while true  do
					if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "珍珑棋局" then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()
				
			end
		end

		return true
	end

end

--天师的期待1
function OnMission_500602()
	
	local strMission = "天师的期待(1)"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(256, 273, 0, "周天师")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		end
		return true
	end
end

--天师的期待2
function OnMission_500604()
	
	local strMission = "天师的期待(2)"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(256, 273, 0, "周天师")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()
		end
		return true
	end
end

--天师的期待(3)
function OnMission_500603()

	local strMission = "天师的期待(3)"

	if Player:GetData("LEVEL") < 32 then return false end

	if DataPool:IsMissionOutline("天师的期待（3）") then
		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		return true
		
	end
end

--天师的期待(4)
function OnMission_500603()

	local strMission = "天师的期待(4)"

	if Player:GetData("LEVEL") < 35 then return false end

	if DataPool:IsMissionOutline("天师的期待（4）") then
		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		return true
		
	end
end

--十年又十年
function OnMission_1018700()
	
	local strMission = "十年又十年"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
	
		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
	end
end

--回报天师(1)
function OnMission_250052()

	local strMission = "回报天师(1)"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
		
	end
end

--贼兵入侵
function OnMission_1018707()

	local strMission = "贼兵入侵"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)
		MoveToNPC(214, 325, 0, "立繁")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()
		return true
		
	end
end

g_Shimen_Npc = {
	--少林
	[0] = {szNpcName="慧方", fX=96, fY=83, nSceneID=9},
	--明教
	[1] = {szNpcName="林岩", fX=98, fY=105, nSceneID=11},
	--丐帮
	[2] = {szNpcName="洪通", fX=91, fY=77, nSceneID=10},
	--武当
	[3] = {szNpcName="张中行", fX=78, fY=95, nSceneID=12},
	--峨嵋
	[4] = {szNpcName="孟龙", fX=96, fY=88, nSceneID=15},
	--星宿
	[5] = {szNpcName="王彦", fX=96, fY=92, nSceneID=16},
	--天龙
	[6] = {szNpcName="本凡", fX=95, fY=88, nSceneID=13},
	--天山
	[7] = {szNpcName="符敏仪", fX=95, fY=60, nSceneID=17},
	--逍遥
	[8] = {szNpcName="秦观", fX=119, fY=152, nSceneID=14},
	--无门派
	[9] = {szNpcName="", fX=0, fY=0, nSceneID=0},
	--莫蓉
	[10] = {szNpcName="慕容胜", fX=68, fY=127, nSceneID=284},
	--唐门
	[11] = {szNpcName="唐清秋", fX=100, fY=64, nSceneID=615}
}

--报效师门
function OnMission_890335()

	local strMission = "报效师门"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		local nMenPai = Player:GetData("MENPAI")

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			
			local Npc = g_Shimen_Npc[nMenPai]

			MoveToNPC(Npc.fX, Npc.fY, Npc.nSceneID, Npc.szNpcName)
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
			QuestFrameMissionComplete()	-- 完成

			return true
		end
	end
end

--青铜武林印之管理员邀请函
function OnMission_1018819()
	local strMission = "青铜武林印之管理员邀请函"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(256, 273, 0, "周天师")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(149, 121, 2, "祝富贵")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		return true
	end
	return false
end

--青铜武林印之相助师门
function OnMission_1018847()
	local strMission = "青铜武林印之相助师门"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(149, 121, 2, "祝富贵")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		local nMenPai = Player:GetData("MENPAI")
		local Npc = g_Shimen_Npc[nMenPai]

		MoveToNPC(Npc.fX, Npc.fY, Npc.nSceneID, Npc.szNpcName)
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end
	return false
end

--青铜武林印之除恶务尽
function OnMission_1039814()
	local strMission = "青铜武林印之除恶务尽"

	if DataPool:IsMissionOutline(strMission) then
		local nMenPai = Player:GetData("MENPAI")
		local Npc = g_Shimen_Npc[nMenPai]

		MoveToNPC(Npc.fX, Npc.fY, Npc.nSceneID, Npc.szNpcName)
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then

			MoveToNPC(94, 201, 2, "付劫生")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
			QuestFrameAcceptClicked()

		else
			MoveToNPC(105, 123, 2, "卢三七")
			QuestFrameOptionClicked("购买药品", CMP_PART_MATCH)
			ShopBuy(30001003, 1)
			System:Sleep(1000)
		end

		return true
	end
	return false
end

--青铜武林印之惩凶打图
function OnMission_1018848()

	local strMission = "青铜武林印之惩凶打图"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(94, 201, 2, "付劫生")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(224, 226, 1, "吴玠")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end
	return false

end

--造反恶贼
function OnMission_500604()

	local strMission = "造反恶贼"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then

		else
			if GetActiveSceneName() ~= "贼寇营地" then
				MoveToNPC(108, 110, 3, "造反恶贼指引人")
				QuestFrameOptionClicked("剿反演练", CMP_PART_MATCH)	-- 选择选项
			else
				MoveToNPC(74, 113, -2, "造反恶贼指引人")
				QuestFrameOptionClicked("造反恶贼", CMP_PART_MATCH)	-- 选择选项
				QuestFrameMissionComplete()	-- 完成
			end
		end

		return true
	end

	return false

end

--剿灭反贼
function OnMission_402061()

	local strMission = "剿灭反贼"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		AI:SetAI("杀怪")
		AI:SetParameter("地图", -1)

		if DataPool:GetPlayerMission_Variable(nSelIndex, 1) ~= 30 then

			AI:SetParameter("目标", "添加", "反贼喽啰")
			AI:SetParameter("坐标", "添加", 86, 88)
			AI:SetParameter("坐标", "添加", 99, 59)
			AI:SetParameter("坐标", "添加", 94, 24)
			AI:SetParameter("坐标", "添加", 24, 26)
			AI:SetParameter("坐标", "添加", 40, 70)
			AI:SetParameter("坐标", "添加", 24, 88)
			AI:SetParameter("坐标", "添加", 20, 104)
			AI:Start(false)

			while DataPool:GetPlayerMission_Variable(nSelIndex, 1) ~= 30  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "贼寇营地" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()

		elseif DataPool:GetPlayerMission_Variable(nSelIndex, 2) ~= 1 then

			AI:SetParameter("目标", "添加", "反贼头目")
			AI:SetParameter("坐标", "添加", 18, 102)
			AI:Start(false)

			while DataPool:GetPlayerMission_Variable(nSelIndex, 2) ~= 10  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "贼寇营地" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()

		end

		return true
	end
	return false

end

--试炼之所摩崖洞
function OnMission_1018706()

	local strMission = "试炼之所摩崖洞"

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		MoveToNPC(17, 229, 213, "摩云天")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
		QuestFrameMissionContinue()	-- 继续
		QuestFrameMissionComplete()	-- 完成
		QuestFrameAcceptClicked()

		return true
	end

	return false

end

--清剿摩崖洞
function OnMission_10300501()

	local strMission = "清剿摩崖洞"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(17, 229, 213, "摩云天")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(17, 229, 213, "摩云天")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
		else
			if GetActiveDataSceneID() ~= 213 then
				MoveTo(17, 229, 213)
			end

			AI:SetAI("杀怪")
			AI:SetParameter("地图", 213)

			if DataPool:GetPlayerMission_Variable(nSelIndex, 1) ~= 10 then

				AI:SetParameter("目标", "添加", "秦家寨恶霸")
				AI:SetParameter("坐标", "添加", 17, 216)
				AI:Start(false)
				while DataPool:GetPlayerMission_Variable(nSelIndex, 1) ~= 10  do
					if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "摩崖洞" then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()

			elseif DataPool:GetPlayerMission_Variable(nSelIndex, 2) ~= 10 then

				AI:SetParameter("目标", "添加", "秦家寨卫兵")
				AI:SetParameter("坐标", "添加", 57, 226)
				AI:Start(false)
				while DataPool:GetPlayerMission_Variable(nSelIndex, 2) ~= 10  do
					if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "摩崖洞" then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()

			elseif DataPool:GetPlayerMission_Variable(nSelIndex, 3) ~= 10 then

				AI:SetParameter("目标", "添加", "秦家寨土匪")
				AI:SetParameter("坐标", "添加", 86, 152)
				AI:Start(false)
				while DataPool:GetPlayerMission_Variable(nSelIndex, 3) ~= 10  do
					if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "摩崖洞" then
						break
					end
					System:Sleep(200)
				end
				AI:Stop()

			end

		end

		return true
	end
	return false

end

--秘密联络
function OnMission_1030050()

	local strMission = "秘密联络"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(263, 47, 18, "种世衡")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(263, 47, 18, "种世衡")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
		else
			MoveTo(200, 121, 18)

			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "秦家寨信使")
			AI:SetParameter("坐标", "添加", 200, 121)
			AI:SetParameter("坐标", "添加", 104, 200)
			--AI:SetParameter("拾取", PM_PICKUP)
			AI:SetParameter("地图", 18)

			AI:Start(false)
			while true  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "雁南" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()
		end
	end
	return false

end

--完美的灰熊皮
function OnMission_1030051()

	local strMission = "完美的灰熊皮"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(260, 88, 18, "马承倩")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(260, 88, 18, "马承倩")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)	-- 选择选项
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
		else
			MoveTo(184, 66, 18)

			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "灰熊")
			AI:SetParameter("坐标", "添加", 184, 66)
			AI:SetParameter("坐标", "添加", 150, 89)
			AI:SetParameter("地图", 18)

			AI:Start(false)
			while true  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "雁南" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()
		end
		return true
	end
	return false

end

--狼害
function OnMission_1000050()

	local strMission = "狼害"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(242, 72, 18, "周无畏")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(242, 72, 18, "周无畏")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
		else

			MoveTo(240, 262, 18)

			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "西北狼")
			AI:SetParameter("坐标", "添加", 240, 262)
			AI:SetParameter("坐标", "添加", 250, 216)
			AI:SetParameter("地图", 18)

			AI:Start(false)
			while true  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "雁南" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()

		end

		return true
	end
	return false
end

--豹害
function OnMission_1000051()

	local strMission = "豹害"

	if DataPool:IsMissionOutline(strMission) then
		MoveToNPC(242, 72, 18, "周无畏")
		QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
		QuestFrameAcceptClicked()
		return true
	end

	local nSelIndex, idMission, idScript = DataPool:GetPlayerMission(strMission)

	if nSelIndex ~= -1 then

		DbgPrintf("%d %d %d", nSelIndex, idMission, idScript)

		if  DataPool:GetPlayerMission_Variable(nSelIndex, 0) == 1 then
			MoveToNPC(242, 72, 18, "周无畏")
			QuestFrameOptionClicked(strMission, CMP_PART_MATCH)
			QuestFrameMissionContinue()	-- 继续
			QuestFrameMissionComplete()	-- 完成
		else

			MoveTo(256, 178, 18)

			AI:SetAI("杀怪")
			AI:SetParameter("目标", "添加", "金钱豹")
			AI:SetParameter("坐标", "添加", 256, 178)
			AI:SetParameter("坐标", "添加", 253, 210)
			AI:SetParameter("地图", 18)

			AI:Start(false)
			while true  do
				if DataPool:IsMissionCanCommit(idMission) or GetActiveSceneName() ~= "雁南" then
					break
				end
				System:Sleep(200)
			end
			AI:Stop()

		end

		return true
	end
	return false
end

local nLastLevel = 0

function _SMain(...)

	if Player:GetData("LEVEL") > 40 then return end

	if 9 == Player:GetData("MENPAI") then
		ShowMessage("未加入门派，请加入门派后再执行此脚本。")
		return
	end

	local nCheckTick = 0 

	while true do

		local nCurLevel = Player:GetData("LEVEL")
		local nCurExperience = Player:GetData("EXP");
		local nRequireExperience = Player:GetData("NEEDEXP");

		if nCurExperience >= nRequireExperience and nCurLevel < 30 then
			DoLuaString("", "AskLevelUp(0);")
		end

		if nCurLevel > nLastLevel and nCurLevel < 30 then
			
			for i=1, 30 do
				if PlayerPackage:IsPresent(i-1) then
					if PlayerPackage:GetItemClass(i-1) == ITEM_CLASS.ICLASS_EQUIP then
						if nCurLevel > PlayerPackage:GetNeedLevel(i-1) + 1 then
							DiscardItem(ITEM_OWNER.IO_MYSELF_PACKET, i-1)
							System:Sleep(1000)
						end
					end
				end
			end
			
			nLastLevel = nCurLevel
		end

		DataPool:GetMissionOutline()

		if OnMission_210810() then
		elseif OnMission_210811() then
		elseif OnMission_210812() then
		elseif OnMission_210813() then
		elseif OnMission_210814() then
		elseif OnMission_210815() then
		elseif OnMission_210816() then
		elseif OnMission_210817() then
		elseif OnMission_210818() then
		elseif OnMission_210819() then
		elseif OnMission_210820() then
		elseif OnMission_210821() then
		elseif OnMission_210822() then
		elseif OnMission_210823() then
		elseif OnMission_210824() then

		elseif OnMission_890235() then
		elseif OnMission_890222() then
		elseif OnMission_890221() then
		elseif OnMission_890223() then
		elseif OnMission_890225() then
		elseif OnMission_890226() then
		elseif OnMission_890227() then
		elseif OnMission_890228() then
		elseif OnMission_890229() then
		elseif OnMission_890230() then
		elseif OnMission_890231() then
		elseif OnMission_890236() then
		elseif OnMission_890233() then
		elseif OnMission_890207() then
		elseif OnMission_890208() then
		elseif OnMission_890209() then
		elseif OnMission_890210() then
		elseif OnMission_890211() then
		elseif OnMission_890212() then
		elseif OnMission_890213() then
		elseif OnMission_890214() then
		elseif OnMission_890215() then
		elseif OnMission_890216() then
		elseif OnMission_890217() then
		elseif OnMission_890218() then
		elseif OnMission_890219() then

		elseif OnMission_890660() then
		elseif OnMission_890659() then
		elseif OnMission_890662() then
		elseif OnMission_890663() then
		elseif OnMission_890664() then
		elseif OnMission_890665() then
		elseif OnMission_890666() then
		elseif OnMission_890667() then
		elseif OnMission_890668() then
		elseif OnMission_890669() then
		elseif OnMission_1018702() then
		elseif OnMission_1018703() then
--[[
		--洛阳棋圣
		elseif OnMission_1018704() then
		--黑白
		elseif OnMission_1018705() then
		--生死棋局
		elseif OnMission_500601() then
		--棋局试炼
		elseif OnMission_402060() then
		--天师的期待1
		elseif OnMission_500602() then
		--天师的期待2
		elseif OnMission_500604() then
		--天师的期待(3)
		elseif OnMission_500603() then
		--十年又十年
		elseif OnMission_1018700() then
		--回报天师(1)
		elseif OnMission_250052() then
		--贼兵入侵
		elseif OnMission_1018707() then
		--报效师门
		elseif OnMission_890335() then
		--青铜武林印之管理员邀请函
		elseif OnMission_1018819() then
		--青铜武林印之相助师门
		elseif OnMission_1018847() then
		--青铜武林印之除恶务尽
		elseif OnMission_1039814() then
		--青铜武林印之惩凶打图
		elseif OnMission_1018848() then
		--造反恶贼
		elseif OnMission_500604() then
		--剿灭反贼
		elseif OnMission_402061() then
		--试炼之所摩崖洞
		elseif OnMission_1018706() then
		--清剿摩崖洞
		elseif OnMission_10300501() then
		--秘密联络
		elseif OnMission_1030050() then
		--完美的灰熊皮
		elseif OnMission_1030051() then
		--狼害
		elseif OnMission_1000050() then
		--豹害
		elseif OnMission_1000051() then
]]--
		else
			nCheckTick = nCheckTick + 1
			if nCheckTick > 5 then 
				break
			else
				System:Sleep(1000)
				continue
			end
		end

		nCheckTick = 0 
		System:Sleep(1000)
	end
end

_SMain()