MaxtorCoder

SMSG_DISPLAY_PLAYER_CHOICE

Mar 3rd, 2019
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.74 KB | None | 0 0
  1.         [Parser(Opcode.SMSG_DISPLAY_PLAYER_CHOICE)]
  2.         public static void HandleDisplayPlayerChoice(Packet packet)
  3.         {
  4.             packet.ReadInt32("ChoiceID");
  5.             var responseCount = packet.ReadUInt32();
  6.             packet.ReadPackedGuid128("SenderGUID");
  7.             packet.ReadInt32("UiTextureKitID");
  8.             packet.ReadUInt32("Unknown");
  9.             packet.ResetBitReader();
  10.             var questionLength = packet.ReadBits(8);
  11.             packet.ReadBit("CloseChoiceFrame");
  12.             packet.ReadBit("HideWarboardHeader");
  13.             packet.ReadBit("KeepOpenAfterChoice");
  14.  
  15.             for (var i = 0u; i < responseCount; ++i)
  16.                 ReadPlayerChoiceResponse(packet, "PlayerChoiceResponse", i);
  17.  
  18.             packet.ReadWoWString("Question", questionLength);
  19.         }
  20.  
  21.         public static void ReadPlayerChoiceResponse(Packet packet, params object[] indexes)
  22.         {
  23.             packet.ReadInt32("ResponseID", indexes);
  24.             packet.ReadInt32("ChoiceArtFileID", indexes);
  25.             packet.ReadInt32("Flags", indexes);
  26.  
  27.             packet.ReadUInt32("WidgetSetID", indexes);
  28.             packet.ReadUInt32("Unk1", indexes);
  29.             packet.ReadUInt32("Unk2", indexes);
  30.             packet.ReadUInt32("Unk3", indexes);
  31.  
  32.             packet.ReadByte("GroupID", indexes);
  33.  
  34.             packet.ResetBitReader();
  35.             var answerLength            = packet.ReadBits("AnswerLength", 9, indexes);
  36.             var headerLength            = packet.ReadBits("HeaderLength", 9, indexes);
  37.             var UnkLength               = packet.ReadBits("UnkLength", 7, indexes);
  38.             var confirmationTextLength  = packet.ReadBits("ConfirmationLength", 9, indexes);
  39.             var descriptionLength       = packet.ReadBits("DescriptionLength", 11, indexes);
  40.             var UnkLength2              = packet.ReadBits("UnkLength2", 7, indexes);
  41.             var hasReward               = packet.ReadBit();
  42.  
  43.             if (hasReward)
  44.                 ReadPlayerChoiceResponseReward(packet, "PlayerChoiceResponseReward", indexes);
  45.  
  46.             packet.ReadWoWString("Answer", answerLength, indexes);
  47.             packet.ReadWoWString("Header", headerLength, indexes);
  48.             packet.ReadWoWString("Description", descriptionLength, indexes);
  49.             packet.ReadWoWString("ConfirmationText", confirmationTextLength, indexes);
  50.             packet.ReadWoWString("UnkText", UnkLength, indexes);
  51.             packet.ReadWoWString("UnkText2", UnkLength2, indexes);
  52.         }
  53.  
  54.         public static void ReadPlayerChoiceResponseReward(Packet packet, params object[] indexes)
  55.         {
  56.             packet.ResetBitReader();
  57.             packet.ReadInt32("TitleID", indexes);
  58.             packet.ReadInt32("PackageID", indexes);
  59.             packet.ReadInt32("SkillLineID", indexes);
  60.             packet.ReadUInt32("SkillPointCount", indexes);
  61.             packet.ReadUInt32("ArenaPointCount", indexes);
  62.             packet.ReadUInt32("HonorPointCount", indexes);
  63.             packet.ReadUInt64("Money", indexes);
  64.             packet.ReadUInt32("Xp", indexes);
  65.  
  66.             var itemCount       = packet.ReadUInt32();
  67.             var currencyCount   = packet.ReadUInt32();
  68.             var factionCount    = packet.ReadUInt32();
  69.             var itemChoiceCount = packet.ReadUInt32();
  70.  
  71.             for (var i = 0u; i < itemCount; ++i)
  72.                 ReadRewardItem(packet, "Item", i);
  73.  
  74.             for (var i = 0u; i < currencyCount; ++i)
  75.                 ReadRewardItem(packet, "Currency", i);
  76.  
  77.             for (var i = 0u; i < factionCount; ++i)
  78.                 ReadRewardItem(packet, "Faction", i);
  79.  
  80.             for (var i = 0u; i < itemChoiceCount; ++i)
  81.                 ReadRewardItem(packet, "ItemChoice", i);
  82.         }
Advertisement
Add Comment
Please, Sign In to add comment