require("Necessary")
require("StoryUtility")
require("BigMap")

-------------以下为DLC07主线剧情函数----------
function DlcEnd()
	if getAurogon999() == 6 and getItemCount(4016) > 0 then
		task()
		.playMusic("P40.ogg",1,1,0,1,3)
		.changeScene("M18","M18-7","null","")
		.TusuShaqi(0)
		.taskPlaySequence("181400","M18")--另有音乐插入XFX
		.taskPlaySequence("181401","M18")
		.openLiaozhai(925)  --开启少恭第一形态的图鉴
		.openLiaozhai(926)  --开启少恭第二形态的图鉴
		.stopMusic(1.5, false)
		.taskPlayBink("END1.bik",true)
		.taskPlayBink("END2.bik",true)
		.taskPlayBink("END3.bik",true)
		.addObject(4016, -1)
		.SetMainStory(190001)                         --------接DLC07，现暂定接在原结局动画后面
		.changeScene("Q20", "Q20", "null", "")        --------接DLC07
	else
		task()
		.playMusic("P40.ogg",1,1,0,1,3)
		.changeScene("M18","M18-7","null","")
		.TusuShaqi(0)
		.taskPlaySequence("181400","M18")--另有音乐插入XFX
		.taskPlaySequence("181401","M18")
		.openLiaozhai(925)  --开启少恭第一形态的图鉴
		.openLiaozhai(926)  --开启少恭第二形态的图鉴
		.stopMusic(1.5, false)
		.taskPlayBink("END1.bik",true)
		.taskPlayBink("END2.bik",true)
		.taskPlayBink("END3.bik",true)
		.taskPlayBink("END4.bik",true)
		.taskDoPostScreen( 1 , 0 , 1)
		.passGame()
		.taskSave()
		.endGame(false)
	end
end

function aaaaa()
    callTaskFunction("story190001")
end

function bbbbb()
	enableUIMenu(2, false)
	enableUIMenu(3, false)
	--enableUIMenu(4, false)
	enableUIMenu(5, false)
	--enableUIMenu(6, false)
	--enableUIMenu(7, false)
	--enableUIMenu(8, false)
	enableTotem(false)
	enableCooking(false)

	setMiniMap("MQ024")

    callTaskFunction("story190100")
end

function DLC7LoadCompleteQ12D()
	log("DLC7LoadCompleteQ12D()")
	enableUIMenu(2, false)
	enableUIMenu(3, false)
	--enableUIMenu(4, false)
	enableUIMenu(5, false)
	--enableUIMenu(6, false)
	--enableUIMenu(7, false)
	--enableUIMenu(8, false)
	enableTotem(false)
	enableCooking(false)
end

function story190001()
	if GetMainStory() == 190001 then
		task()
		.playMusic("P54.ogg", 1, 3, 0, 1, 1)
		.playSWF("Dlc005_2.swf")
		.taskPlaySequence("190001", "Q20DLC7")       --字幕
		.stopSWF()
		.taskPlaySequence("190100", "Q20DLC7")
		.SetMainStory(190002)
		.taskPlaySequence("190101", "Q20DLC7")       --音乐在xfx
		.SetMainStory(190100)
		.changeScene("Q12D", "Q12D", "null", "")
	end
end

function story190100()
	if GetMainStory() == 190100 then
		task()
		.playMusic("P43.ogg",1,3,0,1,3)
		.taskPlaySequence("Q12DLCCAM", "Q12DDLC7")   --浏览镜头
		.taskDoPostScreen( 1 , 1.0 , 1)
		.taskPlaySequence("200100", "Q12DDLC7")
		.leaveTeam(101, false)
		.leaveTeam(102, false)
		.leaveTeam(103, false)
		.leaveTeam(104, false)
		.leaveTeam(105, false)
		.leaveTeam(106, false)
		.joinTeam(114, false)
		.playMusic("P39.ogg",1,3,0,1,3)
		.taskPlaySequence("200101", "Q12DDLC7")
		.SetMainStory(190200)
		.setPlayerPos(0.9460476, 19.65224, 3.762998)
		.setPlayerDir(159.7963)
		.taskDoPostScreen(1, 1.0, 1)
		.playMusic("P43.ogg",1,3,0,1,3)              --剧情结束后换场景音乐
		.setHUD(true)
		.setControl(true)
	end
end

function story190200()
	if GetMainStory() == 190200 then
		task()
		.setHUD(false)
		.taskPlaySequence("200201", "Q12DDLC7")
		.changeScene("Q12D", "Q12NQX", "null", "")
		.playMusic("P31.ogg",1,3,0,1,3)
		.taskPlaySequence("200202", "Q12DDLC7")      --换音乐在xfx
		.SetMainStory(190300)
		.changeScene("Q12D", "Q12D", "null", "")
		.playMusic("P89.ogg",1,3,0,1,3)
		.taskPlaySequence("200300", "Q12DDLC7")      --2C湖边
		.taskPlaySequence("200302", "Q12DDLC7")
		.taskPlaySequence("200303", "Q12DDLC7")
		.taskPlaySequence("200301", "Q12DDLC7")
		.playMusic("P43.ogg",1,3,0,1,3)
		.playSWF("Dlc005_1.swf")
		.taskPlaySequence("200304", "CGdlc")         --美术过场1
		.stopSWF()
        .SetMainStory(190400)
        .changeScene("Q12D", "Q12NQXY", "null", "")
        .stopMusic(1,false,1)                        --停播，静音
        .taskPlaySequence("200400", "Q12DDLC7")      --2D晴雪房间，焚寂，GW，音乐在xfx
        .changeScene("Q12D", "Q12DY", "null", "")
		.taskPlaySequence("200401", "Q12DDLC7")
		.stopMusic(1,false,1)
		.taskPlayBink("END5.bik",true)               --结局，OY，perfect end！
		.playSWF("Dlc005_end.swf")
		.taskPlaySequence("190002", "Q12DDLC7")      --桃花幻梦终
		.stopSWF()
		.stopMusic(1,false,1)
		.playSWF("THX.swf")
		.taskPlaySequence("190004", "Q12DDLC7")      --感谢
		.stopSWF()
		.taskPlayBink("END4.bik",true)
		.stopMusic(1,false,1)
		.playMusic("P125.ogg",1,3,0,1,3)
		.playSWF("end07.swf")
		.taskPlaySequence("190003", "Q12DDLC7")      --DLC制作人员名单
		.stopSWF()
		.stopMusic(1,false,1)
        .taskDoPostScreen(1, 0, 1)
		.addEffort(439, 1)
		.passGame()
		.taskSave()
		.endGame(false)
	end
end


------------------------------------------------------------------------
function OnDLCEnterLevelQ08(minor)
	if getAurogon999() == nil then
		setAurogon999(0)
	end

	if getAurogon999() == 0 and (minor == "Q08N06" or minor == "Q08N23") then
		sendMail(193)
		setAurogon999(1)
	end

	if GetMainStory() >= 180100 and (gValue.aurogon2005 == 0 or gValue.aurogon2005 == nil) then
		sendMail(201)
	end

	if gValue.aurogon2005 == 1 then
		showNPC("NPC 2049", false)
	else
		showNPC("NPC 2049", true)
	end

	log(minor)
	if minor == "Q08" then
		if gValue.showly == nil then
			gValue.showly = {}
			for i = 1, 10 do
				gValue.showly[i] = false
				local effName = string.format("zp %d", i)
				local objName = string.format("zp %da", i)
				showNPC(effName, false)
				showNPC(objName, false)
				setInquiryCount(objName, 0)
			end
		else
			for i = 1, 10 do
				if gValue.showly[i] == nil then
					gValue.showly[i] = false
				end
				local effName = string.format("zp %d", i)
				local objName = string.format("zp %da", i)
				showNPC(effName, gValue.showly[i])
				showNPC(objName, gValue.showly[i])
				if gValue.showly[i] then
					setInquiryCount(objName, 1)
				else
					setInquiryCount(objName, 0)
				end
			end
		end
	end

	if gValue.aurogon2052 == 3 or gValue.aurogon2052 == 4 then
		showNPC("NPC 2054", true)
	else
		showNPC("NPC 2054", false)
	end

	if GetMainStory() >= 150200 and GetMainStory() < 160400 then
		if gValue.aurogon2043 == 5 then
			showNPC("NPC 2047", true)
			showNPC("NPC 2043", true)
		else
			showNPC("NPC 2047", false)
			showNPC("NPC 2043", false)
		end
	else
		showNPC("NPC 2047", true)
		showNPC("NPC 2043", true)
	end

	if minor == "Q08N23" then
		if (gValue.aurogon2024 == 1 or gValue.aurogon2024 == 2) and GetMainStory() >= 150600 and GetMainStory() < 170302 then
			showNPC("NPC 2024", false)
			showNPC("NPC 2028", false)
		else
			showNPC("NPC 2024", true)
			showNPC("NPC 2028", true)
		end
	end

	if GetMainStory() >= 150600 and GetMainStory() < 160200 then
		showNPC("NPC 2010", false)
		showNPC("NPC 2051", false)
	else
		showNPC("NPC 2010", true)
		showNPC("NPC 2051", true)
	end
end

function OnDLC7EnterQ07(minor)
	if GetMainStory() == 130200 then
		log("setAurogon999(2)")
		setAurogon999(2)
	end
end

function OnDLC7EnterQ01(minor)
	if GetMainStory() == 130500 then
		--log("setAurogon999(3)")
		--setAurogon999(3)
	end
end

function DLC7EnterQ15(minor)
	if GetMainStory() == 170300 then
		log("setAurogon999(5)")
		setAurogon999(5)
	end
end

function addEffort438(id)
	log(getEffortPoint(id))
	if getEffortPoint(id) == 0 then
		addEffort(438, 1)
		addEffort(id, 1)
	end
end

