Open() public method

Opens the file for reading.
Files can only be opened once, so don't forget to close the stream after you've used it.
public Open ( ) : MpqFileStream
return MpqFileStream
Beispiel #1
0
 public GameBalance(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.Type = (BalanceType)stream.ReadValueS32();
     Gbi = stream.ReadString(256, true);
     Xls = stream.ReadString(256, true);
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.ItemType = stream.ReadSerializedData<ItemTypeTable>(); //536
     stream.Position += 8;
     this.Item = stream.ReadSerializedData<ItemTable>(); //552
     stream.Position += 8;
     this.Experience = stream.ReadSerializedData<ExperienceTable>(); //568
     stream.Position += 8;
     this.HelpCodes = stream.ReadSerializedData<HelpCodesTable>(); //584
     stream.Position += 8;
     this.MonsterLevel = stream.ReadSerializedData<MonsterLevelTable>(); //600
     stream.Position += 8;
     this.Affixes = stream.ReadSerializedData<AffixTable>(); //616
     stream.Position += 8;
     this.Heros = stream.ReadSerializedData<HeroTable>(); //632
     stream.Position += 8;
     this.MovementStyles = stream.ReadSerializedData<MovementStyleTable>(); //648
     stream.Position += 8;
     this.Labels = stream.ReadSerializedData<LabelGBIDTable>(); //664
     stream.Position += 8;
     this.LootDistribution = stream.ReadSerializedData<LootDistTable>(); //680
     stream.Position += 8;
     this.RareItemNames = stream.ReadSerializedData<RareItemNamesTable>(); //696
     stream.Position += 8;
     this.MonsterAffixes = stream.ReadSerializedData<MonsterAffixesTable>(); //712
     stream.Position += 8;
     this.RareMonsterNames = stream.ReadSerializedData<MonsterNamesTable>(); //728
     stream.Position += 8;
     this.SocketedEffects = stream.ReadSerializedData<SocketedEffectTable>(); //744
     stream.Position += 8;
     this.ItemEnhancement = stream.ReadSerializedData<ItemEnhancementTable>(); //760
     stream.Position += 8;
     this.ItemDrop = stream.ReadSerializedData<ItemDropTable>(); //776
     stream.Position += 8;
     this.ItemLevelMod = stream.ReadSerializedData<ItemLevelModTable>(); //792
     stream.Position += 8;
     this.QualityClass = stream.ReadSerializedData<QualityClassTable>(); //808
     stream.Position += 8;
     this.Hirelings = stream.ReadSerializedData<HirelingTable>(); //824
     stream.Position += 8;
     this.SetItemBonus = stream.ReadSerializedData<SetItemBonusTable>(); //840
     stream.Position += 8;
     this.EliteModifiers = stream.ReadSerializedData<EliteModTable>(); //856
     stream.Position += 8;
     this.ItemTiers = stream.ReadSerializedData<ItemTierTable>(); //872
     stream.Position += 8;
     this.PowerFormula = stream.ReadSerializedData<PowerFormulaTable>(); //888
     stream.Position += 8;
     this.Recipes = stream.ReadSerializedData<RecipeTable>(); //904
     stream.Position += 8;
     this.ScriptedAchievementEvents = stream.ReadSerializedData<ScriptedAchievementEventsTable>(); //920
     stream.Close();
 }
Beispiel #2
0
        public Power(MpqFile file)
        {
            var stream = file.Open();   
            this.Header = new Header(stream);
            LuaName = stream.ReadString(64, true);
            stream.Position += 4; // pad 1
            Powerdef = new PowerDef(stream);
            stream.Position = 440; // Seems like theres a bit of a gap - DarkLotus
            I0 = stream.ReadValueS32();
            I1 = stream.ReadValueS32();
            Chararray2 = stream.ReadString(256, true);
            ScriptFormulaCount = stream.ReadValueS32();
            ScriptFormulaDetails = stream.ReadSerializedData<ScriptFormulaDetails>();
            stream.Position += (3 * 4);
            i3 = stream.ReadValueS32();
            stream.Position += (3 * 4);

            // TODO: please fix this - use our serializable-data readers instead! /raist
            // TODO add a class for complied script so it can be deserialized properly. - DarkLotus
            // none of the .pow appear to have any data here, and stream position appears to be correct, unsure - DarkLotus
            var serCompliedScript = stream.GetSerializedDataPointer();
            if (serCompliedScript.Size > 0)
            {
                long x = stream.Position;
                stream.Position = serCompliedScript.Offset + 16;
                var buf = new byte[serCompliedScript.Size];
                stream.Read(buf, 0, serCompliedScript.Size);
                stream.Position = x;
                CompliedScript.AddRange(buf);
            }
            SNOQuestMetaData = stream.ReadValueS32();
            stream.Close();
        }
