Exemple #1
0
        WhoInfo FromOnline(Player who)
        {
            WhoInfo info   = new WhoInfo();
            string  prefix = who.title == "" ? "" : who.color + "[" + who.titlecolor + who.title + who.color + "] ";

            info.FullName = prefix + who.ColoredName;
            info.Name     = who.name;
            info.Group    = who.group;
            info.Money    = who.money; info.Deaths = who.overallDeath;

            info.TotalBlocks = who.overallBlocks; info.TotalDrawn = who.TotalDrawn;
            info.TotalPlaced = who.TotalPlaced; info.TotalDeleted = who.TotalDeleted;
            info.LoginBlocks = who.loginBlocks;

            info.TimeSpent = who.time; info.TimeOnline = DateTime.Now - who.timeLogged;
            info.First     = who.firstLogin;
            info.Logins    = who.totalLogins; info.Kicks = who.totalKicked;
            info.IP        = who.ip; info.AfkMessage = who.afkMessage;
            info.IdleTime  = DateTime.UtcNow - who.LastAction;

            info.RoundsTotal   = who.Game.TotalRoundsSurvived;
            info.RoundsMax     = who.Game.MaxRoundsSurvived;
            info.InfectedTotal = who.Game.TotalInfected;
            info.InfectedMax   = who.Game.MaxInfected;
            info.TotalRounds   = (int)who.ExtraData["TotalRounds"]; info.Wins = (int)who.ExtraData["Wins"]; info.Losses = (int)who.ExtraData["Losses"]; info.Draws = (int)who.ExtraData["Draws"];
            info.Goals         = (int)who.ExtraData["Goals"]; info.Assists = (int)who.ExtraData["Assists"]; info.OwnGoals = (int)who.ExtraData["OwnGoals"]; info.Saves = (int)who.ExtraData["Saves"]; info.Fouls = (int)who.ExtraData["Fouls"];
            return(info);
        }
Exemple #2
0
        WhoInfo FromOffline(PlayerData data, string message)
        {
            Group  group  = Group.GroupIn(data.Name);
            string color  = data.Color == "" ? group.Color : data.Color;
            string prefix = data.Title == "" ? "" : color + "[" + data.TitleColor + data.Title + color + "] ";

            WhoInfo info = new WhoInfo();

            info.FullName = prefix + color + data.Name.TrimEnd('+');
            info.Name     = data.Name;
            info.Group    = group;
            info.Money    = data.Money; info.Deaths = data.Deaths;

            info.TotalBlocks = data.TotalModified; info.TotalDrawn = data.TotalDrawn;
            info.TotalPlaced = data.TotalPlaced; info.TotalDeleted = data.TotalDeleted;
            info.LoginBlocks = -1;

            info.TimeSpent = data.TotalTime.ToString().ParseDBTime();
            info.First     = data.FirstLogin;
            info.Last      = data.LastLogin;
            info.Logins    = data.Logins; info.Kicks = data.Kicks;
            info.IP        = data.IP;

            if (Server.zombie.Running)
            {
                ZombieStats stats = Server.zombie.LoadZombieStats(data.Name);
                info.RoundsTotal = stats.TotalRounds; info.InfectedTotal = stats.TotalInfected;
                info.RoundsMax   = stats.MaxRounds; info.InfectedMax = stats.MaxInfected;
            }

            if (Core.Match != null)
            {
                FootballStats stats = Stats.LoadFootballStats(data.Name);
                info.TotalRounds = stats.TotalRounds; info.Wins = stats.Wins; info.Losses = stats.Losses; info.Draws = stats.Draws;
                info.Goals       = stats.Goals; info.Assists = stats.Assists; info.OwnGoals = stats.OwnGoals; info.Saves = stats.Saves;
            }
            return(info);
        }
Exemple #3
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                message = p.name;
            }
            int    matches;
            Player pl = PlayerInfo.FindMatches(p, message, out matches);

            if (matches > 1)
            {
                return;
            }

            WhoInfo info;

            if (matches == 1)
            {
                info = FromOnline(pl);
            }
            else
            {
                if (!Formatter.ValidName(p, message, "player"))
                {
                    return;
                }
                Player.Message(p, "Searching database for the player..");
                PlayerData target = PlayerInfo.FindOfflineMatches(p, message);
                if (target == null)
                {
                    return;
                }
                info = FromOffline(target, message);
            }
            WhoInfo.Output(p, info, CheckExtraPerm(p));
        }
