コード例 #1
0
ファイル: PlayerInfo.cs プロジェクト: Benedani/MCGalaxy
        public static Player FindNick(Player p, string nick)
        {
            nick = Colors.StripColors(nick);
            Player[] players = PlayerInfo.Online.Items;
            Player   match = null; int matches = 0;

            foreach (Player pl in players)
            {
                if (!Entities.CanSee(p, pl))
                {
                    continue;
                }
                string name = Colors.StripColors(pl.DisplayName);

                if (name.CaselessEq(nick))
                {
                    return(pl);
                }
                if (name.CaselessContains(nick))
                {
                    match = pl; matches++;
                }
            }
            return(matches == 1 ? match : null);
        }
コード例 #2
0
ファイル: ClassiCube.cs プロジェクト: Benedani/MCGalaxy
        public string PrepareBeat()
        {
            string name = Server.name;

            Server.zombie.OnHeartbeat(ref name);
            Server.lava.OnHeartbeat(ref name);
            name = Colors.StripColors(name);

            return("&port=" + Server.port +
                   "&max=" + Server.players +
                   "&name=" + Uri.EscapeDataString(name) +
                   "&public=" + Server.pub +
                   "&version=7" +
                   "&salt=" + Server.salt +
                   "&users=" + PlayerCount() +
                   "&software=MCGalaxy");
        }
コード例 #3
0
ファイル: Hacks.cs プロジェクト: Benedani/MCGalaxy
        public static byte[] MakeHackControl(Player p)
        {
            string motd = p.level.GetMotd(p);

            motd = Colors.StripColors(motd);
            bool isOp = p.Rank >= LevelPermission.Operator;

            bool  fly = true, noclip = true, speed = true, respawn = true, _3rdPerson = true;
            short maxJump = -1;

            string[] parts = motd.Split(' ');
            for (int i = 0; i < parts.Length; i++)
            {
                string part = parts[i];
                if (part.CaselessEq("-hax"))
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                if (part.CaselessEq("-hax"))
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                else if (part.CaselessEq("-ophax") && isOp)
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                else if (part.CaselessEq("+ophax") && isOp)
                {
                    fly = true; noclip = true; speed = true; respawn = true; _3rdPerson = true;
                }

                if (part.CaselessEq("+noclip"))
                {
                    noclip = true;
                }
                else if (part.CaselessEq("+fly"))
                {
                    fly = true;
                }
                else if (part.CaselessEq("+speed"))
                {
                    speed = true;
                }
                else if (part.CaselessEq("+respawn"))
                {
                    respawn = true;
                }
                else if (part.CaselessEq("+thirdperson"))
                {
                    _3rdPerson = true;
                }

                if (part.CaselessEq("-noclip"))
                {
                    noclip = false;
                }
                else if (part.CaselessEq("-fly"))
                {
                    fly = false;
                }
                else if (part.CaselessEq("-speed"))
                {
                    speed = false;
                }
                else if (part.CaselessEq("-respawn"))
                {
                    respawn = false;
                }
                else if (part.CaselessEq("-thirdperson"))
                {
                    _3rdPerson = false;
                }

                if (!part.CaselessStarts("jumpheight="))
                {
                    continue;
                }
                string heightPart = part.Substring(part.IndexOf('=') + 1);
                float  value;
                if (Utils.TryParseDecimal(heightPart, out value))
                {
                    maxJump = (short)(value * 32);
                }
            }
            return(Packet.HackControl(fly, noclip, speed, respawn, _3rdPerson, maxJump));
        }