-------------------------------------------------------------------------------- -- Kingkong 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 Var["QuestResult"] = "Fail" GoToFail( Var ) return end return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["InitDungeon"] == nil then DebugLog( "Start InitDungeon" ) Var["InitDungeon"] = {} Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"] end -- ÀÏÁ¤ ½Ã°£ µÚ ´ÙÀ½ ´Ü°è·Î if Var["InitDungeon"]["WaitSecDuringInit"] + DelayTime["AfterInit"] <= Var["CurSec"] then local nLimitSec = cGetKQLimitSecond( Var["MapIndex"] ) if nLimitSec == nil then ErrorLog( "InitDungeon::nLimitSec == nil" ) else Var["KQLimitTime"] = Var["CurSec"] + nLimitSec cShowKQTimerWithLife( Var["MapIndex"], nLimitSec ) end Var["QuestResult"] = "Fail" GoToNextStep( Var ) Var["InitDungeon"] = nil DebugLog( "End InitDungeon" ) return end end function FloorFunc( Var ) cExecCheck "FloorFunc" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["FloorInfo"] == nil then Var["FloorInfo"] = {} end if Var["FloorInfo"]["FloorNumber"] == nil then Var["FloorInfo"]["FloorNumber"] = 1 end if Var["FloorInfo"]["Init"] == nil then Var["FloorInfo"]["Init"] = 0 end -- °¢ Ãþ Ãʱ⠼³Á¤ if Var["FloorInfo"]["Init"] ~= Var["FloorInfo"]["FloorNumber"] then DebugLog( "Start Floor "..Var["FloorInfo"]["FloorNumber"] ) local CurFloor = FloorNameTable[ Var["FloorInfo"]["FloorNumber"] ] -- ÃþÀ̸§ ¹Þ¾Æ¿À±â -- ±×·ì ¸®Á¨ local CurRegenGroup = RegenInfo["Group"][ CurFloor ] for i = 1, #CurRegenGroup do cGroupRegenInstance( Var["MapIndex"], CurRegenGroup[i] ) end -- °³º° ¸®Á¨ local CurRegenMob = RegenInfo["BossMob"][ CurFloor ] Var["FloorInfo"]["Success"] = nil Var["FloorInfo"]["Fail"] = nil -- °¢ Ãþ ¼º°ø Á¶°ÇÀÇ ¸÷ if CurRegenMob["Success"] ~= nil then local RegenMob = cMobRegen_XY( Var["MapIndex"], CurRegenMob["Success"]["Index"], CurRegenMob["Success"]["x"], CurRegenMob["Success"]["y"], CurRegenMob["Success"]["dir"] ) -- ¸¶Áö¸· º¸½º¸é ½ºÅ©¸³Æ® ¼¼Æà if Var["FloorInfo"]["FloorNumber"] >= #FloorNameTable then if RegenMob == nil then ErrorLog( "cMobRegen_XY LastBoss Regen failed" ) else cSetAIScript( MainLuaScriptPath, RegenMob ) cAIScriptFunc( RegenMob, "Entrance", "BossRoutine" ) end end Var["FloorInfo"]["Success"] = RegenMob end -- °¢ Ãþ ½ÇÆÐ Á¶°ÇÀÇ ¸÷ if CurRegenMob["Fail"] ~= nil then local RegenMob = cMobRegen_XY( Var["MapIndex"], CurRegenMob["Fail"]["Index"], CurRegenMob["Fail"]["x"], CurRegenMob["Fail"]["y"], CurRegenMob["Fail"]["dir"] ) Var["FloorInfo"]["Fail"] = RegenMob end Var["FloorInfo"]["Init"] = Var["FloorInfo"]["FloorNumber"]; end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["FloorInfo"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["FloorInfo"] = nil return end -- Á×ÀÌ¸é ¾ÈµÇ´Â¸÷ Àâ¾ÒÀ¸¸é ½ÇÆÐ if Var["FloorInfo"]["Fail"] ~= nil then if cIsObjectDead( Var["FloorInfo"]["Fail"] ) == 1 then cAIScriptSet( Var["FloorInfo"]["Fail"] ) GoToFail( Var ) Var["FloorInfo"] = nil return end end -- º¸½º ÀâÀ¸¸é ¼º°ø if Var["FloorInfo"]["Success"] ~= nil then if cIsObjectDead( Var["FloorInfo"]["Success"] ) == 1 then cAIScriptSet( Var["FloorInfo"]["Success"] ) -- ¸÷ Ŭ¸®¾î if cMobSuicide( Var["MapIndex"] ) == nil then ErrorLog( "FloorFunc::Suicide Fail" ) end -- ¸¶Áö¸· º¸½º¸é Å·Äù ¼º°ø -- ¾Æ´Ï¸é ´ÙÀ½Ãþ if Var["FloorInfo"]["FloorNumber"] >= #FloorNameTable then GoToSuccess( Var ) return else Var["FloorInfo"]["FloorNumber"] = Var["FloorInfo"]["FloorNumber"] + 1 return end end end end -- Å·´ý Äù½ºÆ® Ŭ¸®¾î function QuestSuccess( Var ) cExecCheck "QuestSuccess" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return end Var["CurSec"] = cCurrentSecond() -- ¼º°ø µô·¹ÀÌ if Var["QuestSuccessTime"] == nil then Var["QuestSuccessTime"] = Var["CurSec"] end if (Var["QuestSuccessTime"] + DelayTime["QuestSuccessDelay"]) > Var["CurSec"] then return end DebugLog( "Start QuestSuccess" ) Var["QuestResult"] = "Success" -- 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"] ) GoToNextStep( Var ) DebugLog( "End QuestSuccess" ) 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" ) end -- ±Íȯ function ReturnToHome( Var ) cExecCheck "ReturnToHome" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return end Var["CurSec"] = cCurrentSecond() 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"][Var["QuestResult"]] then if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"] then -- Notice of Escape if NoticeInfo["KQReturn"][Var["QuestResult"]][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ~= nil then cNotice( Var["MapIndex"], NoticeInfo["ScriptFileName"], NoticeInfo["KQReturn"][Var["QuestResult"]][ 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"][Var["QuestResult"]] 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 = FloorFunc, Name = "FloorFunc", }, { 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