示例#1
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 (Auction.IsEnabled)
             {
                 Auction.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Auction has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Auction is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Auction.IsEnabled)
             {
                 Auction.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Auction has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Auction is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("cancel"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             int _id;
             if (int.TryParse(_params[1], out _id))
             {
                 if (Auction.AuctionItems.ContainsKey(_id))
                 {
                     Auction.AuctionItems.TryGetValue(_id, out string _playerId);
                     if (PersistentContainer.Instance.Players[_playerId].Auction != null && PersistentContainer.Instance.Players[_playerId].Auction.Count > 0)
                     {
                         if (PersistentContainer.Instance.Players[_playerId].Auction.ContainsKey(_id))
                         {
                             if (PersistentContainer.Instance.Players[_playerId].Auction.TryGetValue(_id, out ItemDataSerializable _itemData))
                             {
                                 ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_playerId);
                                 if (_cInfo != null)
                                 {
                                     ItemValue _itemValue = new ItemValue(ItemClass.GetItem(_itemData.name, false).type, false);
                                     if (_itemValue != null)
                                     {
                                         _itemValue.UseTimes = _itemData.useTimes;
                                         _itemValue.Quality  = _itemData.quality;
                                         World world      = GameManager.Instance.World;
                                         var   entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                                         {
                                             entityClass     = EntityClass.FromString("item"),
                                             id              = EntityFactory.nextEntityID++,
                                             itemStack       = new ItemStack(_itemValue, _itemData.count),
                                             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.Despawned);
                                         Auction.AuctionItems.Remove(_id);
                                         PersistentContainer.Instance.Players[_playerId].Auction.Remove(_id);
                                         PersistentContainer.Instance.AuctionPrices.Remove(_id);
                                         PersistentContainer.Instance.Save();
                                         using (StreamWriter sw = new StreamWriter(filepath, true))
                                         {
                                             sw.WriteLine(string.Format("{0}: {1} {2} had their auction entry # {3} cancelled via console by {4}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _id, _senderInfo.RemoteClientInfo.playerId));
                                             sw.WriteLine();
                                             sw.Flush();
                                             sw.Close();
                                         }
                                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "Your auction item has returned to you.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                     }
                                     else
                                     {
                                         Auction.AuctionItems.Remove(_id);
                                         PersistentContainer.Instance.Players[_playerId].Auction.Remove(_id);
                                         PersistentContainer.Instance.AuctionPrices.Remove(_id);
                                         PersistentContainer.Instance.Save();
                                     }
                                 }
                                 else
                                 {
                                     if (PersistentContainer.Instance.Players[_playerId].AuctionReturn != null && PersistentContainer.Instance.Players[_playerId].AuctionReturn.Count > 0)
                                     {
                                         PersistentContainer.Instance.Players[_playerId].AuctionReturn.Add(_id, _itemData);
                                     }
                                     else
                                     {
                                         Dictionary <int, ItemDataSerializable> _auctionReturn = new Dictionary <int, ItemDataSerializable>();
                                         _auctionReturn.Add(_id, _itemData);
                                         PersistentContainer.Instance.Players[_playerId].AuctionReturn = _auctionReturn;
                                     }
                                     Auction.AuctionItems.Remove(_id);
                                     PersistentContainer.Instance.Players[_playerId].Auction.Remove(_id);
                                     PersistentContainer.Instance.AuctionPrices.Remove(_id);
                                     PersistentContainer.Instance.Save();
                                 }
                                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Id {0} has been removed from the auction list", _id));
                             }
                         }
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("[SERVERTOOLS] Could not find this id listed in the auction. Unable to cancel.[-]");
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer {0}", _id));
             }
             return;
         }
         else if (_params[0].ToLower().Equals("clear"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
             }
             if (int.TryParse(_params[1], out int _id))
             {
                 if (Auction.AuctionItems.ContainsKey(_id))
                 {
                     Auction.AuctionItems.TryGetValue(_id, out string _playerId);
                     Auction.AuctionItems.Remove(_id);
                     if (PersistentContainer.Instance.Players[_playerId].Auction != null && PersistentContainer.Instance.Players[_playerId].Auction.Count > 0)
                     {
                         PersistentContainer.Instance.Players[_playerId].Auction.Remove(_id);
                     }
                     if (PersistentContainer.Instance.AuctionPrices != null && PersistentContainer.Instance.AuctionPrices.Count > 0)
                     {
                         PersistentContainer.Instance.AuctionPrices.Remove(_id);
                     }
                     PersistentContainer.Instance.Save();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Id {0} has been removed from the auction", _id));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Auction does not contain id {0}", _id));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer {0}", _id));
             }
             return;
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             if (Auction.AuctionItems.Count > 0)
             {
                 if (PersistentContainer.Instance.Players.SteamIDs.Count > 0)
                 {
                     List <string>         playerlist     = PersistentContainer.Instance.Players.SteamIDs;
                     Dictionary <int, int> _auctionPrices = PersistentContainer.Instance.AuctionPrices;
                     for (int i = 0; i < playerlist.Count; i++)
                     {
                         string _steamId = playerlist[i];
                         if (PersistentContainer.Instance.Players[_steamId].Auction != null && PersistentContainer.Instance.Players[_steamId].Auction.Count > 0)
                         {
                             foreach (var _auctionItem in PersistentContainer.Instance.Players[_steamId].Auction)
                             {
                                 _auctionPrices.TryGetValue(_auctionItem.Key, out int _price);
                                 string _message = "# {Id}: {Count} {Item} at {Quality} quality, {Durability} durability for {Price} {Name}";
                                 _message = _message.Replace("{Id}", _auctionItem.Key.ToString());
                                 _message = _message.Replace("{Count}", _auctionItem.Value.count.ToString());
                                 _message = _message.Replace("{Item}", _auctionItem.Value.name);
                                 _message = _message.Replace("{Quality}", _auctionItem.Value.quality.ToString());
                                 _message = _message.Replace("{Durability}", (100 - _auctionItem.Value.useTimes).ToString());
                                 _message = _message.Replace("{Price}", _price.ToString());
                                 _message = _message.Replace("{Name}", Wallet.Coin_Name);
                                 SdtdConsole.Instance.Output(_message);
                             }
                         }
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("[SERVERTOOLS] No items are listed in the auction");
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AuctionConsole.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 (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));
     }
 }
示例#3
0
 public void Awake()
 {
     _instance    = this;
     m_downLoader = new LoadALLData();
     m_downLoader.Init();
 }
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 7)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 7, found {0}.", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             ChatColorPrefix.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Chat color prefix has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             ChatColorPrefix.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Chat color prefix has been set to on"));
             return;
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count < 4 || _params.Count > 7)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 4 to 7, found {0}.", _params.Count));
                 return;
             }
             string _steamId = "";
             if (_params[1].Length == 17)
             {
                 _steamId = _params[1];
             }
             else
             {
                 ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
                 if (_cInfo != null)
                 {
                     _steamId = _cInfo.playerId;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not add entity Id or name {0}. They are offline. Use their steam Id instead.", _params[1]));
                     return;
                 }
             }
             if (ChatColorPrefix.dict.ContainsKey(_steamId))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add Id. {0} is already in the chat color prefix list. Remove them first.", _params[1]));
                 return;
             }
             if (_params.Count == 7)
             {
                 foreach (var group in ChatColorPrefix.dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not add Id {0} to the chat color prefix list. Group {1} already exists on the list. Create a new entry or add them to this group", _params[1], _params[3]));
                         return;
                     }
                 }
                 double _daysToExpire;
                 if (!double.TryParse(_params[6], out _daysToExpire))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[6]));
                     return;
                 }
                 DateTime _expireDate;
                 if (_daysToExpire > 0d)
                 {
                     _expireDate = DateTime.Now.AddDays(_daysToExpire);
                 }
                 else
                 {
                     _expireDate = DateTime.Now.AddDays(18250d);
                 }
                 string _color = "";
                 if (!_params[5].StartsWith("[") && !_params[5].StartsWith("**"))
                 {
                     _color = "[" + _params[5] + "]";
                 }
                 else
                 {
                     _color = _params[5];
                 }
                 string[] _c = new string[] { _params[2], _params[3], _params[4], _color };
                 ChatColorPrefix.dict.Add(_steamId, _c);
                 ChatColorPrefix.dict1.Add(_steamId, _expireDate);
                 SdtdConsole.Instance.Output(string.Format("Added Id {0} with the name of {1} to the group {2} with prefix {3} and color {4} that expires {5} to the chat color prefix list.", _steamId, _params[2], _params[3], _params[4], _color, _expireDate.ToString()));
                 ChatColorPrefix.UpdateXml();
                 return;
             }
             else if (_params.Count == 5)
             {
                 foreach (var group in ChatColorPrefix.dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         string[] _c = { _params[2], _params[3], group.Value[2], group.Value[3] };
                         double   _daysToExpire2;
                         if (!double.TryParse(_params[4], out _daysToExpire2))
                         {
                             SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[4]));
                             return;
                         }
                         DateTime _expireDate2;
                         if (_daysToExpire2 > 0d)
                         {
                             _expireDate2 = DateTime.Now.AddDays(_daysToExpire2);
                         }
                         else
                         {
                             _expireDate2 = DateTime.Now.AddDays(18250d);
                         }
                         ChatColorPrefix.dict.Add(_steamId, _c);
                         ChatColorPrefix.dict1.Add(_steamId, _expireDate2);
                         SdtdConsole.Instance.Output(string.Format("Added Id {0} with the name of {1} to the group {2} with prefix {3} and color {4} that expires {5} to the chat color prefix list.", _steamId, _params[2], _params[3], group.Value[2], group.Value[3], _expireDate2.ToString()));
                         ChatColorPrefix.UpdateXml();
                         return;
                     }
                 }
                 SdtdConsole.Instance.Output(string.Format("No group with the name {0} was found.", _params[3]));
                 return;
             }
             else if (_params.Count == 4)
             {
                 foreach (var group in ChatColorPrefix.dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         string[] _c = new string[] { _params[2], _params[3], group.Value[2], group.Value[3] };
                         DateTime _dt;
                         ChatColorPrefix.dict1.TryGetValue(group.Key, out _dt);
                         ChatColorPrefix.dict.Add(_steamId, _c);
                         ChatColorPrefix.dict1.Add(_steamId, _dt);
                         SdtdConsole.Instance.Output(string.Format("Added Id {0} with the name of {1} to the group {2} with prefix {3} and color {4} that expires {5} to the chat color prefix list.", _steamId, _params[2], _params[3], group.Value[2], group.Value[3], _dt.ToString()));
                         ChatColorPrefix.UpdateXml();
                         return;
                     }
                 }
                 SdtdConsole.Instance.Output(string.Format("No group with the name {0} was found.", _params[3]));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("remove") || _params[0].ToLower().Equals("delete") || _params[0].ToLower().Equals("del"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             foreach (var group in ChatColorPrefix.dict)
             {
                 if (group.Value[1] == _params[1])
                 {
                     ChatColorPrefix.dict.Remove(group.Key);
                     ChatColorPrefix.dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("Removed {0} named {1} with group {2} from the chat color prefix list.", group.Key, group.Value[0], _params[1]));
                 }
                 if (group.Key == _params[1])
                 {
                     ChatColorPrefix.dict.Remove(group.Key);
                     ChatColorPrefix.dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("Removed {0} named {1} with group {2} from the chat color prefix list.", _params[1], group.Value[0], group.Value[1]));
                 }
                 if (group.Value[0] == _params[1])
                 {
                     ChatColorPrefix.dict.Remove(group.Key);
                     ChatColorPrefix.dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("Removed {0} named {1} with group {2} from the chat color prefix list.", group.Key, _params[1], group.Value[1]));
                 }
                 ChatColorPrefix.UpdateXml();
             }
             SdtdConsole.Instance.Output(string.Format("Completed removing id and groups matching {0} from the chat color prefix list.", _params[1]));
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             foreach (var group in ChatColorPrefix.dict)
             {
                 if (group.Value[2] == "")
                 {
                     group.Value[2] = "**";
                 }
                 if (group.Value[3] == "")
                 {
                     group.Value[3] = "**";
                 }
                 DateTime _dt;
                 ChatColorPrefix.dict1.TryGetValue(group.Key, out _dt);
                 SdtdConsole.Instance.Output(string.Format("Id {0} named {1} with group {2} prefix {3} color {4} expires {5}.", group.Key, group.Value[0], group.Value[1], group.Value[2], group.Value[3], _dt));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ChatColorPrefixConsole.Run: {0}.", e));
     }
 }
示例#5
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1 && _params.Count != 2 && _params.Count != 4 && _params.Count != 5 && _params.Count != 8)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, 2, 4, 5 or 8, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ChatColorPrefix.IsEnabled)
             {
                 ChatColorPrefix.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Chat color prefix has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Chat color prefix is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!ChatColorPrefix.IsEnabled)
             {
                 ChatColorPrefix.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Chat color prefix has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Chat color prefix is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 4 && _params.Count != 5 && _params.Count != 8)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 4, 5 or 8, found {0}", _params.Count));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo == null)
             {
                 if (_params[1].Length == 17)
                 {
                     _cInfo = PersistentOperations.GetClientInfoFromSteamId(_params[1]);
                     if (_cInfo == null)
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not find player data attached to {0}", _params[1]));
                         return;
                     }
                 }
                 else
                 {
                     if (int.TryParse(_params[1], out int _entId))
                     {
                         _cInfo = PersistentOperations.GetClientInfoFromEntityId(_entId);
                         if (_cInfo == null)
                         {
                             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not find player data attached to {0}", _params[1]));
                             return;
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not find player data attached to {0}", _params[1]));
                         return;
                     }
                 }
             }
             if (_params.Count == 8)
             {
                 foreach (var group in ChatColorPrefix.Dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add id {0} to the chat color prefix list. Group {1} already exists on the list. Create a new entry or add them to this group", _cInfo.playerId, _params[3]));
                         return;
                     }
                 }
                 double _daysToExpire;
                 if (!double.TryParse(_params[7], out _daysToExpire))
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire: {0}", _params[7]));
                     return;
                 }
                 DateTime _expireDate;
                 if (_daysToExpire > 0d)
                 {
                     _expireDate = DateTime.Now.AddDays(_daysToExpire);
                 }
                 else
                 {
                     _expireDate = DateTime.Now.AddDays(18250d);
                 }
                 if ((!_params[5].Contains("[") || !_params[5].Contains("]")) && _params[5] != "**")
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add id {0} to the chat color prefix list. Name color must be in HTML format, example [FFFFFF] with the brackets included. Found: {1}", _params[1], _params[5]));
                     return;
                 }
                 if ((!_params[6].Contains("[") || !_params[6].Contains("]")) && _params[6] != "**")
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add id {0} to the chat color prefix list. Prefix color must be in HTML format, example [FFFFFF] with the brackets included. Found: {1}", _params[1], _params[6]));
                     return;
                 }
                 string[] _c = new string[] { _params[2], _params[3], _params[4], _params[5], _params[6] };
                 if (ChatColorPrefix.Dict.ContainsKey(_params[1]))
                 {
                     ChatColorPrefix.Dict[_cInfo.playerId]  = _c;
                     ChatColorPrefix.Dict1[_cInfo.playerId] = _expireDate;
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Updated id {0} with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], _params[3], _params[4], _params[5], _params[6], _expireDate.ToString()));
                 }
                 else
                 {
                     ChatColorPrefix.Dict.Add(_cInfo.playerId, _c);
                     ChatColorPrefix.Dict1.Add(_cInfo.playerId, _expireDate);
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added id {0} with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], _params[3], _params[4], _params[5], _params[6], _expireDate.ToString()));
                 }
                 ChatColorPrefix.UpdateXml();
                 return;
             }
             else if (_params.Count == 5)
             {
                 foreach (var group in ChatColorPrefix.Dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         double _daysToExpire2;
                         if (!double.TryParse(_params[4], out _daysToExpire2))
                         {
                             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire: {0}", _params[4]));
                             return;
                         }
                         DateTime _expireDate2;
                         if (_daysToExpire2 > 0d)
                         {
                             _expireDate2 = DateTime.Now.AddDays(_daysToExpire2);
                         }
                         else
                         {
                             _expireDate2 = DateTime.Now.AddDays(18250d);
                         }
                         string[] _c = new string[] { _params[2], group.Value[1], group.Value[2], group.Value[3], group.Value[4] };
                         if (ChatColorPrefix.Dict.ContainsKey(_cInfo.playerName))
                         {
                             ChatColorPrefix.Dict[_cInfo.playerId]  = _c;
                             ChatColorPrefix.Dict1[_cInfo.playerId] = _expireDate2;
                             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Updated id {0} with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], group.Value[1], group.Value[2], group.Value[3], group.Value[4], _expireDate2.ToString()));
                         }
                         else
                         {
                             ChatColorPrefix.Dict.Add(_cInfo.playerId, _c);
                             ChatColorPrefix.Dict1.Add(_cInfo.playerId, _expireDate2);
                             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added id {0} with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], group.Value[1], group.Value[2], group.Value[3], group.Value[4], _expireDate2.ToString()));
                         }
                         ChatColorPrefix.UpdateXml();
                         return;
                     }
                 }
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] No group with the name {0} was found.", _params[3]));
                 return;
             }
             else if (_params.Count == 4)
             {
                 foreach (var group in ChatColorPrefix.Dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         string[] _c = new string[] { _params[2], _params[3], group.Value[2], group.Value[3], group.Value[4] };
                         ChatColorPrefix.Dict1.TryGetValue(group.Key, out DateTime _dt);
                         ChatColorPrefix.Dict.Add(_cInfo.playerId, _c);
                         ChatColorPrefix.Dict1.Add(_cInfo.playerId, _dt);
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added Id {0} with the name of {1} to the group {2} using prefix {3} name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], _params[3], group.Value[2], group.Value[3], group.Value[4], _dt.ToString()));
                         ChatColorPrefix.UpdateXml();
                         return;
                     }
                 }
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] No group with the name {0} was found.", _params[3]));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             foreach (var group in ChatColorPrefix.Dict)
             {
                 if (group.Value[1] == _params[1])
                 {
                     ChatColorPrefix.Dict.Remove(group.Key);
                     ChatColorPrefix.Dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed {0} named {1} with group {2} from the chat color prefix list.", group.Key, group.Value[0], _params[1]));
                 }
                 if (group.Key == _params[1])
                 {
                     ChatColorPrefix.Dict.Remove(group.Key);
                     ChatColorPrefix.Dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed {0} named {1} with group {2} from the chat color prefix list.", _params[1], group.Value[0], group.Value[1]));
                 }
                 if (group.Value[0] == _params[1])
                 {
                     ChatColorPrefix.Dict.Remove(group.Key);
                     ChatColorPrefix.Dict1.Remove(group.Key);
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed {0} named {1} with group {2} from the chat color prefix list.", group.Key, _params[1], group.Value[1]));
                 }
                 ChatColorPrefix.UpdateXml();
             }
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Completed removing id and groups matching {0} from the chat color prefix list.", _params[1]));
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             foreach (var group in ChatColorPrefix.Dict)
             {
                 if (group.Value[2] == "")
                 {
                     group.Value[2] = "**";
                 }
                 if (group.Value[3] == "")
                 {
                     group.Value[3] = "**";
                 }
                 DateTime _dt;
                 ChatColorPrefix.Dict1.TryGetValue(group.Key, out _dt);
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Id {0} named {1} with group {2} prefix {3} color {4} expires {5}.", group.Key, group.Value[0], group.Value[1], group.Value[2], group.Value[3], _dt));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ChatColorPrefixConsole.Execute: {0}", e.Message));
     }
 }