function DLCClearQuest1065()
	-- local num = getEffortPoint(433)
	-- if num == 0 then
		-- addEffort(433, 1)
		-- addEffort(438, 1)
	-- end
end

---------白方几何-------------
function DLCQuest2041(npcName)
	if GetMainStory() >= 100102 then
		callTaskFunction("quest2041A")
	else
		npcDialogue(npcName)
	end
end

function quest2041A()
	if gValue.aurogon2041 == nil  then
		gValue.aurogon2041 = 0
	end

	if gValue.aurogon2041 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.rotToPlayer("NPC 2041")
		.taskDialogue("DlgQ08", 9300)		--悄悄告诉你哦，前两天路过某人的办公桌，上面摆满了小苏苏的外装，好美貌好美貌呀～本龙顺手牵来一件，嘻嘻，想要吗？$想要的话……嗯，本龙最爱苏酥甜心糕，拿一块来我就换给你～
		.taskSelectDialogue(30000, 75, 76)
		.callTaskFunction("Answer2041A")
	else
		npcDialogue("NPC 2041")
	end
end

function Answer2041A()
	local r = getSelectResult()
	if r == 1 then
		if getItemCount(4005) > 0 then
			task()
			.addObject(4005, -1)			--口水甜心糕
			.taskDialogue("DlgQ08", 9302)	--……勒个去，这是啥呀，好臭好臭，全是口水……呜……不和你玩了～（白方几何转身呕吐起来……外装掉在了地上……）
			.addObject(22063, 1)			--
			.taskDialogue("DlgQ08", 9303)	--苏苏，...............
			.setAurogon2041(1)
			.addEffort438(448)
			.msgBoxInTable(91, true)
			--.setAurogon999(0)
			.sendMail(195)
			.setHUD(true)
			.setControl(true)
		elseif getItemCount(1016) > 0 then
			task()
			.addObject(1016, -1)			--苏酥甜心糕
			.taskDialogue("DlgQ08", 9301)	--咦？甜心糕呢，在哪里在哪里？我什么都没看到呀～（白方几何迅速一抹嘴巴，眨眨大眼，眼神无辜又纯真……）
			.setHUD(true)
			.setControl(true)
		else
			task()
			.taskDialogue("DlgQ08", 93011)	--咦？甜心糕呢，在哪里在哪里？
			.setHUD(true)
			.setControl(true)
		end
	else
		--do nothing
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2041(v)
	gValue.aurogon2041 = v
end

--------------赝月---------------
function DLCClearQuest2502()
	gValue.aurogon2004 = 1
	--addEffort438(464)
end

function DLCQuest2004(npcName)
	if GetMainStory() >= 100102 then
		callTaskFunction("quest2004A")
	else
		npcDialogue(npcName)
	end
end

function quest2004A()
	if gValue.aurogon2004 == nil  then
		gValue.aurogon2004 = 0
	end

	if gValue.aurogon2004 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9304)	--我想给亲爱的师兄置办一件东西，它有性感的上半身、华丽的下半身，它有很多漂亮璀璨的装饰，据说它来自西域～～你能为我带来吗？
		.setAurogon2004(2)
		.setHUD(true)
		.setControl(true)
	elseif gValue.aurogon2004 == 2 then
		task().log(getItemCount(22055))
		if getItemCount(22055) > 0 then
			task()
			.setHUD(false)
			.setControl(false)
			.taskDialogue("DlgQ08", 9306)	--虽然不是白的，不过勉勉强强了……
			.addObject(22055, -1)
			.addObject(4005, 1)
			.setAurogon2004(3)
			.addEffort438(449)
			.msgBoxInTable(91, true)
			.setHUD(true)
			.setControl(true)
		else
			task()
			.taskDialogue("DlgQ08", 9305)	--嗯哼～还木有找到？
			.setHUD(true)
			.setControl(true)
		end
	else
		npcDialogue("NPC 2004")
	end
end

function setAurogon2004(v)
	gValue.aurogon2004 = v
end

--------------xiaoU---------
local npcid = 0
function DLCQuest2029(npcName)
	if npcName == "NPC 2029" then
		npcid = 0
	elseif npcName == "NPC 2036" then
		npcid = 1
	elseif npcName == "NPC 2056" then
		npcid = 2
	end

	if GetMainStory() >= 100100 and GetMainStory() < 120100 then
		callTaskFunction("quest2029A")
	else
		npcDialogue(npcName)
	end
end

function quest2029A()
	if gValue.aurogon2029 == nil  then
		gValue.aurogon2029 = 0
	end

	if gValue.aurogon2029 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9307 + npcid)--想开启隐藏结局吗？想和晴雪在一起吗？想知道苏苏和雪儿背后的八卦吗？想……嗯，我们的感情很淡吗？橙汁很甜吗？做好准备了吗？迎接挑战吧！！
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2029A")
	elseif gValue.aurogon2029 == 1 then
		task()
		.taskDialogue("DlgQ08", 9310 + npcid)--嗷～求妹纸，求洗白！其实我们真的不想为难你，要怪就怪企划部那群怪癖闷骚唧歪别扭坑爹木RP挚爱SM的混蛋……（以下略去100字）
		.setAurogon2029(2)
		.addEffort438(450)
		.msgBoxInTable(91, true)
		.setHUD(true)
		.setControl(true)
	else
		if npcid == 0 then
			npcDialogue("NPC 2029")
		elseif npcid == 1 then
			npcDialogue("NPC 2036")
		else
			npcDialogue("NPC 2056")
		end
	end
end

function Answer2029A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08","M10_3", 2029)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2029(v)
	gValue.aurogon2029 = v
end

function afterBattle2032()
	task()
	.taskDialogue("DlgQ08", 9317)--不错，小子还有些本事。那么寻找红玉姐姐画像的任务就拜托你啦！$……呃……嗯……如果你没找到，也可去天墉城问问那个卖武器的，他应该有……
	.setAurogon2032(2)
end

function DLCLeaveBattle(cfgID, result)
	setHUD(true)
	setControl(true)
	if cfgID == 2029 and result == 2 then
		setAurogon2029(1)
	end

	if cfgID == 2032 and result == 2 then
		setAurogon2032(1)
		--callTaskFunction("afterBattle2032")
	end

	if cfgID == 1075 and result == 2 then
		--setAurogon2040(1)
		--addObject(1013, 5)
	end

	if cfgID == 2031 and result == 2 then
		setAurogon2031(1)
	end

	if cfgID == 2042 and result == 2 then
		setAurogon7000(3)
		addObject(4014, 1)
	end

	if cfgID == 2010 and result == 2 then
		setAurogon7000(4)
	end

	if cfgID == 2026 and result == 2 then
		setAurogon2026(1)
	end

	if cfgID == 2005 and result == 2 then
		setAurogon2005(2)
		showNPC("NPC 2049", true)
	end

	if cfgID == 2002 and result == 2 then
		setAurogon2002(1)
		addEffort438(451)
		msgBoxInTable(91, true)
	end

	if cfgID == 20111 and result == 2 then
		setAurogon2011(1)
	end
	if cfgID == 20112 and result == 2 then
		setAurogon2011(2)
		sendMail(194)
	end
	if cfgID == 20113 and result == 2 then
		setAurogon2011(3)
		addEffort438(452)
		msgBoxInTable(91, true)
		addObject(1764, 5)
	end
end

----------喵喵--------------
function DLCQuest2052(npcName)
	if GetMainStory() >= 101200 and GetMainStory() < 130203 then
		callTaskFunction("quest2052A")
	else
		npcDialogue(npcName)
	end
end

function quest2052A()
	if gValue.aurogon2052 == nil  then
		gValue.aurogon2052 = 0
	end

	if GetMainStory() >= 110400 and gValue.aurogon2052 == 0 then
		npcDialogue("NPC 2052")
	else
		if gValue.aurogon2052 == 0 then
			task()
			.setHUD(false)
			.setControl(false)
			.taskDialogue("DlgQ08", 9313)--欸欸～我的好朋友橙是个特别贪玩的小孩，上次去海外一个叫啥洲的地方玩儿，说是很快就回来，这都一周了还不见人影。$好心的屠苏哥哥，如果以后你去了那叫啥洲的地儿，能帮我去找找吗？
			.taskSelectDialogue(84, 75, 76)
			.callTaskFunction("Answer2052A")
		elseif gValue.aurogon2052 == 1 or gValue.aurogon2052 == 2 then
			task()
			.taskDialogue("DlgQ08", 9314)--屠苏哥哥还没找到橙子吗？他在海外的什么洲哦～
		elseif gValue.aurogon2052 == 3 then
			task()
			.taskDialogue("DlgQ08", 9315)--橙子安全就好了！谢谢屠苏哥哥～
			.addObject(22061, 1)
			.setAurogon2052(4)
			.addEffort438(453)
			.msgBoxInTable(91, true)
		else
			npcDialogue("NPC 2052")
		end
	end
end

function Answer2052A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.setAurogon2052(1)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2052(v)
	gValue.aurogon2052 = v
end

----------橙--------------
function OnDLCEnterM141(minor)
	log(minor)
	if gValue.aurogon2052 == 1 then
		showNPC("NPC 2054", true)
		showNPC("NPC 2055", false)
	elseif gValue.aurogon2052 == 2 then
		showNPC("NPC 2054", false)
		showNPC("NPC 2055", true)
	else
		showNPC("NPC 2054", false)
		showNPC("NPC 2055", false)
	end
end

function DLCQuest2054(npcName)
	if GetMainStory() >= 120500 and GetMainStory() < 130100 then
		callTaskFunction("quest2054A")
	end
end

function quest2054A()
	if gValue.aurogon2052 == nil  then
		gValue.aurogon2052 = 0
	end

	if gValue.aurogon2052 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgM14", 3)--ZZZZZ……ZZZZZ……
		.taskSelectDialogue(30003, 30004, 30005)
		.callTaskFunction("Answer2054A")
	elseif gValue.aurogon2052 == 2 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgM14", 4)--啧……我认输，回商会就回商会吧！不过，哼哼～你吵醒我睡觉，多少赔偿一下我的精神损失呗？50000文，给是不给？
		.taskSelectDialogue(30006, 30007, 30008)
		.callTaskFunction("Answer2054B")
	else

	end