Exemple #4
0
        public static void Output(Player p, WhoInfo who, bool canSeeIP)
        {
            Player.Message(p, who.FullName + " %S(" + who.Name + ") has:");
            Player.Message(p, "  Rank of " + who.Group.ColoredName);

            if (Economy.Enabled)
            {
                Player.Message(p, "  &a{0} &cdeaths%S, &a{2} %S{3}, {1} %Sawards",
                               who.Deaths, Awards.AwardAmount(who.Name), who.Money, Server.moneys);
            }
            else
            {
                Player.Message(p, "  &a{0} &cdeaths%S, {1} %Sawards",
                               who.Deaths, Awards.AwardAmount(who.Name));
            }

            if (who.LoginBlocks >= 0)
            {
                Player.Message(p, "  Modified &a{0} %Sblocks, &a{1} %Ssince login", who.TotalBlocks, who.LoginBlocks);
            }
            else
            {
                Player.Message(p, "  Modified &a{0} %Sblocks", who.TotalBlocks);
            }
            Player.Message(p, "    &a{0} %Splaced, &a{1} %Sdeleted, &a{2} %Sdrawn",
                           who.TotalPlaced, who.TotalDeleted, who.TotalDrawn);

            if (who.TimeOnline.Ticks > 0)
            {
                Player.Message(p, "  Spent &a{0} %Son the server, &a{1} %Sthis session",
                               who.TimeSpent.Shorten(), who.TimeOnline.Shorten());
            }
            else
            {
                Player.Message(p, "  Spent &a{0} %Son the server", who.TimeSpent.Shorten());
            }

            if (who.Last.Ticks > 0)
            {
                Player.Message(p, "  First login &a" + who.First.ToString("yyyy-MM-dd")
                               + "%S, last login &a" + who.Last.ToString("yyyy-MM-dd"));
            }
            else
            {
                Player.Message(p, "  First login on &a" + who.First.ToString("yyyy-MM-dd")
                               + "%S, and is currently &aonline");
            }

            Player.Message(p, "  Logged in &a{0} %Stimes, &c{1} %Sof which ended in a kick", who.Logins, who.Kicks);
            if (who.Group.Permission == LevelPermission.Banned)
            {
                string[] data = Ban.GetBanData(who.Name);
                if (data != null)
                {
                    Player.Message(p, "  is banned for " + data[1] + " by " + data[0]);
                }
                else
                {
                    Player.Message(p, "  is banned");
                }
            }

            if (Server.Devs.CaselessContains(who.Name.TrimEnd('+')))
            {
                Player.Message(p, "  Player is an &9MCGalaxy Developer");
            }
            if (Server.Mods.CaselessContains(who.Name.TrimEnd('+')))
            {
                Player.Message(p, "  Player is an &9MCGalaxy Moderator");
            }

            if (canSeeIP)
            {
                string ipMsg = who.IP;
                if (Server.bannedIP.Contains(who.IP))
                {
                    ipMsg = "&8" + who.IP + ", which is banned";
                }
                Player.Message(p, "  The IP of " + ipMsg);
                if (ServerConfig.WhitelistedOnly && Server.whiteList.Contains(who.Name))
                {
                    Player.Message(p, "  Player is &fWhitelisted");
                }
            }

            if (who.AfkMessage != null)
            {
                Player.Message(p, "  Idle for {0} (AFK {1}%S)", who.IdleTime.Shorten(), who.AfkMessage);
            }
            else if (who.IdleTime.TotalMinutes >= 1)
            {
                Player.Message(p, "  Idle for {0}", who.IdleTime.Shorten());
            }
            if (Core.Match != null)
            {
                Player.Message(p, "  Participated in &a{0} %Sgames", who.TotalRounds);
                Player.Message(p, "  Won &a{0} %Sgames", who.Wins);
                Player.Message(p, "  Lost &a{0} %Sgames", who.Losses);
                Player.Message(p, "  Drawed &a{0} %Sgames", who.Draws);
                Player.Message(p, "  Scored &a{0} %Sgoals", who.Goals);
                Player.Message(p, "  Made &a{0} %Sassists", who.Assists);
                Player.Message(p, "  Saved &a{0} %Stimes", who.Saves);
                Player.Message(p, "  Scored on themselves &a{0} %Stimes", who.OwnGoals);
                Player.Message(p, "  Fouled &a{0} %Stimes", who.Fouls);
                Player.Message(p, "  Has skill slots: &a{0}", who.Pace);
            }

            if (!Server.zombie.Running)
            {
                return;
            }
            Player.Message(p, "  Survived &a{0} %Srounds (max &e{1}%S)",
                           who.RoundsTotal, who.RoundsMax);
            Player.Message(p, "  Infected &a{0} %Splayers (max &e{1}%S)",
                           who.InfectedTotal, who.InfectedMax);
        }