Beispiel #3
0
        public MarkerSet(MpqFile file)
        {
            var stream = file.Open();
            Header = new Header(stream);
            SNO = stream.ReadInt32();
            unknown0 = stream.ReadInt32();
            unknown1 = stream.ReadInt32();
            serMarkers = new SerializeData(stream);
            long x = stream.Position;
            Markers = new Marker[serMarkers.Size / 208];
            stream.Position = serMarkers.Offset + 16;
            for (int i = 0; i < serMarkers.Size / 208; i++)
            {
                Markers[i] = new Marker(stream);
            }
            stream.Position = x;
            stream.Position += (15 * 4); // pad 15
            serNoSpawns = new SerializeData(stream);
            stream.Position += (14 * 4);
            aabb = new AABB_(stream);
            i0 = stream.ReadInt32();
            byte[] buf = new byte[256];
            stream.Read(buf, 0, 256); filename = Encoding.ASCII.GetString(buf);
            nLabel = stream.ReadInt32();
            nSpecialIndexCount = stream.ReadInt32();
            serSpecialIndexList = new SerializeData(stream);

                stream.Close();
        }
Beispiel #4
0
 public QuestRange(MpqFile file)
 {
     var stream = file.Open();
     this.Time0 = new QuestTime(stream);
     this.Time1 = new QuestTime(stream);
     stream.Close();
 }
Beispiel #5
0
        public Quest(MpqFile file)
        {
            MpqFileStream stream = file.Open();

            Header = new Header(stream);
            QuestType = (QuestType)stream.ReadValueS32();
            NumberOfSteps = stream.ReadValueS32();
            NumberOfCompletionSteps = stream.ReadValueS32();
            I2 = stream.ReadValueS32();
            I3 = stream.ReadValueS32();
            I4 = stream.ReadValueS32();
            I5 = stream.ReadValueS32();

            QuestUnassignedStep = new QuestUnassignedStep(stream);
            stream.Position += 8;
            QuestSteps = stream.ReadSerializedData<QuestStep>();
            stream.Position += 8;
            QuestCompletionSteps = stream.ReadSerializedData<QuestCompletionStep>();

            LevelRange1 = new QuestLevelRange(stream);
            LevelRange2 = new QuestLevelRange(stream);
            LevelRange3 = new QuestLevelRange(stream);
            LevelRange4 = new QuestLevelRange(stream);


            stream.Close();
        }
Beispiel #6
0
        public Conversation(MpqFile file)
        {
            MpqFileStream stream = file.Open();

            this.Header = new Header(stream);
            this.ConversationType = (ConversationTypes)stream.ReadValueS32();
            this.I0 = stream.ReadValueS32();
            this.I1 = stream.ReadValueS32();
            this.SNOQuest = stream.ReadValueS32();
            this.I2 = stream.ReadValueS32();
            this.I3 = stream.ReadValueS32();
            this.SNOConvPiggyback = stream.ReadValueS32();
            this.SNOConvUnlock = stream.ReadValueS32();
            this.I4 = stream.ReadValueS32();
            this.Unknown = stream.ReadString(128, true);
            this.SNOPrimaryNpc = stream.ReadValueS32();
            this.SNOAltNpc1 = stream.ReadValueS32();
            this.SNOAltNpc2 = stream.ReadValueS32();
            this.SNOAltNpc3 = stream.ReadValueS32();
            this.SNOAltNpc4 = stream.ReadValueS32();
            this.I5 = stream.ReadValueS32();

            stream.Position += (2 * 4);
            RootTreeNodes = stream.ReadSerializedData<ConversationTreeNode>();

            this.Unknown2 = stream.ReadString(256, true);
            this.I6 = stream.ReadValueS32();

            stream.Position += 12;
            CompiledScript = Encoding.ASCII.GetString(stream.ReadSerializedByteArray());
            stream.Position += 40;
            this.SNOBossEncounter = stream.ReadValueS32();
            stream.Close();
        }
