Example #1
0
        private static string BaseBanNormal(Account player, Account victim, bool warn, DateTime endDate)
        {
            if (victim == null)
            {
                return(Translation.GetLabel("PlayerBanUserInvalid"));
            }
            if (victim.access > player.access)
            {
                return(Translation.GetLabel("PlayerBanAccessInvalid"));
            }
            if (player.player_id == victim.player_id)
            {
                return(Translation.GetLabel("PlayerBanSimilarID"));
            }
            BanHistory banHistory = BanManager.SaveHistory(player.player_id, "DURATION", victim.player_id.ToString(), endDate);

            if (banHistory == null)
            {
                return(Translation.GetLabel("PlayerBanFail"));
            }
            if (warn)
            {
                using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(Translation.GetLabel("PlayerBannedWarning2", (object)victim.player_name)))
                    GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak);
            }
            victim.ban_obj_id = banHistory.object_id;
            victim.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(2), false);
            victim.Close(1000, true);
            return(Translation.GetLabel("PlayerBanSuccess", (object)banHistory.object_id));
        }
Example #2
0
        public static string GetBanData(string str, Account player)
        {
            BanHistory accountBan = BanManager.GetAccountBan(long.Parse(str.Substring(7)));

            if (accountBan == null)
            {
                return(Translation.GetLabel("GetBanInfoError"));
            }
            string msg = Translation.GetLabel("GetBanInfoTitle") + "\n" + Translation.GetLabel("GetBanInfoProvider", (object)accountBan.provider_id) + "\n" + Translation.GetLabel("GetBanInfoType", (object)accountBan.type) + "\n" + Translation.GetLabel("GetBanInfoValue", (object)accountBan.value) + "\n" + Translation.GetLabel("GetBanInfoReason", (object)accountBan.reason) + "\n" + Translation.GetLabel("GetBanInfoStart", (object)accountBan.startDate) + "\n" + Translation.GetLabel("GetBanInfoEnd", (object)accountBan.endDate);

            player.SendPacket((SendPacket) new SERVER_MESSAGE_ANNOUNCE_PAK(msg));
            return(Translation.GetLabel("GetBanInfoSuccess"));
        }