end

function Answer2054A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("M14", "M14P3","M14_2", 2054)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function DLCLeaveM14(cfgID, reason)
	--log(string.format("DLCLeaveM14(%d, %d)", cfgID, reason))
	if cfgID == 2054 and reason == 2 then
		setAurogon2052(2)
		showNPC("NPC 2054", false)
		showNPC("NPC 2055", true)
		setHUD(true)
		setControl(true)
	end
end

function Answer2054B()
	local r = getSelectResult()
	if r == 1 then
		task()
		.taskDialogue("DlgM14", 5)--(*^__^*) 嘻嘻～逗你玩儿的，还当真呐。好吧，你回去告诉喵喵我稍后就回。先还有点事，拜拜啦！
		.setAurogon2052(3)
		.setHUD(true)
		.setControl(true)
		.showNPC("NPC 2055", false)
		.showNPC("NPC 2054", false)
	else
		task()
		.taskDialogue("DlgM14", 6)--喵了个咪，真小器……不回不回就不回～（跺脚甩尾眼望天……）
		.setHUD(true)
		.setControl(true)
	end
end

------------三红---------------
function DLCQuest2032(npcName)
	if GetMainStory() >= 130100 then
		callTaskFunction("quest2032A")
	else
		npcDialogue(npcName)
	end
end

function quest2032A()
	if gValue.aurogon2032 == nil  then
		gValue.aurogon2032 = 0
	end

	if gValue.aurogon2032 == 0 then
		task()
		.taskDialogue("DlgQ08", 9316)--啊～真烦恼啊～竟然把红玉姐姐的画像弄丢了！这可是我千辛万苦从某人那里弄来的，小子可愿帮我寻找？$不过江湖险恶，待我试过你的斤两，才能放心将任务托付与你。接受挑战吧！
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2032A")
		--.enterBattle("Q08", "Q08", "M02_1", 2032)
	elseif gValue.aurogon2032 == 1 then
		task()
		.taskDialogue("DlgQ08", 9317)--不错，小子还有些本事。那么寻找红玉姐姐画像的任务就拜托你啦！$……呃……嗯……如果你没找到，也可去天墉城问问那个卖武器的，他应该有……
		.setAurogon2032(2)
	elseif gValue.aurogon2032 == 2 then
		task()
		.taskDialogue("DlgQ08", 9319)--红玉姐姐……呼呼呼呼……
	elseif gValue.aurogon2032 == 3 then
		if getItemCount(4007) > 0 then
			task()
			.taskDialogue("DlgQ08", 9320)--唔！就是这个～我的红玉姐姐呀！千万不要再离开我了TvT～
			.addObject(4007, -1)
			.setAurogon2032(4)
			.addEffort438(454)
			.msgBoxInTable(91, true)
			.setHUD(true)
			.setControl(true)
		else
			task()
			.taskDialogue("DlgQ08", 9319)--红玉姐姐……呼呼呼呼……
		end
	else
		npcDialogue("NPC 2032")
	end
end

function Answer2032A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M13_1", 2032)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2032(v)
	gValue.aurogon2032 = v
end

function DLCxieyunliu(npcName)
	callTaskFunction("quest2032B")
end

function quest2032B()
	task()
	.taskDialogue("DlgQ16", 162)--红玉的画像？（谢云流闭眼思考了片刻，终点了点头）好吧，看你乃红玉之友，我愿赠你一幅，不过需拿她的“焰云霞舞”来换……
	.taskSelectDialogue(31062, 75, 76)
	.callTaskFunction("Answer2032B")
end

function Answer2032B()
	local r = getSelectResult()
	if r == 1 then
		if getItemCount(22058) > 0 then
			task()
			.addObject(22058, -1)
			.addObject(4007, 1)
			.setAurogon2032(3)
			.setShopName("NPC 15", "Q16tie")
			.setHUD(true)
			.setControl(true)
		else
			task()
			.taskSystemDialogue(31063)
			.setHUD(true)
			.setControl(true)
		end
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function DLC7EnterQ16(minor)
	if gValue.aurogon2032 == 2 then

	else
		setShopName("NPC 15", "Q16tie")
	end
end

-----------鲸-------------
function setAurogon2025(v)
	gValue.aurogon2025 = v
end

function DLCClearQuest2025()
	setAurogon2025(1)
	addEffort438(466)
end

-----------果冻----------
function DLCQuest2040(npcName)
	npcDialogue(npcName)
--[[
	if GetMainStory() >= 130400 and GetMainStory() < 170500 then
		callTaskFunction("quest2040A")
	else
		npcDialogue(npcName)
	end
--]]
end

function DLCClearQuest2040()
	log("DLCClearQuest2040")
	--setAurogon2040(1)
	addEffort438(465)
end
--[[
function quest2040A()
	if gValue.aurogon2040 == nil  then
		gValue.aurogon2040 = 0
	end

	if gValue.aurogon2040 == 0 then
		task()
		.taskDialogue("DlgQ08", 9360)
		.enterBattle("Q08", "Q08","M13_1", 2040)
	elseif gValue.aurogon2040 == 1 then
		task()
		.taskDialogue("DlgQ08", 9361)--
		.addObject(1013, 5)
		.setAurogon2040(2)
	else
		npcDialogue("NPC 2040")
	end
end
--]]
function setAurogon2040(v)
	gValue.aurogon2040 = v
end

-----------花椒不麻---------
function DLCQuest2031(npcName)
	if GetMainStory() >= 130500 and GetMainStory() < 170500 then
		callTaskFunction("quest2031A")
	else
		npcDialogue(npcName)
	end
end

function quest2031A()
	if gValue.aurogon2031 == nil  then
		gValue.aurogon2031 = 0
	end

	if gValue.aurogon2031 == 0 then
		task()
		.taskDialogue("DlgQ08", 9321)--最近忙着准备英语考试已经要崩溃啦……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2031A")
		--.enterBattle("Q08", "Q08","M02_1", 2031)
	elseif gValue.aurogon2031 == 1 then
		task()
		.taskDialogue("DlgQ08", 9322)--感谢少侠救我于水火，现在我终于神志清醒啦～这次英语考试我一定会过的。握拳！！
		.setAurogon2031(2)
		.addEffort438(455)
		.msgBoxInTable(91, true)
		.addObject(1411, 1)
		.addObject(1412, 1)
		.addObject(1413, 1)
		.addObject(1414, 1)
		.addObject(1415, 1)
	else
		npcDialogue("NPC 2031")
	end
end

function Answer2031A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M13_1", 2031)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2031(v)
	gValue.aurogon2031 = v
end

----------豆腐---------
function DLCQuest2053(npcName)
	if GetMainStory() >= 130500 and GetMainStory() < 170500 then
		callTaskFunction("quest2053A")
	else
		npcDialogue(npcName)
	end
end

function quest2053A()
	if gValue.aurogon2053 == nil  then
		gValue.aurogon2053 = 0
	end

	if gValue.aurogon2053 == 0 then
		task()
		.taskDialogue("DlgQ08", 9324)--嘤嘤……屠苏哥哥，刚刚我在外面玩，不小心跌了一跤，贴身藏着的陵越哥哥的画像全都掉了出来，被风吹跑了……内牛，我的画像，我的宝贝画像啊……屠苏哥哥，你能帮豆腐把画像找回来吗？
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2053A")
	elseif gValue.aurogon2053 == 1 then
		task()
		.taskDialogue("DlgQ08", 9325)--嘤嘤嘤嘤嘤嘤嘤嘤……只有陵越哥哥能安慰我受伤的心灵T-T
	elseif gValue.aurogon2053 == 4 then
		if getItemCount(4008) >= 10 then
			task()
			.taskDialogue("DlgQ08", 9326)--……咦，照片找齐啦！谢谢屠苏哥哥，这下豆腐又有画【哔——】的动力了！
			.addObject(4008, -10)
			.addObject(4009, 1)
			.setAurogon2053(5)
			.addEffort438(456)
			.msgBoxInTable(91, true)
		else
			task()
			.taskDialogue("DlgQ08", 9325)--嘤嘤嘤嘤嘤嘤嘤嘤……只有陵越哥哥能安慰我受伤的心灵T-T
		end
	elseif gValue.aurogon2053 == 2 or gValue.aurogon2053 == 3 then
		task()
		.taskDialogue("DlgQ08", 9327)--陵越哥哥的画像……画像……屠苏哥哥你没有找齐对吧？！呜呜呜……一定是被哪个混蛋捡去了，商会里一直有人对陵越哥哥别有用心！屠苏哥哥，你能找到那个人帮我要回画像吗？
	else
		npcDialogue("NPC 2053")
	end
end

function Answer2053A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.startTiming(10*60, "timeOver2053", false)
		.resetPicly()
		.setAurogon2053(1)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function resetPicly()
	log("resetPicly1")
	gValue.showly = {}
	gValue.showly[1] = true
	gValue.showly[2] = true
	gValue.showly[3] = true
	gValue.showly[4] = true
	gValue.showly[5] = true
	gValue.showly[6] = true
	gValue.showly[7] = true
	gValue.showly[8] = true
	gValue.showly[9] = true
	gValue.showly[10] = true
	log("for")
	for i = 1, 10 do
		log(gValue.showly[i])
	end
	log("for end")
end

function DLC7LeaveQ08()
	if gValue.aurogon2053 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.setPlayerInitPos("StartPoint 01")
		.taskPlayerMove("StartPoint 01", 1.5 , 0)
		.taskSystemDialogue(153)
		.setHUD(true)
		.setControl(true)
	else
		if GetMainStory() >= 90100 then		--bimap opened
			task()
			.taskSelectDialogue( 14 , 15 , 16 )
			.NeedACoin()
		end
	end
