public static byte[] GetAddonInfo(this IAuthHandler authhandler, IPacketReader packet)
        {
            byte[] data = packet.ReadToEnd();

            using (var msIn = new MemoryStream(data, 2, data.Length - 2)) // skip zlib header
                using (var dfltStream = new DeflateStream(msIn, CompressionMode.Decompress))
                    using (var msOut = new MemoryStream())
                    {
                        dfltStream.CopyTo(msOut);
                        return(msOut.ToArray());
                    }
        }
Beispiel #2
0
        public void HandleAuthSession(ref IPacketReader packet, ref IWorldManager manager)
        {
            packet.ReadUInt64();
            byte[] data = packet.ReadToEnd().TakeWhile(x => x != 10 && x != 13).ToArray();
            string name = Encoding.UTF8.GetString(data).ToUpper();

            Account account = new Account(name);

            account.Load <Character>();
            manager.Account = account;

            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_AUTH_RESPONSE], "SMSG_AUTH_RESPONSE");

            writer.WriteUInt8(0x0C);             //AUTH_OK
            manager.Send(writer);
        }
Beispiel #3
0
        public void HandleMovementStatus(ref IPacketReader packet, ref IWorldManager manager)
        {
            if (manager.Account.ActiveCharacter.IsTeleporting)
            {
                return;
            }

            uint opcode = packet.Opcode;
            long pos    = packet.Position;

            var   character = manager.Account.ActiveCharacter;
            ulong Flags     = packet.ReadUInt64();

            character.Location.Update(packet, true);

            packet.Position = pos;
            PacketWriter writer = new PacketWriter(opcode, Sandbox.Instance.Opcodes[opcode].ToString());

            writer.WriteBytes(packet.ReadToEnd());
            manager.Send(writer);
        }