Пример #1
0
        public void EntryChange(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            portalPos bp = (portalPos)p.blockchangeObject;

            if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type); return; }

            byte b = p.level.GetTile(x, y, z);
            p.level.Blockchange(p, x, y, z, bp.type);
            p.SendBlockchange(x, y, z, Block.green);
            portPos Port;

            Port.portMapName = p.level.name;
            Port.x = x; Port.y = y; Port.z = z;

            bp.port.Add(Port);

            p.blockchangeObject = bp;

            if (!bp.Multi)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(ExitChange);
                Player.SendMessage(p, "&aEntry block placed");
            }
            else
            {
                p.Blockchange += new Player.BlockchangeEventHandler(EntryChange);
                Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
            }
        }
Пример #2
0
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            Player who = Player.Find(message);

            if (who == null)
            {
                Player.SendMessage(p, "Could not find player specified");
                return;
            }

            ushort currentX = (ushort)(who.pos[0] / 32);
            ushort currentY = (ushort)(who.pos[1] / 32);
            ushort currentZ = (ushort)(who.pos[2] / 32);
            ushort foundHeight = 0;

            for (ushort yy = currentY; yy <= 1000; yy++)
            {
                if (!Block.Walkthrough(p.level.GetTile(currentX, yy, currentZ)) && p.level.GetTile(currentX, yy, currentZ) != Block.Zero)
                {
                    foundHeight = (ushort)(yy - 1);
                    who.level.ChatLevel(who.color + who.name + Server.DefaultColor + " was slapped into the roof by " + p.color + p.name);
                    break;
                }
            }

            if (foundHeight == 0)
            {
                who.level.ChatLevel(who.color + who.name + Server.DefaultColor + " was slapped sky high by " + p.color + p.name);
                foundHeight = 1000;
            }

            unchecked { who.SendPos((byte)-1, who.pos[0], (ushort)(foundHeight * 32), who.pos[2], who.rot[0], who.rot[1]); }
        }
Пример #3
0
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            Group foundGroup = Group.Find(message);
            if (foundGroup == null)
            {
                Player.SendMessage(p, "Could not find group");
                return;
            }

            string totalList = "";
            foreach (string s in foundGroup.playerList.All())
            {
                totalList += ", " + s;
            }

            if (totalList == "")
            {
                Player.SendMessage(p, "No one has the rank of " + foundGroup.color + foundGroup.name);
                return;
            }

            Player.SendMessage(p, "People with the rank of " + foundGroup.color + foundGroup.name + ":");
            Player.SendMessage(p, totalList.Remove(0, 2));
        }
Пример #4
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/save - Saves the level you are currently in");
     Player.SendMessage(p, "/save all - Saves all loaded levels.");
     Player.SendMessage(p, "/save <map> - Saves the specified map.");
     Player.SendMessage(p, "/save <map> <name> - Backups the map with a given restore name");
 }
Пример #5
0
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            int number = message.Split(' ').Length;
            if (number > 2 || number < 1) { Help(p); return; }
            if (number == 1)
            {
                LevelPermission Perm = Level.PermissionFromName(message);
                if (Perm == LevelPermission.Null) { Player.SendMessage(p, "Not a valid rank"); return; }
                p.level.permissionvisit = Perm;
                Server.s.Log(p.level.name + " visit permission changed to " + message + ".");
                Player.GlobalMessageLevel(p.level, "visit permission changed to " + message + ".");
            }
            else
            {
                int pos = message.IndexOf(' ');
                string t = message.Substring(0, pos).ToLower();
                string s = message.Substring(pos + 1).ToLower();
                LevelPermission Perm = Level.PermissionFromName(s);
                if (Perm == LevelPermission.Null) { Player.SendMessage(p, "Not a valid rank"); return; }

                Level level = Level.Find(t);
                if (level != null)
                {
                    level.permissionvisit = Perm;
                    Server.s.Log(level.name + " visit permission changed to " + s + ".");
                    Player.GlobalMessageLevel(level, "visit permission changed to " + s + ".");
                    if (p != null)
                        if (p.level != level) { Player.SendMessage(p, "visit permission changed to " + s + " on " + level.name + "."); }
                    return;
                }
                else
                    Player.SendMessage(p, "There is no level \"" + s + "\" loaded.");
            }
        }
