-------------------------------------------------------------------------------- -- Gold Hill 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 -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["InitDungeon"] == nil then DebugLog( "Start InitDungeon" ) local Doors = RegenInfo["Stuff"] Var["Door"] = {} -- ¹® »ý¼º for i = 1, #LayerNameTable do local LayerName = LayerNameTable[ i ] Var["Door"][ LayerName ] = cDoorBuild( Var["MapIndex"], Doors[ LayerName ]["Index"], Doors[ LayerName ]["x"], Doors[ LayerName ]["y"], Doors[ LayerName ]["dir"], Doors[ LayerName ]["scale"] ) if Var["Door"][ LayerName ] ~= nil then cSetAIScript ( MainLuaScriptPath, Var["Door"][ LayerName ] ) cAIScriptFunc( Var["Door"][ LayerName ], "NPCClick", "DoorClick" ) cDoorAction( Var["Door"][ LayerName ], Doors[ LayerName ]["Block"], "close" ) end end Var["InitDungeon"] = {} 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 -- ÀÎÆ®·Î function Intro( Var ) cExecCheck "Intro" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["Intro"] == nil then DebugLog( "Start Intro" ) Var["Intro"] = {} Var["Intro"]["DialogStepSec"] = Var["CurSec"] Var["Intro"]["DialogStepNo"] = 1 end -- ´ÙÀ̾ó·Î±×(ÆäÀ̽ºÄÆ) ´Ü°è üũ ¹× ½ÇÇà if Var["Intro"]["DialogStepNo"] <= #TombRaiderChat["Intro"] then -- ÆäÀ̽ºÄÆ Ã³¸® if Var["Intro"]["DialogStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], RegenInfo["Mob"]["TombRaider"]["Index"], TombRaiderChat["ScriptFileName"], TombRaiderChat["Intro"][ Var["Intro"]["DialogStepNo"] ]["Index"] ) Var["Intro"]["DialogStepSec"] = Var["CurSec"] + DelayTime["BetweenIntroDialog"] -- ´ÙÀ½ ÆäÀ̽º ÄÆ ¶ç¿ï ½Ã°£ ¼ÂÆà Var["Intro"]["DialogStepNo"] = Var["Intro"]["DialogStepNo"] + 1 -- ´ÙÀ½ ÆäÀ̽º ÄÆÀ¸·Î ´Ü°è ¼ÂÆà end else GoToNextStep( Var ) Var["Intro"] = nil DebugLog( "End Intro" ) return end end -- Ȳ±Ý¾ð´ø Layer 1 ~ 4 function LayerStep( Var ) cExecCheck "LayerStep" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["LayerStep"] == nil then Var["LayerStep"] = {} Var["LayerStep"]["LayerNumber"] = 1 end if Var["LayerStep"]["LayerNumber"] <= #LayerNameTable then local LayerName = LayerNameTable[ Var["LayerStep"]["LayerNumber"] ] if Var[ LayerName ] == nil then DebugLog( "Start LayerStep "..LayerName ) -- ¸ó½ºÅÍ ¼Òȯ local CurRegenLayer = RegenInfo["Group"][ LayerName ] for i = 1, #CurRegenLayer do cGroupRegenInstance( Var["MapIndex"], CurRegenLayer[i] ) end Var[ LayerName ] = {} -- Var[ LayerName ]["WaitSecDuringMobGen"] = Var["CurSec"] + DelayTime["AfterMobGen"] -- Á¦ÇÑ ½Ã°£ ¼³Á¤ Var["KQLimitTime"] = Var["CurSec"] + LimitTime[ LayerName ] cShowKQTimerWithLife( Var["MapIndex"], LimitTime[ LayerName ] ) return; end if Var[ LayerName ]["KeyCore"] == nil then -- ´ÙÀ̾ó·Î±× Ãâ·Â cMobDialog( Var["MapIndex"], RegenInfo["Mob"]["TombRaider"]["Index"], TombRaiderChat["ScriptFileName"], TombRaiderChat[ LayerName ]["Index"] ) -- ±¤¼® ¿­¼è µå¶ø ¼³Á¤ local TotalCore = 0 for i = 1, #ItemDrop["DropMob"] do local CoreList = { cFindNearestMobList( Var["MapIndex"], ItemDrop["DropMob"][ i ] ) } TotalCore = TotalCore + #CoreList for j = 1, #CoreList do if CoreList[ j ] ~= nil then cSetAIScript ( MainLuaScriptPath, CoreList[ j ] ) cAIScriptFunc( CoreList[ j ], "Entrance", "CoreBreakRoutine" ) end end end local ItemDropInfo = ItemDrop[ LayerName ] Var[ LayerName ]["KeyCore"] = {} Var[ LayerName ]["DeadCoreCount"] = 0 for i = 1, #ItemDropInfo do Var[ LayerName ]["KeyCore"][i] = cRandomInt( ItemDropInfo[i]["RandMin"], ItemDropInfo[i]["RandMax"] ) Var[ LayerName ]["KeyCore"][i] = (Var[ LayerName ]["KeyCore"][i] * TotalCore) / 100 end end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var[ LayerName ] = nil Var["LayerStep"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var[ LayerName ] = nil Var["LayerStep"] = nil return end else DebugLog( "End LayerStep" ) Var["LayerStep"] = nil GoToNextStep( Var ) return end end -- º¸½º ÀüÅõ function LastBattle( Var ) cExecCheck "LastBattle" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end -- ÃÖ»óÃþ ¼ÂÆà if Var["LastBattle"] == nil then DebugLog( "Start LastBattle" ) local RegenTombRaider = RegenInfo["Mob"]["TombRaider"] Var["Enemy"]["TombRaider"] = cMobRegen_XY( Var["MapIndex"], RegenTombRaider["Index"], RegenTombRaider["x"], RegenTombRaider["y"], RegenTombRaider["dir"] ) Var["LastBattle"] = {} Var["LastBattle"]["DialogStepSec"] = Var["CurSec"] Var["LastBattle"]["DialogStepNo"] = 1 -- Á¦ÇÑ ½Ã°£ ¼³Á¤ Var["KQLimitTime"] = Var["CurSec"] + LimitTime[ "LastBattle" ] cShowKQTimerWithLife( Var["MapIndex"], LimitTime[ "LastBattle" ] ) end -- ´ÙÀ̾ó·Î±×(ÆäÀ̽ºÄÆ) ´Ü°è üũ ¹× ½ÇÇà if Var["LastBattle"]["DialogStepNo"] <= #TombRaiderChat["LastBattle"] then -- ´ÙÀ̾ó·Î±× ó¸® if Var["LastBattle"]["DialogStepSec"] <= Var["CurSec"] then cMobDialog( Var["MapIndex"], RegenInfo["Mob"]["TombRaider"]["Index"], TombRaiderChat["ScriptFileName"], TombRaiderChat["LastBattle"][ Var["LastBattle"]["DialogStepNo"] ]["Index"] ) Var["LastBattle"]["DialogStepSec"] = Var["CurSec"] + DelayTime["BetweenLastBattleDialog"] -- ´ÙÀ½ ÆäÀ̽ºÄÆ ¶ç¿ï ½Ã°£ ¼ÂÆà Var["LastBattle"]["DialogStepNo"] = Var["LastBattle"]["DialogStepNo"] + 1 -- ´ÙÀ½ ´Ü°è º¯È£ ¼ÂÆà end end -- Fail Case : Àü¸ê ½Ã ȤÀº Ç÷¹À̾ ¾Æ¹«µµ ¾øÀ» °æ¿ì if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0 then GoToFail( Var ) Var["LastBattle"] = nil return end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["LastBattle"] = nil return end -- local bEndLastBattle = true if Var["Enemy"]["TombRaider"] ~= nil then if cIsObjectDead( Var["Enemy"]["TombRaider"] ) == nil then bEndLastBattle = false end end -- Success Case : if bEndLastBattle == true then GoToNextStep( Var ) Var["LastBattle"] = nil Var["Enemy"]["TombRaider"] = nil DebugLog( "End LastBattle" ) return end end -- Å·´ý Äù½ºÆ® ¿Ï·á °ÔÀÌÆ® function EndGate( Var ) cExecCheck "EndGate" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() end if Var["EndGate"] == nil then DebugLog( "Start EndGate" ) local RegenNPC = RegenInfo["NPC"]["Gate"] local NPCHandle = cMobRegen_XY( Var["MapIndex"], RegenNPC["Index"], RegenNPC["x"], RegenNPC["y"], RegenNPC["dir"] ) if NPCHandle ~= nil then cSetAIScript ( MainLuaScriptPath, NPCHandle ) cAIScriptFunc( NPCHandle, "Entrance", "DummyFunc" ) cAIScriptFunc( NPCHandle, "NPCClick", "EndGateClick" ) end Var["EndGate"] = {} end -- Fail Case : ŸÀÓ ¿À¹ö if IsKQTimeOver( Var ) == true then GoToFail( Var ) Var["LastBattle"] = nil return end end -- Å·´ý Äù½ºÆ® Ŭ¸®¾î function QuestSuccess( Var ) cExecCheck "QuestSuccess" if Var == nil then return end DebugLog( "Start 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"] ) GoToNextStep( Var ) Var["QuestSuccess"] = nil 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" ) Var["QuestFailed"] = {} end -- ±Íȯ function ReturnToHome( Var ) cExecCheck "ReturnToHome" if Var == nil then return end -- 1Ãʸ¶´Ù üũ if Var["CurSec"] + 1 > cCurrentSecond() then return else Var["CurSec"] = cCurrentSecond() 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 = Intro, Name = "Intro", }, { Function = LayerStep, Name = "LayerStep", }, { Function = LastBattle, Name = "LastBattle", }, { Function = EndGate, Name = "EndGate", }, { 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