context: using WowPacketParser.Enums;
  using WowPacketParser.Misc;
  using WowPacketParser.Parsing;
  using WowPacketParser.Proto;
  using WowPacketParser.Store;
  using CoreParsers = WowPacketParser.Parsing.Parsers;
  
  namespace WowPacketParserModule.V9_0_1_36216.Parsers
  {
      public static class MiscellaneousHandler
      {
          public static void ReadGameRuleValuePair(Packet packet, params object[] indexes)
          {
              packet.ReadInt32("Rule", indexes);
              packet.ReadInt32("Value", indexes);
          }
  
          [Parser(Opcode.SMSG_FEATURE_SYSTEM_STATUS)]
          public static void HandleFeatureSystemStatus(Packet packet)
          {
              packet.ReadByte("ComplaintStatus");
  
              packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining");
              packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay");
              packet.ReadUInt32("CfgRealmID");
              packet.ReadInt32("CfgRealmRecID");
              packet.ReadUInt32("MaxRecruits", "RAFSystem");
              packet.ReadUInt32("MaxRecruitMonths", "RAFSystem");
              packet.ReadUInt32("MaxRecruitmentUses", "RAFSystem");
              packet.ReadUInt32("DaysInCycle", "RAFSystem");
              packet.ReadUInt32("TwitterPostThrottleLimit");
              packet.ReadUInt32("TwitterPostThrottleCooldown");
              packet.ReadUInt32("TokenPollTimeSeconds");
              packet.ReadUInt32("KioskSessionMinutes");
              packet.ReadInt64("TokenBalanceAmount");
              packet.ReadUInt32("BpayStoreProductDeliveryDelay");
              packet.ReadUInt32("ClubsPresenceUpdateTimer");
              packet.ReadUInt32("HiddenUIClubsPresenceUpdateTimer");
  
              if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_2_0_42423))
              {
                  packet.ReadInt32("GameRuleUnknown1");
                  var gameRuleValuesCount = packet.ReadUInt32("GameRuleValuesCount");
                  packet.ReadInt16("MaxPlayerNameQueriesPerPacket");
  
                  for (var i = 0; i < gameRuleValuesCount; ++i)
                      ReadGameRuleValuePair(packet, "GameRuleValues");
              }
  
              packet.ResetBitReader();
              packet.ReadBit("VoiceEnabled");
              var hasEuropaTicketSystemStatus = packet.ReadBit("HasEuropaTicketSystemStatus");
              packet.ReadBit("ScrollOfResurrectionEnabled");
              packet.ReadBit("BpayStoreEnabled");
              packet.ReadBit("BpayStoreAvailable");
              packet.ReadBit("BpayStoreDisabledByParentalControls");
              packet.ReadBit("ItemRestorationButtonEnabled");
              packet.ReadBit("BrowserEnabled");
              var hasSessionAlert = packet.ReadBit("HasSessionAlert");
              packet.ReadBit("Enabled", "RAFSystem");
              packet.ReadBit("RecruitingEnabled", "RAFSystem");
              packet.ReadBit("CharUndeleteEnabled");
              packet.ReadBit("RestrictedAccount");
              packet.ReadBit("CommerceSystemEnabled");
              packet.ReadBit("TutorialsEnabled");
              packet.ReadBit("TwitterEnabled");
              packet.ReadBit("Unk67");
              packet.ReadBit("WillKickFromWorld");
              packet.ReadBit("KioskModeEnabled");
              packet.ReadBit("CompetitiveModeEnabled");
              packet.ReadBit("TokenBalanceEnabled");
              packet.ReadBit("WarModeFeatureEnabled");
              packet.ReadBit("ClubsEnabled");
              packet.ReadBit("ClubsBattleNetClubTypeAllowed");
              packet.ReadBit("ClubsCharacterClubTypeAllowed");
              packet.ReadBit("ClubsPresenceUpdateEnabled");
              packet.ReadBit("VoiceChatDisabledByParentalControl");
              packet.ReadBit("VoiceChatMutedByParentalControl");
              packet.ReadBit("QuestSessionEnabled");
              packet.ReadBit("IsMuted");
              packet.ReadBit("ClubFinderEnabled");
              packet.ReadBit("Unknown901CheckoutRelated");
  
              if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_5_40772))
              {
                  packet.ReadBit("TextToSpeechFeatureEnabled");
                  packet.ReadBit("ChatDisabledByDefault");
                  packet.ReadBit("ChatDisabledByPlayer");
                  packet.ReadBit("LFGListCustomRequiresAuthenticator");
              }
  
              {
                  packet.ResetBitReader();
                  packet.ReadBit("ToastsDisabled");
                  packet.ReadSingle("ToastDuration");
                  packet.ReadSingle("DelayDuration");
                  packet.ReadSingle("QueueMultiplier");
                  packet.ReadSingle("PlayerMultiplier");
                  packet.ReadSingle("PlayerFriendValue");
                  packet.ReadSingle("PlayerGuildValue");
                  packet.ReadSingle("ThrottleInitialThreshold");
                  packet.ReadSingle("ThrottleDecayTime");
                  packet.ReadSingle("ThrottlePrioritySpike");
                  packet.ReadSingle("ThrottleMinThreshold");
                  packet.ReadSingle("ThrottlePvPPriorityNormal");
                  packet.ReadSingle("ThrottlePvPPriorityLow");
                  packet.ReadSingle("ThrottlePvPHonorThreshold");
                  packet.ReadSingle("ThrottleLfgListPriorityDefault");
                  packet.ReadSingle("ThrottleLfgListPriorityAbove");
                  packet.ReadSingle("ThrottleLfgListPriorityBelow");
                  packet.ReadSingle("ThrottleLfgListIlvlScalingAbove");
                  packet.ReadSingle("ThrottleLfgListIlvlScalingBelow");
                  packet.ReadSingle("ThrottleRfPriorityAbove");
                  packet.ReadSingle("ThrottleRfIlvlScalingAbove");
                  packet.ReadSingle("ThrottleDfMaxItemLevel");
                  packet.ReadSingle("ThrottleDfBestPriority");
              }
  
              if (hasSessionAlert)
                  V6_0_2_19033.Parsers.MiscellaneousHandler.ReadClientSessionAlertConfig(packet, "SessionAlert");
  
              packet.ResetBitReader();
              V8_0_1_27101.Parsers.MiscellaneousHandler.ReadVoiceChatManagerSettings(packet, "VoiceChatManagerSettings");
  
              if (hasEuropaTicketSystemStatus)
              {
                  packet.ResetBitReader();
                  V6_0_2_19033.Parsers.MiscellaneousHandler.ReadCliEuropaTicketConfig(packet, "EuropaTicketSystemStatus");
              }
          }
  
          [Parser(Opcode.SMSG_FEATURE_SYSTEM_STATUS2)]
          public static void HandleFeatureSystemStatus2(Packet packet)
          {
              packet.ReadBit("TextToSpeechFeatureEnabled");
          }
  
          [Parser(Opcode.SMSG_FEATURE_SYSTEM_STATUS_GLUE_SCREEN)]
          public static void HandleFeatureSystemStatusGlueScreen(Packet packet)
          {
              packet.ReadBit("BpayStoreEnabled");
              packet.ReadBit("BpayStoreAvailable");
              packet.ReadBit("BpayStoreDisabledByParentalControls");
              packet.ReadBit("CharUndeleteEnabled");
              packet.ReadBit("CommerceSystemEnabled");
              packet.ReadBit("Unk14");
              packet.ReadBit("WillKickFromWorld");
              packet.ReadBit("IsExpansionPreorderInStore");
              packet.ReadBit("KioskModeEnabled");
              packet.ReadBit("IsCompetitiveModeEnabled");
              packet.ReadBit("TrialBoostEnabled");
              packet.ReadBit("TokenBalanceEnabled");
              packet.ReadBit("LiveRegionCharacterListEnabled");
              packet.ReadBit("LiveRegionCharacterCopyEnabled");
              packet.ReadBit("LiveRegionAccountCopyEnabled");
              packet.ReadBit("LiveRegionKeyBindingsCopyEnabled");
              packet.ReadBit("Unknown901CheckoutRelated");
              var europaTicket = packet.ReadBit("IsEuropaTicketSystemStatusEnabled");
              packet.ResetBitReader();
  
              if (europaTicket)
                  V6_0_2_19033.Parsers.MiscellaneousHandler.ReadCliEuropaTicketConfig(packet, "EuropaTicketSystemStatus");
  
              packet.ReadUInt32("TokenPollTimeSeconds");
              packet.ReadUInt32("KioskSessionMinutes");
              packet.ReadInt64("TokenBalanceAmount");
              packet.ReadInt32("MaxCharactersPerRealm");
              var liveRegionCharacterCopySourceRegionsCount = packet.ReadUInt32("LiveRegionCharacterCopySourceRegionsCount");
              packet.ReadUInt32("BpayStoreProductDeliveryDelay");
              packet.ReadInt32("ActiveCharacterUpgradeBoostType");
              packet.ReadInt32("ActiveClassTrialBoostType");
              packet.ReadInt32("MinimumExpansionLevel");
              packet.ReadInt32("MaximumExpansionLevel");
  
              var gameRuleValuesCount = 0u;
  
              if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_2_0_42423))
              {
                  packet.ReadInt32("GameRuleUnknown1");
                  gameRuleValuesCount = packet.ReadUInt32("GameRuleValuesCount");
                  packet.ReadInt16("MaxPlayerNameQueriesPerPacket");
              }
  
              for (int i = 0; i < liveRegionCharacterCopySourceRegionsCount; i++)
                  packet.ReadUInt32("LiveRegionCharacterCopySourceRegion", i);
  
              for (var i = 0; i < gameRuleValuesCount; ++i)
                  ReadGameRuleValuePair(packet, "GameRuleValues");
          }
  
          [Parser(Opcode.SMSG_SET_ALL_TASK_PROGRESS)]
          [Parser(Opcode.SMSG_UPDATE_TASK_PROGRESS)]
          public static void HandleSetAllTaskProgress(Packet packet)
          {
              var int4 = packet.ReadUInt32("TaskProgressCount");
              for (int i = 0; i < int4; i++)
              {
                  packet.ReadUInt32("TaskID", i);
  
                  // these fields might have been shuffled
                  packet.ReadUInt32("FailureTime", i);
                  packet.ReadUInt32("Flags", i);
                  packet.ReadUInt32("Unk", i);
  
  
gt:                 var int3 = packet.ReadUInt32("ProgressCounts", i);