-------------------------------------------------------------------------------- -- Arena Progress Func -- -------------------------------------------------------------------------------- function InitSoccer( Var ) cExecCheck "InitSoccer" if Var == nil then ErrorLog( "InitSoccer : Var nil" ) return end -- Ç÷¹À̾îÀÇ Ã¹ ·Î±×ÀÎÀ» ±â´Ù¸°´Ù. if #Var["Player"] < 1 then if Var["InitialSec"] + WAIT_PLAYER_MAP_LOGIN_SEC_MAX <= cCurrentSecond() then cEndOfKingdomQuest( Var[ "MapIndex" ] ) return end return end -- Åõ¸íÇÑ Door¸¦ ¼ÒȯÇØ DoorBlock °ü·Á°¡ ÇÊ¿äÇÔ. local RegenInvisibleDoor = RegenInfo["InvisibleDoor"] Var["InvisibleDoor"] = cDoorBuild( Var["MapIndex"], RegenInvisibleDoor["Index"], RegenInvisibleDoor["X"], RegenInvisibleDoor["Y"], RegenInvisibleDoor["Dir"], 1000 ) if Var["InvisibleDoor"] == nil then GoToFail( Var, "Invisible door regen fail" ) return end cDoorAction( Var["InvisibleDoor"], InvisibleDoor["BlockName"], "open" ) -- Ã౸°ø ¼Òȯ SoccerBall_Regen( Var, RegenInfo["SoccerBall"]["X"], RegenInfo["SoccerBall"]["Y"], RegenInfo["SoccerBall"]["Dir"] ) cDoorAction( Var["InvisibleDoor"], InvisibleDoor["BlockName"], "close" ) -- ½ÉÆÇ ¼Òȯ local RegenReferee = RegenInfo["Referee"] local RefereeHandle RefereeHandle = cMobRegen_XY( Var["MapIndex"], RegenReferee["Index"], RegenReferee["X"], RegenReferee["Y"], RegenReferee["Dir"] ) if RefereeHandle == nil then GoToFail( Var, "Referee regen fail" ) return end Var["Referee"]["Handle"] = RefereeHandle Var["Referee"]["FollowCheckTime"] = 0 Var["Referee"]["RoutineCheckTime"] = 0 cSetAIScript ( MainLuaScriptPath, RefereeHandle ) cAIScriptFunc( RefereeHandle, "Entrance", "Referee_Routine" ) -- °ñÅ°ÆÛ ¼Òȯ for i = 1, #RegenInfo["GoalKeeper"] do local RegenKeeper = RegenInfo["GoalKeeper"][ i ] local KeeperHandle KeeperHandle = cMobRegen_XY( Var["MapIndex"], RegenKeeper["Index"], RegenKeeper["X"], RegenKeeper["Y"], RegenKeeper["Dir"] ) if KeeperHandle == nil then GoToFail( Var, "Goalkeeper regen fail" ) return end Var["Keeper"][ i ] = {} Var["Keeper"][ i ]["Handle"] = KeeperHandle Var["Keeper"][ i ]["TeamType"] = RegenKeeper["TeamType"] Var["Keeper"][ i ]["RoutineCheckTime"] = 0 Var["Keeper"][ i ]["MoveStep"] = 1 Var["Keeper"][ i ]["MoveBack"] = false cSetAIScript ( MainLuaScriptPath, KeeperHandle ) cAIScriptFunc( KeeperHandle, "Entrance", "Keeper_Routine" ) end -- °üÁß ¼Òȯ for i = 1, #RegenInfo["Spectator"] do cGroupRegenInstance( Var["MapIndex"], RegenInfo["Spectator"][i] ) end -- Åõ¸í ¸ó½ºÅÍ ¼Òȯ for i = 1, #RegenInfo[ "InvisibleMonster" ] do local RegenInvisibleMonster = RegenInfo[ "InvisibleMonster" ][ i ] local InvisibleMonsterHandle InvisibleMonsterHandle = cMobRegen_XY( Var["MapIndex"], RegenInvisibleMonster[ "Index" ], RegenInvisibleMonster[ "X" ], RegenInvisibleMonster[ "Y" ], RegenInvisibleMonster[ "Dir" ] ) if InvisibleMonsterHandle == nil then GoToFail( Var, "InvisibleMonster regen fail" ) return end local setScriptResult = cSetAIScript( MainLuaScriptPath, InvisibleMonsterHandle ) --ÇØ´ç ½ºÅ©¸³Æ®ÀÇ LuaScriptScenario* ¸¦ ã¾Æ¼­, ÇØ´ç ¸ó½ºÅÍ¿¡ ¼ÂÆÃÇØÁÝ´Ï´Ù. ¸»ÇÏÀÚ¸é ¸ó½ºÅÍ°¡ AI¸¦ ÇнÀÇϴ°ÍÀ̶ó°í ÇÒ¼öÀÖ½À´Ï´Ù. local setEntranceFunctionResult = cAIScriptFunc( InvisibleMonsterHandle, "Entrance", "InvisibleMonster_Routine" ) --ÇØ´ç ¸ó½ºÅÍÀÇ LuaAi ³» Entrance ¹®ÀÚ¿­¿¡, InvisibleMonster_Routine ·ç¾ÆÇÔ¼ö À̸§ ¹®ÀÚ¿­À» ¼¼ÆÃÇÕ´Ï´Ù. if setScriptResult == nil or setScriptResult == 0 or setEntranceFunctionResult == nil or setEntranceFunctionResult == 0 then GoToFail( Var, "InvisibleMonster setAI fail" ) return end Var[ "InvisibleMonster" ][ i ] = {} Var[ "InvisibleMonster" ][ i ][ "Handle" ] = InvisibleMonsterHandle Var[ "InvisibleMonster" ][ i ][ "MonsterNumber" ] = RegenInvisibleMonster[ "MonsterNumber" ] Var[ "InvisibleMonster" ][ i ][ "RoutineCheckTime" ] = 0 Var[ "InvisibleMonster" ][ i ][ "MoveStep" ] = 1 Var[ "InvisibleMonster" ][ i ][ "MoveBack" ] = false end -- ´ÙÀ½ ´Ü°è ¼³Á¤ Var["StepFunc"] = StartWait end function StartWait( Var ) cExecCheck "StartWait" if Var == nil then ErrorLog( "StartWait : Var nil" ) return end -- ½ºÅÜ ÃʱâÈ­ local StartWaitInfo = Var["StartWait"] if StartWaitInfo == nil then Var["StartWait"] = {} StartWaitInfo = Var["StartWait"] StartWaitInfo["NextSetpWaitTime"] = Var["CurSec"] + DelayTime["StartWait"] StartWaitInfo["DialogTime"] = Var["CurSec"] + DelayTime["StartDialogInterval"] StartWaitInfo["DialogStep"] = 1 end -- ´ÙÀ̾ó·Î±× Ãâ·Â if StartWaitInfo["DialogTime"] ~= nil then if StartWaitInfo["DialogTime"] <= Var["CurSec"] then local DialogStep = StartWaitInfo["DialogStep"] local MaxDialogStep = #Referee_Chat["StartDialog"] if DialogStep <= MaxDialogStep then cScriptMsg( Var["MapIndex"], nil, Referee_Chat["StartDialog"][ DialogStep ] ) StartWaitInfo["DialogTime"] = Var["CurSec"] + DelayTime["StartDialogInterval"] StartWaitInfo["DialogStep"] = DialogStep + 1 end if StartWaitInfo["DialogStep"] > MaxDialogStep then StartWaitInfo["DialogTime"] = nil StartWaitInfo["DialogStep"] = nil end end end -- ´ÙÀ½ ´Ü°è ÁøÇà if StartWaitInfo["NextSetpWaitTime"] <= Var["CurSec"] then Var["StepFunc"] = SoccerProcess Var["StartWait"] = nil StartWaitInfo = nil end end function SoccerProcess( Var ) cExecCheck "SoccerProcess" if Var == nil then ErrorLog( "SoccerProcess : Var nil" ) return end -- ½ºÅÇ ÃʱâÈ­ if Var["KQLimitTime"] == 0 then Var["KQLimitTime"] = Var[ "CurSec"] + DelayTime["LimitTime"] cScriptMsg( Var["MapIndex"], nil, NoticeInfo["Start"] ) -- cScoreInfo_AllInMap( Var["MapIndex"], KQ_TEAM["MAX"], Var["Team"][ KQ_TEAM["RED"] ], Var["Team"][ KQ_TEAM["BLUE"] ] ) cWinter_Event_ScoreBoard_AllInMap( Var["MapIndex"], Var["Team"][ KQ_TEAM["RED"] ], Var["Team"][ KQ_TEAM["BLUE"] ] ) cTimer( Var["MapIndex"], DelayTime["LimitTime"] ) end -- ´ÙÀ½ ´Ü°è ÁøÇà if Var["KQLimitTime"] <= Var["CurSec"] then Var["StepFunc"] = SoccerEnd cScriptMsg( Var["MapIndex"], nil, NoticeInfo["End"] ) cScriptMsg( Var["MapIndex"], Var["Referee"]["Handle"], Referee_Chat["TimeOut"] ) return end -- Ç÷¹ÀÌ¾î °ü¸®ÀÚ if Player_Manager( Var ) == false then -- ¾î´À ÇÑÂÊ ÆÀÀÌ ÀüºÎ ·Î±×¾Æ¿ôµÇ¾úÀ» °æ¿ì Var["Team"][ KQ_TEAM["RED"] ] = 0 Var["Team"][ KQ_TEAM["BLUE"] ] = 0 Var["StepFunc"] = SoccerEnd cScriptMsg( Var["MapIndex"], nil, NoticeInfo["End"] ) cScriptMsg( Var["MapIndex"], Var["Referee"]["Handle"], Referee_Chat["TimeOut"] ) return end BuffBox_Manager( Var ) SoccerBall_Manager( Var ) end -- °æ±â Á¾·á function SoccerEnd( Var ) cExecCheck "SoccerEnd" if Var == nil then ErrorLog( "SoccerEnd : Var nil" ) return end local TeamInfo = Var["Team"] if TeamInfo == nil then ErrorLog( "SoccerEnd : Var[\"Team\"] nil" ) return end local PlayerList = Var["Player"] if PlayerList == nil then ErrorLog( "SoccerEnd : PlayerList nil" ) return end Var["KQLimitTime"] = 0 cTimer( Var["MapIndex"], 0 ) local TeamReward = {} local WinnerTeam = nil -- ·¹µå ÆÀ ¿ì½Â if TeamInfo[ KQ_TEAM["RED"] ] > TeamInfo[ KQ_TEAM["BLUE"] ] then cScriptMsg( Var["MapIndex"], nil, NoticeInfo["Win"][ KQ_TEAM["RED"] ] ) TeamReward[ KQ_TEAM["RED"] ] = SoccerResult["WIN"] TeamReward[ KQ_TEAM["BLUE"] ] = SoccerResult["LOSE"] WinnerTeam = KQ_TEAM["RED"] -- ºí·ç ÆÀ ¿ì½Â elseif TeamInfo[ KQ_TEAM["RED"] ] < TeamInfo[ KQ_TEAM["BLUE"] ] then cScriptMsg( Var["MapIndex"], nil, NoticeInfo["Win"][ KQ_TEAM["BLUE"] ] ) TeamReward[ KQ_TEAM["RED"] ] = SoccerResult["LOSE"] TeamReward[ KQ_TEAM["BLUE"] ] = SoccerResult["WIN"] WinnerTeam = KQ_TEAM["BLUE"] -- µ¿Á¡ else cScriptMsg( Var["MapIndex"], nil, NoticeInfo["Draw"] ) TeamReward[ KQ_TEAM["RED"] ] = SoccerResult["DRAW"] TeamReward[ KQ_TEAM["BLUE"] ] = SoccerResult["DRAW"] end -- º¸»ó Áö±Þ for i = 1, #PlayerList do local PlayerInfo = PlayerList[ i ] local RewardInfo = TeamReward[ PlayerInfo["TeamType"] ] if PlayerInfo["IsInMap"] == true and RewardInfo ~= nil then cEffectMsg( PlayerInfo["Handle"], RewardInfo["EffectMsg"] ) cKQRewardIndex( PlayerInfo["Handle"], RewardInfo["RewardIndex"] ) cCharTitleAddValue( PlayerInfo["Handle"], SoccerResult["SoccerPlayerTitle"], 1 ) end end -- ÃÖ°í µæÁ¡ÀÚ Å¸ÀÌƲ if WinnerTeam ~= nil then local TopScore = 0 -- °¡Àå ³ôÀº Á¡¼ö ã±â for i = 1, #PlayerList do local PlayerInfo = PlayerList[ i ] if PlayerInfo["IsInMap"] == true then if TopScore < PlayerInfo["Goal"] then TopScore = PlayerInfo["Goal"] end end end if TopScore ~= 0 then for i = 1, #PlayerList do local PlayerInfo = PlayerList[ i ] if PlayerInfo["IsInMap"] == true then if TopScore == PlayerInfo["Goal"] then cCharTitleAddValue( PlayerInfo["Handle"], SoccerResult["SoccerTopScorerTitle"], 1 ) end end end end end -- µµ¾î »èÁ¦ cNPCVanish( Var["InvisibleDoor"] ) -- Ã౸°ø »èÁ¦ if Var["SoccerBall"] ~= nil then cNPCVanish( Var["SoccerBall"] ) end -- ½ÉÆÇ »èÁ¦ if Var["Referee"] ~= nil then cNPCVanish( Var["Referee"]["Handle"] ) end -- °ñÅ°ÆÛ »èÁ¦ if Var["Keeper"] ~= nil then for i = 1, #Var["Keeper"] do if Var["Keeper"][ i ]["Handle"] ~= nil then cNPCVanish( Var["Keeper"][ i ]["Handle"] ) end end end -- ¹öÇÁ¹Ú½º »èÁ¦ for i = 1,#RegenInfo["BuffBox"] do cVanishAll( Var["MapIndex"], RegenInfo["BuffBox"][ i ]["Index"] ) end -- ¸ó½ºÅÍ »èÁ¦ if Var[ "InvisibleMonster" ] ~= nil then for i = 1, #Var[ "InvisibleMonster" ] do if Var[ "InvisibleMonster" ][ i ][ "Handle" ] ~= nil then cNPCVanish( Var[ "InvisibleMonster" ][ i ][ "Handle" ] ) end end end -- ´ÙÀ½ ´Ü°è ¼³Á¤ Var["StepFunc"] = ReturnToHome end -- ±Íȯ function ReturnToHome( Var ) cExecCheck "ReturnToHome" if Var == nil then ErrorLog( "ReturnToHome : Var nil" ) 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["KQReturn"]["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["GapKQReturnNotice"] end return end --[[ --º¯½ÅÀ» ÇØÁ¦½ÃÄÑÁÝ´Ï´Ù local PlayerList = Var[ "Player" ] if PlayerList ~= nil then for i = 1, #PlayerList do local TargetPlayerInfo = PlayerList[ i ] if TargetPlayerInfo ~= nil --and TargetPlayerInfo[ "IsInMap" ] == true then cResetAbstate( TargetPlayerInfo[ "Handle" ], LoginSetAbstate[ TargetPlayerInfo[ "TeamType" ] ] ) end end 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"] ) cVanishAll(); Var["ReturnToHome"] = nil if cEndOfKingdomQuest( Var["MapIndex"] ) == nil then ErrorLog( "ReturnToHome::Function cEndOfKingdomQuest failed" ) end end return end end