-------------------------------------------------------------------------------- -- King Slime Progress Func -- -------------------------------------------------------------------------------- -- ´øÀü ÃʱâÈ­ function InitDungeon( Var ) cExecCheck "InitDungeon" if Var == nil then return end -- Å·´ý Äù½ºÆ® ½ÃÀÛ Àü¿¡ Ç÷¹À̾îÀÇ Ã¹ ·Î±×ÀÎÀ» ±â´Ù¸°´Ù. if Var["bPlayerMapLogin"] == nil then if Var["InitialSec"] + WAIT_PLAYER_MAP_LOGIN_SEC_MAX <= cCurrentSecond() then GoToFail( Var ) return end return end if Var["InitDungeon"] == nil then DebugLog( "Start InitDungeon" ) local Doors = RegenInfo["Stuff"] -- ¹® »ý¼º Var["Door1"] = cDoorBuild( Var["MapIndex"], Doors["Door1"]["Index"], Doors["Door1"]["x"], Doors["Door1"]["y"], Doors["Door1"]["dir"], Doors["Door1"]["scale"] ) Var["Door2"] = cDoorBuild( Var["MapIndex"], Doors["Door2"]["Index"], Doors["Door2"]["x"], Doors["Door2"]["y"], Doors["Door2"]["dir"], Doors["Door2"]["scale"] ) Var["Door3"] = cDoorBuild( Var["MapIndex"], Doors["Door3"]["Index"], Doors["Door3"]["x"], Doors["Door3"]["y"], Doors["Door3"]["dir"], Doors["Door3"]["scale"] ) -- ¹® ´Ý±â cDoorAction( Var["Door1"], Doors["Door1"]["Block"], "close" ) cDoorAction( Var["Door2"], Doors["Door2"]["Block"], "close" ) cDoorAction( Var["Door3"], Doors["Door3"]["Block"], "close" ) Var["InitDungeon"] = {} Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"] end -- ÀÏÁ¤ ½Ã°£ µÚ ´ÙÀ½ ´Ü°è·Î if Var["InitDungeon"]["WaitSecDuringInit"] + DelayTime["AfterInit"] <= Var["CurSec"] then GoToNextStep( Var ) Var["InitDungeon"] = nil DebugLog( "End InitDungeon" ) return end end -- °¡µð¾ðÀÇ °æ°í function GuideOfGuard( Var ) cExecCheck "GuideOfGuard" if Var == nil then return end if Var["GuideOfGuard"] == nil then DebugLog( "Start GuideOfGuard" ) local RegenGuard = RegenInfo["NPC"]["NPC_Guard"] local GuardHandle = nil GuardHandle = cMobRegen_XY( Var["MapIndex"], RegenGuard["Index"], RegenGuard["x"],RegenGuard["y"], RegenGuard["dir"] ) if GuardHandle ~= nil then Var["Friend"][ GuardHandle ] = RegenGuard Var["Friend"][ GuardHandle ]["Handle"] = GuardHandle end Var["GuideOfGuard"] = {} Var["GuideOfGuard"]["NoticeStepSec"] = Var["CurSec"] Var["GuideOfGuard"]["NoticeStepNo"] = 1 end -- ´ÙÀ̾ó·Î±×(ÆäÀ̽ºÄÆ) index üũ ¹× ½ÇÇà if Var["GuideOfGuard"]["NoticeStepNo"] <= #NPC_GuardChat["StartWarnDialog"] then -- ÆäÀ̽ºÄÆ Ã³¸® if Var["GuideOfGuard"]["NoticeStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], RegenInfo["NPC"]["NPC_Guard"]["Index"], NPC_GuardChat["ScriptFileName"], NPC_GuardChat["StartWarnDialog"][ Var["GuideOfGuard"]["NoticeStepNo"] ]["Index"] ) Var["GuideOfGuard"]["NoticeStepSec"] = Var["CurSec"] + DelayTime["BetweenGuardWarnDialog"] -- ´ÙÀ½ ÆäÀ̽º ÄÆ ¶ç¿ï ½Ã°£ ¼ÂÆà Var["GuideOfGuard"]["NoticeStepNo"] = Var["GuideOfGuard"]["NoticeStepNo"] + 1 -- ´ÙÀ½ ÆäÀ̽º ÄÆÀ¸·Î ´Ü°è ¼ÂÆà end else for indexHandle, value in pairs( Var["Friend"] ) do cNPCVanish( indexHandle ) end local nLimitSec = cGetKQLimitSecond( Var["MapIndex"] ) if nLimitSec == nil then ErrorLog( "GuideOfGuard::nLimitSec == nil" ) else -- Real Kingdom Quest ½ÃÀÛ !!!! Var["KQLimitTime"] = Var["CurSec"] + nLimitSec -- ŸÀÌ¸Ó ½ÃÀÛ! cShowKQTimerWithLife( Var["MapIndex"], nLimitSec ) end GoToNextStep( Var ) Var["GuideOfGuard"] = nil DebugLog( "End GuideOfGuard" ) return end end -- Å·½½¶óÀÓ¾ð´ö 1, 2, 3Ãþ function LowerFloor( Var ) cExecCheck "LowerFloor" if Var == nil then return end if Var["LowerFloor"] == nil then Var["LowerFloor"] = {} end if Var["LowerFloor"]["FloorNumber"] == nil then Var["LowerFloor"]["FloorNumber"] = 1 end -- °¢ Ãþ Ãʱ⠼³Á¤ if Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ] == nil then DebugLog( "Start Floor "..Var["LowerFloor"]["FloorNumber"] ) local CurFloor = FloorNameTable[ Var["LowerFloor"]["FloorNumber"] ] -- ÃþÀ̸§ ¹Þ¾Æ¿À±â local CurRegenFloor = {} CurRegenFloor = RegenInfo["Group"][ CurFloor ] for i = 1, #CurRegenFloor do cGroupRegenInstance( Var["MapIndex"], CurRegenFloor[i] ) end Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ] = {} Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ]["WaitSecDuringMobGen"] = Var["CurSec"] + DelayTime["AfterMobGen"] end -- ¸÷ »ý¼º ½Ã°£À» ±â´Ù·ÁÁØ ÈÄ Å¬¸®¾î üũ¸¦ Çϱâ À§Çؼ­ ÀÏÁ¤ ½Ã°£À» ±â´Ù·ÁÁÜ if Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ]["WaitSecDuringMobGen"] > Var["CurSec"] then return end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ] = nil Var["LowerFloor"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ] = nil Var["LowerFloor"] = nil return end -- ¸ðµç ¸÷À» Á׿´´ÂÁö üũ local bEndFloor = false if cObjectCount( Var["MapIndex"], ObjectType["Mob"] ) <= 0 then bEndFloor = true end -- Success Case : ¸ðµç ¸÷À» Á׿´À» ¶§ if bEndFloor == true then cDoorAction( Var["Door"..Var["LowerFloor"]["FloorNumber"] ], RegenInfo["Stuff"]["Door"..Var["LowerFloor"]["FloorNumber"] ]["Block"], "open" ) -- ´ÙÀ½ ÃþÀ¸·Î Var["LowerFloor"..Var["LowerFloor"]["FloorNumber"] ] = nil DebugLog( "End Floor "..Var["LowerFloor"]["FloorNumber"] ) Var["LowerFloor"]["FloorNumber"] = Var["LowerFloor"]["FloorNumber"] + 1 -- 1,2,3ÃþÀÌ ¸ðµÎ Ŭ¸®¾î µÇ¸é Å·½½¶óÀÓ°úÀÇ °áÀü! if Var["LowerFloor"]["FloorNumber"] > 3 then Var["LowerFloor"] = nil GoToNextStep( Var ) return end return end end -- Å·½½¶óÀÓ¾ð´ö ÃÖ»óÃþ function TopFloor( Var ) cExecCheck "TopFloor" if Var == nil then return end -- ÃÖ»óÃþ ¼ÂÆà if Var["TopFloor"] == nil then DebugLog( "Start TopFloor" ) local RegenKingSlime = RegenInfo["Mob"]["TopFloor"]["KingSlime"] local KingSlimeHandle = nil KingSlimeHandle = cMobRegen_XY( Var["MapIndex"], RegenKingSlime["Index"], RegenKingSlime["x"], RegenKingSlime["y"], RegenKingSlime["dir"] ) if KingSlimeHandle ~= nil then cSetAIScript ( MainLuaScriptPath, KingSlimeHandle ) cAIScriptFunc( KingSlimeHandle, "Entrance", "KingSlimeRoutine" ) Var["Enemy"][ KingSlimeHandle ] = RegenKingSlime end Var["TopFloor"] = {} -- Å·½½¶óÀÓ °æ°íÀÇ ½Ã°£°ú ´Ü°è ÃʱâÈ­ Var["TopFloor"]["WarnStepSec"] = Var["CurSec"] Var["TopFloor"]["WarnStepNo"] = 1 -- Å·½½¶óÀÓ Á¨ ÈÄ µô·¹À̸¦ ÁÖ±âÀ§ÇÑ ½Ã°£ ¼³Á¤ Var["TopFloor"]["WaitSecDuringBossGen"] = Var["CurSec"] + DelayTime["AfterMobGen"] end ------ KingSlimeÀÇ °æ°í -- ÆäÀ̽ºÄÆ ´Ü°è üũ ¹× ½ÇÇà if Var["TopFloor"]["WarnStepNo"] <= #KingSlimeChat["WarningDialog"] then -- ´ÙÀ̾ó·Î±× ó¸® if Var["TopFloor"]["WarnStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], RegenInfo["Mob"]["TopFloor"]["KingSlime"]["Index"], KingSlimeChat["ScriptFileName"], KingSlimeChat["WarningDialog"][ Var["TopFloor"]["WarnStepNo"] ]["Index"] ) Var["TopFloor"]["WarnStepNo"] = Var["TopFloor"]["WarnStepNo"] + 1 -- ´ÙÀ½ ´Ü°è º¯È£ ¼ÂÆà Var["TopFloor"]["WarnStepSec"] = Var["CurSec"] + DelayTime["BetweenKingSlimeWarnDialog"] -- ´ÙÀ½ ÆäÀ̽ºÄÆ ¶ç¿ï ½Ã°£ ¼ÂÆà end return end -- º¸½º Á¨ ½Ã°£ ±â´Ù¸®±â if Var["TopFloor"]["WaitSecDuringBossGen"] > Var["CurSec"] then return end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["TopFloor"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["TopFloor"] = nil return end -- ¸ðµç ¸÷À» Á׿´´ÂÁö üũ local bEndTopFloor = true for indexHandle, Value in pairs( Var["Enemy"] ) do if Value ~= nil then bEndTopFloor = false end end -- Success Case : ¸ðµç ¸÷À» Á׿´À» ¶§ if bEndTopFloor == true then GoToSuccess( Var ) Var["TopFloor"] = nil DebugLog( "End TopFloor" ) return end end -- Å·´ý Äù½ºÆ® Ŭ¸®¾î function QuestSuccess( Var ) cExecCheck "QuestSuccess" if Var == nil then return end if Var["QuestSuccess"] == nil then DebugLog( "Start QuestSuccess" ) Var["QuestSuccess"] = {} -- Success ¶ç¿ì°í cVanishTimer( Var["MapIndex"] ) cQuestResult( Var["MapIndex"], "Success" ) -- Ç÷¹À̾°Ô Ŭ¸®¾î º¸»ó ÁÖ±â cReward( Var["MapIndex"], "KQ" ) -- Quest Mob Kill ¼¼±â. cQuestMobKill_AllInMap( Var["MapIndex"], QuestMobKillInfo["QuestID"], QuestMobKillInfo["MobIndex"], QuestMobKillInfo["MaxKillCount"] ) Var["QuestSuccess"]["SuccessStepSec"] = Var["CurSec"] Var["QuestSuccess"]["SuccessStepNo"] = 1 end -- °æºñ⺴ÀÇ ¸Þ¼¼Áö if Var["QuestSuccess"]["SuccessStepNo"] <= #NPC_GuardChat["SuccessAndThenDialog"] then if Var["QuestSuccess"]["SuccessStepSec"] <= Var["CurSec"] then local GuardDialog = NPC_GuardChat["SuccessAndThenDialog"] cMobDialog( Var["MapIndex"], GuardDialog["SpeakerIndex"], NPC_GuardChat["ScriptFileName"], GuardDialog[ Var["QuestSuccess"]["SuccessStepNo"] ]["Index"] ) Var["QuestSuccess"]["SuccessStepNo"] = Var["QuestSuccess"]["SuccessStepNo"] + 1 -- go to next dialog Var["QuestSuccess"]["SuccessStepSec"] = Var["CurSec"] + DelayTime["BetweenSuccessDialog"] -- set time for changing step end return end -- ´ÙÀ̾ó·Î±× ³¡ if Var["QuestSuccess"]["SuccessStepNo"] > #NPC_GuardChat["SuccessAndThenDialog"] then if Var["QuestSuccess"]["SuccessStepSec"] <= Var["CurSec"] then GoToNextStep( Var ) Var["QuestSuccess"] = nil DebugLog( "End QuestSuccess" ) end end end -- Å·´ý Äù½ºÆ® ½ÇÆÐ function QuestFailed( Var ) cExecCheck "QuestFailed" if Var == nil then return end DebugLog( "Start QuestFailed" ) -- Fail ¶ç¿ì°í cVanishTimer( Var["MapIndex"] ) cQuestResult( Var["MapIndex"], "Fail" ) GoToNextStep( Var ) DebugLog( "End QuestFailed" ) Var["QuestFailed"] = {} end -- ±Íȯ function ReturnToHome( Var ) cExecCheck "ReturnToHome" if Var == nil then return end if Var["ReturnToHome"] == nil then DebugLog( "Start ReturnToHome" ) Var["ReturnToHome"] = {} Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] Var["ReturnToHome"]["ReturnStepNo"] = 1 end -- Return : return notice substep if Var["ReturnToHome"]["ReturnStepNo"] <= #NoticeInfo["KQReturn"] then if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"] then -- Notice of Escape if NoticeInfo["KQReturn"][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ~= nil then cNotice( Var["MapIndex"], NoticeInfo["ScriptFileName"], NoticeInfo["KQReturn"][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ) end -- Go To Next Notice Var["ReturnToHome"]["ReturnStepNo"] = Var["ReturnToHome"]["ReturnStepNo"] + 1 Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] + DelayTime["BetweenKQReturnNotice"] end return end -- Return : linkto substep if Var["ReturnToHome"]["ReturnStepNo"] > #NoticeInfo["KQReturn"] then if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"] then --Finish_KQ cLinkToAll( Var["MapIndex"], LinkInfo["ReturnMap"]["MapIndex"], LinkInfo["ReturnMap"]["x"], LinkInfo["ReturnMap"]["y"] ) GoToNextStep( Var ) Var["ReturnToHome"] = nil if cEndOfKingdomQuest( Var["MapIndex"] ) == nil then ErrorLog( "ReturnToHome::Function cEndOfKingdomQuest failed" ) end DebugLog( "End ReturnToHome" ) end return end end -- ½ºÅÜ ±¸ºÐÀ» À§ÇÑ ´øÀü ÁøÇà ÇÔ¼ö ¸®½ºÆ® KQ_StepsList = { { Function = InitDungeon, Name = "InitDungeon", }, { Function = GuideOfGuard, Name = "GuideOfGuard", }, { Function = LowerFloor, Name = "LowerFloor", }, { Function = TopFloor, Name = "TopFloor", }, { Function = QuestSuccess, Name = "QuestSuccess", }, { Function = QuestFailed, Name = "QuestFailed", }, { Function = ReturnToHome, Name = "ReturnToHome", }, } -- ¿ªÂüÁ¶ ¸®½ºÆ® KQ_StepsIndexList = { } for index, funcValue in pairs ( KQ_StepsList ) do KQ_StepsIndexList[ funcValue["Name"] ] = index end