Beispiel #7
0
        public MarkerSet(MpqFile file)
        {
            var stream = file.Open();
            this.Header = new Header(stream);

            this.Markers = stream.ReadSerializedData<Marker>();

            stream.Position += (15 * 4);
            var pointerSpawns = stream.GetSerializedDataPointer();
            //TODO Load spawn locations

            stream.Position += (14 * 4);
            this.AABB = new AABB(stream);
            int i0 = stream.ReadValueS32();
            if (i0 != 0 && i0 != 1)
                throw new System.Exception("Farmy thought this field is a bool, but apparently its not");
            this.ContainsActorLocations = i0 == 1;

            this.FileName = stream.ReadString(256, true);

            this.NLabel = stream.ReadValueS32();
            SpecialIndexCount = stream.ReadValueS32();

            var pointerSpecialIndexList = stream.GetSerializedDataPointer();
            // TODO Load PointerSpecialIndexList

            stream.Close();
        }
Beispiel #8
0
 public Recipe(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     ItemSpecifierData = new ItemSpecifierData(stream);
     stream.Close();
 }
Beispiel #9
0
        public Scene(MpqFile file)
        {
            var stream = file.Open();
            this.Header = new Header(stream);

            Int0 = stream.ReadValueS32();
            this.AABBBounds = new AABB(stream);
            this.AABBMarketSetBounds = new AABB(stream);

            this.NavMesh = new NavMeshDef(stream);
            this.Exclusions = stream.ReadSerializedInts();

            stream.Position += (14 * 4);
            this.Inclusions = stream.ReadSerializedInts();

            stream.Position += (14 * 4);
            this.MarkerSets = stream.ReadSerializedInts();

            stream.Position += (14 * 4);
            this.LookLink = stream.ReadString(64, true);

            this.MsgTriggeredEvent = stream.ReadSerializedData<MsgTriggeredEvent>();
            this.Int1 = stream.ReadValueS32();

            stream.Position += (3 * 4);
            this.NavZone = new NavZoneDef(stream);
            this.SNOAppearance = stream.ReadValueS32();
            this.SNOPhysMesh = stream.ReadValueS32();
            stream.Close();
        }
Beispiel #10
0
        public Scene(MpqFile file)
        {
            var stream = file.Open();
            this.Header = new Header(stream);

            Int0 = stream.ReadValueS32();
            this.AABBBounds = new AABB(stream);
            this.AABBMarketSetBounds = new AABB(stream);

            this.NavMesh = new NavMeshDef(stream); //load NavMeshDef
            var exclusions = stream.GetSerializedDataPointer();

            stream.Position += (14 * 4);
            var inclusions = stream.GetSerializedDataPointer();

            stream.Position += (14 * 4);
            this.MarkerSets = stream.ReadSerializedInts();

            stream.Position += (14 * 4);
            this.LookLink = stream.ReadString(64, true);

            // Maybe this is a list/array - DarkLotus
            this.MsgTriggeredEvent = stream.ReadSerializedItem<MsgTriggeredEvent>();
            this.Int1 = stream.ReadValueS32();

            stream.Position += (3 * 4);
            this.NavZone = new NavZoneDef(stream);

            stream.Close();
        }
Beispiel #11
0
 public QuestRange(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.Start = new QuestTime(stream);
     this.End = new QuestTime(stream);
     stream.Close();
 }
Beispiel #12
0
 public ConversationList(MpqFile file)
 {
     MpqFileStream stream = file.Open();
     this.Header = new Header(stream);
     stream.Position += (12);
     ConversationListEntries = stream.ReadSerializedData<ConversationListEntry>();
     stream.Close();
 }
