Ejemplo n.º 1
0
 public override void Use(Player p, string message)
 {
     Player pl = Player.Find(message);
     if (message == "") { Help(p); return; }
     if (p == null)
     {
         if (pl == null) { Player.SendMessage(p, "Player \"" + message + "\"not found!"); return; }
         if (!pl.warned) { Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has not been warned!"); return; }
         pl.warned = false;
         Player.SendMessage(pl, "Unwarned by &cConsole");
         Player.GlobalMessageOps("To Ops" + c.white + " - " + pl.color + pl.name + c.white + " was unwarned by &aConsole");
         Server.s.Log(pl.name + " was unwarned by Console");
     }
     else
     {
         if (pl == null) { Player.SendMessage(p, "Player \"" + message + "\"not found!"); return; }
         if (pl == p) { Player.SendMessage(p, "You cannot unwarn yourself!"); return; }
         if (p.warned) { Player.SendMessage(p, "You cannot unwarn a player if you are warned!"); return; }
         if (p.group.Permission <= pl.group.Permission) { Player.SendMessage(p, "You can't unwarn a player of an equal or higher rank!"); return; }
         if (!pl.warned) { Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has not been warned!"); return; }
         pl.warned = false;
         Player.SendMessage(pl, "Unwarned by " + p.color + p.name);
         Player.GlobalMessageOps("To Ops" + c.white + " - " + pl.color + pl.name + c.white + " was unwarned by " + p.color + p.name);
         Server.s.Log(pl.name + " was unwarned by " + p.name);
         if (p.group.Permission < Server.opchatperm)
         {
             Player.SendMessage(p, pl.color + pl.name + c.white + "was unwarned by " + p.color + p.name);
         }
     }
 }
Ejemplo n.º 2
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] + ")");
        }
Ejemplo n.º 3
0
 public override void Use(Player p, string message)
 {
     if (p == null) { Player.SendMessage(p, "Command not useable from console"); return; }
     if (p.level != Level.FindExact(p.name)) { Player.SendMessage(p, "You must be at your home to use this command"); return; }
     Player pl = Player.Find(message.Split(' ')[0]);
     Level lvl = Level.FindExact(p.name);
     if (message.Split(' ')[1].Trim().ToLower() == "del")
     {
         if (pl == p) { Player.SendMessage(p, "You cannot disallow yourself from building in your home!"); return; }
         p.level.ZoneList.ForEach(delegate(Level.Zone Zn)
         {
             if (Zn.Owner.Trim().ToLower() == Player.Find(message).name.Trim().ToLower())
             {
                 MySQL.executeQuery("DELETE FROM `Zone" + lvl.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'");
                 lvl.ZoneList.Remove(Zn);
                 Player.SendMessage(p, "Removed zone for " + pl.name);
             }
         });
         return;
     }
     Level.Zone zn;
     zn.smallX = 0;
     zn.smallY = 0;
     zn.smallZ = 0;
     zn.bigX = Convert.ToUInt16(lvl.width - 1);
     zn.bigY = Convert.ToUInt16(lvl.height - 1);
     zn.bigZ = Convert.ToUInt16(lvl.depth - 1);
     zn.Owner = pl.name;
     lvl.ZoneList.Add(zn);
     MySQL.executeQuery("INSERT INTO `Zone" + lvl.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + zn.smallX + ", " + zn.smallY + ", " + zn.smallZ + ", " + zn.bigX + ", " + zn.bigY + ", " + zn.bigZ + ", '" + zn.Owner + "')");
     Player.SendMessage(p, "Zoned entire map for " + pl.name);
 }
Ejemplo n.º 4
0
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            if (message.ToLower() == "all")
            {
                foreach (Player pl in Player.players)
                {
                    if (pl.level == p.level && pl != p)
                    {
                        unchecked { pl.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
                        pl.SendMessage("You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
                    }
                }
                return;
            }

            Player who = Player.Find(message);
            if (who == null || who.hidden) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; }
            if (p.level != who.level)
            {
                if (p.level.locked) { Player.SendMessage(p, "You can't summon players to a locked map!"); return; }
                Player.SendMessage(p, who.name + " is in a different level.");
                Player.SendMessage(p, "Force-fetching has started...");
                who.ignorePermission = true;
                Command.all.Find("goto").Use(who, p.level.name);
                who.ignorePermission = false;
                unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
                Player.SendMessage(who, "You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
                return;
            }
            unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
            who.SendMessage("You were summoned by " + p.color + p.name + Server.DefaultColor + ".");
        }
Ejemplo n.º 5
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");
 }
Ejemplo n.º 6
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.");
         }
     }
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
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.");
 }
