Beispiel #1
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 + Server.DefaultColor + " 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 + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + Server.DefaultColor + " 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"] + Server.DefaultColor + " " + Server.moneys);
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + Server.DefaultColor + " 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() + Server.DefaultColor + " blocks, and built &a" + builtBlocks + Server.DefaultColor + "."); }
            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"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " 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" + Server.DefaultColor + ".");
            }
            else
            {
                Player.SendMessage(p, "> > last logged in using &aWOM Game Client" + Server.DefaultColor + ", Version &a" + playerDb.Rows[0]["HasWOM"].ToString().Trim() + Server.DefaultColor + ".");
            }
            // 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, Server.DefaultColor + "> > Player is a &9Developer");
            }
            if (Server.staff.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a member of &4MCDawn Staff");
            }
            if (Server.administration.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &6MCDawn Administrator");
            }
            playerDb.Dispose();
        }
Beispiel #2
0
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length > 2)
            {
                Help(p); return;
            }
            // /awards
            // /awards 1
            // /awards bob
            // /awards bob 1

            int    totalCount  = 0;
            string foundPlayer = "";

            if (message != "")
            {
                if (message.Split(' ').Length == 2)
                {
                    foundPlayer = message.Split(' ')[0];
                    Player who = Player.Find(foundPlayer);
                    if (who != null)
                    {
                        foundPlayer = who.name;
                    }
                    try
                    {
                        totalCount = int.Parse(message.Split(' ')[1]);
                    }
                    catch
                    {
                        Help(p);
                        return;
                    }
                }
                else
                {
                    if (message.Length <= 3)
                    {
                        try
                        {
                            totalCount = int.Parse(message);
                        }
                        catch
                        {
                            foundPlayer = message;
                            Player who = Player.Find(foundPlayer);
                            if (who != null)
                            {
                                foundPlayer = who.name;
                            }
                        }
                    }
                    else
                    {
                        foundPlayer = message;
                        Player who = Player.Find(foundPlayer);
                        if (who != null)
                        {
                            foundPlayer = who.name;
                        }
                    }
                }
            }

            if (totalCount < 0)
            {
                Player.SendMessage(p, "Cannot display pages less than 0");
                return;
            }

            List <Awards.awardData> awardList = new List <Awards.awardData>();

            if (foundPlayer == "")
            {
                awardList = Awards.allAwards;
            }
            else
            {
                foreach (string s in Awards.getPlayersAwards(foundPlayer))
                {
                    Awards.awardData aD = new Awards.awardData();
                    aD.awardName   = s;
                    aD.description = Awards.getDescription(s);
                    awardList.Add(aD);
                }
            }

            if (awardList.Count == 0)
            {
                if (foundPlayer != "")
                {
                    Player.SendMessage(p, "The player has no awards!");
                }
                else
                {
                    Player.SendMessage(p, "There are no awards in this server yet");
                }

                return;
            }

            int max   = totalCount * 5;
            int start = (totalCount - 1) * 5;

            if (start > awardList.Count)
            {
                Player.SendMessage(p, "There aren't that many awards. Enter a smaller number");
                return;
            }
            if (max > awardList.Count)
            {
                max = awardList.Count;
            }

            if (foundPlayer != "")
            {
                Player.SendMessage(p, Server.FindColor(foundPlayer) + foundPlayer + "&g has the following awards:");
            }
            else
            {
                Player.SendMessage(p, "Awards available: ");
            }

            if (totalCount == 0)
            {
                foreach (Awards.awardData aD in awardList)
                {
                    Player.SendMessage(p, "&6" + aD.awardName + ": &7" + aD.description);
                }

                if (awardList.Count > 8)
                {
                    Player.SendMessage(p, "&5Use &b/awards " + message + " 1/2/3/... &5for a more ordered list");
                }
            }
            else
            {
                for (int i = start; i < max; i++)
                {
                    Awards.awardData aD = awardList[i];
                    Player.SendMessage(p, "&6" + aD.awardName + ": &7" + aD.description);
                }
            }
        }
Beispiel #3
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }

            bool give = true;

            if (message.Split(' ')[0].ToLower() == "give")
            {
                give    = true;
                message = message.Substring(message.IndexOf(' ') + 1);
            }
            else if (message.Split(' ')[0].ToLower() == "take")
            {
                give    = false;
                message = message.Substring(message.IndexOf(' ') + 1);
            }

            string foundPlayer = message.Split(' ')[0];
            Player who         = Player.Find(message);

            if (who != null)
            {
                foundPlayer = who.name;
            }
            string awardName = message.Substring(message.IndexOf(' ') + 1);

            if (!Awards.awardExists(awardName))
            {
                Player.SendMessage(p, "The award you entered doesn't exist");
                Player.SendMessage(p, "Use /awards for a list of awards");
                return;
            }

            if (give)
            {
                if (Awards.giveAward(foundPlayer, awardName))
                {
                    Player.GlobalChat(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " was awarded: &b" + Awards.camelCase(awardName), false);
                }
                else
                {
                    Player.SendMessage(p, "The player already has that award!");
                }
            }
            else
            {
                if (Awards.takeAward(foundPlayer, awardName))
                {
                    Player.GlobalChat(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " had their &b" + Awards.camelCase(awardName) + Server.DefaultColor + " award removed", false);
                }
                else
                {
                    Player.SendMessage(p, "The player didn't have the award you tried to take");
                }
            }

            Awards.Save();
        }
Beispiel #4
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 + "&g is on &b" + who.level.name);
                Player.SendMessage(p, who.color + who.prefix + who.name + "&g 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 + "&g " + Server.moneys);
                Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + "&g times");
                Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + "&g blocks, &a" + who.loginBlocks + "&g 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 + "&g blocks, and built &a" + who.builtBlocks + "&g."); }
                catch { }
                if (Server.useMaxMind)
                {
                    Player.SendMessage(p, "> > logged in from country &a" + who.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 + "&g times, &c" + who.totalKicked + "&g 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" + "&g.");
                }
                else
                {
                    Player.SendMessage(p, "> > is using &aWOM Game Client" + "&g, Version &a" + who.womversion + "&g.");
                }
                // 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, "&g> > Player is a &9Developer");
                }
                if (Server.staff.Contains(who.name.ToLower()))
                {
                    Player.SendMessage(p, "&g> > Player is a member of &4MCDawn Staff");
                }
                if (Server.administration.Contains(who.name.ToLower()))
                {
                    Player.SendMessage(p, "&g> > Player is a &6MCDawn Administrator");
                }
            }
            else
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message);
            }
        }