-------------------------------------------------------------------------------- -- Tower Of Iyzel 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"] = {} -- Ãþ »çÀÌ¿¡ ÀÖ´Â ¹® »ý¼º for i = 0, 17 do local DoorTableIndex = nil if i < 10 then DoorTableIndex = "Door0"..i else DoorTableIndex = "Door"..i end local CurRegenDoor = RegenInfo["Stuff"][ DoorTableIndex ] if CurRegenDoor ~= nil then local nCurDoorHandle = cDoorBuild( Var["MapIndex"], CurRegenDoor["Index"], CurRegenDoor["x"], CurRegenDoor["y"], CurRegenDoor["dir"], CurRegenDoor["scale"] ) if nCurDoorHandle ~= nil then cDoorAction( nCurDoorHandle , CurRegenDoor["Block"], "close" ) -- ¸®Á¨ Á¤º¸ º¸°ü Var["Door"][ nCurDoorHandle ] = CurRegenDoor -- ÇÚµé º¸°ü : Á¢±Ù¿ëÀ¸·Î Var["Door"..(i+1) ] = nCurDoorHandle end end end -- ÀÔ±¸ÂÊ Ãⱸ°ÔÀÌÆ® »ý¼º local RegenExitGate = RegenInfo["Stuff"]["ExitGate"] local nExitGateHandle = cDoorBuild( Var["MapIndex"], RegenExitGate["Index"], RegenExitGate["x"], RegenExitGate["y"], RegenExitGate["dir"], RegenExitGate["scale"] ) if nExitGateHandle ~= nil then if cSetAIScript ( MainLuaScriptPath, nExitGateHandle ) == nil then ErrorLog( "InitDungeon::cSetAIScript ( MainLuaScriptPath, nExitGateHandle ) == nil" ) end if cAIScriptFunc( nExitGateHandle, "NPCClick", "ExitGateClick" ) == nil then ErrorLog( "InitDungeon::cAIScriptFunc( nExitGateHandle, \"NPCClick\", \"ExitGateClick\" ) == nil" ) end end -- ´ë±â½Ã°£ ¼³Á¤ Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"] + DelayTime["AfterInit"] end -- ´ë±â ÈÄ ´ÙÀ½ ´Ü°è·Î if Var["InitDungeon"]["WaitSecDuringInit"] <= Var["CurSec"] then GoToNextStep( Var ) Var["InitDungeon"] = nil DebugLog( "End InitDungeon" ) return end end -- 1~19 ¹ø° ÃþÀÇ ¸÷µé°ú º¸½ºÀü function EachFloor( Var ) cExecCheck "EachFloor" if Var == nil then return end if Var["EachFloor"] == nil then Var["EachFloor"] = {} end -- ´Ü°è ¹øÈ£ ¼³Á¤ if Var["EachFloor"]["StepNumber"] == nil then Var["EachFloor"]["StepNumber"] = 1 end -- ´Ü°èÀ̸§ ¹Þ¾Æ¿À±â local CurStepNo = Var["EachFloor"]["StepNumber"] -- ex) 1 local CurStep = StepNameTable[ CurStepNo ] -- ex) Floor01 -- °¢ ´Ü°è Ãʱ⠼³Á¤ if Var["EachFloor"..CurStepNo ] == nil then DebugLog( "Start EachFloor "..CurStepNo ) Var["EachFloor"..CurStepNo ] = {} -- ¸÷ ±×·ì Á¨ local CurStepRegen = RegenInfo["Group"][ CurStep ] for i = 1, #CurStepRegen do cGroupRegenInstance( Var["MapIndex"], CurStepRegen[i] ) end -- º¸½º Á¨( ÀÖÀ»°æ¿ì Only : 4, 9, 13, 19 Ãþ ) if RegenInfo["Mob"][ CurStep ] ~= nil then local RegenBoss = nil local BossHandle = nil for MobName, MobRegenInfo in pairs ( RegenInfo["Mob"][ CurStep ] ) do RegenBoss = MobRegenInfo BossHandle = cMobRegen_XY( Var["MapIndex"], RegenBoss["Index"], RegenBoss["x"], RegenBoss["y"], RegenBoss["dir"] ) end if BossHandle ~= nil then Var["Enemy"][ BossHandle ] = RegenBoss Var["EachFloor"..CurStepNo ]["BossHandle"] = BossHandle Var["RoutineTime"][ BossHandle ] = cCurrentSecond() cSetAIScript ( MainLuaScriptPath, BossHandle ) cAIScriptFunc( BossHandle, "Entrance", "BossRoutine" ) end end -- ÆäÀ̽ºÄÆ ´Ü°è ±¸ºÐ¿ë º¯¼ö ¼³Á¤ Var["EachFloor"..CurStepNo ]["StartDialogStepSec"] = Var["CurSec"] Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] = 1 Var["EachFloor"..CurStepNo ]["ClearDialogStepSec"] = Var["CurSec"] Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] = 1 Var["EachFloor"..CurStepNo ]["BossBattleDialogStepSec"] = Var["CurSec"] Var["EachFloor"..CurStepNo ]["BossBattleDialogStepNo"] = 1 -- ÆäÀ̽ºÄÆ Á¾·á ¿©ºÎ ¼³Á¤ Var["EachFloor"..CurStepNo ]["bStartDialogEnd"] = false Var["EachFloor"..CurStepNo ]["bClearDialogEnd"] = false Var["EachFloor"..CurStepNo ]["bBossBattleDialogEnd"] = false -- ¸÷ Àü¸ê ¿©ºÎ ¼³Á¤ Var["EachFloor"..CurStepNo ]["bMobEliminated"] = false Var["EachFloor"..CurStepNo ]["WaitMobGenSec"] = Var["CurSec"] + DelayTime["WaitAfterGenMob"] end -- ÇØ´ç ´Ü°è ½ÃÀÛ½ÃÀÇ ÆäÀ̽ºÄÆ if NPC_GuardChat["StartDialog"][ CurStep ] ~= nil then if Var["EachFloor"..CurStepNo ]["bStartDialogEnd"] == false then if Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] <= #NPC_GuardChat["StartDialog"][ CurStep ] then if Var["EachFloor"..CurStepNo ]["StartDialogStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], NPC_GuardChat["SpeakerIndex"], NPC_GuardChat["ScriptFileName"], NPC_GuardChat["StartDialog"][ CurStep ][ Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] ]["Index"] ) DebugLog( "EachFloor"..CurStepNo.."::Index("..NPC_GuardChat["StartDialog"][ CurStep ][ Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] ]["Index"].."), StepNo("..Var["EachFloor"..CurStepNo ]["StartDialogStepNo"]..")" ) Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] = Var["EachFloor"..CurStepNo ]["StartDialogStepNo"] + 1 Var["EachFloor"..CurStepNo ]["StartDialogStepSec"] = Var["CurSec"] + DelayTime["GapDialog"] end -- ÇØ´ç ÆäÀ̽ºÄÆ Å¸À̹ÖÀÌ µÉ ¶§±îÁö ´Ù¸¥±â´É ½ÇÇà ¾øÀÌ µô·¹ÀÌ °É±â return else -- ÆäÀ̽ºÄÆ Á¾·á Var["EachFloor"..CurStepNo ]["bStartDialogEnd"] = true end end else -- ÆäÀ̽ºÄÆ ÀÚü°¡ ¾øÀ» ¶§ Var["EachFloor"..CurStepNo ]["bStartDialogEnd"] = true end -- ¸÷ Àü¸êüũ if Var["EachFloor"..CurStepNo ]["bMobEliminated"] == false then if Var["EachFloor"..CurStepNo ]["WaitMobGenSec"] <= Var["CurSec"] then if cObjectCount( Var["MapIndex"], ObjectType["Mob"] ) <= 0 then Var["EachFloor"..CurStepNo ]["bMobEliminated"] = true end end return else -- ÇØ´ç Ãþ ¸÷ Àü¸ê ½Ã -- Ŭ¸®¾î ÆäÀ̽ºÄÆ if NPC_GuardChat["ClearDialog"][ CurStep ] ~= nil then if Var["EachFloor"..CurStepNo ]["bClearDialogEnd"] == false then if Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] <= #NPC_GuardChat["ClearDialog"][ CurStep ] then if Var["EachFloor"..CurStepNo ]["ClearDialogStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], NPC_GuardChat["SpeakerIndex"], NPC_GuardChat["ScriptFileName"], NPC_GuardChat["ClearDialog"][ CurStep ][ Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] ]["Index"] ) DebugLog( "EachFloor"..CurStepNo.."::Index("..NPC_GuardChat["ClearDialog"][ CurStep ][ Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] ]["Index"].."), StepNo("..Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"]..")" ) Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] = Var["EachFloor"..CurStepNo ]["ClearDialogStepNo"] + 1 Var["EachFloor"..CurStepNo ]["ClearDialogStepSec"] = Var["CurSec"] + DelayTime["GapDialog"] end -- ÇØ´ç ÆäÀ̽ºÄÆ Å¸À̹ÖÀÌ µÉ ¶§±îÁö ´Ù¸¥±â´É ½ÇÇà ¾øÀÌ µô·¹ÀÌ °É±â return else -- ÆäÀ̽ºÄÆ Á¾·á Var["EachFloor"..CurStepNo ]["bClearDialogEnd"] = true end end else -- ÆäÀ̽ºÄÆ ÀÚü°¡ ¾øÀ» ¶§ Var["EachFloor"..CurStepNo ]["bClearDialogEnd"] = true end end -- Next Case : ÇØ´ç ÃþÀÇ ¸÷ Àü¸ê ÈÄ Å¬¸®¾î ÆäÀ̽ºÄÆ ¿©ºÎ¿¡ µû¶ó ±× ÆäÀ̽º ÄÆÀÌ Á¾·áÇϸé. if Var["EachFloor"..CurStepNo ]["WaitMobGenSec"] <= Var["CurSec"] then if Var["EachFloor"..CurStepNo ]["bClearDialogEnd"] == true then -- ÇØ´ç Ãþ ¸÷ Àü¸ê »óȲÀÌ ¾Æ´Ñ°æ¿ì ´ÙÀ½´Ü°è·Î ³Ñ¾î°¡Áö ¾Ê´Â´Ù. if Var["EachFloor"..CurStepNo ]["bMobEliminated"] ~= true then return end -- Ŭ¸®¾î ¾×¼Ç if Var["Door"..CurStepNo ] ~= nil then cDoorAction( Var["Door"..CurStepNo ], Var["Door"][ Var["Door"..CurStepNo ] ]["Block"], "open" ) end -- ´ÙÀ½ ´Ü°è·Î Var["EachFloor"..CurStepNo ] = nil Var["EachFloor"]["StepNumber"] = CurStepNo + 1 DebugLog( "End EachFloor "..CurStepNo ) -- ¸ðµç Ãþ Ŭ¸®¾î ½Ã if Var["EachFloor"]["StepNumber"] > #StepNameTable then Var["EachFloor"] = nil GoToSuccess( Var ) return end return end end end -- Å·´ý Äù½ºÆ® Ŭ¸®¾î : ID ¿¡¼± ±â´É °ÅÀÇ ¾øÀ½ function QuestSuccess( Var ) cExecCheck "QuestSuccess" if Var == nil then return end DebugLog( "Start QuestSuccess" ) -- Quest Mob Kill ¼¼±â. cQuestMobKill_AllInMap( Var["MapIndex"], QuestMobKillInfo["QuestID"], QuestMobKillInfo["MobIndex"], QuestMobKillInfo["MaxKillCount"] ) GoToNextStep( Var ) DebugLog( "End QuestSuccess" ) end -- Å·´ý Äù½ºÆ® ½ÇÆÐ : ID ¿¡¼± ±â´É ¾øÀ½ function QuestFailed( Var ) cExecCheck "QuestFailed" if Var == nil then return end DebugLog( "Start QuestFailed" ) 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"] Var["ReturnToHome"]["ReturnNoticeIndex"] = "IDReturn" 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["GapIDReturnNotice"] end return end -- Return : linkto substep if Var["ReturnToHome"]["ReturnStepNo"] > #NoticeInfo[ sReturnNoticeIndex ] then if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"] then --Finish_ID cLinkToAll( Var["MapIndex"], LinkInfo["ReturnMapOnClear"]["MapIndex"], LinkInfo["ReturnMapOnClear"]["x"], LinkInfo["ReturnMapOnClear"]["y"] ) GoToNextStep( Var ) Var["ReturnToHome"] = nil DebugLog( "End ReturnToHome" ) end return end end -- ½ºÅÜ ±¸ºÐÀ» À§ÇÑ ´øÀü ÁøÇà ÇÔ¼ö ¸®½ºÆ® ID_StepsList = { { Function = InitDungeon, Name = "InitDungeon", }, { Function = EachFloor, Name = "EachFloor", }, { Function = QuestSuccess, Name = "QuestSuccess", }, { Function = QuestFailed, Name = "QuestFailed", }, { Function = ReturnToHome, Name = "ReturnToHome", }, } -- ¿ªÂüÁ¶ ¸®½ºÆ® ID_StepsIndexList = { } for index, funcValue in pairs ( ID_StepsList ) do ID_StepsIndexList[ funcValue["Name"] ] = index end