Пример #1
0
 public void Parse(GameBitBuffer buffer)
 {
     Scale = buffer.ReadFloat32();
     Transform = new PRTransform();
     Transform.Parse(buffer);
     WorldID = buffer.ReadUInt(32);
 }
Пример #2
0
 public void Parse(GameBitBuffer buffer)
 {
     Scale     = buffer.ReadFloat32();
     Transform = new PRTransform();
     Transform.Parse(buffer);
     WorldID = buffer.ReadUInt(32);
 }
Пример #3
0
 public MapRevealSceneMessage(string[] data2, int f3)
 {
     Id       = 0x0044;
     ChunkID  = int.Parse(data2[0]);
     snoScene = int.Parse(data2[1]);
     Field2   = new PRTransform()
     {
         Field0 = new Quaternion()
         {
             Amount = float.Parse(data2[5], System.Globalization.CultureInfo.InvariantCulture),
             Axis   = new Vector3D()
             {
                 X = float.Parse(data2[2], System.Globalization.CultureInfo.InvariantCulture),
                 Y = float.Parse(data2[3], System.Globalization.CultureInfo.InvariantCulture),
                 Z = float.Parse(data2[4], System.Globalization.CultureInfo.InvariantCulture),
             },
         },
         ReferencePoint = new Vector3D()
         {
             X = float.Parse(data2[6], System.Globalization.CultureInfo.InvariantCulture),
             Y = float.Parse(data2[7], System.Globalization.CultureInfo.InvariantCulture),
             Z = float.Parse(data2[8], System.Globalization.CultureInfo.InvariantCulture),
         },
     };
     Field3            = f3;//int.Parse(data2[9]),
     MiniMapVisibility = int.Parse(data2[10]);
 }
Пример #4
0
        /// <summary>
        /// Main spawn method
        /// </summary>
        public void Spawn()
        {
            if (this.ActorToSpawnSNO == null)
            {
                // Logger.Debug("Triggered spawner with no ActorToSpawnSNO found.");
                //Try revealing this
                foreach (var player in this.World.Players.Values)
                {
                    base.Reveal(player);
                }
                return;
            }
            var location = new PRTransform()
            {
                Quaternion = new Quaternion
                {
                    W        = this.RotationW,
                    Vector3D = this.RotationAxis
                },
                Vector3D = this.Position
            };

            NullD.Core.GS.Generators.WorldGenerator.loadActor(ActorToSpawnSNO, location, this.World, ((NullD.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap);

            //once target spawned this can be destroyed
            this.Destroy();
        }
Пример #5
0
 public override void Parse(GameBitBuffer buffer)
 {
     ChunkID = buffer.ReadUInt(32);
     SceneSNO = buffer.ReadInt(32);
     Transform = new PRTransform();
     Transform.Parse(buffer);
     WorldID = buffer.ReadUInt(32);
     MiniMapVisibility = (SceneMiniMapVisibility)buffer.ReadInt(3);
 }
Пример #6
0
 public override void Parse(GameBitBuffer buffer)
 {
     ChunkID  = buffer.ReadInt(32);
     snoScene = buffer.ReadInt(32);
     Field2   = new PRTransform();
     Field2.Parse(buffer);
     Field3            = buffer.ReadInt(32);
     MiniMapVisibility = buffer.ReadInt(3);
 }
Пример #7
0
 public override void Parse(GameBitBuffer buffer)
 {
     ChunkID   = buffer.ReadUInt(32);
     SceneSNO  = buffer.ReadInt(32);
     Transform = new PRTransform();
     Transform.Parse(buffer);
     WorldID           = buffer.ReadUInt(32);
     MiniMapVisibility = buffer.ReadBool();;
 }
Пример #8
0
 public override void Parse(GameBitBuffer buffer)
 {
     WorldID = buffer.ReadUInt(32);
     SceneSpec = new SceneSpecification();
     SceneSpec.Parse(buffer);
     ChunkID = buffer.ReadUInt(32);
     SceneSNO = buffer.ReadInt(32);
     Transform = new PRTransform();
     Transform.Parse(buffer);
     ParentChunkID = buffer.ReadUInt(32);
     SceneGroupSNO = buffer.ReadInt(32);
     arAppliedLabels = new int /* gbid */[buffer.ReadInt(9)];
     for (int i = 0; i < arAppliedLabels.Length; i++) arAppliedLabels[i] = buffer.ReadInt(32);
 }
Пример #9
0
        //TODO: Move this out as loading actors can happen even after world was generated
        public static uint loadActor(SNOHandle actorHandle, PRTransform location, World world, TagMap tagMap)
        {
            var actor = Mooege.Core.GS.Actors.ActorFactory.Create(world, actorHandle.Id, tagMap);

            if (actor == null)
            {
                if (actorHandle.Id != -1)
                    Logger.Warn("ActorFactory did not load actor {0}", actorHandle);
                return 0;
            }

            actor.RotationW = location.Quaternion.W;
            actor.RotationAxis = location.Quaternion.Vector3D;
            actor.EnterWorld(location.Vector3D);
            return actor.DynamicID;
        }
Пример #10
0
        private static void loadActor(SNOHandle actorHandle, PRTransform location, World world, TagMap tagMap)
        {
            var actor = Mooege.Core.GS.Actors.ActorFactory.Create(world, actorHandle.Id, tagMap);

            if (actor == null)
            {
                if (actorHandle.Id != -1)
                {
                    Logger.Warn("ActorFactory did not load actor {0}", actorHandle);
                }
                return;
            }

            actor.FacingAngle  = location.Quaternion.W;
            actor.RotationAxis = location.Quaternion.Vector3D;
            actor.EnterWorld(location.Vector3D);
        }
Пример #11
0
 public override void Parse(GameBitBuffer buffer)
 {
     WorldID   = buffer.ReadUInt(32);
     SceneSpec = new SceneSpecification();
     SceneSpec.Parse(buffer);
     ChunkID   = buffer.ReadUInt(32);
     SceneSNO  = buffer.ReadInt(32);
     Transform = new PRTransform();
     Transform.Parse(buffer);
     ParentChunkID   = buffer.ReadUInt(32);
     SceneGroupSNO   = buffer.ReadInt(32);
     arAppliedLabels = new int /* gbid */[buffer.ReadInt(9)];
     for (int i = 0; i < arAppliedLabels.Length; i++)
     {
         arAppliedLabels[i] = buffer.ReadInt(32);
     }
 }
Пример #12
0
        private bool LaunchWave(List <Vector3D> Coordinates, Map.World world, Int32 SnoId)
        {
            var counter          = 0;
            var monsterSNOHandle = new Common.Types.SNO.SNOHandle(SnoId);
            var monsterActor     = monsterSNOHandle.Target as Actor;

            foreach (Vector3D coords in Coordinates)
            {
                Parallel.ForEach(world.Players, player => //Threading because many spawns at once with out Parallel freezes D3.
                {
                    var PRTransform = new PRTransform()
                    {
                        Quaternion = new Quaternion()
                        {
                            W        = 0.590017f,
                            Vector3D = new Vector3D(0, 0, 0)
                        },
                        Vector3D = Coordinates[counter]
                    };

                    //Load the actor here.
                    var actor = WorldGenerator.loadActor(monsterSNOHandle, PRTransform, world, monsterActor.TagMap);
                    monstersAlive.Add(actor);
                    counter++;

                    //If Revealed play animation.
                    world.BroadcastIfRevealed(new PlayAnimationMessage
                    {
                        ActorID = actor,
                        Field1  = 9,
                        Field2  = 0,
                        tAnim   = new Net.GS.Message.Fields.PlayAnimationMessageSpec[]
                        {
                            new Net.GS.Message.Fields.PlayAnimationMessageSpec()
                            {
                                Duration         = 0x00000048,
                                AnimationSNO     = 0x00029A08,
                                PermutationIndex = 0x00000000,
                                Speed            = 1f
                            }
                        }
                    }, player.Value);
                });
            }
            return(true);
        }
Пример #13
0
        /// <summary>
        /// Main spawn method
        /// </summary>
        public void Spawn()
        {
            if (this.ActorToSpawnSNO == null)
            {
                if (this.OnActorSpawnedScript != null)
                {
                    this.World.Game.Scripts[OnActorSpawnedScript.Id].Execute();
                }
                Logger.Debug("Triggered spawner with no ActorToSpawnSNO or Script found.");
                //Try revealing this
                foreach (var player in this.World.Players.Values)
                {
                    base.Reveal(player);
                }
                return;
            }
            var location = new PRTransform()
            {
                Quaternion = new Quaternion
                {
                    W        = this.RotationW,
                    Vector3D = this.RotationAxis
                },
                Vector3D = this.Position
            };

            //TODO: Verify if groups need to really be added to target.
            //HACK
            if (Group1Hash != -1 && !((Mooege.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap.ContainsKey(MarkerKeys.Group1Hash))
            {
                ((Mooege.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap.Add(MarkerKeys.Group1Hash, new TagMapEntry(MarkerKeys.Group1Hash.ID, Group1Hash, 5));
            }
            if (Group2Hash != -1 && !((Mooege.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap.ContainsKey(MarkerKeys.Group2Hash))
            {
                ((Mooege.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap.Add(MarkerKeys.Group2Hash, new TagMapEntry(MarkerKeys.Group2Hash.ID, Group2Hash, 5));
            }
            Mooege.Core.GS.Generators.WorldGenerator.loadActor(ActorToSpawnSNO, location, this.World, ((Mooege.Common.MPQ.FileFormats.Actor)ActorToSpawnSNO.Target).TagMap);

            //once target spawned this can be destroyed
            this.Destroy();
        }
Пример #14
0
		   public Marker(MpqFileStream stream)
		   {
			   byte[] buf = new byte[128];
			   stream.Read(buf, 0, 128); Name = Encoding.ASCII.GetString(buf);
			   i0 = stream.ReadInt32();
			   PRTransform = new PRTransform(stream);
			   SNOName = new SNOName(stream);
			   serTagMap = new SerializeData(stream);
			   TagMap = stream.ReadInt32();
			   i1 = stream.ReadInt32();
			   i2 = stream.ReadInt32();
			   serMarkerLinks = new SerializeData(stream);
			   stream.Position += (3 * 4);
			   long x = stream.Position;
			   
			   if (serTagMap.Size > 0)
			   {
				   stream.Position = serTagMap.Offset + 16;
				   TM = new TagMap(stream);

			   }
			   stream.Position = x;
		   }
Пример #15
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = new SceneSpecification();
     Field1.Parse(buffer);
     Field2 = buffer.ReadInt(32);
     snoScene = buffer.ReadInt(32);
     Field4 = new PRTransform();
     Field4.Parse(buffer);
     Field5 = buffer.ReadInt(32);
     snoSceneGroup = buffer.ReadInt(32);
     arAppliedLabels = new int[buffer.ReadInt(9)];
     for(int i = 0;i < _arAppliedLabels.Length;i++) _arAppliedLabels[i] = buffer.ReadInt(32);
 }
Пример #16
0
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadFloat32();
     Field1 = new PRTransform();
     Field1.Parse(buffer);
     Field2 = buffer.ReadInt(32);
 }
Пример #17
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     snoScene = buffer.ReadInt(32);
     Field2 = new PRTransform();
     Field2.Parse(buffer);
     Field3 = buffer.ReadInt(32);
     Field4 = buffer.ReadBool();
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadCharArray(64);
     Field1 = buffer.ReadInt(32);
     Field2 = buffer.ReadInt(32);
     Field3 = buffer.ReadInt(32);
     Field4 = buffer.ReadInt(32);
     Field5 = new PRTransform();
     Field5.Parse(buffer);
     Field6 = new Vector3D();
     Field6.Parse(buffer);
     Field7 = new PRTransform();
     Field7.Parse(buffer);
     Field8 = new PRTransform();
     Field8.Parse(buffer);
     Field9 = buffer.ReadFloat32();
     Field10 = buffer.ReadFloat32();
     Field11 = buffer.ReadFloat32();
     Field12 = buffer.ReadFloat32();
     Field13 = buffer.ReadFloat32();
     Field14 = buffer.ReadFloat32();
     Field15 = buffer.ReadFloat32();
     Field16 = buffer.ReadFloat32();
     Field17 = buffer.ReadFloat32();
     Field18 = buffer.ReadCharArray(64);
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadCharArray(64);
     Field1 = buffer.ReadInt(32);
     Field2 = new PRTransform();
     Field2.Parse(buffer);
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadCharArray(128);
     Field1 = buffer.ReadInt(32);
     Field2 = new PRTransform();
     Field2.Parse(buffer);
     Field3 = new SNOName();
     Field3.Parse(buffer);
     serTagMap = new SerializeData();
     serTagMap.Parse(buffer);
     hTagMap = new DT_TAGMAP();
     hTagMap.Parse(buffer);
     Field6 = buffer.ReadInt(32);
     serMarkerLinks = new SerializeData();
     serMarkerLinks.Parse(buffer);
     Field8 = new DT_VARIABLEARRAY();
     Field8.Parse(buffer);
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new PRTransform();
     Field0.Parse(buffer);
     Field1 = new Vector3D();
     Field1.Parse(buffer);
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new RequiredMessageHeader();
     Field0.Parse(buffer);
     Field1 = buffer.ReadInt(32);
     Field2 = new SceneSpecification();
     Field2.Parse(buffer);
     Field3 = buffer.ReadInt(32);
     snoScene = buffer.ReadInt(32);
     Field5 = new PRTransform();
     Field5.Parse(buffer);
     Field6 = buffer.ReadInt(32);
     snoSceneGroup = buffer.ReadInt(32);
     arAppliedLabels = new int[buffer.ReadInt(9)];
     for(int i = 0;i < _arAppliedLabels.Length;i++) _arAppliedLabels[i] = buffer.ReadInt(32);
 }
Пример #23
0
        public RevealSceneMessage(string[] data, int f0)
        {
            Id        = 0x0034;
            WorldID   = f0;//0x772E0000; //int.Parse(data[0]),
            SceneSpec = new SceneSpecification()
            {
                Field0 = int.Parse(data[1]),
                Field1 = new IVector2D()
                {
                    Field0 = int.Parse(data[2]),
                    Field1 = int.Parse(data[3]),
                },
                arSnoLevelAreas = new int[4] {
                    int.Parse(data[4]), int.Parse(data[5]), int.Parse(data[6]), int.Parse(data[7]),
                },
                snoPrevWorld     = int.Parse(data[8]),
                Field4           = int.Parse(data[9]),
                snoPrevLevelArea = int.Parse(data[10]),
                snoNextWorld     = int.Parse(data[11]),
                Field7           = int.Parse(data[12]),
                snoNextLevelArea = int.Parse(data[13]),
                snoMusic         = int.Parse(data[14]),
                snoCombatMusic   = int.Parse(data[15]),
                snoAmbient       = int.Parse(data[16]),
                snoReverb        = int.Parse(data[17]),
                snoWeather       = int.Parse(data[18]),
                snoPresetWorld   = int.Parse(data[19]),
                Field15          = int.Parse(data[20]),
                Field16          = int.Parse(data[21]),
                Field17          = int.Parse(data[22]),
                Field18          = int.Parse(data[23]),
                tCachedValues    = new SceneCachedValues()
                {
                    Field0 = int.Parse(data[24]),
                    Field1 = int.Parse(data[25]),
                    Field2 = int.Parse(data[26]),
                    Field3 = new AABB()
                    {
                        Field0 = new Vector3D()
                        {
                            X = float.Parse(data[27], System.Globalization.CultureInfo.InvariantCulture),
                            Y = float.Parse(data[28], System.Globalization.CultureInfo.InvariantCulture),
                            Z = float.Parse(data[29], System.Globalization.CultureInfo.InvariantCulture),
                        },
                        Field1 = new Vector3D()
                        {
                            X = float.Parse(data[30], System.Globalization.CultureInfo.InvariantCulture),
                            Y = float.Parse(data[31], System.Globalization.CultureInfo.InvariantCulture),
                            Z = float.Parse(data[32], System.Globalization.CultureInfo.InvariantCulture),
                        },
                    },
                    Field4 = new AABB()
                    {
                        Field0 = new Vector3D()
                        {
                            X = float.Parse(data[33], System.Globalization.CultureInfo.InvariantCulture),
                            Y = float.Parse(data[34], System.Globalization.CultureInfo.InvariantCulture),
                            Z = float.Parse(data[35], System.Globalization.CultureInfo.InvariantCulture),
                        },
                        Field1 = new Vector3D()
                        {
                            X = float.Parse(data[36], System.Globalization.CultureInfo.InvariantCulture),
                            Y = float.Parse(data[37], System.Globalization.CultureInfo.InvariantCulture),
                            Z = float.Parse(data[38], System.Globalization.CultureInfo.InvariantCulture),
                        },
                    },
                    Field5 = new int[4] {
                        int.Parse(data[39]), int.Parse(data[40]), int.Parse(data[41]), int.Parse(data[42]),
                    },
                    Field6 = int.Parse(data[43]),
                },
            };
            ChunkID  = int.Parse(data[44]);
            snoScene = int.Parse(data[45]);
            Position = new PRTransform()
            {
                Field0 = new Quaternion()
                {
                    Amount = float.Parse(data[49], System.Globalization.CultureInfo.InvariantCulture),
                    Axis   = new Vector3D()
                    {
                        X = float.Parse(data[46], System.Globalization.CultureInfo.InvariantCulture),
                        Y = float.Parse(data[47], System.Globalization.CultureInfo.InvariantCulture),
                        Z = float.Parse(data[48], System.Globalization.CultureInfo.InvariantCulture),
                    },
                },
                ReferencePoint = new Vector3D()
                {
                    X = float.Parse(data[50], System.Globalization.CultureInfo.InvariantCulture),
                    Y = float.Parse(data[51], System.Globalization.CultureInfo.InvariantCulture),
                    Z = float.Parse(data[52], System.Globalization.CultureInfo.InvariantCulture),
                },
            };

            ParentChunkID   = int.Parse(data[53]);
            snoSceneGroup   = int.Parse(data[54]);
            arAppliedLabels = new int[0];
        }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new RequiredMessageHeader();
     Field0.Parse(buffer);
     Field1 = buffer.ReadInt(32);
     snoScene = buffer.ReadInt(32);
     Field3 = new PRTransform();
     Field3.Parse(buffer);
     Field4 = buffer.ReadInt(32);
     Field5 = buffer.ReadBool();
 }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new RequiredMessageHeader();
     Field0.Parse(buffer);
     Field1 = new PRTransform();
     Field1.Parse(buffer);
 }
Пример #26
0
        /// <summary>
        /// Loads content for level areas. Call this after scenes have been generated and after scenes have their GizmoLocations
        /// set (this is done in Scene.LoadActors right now)
        /// </summary>
        /// <param name="levelAreas">Dictionary that for every level area has the scenes it consists of</param>
        /// <param name="world">The world to which to add loaded actors</param>
        private static void loadLevelAreas(Dictionary <int, List <Scene> > levelAreas, World world)
        {
            /// Each Scene has one to four level areas assigned to it. I dont know if that means
            /// the scene belongs to both level areas or if the scene is split
            /// Scenes marker tags have generic GizmoLocationA to Z that are used
            /// to provide random spawning possibilities.
            /// For each of these 26 LocationGroups, the LevelArea has a entry in its SpawnType array that defines
            /// what type of actor/encounter/adventure could spawn there
            ///
            /// It could for example define, that for a level area X, out of the four spawning options
            /// two are randomly picked and have barrels placed there

            // Create an array of mobs, used with the loadActor in the load monster area loop
            // Each monster are created in Mooege.Core.GS.Actors.Implementations.Monsters
            // By Poluxxx
            //int[] aSNO = new int[] {
            //       // 6652      // Zombie
            //         6443      // Ravenous
            //        //, 136943    // Ghost
            //};
            Dictionary <PRTransform, Mooege.Common.MPQ.FileFormats.Actor> dict = new Dictionary <PRTransform, Mooege.Common.MPQ.FileFormats.Actor>();

            foreach (int la in levelAreas.Keys)
            {
                SNOHandle levelAreaHandle = new SNOHandle(SNOGroup.LevelArea, la);
                if (!levelAreaHandle.IsValid)
                {
                    Logger.Warn("Level area {0} does not exist", la);
                    continue;
                }
                var levelArea = levelAreaHandle.Target as LevelArea;

                for (int i = 0; i < 26; i++)
                {
                    // Merge the gizmo starting locations from all scenes and
                    // their subscenes into a single list for the whole level area
                    List <PRTransform> gizmoLocations = new List <PRTransform>();
                    foreach (var scene in levelAreas[la])
                    {
                        if (scene.GizmoSpawningLocations[i] != null)
                        {
                            gizmoLocations.AddRange(scene.GizmoSpawningLocations[i]);
                        }
                        foreach (Scene subScene in scene.Subscenes)
                        {
                            if (subScene.GizmoSpawningLocations[i] != null)
                            {
                                gizmoLocations.AddRange(subScene.GizmoSpawningLocations[i]);
                            }
                        }
                    }

                    // Load all spawns that are defined for that location group
                    foreach (GizmoLocSpawnEntry spawnEntry in levelArea.LocSet.SpawnType[i].SpawnEntry)
                    {
                        // Get a random amount of spawns ...
                        int amount = RandomHelper.Next(spawnEntry.Max, spawnEntry.Max);
                        if (amount > gizmoLocations.Count)
                        {
                            Logger.Trace("Breaking after spawnEntry {0} for LevelArea {1} because there are less locations ({2}) than spawn amount ({3}, {4} min)", spawnEntry.SNOHandle, levelAreaHandle, gizmoLocations.Count, amount, spawnEntry.Min);
                            break;
                        }

                        Logger.Trace("Spawning {0} ({3} - {4} {1} in {2}", amount, spawnEntry.SNOHandle, levelAreaHandle, spawnEntry.Min, spawnEntry.Max);

                        // ...and place each one on a random position within the location group
                        for (; amount > 0; amount--)
                        {
                            int location = RandomHelper.Next(gizmoLocations.Count - 1);

                            switch (spawnEntry.SNOHandle.Group)
                            {
                            case SNOGroup.Actor:
                                //TODO: Why to pass tagmap here and not load it inside Actor
                                loadActor(spawnEntry.SNOHandle, gizmoLocations[location], world, ((Mooege.Common.MPQ.FileFormats.Actor)spawnEntry.SNOHandle.Target).TagMap);
                                break;

                            case SNOGroup.Encounter:
                                var encounter   = spawnEntry.SNOHandle.Target as Encounter;
                                var actor       = RandomHelper.RandomItem(encounter.Spawnoptions, x => x.Probability);
                                var actorHandle = new SNOHandle(actor.SNOSpawn);
                                loadActor(actorHandle, gizmoLocations[location], world, ((Mooege.Common.MPQ.FileFormats.Actor)actorHandle.Target).TagMap);
                                break;

                            case SNOGroup.Adventure:
                                // Adventure are basically made up of a markerSet that has relative PRTransforms
                                // it has some other fields that are always 0 and a reference to a symbol actor
                                // no idea what they are used for - farmy

                                var adventure = spawnEntry.SNOHandle.Target as Adventure;
                                var markerSet = new SNOHandle(adventure.SNOMarkerSet).Target as MarkerSet;

                                foreach (var marker in markerSet.Markers)
                                {
                                    // relative marker set coordinates to absolute world coordinates
                                    var absolutePRTransform = new PRTransform
                                    {
                                        Vector3D   = marker.PRTransform.Vector3D + gizmoLocations[location].Vector3D,
                                        Quaternion = new Quaternion
                                        {
                                            Vector3D = new Vector3D(marker.PRTransform.Quaternion.Vector3D.X, marker.PRTransform.Quaternion.Vector3D.Y, marker.PRTransform.Quaternion.Vector3D.Z),
                                            W        = marker.PRTransform.Quaternion.W
                                        }
                                    };
                                    switch (marker.Type)
                                    {
                                    case MarkerType.Actor:
                                        loadActor(marker.SNOHandle, absolutePRTransform, world, marker.TagMap);
                                        break;

                                    case MarkerType.Encounter:
                                        var encounter2 = marker.SNOHandle.Target as Encounter;
                                        var actor2     = RandomHelper.RandomItem(encounter2.Spawnoptions, x => x.Probability);
                                        loadActor(new SNOHandle(actor2.SNOSpawn), absolutePRTransform, world, marker.TagMap);
                                        break;

                                    default:
                                        Logger.Warn("Unhandled marker type {0} in actor loading", marker.Type);
                                        break;
                                    }
                                }
                                break;

                            default:
                                if (spawnEntry.SNOHandle.Id != -1)
                                {
                                    Logger.Warn("Unknown sno handle in LevelArea spawn entries: {0}", spawnEntry.SNOHandle);
                                }
                                break;
                            }

                            // dont use that location again
                            gizmoLocations.RemoveAt(location);
                        }
                    }
                }

                // Load monsters for level area
                foreach (var scene in levelAreas[la])
                {
                    // HACK: don't spawn monsters in tristram town scenes /mdz
                    if (MPQStorage.Data.Assets[SNOGroup.Scene][scene.SceneSNO.Id].Name.StartsWith("trOut_Tristram_"))
                    {
                        continue;
                    }

                    // a little variety in monsters spawned
                    int[] monsterActors = { 6652, 219725, 5346, 6356, 5393, 434, 4982 };

                    for (int i = 0; i < 100; i++)
                    {
                        if (RandomHelper.NextDouble() > 0.8)
                        {
                            // TODO Load correct spawn population
                            // 2.5 is units per square, TODO: Find out how to calculate units per square. Is it F1 * V0.I1 / SquareCount?
                            int x = RandomHelper.Next(scene.NavMesh.SquaresCountX);
                            int y = RandomHelper.Next(scene.NavMesh.SquaresCountY);

                            if ((scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Flags & Mooege.Common.MPQ.FileFormats.Scene.NavCellFlags.NoSpawn) == 0)
                            {
                                loadActor(
                                    new SNOHandle(monsterActors[RandomHelper.Next(monsterActors.Length)]),
                                    new PRTransform
                                {
                                    Vector3D = new Vector3D
                                    {
                                        X = (float)(x * 2.5 + scene.Position.X),
                                        Y = (float)(y * 2.5 + scene.Position.Y),
                                        Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
                                    },
                                    Quaternion = Quaternion.FacingRotation((float)(RandomHelper.NextDouble() * System.Math.PI * 2))
                                },
                                    world,
                                    new TagMap()
                                    );
                            }
                        }
                    }
                }
            }
        }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new SNOName();
     Field0.Parse(buffer);
     Field1 = new PRTransform();
     Field1.Parse(buffer);
     Field2 = new SceneSpecification();
     Field2.Parse(buffer);
 }