Beispiel #13
0
 public Recipe(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.SNO = stream.ReadValueS32();
     stream.Position += (2 * 4);
     ItemSpecifierData = new ItemSpecifierData(stream);
     stream.Close();
 }
Beispiel #14
0
        /// <summary>Parses the (attributes) if it has not already been done.</summary>
        public void ParseAttributeFile()
        {
            const int MPQ_ATTRIBUTE_CRC32     = 0x1;
            const int MPQ_ATTRIBUTE_FILETIME  = 0x2;
            const int MPQ_ATTRIBUTE_MD5       = 0x4;
            const int MPQ_ATTRIBUTE_PATCH_BIT = 0x8;

            if (attribFileParsed)
            {
                return;
            }

            int numEntries = blockTable.Entries.Length;

            using (var reader = new BinaryReader(attribFile.Open()))
            {
                var version = reader.ReadInt32();
                if (version != 100)
                {
                    return;
                }

                var flags = reader.ReadInt32();

                if ((flags & MPQ_ATTRIBUTE_CRC32) != 0)
                {
                    for (int i = 0; i < numEntries; ++i)
                    {
                        blockTable.Entries[i].Crc32 = reader.ReadInt32();
                    }
                }

                if ((flags & MPQ_ATTRIBUTE_FILETIME) != 0)
                {
                    for (int i = 0; i < numEntries; ++i)
                    {
                        blockTable.Entries[i].FileTime = reader.ReadInt64();
                    }
                }

                if ((flags & MPQ_ATTRIBUTE_MD5) != 0)
                {
                    for (int i = 0; i < numEntries; ++i)
                    {
                        byte[] bytes = reader.ReadBytes(16);
                        blockTable.Entries[i].Md5 = new MpqMd5(bytes);
                    }
                }

                if ((flags & MPQ_ATTRIBUTE_PATCH_BIT) != 0)
                {
                    // ignore for now.
                }

                attribFileParsed = true;
            }
        }
Beispiel #15
0
 public Actor(MpqFile file)
 {
     var stream = file.Open();
     stream.Seek(16, SeekOrigin.Begin);
     this.ActorSNO = stream.ReadInt32();
     stream.Position = 120;
     this.AnimSetSNO = stream.ReadInt32();
     stream.Close();
 }
Beispiel #16
0
 public Encounter(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.SNOSpawn = stream.ReadValueS32();
     stream.Position += (2 * 4);// pad 2 int
     this.Spawnoptions = stream.ReadSerializedData<EncounterSpawnOptions>();
     stream.Close();
 }