end

function timeOver2053()
	log("timeOver2053")
	setAurogon2053(2)
	for i = 1, 10 do
		gValue.showly[i] = false
	end

	if getMinor() == "Q08" then
		for i = 1, 10 do
			local effName = string.format("zp %d", i)
			local objName = string.format("zp %da", i)
			showNPC(effName, false)
			showNPC(objName, false)
			setInquiryCount(objName, 0)
		end
	end
end

function setAurogon2053(v)
	gValue.aurogon2053 = v
end

function DLCpickly(id)
	log(id)
	gValue.showly[id] = false
	local effName = string.format("zp %d", id)
	local objName = string.format("zp %da", id)
	log(effName)
	log(objName)
	showNPC(effName, false)
	showNPC(objName, false)
	setInquiryCount(objName, 0)
	addObject(4008, 1)

	local pickAll = true
	for i = 1, 10 do
		if gValue.showly[i] == true then
			pickAll = false
		end
	end
	if pickAll then
		stopTiming()
		setAurogon2053(4)
	end
end

function quest2010B()
	if gValue.aurogon2053 == nil  then
		gValue.aurogon2053 = 0
	end

	if gValue.aurogon2053 == 2 or gValue.aurogon2053 == 3 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9328)--想要大师兄的画像么？想吗想吗？拿好吃的来换呀～$嗯……想想……我也要吃苏酥甜心糕～要50块！
		.setAurogon2053(3)
		.taskSelectDialogue(31060, 75, 76)
		.callTaskFunction("Answer2010B")
	else
		npcDialogue("NPC 2010")
	end
end

function Answer2010B()
	local r = getSelectResult()
	if r == 1 then
		if getItemCount(1016) >= 50 then
			task()
			.addObject(1016, -50)
			.givePicly()
			.setAurogon2053(4)
			.setHUD(true)
			.setControl(true)
		else
			task()
			.taskSystemDialogue(31061)
			.setHUD(true)
			.setControl(true)
		end
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function givePicly()
	local num = 10 - getItemCount(4008)
	if num > 0 and num <= 10 then
		addObject(4008, num)
	end
end


-----------------------------
function setAurogon2039(v)
	gValue.aurogon2039 = v
end

function DLCClearQuest2039()
	setAurogon2039(1)
	local num = getEffortPoint(434)
	if num == 0 then
		addEffort(434, 1)
		addEffort(438, 1)
	end

	num = getEffortPoint(482)
	if num == 0 then
		addEffort(480, 1)
		addEffort(482, 1)
	end
end

function DLC7EnterQ02(minor)

    if GetMainStory() == 150200  then
		sendMail(212)
	end

	if GetMainStory() == 150200  then
		sendMail(213)
	end

	if GetMainStory() == 150200 then
		log("setAurogon999(3)")
		setAurogon999(3)
	end
	if minor == "Q02N11" then
		if GetMainStory() >= 150200 and GetMainStory() < 160400 then
			if GetMainStory() > 150400 then
				if gValue.aurogon2043 == nil or gValue.aurogon2043 == 0 or gValue.aurogon2043 == 5 then
					showNPC("NPC 2043", false)
					showNPC("NPC 2055", false)
				else
					showNPC("NPC 2043", true)
					showNPC("NPC 2055", true)
				end
			else
				if gValue.aurogon2043 == 5 then
					showNPC("NPC 2043", false)
					showNPC("NPC 2055", false)
				else
					showNPC("NPC 2043", true)
					showNPC("NPC 2055", true)
				end
			end
		else
			showNPC("NPC 2043", false)
			showNPC("NPC 2055", false)
		end
	end
end
----------xThrall-------------
function DLCQuest2055(npcName)
	if GetMainStory() >= 150200 and GetMainStory() < 160400 then
		callTaskFunction("quest2055A")
	else
		--npcDialogue(npcName)
	end
end

function quest2055A()
	if gValue.aurogon2043 == nil  then
		gValue.aurogon2043 = 0
	end

	if gValue.aurogon2043 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ02", 7042)--天下最最乐于助人的百里少侠……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2055A")
	elseif gValue.aurogon2043 == 1 or gValue.aurogon2043 == 2 or gValue.aurogon2043 == 3 then
		task()
		.taskDialogue("DlgQ02", 7045)--快去快回哦！
	elseif gValue.aurogon2043 == 4 then
		if getItemCount(4010) > 0 and getItemCount(4011) > 0 then
			task()
			.addObject(4010, -1)
			.addObject(4011, -1)
			.taskDialogue("DlgQ02", 7048)--谢谢少侠，感激不尽！xThrall有救啦！
			.setAurogon2043(5)
			.addEffort438(457)
			.msgBoxInTable(91, true)
			.addEffort(435, 1)
		else
			task()
			.taskDialogue("DlgQ02", 7045)--快去快回哦！
		end
	else
		task()
		.taskDialogue("DlgQ02", 7048)--谢谢少侠，感激不尽！xThrall有救啦！
	end
end

function Answer2055A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.taskDialogue("DlgQ02", 7045)--快去快回哦！
		.setAurogon2043(1)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2043(v)
	gValue.aurogon2043 = v
end

function DLCQuest2043(npcName)
	if GetMainStory() >= 150200 and GetMainStory() < 160400 then
		callTaskFunction("quest2043A")
	else
		npcDialogue(npcName)
	end
end

function quest2043A()
	if gValue.aurogon2043 == nil  then
		gValue.aurogon2043 = 0
	end

	if gValue.aurogon2043 == 5 then
		task()
		.taskDialogue("DlgQ02", 7049)--唔……谢谢……以后我再也不乱吃东西了……
	else
		task()
		.taskDialogue("DlgQ02", 7043)--呜呜呜呜……（躺床上哼哼唧唧）
	end
end

function DLCQuest2022(npcName)
	if GetMainStory() >= 150200 and GetMainStory() < 160400 then
		callTaskFunction("quest2022A")
	else
		npcDialogue(npcName)
	end
end

function quest2022A()
	if gValue.aurogon2043 == nil  then
		gValue.aurogon2043 = 0
	end

	if gValue.aurogon2043 == 1 then
		task()
		.taskDialogue("DlgQ08", 9329)--是吗？xThrall生病了？我想想……嗯，我这里确实有一种药能治百病，叫“嘛花嘛花哄”。$不过前两天去咕噜湾，貌似丢在那了……百里少侠，你能去咕噜湾帮我把药找回吗？
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2022A")
	elseif gValue.aurogon2043 == 2 then
		task()
		.taskDialogue("DlgQ08", 9330)--我前几天去了趟咕噜湾，回来就找不见“嘛花嘛花哄”了，可能丢在那里了吧……
	elseif gValue.aurogon2043 == 3 then
		task()
		.taskDialogue("DlgQ08", 9331)--对对，这就是“嘛花嘛花哄”！少侠，我再送你“菊花菊花哄”。让xThrall把两种药一起吃下，效果更好！快些去吧～
		.addObject(4010, 1)
		.setAurogon2043(4)
	else
		npcDialogue("NPC 2022")
	end
end

function Answer2022A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.setAurogon2043(2)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function DLCtrigger2022()
	enterBattle("M11", "M11P1", "M11_1", 2022)
end

function DLCLeaveM11(cfgID, result)
	if cfgID == 2022 and result == 2 then
		setAurogon2043(3)
		addObject(4011, 1)
		showNPC("mahua 01", false)
		showNPC("mahua 01-1", false)
		setInquiryCount("mahua 01", 0)
	end
end

------------------xx------------
function setAurogon2024(v)
	gValue.aurogon2024 = v
end

function DLCSendMail199()
	if gValue.aurogon2024 == 1 then
		sendMail(199)
	end
end

function DLC7CheckMail()
	if gValue.aurogon2024 == 2 then
		sendMail(203)
	end
end

function DLCcheckNote2024()
	if GetMainStory() >= 150600 and GetMainStory() < 160300 then
		callTaskFunction("quest2024A")
	end
end

function quest2024A()
	if gValue.aurogon2024 == 1 then
		task()
		.taskSystemDialogue(30009)
		.setAurogon2024(2)
		.setInquiryCount("zhitiao 01", 0)
		.showNPC("zhitiao 01", false)
		.showNPC("zhitiao 01-1", false)
		.setHUD(true)
		.setControl(true)
	elseif gValue.aurogon2024 == 2 then
		task()
		.taskDialogue("DlgM06", 9334)--少侠你终于来啦，不愧是瓜看中的人！哦呵呵呵呵！准备好了吗？好了就戳旁边的叉叉！
	elseif gValue.aurogon2024 == 3 then
		task()
		.taskDialogue("DlgM06", 9336)--真男人！瓜爷爱！
	end
end

function DLCQuest2024(npcName)
	if GetMainStory() >= 150600 and GetMainStory() < 170302 then
		callTaskFunction("quest2024A")
	end
end

function DLCQuest2028(npcName)
	if GetMainStory() >= 150600 and GetMainStory() < 170302 then
		callTaskFunction("quest2028A")
	end
end

function quest2028A()
	if gValue.aurogon2024 == 2 then
		task()
		.taskDialogue("DlgM06", 9335)--……再点我就把你叉掉！
		.enterBattle("M06", "M06P1", "M06_1", 2024)
	elseif gValue.aurogon2024 == 3 then
		task()
		.taskDialogue("DlgM06", 9337)--有了鸡血的新梗，你懂的！
	end
end

function DLCLeaveM06_1(cfgID, result)
	if cfgID == 2024 and result == 2 then
		setAurogon2024(3)
		addEffort438(458)
		msgBoxInTable(91, true)
		addObject(4012, 1)
		addObject(4013, 1)
		sendMail(200)
	end
end

