public static void Exec() { try { if (GameManager.Instance.World.Players.dict.Count > 0) { List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null && _cInfoList.Count > 0) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && _cInfo.playerId != null) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { if (SpectatorEnabled && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Spectator_Admin_Level) { if (_player.IsSpectator) { Phrases.Dict.TryGetValue(962, out string _phrase962); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1}\"", _cInfo.playerId, _phrase962), null); 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 spectator mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, using spectator mode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z); Phrases.Dict.TryGetValue(961, out string _phrase961); _phrase961 = _phrase961.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase961 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); continue; } } if (GodEnabled && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Godmode_Admin_Level) { if (_player.Buffs.HasBuff("god")) { Phrases.Dict.TryGetValue(972, out string _phrase972); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1}\"", _cInfo.playerId, _phrase972), null); 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 godmode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("[SERVERTOOLS] Detected \"{0}\", Steam id {1}, using godmode @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z); Phrases.Dict.TryGetValue(971, out string _phrase971); _phrase971 = _phrase971.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase971 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); continue; } } if (FlyEnabled && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Flying_Admin_Level) { if (!Teleportation.Teleporting.Contains(_cInfo.entityId) && _player.IsSpawned() && _player.IsAlive() && !_player.IsStuck && _player.AttachedToEntity == null) { if (AirCheck(_player.position.x, _player.position.y, _player.position.z) || GroundCheck(_player.position.x, _player.position.y, _player.position.z)) { if (OldY.ContainsKey(_cInfo.entityId)) { OldY.TryGetValue(_cInfo.entityId, out float lastY); OldY[_cInfo.entityId] = _player.position.y; if (lastY - _player.position.y >= 4) { if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } continue; } } else { OldY.Add(_cInfo.entityId, _player.position.y); } if (Flag.ContainsKey(_cInfo.entityId)) { Flag.TryGetValue(_cInfo.entityId, out int _flags); if (_flags + 1 >= Flying_Flags) { Flag.Remove(_cInfo.entityId); Phrases.Dict.TryGetValue(982, out string _phrase982); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1}\"", _cInfo.playerId, _phrase982), null); 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}, flying @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, flying @ {2} {3} {4}. Steam Id has been banned", _cInfo.playerName, _cInfo.playerId, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z); Phrases.Dict.TryGetValue(981, out string _phrase981); _phrase981 = _phrase981.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase981 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); continue; } else { Flag[_cInfo.entityId] = _flags + 1; } } else { Flag.Add(_cInfo.entityId, 1); } } else if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } else { if (OldY.ContainsKey(_cInfo.entityId)) { OldY.Remove(_cInfo.entityId); } if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PlayerChecks.Exec: {0}", e.Message)); } }
public static bool ProcessPlayerDamage(EntityAlive __instance, DamageResponse _dmResponse) { try { if (__instance != null) { if (__instance is EntityPlayer) { if (_dmResponse.Source != null && _dmResponse.Strength > 1) { EntityPlayer _player1 = (EntityPlayer)__instance; int _sourceId = _dmResponse.Source.getEntityId(); if (_sourceId > 0 && _player1.entityId != _sourceId) { ClientInfo _cInfo2 = PersistentOperations.GetClientInfoFromEntityId(_sourceId); if (_cInfo2 != null) { EntityPlayer _player2 = PersistentOperations.GetEntityPlayer(_cInfo2.playerId); if (_player2 != null) { ItemValue _itemValue = ItemClass.GetItem(_player2.inventory.holdingItem.Name, true); if (_itemValue != null) { if (Damage_Detector) { int _distance = (int)_player2.GetDistance(__instance); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} \"{2}\" hit \"{3}\" with entity id {4} using {5} for {6} damage @ {7}. Distance: {8}", DateTime.Now, _cInfo2.playerId, _cInfo2.playerName, __instance.EntityName, __instance.entityId, _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(), _dmResponse.Strength, __instance.position, _distance)); sw.WriteLine(); sw.Flush(); sw.Close(); } if (_dmResponse.Strength >= Entity_Damage_Limit && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo2) > Admin_Level) { Phrases.Dict.TryGetValue(952, out string _phrase952); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1} {2}\"", _cInfo2.playerId, _phrase952, _dmResponse.Strength), null); using (StreamWriter sw = new StreamWriter(_detectionFilepath, true)) { sw.WriteLine(string.Format("Detected \"{0}\" Steam Id {1}, exceeded damage limit @ {2}. Damage: {3}", _cInfo2.playerName, _cInfo2.playerId, __instance.position, _dmResponse.Strength)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(951, out string _phrase951); _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo2.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase951 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); return(false); } } } if (Zones.IsEnabled) { if (Zones.ZonePvE.Contains(__instance.entityId) || Zones.ZonePvE.Contains(_cInfo2.entityId)) { Phrases.Dict.TryGetValue(323, out string _phrase323); ChatHook.ChatMessage(_cInfo2, LoadConfig.Chat_Response_Color + _phrase323 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (!_player1.IsFriendsWith(_player2)) { if (PersistentOperations.PvEViolations.ContainsKey(_cInfo2.entityId)) { PersistentOperations.PvEViolations.TryGetValue(_cInfo2.entityId, out int _flags); _flags++; if (PersistentOperations.Jail_Violation > 0 && _flags >= PersistentOperations.Jail_Violation) { Jail(_cInfo2, __instance); } if (PersistentOperations.Kill_Violation > 0 && _flags >= PersistentOperations.Kill_Violation) { Kill(_cInfo2); } if (PersistentOperations.Kick_Violation > 0 && _flags >= PersistentOperations.Kick_Violation) { Kick(_cInfo2); } if (PersistentOperations.Ban_Violation > 0 && _flags >= PersistentOperations.Ban_Violation) { Ban(_cInfo2); } } else { PersistentOperations.PvEViolations.Add(_cInfo2.entityId, 1); } } return(false); } } if (Lobby.IsEnabled && Lobby.PvE && Lobby.LobbyPlayers.Contains(__instance.entityId) || Market.IsEnabled && Market.PvE && Market.MarketPlayers.Contains(__instance.entityId)) { Phrases.Dict.TryGetValue(260, out string _phrase260); ChatHook.ChatMessage(_cInfo2, LoadConfig.Chat_Response_Color + _phrase260 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (!_player1.IsFriendsWith(_player2)) { if (PersistentOperations.PvEViolations.ContainsKey(_cInfo2.entityId)) { PersistentOperations.PvEViolations.TryGetValue(_cInfo2.entityId, out int _violations); _violations++; if (PersistentOperations.Jail_Violation > 0 && _violations >= PersistentOperations.Jail_Violation) { Jail(_cInfo2, __instance); } if (PersistentOperations.Kill_Violation > 0 && _violations >= PersistentOperations.Kill_Violation) { Kill(_cInfo2); } if (PersistentOperations.Kick_Violation > 0 && _violations >= PersistentOperations.Kick_Violation) { Kick(_cInfo2); } else if (PersistentOperations.Ban_Violation > 0 && _violations >= PersistentOperations.Ban_Violation) { Ban(_cInfo2); } } else { PersistentOperations.PvEViolations.Add(_cInfo2.entityId, 1); } } return(false); } if (KillNotice.IsEnabled) { if (KillNotice.Damage.ContainsKey(_player1.entityId)) { KillNotice.Damage[_player1.entityId] = _dmResponse.Strength; } else { KillNotice.Damage.Add(_player1.entityId, _dmResponse.Strength); } } } } } } } else if (__instance is EntityZombie || __instance is EntityAnimal) { if (_dmResponse.Source != null && _dmResponse.Strength > 1) { int _sourceId = _dmResponse.Source.getEntityId(); if (_sourceId > 0) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromEntityId(_sourceId); if (_cInfo != null) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { ItemValue _itemValue = ItemClass.GetItem(_player.inventory.holdingItem.Name, true); if (_itemValue != null) { if (Damage_Detector) { int _distance = (int)_player.GetDistance(__instance); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} \"{2}\" hit \"{3}\" with entity id {4} using {5} for {6} damage @ {7}. Distance: {8}", DateTime.Now, _cInfo.playerId, _cInfo.playerName, __instance.EntityName, __instance.entityId, _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(), _dmResponse.Strength, __instance.position, _distance)); sw.WriteLine(); sw.Flush(); sw.Close(); } if (_dmResponse.Strength >= Entity_Damage_Limit && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Admin_Level) { Phrases.Dict.TryGetValue(952, out string _phrase952); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1} {2}\"", _cInfo.playerId, _phrase952, _dmResponse.Strength), null); using (StreamWriter sw = new StreamWriter(_detectionFilepath, true)) { sw.WriteLine(string.Format("Detected \"{0}\" Steam Id {1}, exceeded damage limit @ {2}. Damage: {3}", _cInfo.playerName, _cInfo.playerId, __instance.position, _dmResponse.Strength)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(951, out string _phrase951); _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase951 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); return(false); } } } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.ProcessPlayerDamage: {0}", e.Message)); } return(true); }
public static bool ProcessPlayerDamage(EntityAlive __instance, DamageResponse _dmResponse) { try { if (__instance != null && __instance is EntityPlayer && _dmResponse.Source != null) { int _sourceId = _dmResponse.Source.getEntityId(); if (_sourceId > 0) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromEntityId(_sourceId); if (_cInfo != null) { EntityPlayer _player2 = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player2 != null) { if (Damage_Detector) { ItemValue _itemValue = ItemClass.GetItem(_player2.inventory.holdingItem.Name, true); if (_itemValue != null) { int _distance = (int)_player2.GetDistance(__instance); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} {2} hit {3} with entity id {4} using {5} for {6} damage @ {7}. Distance: {8}", DateTime.Now, _cInfo.playerId, _cInfo.playerName, __instance.EntityName, __instance.entityId, _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(), _dmResponse.Strength, __instance.position, _distance)); sw.WriteLine(); sw.Flush(); sw.Close(); } if (_dmResponse.Strength >= Entity_Damage_Limit && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Admin_Level) { string _message = "[FF0000]{PlayerName} has been banned for using damage manipulation."; _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 using damage manipulation. Damage recorded: {1}\"", _cInfo.playerId, _dmResponse.Strength), (ClientInfo)null); using (StreamWriter sw = new StreamWriter(_detectionFilepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, using damage manipulation @ {2}. Damage recorded: {3}", _cInfo.playerName, _cInfo.playerId, __instance.position, _dmResponse.Strength)); sw.WriteLine(); sw.Flush(); sw.Close(); } return(false); } } } if (Zones.IsEnabled) { if (Zones.ZonePvE.Contains(__instance.entityId) || Zones.ZonePvE.Contains(_cInfo.entityId)) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "Do not attack players inside a pve zone or while standing in one!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); EntityPlayer _player1 = (EntityPlayer)__instance; if (_player1 != null) { if (!_player1.IsFriendsWith(_player2)) { if (PersistentOperations.PvEViolations.ContainsKey(_cInfo.entityId)) { PersistentOperations.PvEViolations.TryGetValue(_cInfo.entityId, out int _flags); _flags++; if (PersistentOperations.Jail_Violation > 0 && _flags >= PersistentOperations.Jail_Violation) { Jail(_cInfo, __instance); } if (PersistentOperations.Kill_Violation > 0 && _flags >= PersistentOperations.Kill_Violation) { Kill(_cInfo); } if (PersistentOperations.Kick_Violation > 0 && _flags >= PersistentOperations.Kick_Violation) { Kick(_cInfo); } if (PersistentOperations.Ban_Violation > 0 && _flags >= PersistentOperations.Ban_Violation) { Ban(_cInfo); } } else { PersistentOperations.PvEViolations.Add(_cInfo.entityId, 1); } } } return(false); } } if (Lobby.IsEnabled && Lobby.PvE && Lobby.LobbyPlayers.Contains(__instance.entityId) || Market.IsEnabled && Market.PvE && Market.MarketPlayers.Contains(__instance.entityId)) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "Do not attack players inside the lobby or market!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); EntityPlayer _player1 = (EntityPlayer)__instance; if (_player1 != null) { if (!_player1.IsFriendsWith(_player2)) { if (PersistentOperations.PvEViolations.ContainsKey(_cInfo.entityId)) { PersistentOperations.PvEViolations.TryGetValue(_cInfo.entityId, out int _violations); _violations++; if (PersistentOperations.Jail_Violation > 0 && _violations >= PersistentOperations.Jail_Violation) { Jail(_cInfo, __instance); } if (PersistentOperations.Kill_Violation > 0 && _violations >= PersistentOperations.Kill_Violation) { Kill(_cInfo); } if (PersistentOperations.Kick_Violation > 0 && _violations >= PersistentOperations.Kick_Violation) { Kick(_cInfo); } else if (PersistentOperations.Ban_Violation > 0 && _violations >= PersistentOperations.Ban_Violation) { Ban(_cInfo); } } else { PersistentOperations.PvEViolations.Add(_cInfo.entityId, 1); } } } return(false); } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.ProcessPlayerDamage: {0}", e.Message)); } return(true); }
/// <summary> /// Checks whether commands should reply to a user via chat. /// </summary> /// <param name="client">The <see cref="SMClient"/> object representing the client for which to reply.</param> /// <returns><c>true</c> to reply via chat; <c>false</c> to reply via console.</returns> protected bool ShouldReplyToChat(SMClient client) { return(ChatHook.ShouldReplyToChat(client?.ClientInfo)); }
public static void Exec() { try { if (GameManager.Instance.World.Players.dict.Count > 0) { List <ClientInfo> ClientInfoList = PersistentOperations.ClientList(); if (ClientInfoList != null && ClientInfoList.Count > 0) { for (int i = 0; i < ClientInfoList.Count; i++) { ClientInfo _cInfo = ClientInfoList[i]; if (_cInfo != null && _cInfo.playerId != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Admin_Level) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null && _player.IsSpawned()) { var p_speedForward = _player.speedForward; var p_Health = _player.Stats.Health.Value; var p_Stamina = _player.Stats.Stamina.Value; var p_jumpStrength = _player.jumpStrength; var p_height = _player.height; if (p_Health > 250) { using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} \"{1}\" Steam id {2} was detected with an illegal health value: {3}", DateTime.Now, _cInfo.playerName, _cInfo.playerId, p_Health)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("Detected player \"{0}\" Steam id {1} with health @ {2}. 250 is maximum", _cInfo.playerName, _cInfo.playerId, p_Health); if (Kick_Enabled) { Phrases.Dict.TryGetValue(991, out string _phrase991); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase991), null); Phrases.Dict.TryGetValue(992, out string _phrase992); _phrase992 = _phrase992.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase992 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } if (Ban_Enabled) { Phrases.Dict.TryGetValue(993, out string _phrase993); SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1}\"", _cInfo.playerId, _phrase993), null); Phrases.Dict.TryGetValue(994, out string _phrase994); _phrase994 = _phrase994.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase994 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } } if (p_Stamina > 250) { using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} \"{1}\" Steam id {2} was detected with an illegal stamina value: {3}", DateTime.Now, _cInfo.playerName, _cInfo.playerId, p_Stamina)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("Detected player \"{0}\" Steam id {1} with stamina @ {2}. 250 is maximum", _cInfo.playerName, _cInfo.playerId, p_Stamina); if (Kick_Enabled) { Phrases.Dict.TryGetValue(995, out string _phrase995); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase995), null); Phrases.Dict.TryGetValue(996, out string _phrase996); _phrase996 = _phrase996.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase996 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } if (Ban_Enabled) { Phrases.Dict.TryGetValue(997, out string _phrase997); SdtdConsole.Instance.ExecuteSync(string.Format("ban {0} \"{1}\"", _cInfo.playerId, _phrase997), null); Phrases.Dict.TryGetValue(998, out string _phrase998); _phrase998 = _phrase998.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase998 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } } if (p_jumpStrength >= 1.5) { using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} \"{1}\" Steam id {2} was detected with an illegal jump strength value: {3}", DateTime.Now, _cInfo.playerName, _cInfo.playerId, p_jumpStrength)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("Detected player \"{0}\" Steam id {1} at jump strength {2}.", _cInfo.playerName, _cInfo.playerId, p_jumpStrength); if (Kick_Enabled) { Phrases.Dict.TryGetValue(999, out string _phrase999); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase999), null); Phrases.Dict.TryGetValue(1000, out string _phrase1000); _phrase1000 = _phrase1000.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1000 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } if (Ban_Enabled) { Phrases.Dict.TryGetValue(1001, out string _phrase1001); SdtdConsole.Instance.ExecuteSync(string.Format("ban {0} \"{1}\"", _cInfo.playerId, _phrase1001), null); Phrases.Dict.TryGetValue(1002, out string _phrase1002); _phrase1002 = _phrase1002.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1002 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } } if (p_height > 1.8 || p_height < 1.7) { using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} \"{1}\" Steam id {2} was detected with an illegal player height value: {3}", DateTime.Now, _cInfo.playerName, _cInfo.playerId, p_height)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("Detected player \"{0}\" Steam id {1} with player height @ {2}", _cInfo.playerName, _cInfo.playerId, p_height); if (Kick_Enabled) { Phrases.Dict.TryGetValue(1003, out string _phrase1003); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase1003), null); Phrases.Dict.TryGetValue(1004, out string _phrase1004); _phrase1004 = _phrase1004.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1004 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } if (Ban_Enabled) { Phrases.Dict.TryGetValue(1005, out string _phrase1005); SdtdConsole.Instance.ExecuteSync(string.Format("ban {0} \"{1}\"", _cInfo.playerId, _phrase1005), null); Phrases.Dict.TryGetValue(1006, out string _phrase1006); _phrase1006 = _phrase1006.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1006 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } } if (p_speedForward > Max_Speed) { using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("{0} \"{1}\" Steam id {2} was detected with an illegal run speed value: {3}", DateTime.Now, _cInfo.playerName, _cInfo.playerId, p_speedForward)); sw.WriteLine(); sw.Flush(); sw.Close(); } Log.Warning("Detected player \"{0}\" Steam id {1} was detected with an illegal run speed", _cInfo.playerName, _cInfo.playerId); if (Kick_Enabled) { Phrases.Dict.TryGetValue(1007, out string _phrase1007); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase1007), null); Phrases.Dict.TryGetValue(1008, out string _phrase1008); _phrase1008 = _phrase1008.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1008 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } if (Ban_Enabled) { Phrases.Dict.TryGetValue(1009, out string _phrase1009); SdtdConsole.Instance.ExecuteSync(string.Format("ban {0} \"{1}\"", _cInfo.playerId, _phrase1009), null); Phrases.Dict.TryGetValue(1010, out string _phrase1010); _phrase1010 = _phrase1010.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase1010 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } } } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PlayerStats.Exec: {0}", e.Message)); } }
internal static void Init() { if (Applied) { return; } // Init Warden Module32First/Next hook //MessageBox.Show("TEST"); //var snapshot = WinImports.CreateToolhelp32Snapshot(0x00000010 | 0x00000008, (uint) Reader.Process.Id); //var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //var entry = new WinImports.MODULEENTRY32() { dwSize = 548 }; //if (WinImports.Module32First(snapshot, ref entry)) //{ // entry = new WinImports.MODULEENTRY32() { dwSize = 548 }; // while (WinImports.Module32Next(snapshot, ref entry)) // { // if (entry.szExePath.Contains(basePath)) // Reader.WriteBytes(entry.modBaseAddr, new byte[] {0, 0, 0, 0}); // } //} HookModule32.Init(); Libs.Clear(); Libs.InjectFastcall(); Libs.ReloadNav(); ErrorEnumHook.Init(); ChatHook.Init(); GlobalHooks.Init(); //EnterWorldHook.Init(); //EnterWorldCompleteHook.Init(); WindowProcHook.Init(); HookWardenMemScan.SetupDetour(); // Init DirectX DirectX.Init(); // Init the object manager ObjectManager.Init(); // Apply no collision hack with trees var DisableCollision = new Hack(Hacks.DisableCollision, new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 }, "Collision"); HookWardenMemScan.AddHack(DisableCollision); //DisableCollision.Apply(); // Ctm Patch var CtmPatch = new Hack(Hacks.CtmPatch, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, "Ctm"); HookWardenMemScan.AddHack(CtmPatch); //CtmPatch.Apply(); // wallclimb hack yay :) //float wc = 0.5f; //Hack Wallclimb = new Hack(Hacks.Wallclimb, BitConverter.GetBytes(wc), "Wallclimb"); //HookWardenMemScan.AddHack(Wallclimb); //Wallclimb.Apply(); var Collision3 = new Hack(Hacks.Collision3, new byte[] { 0xEB, 0x69 }, "Collision3"); HookWardenMemScan.AddHack(Collision3); // Loot patch var LootPatch = new Hack(Hacks.LootPatch, new byte[] { 0xEB }, "LootPatch"); HookWardenMemScan.AddHack(LootPatch); LootPatch.Apply(); #region Ctm Hide var CtmHide = new Hack(Player.CtmState, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x0C, 0x00, 0x00, 0x00 }, "CtmHideHack") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHide); var CtmHideX = new Hack(Player.CtmX, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackX") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideX); var CtmHideY = new Hack(Player.CtmY, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackY") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideY); var CtmHideZ = new Hack(Player.CtmZ, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackZ") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideZ); #endregion // Lua Unlock var LuaUnlock = new Hack(Hacks.LuaUnlock, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 }, "LuaUnlock"); HookWardenMemScan.AddHack(LuaUnlock); LuaUnlock.Apply(); #if !DEBUG Hack DisableErrorSpam = new Hack((IntPtr)0x00496810, new byte[] { 0xB9, 0x04, 0x00, 0x00, 0x00, 0x90 }, "ErrorSpamDisable"); HookWardenMemScan.AddHack(DisableErrorSpam); DisableErrorSpam.Apply(); #endif Applied = true; }
public static bool ProcessBlockChange(GameManager __instance, string _persistentPlayerId, List <BlockChangeInfo> _blocksToChange) { try { World _world = __instance.World; if (__instance != null && _blocksToChange != null && !string.IsNullOrEmpty(_persistentPlayerId) && _blocksToChange != null) { for (int i = 0; i < _blocksToChange.Count; i++) { BlockChangeInfo _newBlockInfo = _blocksToChange[i]; //new block info BlockValue _oldBlockValue = _world.GetBlock(_newBlockInfo.pos); //old block value Block _oldBlock = _oldBlockValue.Block; if (_newBlockInfo != null && _newBlockInfo.bChangeBlockValue) //new block value { Block _newBlock = _newBlockInfo.blockValue.Block; if (_oldBlockValue.type == BlockValue.Air.type) //old block was air { if (_newBlock is BlockSleepingBag) //placed a sleeping bag { if (POIProtection.IsEnabled && POIProtection.Bed && _world.IsPositionWithinPOI(_newBlockInfo.pos.ToVector3(), 5)) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { GameManager.Instance.World.SetBlockRPC(_newBlockInfo.pos, BlockValue.Air); PersistentOperations.ReturnBlock(_cInfo, _newBlock.GetBlockName(), 1); Phrases.Dict.TryGetValue(1031, out string _phrase1031); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase1031 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return(false); } } } else if (_newBlock is BlockLandClaim)//placed a land claim { if (POIProtection.IsEnabled && POIProtection.Claim && _world.IsPositionWithinPOI(_newBlockInfo.pos.ToVector3(), 5)) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { GameManager.Instance.World.SetBlockRPC(_newBlockInfo.pos, BlockValue.Air); PersistentOperations.ReturnBlock(_cInfo, _newBlock.GetBlockName(), 1); Phrases.Dict.TryGetValue(1032, out string _phrase1032); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase1032 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return(false); } } } else if (_newBlock is BlockPowered)//placed a electric block { Log.Out(string.Format("[SERVERTOOLS] New block is a powered block named {0}", _newBlock.GetBlockName())); } if (BlockLogger.IsEnabled)//placed block { BlockLogger.Log(_persistentPlayerId, _newBlockInfo); } return(true); } if (Damage_Detector) { if (_newBlockInfo.blockValue.type == BlockValue.Air.type) //new block is air { if (_oldBlockValue.type == BlockValue.Air.type) //replaced block { return(true); } if (_oldBlockValue.Block is BlockLandClaim) //removed claim { if (!string.IsNullOrEmpty(_persistentPlayerId)) //id is valid { if (!PersistentOperations.ClaimedByAllyOrSelf(_persistentPlayerId, _newBlockInfo.pos)) { int _total = _oldBlock.MaxDamage - _oldBlockValue.damage; if (_oldBlock.MaxDamage - _oldBlockValue.damage >= Block_Damage_Limit) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.playerId) > Admin_Level) { BlockPenalty(_total, _persistentPlayerId); return(false); } } } } } } if (!_oldBlock.CanPickup && !PersistentOperations.ClaimedByAllyOrSelf(_persistentPlayerId, _newBlockInfo.pos))//old block can not be picked up and unclaimed space { int _total = _oldBlock.MaxDamage - _oldBlockValue.damage; if (_total >= Block_Damage_Limit) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.playerId) > Admin_Level) { BlockPenalty(_total, _persistentPlayerId); return(false); } } } } } else if (_oldBlock.blockID == _newBlock.blockID) //block is the same { if (_newBlockInfo.bChangeDamage) //block took damage { int _total = _newBlockInfo.blockValue.damage - _oldBlockValue.damage; if (_total >= Block_Damage_Limit) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.playerId) > Admin_Level) { BlockPenalty(_total, _persistentPlayerId); return(false); } } } } if (_oldBlockValue.damage == _newBlockInfo.blockValue.damage || _newBlockInfo.blockValue.damage == 0)//block replaced { return(true); } } else if (_oldBlock.DowngradeBlock.Block.blockID == _newBlock.blockID)//downgraded { if (_oldBlockValue.damage == _newBlockInfo.blockValue.damage || _newBlockInfo.blockValue.damage == 0) { return(true); } int _total = _oldBlock.MaxDamage - _oldBlockValue.damage + _newBlockInfo.blockValue.damage; if (_total >= Block_Damage_Limit) { ClientInfo _cInfo = PersistentOperations.GetClientInfoFromSteamId(_persistentPlayerId); if (_cInfo != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.playerId) > Admin_Level) { BlockPenalty(_total, _persistentPlayerId); return(false); } } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.ProcessBlockDamage: {0}", e.Message)); } return(true); }
/// <summary> /// Called when a chat message is sent. /// </summary> /// <param name="client">The <see cref="ClientInfo"/> object representing the client that sent the message.</param> /// <param name="type">The type of chat message.</param> /// <param name="msg">The message text.</param> /// <param name="recipientEntityIds">The list of entity IDs receiving the message.</param> /// <returns><c>true</c> to allow the message to continue propagating; <c>false</c> to consume the message.</returns> private bool OnChatMessage(ClientInfo client, EChatType type, string msg, List <int> recipientEntityIds) { return(ChatHook.HookChatMessage(client, type, msg, recipientEntityIds)); }
/// <summary> /// 引发玩家捕获聊天信息事件 /// </summary> internal void RaiseChatHookEvent(ChatInfo chatInfo) { ChatHook?.Invoke(chatInfo); }
public static void Exec() { try { if ((int)GameManager.Instance.fps.Counter > 4) { List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { EntityAlive _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null && _player.IsSpawned() && _player.IsAlive() && !_player.IsStuck && _player.AttachedToEntity == null) { float _x = _player.position.x; float _y = _player.position.y; float _z = _player.position.z; if (_player.AttachedToEntity == null && (AirCheck(_x, _y, _z) || GroundCheck(_x, _y, _z))) { if (OldY.ContainsKey(_cInfo.entityId)) { float lastY; OldY.TryGetValue(_cInfo.entityId, out lastY); OldY[_cInfo.entityId] = _y; if (lastY - _y >= 4) { if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } continue; } } else { OldY.Add(_cInfo.entityId, _y); } int _flags; if (Flag.TryGetValue(_cInfo.entityId, out _flags)) { if (_flags + 1 >= Flags) { Flag.Remove(_cInfo.entityId); ChatHook.ChatMessage(null, "[FF0000]" + "Cheater! Player " + _cInfo.playerName + " detected flying!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, flying @ {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}, flying @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, _x, _y, _z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Penalty(_cInfo); continue; } else { Flag[_cInfo.entityId] = _flags + 1; } } else { Flag.Add(_cInfo.entityId, 1); } } else if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } else { if (OldY.ContainsKey(_cInfo.entityId)) { OldY.Remove(_cInfo.entityId); } if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Flying.Exec: {0}.", e.Message)); } }
public static void Load() { Timers.TimerStart(); if (TeleportCheck.IsEnabled) { TeleportCheck.DetectionLogsDir(); } if (FlightCheck.IsEnabled) { FlightCheck.DetectionLogsDir(); } if (HatchElevator.IsEnabled) { HatchElevator.DetectionLogsDir(); } if (PlayerLogs.IsEnabled) { PlayerLogs.PlayerLogsDir(); } if (Report.IsEnabled) { Report.ReportLogsDir(); } if (PlayerStatCheck.IsEnabled) { PlayerStatCheck.DetectionLogsDir(); } if (UndergroundCheck.IsEnabled) { UndergroundCheck.DetectionLogsDir(); } if (Bank.IsEnabled) { Bank.CreateFolder(); } if (AuctionBox.IsEnabled) { AuctionBox.CreateFolder(); } if (Bounties.IsEnabled) { Players.CreateFolder(); } if (CredentialCheck.IsEnabled) { CredentialCheck.CreateFolder(); } if (DupeLog.IsEnabled) { DupeLog.CreateFolder(); } Poll.CreateFolder(); if (PersistentContainer.Instance.PollOpen) { Poll.Check(); } if (ChatHook.Special_Player_Name_Coloring) { ChatHook.SpecialIdCheck(); } if (ClanManager.IsEnabled) { PersistentContainer.Instance.Players.GetClans(); ClanManager.BuildList(); } if (!ClanManager.IsEnabled) { PersistentContainer.Instance.Players.clans.Clear(); ClanManager.ClanMember.Clear(); } if (!InfoTicker.IsEnabled && InfoTicker.IsRunning) { InfoTicker.Unload(); } if (InfoTicker.IsEnabled && !InfoTicker.IsRunning) { InfoTicker.Load(); } if (Gimme.IsRunning && !Gimme.IsEnabled) { Gimme.Unload(); } if (!Gimme.IsRunning && Gimme.IsEnabled) { Gimme.Load(); } if (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled) { UndergroundCheck.Unload(); } if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled) { UndergroundCheck.Load(); } if (Badwords.IsRunning && !Badwords.IsEnabled) { Badwords.Unload(); } if (!Badwords.IsRunning && Badwords.IsEnabled) { Badwords.Load(); } if (!LoginNotice.IsRunning && LoginNotice.IsEnabled) { LoginNotice.Load(); } if (LoginNotice.IsRunning && !LoginNotice.IsEnabled) { LoginNotice.Unload(); } if (!Zones.IsRunning && Zones.IsEnabled) { Zones.Load(); } if (Zones.IsRunning && !Zones.IsEnabled) { Zones.Unload(); } if (!VoteReward.IsRunning && VoteReward.IsEnabled) { VoteReward.Load(); } if (VoteReward.IsRunning && !VoteReward.IsEnabled) { VoteReward.Unload(); } if (!Watchlist.IsRunning && Watchlist.IsEnabled) { Watchlist.Load(); } if (Watchlist.IsRunning && !Watchlist.IsEnabled) { Watchlist.Unload(); } if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled) { ReservedSlots.Load(); } if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled) { ReservedSlots.Unload(); } if (!StartingItems.IsRunning && StartingItems.IsEnabled) { StartingItems.Load(); } if (StartingItems.IsRunning && !StartingItems.IsEnabled) { StartingItems.Unload(); } if (!Travel.IsRunning && Travel.IsEnabled) { Travel.Load(); } if (Travel.IsRunning && !Travel.IsEnabled) { Travel.Unload(); } if (!Shop.IsRunning && Shop.IsEnabled) { Shop.Load(); } if (Shop.IsRunning && !Shop.IsEnabled) { Shop.Unload(); } if (!Motd.IsRunning && Motd.IsEnabled) { Motd.Load(); } if (Motd.IsRunning && !Motd.IsEnabled) { Motd.Unload(); } if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled) { InventoryCheck.Unload(); } if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled) { InventoryCheck.Load(); } if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled) { HighPingKicker.Unload(); } if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled) { HighPingKicker.Load(); } if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled) { CredentialCheck.Unload(); } if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled) { CredentialCheck.Load(); } if (CustomCommands.IsRunning && !CustomCommands.IsEnabled) { CustomCommands.Unload(); } if (!CustomCommands.IsRunning && CustomCommands.IsEnabled) { CustomCommands.Load(); } if (DupeLog.IsRunning && !DupeLog.IsEnabled) { DupeLog.Unload(); } if (!DupeLog.IsRunning && DupeLog.IsEnabled) { DupeLog.Load(); } if (AuctionBox.IsEnabled) { AuctionBox.AuctionList(); } if (MutePlayer.IsEnabled) { MutePlayer.MuteList(); } if (Jail.IsEnabled) { Jail.JailList(); } if (Animals.IsEnabled) { Animals.AnimalList(); } if (AutoShutdown.IsEnabled) { AutoShutdown.ShutdownList(); } }
public static bool GameManager_OpenTileEntityAllowed_Prefix(ref bool __result, ref bool __state, int _entityIdThatOpenedIt, TileEntity _te) { try { ClientInfo cInfo = PersistentOperations.GetClientInfoFromEntityId(_entityIdThatOpenedIt); if (cInfo != null) { if (GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.PlatformId) > 0 && GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.CrossplatformId) > 0) { if (DroppedBagProtection.IsEnabled) { if (_te is TileEntityLootContainer) { TileEntityLootContainer lootContainer = _te as TileEntityLootContainer; if (lootContainer.bPlayerBackpack) { if (!DroppedBagProtection.IsAllowed(_entityIdThatOpenedIt, lootContainer)) { Phrases.Dict.TryGetValue("DroppedBagProtection1", out string phrase); ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); __result = false; return(false); } } } } if (Shutdown.UI_Locked) { if (_te is TileEntityLootContainer) { TileEntityLootContainer lootContainer = _te as TileEntityLootContainer; if (lootContainer.bPlayerBackpack) { return(true); } } if (_te is TileEntityWorkstation || _te is TileEntityLootContainer || _te is TileEntitySecureLootContainer || _te is TileEntityVendingMachine || _te is TileEntityTrader) { if (_te is TileEntityTrader) { __state = true; } Phrases.Dict.TryGetValue("Shutdown3", out string phrase); ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); __result = false; return(false); } } if (WorkstationLock.IsEnabled && _te is TileEntityWorkstation) { EntityPlayer entityPlayer = PersistentOperations.GetEntityPlayer(cInfo.entityId); if (entityPlayer != null) { EnumLandClaimOwner owner = PersistentOperations.ClaimedByWho(cInfo.CrossplatformId, new Vector3i(entityPlayer.position)); if (owner != EnumLandClaimOwner.Self && owner != EnumLandClaimOwner.Ally && !PersistentOperations.ClaimedByNone(new Vector3i(entityPlayer.position))) { Phrases.Dict.TryGetValue("WorkstationLock1", out string phrase); ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); __result = false; return(false); } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Injections.GameManager_OpenTileEntityAllowed_Prefix: {0}", e.Message)); } return(true); }