예제 #1
0
        public override void Use(Player p, string message)
        {
            Player who = null;

            if (message == "")
            {
                who = p; message = p.name;
            }
            else
            {
                who = Player.Find(message);
            }
            if (who != null && !who.hidden)
            {
                Player.SendMessage(p, who.color + who.name + Server.DefaultColor + " is on &b" + who.level.name);
                Player.SendMessage(p, who.color + who.prefix + who.name + Server.DefaultColor + " has :");
                Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
                Player.SendMessage(p, "> > the display name of " + who.color + who.displayName);
                Player.SendMessage(p, "> > &a" + who.money + Server.DefaultColor + " " + Server.moneys);
                Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + Server.DefaultColor + " times");
                Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + Server.DefaultColor + " blocks, &a" + who.loginBlocks + Server.DefaultColor + " since logging in.");
                //int ratio = (int)(Math.Round((decimal)(1 / (Math.Min(who.destroyedBlocks, (who.overallBlocks - who.destroyedBlocks)) / Math.Max(who.destroyedBlocks, (who.overallBlocks - who.destroyedBlocks))))));
                try { Player.SendMessage(p, "> > destroyed &a" + who.destroyedBlocks + Server.DefaultColor + " blocks, and built &a" + who.builtBlocks + Server.DefaultColor + "."); }
                catch { }
                // MaxMind
                string countryname = Server.iploopup.getCountry(IPAddress.Parse(who.ip)).getName();
                if (Server.useMaxMind)
                {
                    Player.SendMessage(p, "> > logged in from country &a" + countryname);
                }
                Player.SendMessage(p, "> > time spent on server: &a" + who.timeSpent.Split(' ')[0] + " Days, " + who.timeSpent.Split(' ')[1] + " Hours, " + who.timeSpent.Split(' ')[2] + " Minutes.");
                string storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss");
                Player.SendMessage(p, "> > been logged in for &a" + storedTime);
                Player.SendMessage(p, "> > first logged into the server on &a" + who.firstLogin.ToString("yyyy-MM-dd") + " at " + who.firstLogin.ToString("HH:mm:ss"));
                Player.SendMessage(p, "> > logged in &a" + who.totalLogins + Server.DefaultColor + " times, &c" + who.totalKicked + Server.DefaultColor + " of which ended in a kick.");
                Player.SendMessage(p, "> > " + Awards.awardAmount(who.name) + " awards");
                if (!who.haswom)
                {
                    Player.SendMessage(p, "> > is not using &cWOM Game Client" + Server.DefaultColor + ".");
                }
                else
                {
                    Player.SendMessage(p, "> > is using &aWOM Game Client" + Server.DefaultColor + ", Version &a" + who.womversion + Server.DefaultColor + ".");
                }
                // Last ranked/banned reason:
                if (who.lastRankReason.ToLower() != "none" && !String.IsNullOrEmpty(who.lastRankReason))
                {
                    if (Group.findPerm(LevelPermission.Banned).playerList.Contains(who.name))
                    {
                        Player.SendMessage(p, "> > last &8banned&g at &a" + who.lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + who.lastRankReason.Substring(who.lastRankReason.IndexOf("]") + 1).Trim());
                    }
                    else
                    {
                        Player.SendMessage(p, "> > last &branked&g at &a" + who.lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + who.lastRankReason.Substring(who.lastRankReason.IndexOf("]") + 1).Trim());
                    }
                }
                bool skip = false;
                if (p != null)
                {
                    if (p.group.Permission <= LevelPermission.Operator)
                    {
                        skip = true;
                    }
                }
                if (!skip)
                {
                    string givenIP;
                    if (Server.bannedIP.Contains(who.ip))
                    {
                        givenIP = "&8" + who.ip + ", which is banned";
                    }
                    else
                    {
                        givenIP = who.ip;
                    }
                    Player.SendMessage(p, "> > the IP of " + givenIP);
                }
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(who.name))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
                if (Server.devs.Contains(who.name.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                }
                if (Server.staff.Contains(who.name.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a member of &4MCDawn Staff");
                }
                if (Server.administration.Contains(who.name.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &6MCDawn Administrator");
                }
            }
            else
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message);
            }
        }
예제 #2
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + "&g is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            DataTable playerDb = MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'");

            if (playerDb.Rows.Count == 0)
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + "&g has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + "&g has :");
            Player.SendMessage(p, "> > the rank of \"" + Group.Find(FoundRank).color + FoundRank);
            Player.SendMessage(p, "> > the display name of " + playerDb.Rows[0]["displayName"]);
            Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + "&g " + Server.moneys);
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + "&g times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + "&g blocks.");
            //int ratio = (int)(Math.Round((decimal)(1 / (Math.Min(Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()), (Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()))) / Math.Max(Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()), (Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString())))))));
            Int64 builtBlocks = 0;

            try { builtBlocks = Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()); }
            catch { builtBlocks = 0; }
            if (builtBlocks < 0)
            {
                builtBlocks = 0;
            }
            try { Player.SendMessage(p, "> > destroyed &a" + playerDb.Rows[0]["destroyedBlocks"].ToString() + "&g blocks, and built &a" + builtBlocks + "&g."); }
            catch { }
            Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]);
            try { if (Server.useMaxMind)
                  {
                      Player.SendMessage(p, "> > last logged in from country &a" + playerDb.Rows[0]["countryName"]);
                  }
            }
            catch { }
            Player.SendMessage(p, "> > " + TimeSpent(playerDb.Rows[0]["TimeSpent"].ToString()));
            Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]);
            Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + "&g times, &c" + playerDb.Rows[0]["totalKicked"] + "&g of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");
            if (playerDb.Rows[0]["HasWOM"].ToString().Trim() == "")
            {
                Player.SendMessage(p, "> > last logged in without &cWOM Game Client" + "&g.");
            }
            else
            {
                Player.SendMessage(p, "> > last logged in using &aWOM Game Client" + "&g, Version &a" + playerDb.Rows[0]["HasWOM"].ToString().Trim() + "&g.");
            }
            // Last ranked/banned reason:
            string lastRankReason = playerDb.Rows[0]["lastRankReason"].ToString();

            if (lastRankReason.ToLower() != "none" && !String.IsNullOrEmpty(lastRankReason))
            {
                if (Group.findPerm(LevelPermission.Banned).playerList.Contains(message))
                {
                    Player.SendMessage(p, "> > last &8banned&g at &a" + lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + lastRankReason.Substring(lastRankReason.IndexOf("]") + 1).Trim());
                }
                else
                {
                    Player.SendMessage(p, "> > last &branked&g at &a" + lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + lastRankReason.Substring(lastRankReason.IndexOf("]") + 1).Trim());
                }
            }
            bool skip = false;

            if (p != null)
            {
                if (p.group.Permission <= LevelPermission.Operator)
                {
                    skip = true;
                }
            }

            if (!skip)
            {
                if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString()))
                {
                    playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned";
                }
                Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]);
            }
            if (Server.useWhitelist)
            {
                if (Server.whiteList.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, "> > Player is &fWhitelisted");
                }
            }
            if (Server.devs.Contains(message.ToLower()))
            {
                Player.SendMessage(p, "&g> > Player is a &9Developer");
            }
            if (Server.staff.Contains(message.ToLower()))
            {
                Player.SendMessage(p, "&g> > Player is a member of &4MCDawn Staff");
            }
            if (Server.administration.Contains(message.ToLower()))
            {
                Player.SendMessage(p, "&g> > Player is a &6MCDawn Administrator");
            }
            playerDb.Dispose();
        }