Beispiel #17
0
 public Tutorial(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.Time = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #18
0
 public SkillKit(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     stream.Position += 12;
     this.TraitEntries = stream.ReadSerializedData<TraitEntry>();
     stream.Position += 8;
     this.ActiveSkillEntries = stream.ReadSerializedData<ActiveSkillEntry>();
     stream.Close();
 }
Beispiel #19
0
 public SceneGroup(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.Items = stream.ReadSerializedData<SceneGroupItem>();
     stream.Position += 8;
     this.I1 = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #20
0
        public int BitField1 { get; private set; }           // 25 bits - better this this would be an uint

        public Actor(MpqFile file)
        {
            var stream = file.Open();
            Header = new Header(stream);

            this.Int0 = stream.ReadValueS32();
            this.Type = (ActorType)stream.ReadValueS32();
            this.ApperanceSNO = stream.ReadValueS32();
            this.PhysMeshSNO = stream.ReadValueS32();
            this.Cylinder = new AxialCylinder(stream);
            this.Sphere = new Sphere(stream);
            this.AABBBounds = new AABB(stream);

            this.TagMap = stream.ReadSerializedItem<TagMap>();
            stream.Position += (2 * 4);

            this.AnimSetSNO = stream.ReadValueS32();
            this.MonsterSNO = stream.ReadValueS32();

            MsgTriggeredEvents = stream.ReadSerializedData<MsgTriggeredEvent>();

            this.Int1 = stream.ReadValueS32();
            stream.Position += (3 * 4);
            this.V0 = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());

            this.Looks = new WeightedLook[8];
            for (int i = 0; i < 8; i++)
            {
                this.Looks[i] = new WeightedLook(stream);
            }

            this.PhysicsSNO = stream.ReadValueS32();
            this.Int2 = stream.ReadValueS32();
            this.Int3 = stream.ReadValueS32();
            this.Float0 = stream.ReadValueF32();
            this.Float1 = stream.ReadValueF32();
            this.Float2 = stream.ReadValueF32();

            this.ActorCollisionData = new ActorCollisionData(stream);

            this.InventoryImages = new int[10]; //Was 5*8/4 - Darklotus
            for (int i = 0; i < 10; i++)
            {
                this.InventoryImages[i] = stream.ReadValueS32();
            }
            this.Int4 = stream.ReadValueS32();
            stream.Position += 4;
            BitField0 = stream.ReadValueS32();
            CastingNotes = stream.ReadSerializedString();
            VoiceOverRole = stream.ReadSerializedString();

            // Updated based on BoyC's 010 template and Moack's work. Think we just about read all data from actor now.- DarkLotus
            stream.Close();
        }
Beispiel #21
0
 public TreasureClass(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.Percentage = stream.ReadValueF32();
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     stream.Position += 8;
     this.ModifierList = stream.ReadSerializedData<LootDropModifier>();
     stream.Close();
 }
Beispiel #22
0
 public Adventure(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.SNOSymbolActor = stream.ReadValueS32();
     this.F0 = stream.ReadValueF32();
     this.F1 = stream.ReadValueF32();
     this.F2 = stream.ReadValueF32();
     this.F3 = stream.ReadValueF32();
     this.SNOMarkerSet = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #23
0
        public Actor(MpqFile file)
        {
            var stream = file.Open();
            Header = new Header(stream);

            this.Int0 = stream.ReadValueS32();
            this.Type = (ActorType)stream.ReadValueS32();
            this.ApperanceSNO = stream.ReadValueS32();
            this.PhysMeshSNO = stream.ReadValueS32();
            this.Cylinder = new AxialCylinder(stream);
            this.Sphere = new Sphere(stream);
            this.AABBBounds = new AABB(stream);

            var tagmap = stream.GetSerializedDataPointer(); // we need to read tagmap. /raist.
            stream.Position += (2*4);

            this.AnimSetSNO = stream.ReadValueS32();
            this.MonsterSNO = stream.ReadValueS32();

            var msgTriggeredEvents = stream.GetSerializedDataPointer();

            this.Int1 = stream.ReadValueS32();
            stream.Position += (3*4);
            this.V0 = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());

            this.Looks = new WeightedLook[8];
            for (int i = 0; i < 8; i++)
            {
                this.Looks[i] = new WeightedLook(stream);
            }

            this.PhysicsSNO = stream.ReadValueS32();
            this.Int2 = stream.ReadValueS32();
            this.Int3 = stream.ReadValueS32();
            this.Float0 = stream.ReadValueF32();
            this.Float1 = stream.ReadValueF32();
            this.Float2 = stream.ReadValueF32();

            this.ActorCollisionData = new int[17]; // Was 68/4 - Darklotus 
            for (int i = 0; i < 17; i++)
            {
                this.ActorCollisionData[i] = stream.ReadValueS32();
            }

            this.InventoryImages = new int[10]; //Was 5*8/4 - Darklotus
            for (int i = 0; i < 10; i++)
            {
                this.InventoryImages[i] = stream.ReadValueS32();
            }

            // Updated based on BoyC's 010editoer template, looks like some data at the end still isnt parsed - Darklotus
            stream.Close();
        }
Beispiel #24
0
        public Globals(MpqFile file)
        {
            var stream = file.Open();
            this.Header = new Header(stream);
            stream.Position += 8;
            this.ServerData = stream.ReadSerializedData<GlobalServerData>();

            stream.Position += 4;
            this.I0 = stream.ReadValueS32(); //32
            stream.Position += 12;
            this.StartLocationNames = new Dictionary<int, FileFormats.StartLocationName>();
            foreach (var startLocation in stream.ReadSerializedData<StartLocationName>())
                StartLocationNames.Add(startLocation.I0, startLocation);

            this.F0 = stream.ReadValueF32(); //56
            this.F1 = stream.ReadValueF32(); //60
            this.F2 = stream.ReadValueF32(); //64
            this.F3 = stream.ReadValueF32(); //68

            Colors = new RGBAColor[400]; //72
            for (int i = 0; i < 400; i++)
                Colors[i] = new RGBAColor(stream);

            this.I1 = stream.ReadValueS32(); //1672
            this.F4 = stream.ReadValueF32(); //1676
            this.I2 = stream.ReadValueS32(); //1680
            this.F5 = stream.ReadValueF32(); //1684
            this.F6 = stream.ReadValueF32(); //1688
            this.I3 = stream.ReadValueS32(); //1692
            this.I4 = stream.ReadValueS32(); //1696
            this.F7 = stream.ReadValueF32(); //1700
            this.F8 = stream.ReadValueF32(); //1704
            this.F9 = stream.ReadValueF32(); //1708
            this.I5 = stream.ReadValueS32(); //1712
            this.I6 = new int[4]; //1716
            for (int i = 0; i < 4; i++)
                this.I6[i] = stream.ReadValueS32();
            stream.Position += 4;
            this.BannerParams = new BannerParams(stream); //1736
            this.I7 = stream.ReadValueS32(); //1968
            this.I8 = stream.ReadValueS32(); //1972
            this.I9 = stream.ReadValueS32(); //1976
            this.I10 = stream.ReadValueS32(); //1980
            this.F10 = stream.ReadValueF32(); //1984
            this.F11 = stream.ReadValueF32(); //1988
            this.F12 = stream.ReadValueF32(); //1992
            this.F13 = stream.ReadValueF32(); //1996
            this.F14 = stream.ReadValueF32(); //2000
            this.F15 = stream.ReadValueF32(); //2004
            this.F16 = stream.ReadValueF32(); //2008
            this.F17 = stream.ReadValueF32(); //2012
            stream.Close();
        }
Beispiel #25
0
 public Lore(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.SNO = stream.ReadValueS32();
     this.i0 = stream.ReadValueS32();
     this.i1 = stream.ReadValueS32();
     this.i2 = stream.ReadValueS32();
     this.snoConversation = stream.ReadValueS32();
     this.i3 = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #26
0
 public Lore(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.Category = (LoreCategory)stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.I2 = stream.ReadValueS32();
     this.SNOConversation = stream.ReadValueS32();
     this.I3 = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #27
0
 public PhysMesh(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.CollisionMeshCount = stream.ReadValueS32();
     this.CollisionMeshes = stream.ReadSerializedData<CollisionMesh>();
     stream.Position += 12;
     this.S0 = stream.ReadString(256);
     this.S1 = stream.ReadString(256);
     this.I1 = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #28
0
 public Anim(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.SNOAppearance = stream.ReadValueS32();
     this.Permutations = stream.ReadSerializedData<AnimPermutation>();
     this.I2 = stream.ReadValueS32();
     stream.Position += 12;
     this.I3 = stream.ReadValueS32();
     stream.Close();
 }
Beispiel #29
0
 public LevelArea(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.SNOLevelAreaOverrideForGizmoLocs = stream.ReadValueS32();
     this.LocSet = new GizmoLocSet(stream);
     this.I2 = stream.ReadValueS32();
     stream.Position += 12;
     this.SpawnPopulation = stream.ReadSerializedData<LevelAreaSpawnPopulation>();
     stream.Close();
 }
Beispiel #30
0
 public Condition(MpqFile file)
 {
     var stream = file.Open();
     this.Header = new Header(stream);
     this.I0 = stream.ReadValueS32();
     this.I1 = stream.ReadValueS32();
     this.Class = new int[5];
     for (int i = 0; i < 5; i++)
         this.Class[i] = stream.ReadValueS32();
     this.Difficulty = new int[4];
     for (int i = 0; i < 4; i++)
         this.Difficulty[i] = stream.ReadValueS32();
     this.LoreCondition = new LoreSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.LoreCondition[i] = new LoreSubcondition(stream);
     this.QuestCondition = new QuestSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.QuestCondition[i] = new QuestSubcondition(stream);
     this.ItemCondition = new ItemSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.ItemCondition[i] = new ItemSubcondition(stream);
     this.I4 = stream.ReadValueS32(); //176
     this.I5 = stream.ReadValueS32();
     this.I6 = stream.ReadValueS32();
     this.I7 = stream.ReadValueS32();
     stream.Position += 4;
     this.I8 = stream.ReadValueS32();
     this.I9 = stream.ReadValueS32();
     this.I10 = stream.ReadValueS32();
     this.I11 = stream.ReadValueS32();
     this.SNOCurrentWorld = stream.ReadValueS32();
     this.SNOCurrentLevelArea = stream.ReadValueS32();
     this.SNOQuestRange = stream.ReadValueS32();
     this.FollowerCondition = new FollowerSubcondition(stream);
     this.LabelCondition = new LabelSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.LabelCondition[i] = new LabelSubcondition(stream);
     this.SkillCondition = new SkillSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.SkillCondition[i] = new SkillSubcondition(stream);
     this.MonsterCondition = new MonsterSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.MonsterCondition[i] = new MonsterSubcondition(stream);
     this.GameFlagCondition = new GameFlagSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.GameFlagCondition[i] = new GameFlagSubcondition(stream);
     this.PlayerFlagCondition = new PlayerFlagSubcondition[3];
     for (int i = 0; i < 3; i++)
         this.PlayerFlagCondition[i] = new PlayerFlagSubcondition(stream);
     stream.Close();
 }
Beispiel #31
0
        public Scene(MpqFile file)
        {
            var stream = file.Open();

            long pos = 0; // x
            DEADBEEF = stream.ReadInt32();
            snoType = stream.ReadInt32();
            unknown1 = stream.ReadInt32();
            unknown2 = stream.ReadInt32();
            SceneSNO = stream.ReadInt32();
            unknown3 = stream.ReadInt32();
            unknown4 = stream.ReadInt32();
            i0 = stream.ReadInt32();
            aabbBounds = new AABB(stream);
            aabbMarkerSetBounds = new AABB(stream);

            //load NavMeshDef
            NavMesh = new NavMeshDef(stream);
            // end navmeshdef
            var serExclusions = new SerializeData(stream);
            stream.Position += 56;
            var serInclusions = new SerializeData(stream);
            stream.Position += 56;

            //MarkerSet Time
            var serMarkerSets = new SerializeData(stream);
            pos = stream.Position;
            stream.Position = serMarkerSets.Offset + 16;
            MarkerSets = new int[serMarkerSets.Size/4];
            for (int i = 0; i < serMarkerSets.Size/4; i++)
            {
                MarkerSets[i] = stream.ReadInt32();
            }
            stream.Position = pos + 56;

            //TODO - parse LookLink /dark
            LookLink = new char[64];
            for (int i = 0; i < 64; i++)
            {
                LookLink[i] = (char) stream.ReadByte();
            }

            var sermsgTriggeredEvents = new SerializeData(stream);
            int i1 = stream.ReadInt32();
            stream.Position += 12;

            //navzonedef
            NavZone = new NavZoneDef(stream);

            stream.Close();
        }
Beispiel #32
0
        /// <summary>Parses the listfile if it has not already been done.</summary>
        /// <remarks>
        /// Once the list file has been parsed, calls this function will just do nothing.
        /// The list file will always be parsed by default, but you can override this behavior using an appropriate constructor.
        /// Please note that parsing the list file can take some time, and is not required if you already know the filenames.
        /// Also, this operation is irreversible. Once the filenames are present in memory, the only way to free the memory is to close the archive.
        /// </remarks>
        public void ParseListFile()
        {
            if (listFileParsed)
            {
                return;
            }

            using (var listFileReader = new StreamReader(listFile.Open()))
            {
                string line;

                while ((line = listFileReader.ReadLine()) != null)
                {
                    TryFilename(line, true);
                }
                listFileParsed = true;
            }
        }