Ejemplo n.º 1
0
 public static void SetJail(ClientInfo _cInfo)
 {
     string[] _command1 = { Command26 };
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_command1, _cInfo))
     {
         Phrases.Dict.TryGetValue(199, out string _phrase199);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase199 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             int    _x         = (int)_player.position.x;
             int    _y         = (int)_player.position.y;
             int    _z         = (int)_player.position.z;
             string _sposition = _x + "," + _y + "," + _z;
             Jail_Position = _sposition;
             LoadConfig.WriteXml();
             Phrases.Dict.TryGetValue(192, out string _phrase192);
             _phrase192 = _phrase192.Replace("{JailPosition}", Jail_Position);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase192 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Ejemplo n.º 2
0
 public static void Set(ClientInfo _cInfo)
 {
     string[] _command = { Market.Command102 };
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_command, _cInfo))
     {
         string _phrase107;
         if (!Phrases.Dict.TryGetValue(107, out _phrase107))
         {
             _phrase107 = "You do not have permissions to use this command.";
         }
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase107 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         Vector3      _position  = _player.GetPosition();
         int          x          = (int)_position.x;
         int          y          = (int)_position.y;
         int          z          = (int)_position.z;
         string       _mposition = x + "," + y + "," + z;
         Market_Position = _mposition;
         string _phrase565;
         if (!Phrases.Dict.TryGetValue(565, out _phrase565))
         {
             _phrase565 = "You have set the market position as {MarketPosition}.";
         }
         _phrase565 = _phrase565.Replace("{MarketPosition}", Market_Position);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase565 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         LoadConfig.WriteXml();
     }
 }
Ejemplo n.º 3
0
 public static void Set(ClientInfo _cInfo)
 {
     string[] _command = { Command87 };
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_command, _cInfo))
     {
         Phrases.Dict.TryGetValue(248, out string _phrase248);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase248 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         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  _lposition = x + "," + y + "," + z;
             Lobby_Position = _lposition;
             LoadConfig.WriteXml();
             Phrases.Dict.TryGetValue(242, out string _phrase242);
             _phrase242 = _phrase242.Replace("{LobbyPosition}", Lobby_Position);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase242 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Ejemplo n.º 4
0
 public static void SetJail(ClientInfo _cInfo)
 {
     string[] _command1 = { Command26 };
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_command1, _cInfo))
     {
         string _phrase107;
         if (!Phrases.Dict.TryGetValue(107, out _phrase107))
         {
             _phrase107 = "You do not have permissions to use this command.";
         }
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase107 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             int    _x         = (int)_player.position.x;
             int    _y         = (int)_player.position.y;
             int    _z         = (int)_player.position.z;
             string _sposition = _x + "," + _y + "," + _z;
             Jail_Position = _sposition;
             string _phrase502;
             if (!Phrases.Dict.TryGetValue(502, out _phrase502))
             {
                 _phrase502 = "You have set the jail position as {JailPosition}.";
             }
             _phrase502 = _phrase502.Replace("{JailPosition}", Jail_Position);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase502 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             LoadConfig.WriteXml();
         }
     }
 }
Ejemplo n.º 5
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             Stuck.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Stuck has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             Stuck.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Stuck has been set to on"));
             return;
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in StuckConsole.Run: {0}.", e));
     }
 }
Ejemplo n.º 6
0
 public static void SetNewSpawnTele(ClientInfo _cInfo)
 {
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_cmd, _cInfo.playerId))
     {
         string _phrase107;
         if (!Phrases.Dict.TryGetValue(107, out _phrase107))
         {
             _phrase107 = " you do not have permissions to use this command.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         Vector3      _position  = _player.GetPosition();
         int          x          = (int)_position.x;
         int          y          = (int)_position.y;
         int          z          = (int)_position.z;
         string       _sposition = x + "," + y + "," + z;
         New_Spawn_Tele_Position = _sposition;
         string _phrase525;
         if (!Phrases.Dict.TryGetValue(525, out _phrase525))
         {
             _phrase525 = " you have set the New Spawn position as {NewSpawnTelePosition}.";
         }
         _phrase525 = _phrase525.Replace("{NewSpawnTelePosition}", New_Spawn_Tele_Position);
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase525 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         LoadConfig.WriteXml();
     }
 }
Ejemplo n.º 7
0
 public static void Set(ClientInfo _cInfo)
 {
     string[] _command = { Command87 };
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_command, _cInfo.playerId))
     {
         string _phrase107;
         if (!Phrases.Dict.TryGetValue(107, out _phrase107))
         {
             _phrase107 = " you do not have permissions to use this command.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         Vector3      _position  = _player.GetPosition();
         int          x          = (int)_position.x;
         int          y          = (int)_position.y;
         int          z          = (int)_position.z;
         string       _lposition = x + "," + y + "," + z;
         Lobby_Position = _lposition;
         string _phrase551;
         if (!Phrases.Dict.TryGetValue(551, out _phrase551))
         {
             _phrase551 = " you have set the lobby position as {LobbyPosition}.";
         }
         _phrase551 = _phrase551.Replace("{LobbyPosition}", Lobby_Position);
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase551 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         LoadConfig.WriteXml();
     }
 }
Ejemplo n.º 8
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             TeleportHome.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Set home has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             TeleportHome.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Set home has been set to on"));
             return;
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length < 1 || _params[1].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not reset Id: Invalid Id {0}", _params[1]));
                 return;
             }
             PersistentPlayer p = PersistentContainer.Instance.Players[_params[1]];
             if (p != null)
             {
                 PersistentContainer.Instance.Players[_params[1]].LastHome1 = DateTime.Now.AddYears(-1);
                 PersistentContainer.Instance.Players[_params[1]].LastHome2 = DateTime.Now.AddYears(-1);
                 PersistentContainer.Instance.Save();
                 SdtdConsole.Instance.Output(string.Format("Home delay reset for {0}.", _params[1]));
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a Home delay to reset.", _params[1]));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in SetHomeConsole.Run: {0}.", e));
     }
 }
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count > 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 0 or 1, found {0}", _params.Count));
             return;
         }
         if (_params.Count == 0)
         {
             SdtdConsole.Instance.Output(string.Format("Starting backup"));
             AutoBackup.Exec();
             SdtdConsole.Instance.Output(string.Format("Backup complete"));
             return;
         }
         else if (_params[0].ToLower().Equals("off"))
         {
             if (AutoBackup.IsEnabled)
             {
                 AutoBackup.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Auto backup has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auto backup is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!AutoBackup.IsEnabled)
             {
                 AutoBackup.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Auto backup has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auto backup is already on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AutoBackup.Execute: {0}", e));
     }
 }
Ejemplo n.º 10
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             Lobby.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Lobby has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             Lobby.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Lobby has been set to on"));
             return;
         }
         else if (_params[0] == ("set"))
         {
             ClientInfo   _cInfo     = _senderInfo.RemoteClientInfo;
             EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             Vector3      _position  = _player.GetPosition();
             int          x          = (int)_position.x;
             int          y          = (int)_position.y;
             int          z          = (int)_position.z;
             string       _lposition = x + "," + y + "," + z;
             Lobby.Lobby_Position = _lposition;
             string _phrase551;
             if (!Phrases.Dict.TryGetValue(551, out _phrase551))
             {
                 _phrase551 = "{PlayerName} you have set the lobby position as {LobbyPosition}";
             }
             _phrase551 = _phrase551.Replace("{PlayerName}", _cInfo.playerName);
             _phrase551 = _phrase551.Replace("{LobbyPosition}", _lposition);
             SdtdConsole.Instance.Output(string.Format("{0}", _phrase551));
             LoadConfig.WriteXml();
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in CommandJailConsole.Execute: {0}", e.Message));
     }
 }
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (AutoShutdown.IsEnabled)
             {
                 AutoShutdown.IsEnabled = false;
                 LoadConfig.WriteXml();
                 StopServer.StopServerCountingDown = false;
                 SdtdConsole.Instance.Output(string.Format("Auto shutdown has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auto shutdown is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!AutoShutdown.IsEnabled)
             {
                 AutoShutdown.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Auto shutdown has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auto shutdown is already on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AutoShutdownConsole.Execute: {0}", e));
     }
 }
Ejemplo n.º 12
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ChatHook.Normal_Player_Color_Prefix)
             {
                 ChatHook.Normal_Player_Color_Prefix = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Normal player coloring has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Normal player coloring is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (ChatHook.Normal_Player_Color_Prefix)
             {
                 ChatHook.Normal_Player_Color_Prefix = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Normal player coloring has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Normal player coloring is already on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in NormalPlayerColoringConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 13
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ChatHook.ChatFlood)
             {
                 ChatHook.ChatFlood = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Chat flood protection has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Chat flood protection is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!ChatHook.ChatFlood)
             {
                 ChatHook.ChatFlood = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Chat flood protection has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Chat flood protection is already on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ChatFloodProtectionConsole.Execute: {0}", e));
     }
 }
Ejemplo n.º 14
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (InvalidItems.IsEnabled)
             {
                 InvalidItems.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid item kicker has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid item kicker is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!InvalidItems.IsEnabled)
             {
                 InvalidItems.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid item kicker has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid item kicker is already on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in InvalidItemKickerConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 15
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output("Wrong number of arguments.");
             return;
         }
         if (!int.TryParse(_params[0], out HighPingKicker.Max_Ping))
         {
             SdtdConsole.Instance.Output("Maxping is not an integer.");
             return;
         }
         SdtdConsole.Instance.Output(string.Format("Max ping limit set to {0}", HighPingKicker.Max_Ping));
         LoadConfig.WriteXml();
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ReservedSlotConsole.Run: {0}.", e));
     }
 }