Ejemplo n.º 10
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]); }
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 12
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);
         }
     }
 }
Ejemplo n.º 13
0
        public override void Use(Player p, string message)
        {
            if (p == null) { Player.SendMessage(p, "Command not useable from console"); return; }
            if (p.level != Level.FindExact(p.name)) { Player.SendMessage(p, "You must be at your home to use this command"); return; }

            int totalFixed = 0;

            for (int i = 0; i < p.level.blocks.Length; i++)
            {
                try
                {
                    ushort x, y, z;
                    p.level.IntToPos(i, out x, out y, out z);

                    if (p.level.blocks[i] == Block.dirt)
                    {
                        if (Block.LightPass(p.level.blocks[p.level.IntOffset(i, 0, 1, 0)]))
                        {
                            p.level.Blockchange(p, x, y, z, Block.grass);
                            totalFixed++;
                        }
                    }
                    else if (p.level.blocks[i] == Block.grass)
                    {
                        if (!Block.LightPass(p.level.blocks[p.level.IntOffset(i, 0, 1, 0)]))
                        {
                            p.level.Blockchange(p, x, y, z, Block.dirt);
                            totalFixed++;
                        }
                    }
                }
                catch { }
            }
            Player.SendMessage(p, "Fixed " + totalFixed + " blocks.");
        }
Ejemplo n.º 14
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }
            Level foundLevel = Level.Find(message.Split(' ')[0]);
            string newName = message.Split(' ')[1];

            if (File.Exists("levels/" + newName)) { Player.SendMessage(p, "Level already exists."); return; }
            if (foundLevel == Server.mainLevel) { Player.SendMessage(p, "Cannot rename the main level."); return; }
            if (foundLevel != null) foundLevel.Unload();

            try
            {
                File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl");

                try
                {
                    File.Move("levels/level properties/" + foundLevel.name + ".properties", "levels/level properties/" + newName + ".properties");
                }
                catch { }
                try
                {
                    File.Move("levels/level properties/" + foundLevel.name, "levels/level properties/" + newName + ".properties");
                }
                catch { }

                MySQL.executeQuery("RENAME TABLE `Block" + foundLevel.name.ToLower() + "` TO `Block" + newName.ToLower() +
                    "`, `Portals" + foundLevel.name.ToLower() + "` TO `Portals" + newName.ToLower() +
                    "`, `Messages" + foundLevel.name.ToLower() + "` TO Messages" + newName.ToLower() +
                    ", `Zone" + foundLevel.name.ToLower() + "` TO `Zone" + newName.ToLower() + "`");

                Player.GlobalMessage("Renamed " + foundLevel.name + " to " + newName);
            }
            catch (Exception e) { Player.SendMessage(p, "Error when renaming."); Server.ErrorLog(e); }
        }
Ejemplo n.º 15
0
        public override void Use(Player p, string message)
        {
            if (Server.PCCounter == null)
            {
                Player.SendMessage(p, "Starting PCCounter...one second");
                Server.PCCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
                Server.PCCounter.BeginInit();
                Server.PCCounter.NextValue();
            }
            if (Server.ProcessCounter == null)
            {
                Player.SendMessage(p, "Starting ProcessCounter...one second");
                Server.ProcessCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
                Server.ProcessCounter.BeginInit();
                Server.ProcessCounter.NextValue();
            }

            TimeSpan tp = Process.GetCurrentProcess().TotalProcessorTime;
            TimeSpan up = (DateTime.Now - Process.GetCurrentProcess().StartTime);

            //To get actual CPU% is OS dependant
            string ProcessorUsage = "CPU Usage (Processes : All Processes):" + Server.ProcessCounter.NextValue() + " : " + Server.PCCounter.NextValue();
            //Alternative Average?
            //string ProcessorUsage = "CPU Usage is Not Implemented: So here is ProcessUsageTime/ProcessTotalTime:"+String.Format("00.00",(((tp.Ticks/up.Ticks))*100))+"%";
            //reports Private Bytes because it is what the process has reserved for itself and is unsharable
            string MemoryUsage = "Memory Usage: " + Math.Round((double)Process.GetCurrentProcess().PrivateMemorySize64 / 1048576).ToString() + " Megabytes";
            string Uptime = "Uptime: " + up.Days + " Days " + up.Hours + " Hours " + up.Minutes + " Minutes " + up.Seconds + " Seconds";
            string Threads = "Threads: " + Process.GetCurrentProcess().Threads.Count;
            Player.SendMessage(p, Uptime);
            Player.SendMessage(p, MemoryUsage);
            Player.SendMessage(p, ProcessorUsage);
            Player.SendMessage(p, Threads);
        }
