예제 #1
0
 static void Stat(Client player, string[] cmd, int iarg)
 {
     if (cmd.Length == 1)
     {
         Chat.TellStatTo(player, player.Settings, player);
         player.TellSystem(Chat.Yellow + " ", Chat.Gold + Donors.Status(player.MinecraftUsername));
     }
     for (int n = 1; n < cmd.Length; n++)
     {
         ClientSettings s = null;
         Client         p = PlayerList.GetPlayerByName(cmd [n]);
         if (p != null)
         {
             s = p.Settings;
         }
         if (s == null || s.Cloaked != null)
         {
             s = Client.LoadProxyPlayer(cmd [n]);
             p = null;
         }
         if (s == null)
         {
             player.TellSystem(Chat.Red, cmd [n] + " is not found");
         }
         else
         {
             Chat.TellStatTo(p, s, player);
             BadPlayer b = Banned.GetBanHistory(cmd [n]);
             if (b != null)
             {
                 player.TellSystem(Chat.Yellow + cmd [n] + " ", Chat.Red + b.ToString());
             }
         }
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Success != false)
            {
                hash ^= Success.GetHashCode();
            }
            if (playerData_ != null)
            {
                hash ^= PlayerData.GetHashCode();
            }
            if (Banned != false)
            {
                hash ^= Banned.GetHashCode();
            }
            if (Warn != false)
            {
                hash ^= Warn.GetHashCode();
            }
            if (WasCreated != false)
            {
                hash ^= WasCreated.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #3
0
        public override WorldSession Join(Client player)
        {
            ConstructSession cs = new HellSession(player);

            Join(cs, player);
            BadPlayer b = Banned.CheckBanned(player);

            if (b == null)
            {
                player.TellSystem(Chat.White, "Welcome to the world of banned players");
                player.TellSystem(Chat.White, "You are not banned so you can /return");
            }
            else
            {
                player.TellSystem(Chat.White, "You have been banned!");
                player.TellSystem(Chat.White, b.ToString());
            }

            UpdateHealth uh = new UpdateHealth(1, 0);

            player.Queue.Queue(uh);
            player.Queue.Queue(new TimeUpdate(14000));

            player.Queue.Queue(new EntityEffect(player.EntityID, PlayerEffects.Blindness, 10, 20 * 60));

            return(cs);
        }
예제 #4
0
        public void Save(string path = null)
        {
            var newline = new [] { Environment.NewLine };

            _config.Administrators.Clear();
            foreach (var admin in Administrators.Split(newline, StringSplitOptions.RemoveEmptyEntries))
            {
                _config.Administrators.Add(admin);
            }

            _config.Banned.Clear();
            foreach (var banned in Banned.Split(newline, StringSplitOptions.RemoveEmptyEntries))
            {
                _config.Banned.Add(ulong.Parse(banned));
            }

            _config.Mods.Clear();
            foreach (var mod in Mods.Split(newline, StringSplitOptions.RemoveEmptyEntries))
            {
                if (ulong.TryParse(mod, out ulong modId))
                {
                    _config.Mods.Add(modId);
                }
                else
                {
                    Log.Warn($"'{mod}' is not a valid mod ID.");
                }
            }

            _config.Save(path);
        }
예제 #5
0
        void Ban(Client player, string[] cmd, int iarg)
        {
            if (cmd.Length < 3)
            {
                throw new UsageException("Usage: /ban [minutes] username Reason for ban");
            }

            string   username;
            string   reason;
            DateTime expire;
            int      minutes;

            if (int.TryParse(cmd [1], out minutes))
            {
                expire   = DateTime.Now.AddMinutes(minutes);
                username = cmd [2];
                reason   = cmd.JoinFrom(3);
            }
            else
            {
                expire   = DateTime.MaxValue;
                username = cmd [1];
                reason   = cmd.JoinFrom(2);
            }

            Banned.Ban(player, username, expire, reason);
        }
예제 #6
0
        void BanIP(Client player, string[] cmd, int iarg)
        {
            if (!player.AdminAny(Permissions.Ban))
            {
                throw new ErrorException("Disabled");
            }
            if (cmd.Length != 2)
            {
                throw new ShowHelpException();
            }

            var bip = PlayerList.GetPlayerByUsernameOrName(cmd [1]);

            if (bip == null)
            {
                throw new ErrorException("Player offline, no IP");
            }

            if (Banned.Ban(bip.RemoteEndPoint.Address))
            {
                player.TellSystem(Chat.Red, "Banned IP for " + bip.Name);
            }
            else
            {
                player.TellSystem(Chat.Red, "IP already banned for " + bip.Name);
            }
        }
예제 #7
0
        void INotificationHandler.HandleResponse(IQueryClient queryClient, string responseText)
        {
            CommandParameterGroupList parameterGroupList = CommandParameterGroupList.Parse(responseText);

            int?reasonId = parameterGroupList.GetParameterValue <int?>("reasonid") ?? (int)ClientLeftReason.Disconnect;

            switch ((ClientLeftReason)reasonId.Value)
            {
            case ClientLeftReason.Kicked:
                Kicked?.Invoke(queryClient, new ClientKickEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.Banned:
                Banned?.Invoke(queryClient, new ClientBanEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.ConnectionLost:
                ConnectionLost?.Invoke(queryClient, new ClientConnectionLostEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.Disconnect:
                Disconnected?.Invoke(queryClient, new ClientDisconnectEventArgs(parameterGroupList));
                break;
            }
        }
예제 #8
0
        public void RemovePlayer(PlayerMobile pm, bool ban = false)
        {
            var team = GetTeam(pm);

            if (team != null)
            {
                team.RemoveParticipant(pm);

                if (Teams[1] != team && team.Unoccupied)
                {
                    Teams.Remove(team);
                }

                if (ban)
                {
                    Banned.Add(pm);

                    PVPArenaSystem.SendMessage(Host, 1115951);            // You have banned the specified participant.
                    PVPArenaSystem.SendParticipantMessage(this, 1115951); // You have been banned from the session by the host player.
                }
                else
                {
                    PVPArenaSystem.SendMessage(pm, 1115948);              // One of the participants has left your duel session.
                    PVPArenaSystem.SendParticipantMessage(this, 1115948); // One of the participants has left your duel session.
                }

                PendingDuelGump.RefreshAll(this);
            }
        }
예제 #9
0
        /// <summary>
        ///ساخت تایمر برای حذف آی پی  بلاک شده از لیست آی پی های بلاک شده
        /// </summary>
        /// <returns></returns>
        private static Timer CreateBanningTimer()
        {
            var timer = GetTimer(ReleaseInterval);

            timer.Elapsed += delegate { Banned.Pop(); };
            return(timer);
        }
예제 #10
0
 static void AFK(Client player, string[] cmd, int iarg)
 {
     if (Banned.CheckBanned(player) != null)
     {
         return;
     }
     player.SetWorld(World.AFK);
 }
예제 #11
0
 public AresUserHistory()
 {
     this.admins    = new Admin();
     this.bans      = new Banned();
     this.rBans     = new RangeBanned();
     this.records   = new ModelList <Record>();
     this.LastSaved = DateTime.Now;
 }
예제 #12
0
        public async Task <int> IncrementForgive(Banned user)
        {
            user.ForgiveCount++;
            var filter = Builders <Banned> .Filter.Eq("BannedUserId", user.BannedUserId);

            var col = db.GetCollection <Banned>("Banned");
            await col.ReplaceOneAsync(filter, user);

            return(user.ForgiveCount);
        }
예제 #13
0
        private static void Context_BeginRequest(object sender, EventArgs e)
        {
            var ip = HttpContext.Current.Request.UserHostAddress;

            if (Banned.Contains(ip))
            {
                HttpContext.Current.Response.StatusCode = 403;
                HttpContext.Current.Response.End();
            }

            CheckIpAddress(ip);
        }
예제 #14
0
 public void BanOrUnban(User user)
 {
     if (user.IsBanned == true)
     {
         user.IsBanned = Banned.unbanUser();
     }
     else
     {
         user.IsBanned = Banned.banUser();
     }
     db.SaveChanges();
 }
예제 #15
0
 /// <summary>
 /// Provides the JSON Representation of the WebServer
 /// </summary>
 /// <returns></returns>
 public string ToJSON()
 {
     return(string.Format(FormatInfo,
                          string.Join(",", Banned.Select(ban => ban.ToString()).ToArray()),
                          string.Join(",", Clients.Select(c => c.ToJSON()).ToArray()),
                          Encoding.EncodingName,
                          DisconnectTime.TotalMilliseconds.ToString(),
                          Wake.TotalMilliseconds.ToString(),
                          string.Join(",", Parts.Union(m_Sites.Keys).Select(p => '\'' + p + '\'').ToArray()),
                          m_instanceId.ToString(),
                          m_Port.ToString(),
                          m_Identifier));
 }
예제 #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Mobile != null ? Mobile.Serial.Value : 0);
         hashCode = (hashCode * 397) ^ Date.GetHashCode();
         hashCode = (hashCode * 397) ^ (Speech != null ? Speech.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Report != null ? Report.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Jailed.GetHashCode();
         hashCode = (hashCode * 397) ^ Banned.GetHashCode();
         return(hashCode);
     }
 }
예제 #17
0
        static void Pardon(Client player, string[] cmd, int iarg)
        {
            if (cmd.Length != 2)
            {
                throw new ErrorException("Missing username");
            }

            if (player.Admin() || Donors.IsDonor(player))
            {
                Banned.Pardon(player, cmd [1]);
                return;
            }

            Banned.VotePardon(player, cmd [1]);
        }
예제 #18
0
        //#endregion

        //#region CheckIpAddress
        /// <summary>
        /// چک میکنیم که آیا آی پی مورد نظر در لیست
        /// آی پی های است یا خیر ، اگر از حد تعیین شده زیاد بود درخواست هایش لذا بلاک شود
        /// </summary>
        /// <param name="ip">آی پی شخص</param>
        private static void CheckIpAddress(string ip)
        {
            if (!IpAdresses.ContainsKey(ip))
            {
                IpAdresses[ip] = 1;
            }
            else if (IpAdresses[ip] == BannedRequests)
            {
                Banned.Push(ip);
                IpAdresses.Remove(ip);
            }
            else
            {
                IpAdresses[ip]++;
            }
        }
예제 #19
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (BaseMap != null ? BaseMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Description?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)AccessControl;
         hashCode = (hashCode * 397) ^ (Links?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (CreationTimeUtc != null ? CreationTimeUtc.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastModifiedTimeUtc != null ? LastModifiedTimeUtc.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Banned.GetHashCode();
         hashCode = (hashCode * 397) ^ (Identity != null ? Identity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Stats != null ? Stats.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #20
0
        public SystemLog.ErrorCodes Remove(Banned banned, int callerId)
        {
            using (UBContext ubc = new UBContext())
            {
                Banned exists = ubc.Users_Banned
                                .Where(x => x.TelegramUserId == banned.TelegramUserId)
                                .FirstOrDefault();
                if (exists == null)
                {
                    return(SystemLog.ErrorCodes.Error);
                }

                try
                {
                    ubc.Remove(exists);
                    ubc.SaveChanges();
                    return(SystemLog.ErrorCodes.OK);
                }
                catch (Exception ex)
                {
                    Utils.Logging.AddLog(new SystemLog()
                    {
                        LoggerName = "Unifiedban",
                        Date       = DateTime.Now,
                        Function   = "Unifiedban.Data.BannedService.Remove",
                        Level      = SystemLog.Levels.Warn,
                        Message    = ex.Message,
                        UserId     = callerId
                    });
                    if (ex.InnerException != null)
                    {
                        Utils.Logging.AddLog(new SystemLog()
                        {
                            LoggerName = "Unifiedban.Data",
                            Date       = DateTime.Now,
                            Function   = "Unifiedban.Data.BannedService.Remove",
                            Level      = SystemLog.Levels.Warn,
                            Message    = ex.InnerException.Message,
                            UserId     = callerId
                        });
                    }
                }
                return(SystemLog.ErrorCodes.Error);
            }
        }
예제 #21
0
        public async Task <IActionResult> Banned(int advertId)
        {
            if (advertId <= 0 && !_context.Banneds.Any(b => b.Id == advertId))
            {
                return(BadRequest());
            }

            Banned banned = new Banned
            {
                AdvertId = advertId,
                UserId   = User.FindFirstValue(ClaimTypes.NameIdentifier)
            };

            _context.Banneds.Add(banned);
            await _context.SaveChangesAsync();

            return(Ok());
        }
예제 #22
0
 static string FormatSpell(Client player, string message)
 {
     //Translate & spelling
     if (Banned.CheckBanned(player) == null)
     {
         string trans = Translator.TranslateFromPlayer(player, message);
         if (trans == null)
         {
             return(Spelling.SpellFormat(message));
         }
         else
         {
             return(trans); //Don't spell correct translations
         }
     }
     else
     {
         return(Spelling.SpellFormat(message));
     }
 }
예제 #23
0
        static void Prod(Client player, string[] cmd, int iarg)
        {
            if (Banned.CheckBanned(player) != null)
            {
                return;
            }

            if (cmd.Length != 2)
            {
                player.TellSystem(Chat.Purple, "Who?");
                return;
            }
            Client p = PlayerList.GetPlayerByName(cmd [1]);

            if (p == null)
            {
                player.TellSystem(Chat.Red, "Player not found");
                return;
            }
            PlayerInteraction.Prod(player, p);
        }
예제 #24
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)AccessControl;
         hashCode = (hashCode * 397) ^ Banned.GetHashCode();
         hashCode = (hashCode * 397) ^ (BaseGame != null ? BaseGame.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ BaseGameEngineType;
         hashCode = (hashCode * 397) ^ (CreationTimeUtc != null ? CreationTimeUtc.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ GameType;
         hashCode = (hashCode * 397) ^ (Identity != null ? Identity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastModifiedTimeUtc != null ? LastModifiedTimeUtc.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Links?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ MatchDurationInSeconds;
         hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ NumberOfLives;
         hashCode = (hashCode * 397) ^ NumberOfRounds;
         hashCode = (hashCode * 397) ^ ScoreToWin;
         hashCode = (hashCode * 397) ^ (Stats != null ? Stats.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #25
0
        /// <summary>
        /// Pure chat messages
        /// </summary>
        public static void ParseClientChat(Client player, string message)
        {
            //Block unknown prevent mistype
            if (message.StartsWith(",") || message.StartsWith(">"))
            {
                player.TellSystem(Chat.Red, "unknown start symbol, begin with a space to ignore");
                return;
            }

            //remove links from new players

            /*
             * if (player.Uptime.TotalDays < 2)
             * {
             *  player.Tell(Chat.Purple, "New players can't send links");
             *  message = message.Replace("http://", "");
             *  message = message.Replace("https://", "");
             *  var mp = message.Split();
             *  foreach(var m in mp)
             *  {
             *      if(m.StartsWith("http://") ||  m.StartsWith("https://"))
             *  }
             * }*/

            //Short /tell
            if (message.StartsWith("."))
            {
                string[] parts = message.Substring(1).Split(' ');
                if (parts.Length < 2)
                {
                    player.TellSystem(Chat.Red, "Usage: .username message");
                    return;
                }
                message = FormatSpell(player, parts.JoinFrom(1));
                Chatting.Parser.SendPrivateMessage(player, parts [0], message);
                return;
            }

            //Short reply
            if (message.StartsWith("<"))
            {
                if (player.LastInTell == null)
                {
                    player.TellSystem(Chat.Red, "You must have received a private message before replying");
                    return;
                }
                message = FormatSpell(player, message.Substring(1));
                Chatting.Parser.SendPrivateMessage(player, player.LastInTell, message);
                return;
            }

            //Short /t
            if (message.StartsWith("-"))
            {
                if (player.LastOutTell == null)
                {
                    player.TellSystem(Chat.Red, "Use \".username message\" one time first");
                    return;
                }
                message = FormatSpell(player, message.Substring(1));
                Chatting.Parser.SendPrivateMessage(player, player.LastOutTell, message);
                return;
            }

            //CAPS block
            if (message.Length > 3)
            {
                string caps = message.ToUpperInvariant();
                if (caps == message)
                {
                    message = message.ToLowerInvariant();
                }
            }

            //Shout !
            if (message == "!")
            {
                message = "!!";
            }
            bool shout = message.StartsWith("!");

            if (shout)
            {
                message = message.Substring(1);
            }
            if (player.Session.CurrentRegion != null && player.Session.CurrentRegion.Type == "spawn" && player.ChatChannel == null)
            {
                shout = true;
            }

            int receivers = 0;

            //No shouting for banned
            if (shout && Banned.CheckBanned(player) != null)
            {
                player.TellSystem(Chat.Red, "No shouting for the banned!");
                return;
            }

            //Format Translate Spell for all other
            message = FormatSpell(player, message);

            //War chat
            if (!shout)
            {
                if (WarChat(player, message))
                {
                    return;
                }
            }
            if (player.Settings.Cloaked != null || player.Session is PossessSession)
            {
                player.TellSystem(Chat.Red, "no chat while cloaked, pm still works");
                return;
            }


            foreach (Client p in  PlayerList.List)
            {
                if (shout)
                {
                    p.TellSystem(Chat.Gold + player.Name + " " + Chat.White + (p.Settings.Help ? "[shout] " : ""), message);
                    receivers += 1;
                    continue;
                }

                if (player.ChatChannel != null)
                {
                    //Channel chat
                    if (player.ChatChannel == p.ChatChannel)
                    {
                        p.TellSystem(Chat.Blue + player.Name + " " + Chat.Green + "[" + p.ChatChannel + "] ", message);
                        receivers += 1;
                    }
                    continue;
                }

                double distance = player.Session.Position.DistanceTo(p.Session.Position);

                //residents always hear
                if (distance >= DistanceMax && TalkingToResident(player, p))
                {
                    p.TellSystem(Chat.Blue + player.Name + " " + Chat.Aqua + "[" + player.Session.CurrentRegion.Name + "] " + Chat.Gray, message);
                    receivers += 1;
                    continue;
                }

                if (p.Settings.Firehose == false)
                {
                    if (player.Session.World != p.Session.World)
                    {
                        continue;
                    }
                    if (player.Session.Dimension != p.Session.Dimension)
                    {
                        continue;
                    }
                }
                else
                {
                    if (player.Session.World != p.Session.World)
                    {
                        distance = DistanceMax + 1;
                    }
                    if (player.Session.Dimension != p.Session.Dimension)
                    {
                        distance = DistanceMax + 1;
                    }

                    //firehose does not hear banned
                    if ((p.Session is HellSession == false) && Banned.CheckBanned(player) != null)
                    {
                        continue;
                    }
                }

                var chatText = new ChatJson()
                {
                    Text  = message,
                    Color = "gray",
                    //HoverEvent = ChatEvent.HoverShowText("that's what " + player.Name + " said"),
                };
                var c = new ChatJson();
                c.Translate = "%1$s %2$s";
                c.With      = new List <ChatJson>()
                {
                    new ChatJson()
                    {
                        Text       = player.Name,
                        Color      = "blue",
                        ClickEvent = ChatEvent.ClickSuggestCommand("." + player.Name + " "),
                        HoverEvent = ChatEvent.HoverShowText("send private message"),
                    },
                    chatText
                };

                if (distance < DistanceClose && p != player)
                {
                    chatText.Color = "yellow";
                }
                else if (distance < DistanceFar || p.Settings.Firehose && distance < DistanceMax)
                {
                    chatText.Color = "white";
                }
                else if (distance < DistanceMax || p.Settings.Firehose)
                {
                    chatText.Color = "gray";
                }
                else
                {
                    continue;
                }

                var packet = new ChatMessageServer();
                packet.Json = c;

                //Send message
                p.Queue.Queue(packet);

                if (p.Settings.Cloaked != null) //Dont count cloaked players
                {
                    continue;
                }

                if (p != player)
                {
                    receivers += 1;
                }
            }

            if (receivers == 0)
            {
                player.TellSystem(Chat.Blue, "No one heard you, " + Chat.Gray + "see /help");
            }

            Log.WriteChat(player, player.ChatChannel, receivers, message);

            player.ChatEntry = new Entry(player.ChatChannel, message);
        }
예제 #26
0
파일: Player.cs 프로젝트: gamehunt/EXILED
 /// <summary>
 /// Invoked after a player has been banned.
 /// </summary>
 /// <param name="ev">The <see cref="BannedEventArgs"/> instance.</param>
 public static void OnBanned(BannedEventArgs ev) => Banned.InvokeSafely(ev);
예제 #27
0
 public bool IsBanned(PlayerMobile pm)
 {
     return(Banned.Contains(pm));
 }
예제 #28
0
 public void Ban(Banned ban)
 {
     this.ban = ban;
 }
예제 #29
0
 void MassPardon(Client player, string[] cmd, int iarg)
 {
     Banned.MassPardon();
     player.TellSystem(Chat.Purple, "Pardoned all players");
 }
예제 #30
0
                public void Save(string Key)
                {
                    bool   found      = false;
                    string OutputFile = "./Database/Users/" + Name + "/Info.Dat";

                    Utilities.IO.PrepareDirectory("./Database/");
                    Utilities.IO.PrepareDirectory("./Database/Users/");
                    Utilities.IO.PrepareDirectory("./Database/Users/" + Name);
                    Utilities.IO.PrepareFile(OutputFile);
                    string[]      OutputFileContents = Utilities.IO.ReadAllLines(OutputFile);
                    string        OutTime            = Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(DateTime.Now));
                    List <String> Output             = new List <String>();

                    foreach (string line in OutputFileContents)
                    {
                        #region GetDataCouplets
                        string ThisLine = line;
                        if (!(ThisLine.Contains("\t")))
                        {
                            Output.Add(line);
                            continue;
                        }
                        while (ThisLine.Contains("\t\t"))
                        {
                            ThisLine = ThisLine.Replace("\t\t", "\t");
                        }
                        string Header    = ThisLine.Split('\t')[0];
                        string Data      = ThisLine.Remove(0, ((Header.Length) + 1));
                        var    Converted = Utilities.IO.StringToVariable(Data);
                        //NOTE: These WILL Bypass GUI mode if enabled, as the GUI setting is turned on until it is read.
                        //if (Converted is Boolean) Logger.Console.WriteLine(String.Format("Bool: {0}", Data));
                        //if (Converted is IPAddress) Logger.Console.WriteLine(String.Format("IPAddress: {0}", Data));
                        //if (Converted is Decimal) Logger.Console.WriteLine(String.Format("Decimal: {0}", Data));
                        //if (Converted is Int32) Logger.Console.WriteLine(String.Format("Int32: {0}", Data));
                        //if (Converted is String) Logger.Console.WriteLine(String.Format("String: {0}", Data));
                        #endregion
                        if (Key.ToUpperInvariant() != Header.ToUpperInvariant())
                        {
                            Output.Add(line);
                            continue;
                        }
                        switch (Header.ToUpperInvariant())
                        {
                            #region Switches
                        case Strings.Name:
                            Output.Add(Strings.Name + "\t\t" + Name);
                            found = true;
                            break;

                        case Strings.DisplayedName:
                            Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString());
                            found = true;
                            break;

                        case Strings.LastIP:
                            Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString());
                            found = true;
                            break;

                        case Strings.LoginCount:
                            Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString());
                            found = true;
                            break;

                        case Strings.MessagesTyped:
                            Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString());
                            found = true;
                            break;

                        case Strings.DateJoined:
                            Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString());
                            found = true;
                            break;

                        case Strings.DateLastVisited:
                            Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString());
                            found = true;
                            break;

                        case Strings.PlayTime:
                            Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString());
                            found = true;
                            break;

                        case Strings.Kills:
                            Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString());
                            found = true;
                            break;

                        case Strings.Deaths:
                            Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString());
                            found = true;
                            break;

                        case Strings.FlightsFlown:
                            Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString());
                            found = true;
                            break;

                        case Strings.FlightHours:
                            Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString());
                            found = true;
                            break;

                        case Strings.Banned:
                            Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString());
                            found = true;
                            break;

                        case Strings.BannedBy:
                            Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateBanned:
                            Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString());
                            found = true;
                            break;

                        case Strings.BanExpires:
                            Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString());
                            found = true;
                            break;

                        case Strings.BanReason:
                            Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesBanned:
                            Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString());
                            found = true;
                            break;

                        case Strings.Frozen:
                            Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString());
                            found = true;
                            break;

                        case Strings.FrozenBy:
                            Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString());
                            found = true;
                            break;

                        case Strings.DateFrozen:
                            Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString());
                            found = true;
                            break;

                        case Strings.FreezeExpires:
                            Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString());
                            found = true;
                            break;

                        case Strings.FreezeReason:
                            Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesFrozen:
                            Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString());
                            found = true;
                            break;

                        case Strings.Muted:
                            Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString());
                            found = true;
                            break;

                        case Strings.MutedBy:
                            Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateMuted:
                            Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString());
                            found = true;
                            break;

                        case Strings.MuteExpires:
                            Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString());
                            found = true;
                            break;

                        case Strings.MuteReason:
                            Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesMuted:
                            Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString());
                            found = true;
                            break;

                        case Strings.Kicked:
                            Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString());
                            found = true;
                            break;

                        case Strings.KickedBy:
                            Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateKicked:
                            Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString());
                            found = true;
                            break;

                        case Strings.KickReason:
                            Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesKicked:
                            Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString());
                            found = true;
                            break;

                        case Strings.OthersBanned:
                            Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString());
                            found = true;
                            break;

                        case Strings.OthersFrozen:
                            Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString());
                            found = true;
                            break;

                        case Strings.OthersMuted:
                            Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString());
                            found = true;
                            break;

                        case Strings.OthersKicked:
                            Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString());
                            found = true;
                            break;

                        case Strings.GroupRepresented:
                            Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString());
                            found = true;
                            break;

                            #endregion
                        default:
                            Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Header));
                            //Unrecognised Value.
                            break;
                        }
                    }
                    if (!found)
                    {
                        switch (Key)
                        {
                            #region Switches
                        case Strings.Name:
                            Output.Add(Strings.Name + "\t\t" + Name);
                            found = true;
                            break;

                        case Strings.DisplayedName:
                            Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString());
                            found = true;
                            break;

                        case Strings.LastIP:
                            Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString());
                            found = true;
                            break;

                        case Strings.LoginCount:
                            Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString());
                            found = true;
                            break;

                        case Strings.MessagesTyped:
                            Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString());
                            found = true;
                            break;

                        case Strings.DateJoined:
                            Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString());
                            found = true;
                            break;

                        case Strings.DateLastVisited:
                            Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString());
                            found = true;
                            break;

                        case Strings.PlayTime:
                            Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString());
                            found = true;
                            break;

                        case Strings.Kills:
                            Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString());
                            found = true;
                            break;

                        case Strings.Deaths:
                            Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString());
                            found = true;
                            break;

                        case Strings.FlightsFlown:
                            Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString());
                            found = true;
                            break;

                        case Strings.FlightHours:
                            Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString());
                            found = true;
                            break;

                        case Strings.Banned:
                            Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString());
                            found = true;
                            break;

                        case Strings.BannedBy:
                            Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateBanned:
                            Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString());
                            found = true;
                            break;

                        case Strings.BanExpires:
                            Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString());
                            found = true;
                            break;

                        case Strings.BanReason:
                            Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesBanned:
                            Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString());
                            found = true;
                            break;

                        case Strings.Frozen:
                            Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString());
                            found = true;
                            break;

                        case Strings.FrozenBy:
                            Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString());
                            found = true;
                            break;

                        case Strings.DateFrozen:
                            Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString());
                            found = true;
                            break;

                        case Strings.FreezeExpires:
                            Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString());
                            found = true;
                            break;

                        case Strings.FreezeReason:
                            Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesFrozen:
                            Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString());
                            found = true;
                            break;

                        case Strings.Muted:
                            Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString());
                            found = true;
                            break;

                        case Strings.MutedBy:
                            Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateMuted:
                            Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString());
                            found = true;
                            break;

                        case Strings.MuteExpires:
                            Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString());
                            found = true;
                            break;

                        case Strings.MuteReason:
                            Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesMuted:
                            Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString());
                            found = true;
                            break;

                        case Strings.Kicked:
                            Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString());
                            found = true;
                            break;

                        case Strings.KickedBy:
                            Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString());
                            found = true;
                            break;

                        case Strings.DateKicked:
                            Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString());
                            found = true;
                            break;

                        case Strings.KickReason:
                            Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString());
                            found = true;
                            break;

                        case Strings.TimesKicked:
                            Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString());
                            found = true;
                            break;

                        case Strings.OthersBanned:
                            Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString());
                            found = true;
                            break;

                        case Strings.OthersFrozen:
                            Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString());
                            found = true;
                            break;

                        case Strings.OthersMuted:
                            Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString());
                            found = true;
                            break;

                        case Strings.OthersKicked:
                            Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString());
                            found = true;
                            break;

                        case Strings.GroupRepresented:
                            Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString());
                            found = true;
                            break;

                            #endregion
                        default:
                            Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Key));
                            //Unrecognised Value.
                            break;
                        }
                    }
                    try
                    {
                        File.WriteAllLines(OutputFile, Output.ToList());
                    }
                    catch
                    {
                    }
                }