function DLC7EnterM06(minor)
	if minor == "M06P2" then
		if GetMainStory() >= 150600 and GetMainStory() < 160300 then
			showNPC("NPC 2024", false)
			showNPC("NPC 2028", false)

			if gValue.aurogon2024 == 1 then
				showNPC("zhitiao 01", true)
				showNPC("zhitiao 01-1", true)
				setInquiryCount("zhitiao 01", 1)
			else
				showNPC("zhitiao 01", false)
				showNPC("zhitiao 01-1", false)
				setInquiryCount("zhitiao 01", 0)
			end
		elseif GetMainStory() >= 160300 and GetMainStory() < 170302 then
			showNPC("zhitiao 01", false)
			showNPC("zhitiao 01-1", false)
			setInquiryCount("zhitiao 01", 0)

			if gValue.aurogon2024 == 2 then
				showNPC("NPC 2024", true)
				showNPC("NPC 2028", true)
			else
				showNPC("NPC 2024", false)
				showNPC("NPC 2028", false)
			end
		else
			showNPC("zhitiao 01", false)
			showNPC("zhitiao 01-1", false)
			setInquiryCount("zhitiao 01", 0)
			showNPC("NPC 2024", false)
			showNPC("NPC 2028", false)
		end
	end
end

-------------蘑尼拔斯基----------
function DLCQuest7000(npcName)
	if GetMainStory() >= 150600 and GetMainStory() < 160200 then
		callTaskFunction("quest7000A")
	end
end

function DLCQuest7001(npcName)
	if GetMainStory() >= 150600 and GetMainStory() < 160200 then
		callTaskFunction("quest7000A")
	end
end

function quest7000A()
	if gValue.aurogon7000 == nil then
		gValue.aurogon7000 = 0
	end

	if gValue.aurogon7000 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ05", 9051)--嘻嘻嘻，要领任务咩？虽然你的眼神诚实又天真，但是～命运不是那么好改滴…
		.taskDialogue("DlgQ05", 9052)--孤魂双剑的红肚兜呀，传闻似是董广号的云飞哥哥亲手绣的，可是不知什么原因，只绣到了一半……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer7000A")
	elseif gValue.aurogon7000 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ05", 9053)--蕾丝～花边～高开叉……总感觉这句话大有深意呀 >_<……
		.taskDialogue("DlgQ05", 9054)--木有肚兜木有奇迹，自己考虑呦～
		.setHUD(true)
		.setControl(true)
	else
	end
end

function Answer7000A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.setAurogon7000(1)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon7000(v)
	gValue.aurogon7000 = v
end

function DLC7EnterQ05(minor)
	if GetMainStory() == 150600 then
		setAurogon999(4)
	end

	if GetMainStory() >= 150600 and (gValue.aurogon2024 == 0 or gValue.aurogon2024 == nil) then
		sendMail(199)
	end

	if minor == "Q05HY" then
		if GetMainStory() >= 150600 and GetMainStory() < 160200 then
			showNPC("NPC 7000", true)
			showNPC("NPC 7001", true)
		else
			showNPC("NPC 7000", false)
			showNPC("NPC 7001", false)
		end
	end
end

function DLCQuest2010(npcName)
	if GetMainStory() >= 180100 and GetMainStory() < 180600 then
		callTaskFunction("quest2010A")
	elseif GetMainStory() >= 130400 and GetMainStory() < 170500 then
		callTaskFunction("quest2010B")
	else
		npcDialogue(npcName)
	end
end

function quest2010A()
	if gValue.aurogon7000 == 3 then
		if getItemCount(4014) > 0 then
			task()
			.setHUD(false)
			.setControl(false)
			.taskDialogue("DlgQ05", 9056)--嗯，是这条没错！
			.taskDialogue("DlgQ05", 9058)--嗷呜，其实呐，我们真的不想为难你，可是师兄之命不可违，战斗不可避免……做好准备了吗？$要是连6回合也撑不过，天机啊命运啊可就浮云了呦～
			.addObject(4014, -1)
			.enterBattle("Q08", "Q08", "M02_1", 2010)
		else
			npcDialogue("NPC 2010")
		end
	elseif gValue.aurogon7000 == 4 then
		task()
		.taskDialogue("DlgQ05", 9060)--(*^__^*) 嘻嘻……你表现得挺好嘛！作为鼓励，送你几串糖葫芦～这可是我们的压箱宝呀，记得要吃哦！
		.addObject(1727, 50)
		.addObject(1756, 50)
		.sendMail(196)
		.sendMail(197)
		.setAurogon7000(5)
		.addEffort438(459)
		.msgBoxInTable(91, true)
	else
		npcDialogue("NPC 2010")
	end
end

