Exemplo n.º 1
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Player.SendMessage(p, "Basic blocks: ");
                    for (byte i = 0; i < 50; i++)
                    {
                        message += ", " + Block.Name(i);
                    }
                    Player.SendMessage(p, message.Remove(0, 2));
                    Player.SendMessage(p, "&d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "will show the rest.");
                }
                else if (message.ToLower() == "all")
                {
                    Player.SendMessage(p, "Complex blocks: ");
                    for (byte i = 50; i < 255; i++)
                    {
                        if (Block.Name(i).ToLower() != "unknown")
                        {
                            message += ", " + Block.Name(i);
                        }
                    }
                    Player.SendMessage(p, message.Remove(0, 2));
                    Player.SendMessage(p, "Use &d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "for a readable list.");
                }
                else if (message.ToLower().IndexOf(' ') != -1 && message.Split(' ')[0] == "all")
                {
                    int foundRange = 0;
                    try { foundRange = int.Parse(message.Split(' ')[1]); }
                    catch { Player.SendMessage(p, "Incorrect syntax"); return; }

                    if (foundRange >= 5 || foundRange < 0)
                    {
                        Player.SendMessage(p, "Number must be between 0 and 4"); return;
                    }

                    message = "";
                    Player.SendMessage(p, "Blocks between " + foundRange * 51 + " and " + (foundRange + 1) * 51);
                    for (byte i = (byte)(foundRange * 51); i < (byte)((foundRange + 1) * 51); i++)
                    {
                        if (Block.Name(i).ToLower() != "unknown")
                        {
                            message += ", " + Block.Name(i);
                        }
                    }
                    Player.SendMessage(p, message.Remove(0, 2));
                }
                else
                {
                    string printMessage = ">>>&b";

                    if (Block.Byte(message) != Block.Zero)
                    {
                        byte b = Block.Byte(message);
                        if (b < 51)
                        {
                            for (byte i = 51; i < 255; i++)
                            {
                                if (Block.Convert(i) == b)
                                {
                                    printMessage += Block.Name(i) + ", ";
                                }
                            }

                            if (printMessage != ">>>&b")
                            {
                                Player.SendMessage(p, "Blocks which look like \"" + message + "\":");
                                Player.SendMessage(p, printMessage.Remove(printMessage.Length - 2));
                            }
                            else
                            {
                                Player.SendMessage(p, "No Complex Blocks look like \"" + message + "\"");
                            }
                        }
                        else
                        {
                            Player.SendMessage(p, "&bComplex information for \"" + message + "\":");
                            Player.SendMessage(p, "&cBlock will appear as a \"" + Block.Name(Block.Convert(b)) + "\" block");

                            if (Block.LightPass(b))
                            {
                                Player.SendMessage(p, "Block will allow light through");
                            }
                            if (Block.Physics(b))
                            {
                                Player.SendMessage(p, "Block effects physics in some way");
                            }
                            else
                            {
                                Player.SendMessage(p, "Block will not effect physics in any way");
                            }
                            if (Block.NeedRestart(b))
                            {
                                Player.SendMessage(p, "The block's physics will auto-start");
                            }

                            if (Block.OPBlocks(b))
                            {
                                Player.SendMessage(p, "Block is unaffected by explosions");
                            }

                            if (Block.AllowBreak(b))
                            {
                                Player.SendMessage(p, "Anybody can activate the block");
                            }
                            if (Block.Walkthrough(b))
                            {
                                Player.SendMessage(p, "Block can be walked through");
                            }
                            if (Block.Death(b))
                            {
                                Player.SendMessage(p, "Walking through block will kill you");
                            }

                            if (Block.DoorAirs(b) != (byte)0)
                            {
                                Player.SendMessage(p, "Block is an ordinary door");
                            }
                            if (Block.tDoor(b))
                            {
                                Player.SendMessage(p, "Block is a tdoor, which allows other blocks through when open");
                            }
                            if (Block.odoor(b) != Block.Zero)
                            {
                                Player.SendMessage(p, "Block is an odoor, which toggles (GLITCHY)");
                            }

                            if (Block.Mover(b))
                            {
                                Player.SendMessage(p, "Block can be activated by walking through it");
                            }
                        }
                    }
                    else if (Group.Find(message) != null)
                    {
                        LevelPermission Perm = Group.Find(message).Permission;
                        foreach (Block.Blocks bL in Block.BlockList)
                        {
                            if (Block.canPlace(Perm, bL.type) && Block.Name(bL.type).ToLower() != "unknown")
                            {
                                printMessage += Block.Name(bL.type) + ", ";
                            }
                        }

                        if (printMessage != ">>>&b")
                        {
                            Player.SendMessage(p, "Blocks which " + Group.Find(message).color + Group.Find(message).name + Server.DefaultColor + " can place: ");
                            Player.SendMessage(p, printMessage.Remove(printMessage.Length - 2));
                        }
                        else
                        {
                            Player.SendMessage(p, "No blocks are specific to this rank");
                        }
                    }
                    else if (message.IndexOf(' ') == -1)
                    {
                        if (message.ToLower() == "count")
                        {
                            Player.SendMessage(p, "Blocks in this map: " + p.level.blocks.Length);
                        }
                        else
                        {
                            Help(p);
                        }
                    }
                    else if (message.Split(' ')[0].ToLower() == "count")
                    {
                        int foundNum = 0; byte foundBlock = Block.Byte(message.Split(' ')[1]);
                        if (foundBlock == Block.Zero)
                        {
                            Player.SendMessage(p, "Could not find block specified"); return;
                        }

                        for (int i = 0; i < p.level.blocks.Length; i++)
                        {
                            if (foundBlock == p.level.blocks[i])
                            {
                                foundNum++;
                            }
                        }

                        if (foundNum == 0)
                        {
                            Player.SendMessage(p, "No blocks were of type \"" + message.Split(' ')[1] + "\"");
                        }
                        else if (foundNum == 1)
                        {
                            Player.SendMessage(p, "1 block was of type \"" + message.Split(' ')[1] + "\"");
                        }
                        else
                        {
                            Player.SendMessage(p, foundNum.ToString() + " blocks were of type \"" + message.Split(' ')[1] + "\"");
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "Unable to find block or rank");
                    }
                }
            }
            catch (Exception e) { Server.ErrorLog(e); Help(p); }
        }