Ejemplo n.º 16
0
 public static void SetNewSpawnTele(ClientInfo _cInfo)
 {
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_cmd, _cInfo))
     {
         Phrases.Dict.TryGetValue(217, out string _phrase217);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase217 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         Vector3      _position  = _player.GetPosition();
         int          x          = (int)_position.x;
         int          y          = (int)_position.y;
         int          z          = (int)_position.z;
         string       _sposition = x + "," + y + "," + z;
         New_Spawn_Tele_Position = _sposition;
         LoadConfig.WriteXml();
         Phrases.Dict.TryGetValue(211, out string _phrase211);
         _phrase211 = _phrase211.Replace("{Position}", New_Spawn_Tele_Position);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase211 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Ejemplo n.º 17
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count == 3 || _params.Count == 4 || _params.Count > 5)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, 2 or 5, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             Tracking.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Tracking has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             Tracking.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Tracking has been set to on"));
             return;
         }
         else if (_params.Count == 2)
         {
             int _hours, _range;
             if (int.TryParse(_params[0], out _hours))
             {
                 if (int.TryParse(_params[1], out _range))
                 {
                     List <string> PlayerInRange = new List <string>();
                     string        _sql          = string.Format("SELECT * FROM Tracking ORDER BY dateTime DESC");
                     DataTable     _result       = SQL.TypeQuery(_sql);
                     if (_result.Rows.Count > 0)
                     {
                         bool         _found  = false;
                         EntityPlayer _player = GameManager.Instance.World.Players.dict[_senderInfo.RemoteClientInfo.entityId];
                         SdtdConsole.Instance.Output(string.Format("Tracking results at a range of {0} blocks:", _range));
                         foreach (DataRow row in _result.Rows)
                         {
                             DateTime _dateTime;
                             DateTime.TryParse(row.ItemArray.GetValue(1).ToString(), out _dateTime);
                             if (_dateTime.AddHours(_hours) >= DateTime.Now)
                             {
                                 string[] _cords = row.ItemArray.GetValue(2).ToString().Split(' ');
                                 int      _x, _y, _z;
                                 int.TryParse(_cords[0], out _x);
                                 int.TryParse(_cords[1], out _y);
                                 int.TryParse(_cords[2], out _z);
                                 Vector3 _trackedVecPos = new Vector3(_x, _y, _z);
                                 if (RangeCheck(_player.position, _trackedVecPos, _range))
                                 {
                                     _found = true;
                                     string _playerId   = row.ItemArray.GetValue(3).ToString();
                                     string _playerName = row.ItemArray.GetValue(4).ToString();
                                     string _itemHeld   = row.ItemArray.GetValue(5).ToString();
                                     if (!PlayerInRange.Contains(_playerId))
                                     {
                                         PlayerInRange.Add(_playerId);
                                         SdtdConsole.Instance.Output(string.Format("Player: {0}, SteamId: {1}, Time: {2}, Position: {3} {4} {5}, Item Held: {6}", _playerName, _playerId, _dateTime, _x, _y, _z, _itemHeld));
                                     }
                                 }
                             }
                         }
                         if (!_found)
                         {
                             SdtdConsole.Instance.Output(string.Format("Tracking results found nobody at this time and range inside your current position"));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("No tracking positions are recorded in the database"));
                     }
                     _result.Dispose();
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
             }
             return;
         }
         else if (_params.Count == 5)
         {
             int _hours, _range, _worldX, _worldY, _worldZ;
             if (int.TryParse(_params[0], out _hours))
             {
                 if (int.TryParse(_params[1], out _range))
                 {
                     if (int.TryParse(_params[2], out _worldX))
                     {
                         if (int.TryParse(_params[3], out _worldY))
                         {
                             if (int.TryParse(_params[4], out _worldZ))
                             {
                                 string    _sql    = string.Format("SELECT * FROM Tracking ORDER BY dateTime DESC");
                                 DataTable _result = SQL.TypeQuery(_sql);
                                 if (_result.Rows.Count > 0)
                                 {
                                     bool          _found        = false;
                                     List <string> PlayerInRange = new List <string>();
                                     SdtdConsole.Instance.Output(string.Format("Tracking results at a range of {0} blocks:", _range));
                                     foreach (DataRow row in _result.Rows)
                                     {
                                         DateTime _dateTime;
                                         DateTime.TryParse(row.ItemArray.GetValue(1).ToString(), out _dateTime);
                                         if (_dateTime.AddHours(_hours) >= DateTime.Now)
                                         {
                                             string[] _cords = row.ItemArray.GetValue(2).ToString().Split(' ');
                                             int      _x, _y, _z;
                                             int.TryParse(_cords[0], out _x);
                                             int.TryParse(_cords[1], out _y);
                                             int.TryParse(_cords[2], out _z);
                                             Vector3 _worldVecPos   = new Vector3(_worldX, _worldY, _worldZ);
                                             Vector3 _trackedVecPos = new Vector3(_x, _y, _z);
                                             if (RangeCheck(_worldVecPos, _trackedVecPos, _range))
                                             {
                                                 _found = true;
                                                 string _playerId   = row.ItemArray.GetValue(3).ToString();
                                                 string _playerName = row.ItemArray.GetValue(4).ToString();
                                                 string _itemHeld   = row.ItemArray.GetValue(5).ToString();
                                                 if (!PlayerInRange.Contains(_playerId))
                                                 {
                                                     PlayerInRange.Add(_playerId);
                                                     SdtdConsole.Instance.Output(string.Format("Player: {0}, SteamId: {1}, Time: {2}, Position: {3} {4} {5}, Item Held: {6}", _playerName, _playerId, _dateTime, _x, _y, _z, _itemHeld));
                                                 }
                                             }
                                         }
                                     }
                                     if (!_found)
                                     {
                                         SdtdConsole.Instance.Output(string.Format("Tracking results found nobody at this time and range inside the specified position"));
                                     }
                                 }
                                 else
                                 {
                                     SdtdConsole.Instance.Output(string.Format("No tracking positions are recorded in the database"));
                                 }
                                 _result.Dispose();
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[4]));
                             }
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[3]));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[2]));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
             }
             return;
         }
         else
         {
             SdtdConsole.Instance.Output("Invalid arguments.");
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in TrackingConsole.Run: {0}.", e));
     }
 }
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 3, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (Watchlist.IsEnabled)
             {
                 Watchlist.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Watch list has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Watch list is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Watchlist.IsEnabled)
             {
                 Watchlist.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Watch list has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Watch list is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId: Invalid SteamId {0}", _params[1]));
                 return;
             }
             if (Watchlist.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId. {0} is already in the Watchlist.", _params[1]));
                 return;
             }
             if (_params.Count == 3)
             {
                 Watchlist.Dict.Add(_params[1], _params[2]);
                 SdtdConsole.Instance.Output(string.Format("Added SteamId {0} with the reason {1} the Watchlist.", _params[1], _params[2]));
             }
             Watchlist.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (!Watchlist.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("SteamId {0} was not found", _params[1]));
                 return;
             }
             Watchlist.Dict.Remove(_params[1]);
             SdtdConsole.Instance.Output(string.Format("Removed SteamId {0} from the Watchlist", _params[1]));
             Watchlist.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             if (Watchlist.Dict.Count < 1)
             {
                 SdtdConsole.Instance.Output("There are no steamIds on the Watchlist");
                 return;
             }
             foreach (KeyValuePair <string, string> _key in Watchlist.Dict)
             {
                 string _output = string.Format("{0} {1}", _key.Key, _key.Value);
                 SdtdConsole.Instance.Output(_output);
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in WatchlistConsole.Execute: {0}", e));
     }
 }
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1 && _params.Count != 2 && _params.Count != 5)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, 2 or 5, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ProtectedSpaces.IsEnabled)
             {
                 ProtectedSpaces.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Protected_Spaces has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Protected spaces is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!ProtectedSpaces.IsEnabled)
             {
                 ProtectedSpaces.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Protected_Spaces has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Protected spaces is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 1 && _params.Count != 5)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 5, found {0}", _params.Count));
                 return;
             }
             if (_params.Count == 1)
             {
                 if (_senderInfo.RemoteClientInfo == null)
                 {
                     SdtdConsole.Instance.Output(string.Format("Not a client"));
                     return;
                 }
                 EntityPlayer _player = PersistentOperations.GetEntityPlayer(_senderInfo.RemoteClientInfo.playerId);
                 if (_player != null)
                 {
                     if (!ProtectedSpaces.Vectors.ContainsKey(_player.entityId))
                     {
                         int      _x = (int)_player.position.x, _z = (int)_player.position.z;
                         string[] _vector1 = { _x.ToString(), _z.ToString() };
                         ProtectedSpaces.Vectors.Add(_player.entityId, _vector1);
                         SdtdConsole.Instance.Output(string.Format("The first position has been set to {0}x,{1}z", _x, _z));
                         SdtdConsole.Instance.Output("Stand in the opposite corner and use add. Use cancel to clear the saved location and start again");
                         return;
                     }
                     else
                     {
                         string[] _vector1;
                         ProtectedSpaces.Vectors.TryGetValue(_player.entityId, out _vector1);
                         ProtectedSpaces.Vectors.Remove(_player.entityId);
                         int xMin = int.Parse(_vector1[0]), zMin = int.Parse(_vector1[1]), xMax = (int)_player.position.x, zMax = (int)_player.position.z;
                         int _xMinAlt = xMin, _zMinAlt = zMin, _xMaxAlt = xMax, _zMaxAlt = zMax;
                         if (xMin > xMax)
                         {
                             _xMinAlt = xMax;
                             _xMaxAlt = xMin;
                         }
                         if (zMin > zMax)
                         {
                             _zMinAlt = zMax;
                             _zMaxAlt = zMin;
                         }
                         string[] _vector = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() };
                         if (!ProtectedSpaces.ProtectedList.Contains(_vector))
                         {
                             ProtectedSpaces.Add(_vector);
                             SdtdConsole.Instance.Output(string.Format("Added protected space from {0},{1} to {2},{3}", _xMinAlt, _zMinAlt, _xMaxAlt, _zMaxAlt));
                             return;
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("This protected space is already on the list"));
                             return;
                         }
                     }
                 }
             }
             else if (_params.Count == 5)
             {
                 int xMin, zMin, xMax, zMax;
                 if (!int.TryParse(_params[1], out xMin))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[1]));
                     return;
                 }
                 if (!int.TryParse(_params[2], out zMin))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[2]));
                     return;
                 }
                 if (!int.TryParse(_params[3], out xMax))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[3]));
                     return;
                 }
                 if (!int.TryParse(_params[4], out zMax))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[4]));
                     return;
                 }
                 int _xMinAlt = xMin, _zMinAlt = zMin, _xMaxAlt = xMax, _zMaxAlt = zMax;
                 if (xMin > xMax)
                 {
                     _xMinAlt = xMax;
                     _xMaxAlt = xMin;
                 }
                 if (zMin > zMax)
                 {
                     _zMinAlt = zMax;
                     _zMaxAlt = zMin;
                 }
                 string[] _vector = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() };
                 if (!ProtectedSpaces.ProtectedList.Contains(_vector))
                 {
                     ProtectedSpaces.Add(_vector);
                     SdtdConsole.Instance.Output(string.Format("Added protected space from {0},{1} to {2},{3}", _xMinAlt, _zMinAlt, _xMaxAlt, _zMaxAlt));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("This protected space is already on the list"));
                     return;
                 }
             }
         }
         else if (_params[0].ToLower().Equals("cancel"))
         {
             if (_senderInfo.RemoteClientInfo == null)
             {
                 SdtdConsole.Instance.Output(string.Format("Not a client"));
                 return;
             }
             if (ProtectedSpaces.IsEnabled && ProtectedSpaces.Vectors.ContainsKey(_senderInfo.RemoteClientInfo.entityId))
             {
                 ProtectedSpaces.Vectors.Remove(_senderInfo.RemoteClientInfo.entityId);
                 SdtdConsole.Instance.Output(string.Format("Cancelled the saved first position for a protected space. Use add to start again"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("You have no saved position for a protected space. Use add in the first corner you want to protect"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count == 2)
             {
                 if (ProtectedSpaces.ProtectedList.Count > 0)
                 {
                     int _listNum;
                     if (int.TryParse(_params[1], out _listNum))
                     {
                         if (ProtectedSpaces.ProtectedList.Count >= _listNum)
                         {
                             string[] _vectors = ProtectedSpaces.ProtectedList[_listNum - 1];
                             ProtectedSpaces.Remove(_vectors);
                             SdtdConsole.Instance.Output(string.Format("Removed protected spaces list entry {0}: {1},{2} to {3},{4}", _listNum, _vectors[0], _vectors[1], _vectors[2], _vectors[3]));
                             return;
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("Invalid list number: {0}", _params[1]));
                             return;
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[1]));
                         return;
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("There are no protected spaces"));
                     return;
                 }
             }
             else if (_senderInfo.RemoteClientInfo != null)
             {
                 PersistentOperations.ClearChunkProtection(_senderInfo.RemoteClientInfo);
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (ProtectedSpaces.ProtectedList.Count > 0)
             {
                 SdtdConsole.Instance.Output(string.Format("Protected spaces list:"));
                 for (int i = 0; i < ProtectedSpaces.ProtectedList.Count; i++)
                 {
                     string[] _vectors = ProtectedSpaces.ProtectedList[i];
                     SdtdConsole.Instance.Output(string.Format("#{0}: {1},{2} to {3},{4}", i + 1, _vectors[0], _vectors[1], _vectors[2], _vectors[3]));
                 }
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("There are no protected spaces"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ProtectedSpaceConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 20
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 3)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 to 3, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (WebsiteServer.IsEnabled)
             {
                 WebsiteServer.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!WebsiteServer.IsEnabled)
             {
                 WebsiteServer.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, 2, found {0}", _params.Count));
                 return;
             }
             else if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client id must be 17 characters in length, found {0}", _params[1].Length));
                 return;
             }
             else
             {
                 if (!WebsiteServer.Clients.Contains(_params[1]) && !WebsiteServer.BannedIP.Contains(_params[1]))
                 {
                     string _password = WebsiteServer.SetPassword();
                     WebsiteServer.Clients.Add(_params[1]);
                     if (PersistentContainer.Instance.WebsiteClientList != null)
                     {
                         List <string> _clients = PersistentContainer.Instance.WebsiteClientList;
                         _clients.Add(_params[1]);
                         PersistentContainer.Instance.WebsiteClientList = _clients;
                     }
                     else
                     {
                         List <string> _clients = new List <string>();
                         _clients.Add(_params[1]);
                         PersistentContainer.Instance.WebsiteClientList = _clients;
                     }
                     PersistentContainer.Instance.Players[_params[1]].WP = _password;
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added {0} to the website client list. Their password is {1}", _params[1], _password));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add this id. Client is already on the list or banned"));
                     return;
                 }
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, 2, found {0}", _params.Count));
                 return;
             }
             else if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client id must be 17 characters in length, found {0}", _params[1].Length));
                 return;
             }
             else
             {
                 if (WebsiteServer.Clients.Contains(_params[1]))
                 {
                     WebsiteServer.Clients.Remove(_params[1]);
                     if (PersistentContainer.Instance.WebsiteClientList != null)
                     {
                         List <string> _clients = PersistentContainer.Instance.WebsiteClientList;
                         _clients.Remove(_params[1]);
                         PersistentContainer.Instance.WebsiteClientList = _clients;
                     }
                     PersistentContainer.Instance.Players[_params[1]].WP = "";
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed {0} from the website client list", _params[1]));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove this id. Client is not on the list"));
                     return;
                 }
             }
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, 2, found {0}", _params.Count));
                 return;
             }
             else if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client id must be 17 characters in length, found {0}", _params[1].Length));
                 return;
             }
             else
             {
                 if (WebsiteServer.TimeOut.ContainsKey(_params[1]))
                 {
                     WebsiteServer.TimeOut.Remove(_params[1]);
                     if (PersistentContainer.Instance.WebsiteTimeoutList != null)
                     {
                         Dictionary <string, DateTime> _timeouts = PersistentContainer.Instance.WebsiteTimeoutList;
                         _timeouts.Remove(_params[1]);
                         PersistentContainer.Instance.WebsiteTimeoutList = _timeouts;
                         PersistentContainer.Instance.Save();
                     }
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} has been removed from the time out list", _params[1]));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} not found on the time out list", _params[1]));
                 }
                 if (WebsiteServer.Clients.Contains(_params[1]))
                 {
                     if (WebsiteServer.Visitor.ContainsKey(_params[1]))
                     {
                         WebsiteServer.Visitor.Remove(_params[1]);
                     }
                     if (WebsiteServer.Authorized.ContainsKey(_params[1]))
                     {
                         WebsiteServer.Authorized.Remove(_params[1]);
                         WebsiteServer.AuthorizedTime.Remove(_params[1]);
                     }
                     string _password = WebsiteServer.SetPassword();
                     PersistentContainer.Instance.Players[_params[1]].WP = _password;
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client {0} has been reset. Their password is {1}", _params[1], _password));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client {0} was not found on the list", _params[1]));
                     return;
                 }
             }
         }
         else if (_params[0].ToLower().Equals("ban"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, 3, found {0}", _params.Count));
                 return;
             }
             else if (_params[1].ToLower() == "add")
             {
                 string _ip = _params[3];
                 if (!WebsiteServer.BannedIP.Contains(_ip))
                 {
                     WebsiteServer.BannedIP.Add(_ip);
                     List <string> _banList = PersistentContainer.Instance.WebsiteBanList;
                     if (_banList != null && _banList.Count > 0)
                     {
                         if (_banList.Contains(_ip))
                         {
                             _banList.Add(_ip);
                             PersistentContainer.Instance.WebsiteBanList = _banList;
                             PersistentContainer.Instance.Save();
                         }
                     }
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} has been added to the website ban list", _ip));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add IP {0}. It is already on the ban list", _ip));
                     return;
                 }
             }
             else if (_params[1].ToLower() == "remove")
             {
                 string _ip = _params[2];
                 if (WebsiteServer.BannedIP.Contains(_ip))
                 {
                     WebsiteServer.BannedIP.Remove(_ip);
                     List <string> _banList = PersistentContainer.Instance.WebsiteBanList;
                     if (_banList != null && _banList.Count > 0)
                     {
                         if (_banList.Contains(_ip))
                         {
                             _banList.Remove(_ip);
                             PersistentContainer.Instance.WebsiteBanList = _banList;
                             PersistentContainer.Instance.Save();
                         }
                     }
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} has been removed from the website ban list", _ip));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove IP {0}. It is not on the ban list", _ip));
                     return;
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[1]));
             }
         }
         else if (_params[0].ToLower().Equals("timeout"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, 3, found {0}", _params.Count));
                 return;
             }
             else if (_params[1].ToLower() == "add")
             {
                 string _ip = _params[3];
                 if (!WebsiteServer.TimeOut.ContainsKey(_ip))
                 {
                     WebsiteServer.TimeOut.Add(_ip, DateTime.Now);
                     Dictionary <string, DateTime> _timeoutList = PersistentContainer.Instance.WebsiteTimeoutList;
                     if (_timeoutList != null && _timeoutList.Count > 0)
                     {
                         if (_timeoutList.ContainsKey(_ip))
                         {
                             _timeoutList.Add(_ip, DateTime.Now);
                             PersistentContainer.Instance.WebsiteTimeoutList = _timeoutList;
                             PersistentContainer.Instance.Save();
                         }
                     }
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} has been added to the website timeout list", _ip));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add IP {0}. It is already on the timeout list", _ip));
                     return;
                 }
             }
             else if (_params[1].ToLower() == "remove")
             {
                 string _ip = _params[2];
                 if (WebsiteServer.TimeOut.ContainsKey(_ip))
                 {
                     WebsiteServer.TimeOut.Remove(_ip);
                     Dictionary <string, DateTime> _timeoutList = PersistentContainer.Instance.WebsiteTimeoutList;
                     if (_timeoutList != null && _timeoutList.Count > 0)
                     {
                         if (_timeoutList.ContainsKey(_ip))
                         {
                             _timeoutList.Remove(_ip);
                             PersistentContainer.Instance.WebsiteTimeoutList = _timeoutList;
                             PersistentContainer.Instance.Save();
                         }
                     }
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] IP {0} has been removed from the website timeout list", _ip));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove IP {0}. It is not on the timeout list", _ip));
                     return;
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[1]));
             }
         }
         else if (_params[0].ToLower().Equals("restart"))
         {
             if (WebsiteServer.IsEnabled)
             {
                 WebsiteServer.IsEnabled = false;
                 WebsiteServer.Authorized.Clear();
                 WebsiteServer.Visitor.Clear();
                 WebsiteServer.PageHits.Clear();
                 WebsiteServer.LoginAttempts.Clear();
                 WebsiteServer.TimeOut.Clear();
                 WebsiteServer.IsEnabled = true;
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website server has been cleared and restarted. All users must relog"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Website is not enabled, unable to restart it"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (WebsiteServer.Clients.Count > 0)
             {
                 for (int i = 0; i < WebsiteServer.Clients.Count; i++)
                 {
                     string _client = WebsiteServer.Clients[i];
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Client id = {0}", _client));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] There are no clients on the website list"));
             }
             if (WebsiteServer.BannedIP.Count > 0)
             {
                 for (int i = 0; i < WebsiteServer.BannedIP.Count; i++)
                 {
                     string _bannedIp = WebsiteServer.BannedIP[i];
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Banned IP = {0}", _bannedIp));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] There are no banned ip address"));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in WebsiteConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 21
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (Gimme.IsEnabled)
             {
                 Gimme.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Gimme has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Gimme is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Gimme.IsEnabled)
             {
                 Gimme.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Gimme has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Gimme is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params[1].ToLower().Equals("all"))
             {
                 for (int i = 0; i < PersistentContainer.Instance.Players.SteamIDs.Count; i++)
                 {
                     string           _id = PersistentContainer.Instance.Players.SteamIDs[i];
                     PersistentPlayer p   = PersistentContainer.Instance.Players[_id];
                     {
                         PersistentContainer.Instance.Players[_id].LastGimme = DateTime.Now.AddYears(-1);
                     }
                 }
                 PersistentContainer.Instance.Save();
                 SdtdConsole.Instance.Output("[SERVERTOOLS] Gimme delay reset for all players.");
             }
             else
             {
                 PersistentPlayer p = PersistentContainer.Instance.Players[_params[1]];
                 if (p != null)
                 {
                     PersistentContainer.Instance.Players[_params[1]].LastGimme = DateTime.Now.AddYears(-1);
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Gimme delay reset for {0}.", _params[1]));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not reset player. Invalid Id {0}.", _params[1]));
                     return;
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in GimmeConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 22
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 && _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (AuctionBox.IsEnabled)
             {
                 AuctionBox.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Auction has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auction is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!AuctionBox.IsEnabled)
             {
                 AuctionBox.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Auction has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Auction is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("cancel"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             int _id;
             if (int.TryParse(_params[1], out _id))
             {
                 if (AuctionBox.AuctionItems.ContainsKey(_id))
                 {
                     ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_id);
                     if (_cInfo != null)
                     {
                         string    _auctionName    = PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemName;
                         int       _auctionCount   = PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemCount;
                         int       _auctionQuality = PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemQuality;
                         int       _auctionPrice   = PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemPrice;
                         ItemClass _class          = ItemClass.GetItemClass(_auctionName, false);
                         Block     _block          = Block.GetBlockByName(_auctionName, false);
                         if (_class == null && _block == null)
                         {
                             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "Could not complete the auction cancel. Unable to find item {0} in the item.xml list. Contact an administrator.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             Log.Out(string.Format("Could not complete the auction cancel. Unable to find item {0} in the item.xml list", _auctionName));
                             return;
                         }
                         ItemValue itemValue  = new ItemValue(ItemClass.GetItem(_auctionName).type, _auctionQuality, _auctionQuality, false, null, 1);
                         World     world      = GameManager.Instance.World;
                         var       entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                         {
                             entityClass     = EntityClass.FromString("item"),
                             id              = EntityFactory.nextEntityID++,
                             itemStack       = new ItemStack(itemValue, _auctionCount),
                             pos             = world.Players.dict[_cInfo.entityId].position,
                             rot             = new UnityEngine.Vector3(20f, 0f, 20f),
                             lifetime        = 60f,
                             belongsPlayerId = _cInfo.entityId
                         });
                         world.SpawnEntityInWorld(entityItem);
                         _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId));
                         world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed);
                         AuctionBox.AuctionItems.Remove(_id);
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionId          = 0;
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemName    = "";
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemCount   = 0;
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemQuality = 0;
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionItemPrice   = 0;
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionCancelTime  = DateTime.Now;
                         PersistentContainer.Instance.Save();
                     }
                     else
                     {
                         AuctionBox.AuctionItems.Remove(_id);
                         PersistentContainer.Instance.Players[_cInfo.playerId].AuctionReturn = true;
                         PersistentContainer.Instance.Save();
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Auction does not contain id {0}", _id));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid integer {0}", _id));
             }
             return;
         }
         else if (_params[0].ToLower().Equals("clear"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
             }
             int _id;
             if (int.TryParse(_params[1], out _id))
             {
                 if (AuctionBox.AuctionItems.ContainsKey(_id))
                 {
                     AuctionBox.AuctionItems.Remove(_id);
                     SdtdConsole.Instance.Output(string.Format("Id {0} has been removed from the auction", _id));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Auction does not contain id {0}", _id));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid integer {0}", _id));
             }
             return;
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             bool          _auctionItemsFound = false;
             List <string> playerlist         = PersistentContainer.Instance.Players.SteamIDs;
             for (int i = 0; i < playerlist.Count; i++)
             {
                 string _steamId   = playerlist[i];
                 int    _auctionId = PersistentContainer.Instance.Players[_steamId].AuctionId;
                 if (_auctionId > 0 && AuctionBox.AuctionItems.ContainsKey(_auctionId))
                 {
                     _auctionItemsFound = true;
                     int    _auctionCount   = PersistentContainer.Instance.Players[_steamId].AuctionItemCount;
                     string _auctionName    = PersistentContainer.Instance.Players[_steamId].AuctionItemName;
                     int    _auctionQuality = PersistentContainer.Instance.Players[_steamId].AuctionItemQuality;
                     int    _auctionPrice   = PersistentContainer.Instance.Players[_steamId].AuctionItemPrice;
                     if (_auctionQuality > 1)
                     {
                         string _message = "# {Id}: {Count} {Item} at {Quality} quality, for {Price} {Name}";
                         _message = _message.Replace("{Id}", _auctionId.ToString());
                         _message = _message.Replace("{Count}", _auctionCount.ToString());
                         _message = _message.Replace("{Item}", _auctionName);
                         _message = _message.Replace("{Quality}", _auctionQuality.ToString());
                         _message = _message.Replace("{Price}", _auctionPrice.ToString());
                         _message = _message.Replace("{Name}", Wallet.Coin_Name);
                         SdtdConsole.Instance.Output(_message);
                     }
                     else
                     {
                         string _message = "# {Id}: {Count} {Item} for {Price} {Name}";
                         _message = _message.Replace("{Id}", _auctionId.ToString());
                         _message = _message.Replace("{Count}", _auctionCount.ToString());
                         _message = _message.Replace("{Item}", _auctionName);
                         _message = _message.Replace("{Price}", _auctionPrice.ToString());
                         _message = _message.Replace("{Name}", Wallet.Coin_Name);
                         SdtdConsole.Instance.Output(_message);
                     }
                 }
             }
             if (!_auctionItemsFound)
             {
                 SdtdConsole.Instance.Output("No items are currently for sale");
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AuctionConsole.Execute: {0}", e));
     }
 }
Ejemplo n.º 23
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 && _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ClanManager.IsEnabled)
             {
                 ClanManager.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Clan manager has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Clan manager is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!ClanManager.IsEnabled)
             {
                 ClanManager.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Clan manager has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Clan manager is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             if (ClanManager.Clans.Count > 0)
             {
                 SdtdConsole.Instance.Output(string.Format("Clan List:"));
                 foreach (KeyValuePair <string, string> i in ClanManager.Clans)
                 {
                     string _playerName = PersistentContainer.Instance.Players[i.Key].PlayerName;
                     if (!string.IsNullOrEmpty(_playerName))
                     {
                         SdtdConsole.Instance.Output(string.Format("Clan named {0}, owned by {1}, with id {2}", i.Value, _playerName, i.Key));
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Clan named {0}, owned by player with id {1}", i.Value, i.Key));
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("No clans were found"));
             }
             return;
         }
         else if (_params[0].ToLower().Equals("delete"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             int _steamId;
             if (int.TryParse(_params[1], out _steamId))
             {
                 if (ClanManager.ClanMember.Contains(_params[1]))
                 {
                     string _clanName   = PersistentContainer.Instance.Players[_params[1]].ClanName;
                     string _playerName = PersistentContainer.Instance.Players[_params[1]].PlayerName;
                     if (PersistentContainer.Instance.Players[_params[1]].ClanOwner)
                     {
                         ClanManager.Clans.Remove(_params[1]);
                         PersistentContainer.Instance.Players[_params[1]].ClanOwner         = false;
                         PersistentContainer.Instance.Players[_params[1]].ClanRequestToJoin = null;
                         for (int i = 0; i < PersistentContainer.Instance.Players.SteamIDs.Count; i++)
                         {
                             string           _id = PersistentContainer.Instance.Players.SteamIDs[i];
                             PersistentPlayer p   = PersistentContainer.Instance.Players[_id];
                             {
                                 if (p.ClanName != null && p.ClanName == _clanName)
                                 {
                                     p.ClanOfficer = false;
                                     p.ClanName    = "";
                                     ClanManager.ClanMember.Remove(_id);
                                     SdtdConsole.Instance.Output(string.Format("Deleted {0} with id {1} from the clan system", p.PlayerName, _id));
                                     ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_id);
                                     if (_cInfo2 != null)
                                     {
                                         string _phrase121;
                                         if (!Phrases.Dict.TryGetValue(121, out _phrase121))
                                         {
                                             _phrase121 = " you have been removed from the clan {ClanName}.";
                                         }
                                         _phrase121 = _phrase121.Replace("{ClanName}", _clanName);
                                         ChatHook.ChatMessage(_cInfo2, LoadConfig.Chat_Response_Color + _cInfo2.playerName + LoadConfig.Chat_Response_Color + _phrase121 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                     }
                                 }
                                 else if (p.ClanInvite != null && p.ClanInvite == _clanName)
                                 {
                                     PersistentContainer.Instance.Players[_id].ClanInvite = "";
                                 }
                             }
                         }
                     }
                     PersistentContainer.Instance.Players[_params[1]].ClanOfficer = false;
                     PersistentContainer.Instance.Players[_params[1]].ClanName    = "";
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("Deleted {0} with id {1} from the clan system", _playerName, _params[1]));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("{0} was not found in the clan system", _params[1]));
                 }
             }
             else
             {
                 if (ClanManager.Clans.ContainsValue(_params[1]))
                 {
                     foreach (KeyValuePair <string, string> _clan in ClanManager.Clans)
                     {
                         if (_clan.Value == _params[1])
                         {
                             ClanManager.Clans.Remove(_clan.Key);
                             break;
                         }
                     }
                     for (int i = 0; i < PersistentContainer.Instance.Players.SteamIDs.Count; i++)
                     {
                         string           _id = PersistentContainer.Instance.Players.SteamIDs[i];
                         PersistentPlayer p   = PersistentContainer.Instance.Players[_id];
                         {
                             if (p.ClanName != null && p.ClanName == _params[1])
                             {
                                 p.ClanName          = "";
                                 p.ClanOwner         = false;
                                 p.ClanOfficer       = false;
                                 p.ClanRequestToJoin = null;
                                 ClanManager.ClanMember.Remove(_id);
                                 SdtdConsole.Instance.Output(string.Format("Deleted {0} with id {1} from the clan system", p.PlayerName, _id));
                                 ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_id);
                                 if (_cInfo2 != null)
                                 {
                                     string _phrase121;
                                     if (!Phrases.Dict.TryGetValue(121, out _phrase121))
                                     {
                                         _phrase121 = " you have been removed from the clan {ClanName}.";
                                     }
                                     _phrase121 = _phrase121.Replace("{ClanName}", _params[0]);
                                     ChatHook.ChatMessage(_cInfo2, LoadConfig.Chat_Response_Color + _cInfo2.playerName + LoadConfig.Chat_Response_Color + _phrase121 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                 }
                             }
                             else if (p.ClanInvite != null && p.ClanInvite == _params[1])
                             {
                                 PersistentContainer.Instance.Players[_id].ClanInvite = "";
                             }
                         }
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("{0} was not found in the clan system", _params[1]));
                 }
             }
             return;
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ClanManagerConsole.Execute: {0}", e));
     }
 }
