//BanAction public static void ProcessAction(Client client, Player player, BanAction action) { var target = DbInterface.GetPlayer(action.Name); if (target != null) { if (string.IsNullOrEmpty(Ban.CheckBan(target.User, ""))) { if (action.BanIp == true) { Ban.Add( target.User, action.DurationDays, action.Reason, player.Name, target.Client?.GetIp() ?? "" ); } else { Ban.Add(target.User, action.DurationDays, action.Reason, player.Name, ""); } target.Client?.Disconnect(); PacketSender.SendChatMsg(player, Strings.Account.banned.ToString(target.Name), Color.Red); } else { PacketSender.SendChatMsg(player, Strings.Account.alreadybanned.ToString(target.Name), Color.Red); } } else { PacketSender.SendChatMsg(player, Strings.Player.offline); } }
//BanAction public static void ProcessAction(Client client, Player player, BanAction action) { var target = Player.Find(action.Name); if (target != null) { if (string.IsNullOrEmpty(Ban.CheckBan(target.User, ""))) { if (action.BanIp == true) { Ban.Add( target.User, action.DurationDays, action.Reason, player.Name, target.Client?.GetIp() ?? "" ); } else { Ban.Add(target.User, action.DurationDays, action.Reason, player.Name, ""); } UserActivityHistory.LogActivity(target?.UserId ?? Guid.Empty, target?.Id ?? Guid.Empty, target?.Client?.GetIp(), UserActivityHistory.PeerType.Client, UserActivityHistory.UserAction.DisconnectBan, $"{target.User?.Name},{target.Name}"); target.Client?.Disconnect(); PacketSender.SendChatMsg(player, Strings.Account.banned.ToString(target.Name), Enums.ChatMessageType.Admin, Color.Red); } else { PacketSender.SendChatMsg(player, Strings.Account.alreadybanned.ToString(target.Name), Enums.ChatMessageType.Admin, Color.Red); } } else { PacketSender.SendChatMsg(player, Strings.Player.offline, Enums.ChatMessageType.Admin); } }
//BanAction public static void ProcessAction(Client client, Player player, BanAction action) { var target = Player.Find(action.Name); if (target != null) { if (string.IsNullOrEmpty(Ban.CheckBan(target.User, ""))) { if (action.BanIp == true) { Ban.Add( target.User, action.DurationDays, action.Reason, player.Name, target.Client?.GetIp() ?? "" ); } else { Ban.Add(target.User, action.DurationDays, action.Reason, player.Name, ""); } using (var logging = DbInterface.LoggingContext) { logging.UserActivityHistory.Add( new UserActivityHistory { UserId = target.UserId, PlayerId = target.Id, Ip = target.Client?.GetIp(), Peer = UserActivityHistory.PeerType.Client, Action = UserActivityHistory.UserAction.DisconnectBan, Meta = $"{target.User?.Name},{target.Name}" } ); } target.Client?.Disconnect(); PacketSender.SendChatMsg(player, Strings.Account.banned.ToString(target.Name), Enums.ChatMessageType.Admin, Color.Red); } else { PacketSender.SendChatMsg(player, Strings.Account.alreadybanned.ToString(target.Name), Enums.ChatMessageType.Admin, Color.Red); } } else { PacketSender.SendChatMsg(player, Strings.Player.offline, Enums.ChatMessageType.Admin); } }