Exemplo n.º 2
0
        public override void Use(Player p, string message)
        {
            try
            {
                List <groups> playerList = new List <groups>();

                foreach (Group grp in Group.GroupList)
                {
                    if (grp.name != "nobody")
                    {
                        if (String.IsNullOrEmpty(message) || !Group.Exists(message))
                        {
                            groups groups;
                            groups.group   = grp;
                            groups.players = new List <string>();
                            playerList.Add(groups);
                        }
                        else
                        {
                            Group grp2 = Group.Find(message);
                            if (grp2 != null && grp == grp2)
                            {
                                groups groups;
                                groups.group   = grp;
                                groups.players = new List <string>();
                                playerList.Add(groups);
                            }
                        }
                    }
                }

                string devs       = "";
                string unverified = "";
                //string devUnverified = "";
                int totalPlayers = 0;
                foreach (Player pl in Player.players)
                {
                    if (pl.group.Permission == LevelPermission.Nobody && !Server.devs.Contains(pl.name.ToLower()))
                    {
                        continue;
                    }
                    if (p == null || !pl.hidden || p.group.Permission >= pl.group.Permission || Server.devs.Contains(p.name.ToLower()))
                    {
                        totalPlayers++;
                        string foundName = pl.name;

                        if (Server.afkset.Contains(pl.name))
                        {
                            foundName = pl.name + "-afk";
                        }

                        if (Server.devs.Contains(pl.name.ToLower()) && !pl.devUnverified && !pl.unverified)
                        {
                            if (pl.voice)
                            {
                                devs += " " + "&f+" + Server.DefaultColor + foundName + " (" + pl.level.name + "),";
                            }
                            else
                            {
                                devs += " " + foundName + " (" + pl.level.name + "),";
                            }
                        }
                        else if (pl.unverified || pl.devUnverified)
                        {
                            if (pl.voice)
                            {
                                unverified += " " + "&f+" + Server.DefaultColor + foundName + " (" + pl.level.name + "),";
                            }
                            else
                            {
                                unverified += " " + foundName + " (" + pl.level.name + "),";
                            }
                        }
                        else
                        {
                            if (pl.voice)
                            {
                                playerList.Find(grp => grp.group == pl.group).players.Add("&f+" + Server.DefaultColor + foundName + " (" + pl.level.name + ")");
                            }
                            else
                            {
                                playerList.Find(grp => grp.group == pl.group).players.Add(foundName + " (" + pl.level.name + ")");
                            }
                        }
                    }
                }
                Player.SendMessage(p, "There are " + totalPlayers + " players online.");
                if (devs.Length > 0)
                {
                    Player.SendMessage(p, ":&9Developers:" + Server.DefaultColor + devs.Trim(','));
                }
                for (int i = playerList.Count - 1; i >= 0; i--)
                {
                    groups groups       = playerList[i];
                    string appendString = "";

                    foreach (string player in groups.players)
                    {
                        appendString += ", " + player;
                    }

                    if (appendString != "")
                    {
                        appendString = appendString.Remove(0, 2);
                    }
                    appendString = ":" + groups.group.color + getPlural(groups.group.trueName) + ": " + appendString;

                    Player.SendMessage(p, appendString);
                }
                if (unverified.Length > 0)
                {
                    Player.SendMessage(p, ":&3Admin Security System:" + Server.DefaultColor + unverified.Trim(','));
                }
                //if (devUnverified.Length > 0) { Player.SendMessage(p, ":&3Developer Security System:" + Server.DefaultColor + unverified.Trim(',')); }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }