-------------------------------------------------------------------------------- -- Mini Dragon (Hard Mode) 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" ) Var["InitDungeon"] = {} Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"] + DelayTime["AfterInit"] end -- ÀÏÁ¤ ½Ã°£ µÚ ´ÙÀ½ ´Ü°è·Î if Var["InitDungeon"]["WaitSecDuringInit"] <= Var["CurSec"] then 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["InitDungeon"] = nil DebugLog( "End InitDungeon" ) return end end -- 1, 2, 3, 4 ¹ø° Çʵå Â̵é°ú Áß°£º¸½º ¸÷µé°úÀÇ ÀüÅõ function MidBossStep( Var ) cExecCheck "MidBossStep" if Var == nil then return end if Var["MidBossStep"] == nil then Var["MidBossStep"] = {} end if Var["MidBossStep"]["StepNumber"] == nil then Var["MidBossStep"]["StepNumber"] = 1 end local CurStepNo = Var["MidBossStep"]["StepNumber"] -- °¢ ´Ü°è Ãʱ⠼³Á¤ if Var["MidBossStep"..CurStepNo ] == nil then DebugLog( "Start MidBossStep "..CurStepNo ) Var["MidBossStep"..CurStepNo ] = {} -- ´Ü°èÀ̸§ ¹Þ¾Æ¿À±â local CurStep = StepNameTable[ CurStepNo ] -- ¸÷ ±×·ì Á¨ local CurStepRegen = RegenInfo["Group"][ CurStep ] for i = 1, #CurStepRegen do cGroupRegenInstance( Var["MapIndex"], CurStepRegen[i] ) end -- Áß°£º¸½º Á¨ local RegenMidBoss = nil local MidBossHandle = nil for MobName, MobRegenInfo in pairs ( RegenInfo["Mob"][ CurStep ] ) do RegenMidBoss = MobRegenInfo MidBossHandle = cMobRegen_XY( Var["MapIndex"], RegenMidBoss["Index"], RegenMidBoss["x"], RegenMidBoss["y"], RegenMidBoss["dir"] ) end if MidBossHandle ~= nil then Var["Enemy"][ MidBossHandle ] = RegenMidBoss Var["MidBossStep"..CurStepNo ]["MidBossHandle"] = MidBossHandle Var["RoutineTime"][ MidBossHandle ] = cCurrentSecond() cSetAIScript ( MainLuaScriptPath, MidBossHandle ) cAIScriptFunc( MidBossHandle, "Entrance", "MidBossRoutine" ) end end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["MidBossStep"..CurStepNo ] = nil Var["MidBossStep"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["MidBossStep"..CurStepNo ] = nil Var["MidBossStep"] = nil return end local nMidBossHandle = Var["MidBossStep"..CurStepNo ]["MidBossHandle"] -- Next Case : Áß°£º¸½º »ç¸Á½Ã if Var["Enemy"][ nMidBossHandle ] == nil then -- ¾È Á×Àº Àܸ÷ ÀÚ»ì cMobSuicide( Var["MapIndex"] ) -- ´ÙÀ½ ´Ü°è·Î Var["MidBossStep"..CurStepNo ] = nil Var["MidBossStep"]["StepNumber"] = CurStepNo + 1 DebugLog( "End MidBossStep "..CurStepNo ) -- Áß°£º¸½º ¿Ã Ŭ¸®¾î : º¸½º ÀüÀ¸·Î if Var["MidBossStep"]["StepNumber"] >= #StepNameTable then Var["MidBossStep"] = nil GoToNextStep( Var ) return end return end end -- º¸½º ¹Ì´Ïµå·¡°ï°úÀÇ ÀüÅõ function BossBattle( Var ) cExecCheck "BossBattle" if Var == nil then return end -- º¸½ºÀü ¼ÂÆà if Var["BossBattle"] == nil then DebugLog( "Start BossBattle" ) Var["BossBattle"] = {} -- ¹Ì´Ï µå·¡°ï Á¨ local RegenMiniDragon = RegenInfo["Mob"]["BossBattle"]["MiniDragon"] local MiniDragonHandle = cMobRegen_XY( Var["MapIndex"], RegenMiniDragon["Index"], RegenMiniDragon["x"], RegenMiniDragon["y"], RegenMiniDragon["dir"] ) if MiniDragonHandle ~= nil then Var["Enemy"][ MiniDragonHandle ] = RegenMiniDragon Var["BossBattle"]["BossHandle"] = MiniDragonHandle cMobDetectRange( MiniDragonHandle, BossDetectRange["Regen"] ) Var["RoutineTime"][ MiniDragonHandle ] = cCurrentSecond() cSetAIScript ( MainLuaScriptPath, MiniDragonHandle ) cAIScriptFunc( MiniDragonHandle, "Entrance", "MiniDragonRoutine" ) end end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["BossBattle"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["BossBattle"] = nil return end -- Success Case : ¹Ì´Ïµå·¡°ï »ç¸Á½Ã local nBossHandle = Var["BossBattle"]["BossHandle"] if Var["Enemy"][ nBossHandle ] == nil then GoToSuccess( Var ) Var["BossBattle"] = nil DebugLog( "End BossBattle" ) return end end -- Å·´ý Äù½ºÆ® Ŭ¸®¾î function QuestSuccess( Var ) cExecCheck "QuestSuccess" if Var == nil then return end if Var["QuestSuccess"] == nil then DebugLog( "Start QuestSuccess" ) Var["QuestSuccess"] = {} Var["QuestSuccess"]["WaitSecAfterKillBoss"] = Var["CurSec"] + DelayTime["WaitAfterKillBoss"] end -- º¸½º Á×ÀÎ ÈÄ Àá½Ã ±â´Ù·Á ÁÜ if Var["QuestSuccess"]["WaitSecAfterKillBoss"] <= Var["CurSec"] then -- 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"] ) -- º¸»ó¿ë ±¤¼®±×·ì Á¨ cGroupRegenInstance( Var["MapIndex"], RegenInfo["Group"]["QuestSuccess"] ) -- ±Íȯ ÇÏ·¯ GoToNextStep( Var ) DebugLog( "End QuestSuccess" ) 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" ) end -- ±Íȯ function ReturnToHome( Var ) cExecCheck "ReturnToHome" if Var == nil then return end if Var["ReturnToHome"] == nil then DebugLog( "Start ReturnToHome" ) Var["ReturnToHome"] = {} Var["ReturnToHome"]["ReturnStepNo"] = 1 Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] if Var["QuestSuccess"] ~= nil then -- ¼º°ø½Ã Var["ReturnToHome"]["ReturnNoticeIndex"] = "KQReturn" Var["QuestSuccess"] = nil else -- ½ÇÆнà Var["ReturnToHome"]["ReturnNoticeIndex"] = "KQFReturn" end end local sReturnNoticeIndex = Var["ReturnToHome"]["ReturnNoticeIndex"] -- Return : return notice substep if Var["ReturnToHome"]["ReturnStepNo"] <= #NoticeInfo[ sReturnNoticeIndex ] then if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"] then -- Notice of Escape if NoticeInfo[ sReturnNoticeIndex ][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ~= nil then cNotice( Var["MapIndex"], NoticeInfo["ScriptFileName"], NoticeInfo[ sReturnNoticeIndex ][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ) end -- Go To Next Notice Var["ReturnToHome"]["ReturnStepNo"] = Var["ReturnToHome"]["ReturnStepNo"] + 1 Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] + DelayTime["GapKQReturnNotice"] end return end -- Return : linkto substep if Var["ReturnToHome"]["ReturnStepNo"] > #NoticeInfo[ sReturnNoticeIndex ] 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 = MidBossStep, Name = "MidBossStep", }, { Function = BossBattle, Name = "BossBattle", }, { 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