Ejemplo n.º 16
0
        public override void Use(Player p, string message)
        {
            if (message != "") { Help(p); return; }

            p.deleteMode = !p.deleteMode;
            Player.SendMessage(p, "Delete mode: &a" + p.deleteMode);
        }
Ejemplo n.º 17
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 + "\"");
     }
 }
Ejemplo n.º 18
0
        public override void Use(Player p, string message)
        {
            if (message != "list")
            {
                if (p.joker)
                {
                    message = "";
                }
                if (!Server.afkset.Contains(p.name))
                {
                    Server.afkset.Add(p.name);
                    if (p.muted)
                    {
                        message = "";
                    }
                    Player.GlobalMessage("-" + p.color + p.name + Server.DefaultColor + "- is AFK " + message);
                    IRCBot.Say(p.name + " is AFK " + message);
                    return;

                }
                else
                {
                    Server.afkset.Remove(p.name);
                    Player.GlobalMessage("-" + p.color + p.name + Server.DefaultColor + "- is no longer AFK");
                    IRCBot.Say(p.name + " is no longer AFK");
                    return;
                }
            }
            else
            {
                foreach (string s in Server.afkset) Player.SendMessage(p, s);
            }
        }
Ejemplo n.º 19
0
 public override void Use(Player p, string message)
 {
     if (message != "") { Help(p); return; }
     string devlist = "";
     string temp;
     foreach (string dev in Server.devs)
     {
         temp = dev.Substring(0, 1);
         temp = temp.ToUpper() + dev.Remove(0, 1);
         devlist += temp + ", ";
     }
     devlist = devlist.Remove(devlist.Length - 2);
     Player.SendMessage(p, "&9MCSong Development Team: " + Server.DefaultColor + devlist);
     if (Server.staff.Count > 0)
     {
         string stafflist = "";
         string tmp;
         foreach (string staff in Server.staff)
         {
             tmp = staff.Substring(0, 1);
             tmp = tmp.ToUpper() + staff.Remove(0, 1);
             stafflist += tmp + ", ";
         }
         stafflist = stafflist.Remove(stafflist.Length - 2);
         Player.SendMessage(p, "&9MCSong Administration Team: " + Server.DefaultColor + stafflist);
     }
 }
 public override void Use(Player p, string message)
 {
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
     Player.SendMessage(p, "\r\n");
 }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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");
            }
        }
Ejemplo n.º 23
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.");
 }
Ejemplo n.º 24
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); }
        }
Ejemplo n.º 25
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"); }
        }
Ejemplo n.º 26
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");
 }
Ejemplo n.º 27
0
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Help(p);
            }
            else
            {
                Player.SendMessage(p, "This server runs on" + c.teal + " MCSong" + Server.DefaultColor + ", an MCLawl based software started by 727021.");
                Player.SendMessage(p, "This server's name: " + c.aqua + Server.name);
                Player.SendMessage(p, "This server's version: " + c.teal + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
               // Player.SendMessage(p, "This server's owner: " + c.aqua + Server.owner);
                Player.SendMessage(p, "There are currently " + c.aqua + Player.players.Count.ToString() + Server.DefaultColor + " players on " + c.aqua + Server.levels.Count.ToString() + Server.DefaultColor + " worlds.");
                if (Server.autorestart) Player.SendMessage(p, "This server is scheduled to restart at " + c.teal + Server.restarttime.ToString("HH:mm:ss"));

                TimeSpan up = DateTime.Now - Server.timeOnline;
                string upTime = "Time online: " + c.aqua;
                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 " + c.purple + "Low Lag" + Server.DefaultColor + " mode.");
                if (Server.maintenanceMode) Player.SendMessage(p, "Server is currently in " + c.red + "Maintenance" + Server.DefaultColor + " mode.");
            }
        }
Ejemplo n.º 28
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);
        }
Ejemplo n.º 29
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"); }
 }
Ejemplo n.º 30
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();
         }
     }
 }