Ejemplo n.º 24
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         var _cInfo = _senderInfo.RemoteClientInfo;
         if (_cInfo != null)
         {
             if (_params[0].ToLower().Equals("off"))
             {
                 Zones.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Zones has been set to off"));
                 return;
             }
             else if (_params[0].ToLower().Equals("on"))
             {
                 Zones.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Zones has been set to on"));
                 return;
             }
             else if (_params[0].ToLower().Equals("new"))
             {
                 if (newZone.ContainsKey(_cInfo.entityId))
                 {
                     newZone[_cInfo.entityId] = 1;
                 }
                 else
                 {
                     newZone.Add(_cInfo.entityId, 1);
                 }
                 if (Zones.zoneSetup1.ContainsKey(_cInfo.entityId))
                 {
                     Zones.zoneSetup1.Remove(_cInfo.entityId);
                 }
                 if (Zones.zoneSetup2.ContainsKey(_cInfo.entityId))
                 {
                     Zones.zoneSetup2.Remove(_cInfo.entityId);
                 }
                 string[] _strings = { "", "", "", "", "", "" };
                 bool[]   _bools   = { false, false, false };
                 Zones.zoneSetup1.Add(_cInfo.entityId, _strings);
                 Zones.zoneSetup2.Add(_cInfo.entityId, _bools);
                 SdtdConsole.Instance.Output(string.Format("Stand at the first corner of the zone and type zone save."));
                 SdtdConsole.Instance.Output(string.Format("If you would like a circle, stand in the middle of the circle and type zone circle."));
             }
             else if (_params[0].ToLower().Equals("list"))
             {
                 if (Zones.Box1.Count > 0)
                 {
                     for (int i = 0; i < Zones.Box1.Count; i++)
                     {
                         string[] _box  = Zones.Box1[i];
                         bool[]   _box2 = Zones.Box2[i];
                         if (_box != null)
                         {
                             SdtdConsole.Instance.Output(string.Format("Zone number {0}:", i));
                             SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _box[0]));
                             SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _box[1]));
                             SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _box[2]));
                             SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _box[3]));
                             SdtdConsole.Instance.Output(string.Format("Response = {0}", _box[4]));
                             SdtdConsole.Instance.Output(string.Format("Reminder Notice = {0}", _box[5]));
                             SdtdConsole.Instance.Output(string.Format("Circle = {0}", _box2[0]));
                             SdtdConsole.Instance.Output(string.Format("PvE = {0}", _box2[1]));
                             SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _box2[2]));
                             SdtdConsole.Instance.Output(string.Format(""));
                         }
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("There are no zones setup."));
                 }
             }
             else if (_params[0].ToLower().Equals("delete"))
             {
                 if (Zones.Box1.Count > 0)
                 {
                     int _number;
                     if (int.TryParse(_params[1], out _number))
                     {
                         Zones.Box1.RemoveAt(_number);
                         Zones.Box2.RemoveAt(_number);
                         Zones.UpdateXml();
                         SdtdConsole.Instance.Output(string.Format("Removed zone entry number {0} from the list.", _number));
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid format or non numeric entry. Type zone delete <number> from the list of zones."));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("There are no zones setup."));
                 }
             }
             else if (_params[0].ToLower().Equals("circle"))
             {
                 if (newZone.ContainsKey(_cInfo.entityId))
                 {
                     int _stage;
                     newZone.TryGetValue(_cInfo.entityId, out _stage);
                     if (_stage == 1)
                     {
                         bool[] _bools;
                         Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                         _bools[0] = true;
                         Zones.zoneSetup2[_cInfo.entityId] = _bools;
                         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                         Vector3      _position  = _player.GetPosition();
                         int          x          = (int)_position.x;
                         int          y          = (int)_position.y;
                         int          z          = (int)_position.z;
                         string       _sposition = x + "," + y + "," + z;
                         string[]     _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[0] = _sposition;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 2;
                         SdtdConsole.Instance.Output(string.Format("Saved the zone as a circle. Circle center point = {0} {1} {2}", x, y, z));
                         SdtdConsole.Instance.Output(string.Format("Type zone circle <number> to set the amount of blocks from center the zone will reach."));
                     }
                     else if (_stage == 2)
                     {
                         bool[] _bools;
                         Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                         if (_bools[0])
                         {
                             int _result;
                             if (int.TryParse(_params[1], out _result))
                             {
                                 string[] _strings;
                                 Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                                 _strings[1] = _result.ToString();
                                 Zones.zoneSetup1[_cInfo.entityId] = _strings;
                                 newZone[_cInfo.entityId]          = 3;
                                 SdtdConsole.Instance.Output(string.Format("Saved the circle radius to {0}.", _result));
                                 SdtdConsole.Instance.Output(string.Format("Type zone save \"entry message\". This is the message players receive upon entering the zone."));
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("This zone is not setup as a circle, go back by typing zone back."));
                             }
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("This zone is not setup as a circle, go back by typing zone back."));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Start a new zone setup or go back to the circle setup if you need to change it by typing zone back."));
                     }
                 }
             }
             else if (_params[0].ToLower().Equals("save"))
             {
                 if (newZone.ContainsKey(_cInfo.entityId))
                 {
                     int _stage;
                     newZone.TryGetValue(_cInfo.entityId, out _stage);
                     if (_stage == 1)
                     {
                         bool[] _bools;
                         Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                         _bools[0] = false;
                         Zones.zoneSetup2[_cInfo.entityId] = _bools;
                         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                         Vector3      _position  = _player.GetPosition();
                         int          x          = (int)_position.x;
                         int          y          = (int)_position.y;
                         int          z          = (int)_position.z;
                         string       _sposition = x + "," + y + "," + z;
                         string[]     _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[0] = _sposition;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 2;
                         SdtdConsole.Instance.Output(string.Format("Corner 1 = {0} {1} {2}", x, y, z));
                         SdtdConsole.Instance.Output(string.Format("Corner 1 saved. Stand in the opposite corner of the zone and type zone save."));
                     }
                     if (_stage == 2)
                     {
                         EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                         Vector3      _position  = _player.GetPosition();
                         int          x          = (int)_position.x;
                         int          y          = (int)_position.y;
                         int          z          = (int)_position.z;
                         string       _sposition = x + "," + y + "," + z;
                         string[]     _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[1] = _sposition;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 3;
                         SdtdConsole.Instance.Output(string.Format("Corner 2 = {0} {1} {2}", x, y, z));
                         SdtdConsole.Instance.Output(string.Format("Corner 2 saved. Type zone save \"entry message\". This is the message players receive upon entering the zone."));
                     }
                     else if (_stage == 3)
                     {
                         string   _entry = _params[1];
                         string[] _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[2] = _entry;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 4;
                         SdtdConsole.Instance.Output(string.Format("Zone entry message = \"{0}\"", _entry));
                         SdtdConsole.Instance.Output(string.Format("Zone entry message saved. Type zone save \"exit message\". This is the message players receive upon exiting the zone."));
                     }
                     else if (_stage == 4)
                     {
                         string   _exit = _params[1];
                         string[] _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[3] = _exit;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 5;
                         SdtdConsole.Instance.Output(string.Format("Zone exit message = \"{0}\"", _exit));
                         SdtdConsole.Instance.Output(string.Format("Zone exit message saved. Type zone save \"response\". This is the console command that will occur when a player enters this zone."));
                     }
                     else if (_stage == 5)
                     {
                         string   _response = _params[1];
                         string[] _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[4] = _response;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 6;
                         SdtdConsole.Instance.Output(string.Format("Zone response = \"{0}\"", _response));
                         SdtdConsole.Instance.Output(string.Format("Zone response saved. Type zone save \"reminder message\". This will set the message players receive if they stay in this zone long enough."));
                     }
                     else if (_stage == 6)
                     {
                         string   _response = _params[1];
                         string[] _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         _strings[5] = _response;
                         Zones.zoneSetup1[_cInfo.entityId] = _strings;
                         newZone[_cInfo.entityId]          = 7;
                         SdtdConsole.Instance.Output(string.Format("Zone reminder message = \"{0}\"", _response));
                         SdtdConsole.Instance.Output(string.Format("Zone reminder message saved. Type zone save 'true or false'. This will set PvE to true or false."));
                     }
                     else if (_stage == 7)
                     {
                         bool _result;
                         if (bool.TryParse(_params[1], out _result))
                         {
                             if (_result)
                             {
                                 bool[] _bools;
                                 Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                                 _bools[1] = true;
                                 Zones.zoneSetup2[_cInfo.entityId] = _bools;
                                 newZone[_cInfo.entityId]          = 8;
                                 SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _result));
                                 SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set No_Zombie to true or false."));
                             }
                             else
                             {
                                 bool[] _bools;
                                 Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                                 _bools[1] = false;
                                 Zones.zoneSetup2[_cInfo.entityId] = _bools;
                                 newZone[_cInfo.entityId]          = 8;
                                 SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _result));
                                 SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set No_Zombie to true or false."));
                             }
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("Incorrect format. Type zone save 'true or false'."));
                         }
                     }
                     else if (_stage == 8)
                     {
                         bool _result;
                         if (bool.TryParse(_params[1], out _result))
                         {
                             if (_result)
                             {
                                 string[] _strings;
                                 Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                                 bool[] _bools;
                                 Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                                 _bools[2] = true;
                                 Zones.zoneSetup2[_cInfo.entityId] = _bools;
                                 newZone[_cInfo.entityId]          = 9;
                                 SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _result));
                                 SdtdConsole.Instance.Output(string.Format("No zombie saved"));
                                 SdtdConsole.Instance.Output("");
                                 SdtdConsole.Instance.Output(string.Format("Zone Review:"));
                                 SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0]));
                                 SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1]));
                                 SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2]));
                                 SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3]));
                                 SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4]));
                                 SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5]));
                                 SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0]));
                                 SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1]));
                                 SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2]));
                                 SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup."));
                             }
                             else
                             {
                                 string[] _strings;
                                 Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                                 bool[] _bools;
                                 Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                                 _bools[2] = false;
                                 Zones.zoneSetup2[_cInfo.entityId] = _bools;
                                 newZone[_cInfo.entityId]          = 9;
                                 SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _result));
                                 SdtdConsole.Instance.Output(string.Format("No zombie saved"));
                                 SdtdConsole.Instance.Output("");
                                 SdtdConsole.Instance.Output(string.Format("Zone Review:"));
                                 SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0]));
                                 SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1]));
                                 SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2]));
                                 SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3]));
                                 SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4]));
                                 SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5]));
                                 SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0]));
                                 SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1]));
                                 SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2]));
                                 SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup."));
                             }
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("Incorrect format. Type zone save true or zone save false."));
                         }
                     }
                     else if (_stage == 9)
                     {
                         string[] _strings;
                         Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                         bool[] _bools;
                         Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                         string[] _box1 = { _strings[0], _strings[1], _strings[2], _strings[3], _strings[4], _strings[5] };
                         bool[]   _box2 = { _bools[0], _bools[1], _bools[2] };
                         if (!Zones.Box1.Contains(_box1))
                         {
                             Zones.Box1.Add(_box1);
                             Zones.Box2.Add(_box2);
                             Zones.UpdateXml();
                             SdtdConsole.Instance.Output(string.Format("New zone setup has been completed."));
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("This zone is already setup. Setup a new zone by typing zone new."));
                         }
                         newZone.Remove(_cInfo.entityId);
                         Zones.zoneSetup1.Remove(_cInfo.entityId);
                         Zones.zoneSetup1.Remove(_cInfo.entityId);
                     }
                 }
                 else if (_params[0].ToLower().Equals("back"))
                 {
                     if (newZone.ContainsKey(_cInfo.entityId))
                     {
                         int _stage;
                         newZone.TryGetValue(_cInfo.entityId, out _stage);
                         if (_stage == 1)
                         {
                             SdtdConsole.Instance.Output(string.Format("You can not go any further back in the setup process."));
                             SdtdConsole.Instance.Output(string.Format("Stand at the first corner of the zone and type zone save."));
                             SdtdConsole.Instance.Output(string.Format("If you would like a circle, stand in the middle of the circle and type zone circle."));
                         }
                         else if (_stage == 2)
                         {
                             newZone[_cInfo.entityId] = 1;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             string[] _corner1 = _strings[0].Split(',');
                             int      x, y, z;
                             int.TryParse(_corner1[0], out x);
                             int.TryParse(_corner1[1], out y);
                             int.TryParse(_corner1[2], out z);
                             bool[] _bools;
                             Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                             if (_bools[0])
                             {
                                 SdtdConsole.Instance.Output(string.Format("Saved the zone as a circle. Circle center point = {0} {1} {2}", x, y, z));
                                 SdtdConsole.Instance.Output(string.Format("Stand at the furthest point from the center and type zone circle."));
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Corner 1 = {0} {1} {2}", x, y, z));
                                 SdtdConsole.Instance.Output(string.Format("Corner 1 saved. Stand in the opposite corner of the zone and type zone save."));
                             }
                         }
                         else if (_stage == 3)
                         {
                             newZone[_cInfo.entityId] = 2;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             bool[] _bools;
                             Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                             if (_bools[0])
                             {
                                 string _distance = _strings[1];
                                 SdtdConsole.Instance.Output(string.Format("Saved the circle radius to {0}.", _distance));
                                 SdtdConsole.Instance.Output(string.Format("Type zone save 'entry message'. This is the message players receive upon entering the zone."));
                             }
                             else
                             {
                                 string[] _corner2 = _strings[1].Split(',');
                                 int      x, y, z;
                                 int.TryParse(_corner2[0], out x);
                                 int.TryParse(_corner2[1], out y);
                                 int.TryParse(_corner2[2], out z);
                                 SdtdConsole.Instance.Output(string.Format("Corner 2 = {0} {1} {2}", x, y, z));
                                 SdtdConsole.Instance.Output(string.Format("Corner 2 saved. Type zone save 'entry message'. This is the message players receive upon entering the zone."));
                             }
                         }
                         else if (_stage == 4)
                         {
                             newZone[_cInfo.entityId] = 3;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             SdtdConsole.Instance.Output(string.Format("Zone entry message = \"{0}\"", _strings[2]));
                             SdtdConsole.Instance.Output(string.Format("Zone entry message saved. Type zone save 'exit message'. This is the message players receive upon exiting the zone."));
                         }
                         else if (_stage == 5)
                         {
                             newZone[_cInfo.entityId] = 4;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             SdtdConsole.Instance.Output(string.Format("Zone exit message = \"{0}\"", _strings[3]));
                             SdtdConsole.Instance.Output(string.Format("Zone exit message saved. Type zone save 'response'. This is the console command that will occur when a player enters this zone."));
                         }
                         else if (_stage == 6)
                         {
                             newZone[_cInfo.entityId] = 5;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             SdtdConsole.Instance.Output(string.Format("Zone response = \"{0}\"", _strings[4]));
                             SdtdConsole.Instance.Output(string.Format("Zone response saved. Type zone save 'reminder message'. This will set the message players receive if they stay in this zone long enough."));
                         }
                         else if (_stage == 7)
                         {
                             newZone[_cInfo.entityId] = 6;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             SdtdConsole.Instance.Output(string.Format("Zone reminder message = \"{0}\"", _strings[5]));
                             SdtdConsole.Instance.Output(string.Format("Zone reminder message saved. Type zone save 'true or false'. This will set the zone as a PvE zone or not."));
                         }
                         else if (_stage == 8)
                         {
                             newZone[_cInfo.entityId] = 7;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             bool[] _bools;
                             Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                             SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _bools[1]));
                             SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set the zone as a PvE zone or not."));
                         }
                         else if (_stage == 9)
                         {
                             newZone[_cInfo.entityId] = 8;
                             SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step."));
                             string[] _strings;
                             Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings);
                             bool[] _bools;
                             Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools);
                             SdtdConsole.Instance.Output(string.Format("Zone Review:"));
                             SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0]));
                             SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1]));
                             SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2]));
                             SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3]));
                             SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4]));
                             SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5]));
                             SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0]));
                             SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1]));
                             SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2]));
                             SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup."));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("You have not started the setup for a new zone. Type zone new to begin setting up a new zone."));
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ZoneSetupConsole.Run: {0}.", e));
     }
 }
Ejemplo n.º 25
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (Animals.IsEnabled)
             {
                 Animals.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Animal tracking has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Animal tracking is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Animals.IsEnabled)
             {
                 Animals.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Animal tracking has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Animal tracking is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params[1].ToLower().Equals("all"))
             {
                 for (int i = 0; i < PersistentContainer.Instance.Players.SteamIDs.Count; i++)
                 {
                     string           _id = PersistentContainer.Instance.Players.SteamIDs[i];
                     PersistentPlayer p   = PersistentContainer.Instance.Players[_id];
                     {
                         PersistentContainer.Instance.Players[_id].LastAnimal = DateTime.Now.AddYears(-1);
                     }
                 }
                 PersistentContainer.Instance.Save();
                 SdtdConsole.Instance.Output("Animal tracking delay reset for all players.");
             }
             else
             {
                 ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
                 if (_cInfo != null)
                 {
                     PersistentContainer.Instance.Players[_params[1]].LastAnimal = DateTime.Now.AddYears(-1);
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("Animal tracking delay reset for {0}.", _cInfo.playerName));
                 }
                 else
                 {
                     if (_params[1].Length != 17)
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not reset Id: Invalid Id {0}", _params[1]));
                         return;
                     }
                     PersistentContainer.Instance.Players[_params[1]].LastAnimal = DateTime.Now.AddYears(-1);
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("Animal tracking delay reset for {0}.", _params[1]));
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AnimalTrackingConsole.Execute: {0}", e));
     }
 }
Ejemplo n.º 26
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             VoteReward.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Vote reward has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             VoteReward.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Vote reward has been set to on"));
             return;
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (_params[1].ToLower().Equals("online"))
             {
                 List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList();
                 for (int i = 0; i < ClientInfoList.Count; i++)
                 {
                     ClientInfo _cInfo2 = ClientInfoList[i];
                     if (_cInfo2 != null)
                     {
                         string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                         DataTable _result = SQL.TQuery(_sql);
                         if (_result.Rows.Count != 0)
                         {
                             DateTime _lastVoteReward;
                             DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                             if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                             {
                                 _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _cInfo2.playerId);
                                 SQL.FastQuery(_sql, "VoteConsole");
                                 SdtdConsole.Instance.Output(string.Format("Vote reward delay reset for {0}.", _cInfo2.playerName));
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Player named {0} does not have a vote reward delay that requires reset.", _cInfo2.playerName));
                             }
                         }
                     }
                 }
                 return;
             }
             if (_params[1].ToLower().Equals("all"))
             {
                 string _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE lastVoteReward != '10/29/2000 7:30:00 AM'");
                 SQL.FastQuery(_sql, "VoteConsole");
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count != 0)
                 {
                     DateTime _lastVoteReward;
                     DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                     if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                     {
                         _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql, "VoteConsole");
                         SdtdConsole.Instance.Output("Vote reward delay reset.");
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay that requires reset.", _params[1]));
                     }
                 }
                 _result.Dispose();
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not reset Id: Invalid Id {0}", _params[1]));
                     return;
                 }
                 string    _id     = SQL.EscapeString(_params[1]);
                 string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _id);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count != 0)
                 {
                     DateTime _lastVoteReward;
                     DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                     if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                     {
                         _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _id);
                         SQL.FastQuery(_sql, "VoteConsole");
                         SdtdConsole.Instance.Output("Vote reward delay reset.");
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay that requires reset.", _params[1]));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay to reset.", _params[1]));
                 }
                 _result.Dispose();
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in VotingConsole.Run: {0}.", e));
     }
 }
Ejemplo n.º 27
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (VehicleTeleport.IsEnabled)
             {
                 VehicleTeleport.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!VehicleTeleport.IsEnabled)
             {
                 VehicleTeleport.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("bike"))
         {
             if (VehicleTeleport.Bike)
             {
                 VehicleTeleport.Bike = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport bike has been set to off"));
                 return;
             }
             else
             {
                 VehicleTeleport.Bike = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport bike has been set to on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("minibike"))
         {
             if (VehicleTeleport.Mini_Bike)
             {
                 VehicleTeleport.Mini_Bike = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport minibike has been set to off"));
                 return;
             }
             else
             {
                 VehicleTeleport.Mini_Bike = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport minibike has been set to on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("motorbike"))
         {
             if (VehicleTeleport.Motor_Bike)
             {
                 VehicleTeleport.Motor_Bike = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport minibike has been set to off"));
                 return;
             }
             else
             {
                 VehicleTeleport.Motor_Bike = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport minibike has been set to on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("jeep"))
         {
             if (VehicleTeleport.Jeep)
             {
                 VehicleTeleport.Jeep = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport jeep has been set to off"));
                 return;
             }
             else
             {
                 VehicleTeleport.Jeep = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport jeep has been set to on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("gyro"))
         {
             if (VehicleTeleport.Gyro)
             {
                 VehicleTeleport.Gyro = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport gyro has been set to off"));
                 return;
             }
             else
             {
                 VehicleTeleport.Gyro = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Vehicle_Teleport gyro has been set to on"));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in VehicleTeleportConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 28
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 && _params.Count > 3)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 3, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             Bounties.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Bounties has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             Bounties.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Bounties has been set to on"));
             return;
         }
         else if (_params[0].ToLower().Equals("edit"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}", _params.Count));
                 return;
             }
             int _value;
             if (!int.TryParse(_params[2], out _value))
             {
                 SdtdConsole.Instance.Output(string.Format("Must input a valid interger: {0}", _params[2]));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 Bounties.ConsoleEdit(_cInfo.playerId, _value);
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("No player found online with id or name: {0}. Checking steam id", _params[1]));
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not edit: Invalid steam id {0}", _params[1]));
                     return;
                 }
                 Bounties.ConsoleEdit(_params[1], _value);
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 Bounties.ConsoleRemoveBounty(_cInfo.playerId);
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("No player found online with id or name: {0}. Checking steam id", _params[1]));
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not remove: Invalid steam id {0}", _params[1]));
                     return;
                 }
                 Bounties.ConsoleRemoveBounty(_params[1]);
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             Bounties.ConsoleBountyList();
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in BountiesConsole.Run: {0}.", e));
     }
 }
Ejemplo n.º 29
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1 && _params.Count != 2)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (WorldRadius.IsEnabled)
             {
                 WorldRadius.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!WorldRadius.IsEnabled)
             {
                 WorldRadius.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("normal"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             int _radius = WorldRadius.Normal_Player;
             if (int.TryParse(_params[1], out _radius))
             {
                 WorldRadius.Normal_Player = _radius;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius for normal players has been set to {0}", _radius));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[1]));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("reserved"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             int _radius = WorldRadius.Reserved;
             if (int.TryParse(_params[1], out _radius))
             {
                 WorldRadius.Reserved = _radius;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] World radius for reserved players has been set to {0}", _radius));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[1]));
                 return;
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in WorldRadiusConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 30
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (Wallet.IsEnabled)
             {
                 Wallet.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Wallet has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wallet is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Wallet.IsEnabled)
             {
                 Wallet.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Wallet has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wallet is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("all"))
         {
             int _adjustCoins;
             if (!int.TryParse(_params[1], out _adjustCoins))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not adjust wallet. Value {0} is invalid", _params[1]));
             }
             else
             {
                 List <ClientInfo> _cInfoList = PersistentOperations.ClientList();
                 for (int i = 0; i < _cInfoList.Count; i++)
                 {
                     ClientInfo _cInfo = _cInfoList[i];
                     if (_cInfo != null)
                     {
                         if (_adjustCoins >= 0)
                         {
                             Wallet.AddCoinsToWallet(_cInfo.playerId, _adjustCoins);
                             SdtdConsole.Instance.Output(string.Format("Added {0} {1} to player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0]));
                         }
                         else
                         {
                             Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _adjustCoins);
                             SdtdConsole.Instance.Output(string.Format("Subtracted {0} {1} from player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0]));
                         }
                     }
                 }
             }
         }
         else if (_params.Count == 2)
         {
             if (_params[0].Length < 1 || _params[0].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not adjust wallet: Invalid Id {0}", _params[0]));
                 return;
             }
             if (_params[1].Length < 1 || _params[1].Length > 5)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not adjust wallet. Value {0} is invalid", _params[1]));
                 return;
             }
             int _adjustCoins;
             if (!int.TryParse(_params[1], out _adjustCoins))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not adjust wallet. Value {0} is invalid", _params[1]));
             }
             else
             {
                 PersistentPlayer p = PersistentContainer.Instance.Players[_params[0]];
                 if (p != null)
                 {
                     Wallet.AddCoinsToWallet(_params[0], _adjustCoins);
                     if (_adjustCoins >= 0)
                     {
                         SdtdConsole.Instance.Output(string.Format("Added {0} {1} to player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0]));
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Subtracted {0} {1} from player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0]));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Player id not found: {0}", _params[0]));
                 }
             }
         }
         else if (_params.Count == 1)
         {
             if (_params[0].Length < 1 || _params[0].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not check wallet value: Invalid Id {0}", _params[0]));
                 return;
             }
             int    _currentWallet = Wallet.GetCurrentCoins(_params[0]);
             string _playerName    = PersistentContainer.Instance.Players[_params[0]].PlayerName;
             if (string.IsNullOrEmpty(_playerName))
             {
                 _playerName = "Unknown";
             }
             SdtdConsole.Instance.Output(string.Format("Player with id {0}, named {1}, has a wallet value of: {2}", _params[0], _playerName, _currentWallet));
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in WalletConsole.Execute: {0}", e.Message));
     }
 }