public static void SendAdmins(ClientInfo _sender, string _message) { if (!GameManager.Instance.adminTools.IsAdmin(_sender.playerId)) { string _phrase200; if (!Phrases.Dict.TryGetValue(200, out _phrase200)) { _phrase200 = "{PlayerName} you do not have permissions to use this command."; } _phrase200 = _phrase200.Replace("{PlayerName}", _sender.playerName); _sender.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase200), Config.Server_Response_Name, false, "ServerTools", false)); } else { List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients(); foreach (ClientInfo _cInfo in _cInfoList) { if (GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel <= ChatHook.Mod_Level) { _message = _message.Replace("@ADMINS ", ""); _message = _message.Replace("@admins ", ""); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _message), _sender.playerName, false, "", false)); } } } } }
public static string GetChatCommandsAdmin(ClientInfo _cInfo) { string _commandsAdmin = string.Format("{0}Admin commands are:", LoadConfig.Chat_Response_Color); if (AdminChat.IsEnabled && GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel <= ChatHook.Mod_Level) { if (AdminChat.IsEnabled) { _commandsAdmin = string.Format("{0} @" + AdminChat.Command118, _commandsAdmin); } if (Jail.IsEnabled) { _commandsAdmin = string.Format("{0} {1}{2}", _commandsAdmin, ChatHook.Command_Private, Jail.Command27); } if (Mute.IsEnabled) { _commandsAdmin = string.Format("{0} {1}{2}", _commandsAdmin, ChatHook.Command_Private, Mute.Command13); _commandsAdmin = string.Format("{0} {1}{2}", _commandsAdmin, ChatHook.Command_Private, Mute.Command14); } } } return(_commandsAdmin); }
public static void CheckWatchlist() { List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (Dict.ContainsKey(_cInfo.playerId)) { foreach (var _cInfo1 in _cInfoList) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo1.playerId); if (Admin.PermissionLevel <= Admin_Level) { string _phrase350; if (!Phrases.Dict.TryGetValue(350, out _phrase350)) { _phrase350 = "Player {PlayerName} is on the watchlist for {Reason}."; } string _reason = null; if (Dict.TryGetValue(_cInfo.playerId, out _reason)) { _phrase350 = _phrase350.Replace("{PlayerName}", _cInfo.playerName); _phrase350 = _phrase350.Replace("{Reason}", _reason); ChatHook.ChatMessage(_cInfo1, LoadConfig.Chat_Response_Color + _phrase350 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } }
public static void GodFlightCheck(ClientInfo _cInfo) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { EntityAlive _player = (EntityAlive)GameManager.Instance.World.GetEntity(_cInfo.entityId); if (_player.Buffs.HasBuff("god")) { ChatHook.ChatMessage(null, "[FF0000]" + "Cheater! Player " + _cInfo.playerName + " detected using god mode!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); EntityPlayer _entPlayer = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int x = (int)_entPlayer.position.x; int y = (int)_entPlayer.position.y; int z = (int)_entPlayer.position.z; Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, using god mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, x, y, z); string _file = string.Format("DetectionLog_{0}.txt", DateTime.Today.ToString("M-d-yyyy")); string _filepath = string.Format("{0}/Logs/DetectionLogs/{1}", API.ConfigPath, _file); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, using god mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, x, y, z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Penalty(_cInfo); } } }
public static void GodCheck(ClientInfo _cInfo) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { EntityAlive _player = PersistentOperations.GetPlayerAlive(_cInfo.playerId); if (_player != null && _player.Buffs.HasBuff("god")) { ChatHook.ChatMessage(null, "[FF0000]" + "Cheater! Player " + _cInfo.playerName + " detected using god mode!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); EntityPlayer _entityPlayer = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_entityPlayer != null) { int x = (int)_entityPlayer.position.x; int y = (int)_entityPlayer.position.y; int z = (int)_entityPlayer.position.z; Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, using god mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, x, y, z); string _file = string.Format("DetectionLog_{0}.txt", DateTime.Today.ToString("M-d-yyyy")); string _filepath = string.Format("{0}/Logs/DetectionLogs/{1}", API.ConfigPath, _file); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, using god mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, x, y, z)); sw.WriteLine(); sw.Flush(); sw.Close(); } string _message = "[FF0000]{PlayerName} has been banned for god mode."; _message = _message.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Auto detection has banned you for god mode\"", _cInfo.playerId), (ClientInfo)null); } } } }
public static void CheckWatchlist() { List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (Dict.ContainsKey(_cInfo.playerId)) { foreach (var _cInfo1 in _cInfoList) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo1.playerId); if (Admin.PermissionLevel <= Admin_Level) { string _phrase350; if (!Phrases.Dict.TryGetValue(350, out _phrase350)) { _phrase350 = "Player {PlayerName} is on the watchlist for {Reason}."; } string _reason = null; if (Dict.TryGetValue(_cInfo.playerId, out _reason)) { _phrase350 = _phrase350.Replace("{PlayerName}", _cInfo.playerName); _phrase350 = _phrase350.Replace("{Reason}", _reason); _cInfo1.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase350), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } }
public static void List(ClientInfo _cInfo, bool _announce, string _playerName) { Admins.Clear(); Mods.Clear(); List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfoAdmins = _cInfoList[i]; if (!AdminChatColor.AdminColorOff.Contains(_cInfoAdmins.playerId)) { GameManager.Instance.adminTools.IsAdmin(_cInfoAdmins.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfoAdmins.playerId); if (Admin.PermissionLevel <= Admin_Level) { Admins.Add(_cInfoAdmins.playerName); } if (Admin.PermissionLevel > Admin_Level & Admin.PermissionLevel <= Mod_Level) { Mods.Add(_cInfoAdmins.playerName); } } } Response(_cInfo, _announce, _playerName); }
public static void PvEProt(object sender, ElapsedEventArgs e) { if (ConnectionManager.Instance.ClientCount() > 0) { World world = GameManager.Instance.World; var enumerator = world.Players.list; foreach (var ent in enumerator) { if (ent.IsClientControlled()) { List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients(); foreach (var _cInfo in _cInfoList) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > AdminLevel) { if (ent.entityId == _cInfo.entityId) { var p_KilledPlayers = ent.KilledPlayers; var p_KilledZombies = ent.KilledZombies; var p_Score = ent.Score; var p_Died = ent.Died; var p_GetDamagedTarget = ent.GetDamagedTarget(); } } } } } } }
public static bool AccCheck(ClientInfo _cInfo) { if (_cInfo != null) { if (!OmittedPlayers.ContainsKey(_cInfo.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { if (Family_Share) { if (_cInfo.ownerId != _cInfo.playerId) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using a family share account. Purchase the game or contact an administrator for permission to join this server\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with a family share account", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, _cInfo.ip)); sw.WriteLine(); sw.Flush(); sw.Close(); } return(false); } } if (Bad_Id) { if (_cInfo.ownerId.Length != 17 || !_cInfo.ownerId.StartsWith("7656119") || _cInfo.playerId.Length != 17 || !_cInfo.playerId.StartsWith("7656119")) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using an invalid Id\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with an invalid Id", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, _cInfo.ip)); sw.WriteLine(); sw.Flush(); sw.Close(); } return(false); } } if (No_Internal) { string IP = _cInfo.ip; if (IP.StartsWith("192.168")) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using an invalid IP\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with an invalid IP", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, _cInfo.ip)); sw.WriteLine(); sw.Flush(); sw.Close(); } return(false); } } } } } return(true); }
public static void SendAdmins(ClientInfo _sender, string _message) { if (!GameManager.Instance.adminTools.IsAdmin(_sender.playerId)) { string _phrase107; if (!Phrases.Dict.TryGetValue(107, out _phrase107)) { _phrase107 = "you do not have permissions to use this command."; } ChatHook.ChatMessage(_sender, LoadConfig.Chat_Response_Color + _sender.playerName + _phrase107 + "[-]", _sender.entityId, _sender.playerName, EChatType.Whisper, null); } else { List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList(); foreach (ClientInfo _cInfo in _cInfoList) { if (GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel <= ChatHook.Mod_Level) { _message = _message.Replace("@ADMINS ", ""); _message = _message.Replace("@admins ", ""); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _sender.playerName + ": " + _message + "[-]", _sender.entityId, _sender.playerName, EChatType.Whisper, null); } } } } }
public static void AccCheck(ClientInfo _cInfo) { if (_cInfo != null) { if (!OmittedPlayers.ContainsKey(_cInfo.playerId)) { if (Family_Share) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { if (_cInfo.ownerId != _cInfo.playerId) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using a family share account. Purchase the game or contact an administrator for permission to join this server\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with a family share account", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, AllocsFixes.PersistentData.PersistentContainer.Instance.Players[_cInfo.playerId, false].IP)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } } if (Bad_Id) { if (_cInfo.ownerId.Length != 17 || !_cInfo.ownerId.StartsWith("7656119") || _cInfo.playerId.Length != 17 || !_cInfo.playerId.StartsWith("7656119")) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using an invalid Id\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with an invalid Id", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, AllocsFixes.PersistentData.PersistentContainer.Instance.Players[_cInfo.playerId, false].IP)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } if (No_Internal) { string IP = AllocsFixes.PersistentData.PersistentContainer.Instance.Players[_cInfo.playerId, false].IP; string[] _ipSplit = IP.Split('.').ToArray(); if (_ipSplit[0] == "192" && _ipSplit[1] == "168" && _ipSplit[2] == "1") { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using an invalid IP\"", _cInfo.playerId), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Player name {1} with ownerId {2} playerId {3} IP Address {4} connected with an invalid IP", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId, AllocsFixes.PersistentData.PersistentContainer.Instance.Players[_cInfo.playerId, false].IP)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } } } }
public static void CheckStorage() { try { LinkedList <Chunk> chunkArray = new LinkedList <Chunk>(); DictionaryList <Vector3i, TileEntity> tiles = new DictionaryList <Vector3i, TileEntity>(); ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters; for (int i = 0; i < chunklist.Count; i++) { ChunkCluster chunk = chunklist[i]; chunkArray = chunk.GetChunkArray(); foreach (Chunk _c in chunkArray) { tiles = _c.GetTileEntities(); foreach (TileEntity tile in tiles.dict.Values) { if (tile.GetTileEntityType().ToString().Equals("SecureLoot")) { TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile; AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(SecureLoot.GetOwner()); if (Admin.PermissionLevel > Admin_Level) { ItemStack[] items = SecureLoot.items; int slotNumber = 0; foreach (ItemStack item in items) { if (!item.IsEmpty()) { string _itemName = ItemClass.list[item.itemValue.type].Name; if (dict.Contains(_itemName)) { int _count = item.count; ItemStack itemStack = new ItemStack(); SecureLoot.UpdateSlot(slotNumber, itemStack.Clone()); Vector3i _chestPos = SecureLoot.localChunkPos; using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine("[SERVERTOOLS] Removed {0} {1}, from a secure loot located at {2} {3} {4}, owned by {5}", item.count, _itemName, _chestPos.x, _chestPos.y, _chestPos.z, SecureLoot.GetOwner()); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Out(string.Format("[SERVERTOOLS] Removed {0} {1}, from a secure loot located at {2} {3} {4}, owned by {5}", item.count, _itemName, _chestPos.x, _chestPos.y, _chestPos.z, SecureLoot.GetOwner())); } } slotNumber++; } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in InventoryCheck.ChestCheck: {0}.", e.Message)); } }
public static bool AdminCheck(string _steamId) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_steamId); if (Admin.PermissionLevel <= Admin_Level) { return(true); } return(false); }
public static void TeleportCheckValid(ClientInfo _cInfo) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { Penalty(_cInfo); } }
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].Length < 1 || _params.Count > 17) { SdtdConsole.Instance.Output(string.Format("Can not ban Id: Invalid Id {0}", _params[0])); return; } int _time; if (!int.TryParse(_params[1], out _time)) { _time = 15; } ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[0]); if (_cInfo != null) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { if (_time > 60) { SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} {1} minutes \"You have been temporarily banned for {2} minutes\"", _cInfo.playerId, _time, _time), _cInfo); } else { SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} {1} minutes \"You have been temporarily banned for {2} minutes\"", _cInfo.playerId, _params[1], _params[1]), _cInfo); } } else { SdtdConsole.Instance.Output(string.Format("Can not ban Id: {0}. The Id belongs to an Admin.", _params[1])); } } else { SdtdConsole.Instance.Output(string.Format("Player with Id {0} does not exist.", _cInfo.entityId)); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in TempBanConsole.Run: {0}.", e)); } }
public static void ChestCheck() { LinkedList <Chunk> chunkArray = new LinkedList <Chunk>(); DictionaryList <Vector3i, TileEntity> tiles = new DictionaryList <Vector3i, TileEntity>(); ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters; for (int i = 0; i < chunklist.Count; i++) { ChunkCluster chunk = chunklist[i]; chunkArray = chunk.GetChunkArray(); foreach (Chunk _c in chunkArray) { tiles = _c.GetTileEntities(); foreach (TileEntity tile in tiles.dict.Values) { TileEntityType type = tile.GetTileEntityType(); if (type.ToString().Equals("SecureLoot")) { TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile; AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(SecureLoot.GetOwner()); if (Admin.PermissionLevel > Admin_Level) { ItemStack[] items = SecureLoot.items; int slotNumber = 0; foreach (ItemStack item in items) { if (!item.IsEmpty()) { ItemClass _itemClass = ItemClass.list[item.itemValue.type]; string _itemName = _itemClass.GetItemName(); if (dict.Contains(_itemName)) { int _count = item.count; ItemStack itemStack = new ItemStack(); SecureLoot.UpdateSlot(slotNumber, itemStack); Vector3i _chestPos = SecureLoot.localChunkPos; Log.Out(string.Format("[SERVERTOOLS] Removed {0} {1}, from a chest located at {2} {3} {4}", item.count, _itemName, _chestPos.x, _chestPos.y, _chestPos.z)); } } slotNumber++; } } } } } } }
public static bool ProcessPenalty(int _total, string _persistentPlayerId, BlockChangeInfo _bChangeInfo) { try { if (!string.IsNullOrEmpty(_persistentPlayerId)) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_persistentPlayerId); if (_player != null) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_persistentPlayerId); if (Admin.PermissionLevel > Admin_Level) { if (DamageDetector.IsEnabled) { string _message = "[FF0000]{PlayerName} has been banned for using damage manipulation."; _message = _message.Replace("{PlayerName}", _player.EntityName); ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Auto detection has banned you for using a damage manipulator. Damage recorded: {1}\"", _persistentPlayerId, _total.ToString()), null); using (StreamWriter sw = new StreamWriter(_detectionFilepath, true)) { sw.WriteLine(string.Format("Detected {0} with steam id {1} using a damage manipulator @ position {2}. Damage recorded: {3}", _player.EntityName, _persistentPlayerId, _player.position, _total)); sw.WriteLine(); sw.Flush(); sw.Close(); } } return(true); } } else { return(true); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in DamageDetector.ProcessPenalty: {0}", e.Message)); } return(false); }
public static bool ExplosionServer_Prefix(GameManager __instance, Vector3 _worldPos, Vector3i _blockPos, int _playerId) { try { if (_playerId > 0) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_playerId.ToString()); if (Admin.PermissionLevel > DamageDetector.Admin_Level) { return(ProtectedSpace.AllowExplosion(_worldPos)); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Injections.ExplosionServer_Prefix: {0}.", e.Message)); } return(true); }
public static void Exec(ClientInfo _cInfo, string _message) { _message = _message.Replace(Command82 + " ", ""); EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Vector3 _pos = _player.position; List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList(); for (int i = 0; i < ClientInfoList.Count; i++) { ClientInfo _cInfoAdmins = ClientInfoList[i]; AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfoAdmins.playerId); if (Admin.PermissionLevel <= Admin_Level) { string _phrase796; if (!Phrases.Dict.TryGetValue(796, out _phrase796)) { _phrase796 = "Report from {PlayerName}: {Message}"; } _phrase796 = _phrase796.Replace("{PlayerName}", _cInfo.playerName); _phrase796 = _phrase796.Replace("{Message}", _message); ChatHook.ChatMessage(_cInfoAdmins, LoadConfig.Chat_Response_Color + _phrase796 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Location: {1} {2} {3}. Player {4} reports: {5}.", DateTime.Now, (int)_pos.x, (int)_pos.y, (int)_pos.z, _cInfo.playerName, _message)); sw.WriteLine(); sw.Flush(); sw.Close(); } string _phrase797; if (!Phrases.Dict.TryGetValue(797, out _phrase797)) { _phrase797 = " your report has been sent to online administrators and logged."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase797 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); string _sql = string.Format("UPDATE Players SET lastLog = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql, "Report"); Log.Out(string.Format("[SERVERTOOLS] Report sent by player name {0}", _cInfo.playerName)); }
public static void Exec(ClientInfo _cInfo, string _message) { _message = _message.Replace("report ", ""); EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Vector3 _pos = _player.position; List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfoAdmins = _cInfoList[i]; AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfoAdmins.playerId); if (Admin.PermissionLevel <= Admin_Level) { string _phrase796; if (!Phrases.Dict.TryGetValue(796, out _phrase796)) { _phrase796 = "Report from {PlayerName}: {Message}"; } _phrase796 = _phrase796.Replace("{PlayerName}", _cInfo.playerName); _phrase796 = _phrase796.Replace("{Message}", _message); _cInfoAdmins.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase796), Config.Server_Response_Name, false, "ServerTools", false)); } } using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0}: Location: {1} {2} {3}. Player {4} reports: {5}.", DateTime.Now, (int)_pos.x, (int)_pos.y, (int)_pos.z, _cInfo.playerName, _message)); sw.WriteLine(); sw.Flush(); sw.Close(); } string _phrase797; if (!Phrases.Dict.TryGetValue(797, out _phrase797)) { _phrase797 = "{PlayerName} your report has been sent to online administrators and logged."; } _phrase797 = _phrase797.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase797), Config.Server_Response_Name, false, "ServerTools", false)); PersistentContainer.Instance.Players[_cInfo.playerId, true].Log = DateTime.Now; PersistentContainer.Instance.Save(); Log.Out(string.Format("[SERVERTOOLS] Report sent by player name {0}", _cInfo.playerName)); }
public static void CheckReservedSlot(ClientInfo _cInfo) { int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount == API.MaxPlayers) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { if (Dict.ContainsKey(_cInfo.playerId)) { DateTime _dt; Dict.TryGetValue(_cInfo.playerId, out _dt); if (DateTime.Now < _dt) { OpenSlot(); } else { string _phrase22; if (!Phrases.Dict.TryGetValue(22, out _phrase22)) { _phrase22 = "Sorry {PlayerName} server is at max capacity and this slot is reserved."; } _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase22), (ClientInfo)null); } } else { string _phrase22; if (!Phrases.Dict.TryGetValue(22, out _phrase22)) { _phrase22 = "Sorry {PlayerName} server is at max capacity and this slot is reserved."; } _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase22), (ClientInfo)null); } } } }
public static void AccCheck(ClientInfo _cInfo) { if (_cInfo.ownerId != _cInfo.playerId && !OmittedPlayers.ContainsKey(_cInfo.playerId)) { GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { string _file = string.Format("PlayerLog_{0}.txt", DateTime.Today.ToString("M-d-yyyy")); string _filepath = string.Format("{0}/PlayerLogs/{1}", API.GamePath, _file); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} {1} ownerId {2} playerId {3} IP Address {4} connected with a family share account", DateTime.Now, _cInfo.playerName, _cInfo.ownerId, _cInfo.playerId)); sw.WriteLine(); sw.Flush(); sw.Close(); } SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"You have been kicked for using a family share account. Purchase the game or contact an administrator for permission to join this server\"", _cInfo.playerId), (ClientInfo)null); } } }
public static void Exec() { if (ConnectionManager.Instance.ClientCount() > 0) { World world = GameManager.Instance.World; List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (ReservedSlots.IsEnabled) { DateTime _dt; if (ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt)) { if (DateTime.Now < _dt) { DonatorRad(_player); } else { NormalRad(_player); } } else { NormalRad(_player); } } else { NormalRad(_player); } } } } }
public static void List(ClientInfo _cInfo, bool _announce, string _playerName) { Admins.Clear(); Mods.Clear(); List <ClientInfo> ClientInfoList = PersistentOperations.ClientList(); for (int i = 0; i < ClientInfoList.Count; i++) { ClientInfo _cInfoAdmins = ClientInfoList[i]; GameManager.Instance.adminTools.IsAdmin(_cInfoAdmins.playerId); AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfoAdmins.playerId); if (Admin.PermissionLevel <= Admin_Level) { Admins.Add(_cInfoAdmins.playerName); } if (Admin.PermissionLevel > Admin_Level & Admin.PermissionLevel <= Mod_Level) { Mods.Add(_cInfoAdmins.playerName); } } Response(_cInfo, _announce, _playerName); }
public static string GetChatCommandsAdmin(ClientInfo _cInfo) { string _commandsAdmin = string.Format("{0}Admin commands are:", Config.Chat_Response_Color); if (AdminChat.IsEnabled && GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel <= ChatHook.Admin_Level) { _commandsAdmin = string.Format("{0} @admins", _commandsAdmin); string[] _command = { "say" }; if (GameManager.Instance.adminTools.CommandAllowedFor(_command, _cInfo.playerId)) { _commandsAdmin = string.Format("{0} @all", _commandsAdmin); } string[] _command1 = { "jail" }; if (GameManager.Instance.adminTools.CommandAllowedFor(_command1, _cInfo.playerId)) { if (Jail.IsEnabled) { _commandsAdmin = string.Format("{0} /jail", _commandsAdmin); } } string[] _command2 = { "mute" }; if (GameManager.Instance.adminTools.CommandAllowedFor(_command2, _cInfo.playerId)) { _commandsAdmin = string.Format("{0} /mute", _commandsAdmin); } if (_commandsAdmin.EndsWith("Admin commands are:")) { _commandsAdmin = string.Format("{0}Sorry, there are no admin chat commands.", Config.Chat_Response_Color); } } } return(_commandsAdmin); }
public static void CallForVote1(ClientInfo _cInfo) { if (!Startup) { if (!StartedVote) { bool adminOnline = false; List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList(); for (int i = 0; i < ClientInfoList.Count; i++) { ClientInfo _cInfoAdmins = ClientInfoList[i]; if (_cInfo != _cInfoAdmins) { if (GameManager.Instance.adminTools.IsAdmin(_cInfoAdmins.playerId)) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfoAdmins.playerId); if (Admin.PermissionLevel <= Admin_Level) { adminOnline = true; string _phrase748; if (!Phrases.Dict.TryGetValue(748, out _phrase748)) { _phrase748 = "{Player} has requested a restart vote."; } _phrase748 = _phrase748.Replace("{Player}", _cInfo.playerName); ChatHook.ChatMessage(_cInfoAdmins, LoadConfig.Chat_Response_Color + _phrase748 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } if (!adminOnline) { if (ConnectionManager.Instance.ClientCount() >= Players_Online) { StartedVote = true; string _phrase740; if (!Phrases.Dict.TryGetValue(740, out _phrase740)) { _phrase740 = "A vote to restart the server has opened and will close in 60 seconds. Type {CommandPrivate}{Command70} to cast your vote."; } _phrase740 = _phrase740.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase740 = _phrase740.Replace("{Command70}", Command70); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase740 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { string _phrase741; if (!Phrases.Dict.TryGetValue(741, out _phrase741)) { _phrase741 = " there are not enough players online to start a restart vote."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase741 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase749; if (!Phrases.Dict.TryGetValue(749, out _phrase749)) { _phrase749 = " a administrator is currently online. They have been alerted."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase749 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase824; if (!Phrases.Dict.TryGetValue(824, out _phrase824)) { _phrase824 = " there is a vote already open."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase824 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase816; if (!Phrases.Dict.TryGetValue(816, out _phrase816)) { _phrase816 = " you must wait thirty minutes after the server starts before opening a restart vote."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase816 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void CheckInv(ClientInfo _cInfo, PlayerDataFile _playerDataFile) { if (_cInfo != null) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { int _bagClean = 0, _invClean = 0, _totalBagCount = 0, _totalInventoryCount = 0; for (int i = 0; i < _playerDataFile.inventory.Length; i++) { ItemStack _itemStack = new ItemStack(); ItemValue _itemValue = new ItemValue(); _itemStack = _playerDataFile.inventory[i]; _itemValue = _itemStack.itemValue; int _count = _playerDataFile.inventory[i].count; if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null) { int _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value; string _name = ItemClass.list[_itemValue.type].GetItemName(); if (Announce_Invalid_Stack && _count > _maxAllowed) { string _phrase3; if (!Phrases.Dict.TryGetValue(3, out _phrase3)) { _phrase3 = " you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}."; } _phrase3 = _phrase3.Replace("{ItemName}", _name); _phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString()); _phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString()); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _cInfo.playerName + _phrase3 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); ChatLog.Log(_phrase3, LoadConfig.Server_Response_Name); } if (IsEnabled && (dict.Contains(_name) || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.Dev || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.None)) { if (Ban_Player) { string _phrase4; if (!Phrases.Dict.TryGetValue(4, out _phrase4)) { _phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}."; } _phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName); _phrase4 = _phrase4.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase4 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Invalid Item {1}\"", _cInfo.entityId, _name), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Banned the player.", _cInfo.playerName, _cInfo.playerId, _name)); sw.WriteLine(); sw.Flush(); sw.Close(); } } else { if (playerflag.ContainsKey(_cInfo.entityId)) { int _value; if (playerflag.TryGetValue(_cInfo.entityId, out _value)) { if (_value == 2) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Invalid Item: {1}\"", _cInfo.entityId, _name), (ClientInfo)null); string _phrase5; if (!Phrases.Dict.TryGetValue(5, out _phrase5)) { _phrase5 = "Cheat Detected: Auto kicked {PlayerName} for having a invalid item: {ItemName}."; } _phrase5 = _phrase5.Replace("{PlayerName}", _cInfo.playerName); _phrase5 = _phrase5.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase5 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Kicked the player.", _cInfo.playerName, _cInfo.playerId, _name)); sw.WriteLine(); sw.Flush(); sw.Close(); } playerflag.Remove(_cInfo.entityId); } else { playerflag[_cInfo.entityId] = 2; string _phrase799; if (!Phrases.Dict.TryGetValue(799, out _phrase799)) { _phrase799 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. Final warning, drop it!"; } _phrase799 = _phrase799.Replace("{PlayerName}", _cInfo.playerName); _phrase799 = _phrase799.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase799 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } } } else { playerflag.Add(_cInfo.entityId, 1); string _phrase800; if (!Phrases.Dict.TryGetValue(800, out _phrase800)) { _phrase800 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. You have 30 seconds to drop it."; } _phrase800 = _phrase800.Replace("{PlayerName}", _cInfo.playerName); _phrase800 = _phrase800.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase800 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } } } else if (IsEnabled) { _totalInventoryCount++; if (_totalInventoryCount == _count) { _totalInventoryCount = 0; _invClean = 1; } } } } for (int i = 0; i < _playerDataFile.bag.Length; i++) { ItemStack _intemStack = new ItemStack(); ItemValue _itemValue = new ItemValue(); _intemStack = _playerDataFile.bag[i]; _itemValue = _intemStack.itemValue; int _count = _playerDataFile.bag[i].count; if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null) { int _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value; string _name = ItemClass.list[_itemValue.type].GetItemName(); if (Announce_Invalid_Stack && _count > _maxAllowed) { string _phrase3; if (!Phrases.Dict.TryGetValue(3, out _phrase3)) { _phrase3 = " you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}."; } _phrase3 = _phrase3.Replace("{ItemName}", _name); _phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString()); _phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString()); ChatLog.Log(_phrase3, LoadConfig.Server_Response_Name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _cInfo.playerName + _phrase3 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } if (IsEnabled && (dict.Contains(_name) || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.Dev || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.None)) { if (Ban_Player) { SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Invalid Item {1}\"", _cInfo.entityId, _name), (ClientInfo)null); string _phrase4; if (!Phrases.Dict.TryGetValue(4, out _phrase4)) { _phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}."; } _phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName); _phrase4 = _phrase4.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase4 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { if (playerflag.ContainsKey(_cInfo.entityId)) { int _value; if (playerflag.TryGetValue(_cInfo.entityId, out _value)) { if (_value == 2) { string _phrase5; if (!Phrases.Dict.TryGetValue(5, out _phrase5)) { _phrase5 = "Cheat Detected: Auto kicked {PlayerName} for having a invalid item: {ItemName}."; } _phrase5 = _phrase5.Replace("{PlayerName}", _cInfo.playerName); _phrase5 = _phrase5.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase5 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Invalid Item: {1}\"", _cInfo.entityId, _name), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Kicked the player.", _cInfo.playerName, _cInfo.playerId, _name)); sw.WriteLine(); sw.Flush(); sw.Close(); } playerflag.Remove(_cInfo.entityId); } else { playerflag[_cInfo.entityId] = 2; string _phrase799; if (!Phrases.Dict.TryGetValue(799, out _phrase799)) { _phrase799 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. Final warning, drop it!"; } _phrase799 = _phrase799.Replace("{PlayerName}", _cInfo.playerName); _phrase799 = _phrase799.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase799 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } } } else { playerflag.Add(_cInfo.entityId, 1); string _phrase800; if (!Phrases.Dict.TryGetValue(800, out _phrase800)) { _phrase800 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. You have 30 seconds to drop it."; } _phrase800 = _phrase800.Replace("{PlayerName}", _cInfo.playerName); _phrase800 = _phrase800.Replace("{ItemName}", _name); ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase800 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } } } else if (IsEnabled) { _totalBagCount++; if (_totalBagCount == _count) { _totalBagCount = 0; _bagClean = 1; } } } } if (_bagClean == 1 && _invClean == 1) { _bagClean = 0; _invClean = 0; if (dropCheck.Contains(_cInfo.entityId)) { dropCheck.Remove(_cInfo.entityId); } } } } }
public static void OpenSlot() { bool Kicked = false; List <string> _sessionList = new List <string>(Players.Session.Keys); for (int i = 0; i < _sessionList.Count; i++) { if (!Kicked) { string _player = _sessionList[i]; ClientInfo _cInfo = ConnectionManager.Instance.GetClientInfoForPlayerId(_player); if (_cInfo != null) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { if (!Dict.ContainsKey(_cInfo.playerId)) { DateTime _dateTime; Players.Session.TryGetValue(_cInfo.playerId, out _dateTime); TimeSpan varTime = DateTime.Now - _dateTime; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (_timepassed >= Session_Time) { Kicked = true; string _phrase22; if (!Phrases.Dict.TryGetValue(22, out _phrase22)) { _phrase22 = "Sorry {PlayerName} server is at max capacity and this slot is reserved."; } _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase22), (ClientInfo)null); } } else { DateTime _dt; Dict.TryGetValue(_cInfo.playerId, out _dt); if (DateTime.Now > _dt) { DateTime _dateTime; Players.Session.TryGetValue(_cInfo.playerId, out _dateTime); TimeSpan varTime = DateTime.Now - _dateTime; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (_timepassed >= Session_Time) { Kicked = true; string _phrase21; if (!Phrases.Dict.TryGetValue(21, out _phrase21)) { _phrase21 = "Sorry {PlayerName} server is at max capacity and your reserved status has expired."; } _phrase21 = _phrase21.Replace("{PlayerName}", _cInfo.playerName); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase21), (ClientInfo)null); } } } } } } } }
public BCMAdmin(AdminToolsClientInfo atci, ClientInfo ci) { SteamId = atci.SteamID; PermissionLevel = atci.PermissionLevel; PlayerName = ci != null ? ci.playerName : ""; }
public static void Remove(ClientInfo _cInfo, string _playerName) { if (!GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId)) { string _phrase200; if (!Phrases.Dict.TryGetValue(200, out _phrase200)) { _phrase200 = "{PlayerName} you do not have permissions to use this command."; } _phrase200 = _phrase200.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase200), "Server", false, "", false)); } else { AdminToolsClientInfo _admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (_admin.PermissionLevel > PermLevelNeededforMute) { string _phrase200; if (!Phrases.Dict.TryGetValue(200, out _phrase200)) { _phrase200 = "{PlayerName} you do not have permissions to use this command."; } _phrase200 = _phrase200.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase200), "Server", false, "", false)); } else { _playerName = _playerName.Replace("unmute ", ""); ClientInfo _PlayertoUnMute = ConsoleHelper.ParseParamIdOrName(_playerName); if (_PlayertoUnMute == null) { string _phrase201; if (!Phrases.Dict.TryGetValue(201, out _phrase201)) { _phrase201 = "{AdminPlayerName} player {PlayerName} was not found."; } _phrase201 = _phrase201.Replace("{AdminPlayerName}", _cInfo.playerName); _phrase201 = _phrase201.Replace("{PlayerName}", _playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase201, CustomCommands.ChatColor), "Server", false, "", false)); } else { if (!Dict.ContainsKey(_PlayertoUnMute.playerId)) { string _phrase204; if (!Phrases.Dict.TryGetValue(204, out _phrase204)) { _phrase204 = "{AdminPlayerName} player {PlayerName} is not muted."; } _phrase204 = _phrase204.Replace("{AdminPlayerName}", _cInfo.playerName); _phrase204 = _phrase204.Replace("{PlayerName}", _PlayertoUnMute.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase204, CustomCommands.ChatColor), "Server", false, "", false)); } else { Dict.Remove(_PlayertoUnMute.playerId); string _phrase205; if (!Phrases.Dict.TryGetValue(205, out _phrase205)) { _phrase205 = "{AdminPlayerName} you have unmuted {UnMutedPlayerName}."; } _phrase205 = _phrase205.Replace("{AdminPlayerName}", _cInfo.playerName); _phrase205 = _phrase205.Replace("{UnMutedPlayerName}", _PlayertoUnMute.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase205, CustomCommands.ChatColor), "Server", false, "", false)); } } } } }