Пример #6
0
        public override void Use(Player p, string message)
        {
            Level foundLevel;

            if (message == "") { foundLevel = p.level; }
            else foundLevel = Level.Find(message);

            if (foundLevel == null) { Player.SendMessage(p, "Could not find specified level."); return; }

            Player.SendMessage(p, "&b" + foundLevel.name + Server.DefaultColor + ": Width=" + foundLevel.width.ToString() + " Height=" + foundLevel.depth.ToString() + " Depth=" + foundLevel.height.ToString());

            switch (foundLevel.physics)
            {
                case 0: Player.SendMessage(p, "Physics are &cOFF" + Server.DefaultColor + " on &b" + foundLevel.name); break;
                case 1: Player.SendMessage(p, "Physics are &aNormal" + Server.DefaultColor + " on &b" + foundLevel.name); break;
                case 2: Player.SendMessage(p, "Physics are &aAdvanced" + Server.DefaultColor + " on &b" + foundLevel.name); break;
                case 3: Player.SendMessage(p, "Physics are &aHardcore" + Server.DefaultColor + " on &b" + foundLevel.name); break;
                case 4: Player.SendMessage(p, "Physics are &aInstant" + Server.DefaultColor + " on &b" + foundLevel.name); break;
            }

            try
            {
                Player.SendMessage(p, "Build rank = " + Group.findPerm(foundLevel.permissionbuild).color + Group.findPerm(foundLevel.permissionbuild).trueName + Server.DefaultColor + " : Visit rank = " + Group.findPerm(foundLevel.permissionvisit).color + Group.findPerm(foundLevel.permissionvisit).trueName);
            } catch (Exception e) { Server.ErrorLog(e); }

            if (Directory.Exists(@Server.backupLocation + "/" + foundLevel.name))
            {
                int latestBackup = Directory.GetDirectories(@Server.backupLocation + "/" + foundLevel.name).Length;
                Player.SendMessage(p, "Latest backup: &a" + latestBackup + Server.DefaultColor + " at &a" + Directory.GetCreationTime(@Server.backupLocation + "/" + foundLevel.name + "/" + latestBackup).ToString("yyyy-MM-dd HH:mm:ss")); // + Directory.GetCreationTime(@Server.backupLocation + "/" + latestBackup + "/").ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else
            {
                Player.SendMessage(p, "No backups for this map exist yet.");
            }
        }
Пример #7
0
 public override void Use(Player p, string message)
 {
     if (message == "") { Help(p); return; }
     try
     {
         if (message.ToLower() == "all")
         {
             for (int i = 0; i < PlayerBot.playerbots.Count; i++)
             {
                 if (PlayerBot.playerbots[i].level == p.level)
                 {
                     //   PlayerBot.playerbots.Remove(PlayerBot.playerbots[i]);
                     PlayerBot Pb = PlayerBot.playerbots[i];
                     Pb.removeBot();
                     i--;
                 }
             }
         }
         else
         {
             PlayerBot who = PlayerBot.Find(message);
             if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
             if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
             who.removeBot();
             Player.SendMessage(p, "Removed bot.");
         }
     }
     catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error caught"); }
 }
Пример #8
0
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            string fileName;
            fileName = "extra/import/" + message + ".dat";

            if (!Directory.Exists("extra/import")) Directory.CreateDirectory("extra/import");
            if (!File.Exists(fileName))
            {
                Player.SendMessage(p, "Could not find .dat file");
                return;
            }

            FileStream fs = File.OpenRead(fileName);
            if (ConvertDat.Load(fs, message) != null)
            {
                Player.SendMessage(p, "Converted map!");
            }
            else
            {
                Player.SendMessage(p, "The map conversion failed.");
                return;
            }
            fs.Close();

            Command.all.Find("load").Use(p, message);
        }
