Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 5.05 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using Kamilla.WorldOfWarcraft.Latest.OpcodeDatas;
  3.  
  4. namespace Kamilla.WorldOfWarcraft.Latest.Parsers.Lobby
  5. {
  6.     [WowPacketParser(WowOpcodes.SMSG_CHAR_ENUM)]
  7.     [WowPacketParser(WowOpcodes.SMSG_COMPRESSED_CHAR_ENUM)]
  8.     internal sealed class CharEnumParser : WowPacketParser
  9.     {
  10.         protected unsafe override void Parse()
  11.         {
  12.             if ((WowOpcodes)this.Packet.Opcode == WowOpcodes.SMSG_COMPRESSED_CHAR_ENUM)
  13.                 this.Decompress();
  14.  
  15.             int someBool = Reader.ReadByte() >> 7;
  16.             Output.AppendLine("Not Drop Character Info: " + someBool);
  17.  
  18.             Output.AppendLine();
  19.  
  20.             uint count = Reader.ReadUInt32();
  21.             Output.AppendLine("Unk Count: " + count);
  22.             for (uint i = 0; i < count; ++i) // byte=[0,23]
  23.                 Output.AppendFormatLine("  Unk: {1} => {0}", Reader.ReadUInt32(), Reader.ReadByte());
  24.  
  25.             Output.AppendLine();
  26.  
  27.             uint nCharacters = Reader.ReadUInt32();
  28.             Output.AppendLine("Total Characters: " + nCharacters);
  29.  
  30.             var pack = new PackingContext(Reader);
  31.  
  32.             var guids = new Tuple<byte[], byte[]>[nCharacters];
  33.             var firstLogin = new bool[nCharacters];
  34.             for (byte i = 0; i < nCharacters; ++i)
  35.             {
  36.                 var guid1 = new byte[8];
  37.                 var guid2 = new byte[8];
  38.                 guids[i] = new Tuple<byte[], byte[]>(guid1, guid2);
  39.  
  40.                 guid2[0] = pack.NextBit();
  41.                 firstLogin[i] = pack.NextBool();
  42.                 guid1[5] = pack.NextBit();
  43.                 guid2[7] = pack.NextBit();
  44.                 guid2[5] = pack.NextBit();
  45.                 guid1[1] = pack.NextBit();
  46.                 guid1[3] = pack.NextBit();
  47.                 guid2[1] = pack.NextBit();
  48.                 guid1[2] = pack.NextBit();
  49.                 guid1[6] = pack.NextBit();
  50.                 guid2[6] = pack.NextBit();
  51.                 guid2[3] = pack.NextBit();
  52.                 guid2[2] = pack.NextBit();
  53.                 guid1[7] = pack.NextBit();
  54.                 guid1[4] = pack.NextBit();
  55.                 guid2[4] = pack.NextBit();
  56.                 guid1[0] = pack.NextBit();
  57.  
  58.                 Output.AppendLine(BitConverter.ToUInt64(guid1, 0).ToString("X16") + BitConverter.ToUInt64(guid2, 0).ToString("X16"));
  59.             }
  60.  
  61.             for (byte i = 0; i < nCharacters; ++i)
  62.             {
  63.                 var chrguids = guids[i];
  64.                 var guid1 = new WowGuid(chrguids.Item1);
  65.                 var guid2 = new WowGuid(chrguids.Item2);
  66.                 Output.AppendFormatLine(" Character {0}", i);
  67.  
  68.                 Output.AppendLine("  First Login: " + firstLogin[i]);
  69.                 Output.AppendLine("  Hair Color: " + Reader.ReadByte());
  70.                 pack.XorByte(ref guid1.Bytes[7]);
  71.                 Output.AppendLine("  Gender: " + (Genders)Reader.ReadByte());
  72.                 pack.XorByte(ref guid2.Bytes[6]);
  73.                 Output.AppendLine("  Level: " + Reader.ReadByte());
  74.                 pack.XorByte(ref guid1.Bytes[6]);
  75.                 Output.AppendLine("  Zone: " + Reader.ReadUInt32());
  76.                 Output.AppendLine("  Pet DisplayId: " + Reader.ReadUInt32());
  77.                 pack.XorByte(ref guid2.Bytes[1]);
  78.                 pack.XorByte(ref guid2.Bytes[5]);
  79.                 Output.AppendLine("  Race: " + (Races)Reader.ReadByte());
  80.                 pack.XorByte(ref guid2.Bytes[3]);
  81.                 Output.AppendLine("  Character Flags: " + (CharacterFlags)Reader.ReadUInt32());
  82.                 pack.XorByte(ref guid2.Bytes[4]);
  83.                 pack.XorByte(ref guid1.Bytes[5]);
  84.                 pack.XorByte(ref guid1.Bytes[3]);
  85.                 pack.XorByte(ref guid1.Bytes[4]);
  86.                 Output.AppendLine("  Pet Family: " + Reader.ReadUInt32());
  87.                 Output.AppendLine("  Hair Style: " + Reader.ReadByte());
  88.                 Output.AppendLine("  Order: " + Reader.ReadByte());
  89.                 pack.XorByte(ref guid2.Bytes[7]);
  90.  
  91.                 Reader.Skip(23 * (4 + 4 + 1)); // item data
  92.  
  93.                 Output.AppendLine("  Face: " + Reader.ReadByte());
  94.                 pack.XorByte(ref guid1.Bytes[0]);
  95.                 pack.XorByte(ref guid2.Bytes[2]);
  96.                 Output.AppendLine("  Class: " + (Classes)Reader.ReadByte());
  97.                 Output.AppendLine("  Position: " + Reader.ReadStruct<Vector3>());
  98.                 pack.XorByte(ref guid2.Bytes[0]);
  99.                 Output.AppendLine("  Name: " + Reader.ReadCString());
  100.                 Output.AppendLine("  Map: " + (Maps)Reader.ReadUInt32());
  101.                 pack.XorByte(ref guid1.Bytes[1]);
  102.                 Output.AppendLine("  Pet Level: " + Reader.ReadUInt32());
  103.                 Output.AppendLine("  Customize Flags: " + (CharacterCustomizeFlags)Reader.ReadUInt32());
  104.                 pack.XorByte(ref guid1.Bytes[2]);
  105.                 Output.AppendLine("  Facial Hair: " + Reader.ReadByte());
  106.                 Output.AppendLine("  Skin: " + Reader.ReadByte());
  107.  
  108.                 Output.AppendLine("  Player Guid: " + guid2);
  109.                 Output.AppendLine("  Guild Guid: " + guid1);
  110.  
  111.                 Output.AppendLine();
  112.             }
  113.         }
  114.     }
  115. }