Ejemplo n.º 1
0
        /// <summary>
        /// Spawns the entity.
        /// </summary>
        /// <param name="p">The player.</param>
        public void SpawnEntity(NewPlayer p)
        {
            byte ID = 255;

            if (p != this)
            {
                ID = p.PlayerID;
            }

            PacketQueue.WritePacket(new PacketSpawnPlayer(ID, p.DisplayName, p.CurrentPosition, p.CurrentPitch, p.CurrentYaw));
            UpdatePos();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines whether the player has a valid account
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="playerKey">The player key.</param>
        /// <returns>
        ///   <c>true</c> if the player has a valid account; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsValidAccount(NewPlayer player, string playerKey)
        {
            if (ServerSettings.GetSettingBoolean("offline") || InetUtils.IsLocalIP(player.IP))
            {
                return(true);
            }

            while (playerKey.Length < 32)
            {
                playerKey = "0" + playerKey;
            }

            MD5           hash    = MD5.Create();
            StringBuilder builder = new StringBuilder(32);

            foreach (byte b in hash.ComputeHash(Encoding.ASCII.GetBytes(ServerSettings.Salt + player.Username)))
            {
                builder.AppendFormat("{0:x2}", b);
            }

            return(string.Equals(builder.ToString(), playerKey, StringComparison.OrdinalIgnoreCase));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Spawns the specified player for everybody.
 /// </summary>
 /// <param name="playerToSpawn">The player to spawn.</param>
 public static void GlobalSpawnEntity(NewPlayer playerToSpawn)
 {
     foreach (var player in Server.Players)
     {
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Spawns the specified player for everybody.
 /// </summary>
 /// <param name="playerToSpawn">The player to spawn.</param>
 public static void GlobalSpawnEntity(NewPlayer playerToSpawn) {
     foreach ( var player in Server.Players ) { }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Determines whether the player has a valid account
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="playerKey">The player key.</param>
        /// <returns>
        ///   <c>true</c> if the player has a valid account; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsValidAccount(NewPlayer player, string playerKey) {

            if ( ServerSettings.GetSettingBoolean("offline") || InetUtils.IsLocalIP(player.IP) )
                return true;

            while ( playerKey.Length < 32 )
                playerKey = "0" + playerKey;

            MD5 hash = MD5.Create();
            StringBuilder builder = new StringBuilder(32);
            foreach ( byte b in hash.ComputeHash(Encoding.ASCII.GetBytes(ServerSettings.Salt + player.Username)) )
                builder.AppendFormat("{0:x2}", b);

            return string.Equals(builder.ToString(), playerKey, StringComparison.OrdinalIgnoreCase);

        }
Ejemplo n.º 6
0
        /// <summary>
        /// Spawns the entity.
        /// </summary>
        /// <param name="p">The player.</param>
        public void SpawnEntity(NewPlayer p) {

            byte ID = 255;

            if( p != this )
                   ID = p.PlayerID;

            PacketQueue.WritePacket(new PacketSpawnPlayer(ID, p.DisplayName, p.CurrentPosition, p.CurrentPitch, p.CurrentYaw));
            UpdatePos();

        }