function DLCQuest2051(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2051A")
	else
		npcDialogue(npcName)
	end
end

function quest2051A()
	log(gValue.aurogon7000)
	if gValue.aurogon7000 == 3 then
		if getItemCount(4014) > 0 then
			task()
			.setHUD(false)
			.setControl(false)
			.taskDialogue("DlgQ05", 9055)--你的肚兜，我收下了。
			.taskDialogue("DlgQ05", 9057)--呵呵呵呵呵……虽然我深深觉得，虐你不如虐老板来得赏心悦目，可惜师兄之命不可违～来来来，6回合内见分晓……
			.addObject(4014, -1)
			.enterBattle("Q08", "Q08", "M02_1", 2010)
		else
			npcDialogue("NPC 2051")
		end
	elseif gValue.aurogon7000 == 4 then
		task()
		.taskDialogue("DlgQ05", 9059)--呵呵呵呵，奖品请拿好……话说回来，焦冥手办、人骨风铃这类东西，什么时候才能作为周边发售呢……
		.addObject(1727, 50)
		.addObject(1756, 50)
		.sendMail(196)
		.sendMail(197)
		.setAurogon7000(5)
		.addEffort438(459)
		.msgBoxInTable(91, true)
	else
		npcDialogue("NPC 2051")
	end
end

----------杉木----------
function DLCQuest2023(npcName)
	if GetMainStory() >= 170300 and gValue.aurogon2023 == 1 then
		callTaskFunction("quest2023A")
	else
		npcDialogue(npcName)
	end
end

function DLCClearQuest2023()
	setAurogon2023(1)
	local num = getEffortPoint(436)
	if num == 0 then
		addEffort(436, 1)
		addEffort(438, 1)
	end
end

function setAurogon2023(v)
	gValue.aurogon2023 = v
end

function quest2023A()
	task()
	.taskDialogue("DlgQ08", 9358)--少侠果然心志坚毅，一往无前正是我辈人应有之精神。经过试炼，相信少侠又有不少领悟。前路漫漫，望君珍重。
	.setAurogon2023(2)
end

function DLCQuest2030(npcName)
	if GetMainStory() >= 170300 and gValue.aurogon2023 == 1 then
		callTaskFunction("quest2030A")
	else
		npcDialogue(npcName)
	end
end

function quest2030A()
	task()
	.taskDialogue("DlgQ08", 9359)--少侠果然心志坚毅，一往无前正是我辈人应有之精神。经过试炼，相信少侠又有不少领悟。前路漫漫，望君珍重。
	.setAurogon2023(2)
end

----------------cjk--------------
function DLCQuest2042(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2042A")
	else
		npcDialogue(npcName)
	end
end

function quest2042A()
	if gValue.aurogon7000 == nil then
		gValue.aurogon7000 = 0
	end

	if gValue.aurogon7000 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9360)--最近咱和老K要去参加一场50人的coser联欢会……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2042A")
	elseif gValue.aurogon7000 == 3 then
		task()
		.taskDialogue("DlgQ08", 9361)--
		--.addObject(22060, 1)
		--.setAurogon7000(3)
	else
		npcDialogue("NPC 2042")
	end
end

function Answer2042A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M02_1", 2042)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2042(v)
	gValue.aurogon2042 = v
end

-------------寸身言-------------
function DLCQuest2026(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2026A")
	else
		npcDialogue(npcName)
	end
end

function quest2026A()
	if gValue.aurogon2026 == nil then
		gValue.aurogon2026 = 0
	end

	if gValue.aurogon2026 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9332)--靓仔，看你骨骼精奇，乃是万中无一的武学奇才……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2026A")
	elseif gValue.aurogon2026 == 1 then
		task()
		.taskDialogue("DlgQ08", 9333)--靓仔，本小龙偷师紫胤真人下山后未逢敌手！虽然本小龙只用了一成功力，但已经看到了你内裤……
		.addObject(4015, 1)
		.sendMail(198)
		.setAurogon2026(2)
		.addEffort438(460)
		.msgBoxInTable(91, true)
	else
		npcDialogue("NPC 2026")
	end
end

function Answer2026A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M02_1", 2026)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function setAurogon2026(v)
	gValue.aurogon2026 = v
end

----------lulu---------
function setAurogon2005(v)
	gValue.aurogon2005 = v
end

function DLC7ComeFromCombatQ08(minor, reason)
	--log(string.format("DLC7ComeFromCombatQ08(%s, %d)"), minor, reason)
end

function DLCQuest2005(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2005A")
	else
		npcDialogue(npcName)
	end
end

function give4016()
	if getItemCount(4016) < 1 then
		addObject(4016, 1)
	end
	gValue.has4016 = true
end

function quest2005A()
	if gValue.aurogon2005 == nil then
		gValue.aurogon2005 = 0
	end

	if gValue.aurogon2005 == 1 then
		task()
		.taskDialogue("DlgQ08", 9334)--……是吗，它终于想起了以前的事？$……
		.enterBattle("Q08", "Q08", "M08_5", 2005)
	elseif gValue.aurogon2005 == 2 then
		task()
		.taskDialogue("DlgQ08", 9335)--大狗乖，别再离家出走了，我给你买最好的狗粮，每天带你散步，你不喜欢项圈就不戴吧，不洗澡我也不会勉强……
		.setAurogon2005(3)
		.addEffort438(461)
		.msgBoxInTable(91, true)
		.sendMail(202)
	else
		if getAurogon999() == 6 and gValue.has4016 ~= true then
			task()
			.taskDialogue("DlgQ08", 9337)--酒拿去，别多问，我什么都不知道……
			--.addObject(4016, 1)
			.give4016()
			.msgBoxInTable(31058, true)
			.msgBoxInTable(31059, true)
			--.setAurogon999(1)
		else
			npcDialogue("NPC 2005")
		end
	end
end

function DLCQuest2049(npcName)
	if GetMainStory() >= 180100 and GetMainStory() < 180600 then
		callTaskFunction("quest2049A")
	else
		npcDialogue(npcName)
	end
end

function quest2049A()
	if gValue.aurogon2005 == 2 then
		task()
		.taskDialogue("DlgQ08", 9336)--……………………………………………………
	else
		npcDialogue("NPC 2049")
	end
end

function checkAurogon()
	log(gValue.aurogon2041)
	log(gValue.aurogon2004)
	log(gValue.aurogon2029)
	log(gValue.aurogon2052)
	log(gValue.aurogon2032)
	log(gValue.aurogon2031)
	log(gValue.aurogon2053)
	log(gValue.aurogon2043)
	log(gValue.aurogon2024)
	log(gValue.aurogon7000)
	log(gValue.aurogon2026)
	log(gValue.aurogon2005)
	log(gValue.aurogon2002)
	log(gValue.aurogon2011)
	log(gValue.aurogon2000)
	log(isQuestClear(1065))
	log(isQuestClear(1066))
	log(isQuestClear(1074))
	log(isQuestClear(1075))
	log(isQuestClear(1076))
	log(isQuestClear(1083))
	log(isQuestClear(1084))
	if gValue.aurogon2041 == 1 and
		gValue.aurogon2004 == 3 and
		gValue.aurogon2029 == 2 and
		gValue.aurogon2052 == 4 and
		gValue.aurogon2032 == 4 and
		gValue.aurogon2031 == 2 and
		gValue.aurogon2053 == 5 and
		gValue.aurogon2043 == 5 and
		gValue.aurogon2024 == 3 and
		gValue.aurogon7000 == 5 and
		gValue.aurogon2026 == 2 and
		gValue.aurogon2005 == 3 and
		gValue.aurogon2002 == 1 and
		gValue.aurogon2011 == 3 and
		--gValue.aurogon2000 == 2 and
		isQuestClear(1065) and
		isQuestClear(1066) and
		isQuestClear(1074) and
		isQuestClear(1075) and
		isQuestClear(1076) and
		isQuestClear(1083) and
		isQuestClear(1084) then
		return true
	else
		return false
	end
end

----------御前带两把刀----------
function DLCQuest2002(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2002A")
	else
		npcDialogue(npcName)
	end
end

function quest2002A()
	if gValue.aurogon2002 == nil then
		gValue.aurogon2002 = 0
	end

	if gValue.aurogon2002 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9338)--常在江湖飘，怎能不答题～你准备好了吗？
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2002A")
	else
		npcDialogue("NPC 2002")
	end
end

function Answer2002A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.taskDialogue("DlgQ08", 9339)--1、古剑发布了几期DLC剧情？
		.taskSelectDialogue(7647, 30010, 30011, 30012)
		.callTaskFunction("Answer2002B")
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function Answer2002B()
	local r = getSelectResult()
	if r == 2 then
		task()
		.taskDialogue("DlgQ08", 9340)--2、第二期剧情DLC的名称是……？
		.taskSelectDialogue(7647, 30013, 30014, 30015)
		.callTaskFunction("Answer2002C")
	else
		task()
		.taskDialogue("DlgQ08", 9348)--哼哼，你的爱还不够！接受惩罚吧！
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002C()
	local r = getSelectResult()
	if r == 3 then
		task()
		.taskDialogue("DlgQ08", 9341)--3、陵端的外号是……？
		.taskSelectDialogue(7647, 30016, 30017, 30018)
		.callTaskFunction("Answer2002D")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002D()
	local r = getSelectResult()
	if r == 2 then
		task()
		.taskDialogue("DlgQ08", 9342)--4、古剑的城镇和迷宫一共有几个
		.taskSelectDialogue(7647, 30019, 30020, 30021)
		.callTaskFunction("Answer2002E")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002E()
	local r = getSelectResult()
	if r == 2 then
		task()
		.taskDialogue("DlgQ08", 9343)--5、青龙镇是现在的神马地方
		.taskSelectDialogue(7647, 30022, 30023, 30024)
		.callTaskFunction("Answer2002F")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002F()
	local r = getSelectResult()
	if r == 2 then
		task()
		.taskDialogue("DlgQ08", 9344)--6、古剑中最帅的角色是……？
		.taskSelectDialogue(7647, 30025, 30026, 30027)
		.callTaskFunction("Answer2002G")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002G()
	local r = getSelectResult()
	if r == 3 then
		task()
		.taskDialogue("DlgQ08", 9345)--7、龙宝宝的内衣是神马颜色？
		.taskSelectDialogue(7647, 30028, 30029, 30030)
		.callTaskFunction("Answer2002H")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002H()
	local r = getSelectResult()
	if r == 3 then
		task()
		.taskDialogue("DlgQ08", 9346)--8、龙宝宝喜欢吃神马？
		.taskSelectDialogue(7647, 30031, 30032, 30033, 30034)
		.callTaskFunction("Answer2002I")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002I()
	local r = getSelectResult()
	if r == 2 then
		task()
		.taskDialogue("DlgQ08", 9347)--9、龙宝宝是……
		.taskSelectDialogue(7647, 30035, 30036, 30037, 30038)
		.callTaskFunction("Answer2002J")
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function Answer2002J()
	local r = getSelectResult()
	if r == 4 then
		task()
		.taskDialogue("DlgQ08", 9349)--我眼光不错，你很有KUSO的潜质……我这边的任务完结了，祝你在古剑的世界中玩得愉快～
		.setAurogon2002(1)
		.addEffort438(451)
		.msgBoxInTable(91, true)
		.setHUD(true)
		.setControl(true)
	else
		task()
		.taskDialogue("DlgQ08", 9348)
		.enterBattle("Q08", "Q08", "M02_1", 2002)
	end
end

function setAurogon2002(v)
	gValue.aurogon2002 = v
end

--------------胃妖-------------
function DLCQuest2011(npcName)
	log("DLCQuest2011")
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2011A")
	else
		npcDialogue(npcName)
	end
end

function setAurogon2011(v)
	gValue.aurogon2011 = v
end

function quest2011A()
	if gValue.aurogon2011 == nil then
		gValue.aurogon2011 = 0
	end

	if gValue.aurogon2011 == 0 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9351)--家里的那位突然跑去种地了，没人煮饭吃，饿……家猫露娜爆走了，还撺掇了隔壁的波波，囧……少侠能帮我找回它们吗，在阿树没有发现之前……
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2011A")
	elseif gValue.aurogon2011 == 1 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9352)--谢谢少侠找回了猫猫，但是没有人煮饭吃真的非常饿……我和露娜想吃水煮鱼～少侠能帮我再打些鱼来吗？
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2011B")
	elseif gValue.aurogon2011 == 2 then
		task()
		.setHUD(false)
		.setControl(false)
		.taskDialogue("DlgQ08", 9353)--你真是好人，嘻嘻～我肚子好饱哦，我们来运动运动吧XD～赢了我会送你一个宝贝哦。
		.taskSelectDialogue(84, 75, 76)
		.callTaskFunction("Answer2011C")
	--elseif gValue.aurogon2011 == 3 then

	else
		npcDialogue("NPC 2011")
	end
end

function Answer2011A()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M02_1", 20111)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function Answer2011B()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M02_1", 20112)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

function Answer2011C()
	local r = getSelectResult()
	if r == 1 then
		task()
		.enterBattle("Q08", "Q08", "M02_1", 20113)
	else
		task()
		.setHUD(true)
		.setControl(true)
	end
end

---------------树--------------
function DLCQuest2000(npcName)
	if GetMainStory() >= 180100 then
		callTaskFunction("quest2000A")
	else
		npcDialogue(npcName)
	end
end

function DLCClearQuest2000()
	if gValue.aurogon2000 == 0 or gValue.aurogon2000 == nil then
		setAurogon2000(1)
	end
end

function set4016()
	gValue.has4016 = false
end

function quest2000A()
	if gValue.aurogon2000 == nil then
		gValue.aurogon2000 = 0
	end

	if gValue.aurogon2000 == 1 then
		if checkAurogon() then
			task()
			.taskDialogue("DlgQ08", 9355)--百里少侠，此去千山万水拦路，愿君逢凶化吉、求仁得仁……LuLu已备下薄酒一坛，对少侠或有助益，请少侠前去领取。
			.set4016()
			.addObject(22060, 1)
			.setAurogon999(6)
			.setAurogon2000(2)
			.addEffort438(463)
			.msgBoxInTable(91, true)
		else
			task()
			.taskDialogue("DlgQ08", 9357)--失之毫厘，谬以千里。天机不可泄露……
		end
	elseif gValue.aurogon2000 == 2 then
		task()
		.taskDialogue("DlgQ08", 9356)--……
	else
		npcDialogue("NPC 2000")
	end
end

function setAurogon2000(v)
	gValue.aurogon2000 = v
end

---------------------------------------
function DLC7EnterM11(minor)
	if minor == "M11P1" then
		if gValue.aurogon2043 == 2 then
			showNPC("mahua 01", true)
			showNPC("mahua 01-1", true)
			setInquiryCount("mahua 01", 1)
		else
			showNPC("mahua 01", false)
			showNPC("mahua 01-1", false)
			setInquiryCount("mahua 01", 0)
		end
	end
end

function DLCPickMahua()
	enterBattle("M11", "M11P1", "M11_1", 2022)
end

function mahua()
	DLCPickMahua()
