mackal

Untitled

Apr 27th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.30 KB | None | 0 0
  1.         public override UInt16 GetZoneNumber()
  2.         {
  3.             // A return value of zero from this method should be intepreted as 'Unable to identify patch version'.
  4.  
  5.             // Thanks to ShowEQ team for details on how to parse the variable length PP
  6.             try
  7.             {
  8.                 List<byte[]> PlayerProfilePacket = GetPacketsOfType("OP_PlayerProfile", PacketDirection.ServerToClient);
  9.  
  10.                 if (PlayerProfilePacket.Count == 0)
  11.                 {
  12.                     return 0;
  13.                 }
  14.  
  15.                 var Buffer = new ByteStream(PlayerProfilePacket[0]);
  16.                 Buffer.SkipBytes(4); // checksum
  17.                 Buffer.SkipBytes(12); // unknown
  18.                 Buffer.SkipBytes(1); // gender
  19.                 Buffer.SkipBytes(4); // race
  20.                 Buffer.SkipBytes(4); // class_
  21.                 Buffer.SkipBytes(1); // level
  22.                 Buffer.SkipBytes(1); // level1
  23.  
  24.                 // Bind points
  25.                 int BindCount = Buffer.ReadInt32();
  26.  
  27.                 Buffer.SkipBytes(20 * BindCount); // bind structs - 20 = sizeof(BindStruct)
  28.  
  29.                 Buffer.SkipBytes(4); // deity
  30.                 Buffer.SkipBytes(4); // intoxication
  31.                 // Spell slot refresh
  32.                 int spellRefreshCount = Buffer.ReadInt32();
  33.  
  34.                 Buffer.SkipBytes(4 * spellRefreshCount); // spell refresh slots - just int32 * count
  35.  
  36.                 // Equipment
  37.                 uint EquipmentCount = Buffer.ReadUInt32();
  38.  
  39.                 Buffer.SkipBytes(20 * EquipmentCount); // equipment
  40.  
  41.                 // Something (9 ints)
  42.                 var sCount = Buffer.ReadUInt32();
  43.                 Buffer.SkipBytes(20 * sCount);
  44.  
  45.                 // Something (9 ints)
  46.                 var sCount1 = Buffer.ReadUInt32();
  47.                 Buffer.SkipBytes(4 * sCount1);
  48.  
  49.                 // Something (9 ints)
  50.                 var sCount2 = Buffer.ReadUInt32();
  51.                 Buffer.SkipBytes(4 * sCount2);
  52.  
  53.                 Buffer.SkipBytes(52); // face, haircolor, etc
  54.                 Buffer.SkipBytes(4 * 10); // points, mana, curHP ... WIS
  55.  
  56.                 Buffer.SkipBytes(28); // unknown
  57.  
  58.                 UInt32 AACount = Buffer.ReadUInt32();
  59.  
  60.                 Buffer.SkipBytes(4 * 3 * AACount); // AA stuffs
  61.  
  62.                 // Something (100 ints)
  63.                 uint sCount3 = Buffer.ReadUInt32();
  64.                 Buffer.SkipBytes(4 * sCount3);
  65.  
  66.                 // Something (25 ints)
  67.                 uint sCount4 = Buffer.ReadUInt32();
  68.                 Buffer.SkipBytes(4 * sCount4);
  69.  
  70.                 // Something (300 ints)
  71.                 uint sCount5 = Buffer.ReadUInt32();
  72.                 Buffer.SkipBytes(4 * sCount5);
  73.  
  74.                 // Something (20 ints)
  75.                 uint sCount6 = Buffer.ReadUInt32();
  76.                 Buffer.SkipBytes(4 * sCount6);
  77.  
  78.                 // Something (20 floats)
  79.                 uint sCount7 = Buffer.ReadUInt32();
  80.                 Buffer.SkipBytes(4 * sCount7);
  81.  
  82.                 // Something (100 floats)
  83.                 uint sCount8 = Buffer.ReadUInt32();
  84.                 Buffer.SkipBytes(4 * sCount8);
  85.  
  86.                 UInt32 SpellBookSlots = Buffer.ReadUInt32();
  87.                 Buffer.SkipBytes(4 * SpellBookSlots);
  88.  
  89.                 UInt32 SpellMemSlots = Buffer.ReadUInt32();
  90.                 Buffer.SkipBytes(4 * SpellMemSlots);
  91.  
  92.                 // Something (13 ints)
  93.                 uint sCount9 = Buffer.ReadUInt32();
  94.                 Buffer.SkipBytes(4 * sCount9);
  95.  
  96.                 // Unknown
  97.                 Buffer.SkipBytes(1);
  98.  
  99.                 UInt32 BuffCount = Buffer.ReadUInt32();
  100.                 Buffer.SkipBytes(80 * BuffCount); // buffs - 80 = sizeof(spellBuff)
  101.  
  102.                 Buffer.SkipBytes(4); // money
  103.                 Buffer.SkipBytes(4);
  104.                 Buffer.SkipBytes(4);
  105.                 Buffer.SkipBytes(4);
  106.  
  107.                 Buffer.SkipBytes(4); // money cursor
  108.                 Buffer.SkipBytes(4);
  109.                 Buffer.SkipBytes(4);
  110.                 Buffer.SkipBytes(4);
  111.  
  112.                 // Unknown
  113.                 Buffer.SkipBytes(20);
  114.  
  115.                 Buffer.SkipBytes(4); // aa_spent
  116.  
  117.                 // Unknown
  118.                 Buffer.SkipBytes(4);
  119.  
  120.                 Buffer.SkipBytes(4); // aa_assigned
  121.  
  122.                 // Unknown
  123.                 Buffer.SkipBytes(16);
  124.  
  125.                 Buffer.SkipBytes(4); // aa_unspent
  126.  
  127.                 // Unknown
  128.                 Buffer.SkipBytes(2);
  129.                
  130.                 UInt32 BandolierCount = Buffer.ReadUInt32();
  131.                 for (int i = 0; i < BandolierCount; ++i)
  132.                 {
  133.                     Buffer.ReadString(false); // bandolierName
  134.  
  135.                     Buffer.ReadString(false); // mainhand
  136.                     Buffer.SkipBytes(8);
  137.  
  138.                     Buffer.ReadString(false); // offhand
  139.                     Buffer.SkipBytes(8);
  140.  
  141.                     Buffer.ReadString(false); // range
  142.                     Buffer.SkipBytes(8);
  143.  
  144.                     Buffer.ReadString(false); // ammo
  145.                     Buffer.SkipBytes(8);
  146.                 }
  147.  
  148.                 UInt32 PotionCount = Buffer.ReadUInt32();
  149.                 for (int i = 0; i < PotionCount; ++i)
  150.                 {
  151.                     Buffer.ReadString(false);
  152.                     Buffer.SkipBytes(8);
  153.                 }
  154.  
  155.                 // Unknown
  156.                 Buffer.SkipBytes(84);
  157.  
  158.                 Buffer.SkipBytes(4); // endurance
  159.  
  160.                 // Unknown
  161.                 Buffer.SkipBytes(12);
  162.  
  163.  
  164.                 Buffer.SkipBytes(64); // name
  165.  
  166.                 Buffer.SkipBytes(4); // unknown
  167.  
  168.                 Buffer.SkipBytes(64); // lastname
  169.  
  170.                 Buffer.SkipBytes(4); // birthdayTime
  171.                 Buffer.SkipBytes(4); // accountCreateDate
  172.                 Buffer.SkipBytes(4); // lastSaveTime
  173.                 Buffer.SkipBytes(4); // timePlayedMin
  174.  
  175.                 Buffer.SkipBytes(8); // unknown
  176.  
  177.                 UInt32 LanguageCount = Buffer.ReadUInt32();
  178.                 Buffer.SkipBytes(1 * LanguageCount); // langs
  179.  
  180.                 // This is what I am after ...
  181.  
  182.                 UInt16 ZoneID = Buffer.ReadUInt16();
  183.  
  184.                 return ZoneID;
  185.             }
  186.             catch (Exception)
  187.             {
  188.                 return 0;
  189.             }
  190.         }
Advertisement
Add Comment
Please, Sign In to add comment