Пример #9
0
 public override void Use(Player p, string message)
 {
     if (message == "") { Help(p); return; }
     Player who = Player.Find(message);
     if (who != null)
     {
         if (who.voice)
         {
             who.voice = false;
             Player.SendMessage(p, "Removing voice status from " + who.name);
             who.SendMessage("Your voice status has been revoked.");
             who.voicestring = "";
         }
         else
         {
             who.voice = true;
             Player.SendMessage(p, "Giving voice status to " + who.name);
             who.SendMessage("You have received voice status.");
             who.voicestring = "&f+";
         }
     }
     else
     {
         Player.SendMessage(p, "There is no player online named \"" + message + "\"");
     }
 }
Пример #10
0
        public void highlightStuff(string[] fileContent, Int64 seconds, Player p)
        {
            Player.UndoPos Pos;

            for (int i = fileContent.Length / 7; i >= 0; i--)
            {
                try
                {
                    if (Convert.ToDateTime(fileContent[(i * 7) + 4].Replace('&', ' ')).AddSeconds(seconds) >= DateTime.Now)
                    {
                        Level foundLevel = Level.Find(fileContent[i * 7]);
                        if (foundLevel != null && foundLevel == p.level)
                        {
                            Pos.mapName = foundLevel.name;
                            Pos.x = Convert.ToUInt16(fileContent[(i * 7) + 1]);
                            Pos.y = Convert.ToUInt16(fileContent[(i * 7) + 2]);
                            Pos.z = Convert.ToUInt16(fileContent[(i * 7) + 3]);

                            Pos.type = foundLevel.GetTile(Pos.x, Pos.y, Pos.z);

                            if (Pos.type == Convert.ToByte(fileContent[(i * 7) + 6]) || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
                            {
                                if (Pos.type == Block.air || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
                                    p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.red);
                                else p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.green);
                            }
                        }
                    }
                    else break;
                }
                catch { }
            }
        }
Пример #11
0
 public override void Use(Player p, string message)
 {
     if (message != "") { Help(p); return; }
     p.painting = !p.painting; if (p.painting) { Player.SendMessage(p, "Painting mode: &aON" + Server.DefaultColor + "."); }
     else { Player.SendMessage(p, "Painting mode: &cOFF" + Server.DefaultColor + "."); }
     p.BlockAction = 0;
 }
Пример #12
0
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            Level.Zone Zn;

            Zn.smallX = Math.Min(cpos.x, x);
            Zn.smallY = Math.Min(cpos.y, y);
            Zn.smallZ = Math.Min(cpos.z, z);
            Zn.bigX = Math.Max(cpos.x, x);
            Zn.bigY = Math.Max(cpos.y, y);
            Zn.bigZ = Math.Max(cpos.z, z);
            Zn.Owner = cpos.Owner;

            p.level.ZoneList.Add(Zn);

            //DB
            MySQL.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", '" + Zn.Owner + "')");
            //DB

            Player.SendMessage(p, "Added zone for &b" + cpos.Owner);
        }
Пример #13
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/cmdbind [command] [num] - Binds [command] to [num]");
     Player.SendMessage(p, "[num] must be between 0 and 9");
     Player.SendMessage(p, "Use with \"/[num]\" &b(example: /2)");
     Player.SendMessage(p, "Use /cmdbind [num] to see stored commands.");
 }