end





----------------------------------------我是DLC06的分割线！----------------------------------------
function DLCStory4Begin()
	task()
	.log("DLCStory4Begin")
	.SetStoryVersion(4)
	.InitTourCamera()
	.InitBigMap()
	.stopMusic(1.5, false)
	.SetDLC4Story(710100)	                      ---初始化剧情变量
	.gValueQuestInit()
	.changeScene("Q11", "Q11N04D", "null", "")    ---切场景
end

function DLC7EnterQ11(minor)	--Q11
	log("DLC7EnterQ11")
	if GetDLC4Story() < 720100 then
		enableUIMenu(2, false)
		enableUIMenu(3, false)
		--enableUIMenu(4, false)
		enableUIMenu(5, false)
		--enableUIMenu(6, false)
		enableTotem(false)
		enableCooking(false)
	end

	if GetDLC4Story() > 710100 then
		playMusic("P22.ogg", 1, 3, 0, 1, 3)
	end

	callTaskFunction("dlcstory710100")

	if minor == "Q11SD" then
		setMiniMap("MQ015")
	else
		setMiniMap("MQ014")
	end

	if gValue.pickQ11p1 then
		showNPC("plant1", false)
		setInquiryCount("plant1", 0)
		showNPC("tishi1", false)
	end
	if gValue.pickQ11p2 then
		showNPC("plant2", false)
		setInquiryCount("plant2", 0)
		showNPC("tishi2", false)
	end
	if gValue.pickQ11p3 then
		showNPC("plant3", false)
		setInquiryCount("plant3", 0)
		showNPC("tishi3", false)
	end
end

function DLC6LoadQ11()
	if GetDLC4Story() < 720100 then
		enableUIMenu(2, false)
		enableUIMenu(3, false)
		--enableUIMenu(4, false)
		enableUIMenu(5, false)
		--enableUIMenu(6, false)
		enableTotem(false)
		enableCooking(false)
	end
end

function DLC6EnterQ15(minor)
    if GetDLC4Story() == 720400 then
        playMusic("P09.ogg", 1, 3, 0, 1, 3)
	elseif GetDLC4Story() == 720100 then
	    stopMusic(1,false,1)
    elseif GetDLC4Story() == 730100 then
        playMusic("P122.ogg", 1, 3, 0, 1, 3)
	else
	    playMusic("P14.ogg", 1, 3, 0, 1, 3)
	end

--[[
	if GetDLC4Story() >= 720100 then
		enableUIMenu(2, true)
		enableUIMenu(3, true)
		--enableUIMenu(4, true)
		enableUIMenu(5, true)
		--enableUIMenu(6, true)
	end
--]]
	callTaskFunction("dlcstory720100")
    setMiniMap("MQ020")
    setPostMan("NPC 100")
	shuxinDLC6()
--[[
	if gValue.Sub043 == 1 then
		showFood(true)
	else
		showFood(false)
	end
--]]
	if gValue.q15Food1 then
		showNPC("food31", false)
		showNPC("eff31", false)
		setInquiryCount("food31", 0)
	end
	if gValue.q15Food2 then
		showNPC("food32", false)
		showNPC("eff32", false)
		setInquiryCount("food32", 0)
	end
	if gValue.q15Food3 then
		showNPC("food33", false)
		showNPC("eff33", false)
		setInquiryCount("food33", 0)
	end
	if gValue.q15Food4 then
		showNPC("food34", false)
		showNPC("eff34", false)
		setInquiryCount("food34", 0)
	end

	if gValue.Sub044 ~= 1 then
		showNPC("lajiao", false)
	end
end

function OnDLC6LoadQ15()
	SetDLC4Story( gValue.mainStory )
--[[
	if GetDLC4Story() >= 720100 then
		enableUIMenu(2, true)
		enableUIMenu(3, true)
		--enableUIMenu(4, true)
		enableUIMenu(5, true)
		--enableUIMenu(6, true)
	end
--]]
end

function NeedACoin()
	coin = getSelectResult()
	if coin == 1 then
		openWorldMap()
	else
		callTaskFunction("StayBack")
	end
end

function OnTrigger1101()
    if GetDLC4Story() > 720400 then
		task()
		.taskSelectDialogue( 14 , 15 , 16 )
		.NeedACoin()
    else
		task()
		.setHUD(false)
		.setControl(false)
		.setPlayerInitPos("StartPoint 21")
		.taskPlayerMove("StartPoint 21", 1.5 , 0)
		.taskSystemDialogue(8041)
		.setHUD(true)
		.setControl(true)
	end
end

function OnTrigger1100()
    task()
	.setHUD(false)
	.setControl(false)
	.setPlayerInitPos("StartPoint 20")
	.taskPlayerMove("StartPoint 20", 1.5 , 0)
	.taskSystemDialogue(8040)
	.setHUD(true)
	.setControl(true)
end

function DLC7EnterQ09()	--Q09
	log("DLC7EnterQ09")
	callTaskFunction("dlcstory720400")
end

function DLC7EnterM19(minor)	--M19
	log("DLC7EnterM19")
	playMusic("P59.ogg", 1, 3, 0, 1, 3)
	callTaskFunction("dlcstory730100")
	if minor == "M19P1D" then
		setMiniMap("MQ015")
	else
		setMiniMap("MQ014")
	end
	if GetDLC4Story() == 730201 then
		callTaskFunction("M19_QTE")
	    --callTaskFunction("QteProcess")
	    --callTaskFunction("QTElose")
	    --callTaskFunction("QTEwin")
	end

	if GetDLC4Story() >= 730300 then
		hideMst()
	end
end


-------------------DLC06主线剧情的分割线-----------------
function dlcstory710100()
	if GetDLC4Story() == 710100 then
		task()
		.joinTeam(118, false)                             --入队QS
		.taskPlaySequence("700100", "Q11DLC6")            --音乐在xfx中
		.changeScene("Q11", "Q11SD", "null", "")
		.taskPlaySequence("700101", "Q11DLC6")
		.changeScene("Q11", "Q11N02D", "null", "")        --丹阁
		.stopMusic(1,false,1)                             --停播音乐
		.playSWF("Dlc004_1.swf")                          --两个月后
		.taskPlaySequence("700001", "Q11DLC6")            --黑屏未拉
		.stopSWF()
        .playMusic("P108.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("700200", "Q11DLC6")
		.SetDLC4Story(710300)
		.changeScene("Q11", "Q11SD", "null", "")
		.setPlayerPos(-4.742028, -20.94416, 20.19784)
		.setPlayerDir(143.2706)
		.taskDoPostScreen(1, 1.0, 1)
		.playMusic("P22.ogg",1,3,0,1,3)                   --剧情结束后换场景音乐
		--.setRoleString(118, "Nickname", "suyi")	---素衣
		.enableTotem(false)
		.enableCooking(false)
		.enableUIMenu(2, false)
		.enableUIMenu(3, false)
		.enableUIMenu(5, false)
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory710300()
	if GetDLC4Story() == 710300 then
		task()
		.showNPC("NPC JT", false)
		.playMusic("P64.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("700300", "Q11DLC6")
		.SetDLC4Story(720100)
		.changeScene("Q15", "Q15D", "null", "")
	end
end

function dlcstory720100()
	if GetDLC4Story() == 720100 then
		task()
		--.stopMusic(1,false,1)                             --停播音乐
		.playSWF("Dlc004_2.swf")                          --五年之后
		.taskPlaySequence("700002", "Q15DLC6")            --黑屏未拉
		.stopSWF()
		.leaveTeam(118, false)                            --离队QS
		.joinTeam(103, false)                             --入队QS
        .playMusic("P106.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("720100", "Q15DLC6")
		.taskPlaySequence("720101", "Q15DLC6")
		.SetDLC4Story(720200)
		.setRoleLevel(103, 24)
		.setRoleInt(103, "CurrentActPoint", 3)
		.addStar(103, 4)
		.changeCellColor(103, 16, 3)
		.changeCellColor(103, 15, 3)
		.changeCellColor(103, 14, 3)
		.changeCellColor(103, 10, 3)
		.changeCellColor(103, 9, 3)
		.changeCellColor(103, 11, 3)
		.changeCellColor(103, 7, 3)
		.changeCellColor(103, 6, 3)
		.changeCellColor(103, 8, 3)
		.stop2DSound("WA025")
		.addObject(21201, 1, 0)
		.equip(103, 21201)
		.addObject(22227, 1, 0)
		.equip(103, 22227)
		.addObject(21906, 1, 0)
		.equip(103, 21906)
		.addObject(21726, 1, 0)
		.equip(103, 21726)
		.showWeapon(103, false)
		.addSkill(103, 3203)
		.addSkill(103, 3204)
		.addSkill(103, 1122)
		.addObject(22401, 1, 0)
		.addObject(22419, 2, 0)
		.addObject(1642, 50, 0)
		.addObject(1002, 10, 0)
		.addObject(1003, 2, 0)
		.addObject(1006, 5, 0)
		.addObject(1224, 5, 0)
		.setPlayerPos(-17.1781, -2.038488, 23.36678)
		.setPlayerDir(-81.41476)
		.taskDoPostScreen(1, 1.0, 1)
		.playMusic("P14.ogg",1,3,0,1,3)                   --剧情结束后换场景音乐
		.enableUIMenu(2, true)
		.enableUIMenu(3, true)
		.enableUIMenu(5, true)
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory720200()
	if GetDLC4Story() == 720200 then
		task()
		.changeScene("Q15", "Q15M", "null", "")
		.playMusic("P114.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("720200", "Q15DLC6")
		.SetDLC4Story(720300)
		.setPlayerPos(17.64877, 23.98149, 41.92598)
		.setPlayerDir(-153.5104)
		.taskDoPostScreen(1, 1.0, 1)
		.playMusic("P14.ogg",1,3,0,2)                   --剧情结束后换场景音乐
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory720300()
	if GetDLC4Story() == 720300 then
		task()
		.playMusic("P09.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("720300", "Q15DLC6")
		.taskPlaySequence("720301", "Q15DLC6")
		.taskPlaySequence("720302", "Q15DLC6")
		.taskPlaySequence("720303", "Q15DLC6")
		.SetDLC4Story(720400)
		.setPlayerPos(5.329412, 49.97821, 53.42651)
		.setPlayerDir(95.23719)
		.taskDoPostScreen(1, 1.0, 1)
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory720400()
	if GetDLC4Story() == 720400 then
		task()
		.playMusic("P25.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("720400", "Q09DLC6")
		.changeScene("Q09", "Q09N01D", "null", "")
		.taskPlaySequence("720401", "Q09DLC6")
		.SetDLC4Story(720402)
        .enterBattle("Q09", "Q09N01D", "Q09_1", 601)                     --接胖鱼战斗，战场lulu填
        .taskDoPostScreen(1, 0, 1)
	end
end

function DlcComeFromCombatQ09(minor, reason)
	playMusic("P80.ogg" , 1 , 3 , 0 , 1 , 3)

	if GetDLC4Story() == 720402 then
		callTaskFunction("dlcstory720402")
	end

end

function dlcstory720402()
	if GetDLC4Story() == 720402 then
		task()
		.playMusic("P80.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("720402", "Q09DLC6")            --音乐在xfx中
		.playMusic("P102.ogg", 1, 3, 0, 1, 1)             --音乐在xfx中
		.taskPlaySequence("720403", "Q09DLC6")
		.SetDLC4Story(730100)
		.enableUIMenu(2, true)
		.enableUIMenu(3, true)
		.enableUIMenu(5, true)
		.joinTeam(116, true)                              --入队，设置领队SG
		.setRoleLevel(116, 30)
		.setRoleInt(116,"CurrentActPoint", 3)
		.addSkill(116, 7034)
		.addSkill(116, 7035)
		.addSkill(116, 7036)
		.addSkill(116, 7037)
		.addSkill(116, 7038)
		.addSkill(116, 2401)
		.addSkill(116, 2402)
		.addSkill(116, 2403)
		.addSkill(116, 2101)
		.addSkill(116, 2102)
		.addSkill(116, 2301)
		.addSkill(116, 2302)
		.setTeamLeader(116)
		.addObject(1014, 5, 0)
		.addObject(1220, 2, 0)
		.addObject(1421, 2, 0)
		.addObject(1422, 2, 0)
		.addObject(1423, 2, 0)
		.addObject(1424, 2, 0)
		.changeScene("Q15", "Q15M", "null", "")
		.setPlayerPos(-2.519413, 49.00424, 53.49903)
		.setPlayerDir(-96.73994)
		.taskDoPostScreen(1, 1.0, 1)
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory730100()
	if GetDLC4Story() == 730100 then
		task()
		.playMusic("P122.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("730100", "M19DLC6")
		.taskPlaySequence("730101", "M19DLC6")
		.SetDLC4Story(730200)
        .setPlayerPos(-10.86135, 21.11158, 0.409586)
		.setPlayerDir(58.19967)
		.taskDoPostScreen(1, 1.0, 1)
		.playMusic("P59.ogg",1,3,0,1,3)                   --剧情结束后换场景音乐
		.setHUD(true)
		.setControl(true)
	end
end

function initDushi()
	gValue.dushiInit = true
end

function dlcstory730200()
	if GetDLC4Story() == 730200 then
		task()
		.playMusic("P122.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("730200", "M19DLC6")
		.SetDLC4Story(730201)
		.initDushi()
		.enterBattle("M19", "M19P2D", "M19_1", 610)                     --接毒尸战斗，战场lulu填
        .taskDoPostScreen(1, 0, 1)
	end
end

function OnDLCEnterLevelM19()
	playMusic("P59.ogg" , 1 , 3 , 0 , 1 , 3)

	if GetDLC4Story() == 730201 then
		callTaskFunction("M19_QTE")
	end

end

function hideMst()
	showNPC("Monster 01", false)
	showNPC("Monster 02", false)
	showNPC("Monster 03", false)
	showNPC("Monster 04", false)
	showNPC("Monster 05", false)
	showNPC("Monster 06", false)
	showNPC("Monster 07", false)
	showNPC("Monster 08", false)

	showNPC("Monster 11", false)
	showNPC("Monster 12", false)
	showNPC("Monster 13", false)
	showNPC("Monster 14", false)
	showNPC("Monster 15", false)
	showNPC("Monster 16", false)
	showNPC("Monster 17", false)
	showNPC("Monster 18", false)
	showNPC("Monster 19", false)
end

function dlcstory730202()
	if GetDLC4Story() == 730202 then
		task()
		.playMusic("P59.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("730201", "M19DLC6")
		.SetDLC4Story(730203)
		.changeScene("M19", "M19P2D", "null", "")
		.taskPlaySequence("730204", "M19DLC6")
		.taskPlaySequence("730202", "M19DLC6")
		.changeScene("M19", "M19P1D", "null", "")
		.taskPlaySequence("730203", "M19DLC6")
		.SetDLC4Story(730300)
		.hideMst()
		.leaveTeam(116, false)                           --SG离对
		.setTeamLeader(103)                              --领队，换QS
        .setPlayerPos(-17.49418, -12.04876, 20.19662)
		.setPlayerDir(35.54037)
		.taskDoPostScreen(1, 1.0, 1)
		.setHUD(true)
		.setControl(true)
	end
end

function dlcstory730300()
	if GetDLC4Story() == 730300 then
		task()
		.changeScene("Q11", "Q11J", "null", "")
		.playMusic("P77.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("730300", "Q11DLC6")
		.taskPlaySequence("730301", "Q11DLC6")
		.changeScene("Q11", "Q11N02D", "null", "")        --丹阁
		.stopMusic(1,false,1)                             --停播音乐
		.playSWF("Dlc004_3.swf")                          --一个月后
		.taskPlaySequence("700003", "Q11DLC6")
		.stopSWF()
        .playMusic("P22.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("730302", "Q11DLC6")
		.SetDLC4Story(740100)
		.changeScene("Q15", "Q15D", "null", "")
		.playMusic("P108.ogg", 1, 3, 0, 1, 1)
		.taskPlaySequence("740100", "Q15DLC6")            --音乐在xfx中
        .playSWF("Dlc004_end.swf")                        --结尾flash
		.taskPlaySequence("700004","Q15DLC6")
		.stopSWF()
        .addEffort(440, 1)      		                  --成就
        .saveEffort()
        .taskDoPostScreen(1, 0, 1)
		.endGame(false)
	end
end



----------------以下为DLC06书信-----------------------
function shuxinDLC6()
	if GetDLC4Story() == 720100 then
		sendMail(204)
		sendMail(205)
		sendMail(206)
		sendMail(207)
		sendMail(208)
		sendMail(209)
		sendMail(210)
		sendMail(211)
	end
end


----------------以下为DLC06QTE函数-----------------------
function M19_QTE()
	if gValue.qte == nil then
		gValue.qte = {}
		for inum = 1 , 20 do
			gValue.qte[ inum ] = false
		end
	end
	if gValue.qte[ 8 ] == false then
		task()
			.playMusic("P71.ogg" , 1 , 3 , 0 , 1 , 3)
			.pauseScene3dSound()
			.setHUD(false)
			.setControl(false)
			.taskDoPostScreen( 1 , 1.5 , 0)
			.msgBoxInTable(8043,2,false)
			.wait(1)
			.taskPlaySequence("QTE_M19","QTE")
			.callTaskFunction("M19_QteProcess")
			.resumeScene3dSound()
	end
end

function M19_QteProcess()
	if getQTEResult() == false then
		task()
			.msgBoxInTable(8050)
			--.setPlayerInitPos("StartPoint 10")            --
			.taskDoPostScreen( 1 , 1.5 , 1)
			.QTElose()
			.enterBattle("M19", "M19P2D", "M19_1", 610)                     --接毒尸战斗，战场露露填
            .taskDoPostScreen(1, 0, 1)
	else
		task()
			.msgBoxInTable(8051)
			--.setPlayerInitPos("StartPoint 11")             --
--			.showNPC("MO_03" , false)
			.taskDoPostScreen( 1 , 1.5 , 1)
			.SetQTE( 8 , true )
			.QTEwin()
			.SetDLC4Story(730202)
			.callTaskFunction("dlcstory730202")
	end
end

function QTElose()
	if gValue.failQTE == nil then
		gValue.failQTE=0
	end

	gValue.failQTE = gValue.failQTE + 1
end

function QTEwin()
	if gValue.failQTE == nil then
		gValue.failQTE=0
	end

	if gValue.failQTE <4 then
		addEffort(306, 0) --成就项《身轻如燕》「在同一轮回内，场景QTE失败次数不大于3次。」
	end
end


------------------------NPC主线剧情增补-------------------------
function setXXX(v)
    gValue.XXX = v
end

function Q12DNPC()
	if gValue.XXX==0 or gValue.XXX == nil then
		callTaskFunction("talk123")
	else
		npcDialogue("NPC 16")
	end
end


 function talk123()
	task()
	.setHUD(false)
	.setControl(false)
	.setNpcDir("NPC 16","")
	.taskDialogue("DlgQ12D", 30)
	.taskDialogue("DlgQ12D", 31)
	.taskDialogue("DlgQ12D", 32)
	.taskDialogue("DlgQ12D", 33)
	.taskDialogue("DlgQ12D", 34)
	.taskDialogue("DlgQ12D", 35)
	.taskDialogue("DlgQ12D", 36)
	.taskDialogue("DlgQ12D", 37)
	.taskDialogue("DlgQ12D", 38)
	.taskDialogue("DlgQ12D", 39)
	.setXXX(1)
	.setHUD(true)
	.setControl(true)
end
