Exemplo n.º 1
0
        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();

            writer.Write((byte)1); // Always 1?

            // Padding? Or the above is actually a uint
            for (int i = 0; i < 3; i++)
            {
                writer.Write((byte)0);
            }

            // Character ID
            writer.Write((uint)character.CharacterID);

            // Padding?
            for (int i = 0; i < 4; i++)
            {
                writer.Write((byte)0);
            }

            // Nickname
            // TODO: The above and below may be switched around, need more data
            writer.WriteFixedLengthUTF16(character.Player.Nickname, 16);

            // Padding?
            for (int i = 0; i < 36; i++)
            {
                writer.Write((byte)0);
            }

            // Player name
            writer.WriteFixedLengthUTF16(character.Name, 16);

            // Unknown?
            for (int i = 0; i < 24; i++)
            {
                writer.Write((byte)0);
            }

            // Team Name
            // We don't actually have team names anywhere, just dump a test here
            writer.WriteFixedLengthUTF16("Polaris Team", 16);

            // Unknown
            // Somewhere in here is likely a Team ID
            for (int i = 0; i < 32; i++)
            {
                writer.Write((byte)0);
            }

            return(writer.ToArray());
        }
        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();

            // Player header
            writer.WritePlayerHeader((uint)character.Player.PlayerID);

            // Spawn position
            writer.Write(Position);

            writer.Write((ushort)0);                       // padding?
            writer.WriteFixedLengthASCII("Character", 32);
            writer.Write((ushort)1);                       // 0x44
            writer.Write((ushort)0);                       // 0x46
            writer.Write((uint)602);                       // 0x48
            writer.Write((uint)1);                         // 0x4C
            writer.Write((uint)53);                        // 0x50
            writer.Write((uint)0);                         // 0x54
            writer.Write((uint)(IsItMe ? 47 : 39));        // 0x58
            writer.Write((ushort)559);                     // 0x5C
            writer.Write((ushort)306);                     // 0x5E
            writer.Write((uint)character.Player.PlayerID); // player ID copy
            writer.Write((uint)0);                         // "char array ugggghhhhh" according to PolarisLegacy
            writer.Write((uint)0);                         // "voiceParam_unknown4"
            writer.Write((uint)0);                         // "voiceParam_unknown8"
            writer.WriteFixedLengthUTF16(character.Name, 16);
            writer.Write((uint)0);                         // 0x90
            writer.WriteStruct(character.Looks);
            writer.WriteStruct(character.Jobs);
            writer.WriteFixedLengthUTF16("", 32);                        // title?
            writer.Write((uint)0);                                       // 0x204
            writer.Write((uint)0);                                       // gmflag?
            writer.WriteFixedLengthUTF16(character.Player.Nickname, 16); // nickname, maybe not 16 chars?
            for (int i = 0; i < 64; i++)
            {
                writer.Write((byte)0);
            }

            return(writer.ToArray());
        }