-------------------------------------------------------------------------------- -- KDArena Routine -- -------------------------------------------------------------------------------- function DummyRoutineFunc( ) cExecCheck "DummyRoutineFunc" end ---------------------------------------------------------------------- -- MapLogin Function ---------------------------------------------------------------------- function PlayerMapLogin( MapIndex, Handle ) cExecCheck "PlayerMapLogin" -- »ç¿ëÇÒ µ¥ÀÌÅÍ : Å·´ý Äù½ºÆ® Á¤º¸, ÇöÀç½Ã°£, Ç÷¹À̾î ÆÀ ¹øÈ£, Ç÷¹À̾î ij¸¯ ¹øÈ£ local Var = InstanceField[ MapIndex ] local CurSec = cCurrentSecond() local TeamNumber = cGetKQTeamType( Handle ) + 1 local CharNo = cGetCharNo( Handle ) DebugLog( "TeamNumer : "..TeamNumber ) if Var == nil then return end if CurSec == nil then return end if TeamNumber == nil then return end if CharNo == nil then return end -- Ç÷¹ÀÌ¾î ¼ö, ÇÚµé, Ãß°¡ ¿©ºÎ, local PlayerCount = #Var[ "Player" ] local OldHandle = 0 local PlayerInsert = true -- Ç÷¹ÀÌ¾î ¸ñ·Ï ã±â for i = 1, PlayerCount do if CharNo == Var[ "Player" ][ i ][ "CharNo" ] then -- Ç÷¹À̾î Ãß°¡ ¿©ºÎ, ÇÚµé ¼³Á¤ PlayerInsert = false OldHandle = Var[ "Player" ][ i ][ "Handle" ] Var[ "Player" ][ i ][ "Handle" ] = Handle Var[ "Player" ][ i ][ "FlagPickSec" ] = CurSec + ArenaFlag[ "PickDelay" ] Var[ "Player" ][ i ][ "InMap" ] = true -- Ç÷¹À̾î ÆÀ ¹øÈ£°¡ ´Ù¸¦ °æ¿ì if TeamNumber ~= Var[ "Player" ][ i ][ "TeamNumber" ] then -- ÆÀ Á¤º¸ local DelTeamNumber = Var[ "Player" ][ i ][ "TeamNumber" ] local TeamMemberCount = #Var[ "Team" ][ DelTeamNumber ][ "Member" ] -- ÆÀ ¸â¹ö ¸ñ·Ï¿¡¼­ »èÁ¦ for DelMemberIndex = 1, TeamMemberCount do if Var[ "Team" ][ DelTeamNumber ][ "Member" ] == OldHandle then for MoveIndex = DelMemberIndex, ( TeamMemberCount - 1 ) do Var[ "Team" ][ DelTeamNumber ][ "Member" ][ MoveIndex ] = Var[ "Team" ][ DelTeamNumber ][ "Member" ][ ( MoveIndex + 1 ) ] end Var[ "Team" ][ DelTeamNumber ][ "Member" ][ TeamMemberCount ] = nil break end end -- Ç÷¹ÀÌ¾î ¸ñ·Ï¿¡¼­ »èÁ¦ for MoveIndex = i, ( PlayerCount - 1 ) do Var[ "Player" ][ MoveIndex ] = Var[ "Player" ][ ( MoveIndex + 1 ) ] end Var[ "Player" ][ PlayerCount ] = nil return end break end end if PlayerInsert == true then ------------------------------------------------------------ -- Ç÷¹À̾î Á¤º¸ Ãß°¡ ------------------------------------------------------------ if TeamNumber >= DEF_TEAM then return end local P_InsertIndex = ( PlayerCount + 1 ) local T_InsertIndex = ( #Var[ "Team" ][ TeamNumber ][ "Member" ] + 1 ) -- Ç÷¹ÀÌ¾î ¸ñ·Ï¿¡ Ãß°¡ Var[ "Player" ][ P_InsertIndex ] = {} Var[ "Player" ][ P_InsertIndex ][ "Handle" ] = Handle Var[ "Player" ][ P_InsertIndex ][ "CharNo" ] = CharNo Var[ "Player" ][ P_InsertIndex ][ "FlagPickSec" ] = CurSec + ArenaFlag[ "PickDelay" ] Var[ "Player" ][ P_InsertIndex ][ "InMap" ] = true Var[ "Player" ][ P_InsertIndex ][ "TeamNumber" ] = TeamNumber -- ÆÀ ¸â¹ö ¸ñ·Ï¿¡ Ãß°¡ Var["Team"][ TeamNumber ][ "Member" ][ T_InsertIndex ] = Handle elseif OldHandle ~= Handle then ------------------------------------------------------------ -- Ç÷¹À̾î Á¤º¸ ¼öÁ¤ ------------------------------------------------------------ local MemberCount = #Var["Team"][ TeamNumber ][ "Member" ] -- ÆÀ ¸â¹ö Á¤º¸ ¼öÁ¤ for i = 1, MemberCount do if OldHandle == Var["Team"][ TeamNumber ][ "Member" ][ i ] then Var["Team"][ TeamNumber ][ "Member" ][ i ] = Handle break end end end -- ÆÀ À¯´ÏÆû Âø¿ë for i = 1, #TeamUniform[ TeamNumber ] do cViewSlotEquip( Handle, TeamUniform[ TeamNumber ][ i ] ) end -- °ÔÀÓÀÌ ÁøÇà ÁßÀÌ ¾Æ´Ï¸é ÇÔ¼ö Á¾·á if Var[ "KQLimitTime" ] <= 0 then return end -- ¾Æ·¹³ª Á¡¼ö, ½Ã°£ Á¤º¸ Àü¼Û cScoreInfo( Handle, #TeamNumberList, Var[ "Team" ][ RED_TEAM ][ "Score" ], Var[ "Team" ][ BLUE_TEAM ][ "Score" ] ) cTimer_Obj( Handle, ( Var[ "KQLimitTime" ] - CurSec ) ) end ---------------------------------------------------------------------- -- Click Functions ---------------------------------------------------------------------- function ArenaGate_Click( NPCHandle, PlayerHandle, PlayerCharNo, Arg ) cExecCheck "ArenaGate_Click" -- ¸ÊÀ妽º °¡Á®¿À±â local NPCMapIndex = cGetCurMapIndex( NPCHandle ) if NPCMapIndex == nil then return end -- »ç¿ëÇÒ µ¥ÀÌÅÍ : Å·´ý Äù½ºÆ® Á¤º¸ local Var = InstanceField[ NPCMapIndex ] if Var == nil then return end if Var[ "ArenaGate" ] == nil then return end -- °ÔÀÌÆ® Á¤º¸ ã±â local WarpInfo = nil for i = 1, Var[ "ArenaGate" ][ "Count" ] do if Var[ "ArenaGate" ][ i ] == NPCHandle then WarpInfo = WarpGate[ i ] if WarpInfo == nil then return end break end end -- Ç÷¹À̾î ÆÀ È®ÀÎ for i = 1, #Var[ "Player" ] do if Var[ "Player" ][ i ][ "CharNo" ] == PlayerCharNo then if Var[ "Player" ][ i ][ "TeamNumber" ] == WarpInfo[ "Team" ] then cCastTeleport( PlayerHandle, "SpecificCoord", WarpInfo[ "X" ], WarpInfo[ "Y" ] ); end end end end ---------------------------------------------------------------------- -- Entrance Functions ---------------------------------------------------------------------- function ArenaFlag_Entrance( Handle, MapIndex ) cExecCheck "ArenaFlag_Entrance" -- »ç¿ëÇÒ µ¥ÀÌÅÍ : Å·´ý Äù½ºÆ® Á¤º¸, ÇöÀç½Ã°£ local Var = InstanceField[ MapIndex ] local CurSec = cCurrentSecond() if Var == nil then return ReturnAI[ "END" ] end if CurSec == nil then return ReturnAI[ "END" ] end if Var[ "KQLimitTime" ] == 0 then return ReturnAI[ "END" ] end local ArenaFlagInfo = Var[ "ArenaFlag" ] if ArenaFlagInfo == nil then return ReturnAI[ "END" ] end -- ÆÀ ¹øÈ£ ã±â local FlagTeamNumber = DEF_TEAM for i = 1, #TeamNumberList do if ArenaFlagInfo[ TeamNumberList[ i ] ][ "Handle" ] == Handle then FlagTeamNumber = TeamNumberList[ i ] end end if FlagTeamNumber == DEF_TEAM then return ReturnAI[ "END" ] end ------------------------------------------------------------ -- µå¶ø 30 ÃÊ ÈÄ ÀÌÁ¨ À§Ä¡·Î À̵¿ ------------------------------------------------------------ if ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] ~= nil then if ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] <= CurSec then local Regen_Flag = RegenInfo[ "NPC" ][ "ArenaFlag" ][ FlagTeamNumber ] local Regen_Handle = nil -- ±ê¹ß »èÁ¦ cNPCVanish( Handle ) ArenaFlagInfo[ FlagTeamNumber ][ "Handle" ] = nil -- ±ê¹ß ¼Òȯ Regen_Handle = cMobRegen_XY( Var[ "MapIndex" ], Regen_Flag[ "Index" ], Regen_Flag[ "X" ], Regen_Flag[ "Y" ], Regen_Flag[ "Dir" ] ) if Regen_Handle ~= nil then cSetAIScript ( MainLuaScriptPath, Regen_Handle ) cAIScriptFunc( Regen_Handle, "Entrance", "ArenaFlag_Entrance" ) ArenaFlagInfo[ FlagTeamNumber ][ "Handle" ] = Regen_Handle ArenaFlagInfo[ FlagTeamNumber ][ "PlayerHandle" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "PlayerTeam" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "X" ] = Regen_Flag[ "X" ] ArenaFlagInfo[ FlagTeamNumber ][ "Y" ] = Regen_Flag[ "Y" ] ArenaFlagInfo[ FlagTeamNumber ][ "GoalConditionNoticeTime"] = nil ArenaFlagInfo[ FlagTeamNumber ][ "Penalty"] = nil end -- ±ê¹ß ȸ¼ö ¾Ë¸² cScriptMessage( Var[ "MapIndex" ], ArenaFlag[ FlagTeamNumber ][ "ScriptMsg" ][ "Return_Flag" ] ) return ReturnAI[ "END" ] end end ------------------------------------------------------------ -- ±Ùó¿¡ Ç÷¹À̾ ÀÖÀ» °æ¿ì ------------------------------------------------------------ local PlayerList = { cNearObjectList( Handle, ArenaFlag[ "CheckDistance_Falg" ], ObjectType[ "Player" ] ) } for i = 1, #PlayerList do -- ¾Æ·¹³ª¿¡ Âü¿©ÁßÀÎ Ç÷¹ÀÌ¾î ¸ñ·Ï°ú ºñ±³ for PlayerIndex = 1, #Var[ "Player" ] do -- ÇÚµé, ±ê¹ß ȹµæ °¡´É ½Ã°£ ºñ±³ if Var[ "Player" ][ PlayerIndex ][ "Handle" ] == PlayerList[ i ] and Var[ "Player" ][ PlayerIndex ][ "FlagPickSec" ] <= CurSec then -- »óÅÂÀÌ»ó È®ÀÎ( Àº½Å, Æú¸®¸ðÇÁ ) local bAbstateCheck = false for j = 1, #ArenaFlag[ "Drop_Abstate" ] do if cAbstateRestTime( PlayerList[ i ], ArenaFlag[ "Drop_Abstate" ][ j ] ) ~= nil then bAbstateCheck = true break end end if bAbstateCheck == false then if Var[ "Player" ][ PlayerIndex ][ "TeamNumber" ] == FlagTeamNumber then if ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] ~= nil then ------------------------------------------------------------ -- ¾Æ±º : ±ê¹ß ¸®Á¨ Æ÷ÀÎÆ®¿¡ ¼Òȯ ------------------------------------------------------------ local Regen_Flag = RegenInfo[ "NPC" ][ "ArenaFlag" ][ FlagTeamNumber ] local Regen_Handle = nil -- ±ê¹ß »èÁ¦ cNPCVanish( Handle ) ArenaFlagInfo[ FlagTeamNumber ][ "Handle" ] = nil -- ±ê¹ß ¼Òȯ Regen_Handle = cMobRegen_XY( Var[ "MapIndex" ], Regen_Flag[ "Index" ], Regen_Flag[ "X" ], Regen_Flag[ "Y" ], Regen_Flag[ "Dir" ] ) if Regen_Handle ~= nil then cSetAIScript ( MainLuaScriptPath, Regen_Handle ) cAIScriptFunc( Regen_Handle, "Entrance", "ArenaFlag_Entrance" ) ArenaFlagInfo[ FlagTeamNumber ][ "Handle" ] = Regen_Handle ArenaFlagInfo[ FlagTeamNumber ][ "PlayerHandle" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "PlayerTeam" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "X" ] = Regen_Flag[ "X" ] ArenaFlagInfo[ FlagTeamNumber ][ "Y" ] = Regen_Flag[ "Y" ] ArenaFlagInfo[ FlagTeamNumber ][ "GoalConditionNoticeTime" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "Penalty"] = nil end -- ±ê¹ß ȸ¼ö ¾Ë¸² cScriptMessage( Var[ "MapIndex" ], ArenaFlag[ FlagTeamNumber ][ "ScriptMsg" ][ "Return_Flag" ] ) return ReturnAI[ "END" ] end else ------------------------------------------------------------ -- Àû±º : ±ê¹ß ȹµæ ------------------------------------------------------------ -- local FlagData = ArenaFlag[ FlagTeamNumber ] local PenaltyData = ArenaFlag["Penalty"] local Player_X, Player_Y = cObjectLocate( Handle ) if X == nil or Y == nil then Player_X = 0 Player_Y = 0 end -- ±ê¹ß Á¤º¸ ¼³Á¤ ArenaFlagInfo[ FlagTeamNumber ][ "Handle" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "PlayerHandle" ] = Var[ "Player" ][ PlayerIndex ][ "Handle" ] ArenaFlagInfo[ FlagTeamNumber ][ "PlayerTeam" ] = Var[ "Player" ][ PlayerIndex ][ "TeamNumber" ] ArenaFlagInfo[ FlagTeamNumber ][ "Drop_LifeTime" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "X" ] = Player_X ArenaFlagInfo[ FlagTeamNumber ][ "Y" ] = Player_Y ArenaFlagInfo[ FlagTeamNumber ][ "GoalConditionNoticeTime" ] = nil ArenaFlagInfo[ FlagTeamNumber ][ "Penalty"] = {} ArenaFlagInfo[ FlagTeamNumber ][ "Penalty"]["Step"] = 1 ArenaFlagInfo[ FlagTeamNumber ][ "Penalty"]["CheckTime"] = CurSec + PenaltyData["Step"][ 1 ]["CheckTick"] -- ±ê¹ß ȹµæÀÚ »óÅÂÀÌ»ó °É±â cSetAbstate( PlayerList[i], FlagData["Abstate"]["Index"], FlagData["Abstate"]["Str"], FlagData["Abstate"]["KeepTime"] ) -- ±ê¹ß ȹµæÀÚ ÆгÎƼ ºÎ¿© for PenaltyIndex = 1, #PenaltyData["Abstate"] do cSetAbstate( PlayerList[i], PenaltyData["Abstate"][PenaltyIndex]["Index"], PenaltyData["Abstate"][PenaltyIndex]["Str"], PenaltyData["Abstate"][PenaltyIndex]["KeepTime"] ) end -- ¸ñÀûÁö ¹æÇâ Ç¥½Ã cDirectionalArrow( PlayerList[ i ], ArenaFlag[ FlagTeamNumber ][ "GoalPoint" ][ "X" ], ArenaFlag[ FlagTeamNumber ][ "GoalPoint" ][ "Y" ] ) -- ±ê¹ß ȹµæ ¾Ë¸®±â local PlayerName = cGetPlayerName( PlayerList[ i ] ) if PlayerName == nil then PlayerName = "" end cScriptMessage( Var[ "MapIndex" ], ArenaFlag[ FlagTeamNumber ][ "ScriptMsg" ][ "Have_Flag" ], PlayerName ) cNPCVanish( Handle ) return ReturnAI[ "END" ] end end break end end end return ReturnAI[ "END" ] end function ArenaStone_Entrance( Handle, MapIndex ) cExecCheck "ArenaStone_Entrance" -- »ç¿ëÇÒ µ¥ÀÌÅÍ : Å·´ý Äù½ºÆ® Á¤º¸, ÇöÀç½Ã°£ local Var = InstanceField[ MapIndex ] local CurSec = cCurrentSecond() if Var == nil then return ReturnAI[ "END" ] end if CurSec == nil then return ReturnAI[ "END" ] end if Var[ "ArenaStone" ] == nil then return ReturnAI[ "END" ] end if Var[ "ArenaStone" ][ "SkillUseTime" ] == nil then return ReturnAI[ "END" ] end if Var[ "ArenaStone" ][ "SkillUseTime" ][ Handle ] == nil then -- ½ºÅ³ »ç¿ë½Ã°£ÀÌ ¼³Á¤µÇ¾îÀÖÁö ¾ÊÀ¸¸é ¼³Á¤ÇØÁØ´Ù. Var[ "ArenaStone" ][ "SkillUseTime" ][ Handle ] = CurSec + ArenaStone[ "IntervalTime" ] return ReturnAI[ "END" ] end -- ½ºÅ³ »ç¿ë½Ã°£ È®ÀÎ if Var[ "ArenaStone" ][ "SkillUseTime" ][ Handle ] <= CurSec then -- ½ºÅ³ »ç¿ë cSkillBlast( Handle, Handle, ArenaStone[ "SkillIndex" ] ) -- ´ÙÀ½ ½ºÅ³ »ç¿ë½Ã°£ ¼³Á¤ Var[ "ArenaStone" ][ "SkillUseTime" ][ Handle ] = CurSec + ArenaStone[ "IntervalTime" ] end return ReturnAI[ "END" ] end function ArenaCrystal_Entrance( Handle, MapIndex ) cExecCheck "ArenaCrystal" -- »ç¿ëÇÒ µ¥ÀÌÅÍ : Å·´ý Äù½ºÆ® Á¤º¸, ÇöÀç½Ã°£, Å©¸®½ºÅ» HP Á¤º¸ local Var = InstanceField[ MapIndex ] local CurSec = cCurrentSecond() local CurHP, MaHP = cObjectHP( Handle ) if Var == nil then return ReturnAI[ "END" ] end if CurSec == nil then return ReturnAI[ "END" ] end if CurHP == nil then return returnAI[ "END" ] end if Var[ "ArenaCrystal" ] == nil then return ReturnAI[ "END" ] end -- Å©¸®½ºÅ» HP ¿¡ µû¸¥ ó¸® if CurHP > 1 then ------------------------------------------------------------ -- ÀÏÁ¤ °£°ÝÀ¸·Î »ç¿ëÇÏ´Â ½ºÅ³ ------------------------------------------------------------ if Var[ "ArenaCrystal" ][ "SkillUseTime" ] == nil then -- ½ºÅ³ »ç¿ë½Ã°£ÀÌ ¼³Á¤µÇ¾îÀÖÁö ¾ÊÀ¸¸é ¼³Á¤ÇØÁØ´Ù. Var[ "ArenaCrystal" ][ "SkillUseTime" ] = CurSec + ArenaCrystal[ "Routine" ][ "BlastTime" ] return ReturnAI[ "END" ] end -- ½ºÅ³ »ç¿ë½Ã°£ È®ÀÎ if Var[ "ArenaCrystal" ][ "SkillUseTime" ] <= CurSec then -- Å©¸®½ºÅ» À§Ä¡ °¡Á®¿À±â local X, Y = cObjectLocate( Handle ) if X == nil or Y == nil then return ReturnAI[ "END" ] end -- ½ºÅ³ »ç¿ë --cMagicFieldSpread( Handle, X, Y, 0, ArenaCrystal[ "Routine" ][ "MagicField" ], 0 ) cSkillBlast( Handle, Handle, ArenaCrystal[ "Routine" ][ "SkillIndex" ] ) -- ´ÙÀ½ ½ºÅ³ »ç¿ë½Ã°£ ¼³Á¤ Var[ "ArenaCrystal" ][ "SkillUseTime" ] = CurSec + ArenaCrystal[ "Routine" ][ "BlastTime" ] end else ------------------------------------------------------------ -- Á×À»¶§ »ç¿ëÇÏ´Â ½ºÅ³ ------------------------------------------------------------ if Var[ "ArenaCrystal" ][ "SkillUseTime" ] ~= nil then if Var[ "ArenaCrystal" ][ "SkillUseTime" ] <= CurSec then -- ½ºÅ³»ç¿ë cSkillBlast( Handle, Handle, ArenaCrystal[ "Dead" ][ "SkillIndex" ] ) Var[ "ArenaCrystal" ][ "SkillUseTime" ] = nil Var[ "ArenaCrystal" ][ "VanishTime" ] = CurSec + ArenaCrystal[ "Dead" ][ "BlastTime" ] end end -- ¼Ò¸ê½Ã°£ È®ÀÎ if Var[ "ArenaCrystal" ][ "VanishTime" ] ~= nil then if Var[ "ArenaCrystal" ][ "VanishTime" ] <= CurSec then -- ÇÚµé ÃʱâÈ­ Var[ "ArenaCrystal" ][ "Handle" ] = nil -- ½ºÅ©¸³Æ® ÇØÁ¦, ¿ÀºêÁ§Æ® ¼Ò¸ê cAIScriptSet( Handle ) cKillObject( Handle ) end end end return ReturnAI[ "END" ] end