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(); }
public LevelArea(MpqFile file) { if (file.Size == 0 || file.Size == 48) // Fixes crash on A4_dun_DIablo_Arena_Phase3 - DarkLotus { return; } var stream = file.Open(); this.Header = new Header(stream); this.I0 = new int[4]; for (int i = 0; i < 4; i++) { this.I0[i] = stream.ReadValueS32(); } this.I1 = stream.ReadValueS32(); this.SNOLevelAreaOverrideForGizmoLocs = stream.ReadValueS32(); stream.Position += 4; this.LocSet = new GizmoLocSet(stream); this.SpawnPopulationEntries = stream.ReadValueS32(); stream.Position += 12; //mpq reading of spawn populations is disabled because its not working anymore. data is loaded from database instead //this.SpawnPopulation = stream.ReadSerializedData<LevelAreaSpawnPopulation>(); stream.Close(); }
public MarkerSet(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.Markers = stream.ReadSerializedData <Marker>(); stream.Position += (15 * 4); NoSpawns = stream.ReadSerializedData <Circle>(); 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(); this.SpecialIndexCount = stream.ReadValueS32(); this.SpecialIndexList = stream.ReadSerializedShorts(); stream.Close(); }
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(); this.I2 = stream.ReadValueS32(); this.F4 = stream.ReadValueF32(); this.F5 = stream.ReadValueF32(); this.I3 = stream.ReadValueS32(); this.F6 = stream.ReadValueF32(); this.F7 = stream.ReadValueF32(); this.F8 = stream.ReadValueF32(); this.F9 = stream.ReadValueF32(); this.F10 = stream.ReadValueF32(); this.I4 = stream.ReadValueS32(); this.I6 = new int[4]; for (int i = 0; i < 4; i++) { this.I6[i] = stream.ReadValueS32(); } stream.Position += 4; this.BannerParams = new BannerParams(stream); this.I5 = stream.ReadValueS32(); this.I7 = stream.ReadValueS32(); this.I8 = stream.ReadValueS32(); this.I9 = stream.ReadValueS32(); this.F11 = stream.ReadValueF32(); this.F12 = stream.ReadValueF32(); this.F13 = stream.ReadValueF32(); this.F14 = stream.ReadValueF32(); this.F15 = stream.ReadValueF32(); this.F16 = stream.ReadValueF32(); this.F17 = stream.ReadValueF32(); this.F18 = stream.ReadValueF32(); stream.Close(); }
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 this.Exclusions = stream.ReadSerializedInts(); //var exclusions = stream.GetSerializedDataPointer(); stream.Position += (14 * 4); this.Inclusions = stream.ReadSerializedInts(); //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(); }
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(); }
public BossEncounter(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.I0 = stream.ReadValueS32(); this.I1 = stream.ReadValueS32(); this.I2 = stream.ReadValueS32(); this.I3 = stream.ReadValueS32(); this.I4 = stream.ReadValueS32(); this.I5 = stream.ReadValueS32(); this.I6 = stream.ReadValueS32(); this.I7 = stream.ReadValueS32(); this.I8 = stream.ReadValueS32(); this.I9 = stream.ReadValueS32(); this.SNOQuestRange = stream.ReadValueS32(); this.Worlds = new int[4]; for (int i = 0; i < 4; i++) { this.Worlds[i] = stream.ReadValueS32(); } this.Scripts = new int[3]; for (int i = 0; i < 3; i++) { this.Scripts[i] = stream.ReadValueS32(); } stream.Close(); }
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(); }
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(); }
public Act(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.ActQuestInfo = stream.ReadSerializedData <ActQuestInfo>(); stream.Position += 12; this.WayPointInfo = new WaypointInfo[25]; for (int i = 0; i < WayPointInfo.Length; i++) { this.WayPointInfo[i] = new WaypointInfo(stream); } this.ResolvedPortalDestination = new ResolvedPortalDestination(stream); this.ActStartLocOverrides = new ActStartLocOverride[6]; for (int i = 0; i < ActStartLocOverrides.Length; i++) { this.ActStartLocOverrides[i] = new ActStartLocOverride(stream); } stream.Close(); }
public Recipe(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); ItemSpecifierData = new ItemSpecifierData(stream); stream.Close(); }
public ConversationList(MpqFile file) { MpqFileStream stream = file.Open(); this.Header = new Header(stream); stream.Position += (12); ConversationListEntries = stream.ReadSerializedData <ConversationListEntry>(); stream.Close(); }
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(); }
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(); }
} // 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(); }
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(); }
public static byte[] ReadAllBytes(MpqFile file) { UnityEngine.Profiling.Profiler.BeginSample("Mpq.ReadAllBytes"); using (var stream = file.Open()) { byte[] bytes = new byte[file.Size]; stream.Read(bytes, 0, bytes.Length); UnityEngine.Profiling.Profiler.EndSample(); return(bytes); } }
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(); }
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(); this.I2 = stream.ReadValueS32(); this.V0 = new Vector2D(stream); stream.Close(); }
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(); }
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(); }
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.LootDropModifiers = stream.ReadSerializedData <LootDropModifier>(); stream.Close(); Name = file.Name; }
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(); }
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(); }
public EffectGroup(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.I0 = stream.ReadValueS32(); this.EffectItems = stream.ReadSerializedData <EffectItem>(); this.I1 = stream.ReadValueS32(); stream.Position += 4; // pad 1 this.I2 = stream.ReadValueS32(); this.I3 = stream.ReadValueS32(); this.I4 = stream.ReadValueS32(); this.SnoPower = stream.ReadValueS32(); stream.Close(); }
void PlayMusic() { MpqFile file = Mpq.fs.FindFile(@"data\global\music\introedit.wav"); if (file == null) { return; } musicStream = file.Open(); AudioClip clip = Wav.Load("intro music", true, musicStream); var musicObject = new GameObject(); var audioSource = musicObject.AddComponent <AudioSource>(); audioSource.clip = clip; audioSource.loop = true; audioSource.Play(); }
public AnimSet(MpqFile file) { var stream = file.Open(); this.Header = new Header(stream); this.SNOParentAnimSet = stream.ReadValueS32(); TagMapAnimDefault = stream.ReadSerializedItem <TagMap>(); stream.Position += 8; AnimSetTagMaps = new TagMap[19]; for (int i = 0; i < 19; i++) { AnimSetTagMaps[i] = stream.ReadSerializedItem <TagMap>(); stream.Position += 8; } stream.Close(); }
public World(MpqFile file) { if (file.Size == 0) { return; } var stream = file.Open(); this.Header = new Header(stream); this.IsGenerated = (stream.ReadValueS32() != 0); this.Int1 = stream.ReadValueS32(); this.Int2 = stream.ReadValueS32(); //this.DRLGParams = stream.ReadSerializedData<DRLGParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/120) /raist stream.Position += 8; // skips reading of DRLG Pointer stream.Position += (2 * 4); this.SceneParams = stream.ReadSerializedItem <SceneParams>(); // I'm not sure if we can have a list of drlgparams. (then should be calling it with pointer.Size/24) /raist stream.Position += (2 * 4); this.MarkerSets = stream.ReadSerializedInts(); stream.Position += (14 * 4); this.Environment = new Environment(stream); stream.Position += 4; LabelRuleSet = new LabelRuleSet(stream); this.Int4 = stream.ReadValueS32(); stream.Position += 4; this.SceneClusterSet = new SceneClusterSet(stream); for (int i = 0; i < SNONavMeshFunctions.Length; i++) { SNONavMeshFunctions[i] = stream.ReadValueS32(); } stream.Position += 4; Float0 = stream.ReadValueF32(); Int5 = stream.ReadValueS32(); SNOScript = stream.ReadValueS32(); Int6 = stream.ReadValueS32(); stream.Close(); }
private ZoneMap LoadZoneMap(string filename) { MpqFile file = wowFileSystem.FindFile(filename); Stream stream = null; ZoneMap zoneMap; if (file == null) { return(null); } try { stream = file.Open(); zoneMap = new ZoneMap(stream); stream.Close(); #if DEBUG if (zoneMap != null) { Bitmap b = new Bitmap(128, 128); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { b.SetPixel(i, j, Color.FromArgb(zoneMap[i, j] | ~0xFFFFFF)); } } b.Save(Path.GetFileNameWithoutExtension(filename) + ".bmp"); } #endif return(zoneMap); } catch { if (stream != null) { stream.Close(); } return(null); } }
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 += (2 * 4); SerializableDataPointer compiledScriptPointer = stream.GetSerializedDataPointer(); stream.Position += 44; // these bytes are unaccounted for in the xml this.SNOBossEncounter = stream.ReadValueS32(); // reading compiled script, placed it here so i dont have to move the offset around CompiledScript = new byte[compiledScriptPointer.Size]; stream.Position = compiledScriptPointer.Offset + 16; stream.Read(CompiledScript, 0, compiledScriptPointer.Size); stream.Close(); }