Пример #14
0
        public void ExitChange(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            portalPos bp = (portalPos)p.blockchangeObject;

            foreach (portPos pos in bp.port)
            {
                DataTable Portals = MySQL.fillData("SELECT * FROM `Portals" + pos.portMapName + "` WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z);
                Portals.Dispose();

                if (Portals.Rows.Count == 0)
                {
                    MySQL.executeQuery("INSERT INTO `Portals" + pos.portMapName + "` (EntryX, EntryY, EntryZ, ExitMap, ExitX, ExitY, ExitZ) VALUES (" + (int)pos.x + ", " + (int)pos.y + ", " + (int)pos.z + ", '" + p.level.name + "', " + (int)x + ", " + (int)y + ", " + (int)z + ")");
                }
                else
                {
                    MySQL.executeQuery("UPDATE `Portals" + pos.portMapName + "` SET ExitMap='" + p.level.name + "', ExitX=" + (int)x + ", ExitY=" + (int)y + ", ExitZ=" + (int)z + " WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z);
                }
                //DB

                if (pos.portMapName == p.level.name) p.SendBlockchange(pos.x, pos.y, pos.z, bp.type);
            }

            Player.SendMessage(p, "&3Exit" + Server.DefaultColor + " block placed");

            if (p.staticCommands) { bp.port.Clear(); p.blockchangeObject = bp; p.Blockchange += new Player.BlockchangeEventHandler(EntryChange); }
        }
Пример #15
0
        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            cpos.message = cpos.message.Replace("'", "\\'");

            DataTable Messages = MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            Messages.Dispose();

            if (Messages.Rows.Count == 0)
            {
                MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
            }
            else
            {
                MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            }

            Player.SendMessage(p, "Message block placed.");
            p.level.Blockchange(p, x, y, z, cpos.type);
            p.SendBlockchange(x, y, z, cpos.type);

            if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Пример #16
0
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length > 1) { Help(p); return; }

            if (p.BlockAction == 13 || p.BlockAction == 14)
            {
                p.BlockAction = 0; Player.SendMessage(p, "TNT mode is now &cOFF" + Server.DefaultColor + ".");
            }
            else if (message.ToLower() == "small" || message == "")
            {
                p.BlockAction = 13; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + ".");
            }
            else if (message.ToLower() == "big")
            {
                if (p.group.Permission > LevelPermission.AdvBuilder)
                {
                    p.BlockAction = 14; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + ".");
                }
                else
                {
                    Player.SendMessage(p, "This mode is reserved for OPs");
                }
            }
            else
            {
                Help(p);
            }

            p.painting = false;
        }
Пример #17
0
 public static void placeBlock(Level l, Player p, ushort x, ushort y, ushort z, byte type)
 {
     if (p == null)
         l.Blockchange(x, y, z, type);
     else
         l.Blockchange(p, x, y, z, type);
 }
Пример #18
0
 public override void Use(Player p, string message)
 {
     if (message == "") { Help(p); return; }
     if (!PlayerBot.ValidName(message)) { Player.SendMessage(p, "bot name " + message + " not valid!"); return; }
     PlayerBot.playerbots.Add(new PlayerBot(message, p.level, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0));
     //who.SendMessage("You were summoned by " + p.color + p.name + "&e.");
 }
Пример #19
0
        public override void Use(Player p, string message)
        {
            if (message.ToLower() == "empty")
            {
                Boolean Empty = true;

                foreach (Level l in Server.levels)
                {
                    Empty = true;
                    Player.players.ForEach(delegate(Player pl)
                    {
                        if (pl.level == l) Empty = false;
                    });

                    if (Empty == true && l.unload)
                    {
                        l.Unload();
                        return;
                    }
                }
                Player.SendMessage(p, "No levels were empty.");
                return;
            }

            Level level = Level.Find(message);

            if (level != null)
            {
                if (!level.Unload()) Player.SendMessage(p, "You cannot unload the main level.");
                return;
            }

            Player.SendMessage(p, "There is no level \"" + message + "\" loaded.");
        }
Пример #20
0
 public override void Use(Player p, string message)
 {
     if (message == "")
     {
         Command.all.Find("spawn");
         return;
     }
     Player who = Player.Find(message);
     if (who == null || (who.hidden && p.group.Permission < LevelPermission.Admin)) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; }
     if (p.level != who.level)
     {
         if(who.level.name.Contains("cMuseum"))
         {
             Player.SendMessage(p, "Player \"" + message + "\" is in a museum!");
             return;
         }
         else
         {
             Command.all.Find("goto").Use(p, who.level.name);
         }
     }
     if (p.level == who.level)
     {
         if (who.Loading)
         {
             Player.SendMessage(p, "Waiting for " + who.color + who.name + Server.DefaultColor + " to spawn...");
             while (who.Loading) { }
         }
         while (p.Loading) { }  //Wait for player to spawn in new map
         unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); }
     }
 }
Пример #21
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/undo [player] [seconds] - Undoes the blockchanges made by [player] in the previous [seconds].");
     Player.SendMessage(p, "/undo [player] all - &cWill undo 138 hours for [player] <SuperOP+>");
     Player.SendMessage(p, "/undo [player] 0 - &cWill undo 30 minutes <Operator+>");
     Player.SendMessage(p, "/undo physics [seconds] - Undoes the physics for the current map");
 }
Пример #22
0
 public override void Use(Player p, string message)
 {
     if ((message.ToLower() == "create" || message.ToLower() == "") && p != null)
     {
         p.level.jailx = p.pos[0]; p.level.jaily = p.pos[1]; p.level.jailz = p.pos[2];
         p.level.jailrotx = p.rot[0]; p.level.jailroty = p.rot[1];
         Player.SendMessage(p, "Set Jail point.");
     }
     else
     {
         Player who = Player.Find(message);
         if (who != null)
         {
             if (!who.jailed)
             {
                 if (p != null) if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; }
                 if (who.level != p.level) Command.all.Find("goto").Use(who, p.level.name);
                 Player.GlobalDie(who, false);
                 Player.GlobalSpawn(who, p.level.jailx, p.level.jaily, p.level.jailz, p.level.jailrotx, p.level.jailroty, true);
                 who.jailed = true;
                 Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &8jailed", false);
             }
             else
             {
                 who.jailed = false;
                 Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false);
             }
         }
         else
         {
             Player.SendMessage(p, "Could not find specified player.");
         }
     }
 }
Пример #23
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/setrank <player> <rank> <yay> - Sets or returns a players rank.");
     Player.SendMessage(p, "You may use /rank as a shortcut");
     Player.SendMessage(p, "Valid Ranks are: " + Group.concatList(true, true));
     Player.SendMessage(p, "<yay> is a celebratory message");
 }
Пример #24
0
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Help(p);
            }
            else
            {
                Player.SendMessage(p, "This server runs on &bMCDeamon" + Server.DefaultColor + ", which started as MCLawl, and was made much more feature-packed by Zallist, then picked up again and had development continued by Lawlcat, Valek and Zallist, And then forked and made better by Legorek");
                Player.SendMessage(p, "This server's version: &a" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());

                TimeSpan up = DateTime.Now - Server.timeOnline;
                string upTime = "Time online: &b";
                if (up.Days == 1) upTime += up.Days + " day, ";
                else if (up.Days > 0) upTime += up.Days + " days, ";
                if (up.Hours == 1) upTime += up.Hours + " hour, ";
                else if (up.Days > 0 || up.Hours > 0) upTime += up.Hours + " hours, ";
                if (up.Minutes == 1) upTime += up.Minutes + " minute and ";
                else if (up.Hours > 0 || up.Days > 0 || up.Minutes > 0) upTime += up.Minutes + " minutes and ";
                if (up.Seconds == 1) upTime += up.Seconds + " second";
                else upTime += up.Seconds + " seconds";
                Player.SendMessage(p, upTime);

                if (Server.updateTimer.Interval > 1000) Player.SendMessage(p, "Server is currently in &5Low Lag" + Server.DefaultColor + " mode.");
            }
        }
Пример #25
0
        public override void Use(Player p, string message)
        {
            string[] parameters = message.Split(' ');
            ushort[] click = p.lastClick;

            if (message.IndexOf(' ') != -1)
            {
                if (parameters.Length != 3)
                {
                    Help(p);
                    return;
                }
                else
                {
                    for (int value = 0; value < 3; value++)
                    {
                        if (parameters[value].ToLower() == "x" || parameters[value].ToLower() == "y" || parameters[value].ToLower() == "z")
                            click[value] = p.lastClick[value];
                        else if (isValid(parameters[value], value, p))
                            click[value] = ushort.Parse(parameters[value]);
                        else
                        {
                            Player.SendMessage(p, "\"" + parameters[value] + "\" was not valid");
                            return;
                        }
                    }
                }
            }

            p.manualChange(click[0], click[1], click[2], 0, Block.rock);
            Player.SendMessage(p, "Clicked &b(" + click[0] + ", " + click[1] + ", " + click[2] + ")");
        }
Пример #26
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/tcolor <player> [color] - Gives <player> the title color of [color].");
     Player.SendMessage(p, "If no [color] is specified, title color is removed.");
     Player.SendMessage(p, "&0black &1navy &2green &3teal &4maroon &5purple &6gold &7silver");
     Player.SendMessage(p, "&8gray &9blue &alime &baqua &cred &dpink &eyellow &fwhite");
 }
Пример #27
0
        public override void Use(Player p, string message)
        {
            p.staticCommands = !p.staticCommands;
            p.ClearBlockchange();
            p.BlockAction = 0;

            Player.SendMessage(p, "Static mode: &a" + p.staticCommands.ToString());

            try
            {
                if (message != "")
                {
                    if (message.IndexOf(' ') == -1)
                    {
                        if (p.group.CanExecute(Command.all.Find(message)))
                            Command.all.Find(message).Use(p, "");
                        else
                            Player.SendMessage(p, "Cannot use that command.");
                    }
                    else
                    {
                        if (p.group.CanExecute(Command.all.Find(message.Split(' ')[0])))
                            Command.all.Find(message.Split(' ')[0]).Use(p, message.Substring(message.IndexOf(' ') + 1));
                        else
                            Player.SendMessage(p, "Cannot use that command.");
                    }
                }
            }
            catch { Player.SendMessage(p, "Could not find specified command"); }
        }
Пример #28
0
 public override void Use(Player p, string message)
 {
     if (message == "") { Help(p); return; }
     string[] args = message.Split(' ');
     Player who = Player.Find(args[0]);
     if (who == null)
     {
         Player.SendMessage(p, "Could not find player.");
         return;
     }
     if (args.Length == 1)
     {
         who.titlecolor = "";
         Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color removed.", false);
         MySQL.executeQuery("UPDATE Players SET title_color = '' WHERE Name = '" + who.name + "'");
         who.SetPrefix();
         return;
     }
     else
     {
         string color = c.Parse(args[1]);
         if (color == "") { Player.SendMessage(p, "There is no color \"" + args[1] + "\"."); return; }
         else if (color == who.titlecolor) { Player.SendMessage(p, who.name + " already has that title color."); return; }
         else
         {
             MySQL.executeQuery("UPDATE Players SET title_color = '" + c.Name(color) + "' WHERE Name = '" + who.name + "'");
             Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
             who.titlecolor = color;
             who.SetPrefix();
         }
     }
 }
Пример #29
0
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();

            for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
            {
                for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                {
                    for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                    {
                        if (p.level.GetTile(xx, yy, zz) == type) { BufferAdd(buffer, xx, yy, zz); }
                    }
                }
            }

            if (buffer.Count > p.group.maxBlocks)
            {
                Player.SendMessage(p, "You tried to replace " + buffer.Count + " blocks.");
                Player.SendMessage(p, "You cannot replace more than " + p.group.maxBlocks + ".");
                return;
            }

            Player.SendMessage(p, buffer.Count.ToString() + " blocks.");
            buffer.ForEach(delegate(Pos pos)
            {
                p.level.Blockchange(p, pos.x, pos.y, pos.z, cpos.type2);                  //update block for everyone
            });

            if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Пример #30
0
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p);
         return;
     }
     else
     {
         string hasirc;
         string ircdetails = "";
         if (Server.irc)
         {
             hasirc = "&aEnabled" + Server.DefaultColor + ".";
             ircdetails = Server.ircServer + " > " + Server.ircChannel;
         }
         else
         {
             hasirc = "&cDisabled" + Server.DefaultColor + ".";
         }
         Player.SendMessage(p, "IRC is " + hasirc);
         if (ircdetails != "")
         {
             Player.SendMessage(p, "Location: " + ircdetails);
         }
     }
 }