示例#1
0
        public static PlayerModule read(BinaryReader binaryReader)
        {
            PlayerModule newObj = new PlayerModule();

            newObj.header   = binaryReader.ReadUInt32();
            newObj.options_ = binaryReader.ReadUInt32();
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_ShortCutManager) != 0)
            {
                newObj.shortcuts_ = ShortCutManager.read(binaryReader);
            }
            // TODO: This message often gets fragmented. Need to combine fragments to prevent the reader from creating an exception from trying to read beyond buffer.
            newObj.favorite_spells_[0] = PList <uint> .read(binaryReader);

            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_MultiSpellLists) != 0)
            {
                for (int i = 1; i < 5; ++i)
                {
                    newObj.favorite_spells_[i] = PList <uint> .read(binaryReader);
                }
            }
            else if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_ExtendedMultiSpellLists) != 0)
            {
                for (int i = 1; i < 7; ++i)
                {
                    newObj.favorite_spells_[i] = PList <uint> .read(binaryReader);
                }
            }
            else if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_8_SpellLists) != 0)
            {
                for (int i = 1; i < 8; ++i)
                {
                    newObj.favorite_spells_[i] = PList <uint> .read(binaryReader);
                }
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_DesiredComps) != 0)
            {
                newObj.desired_comps_ = PackableHashTable <uint, int> .read(binaryReader);
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_SpellbookFilters) != 0)
            {
                newObj.spell_filters_ = binaryReader.ReadUInt32();
            }
            else
            {
                newObj.spell_filters_ = 0x3FFF;
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_2ndCharacterOptions) != 0)
            {
                newObj.options2 = binaryReader.ReadUInt32();
            }
            else
            {
                newObj.options2 = 0x948700;
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_TimeStampFormat) != 0)
            {
                newObj.m_TimeStampFormat = PStringChar.read(binaryReader);
            }
            // TODO: Lots more to read here!
            return(newObj);
        }
示例#2
0
        public List <string> packedItems; // For display purposes

        public static PlayerModule read(BinaryReader binaryReader)
        {
            PlayerModule newObj = new PlayerModule();

            newObj.packedItems = new List <string>();
            newObj.header      = binaryReader.ReadUInt32();
            newObj.options_    = binaryReader.ReadUInt32();
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_ShortCutManager) != 0)
            {
                newObj.shortcuts_ = ShortCutManager.read(binaryReader);
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_ShortCutManager.ToString());
            }

            newObj.favorite_spells_[0] = PList <SpellID> .read(binaryReader);

            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_MultiSpellLists) != 0)
            {
                for (int i = 1; i < 5; ++i)
                {
                    newObj.favorite_spells_[i] = PList <SpellID> .read(binaryReader);
                }
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_MultiSpellLists.ToString());
            }
            else if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_ExtendedMultiSpellLists) != 0)
            {
                for (int i = 1; i < 7; ++i)
                {
                    newObj.favorite_spells_[i] = PList <SpellID> .read(binaryReader);
                }
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_ExtendedMultiSpellLists.ToString());
            }
            else if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_8_SpellLists) != 0)
            {
                for (int i = 1; i < 8; ++i)
                {
                    newObj.favorite_spells_[i] = PList <SpellID> .read(binaryReader);
                }
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_8_SpellLists.ToString());
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_DesiredComps) != 0)
            {
                newObj.desired_comps_ = PackableHashTable <uint, int> .read(binaryReader);

                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_DesiredComps.ToString());
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_SpellbookFilters) != 0)
            {
                newObj.spell_filters_ = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_SpellbookFilters.ToString());
            }
            else
            {
                newObj.spell_filters_ = 0x3FFF;
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_2ndCharacterOptions) != 0)
            {
                newObj.options2 = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_2ndCharacterOptions.ToString());
            }
            else
            {
                newObj.options2 = 0x948700;
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_TimeStampFormat) != 0)
            {
                newObj.m_TimeStampFormat = PStringChar.read(binaryReader);
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_TimeStampFormat.ToString());
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_GenericQualitiesData) != 0)
            {
                newObj.m_pPlayerOptionsData = GenericQualitiesData.read(binaryReader);
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_GenericQualitiesData.ToString());
            }
            if ((newObj.header & (uint)PlayerModulePackHeader.PM_Packed_GameplayOptions) != 0)
            {
                newObj.m_colGameplayOptions = PackObjPropertyCollection.read(binaryReader);
                Util.readToAlign(binaryReader); // Align to dword boundary
                newObj.packedItems.Add(PlayerModulePackHeader.PM_Packed_GameplayOptions.ToString());
            }
            return(newObj);
        }