예제 #31
0
        public static void SendPrivateMessage(Client player, string name, string msg)
        {
            if (Banned.CheckBanned(player) != null)
            {
                player.TellSystem(Chat.Red, "No PM in Hell, wait for someone to join");
                return;
            }

            Client p = PlayerList.GetPlayerByName(name);

            //Make sure the player ever has been online
            if (p == null)
            {
                if (File.Exists("proxy/players/" + Path.GetFileName(name) + ".json") == false)
                {
                    player.TellSystem(Chat.Red, "No such player: " + Format.StripFormat(name));
                    return;
                }
                Inbox.Write(player, name, msg);

                Log.WriteChat(player, name, 1, msg);
            }
            else
            {
                Log.WriteChat(player, p.MinecraftUsername, 1, msg);
            }

            string trans = Translator.TranslateFromPlayer(player, msg);

            if (trans != null)
            {
                msg = trans;
            }

            player.LastOutTell = name.ToLowerInvariant();

            string chatRecipient = Chat.Yellow + player.Name;

            //Sender display
            if (p == null || p.Settings.Cloaked != null && p.LastOutTell != player.Name.ToLowerInvariant())
            {
                //Offline/hidden
                player.TellSystem("> " + Chat.Yellow + name + Chat.Gray + (player.Settings.Help ? " [private] " : " "), msg);
                player.TellSystem(Chat.Red, name + " is offline, message saved in their inbox");

                chatRecipient += Chat.Red + " (hidden)";
            }
            else
            {
                //Online, visible or started conversation
                player.TellSystem("> " + Chat.Yellow + p.Name + Chat.Gray + (player.Settings.Help ? " [private] " : " "), msg);
                player.LastOutTell = p.Name.ToLowerInvariant();
            }

            if (p == null)
            {
                return;
            }

            //Recipient display
            if (player.Session.Position.DistanceTo(p.Session.Position) < Parser.DistanceClose)
            {
                chatRecipient += Chat.White + (p.Settings.Help ? " [private] " : " ");
            }
            else
            {
                chatRecipient += Chat.Gray + (p.Settings.Help ? " [private] " : " ");
            }

            p.TellSystem(chatRecipient, msg);
            p.LastInTell = player.Name;
        }