예제 #1
0
 public static void AddPlayer(ClientInfo _cInfo)
 {
     if (!Teams.ContainsKey(_cInfo.playerId))
     {
         if (Teams.Count >= PlayerCount)
         {
             ChatHook.ChatMessage(_cInfo, "The event is full. Unable to join.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             Vector3 _position  = _player.GetPosition();
             int     x          = (int)_position.x;
             int     y          = (int)_position.y;
             int     z          = (int)_position.z;
             string  _sposition = x + "," + y + "," + z;
             PersistentContainer.Instance.Players[_cInfo.playerId].EventReturnPosition = _sposition;
             PersistentContainer.Instance.Save();
             ChatHook.ChatMessage(_cInfo, "You have signed up for the event and your current location has been saved for return.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         EventCommandsConsole.Setup.TryGetValue(Operator, out List <string> _setup);
         Teams.Add(_cInfo.playerId, TeamSetup);
         string _message = "You are on team {Team}.";
         _message = _message.Replace("{Team}", TeamSetup.ToString());
         ChatHook.ChatMessage(_cInfo, _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         TeamSetup--;
         if (TeamSetup == 0)
         {
             TeamSetup = TeamCount;
         }
         if (Teams.Count == PlayerCount)
         {
             Invited = false;
             foreach (var _teamPlayer in Teams)
             {
                 ClientInfo _eventClientInfo = ConnectionManager.Instance.Clients.ForPlayerId(_teamPlayer.Key);
                 if (_eventClientInfo != null)
                 {
                     EntityPlayer _eventPlayer = GameManager.Instance.World.Players.dict[_eventClientInfo.entityId];
                     if (_eventPlayer != null && _eventPlayer.IsAlive())
                     {
                         Teams.TryGetValue(_teamPlayer.Key, out int _teamNumber);
                         string   _spawnPosition = _setup[_teamNumber + 4];
                         int      _x, _y, _z;
                         string[] _cords = _spawnPosition.Split(',');
                         int.TryParse(_cords[0], out _x);
                         int.TryParse(_cords[1], out _y);
                         int.TryParse(_cords[2], out _z);
                         _eventClientInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false));
                         ChatHook.ChatMessage(_eventClientInfo, LoadConfig.Chat_Response_Color + "You have been sent to your event spawn point.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                     else
                     {
                         PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                         PersistentContainer.Instance.Save();
                     }
                 }
                 else
                 {
                     PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                     PersistentContainer.Instance.Save();
                 }
             }
             int _eventTime = Time * 60;
             Timers._eventTime = _eventTime;
             Open     = true;
             _message = "{EventName} has now started.";
             _message = _message.Replace("{EventName}", EventName);
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             _message = "{EventName} still has space for more players. Type " + ChatHook.Command_Private + Command100 + ".";
             _message = _message.Replace("{EventName}", EventName);
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             _message = "{Count} of {PlayerTotal} have joined the event.";
             _message = _message.Replace("{Count}", Teams.Count.ToString());
             _message = _message.Replace("{PlayerTotal}", PlayerCount.ToString());
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
     }
     else
     {
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You have already joined this event. It will start when enough players sign up.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
예제 #2
0
 public static void AddPlayer(ClientInfo _cInfo)
 {
     if (!Teams.ContainsKey(_cInfo.playerId))
     {
         if (Teams.Count >= PlayerCount)
         {
             Phrases.Dict.TryGetValue(773, out string _phrase773);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase773 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             Vector3 _position  = _player.GetPosition();
             int     x          = (int)_position.x;
             int     y          = (int)_position.y;
             int     z          = (int)_position.z;
             string  _sposition = x + "," + y + "," + z;
             PersistentContainer.Instance.Players[_cInfo.playerId].EventReturnPosition = _sposition;
             PersistentContainer.Instance.Save();
             Phrases.Dict.TryGetValue(774, out string _phrase774);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase774 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         EventCommandsConsole.Setup.TryGetValue(Operator, out List <string> _setup);
         Teams.Add(_cInfo.playerId, TeamSetup);
         Phrases.Dict.TryGetValue(775, out string _phrase775);
         _phrase775 = _phrase775.Replace("{Value}", TeamSetup.ToString());
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase775 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         TeamSetup--;
         if (TeamSetup == 0)
         {
             TeamSetup = TeamCount;
         }
         if (Teams.Count == PlayerCount)
         {
             Invited = false;
             foreach (var _teamPlayer in Teams)
             {
                 ClientInfo _eventClientInfo = ConnectionManager.Instance.Clients.ForPlayerId(_teamPlayer.Key);
                 if (_eventClientInfo != null)
                 {
                     EntityPlayer _eventPlayer = GameManager.Instance.World.Players.dict[_eventClientInfo.entityId];
                     if (_eventPlayer != null && _eventPlayer.IsAlive())
                     {
                         Teams.TryGetValue(_teamPlayer.Key, out int _teamNumber);
                         string   _spawnPosition = _setup[_teamNumber + 4];
                         int      _x, _y, _z;
                         string[] _cords = _spawnPosition.Split(',');
                         int.TryParse(_cords[0], out _x);
                         int.TryParse(_cords[1], out _y);
                         int.TryParse(_cords[2], out _z);
                         _eventClientInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false));
                     }
                     else
                     {
                         PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                         PersistentContainer.Instance.Save();
                     }
                 }
                 else
                 {
                     PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                     PersistentContainer.Instance.Save();
                 }
             }
             int _eventTime = Time * 60;
             Timers._eventTime = _eventTime;
             Open = true;
             Phrases.Dict.TryGetValue(776, out string _phrase776);
             _phrase776 = _phrase776.Replace("{EventName}", TeamSetup.ToString());
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase776 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             Phrases.Dict.TryGetValue(777, out string _phrase777);
             _phrase777 = _phrase777.Replace("{EventName}", TeamSetup.ToString());
             _phrase777 = _phrase777.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase777 = _phrase777.Replace("{Command100}", Command100);
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase777 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             Phrases.Dict.TryGetValue(778, out string _phrase778);
             _phrase778 = _phrase778.Replace("{Value}", Teams.Count.ToString());
             _phrase778 = _phrase778.Replace("{PlayerTotal}", PlayerCount.ToString());
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase778 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
     }
     else
     {
         Phrases.Dict.TryGetValue(779, out string _phrase779);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase779 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
예제 #3
0
 public static void AddPlayer(ClientInfo _cInfo)
 {
     if (!Teams.ContainsKey(_cInfo.CrossplatformId.CombinedString))
     {
         if (Teams.Count >= PlayerCount)
         {
             Phrases.Dict.TryGetValue("Event3", out string _phrase);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
         EntityPlayer player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (player != null)
         {
             Vector3 _position = player.GetPosition();
             int     x         = (int)_position.x;
             int     y         = (int)_position.y;
             int     z         = (int)_position.z;
             string  sposition = x + "," + y + "," + z;
             PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].EventReturnPosition = sposition;
             PersistentContainer.DataChange = true;
             Phrases.Dict.TryGetValue("Event4", out string phrase);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         EventCommandsConsole.Setup.TryGetValue(Operator, out List <string> setup);
         Teams.Add(_cInfo.CrossplatformId.CombinedString, TeamSetup);
         Phrases.Dict.TryGetValue("Event5", out string phrase1);
         phrase1 = phrase1.Replace("{Value}", TeamSetup.ToString());
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase1 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         TeamSetup--;
         if (TeamSetup == 0)
         {
             TeamSetup = TeamCount;
         }
         if (Teams.Count == PlayerCount)
         {
             Invited = false;
             foreach (var teamPlayer in Teams)
             {
                 ClientInfo eventClientInfo = PersistentOperations.GetClientInfoFromNameOrId(teamPlayer.Key);
                 if (eventClientInfo != null)
                 {
                     EntityPlayer eventPlayer = GameManager.Instance.World.Players.dict[eventClientInfo.entityId];
                     if (eventPlayer != null && eventPlayer.IsAlive())
                     {
                         Teams.TryGetValue(teamPlayer.Key, out int _teamNumber);
                         string   spawnPosition = setup[_teamNumber + 4];
                         string[] cords         = spawnPosition.Split(',');
                         int.TryParse(cords[0], out int x);
                         int.TryParse(cords[1], out int y);
                         int.TryParse(cords[2], out int z);
                         eventClientInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false));
                     }
                     else
                     {
                         PersistentContainer.Instance.Players[eventClientInfo.CrossplatformId.CombinedString].EventSpawn = true;
                         PersistentContainer.DataChange = true;
                     }
                 }
                 else
                 {
                     PersistentContainer.Instance.Players[eventClientInfo.CrossplatformId.CombinedString].EventSpawn = true;
                     PersistentContainer.DataChange = true;
                 }
             }
             int eventTime = Time * 60;
             Timers.eventTime = eventTime;
             Open             = true;
             Phrases.Dict.TryGetValue("Event6", out string _phrase);
             _phrase = _phrase.Replace("{EventName}", TeamSetup.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             Phrases.Dict.TryGetValue("Event7", out string _phrase);
             _phrase = _phrase.Replace("{EventName}", TeamSetup.ToString());
             _phrase = _phrase.Replace("{Command_Prefix1}", ChatHook.Chat_Command_Prefix1);
             _phrase = _phrase.Replace("{Command_join}", Command_join);
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
             Phrases.Dict.TryGetValue("Event8", out _phrase);
             _phrase = _phrase.Replace("{Value}", Teams.Count.ToString());
             _phrase = _phrase.Replace("{PlayerTotal}", PlayerCount.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
     }
     else
     {
         Phrases.Dict.TryGetValue("Event9", out string _phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }