Exemple #1
0
 public override void Use(Player p, string message)
 {
     if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Title Colors!"); return; }
     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();
         }
     }
 }
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Block Logging!"); return; }
            Level l = Level.Find(message);
            if (l == null && message != "") { Player.SendMessage(p, "Could not find level."); return; }
            if (l == null) l = p.level;

            MySQL.executeQuery("TRUNCATE TABLE `Block" + l.name + "`");
            Player.SendMessage(p, "Cleared &cALL" + Server.DefaultColor + " recorded block changes in: &d" + l.name);
        }
Exemple #3
0
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Titles!"); return; }
            if (message == "") { Help(p); return; }

            int pos = message.IndexOf(' ');
            Player who = Player.Find(message.Split(' ')[0]);
            if (who == null) { Player.SendMessage(p, "Could not find player."); return; }

            string query;
            string newTitle = "";
            if (message.Split(' ').Length > 1) newTitle = message.Substring(pos + 1);
            else
            {
                who.title = "";
                who.SetPrefix();
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " had their title removed.", false);
                query = "UPDATE Players SET Title = '' WHERE Name = '" + who.name + "'";
                MySQL.executeQuery(query);
                return;
            }

            if (newTitle != "")
            {
                newTitle = newTitle.ToString().Trim().Replace("[", "");
                newTitle = newTitle.Replace("]", "");
                /* if (newTitle[0].ToString() != "[") newTitle = "[" + newTitle;
                if (newTitle.Trim()[newTitle.Trim().Length - 1].ToString() != "]") newTitle = newTitle.Trim() + "]";
                if (newTitle[newTitle.Length - 1].ToString() != " ") newTitle = newTitle + " "; */
            }

            if (newTitle.Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; }
            if (!Server.devs.Contains(p.name.ToLower()))
            {
                if (Server.devs.Contains(who.name.ToLower()) || newTitle.ToLower() == "dev" || newTitle.ToLower() == "developer") { Player.SendMessage(p, "You're not a dev!"); return; }
            }

            if (newTitle != "")
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was given the title of &b[" + newTitle + "]", false);
            else Player.GlobalChat(null, who.color + who.prefix + who.name + Server.DefaultColor + " had their title removed.", false);

            if (newTitle == "")
            {
                query = "UPDATE Players SET Title = '' WHERE Name = '" + who.name + "'";
            }
            else
            {
                query = "UPDATE Players SET Title = '" + newTitle.Replace("'", "\'") + "' WHERE Name = '" + who.name + "'";
            }
            MySQL.executeQuery(query);
            who.title = newTitle;
            who.SetPrefix();
        }
Exemple #4
0
 public override void Use(Player p, string message)
 {
     if (message == "" || message.IndexOf(' ') != -1)
     {
         Help(p);
         return;
     }
     else
     {
         if (File.Exists("extra/commands/source/Cmd" + message + ".cs")) { p.SendMessage("File Cmd" + message + ".cs already exists.  Choose another name."); return; }
         try
         {
             Scripting.CreateNew(message);
         }
         catch (Exception e)
         {
             Server.ErrorLog(e);
             Player.SendMessage(p, "An error occurred creating the class file.");
             return;
         }
         Player.SendMessage(p, "Successfully created a new command class.");
     }
 }
Exemple #5
0
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Message Blocks!"); return; }
            if (message == "") { Help(p); return; }

            CatchPos cpos;
            cpos.message = "";

            try
            {
                switch (message.Split(' ')[0])
                {
                    case "air": cpos.type = Block.MsgAir; break;
                    case "water": cpos.type = Block.MsgWater; break;
                    case "lava": cpos.type = Block.MsgLava; break;
                    case "black": cpos.type = Block.MsgBlack; break;
                    case "white": cpos.type = Block.MsgWhite; break;
                    case "show": showMBs(p); return;
                    default: cpos.type = Block.MsgWhite; cpos.message = message; break;
                }
            }
            catch { cpos.type = Block.MsgWhite; cpos.message = message; }

            if (cpos.message == "") cpos.message = message.Substring(message.IndexOf(' ') + 1);
            p.blockchangeObject = cpos;

            Player.SendMessage(p, "Place where you wish the message block to go."); p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Exemple #6
0
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Portals!"); return; }
            portalPos portalPos;

            portalPos.Multi = false;

            if (message.IndexOf(' ') != -1)
            {
                if (message.Split(' ')[1].ToLower() == "multi")
                {
                    portalPos.Multi = true;
                    message = message.Split(' ')[0];
                }
                else
                {
                    Player.SendMessage(p, "Invalid parameters");
                    return;
                }
            }

            if (message.ToLower() == "blue" || message == "") { portalPos.type = Block.blue_portal; }
            else if (message.ToLower() == "orange") { portalPos.type = Block.orange_portal; }
            else if (message.ToLower() == "air") { portalPos.type = Block.air_portal; }
            else if (message.ToLower() == "water") { portalPos.type = Block.water_portal; }
            else if (message.ToLower() == "lava") { portalPos.type = Block.lava_portal; }
            else if (message.ToLower() == "show") { showPortals(p); return; }
            else { Help(p); return; }

            p.ClearBlockchange();

            portPos port;

            port.x = 0; port.y = 0; port.z = 0; port.portMapName = "";
            portalPos.port = new List<portPos>();

            p.blockchangeObject = portalPos;
            Player.SendMessage(p, "Place a the &aEntry block" + Server.DefaultColor + " for the portal"); p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(EntryChange);
        }
Exemple #7
0
        public override void Use(Player p, string message)
        {
            if (p.hasflag != null) { Player.SendMessage(p, "You can't use a gun while you have the flag!"); return;}
            Pos cpos;

            if (p.aiming)
            {
                if (message == "")
                {
                    p.aiming = false;
                    p.ClearBlockchange();
                    Player.SendMessage(p, "Disabled gun");
                    return;
                }
            }

            cpos.ending = 0;
            if (message.ToLower() == "destroy") cpos.ending = 1;
            else if (message.ToLower() == "explode") cpos.ending = 2;
            else if (message.ToLower() == "laser") cpos.ending = 3;
            else if (message.ToLower() == "teleport" || message.ToLower() == "tp") cpos.ending = -1;
            else if (message != "") { Help(p); return; }

            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);

            p.SendMessage("Gun mode engaged, fire at will");

            if (p.aiming)
            {
                return;
            }

            p.aiming = true;
            Thread aimThread = new Thread(new ThreadStart(delegate
            {
                CatchPos pos;
                List<CatchPos> buffer = new List<CatchPos>();
                while (p.aiming)
                {
                    List<CatchPos> tempBuffer = new List<CatchPos>();

                    double a = Math.Sin(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI);
                    double b = Math.Cos(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI);
                    double c = Math.Cos(((double)(p.rot[1] + 64) / 256) * 2 * Math.PI);

                    try
                    {
                        ushort x = (ushort)(p.pos[0] / 32);
                        x = (ushort)Math.Round(x + (double)(a * 3));

                        ushort y = (ushort)(p.pos[1] / 32 + 1);
                        y = (ushort)Math.Round(y + (double)(c * 3));

                        ushort z = (ushort)(p.pos[2] / 32);
                        z = (ushort)Math.Round(z + (double)(b * 3));

                        if (x > p.level.width || y > p.level.depth || z > p.level.height) throw new Exception();
                        if (x < 0 || y < 0 || z < 0) throw new Exception();

                        for (ushort xx = x; xx <= x + 1; xx++)
                        {
                            for (ushort yy = (ushort)(y - 1); yy <= y; yy++)
                            {
                                for (ushort zz = z; zz <= z + 1; zz++)
                                {
                                    if (p.level.GetTile(xx, yy, zz) == Block.air)
                                    {
                                        pos.x = xx; pos.y = yy; pos.z = zz;
                                        tempBuffer.Add(pos);
                                    }
                                }
                            }
                        }

                        List<CatchPos> toRemove = new List<CatchPos>();
                        foreach (CatchPos cP in buffer)
                        {
                            if (!tempBuffer.Contains(cP))
                            {
                                p.SendBlockchange(cP.x, cP.y, cP.z, Block.air);
                                toRemove.Add(cP);
                            }
                        }

                        foreach (CatchPos cP in toRemove)
                        {
                            buffer.Remove(cP);
                        }

                        foreach (CatchPos cP in tempBuffer)
                        {
                            if (!buffer.Contains(cP))
                            {
                                buffer.Add(cP);
                                p.SendBlockchange(cP.x, cP.y, cP.z, Block.glass);
                            }
                        }

                        tempBuffer.Clear();
                        toRemove.Clear();
                    }
                    catch { }
                    Thread.Sleep(20);
                }

                foreach (CatchPos cP in buffer)
                {
                    p.SendBlockchange(cP.x, cP.y, cP.z, Block.air);
                }
            }));
            aimThread.Start();
        }
Exemple #8
0
 public override void Use(Player p, string message)
 { // TODO
     try
     {
         if (message != "")
         {
             Help(p); return;
         }
         message = "";
         string message2 = "";
         bool   Once     = false;
         Server.levels.ForEach(delegate(Level level)
         {
             if (level.permissionvisit <= p.group.Permission)
             {
                 if (Group.findPerm(level.permissionbuild) != null)
                 {
                     message += ", " + Group.findPerm(level.permissionbuild).color + level.name + " &b[" + level.physics + "]";
                 }
                 else
                 {
                     message += ", " + level.name + " &b[" + level.physics + "]";
                 }
             }
             else
             {
                 if (!Once)
                 {
                     Once = true;
                     if (Group.findPerm(level.permissionvisit) != null)
                     {
                         message2 += Group.findPerm(level.permissionvisit).color + level.name + " &b[" + level.physics + "]";
                     }
                     else
                     {
                         message2 += level.name + " &b[" + level.physics + "]";
                     }
                 }
                 else
                 {
                     if (Group.findPerm(level.permissionvisit) != null)
                     {
                         message2 += ", " + Group.findPerm(level.permissionvisit).color + level.name + " &b[" + level.physics + "]";
                     }
                     else
                     {
                         message2 += ", " + level.name + " &b[" + level.physics + "]";
                     }
                 }
             }
         });
         Player.SendMessage(p, "Loaded: " + message.Remove(0, 2));
         if (message2 != "")
         {
             Player.SendMessage(p, "Can't Goto: " + message2);
         }
         Player.SendMessage(p, "Use &4/unloaded for unloaded levels.");
     }
     catch (Exception e)
     {
         Server.ErrorLog(e);
     }
 }
Exemple #9
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/abort - Cancels an action.");
 }
Exemple #10
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/kick <player> [message] - Kicks a player.");
 }
Exemple #11
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/say - broadcasts a global message to everyone in the server.");
 }
Exemple #12
0
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Colors!"); return; }
            if (message == "" || message.Split(' ').Length > 2) { Help(p); return; }
            int pos = message.IndexOf(' ');
            if (pos != -1)
            {
                Player who = Player.Find(message.Substring(0, pos));
                if (who == null) { Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return; }
                if (message.Substring(pos + 1) == "del")
                {
                    MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + who.name + "'");
                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    who.color = who.group.color;

                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                    return;
                }
                string color = c.Parse(message.Substring(pos + 1));
                if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
                else if (color == who.color) { Player.SendMessage(p, who.name + " already has that color."); }
                else
                {
                    //Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) +
                    //                  " color to " + color +
                    //                  c.Name(color) + "&e.", false);
                    MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + who.name + "'");

                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    who.color = color;

                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                }
            }
            else
            {
                if (message == "del")
                {
                    MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + p.name + "'");

                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    p.color = p.group.color;

                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                    return;
                }
                string color = c.Parse(message);
                if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
                else if (color == p.color) { Player.SendMessage(p, "You already have that color."); }
                else
                {
                    MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + p.name + "'");

                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    p.color = color;

                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                }
            }
        }
Exemple #13
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                if (p != null)
                {
                    message = p.level.name + " 30";
                }
                else
                {
                    message = Server.mainLevel + " 30";
                }
            }
            int foundNum = 0; Level foundLevel;

            if (message.IndexOf(' ') == -1)
            {
                try
                {
                    foundNum = int.Parse(message);
                    if (p != null)
                    {
                        foundLevel = p.level;
                    }
                    else
                    {
                        foundLevel = Server.mainLevel;
                    }
                }
                catch
                {
                    foundNum   = 30;
                    foundLevel = Level.Find(message);
                }
            }
            else
            {
                try
                {
                    foundNum   = int.Parse(message.Split(' ')[1]);
                    foundLevel = Level.Find(message.Split(' ')[0]);
                }
                catch
                {
                    Player.SendMessage(p, "Invalid input");
                    return;
                }
            }

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

            try
            {
                if (foundLevel.physPause)
                {
                    foundLevel.physThread.Resume();
                    foundLevel.physResume = DateTime.Now;
                    foundLevel.physPause  = false;
                    Player.GlobalMessage("Physics on " + foundLevel.name + " were re-enabled.");
                }
                else
                {
                    foundLevel.physThread.Suspend();
                    foundLevel.physResume = DateTime.Now.AddSeconds(foundNum);
                    foundLevel.physPause  = true;
                    Player.GlobalMessage("Physics on " + foundLevel.name + " were temporarily disabled.");

                    foundLevel.physTimer.Elapsed += delegate
                    {
                        if (DateTime.Now > foundLevel.physResume)
                        {
                            foundLevel.physPause = false;
                            try
                            {
                                foundLevel.physThread.Resume();
                            }
                            catch (Exception e) { Server.ErrorLog(e); }
                            Player.GlobalMessage("Physics on " + foundLevel.name + " were re-enabled.");
                            foundLevel.physTimer.Stop();
                            foundLevel.physTimer.Dispose();
                        }
                    };
                    foundLevel.physTimer.Start();
                }
            }
            catch (Exception e)
            {
                Server.ErrorLog(e);
            }
        }
Exemple #14
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/pause [map] [amount] - Pauses physics on [map] for 30 seconds");
 }
Exemple #15
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/levels - Lists all loaded levels and their physics levels.");
 }
Exemple #16
0
 public override void Help(Player p)
 {
     p.SendMessage("/whoip <ip address> - Displays players associated with a given IP address.");
 }
Exemple #17
0
        public PlayerBot(string n, Level l, ushort x, ushort y, ushort z, byte rotx, byte roty)
        {
            name  = n;
            color = "&1";
            id    = FreeId();

            level = l;
            pos   = new ushort[3] {
                x, y, z
            }; rot = new byte[2] {
                rotx, roty
            };
            GlobalSpawn();

            foreach (Player p in Player.players)
            {
                if (p.level == level)
                {
                    Player.SendMessage(p, color + name + Server.DefaultColor + ", the bot, has been added.");
                }
            }

            botTimer.Elapsed += delegate
            {
                int    currentNum, foundNum = (32 * 75);
                Random rand = new Random();

                x = (ushort)Math.Round((decimal)pos[0] / (decimal)32);
                y = (ushort)((pos[1] - 33) / 32);
                z = (ushort)Math.Round((decimal)pos[2] / (decimal)32);

                if (kill)
                {
                    foreach (Player p in Player.players)
                    {
                        if ((ushort)(p.pos[0] / 32) == x)
                        {
                            if (Math.Abs((ushort)(p.pos[1] / 32) - y) < 2)
                            {
                                if ((ushort)(p.pos[2] / 32) == z)
                                {
                                    p.HandleDeath(Block.Zero);
                                }
                            }
                        }
                    }
                }

                if (Waypoints.Count < 1)
                {
                    if (hunt)
                    {
                        Player.players.ForEach(delegate(Player p)
                        {
                            if (p.level == level && !p.invincible)
                            {
                                currentNum = Math.Abs(p.pos[0] - pos[0]) + Math.Abs(p.pos[1] - pos[1]) + Math.Abs(p.pos[2] - pos[2]);
                                if (currentNum < foundNum)
                                {
                                    foundNum = currentNum;
                                    foundPos = p.pos;
                                    foundRot = p.rot;
                                    movement = true;
                                    rot[1]   = (byte)(255 - foundRot[1]);
                                    if (foundRot[0] < 128)
                                    {
                                        rot[0] = (byte)(foundRot[0] + 128);
                                    }
                                    else
                                    {
                                        rot[0] = (byte)(foundRot[0] - 128);
                                    }
                                }
                            }
                        });
                    }
                }
                else
                {
                    bool skip = false;
                    movement = false;

                    retry : switch (Waypoints[currentPoint].type)
                    {
                    case "walk" :
                        foundPos[0] = Waypoints[currentPoint].x;
                        foundPos[1] = Waypoints[currentPoint].y;
                        foundPos[2] = Waypoints[currentPoint].z;
                        movement    = true;

                        if ((ushort)(pos[0] / 32) == (ushort)(Waypoints[currentPoint].x / 32))
                        {
                            if ((ushort)(pos[2] / 32) == (ushort)(Waypoints[currentPoint].z / 32))
                            {
                                rot[0] = Waypoints[currentPoint].rotx;
                                rot[1] = Waypoints[currentPoint].roty;
                                currentPoint++;
                                movement = false;

                                if (currentPoint == Waypoints.Count)
                                {
                                    currentPoint = 0;
                                }
                                if (!skip)
                                {
                                    skip = true; goto retry;
                                }
                            }
                        }
                        break;

                    case "teleport":
                        pos[0] = Waypoints[currentPoint].x;
                        pos[1] = Waypoints[currentPoint].y;
                        pos[2] = Waypoints[currentPoint].z;
                        rot[0] = Waypoints[currentPoint].rotx;
                        rot[1] = Waypoints[currentPoint].roty;
                        currentPoint++;
                        if (currentPoint == Waypoints.Count)
                        {
                            currentPoint = 0;
                        }
                        return;

                    case "wait":
                        if (countdown != 0)
                        {
                            countdown--;
                            if (countdown == 0)
                            {
                                currentPoint++;
                                if (currentPoint == Waypoints.Count)
                                {
                                    currentPoint = 0;
                                }
                                if (!skip)
                                {
                                    skip = true; goto retry;
                                }
                            }
                        }
                        else
                        {
                            countdown = Waypoints[currentPoint].seconds;
                        }
                        return;

                    case "nod":
                        if (countdown != 0)
                        {
                            countdown--;

                            if (nodUp)
                            {
                                if (rot[1] > 32 && rot[1] < 128)
                                {
                                    nodUp = !nodUp;
                                }
                                else
                                {
                                    if (rot[1] + (byte)Waypoints[currentPoint].rotspeed > 255)
                                    {
                                        rot[1] = 0;
                                    }
                                    else
                                    {
                                        rot[1] += (byte)Waypoints[currentPoint].rotspeed;
                                    }
                                }
                            }
                            else
                            {
                                if (rot[1] > 128 && rot[1] < 224)
                                {
                                    nodUp = !nodUp;
                                }
                                else
                                {
                                    if (rot[1] - (byte)Waypoints[currentPoint].rotspeed < 0)
                                    {
                                        rot[1] = 255;
                                    }
                                    else
                                    {
                                        rot[1] -= (byte)Waypoints[currentPoint].rotspeed;
                                    }
                                }
                            }

                            if (countdown == 0)
                            {
                                currentPoint++;
                                if (currentPoint == Waypoints.Count)
                                {
                                    currentPoint = 0;
                                }
                                if (!skip)
                                {
                                    skip = true; goto retry;
                                }
                            }
                        }
                        else
                        {
                            countdown = Waypoints[currentPoint].seconds;
                        }
                        return;

                    case "spin":
                        if (countdown != 0)
                        {
                            countdown--;

                            if (rot[0] + (byte)Waypoints[currentPoint].rotspeed > 255)
                            {
                                rot[0] = 0;
                            }
                            else if (rot[0] + (byte)Waypoints[currentPoint].rotspeed < 0)
                            {
                                rot[0] = 255;
                            }
                            else
                            {
                                rot[0] += (byte)Waypoints[currentPoint].rotspeed;
                            }

                            if (countdown == 0)
                            {
                                currentPoint++;
                                if (currentPoint == Waypoints.Count)
                                {
                                    currentPoint = 0;
                                }
                                if (!skip)
                                {
                                    skip = true; goto retry;
                                }
                            }
                        }
                        else
                        {
                            countdown = Waypoints[currentPoint].seconds;
                        }
                        return;

                    case "speed":
                        movementSpeed = (int)Math.Round((decimal)((decimal)24 / (decimal)100 * (decimal)Waypoints[currentPoint].seconds));
                        if (movementSpeed == 0)
                        {
                            movementSpeed = 1;
                        }

                        currentPoint++;
                        if (currentPoint == Waypoints.Count)
                        {
                            currentPoint = 0;
                        }
                        if (!skip)
                        {
                            skip = true; goto retry;
                        }
                        return;

                    case "reset":
                        currentPoint = 0;
                        return;

                    case "remove":
                        removeBot();
                        return;

                    case "linkscript":
                        if (File.Exists("bots/" + Waypoints[currentPoint].newscript))
                        {
                            Command.all.Find("botset").Use(null, this.name + " " + Waypoints[currentPoint].newscript);
                            return;
                        }

                        currentPoint++;
                        if (currentPoint == Waypoints.Count)
                        {
                            currentPoint = 0;
                        }
                        if (!skip)
                        {
                            skip = true; goto retry;
                        }
                        return;

                    case "jump":
                        jumpTimer.Elapsed += delegate
                        {
                            currentjump++;
                            switch (currentjump)
                            {
                            case 1:
                            case 2: pos[1] += 24; break;

                            case 3: break;

                            case 4: pos[1] -= 24; break;

                            case 5: pos[1] -= 24; jumping = false; currentjump = 0; jumpTimer.Stop(); break;
                            }
                        };
                        jumpTimer.Start();

                        currentPoint++;
                        if (currentPoint == Waypoints.Count)
                        {
                            currentPoint = 0;
                        }
                        if (!skip)
                        {
                            skip = true; goto retry;
                        }
                        break;
                    }

                    if (currentPoint == Waypoints.Count)
                    {
                        currentPoint = 0;
                    }
                }

                if (!movement)
                {
                    if (rot[0] < 245)
                    {
                        rot[0] += 8;
                    }
                    else
                    {
                        rot[0] = 0;
                    }

                    if (rot[1] > 32 && rot[1] < 64)
                    {
                        rot[1] = 224;
                    }
                    else if (rot[1] > 250)
                    {
                        rot[1] = 0;
                    }
                    else
                    {
                        rot[1] += 4;
                    }
                }
            };

            botTimer.Start();

            moveTimer.Elapsed += delegate
            {
                moveTimer.Interval = Server.updateTimer.Interval / movementSpeed;
                if (!movement)
                {
                    return;
                }
                int newNum; Random rand = new Random();

                if ((pos[1] - 19) % 32 != 0 && !jumping)
                {
                    pos[1] = (ushort)((pos[1] + 19) - (pos[1] % 32));
                }

                x = (ushort)Math.Round((decimal)(pos[0] - 16) / (decimal)32);
                y = (ushort)((pos[1] - 64) / 32);
                z = (ushort)Math.Round((decimal)(pos[2] - 16) / (decimal)32);

                byte b = Block.Convert(level.GetTile(x, y, z));
                byte b1, b2, b3;//, b4;

                if (Block.Walkthrough(b) && !jumping)
                {
                    pos[1] = (ushort)(pos[1] - 32);
                }

                y = (ushort)((pos[1] - 64) / 32);   //Block below feet

                newNum = level.PosToInt((ushort)(x + Math.Sign(foundPos[0] - pos[0])), y, (ushort)(z + Math.Sign(foundPos[2] - pos[2])));
                b      = Block.Convert(level.GetTile(newNum));
                b1     = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 1, 0)));
                b2     = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 2, 0)));
                b3     = Block.Convert(level.GetTile(level.IntOffset(newNum, 0, 3, 0)));

                if (Block.Walkthrough(b2) && Block.Walkthrough(b3) && !Block.Walkthrough(b1))
                {     //Get ready to go up step
                    pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]);
                    pos[1] += (ushort)32;
                    pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]);
                }
                else if (Block.Walkthrough(b1) && Block.Walkthrough(b2))
                {                        //Stay on current level
                    pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]);
                    pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]);
                }
                else if (Block.Walkthrough(b) && Block.Walkthrough(b1))
                {                         //Drop a level
                    pos[0] += (ushort)Math.Sign(foundPos[0] - pos[0]);
                    pos[1] -= (ushort)32;
                    pos[2] += (ushort)Math.Sign(foundPos[2] - pos[2]);
                }

                x = (ushort)Math.Round((decimal)(pos[0] - 16) / (decimal)32);
                y = (ushort)((pos[1] - 64) / 32);
                z = (ushort)Math.Round((decimal)(pos[2] - 16) / (decimal)32);

                b1 = Block.Convert(level.GetTile(x, (ushort)(y + 1), z));
                b2 = Block.Convert(level.GetTile(x, (ushort)(y + 2), z));
                b3 = Block.Convert(level.GetTile(x, y, z));

                /*
                 * if ((ushort)(foundPos[1] / 32) > y) {
                 *  if (b1 == Block.water || b1 == Block.waterstill || b1 == Block.lava || b1 == Block.lavastill) {
                 *      if (Block.Walkthrough(b2)) {
                 *          pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1])));
                 *      }
                 *  } else if (b2 == Block.water || b2 == Block.waterstill || b2 == Block.lava || b2 == Block.lavastill) {
                 *      pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1])));
                 *  }
                 * } else if ((ushort)(foundPos[1] / 32) < y) {
                 *  if (b3 == Block.water || b3 == Block.waterstill || b3 == Block.lava || b3 == Block.lavastill) {
                 *      pos[1] = (ushort)(pos[1] + (Math.Sign(foundPos[1] - pos[1])));
                 *  }
                 * }*/
            };
            moveTimer.Start();
        }