Example #1
0
        private static void DeSpawnEvent(WorldEvent worldEvent)
        {
            foreach (WorldEventNPC npcSpawn in worldEvent.NPCSpawns)
            {
                NPCSpawnEntry spawnEntry = NPCMgr.GetSpawnEntry(npcSpawn.Guid);
                Map           map        = spawnEntry.Map;
                if (map != null)
                {
                    if (npcSpawn.Spawn)
                    {
                        map.RemoveNPCSpawnPool(spawnEntry.PoolTemplate);
                    }
                    else
                    {
                        foreach (SpawnPoint <NPCSpawnPoolTemplate, NPCSpawnEntry, NPC, NPCSpawnPoint, NPCSpawnPool>
                                 spawnPoint in spawnEntry.SpawnPoints.ToArray())
                        {
                            spawnPoint.Respawn();
                        }
                    }
                }
            }

            foreach (WorldEventGameObject goSpawn in worldEvent.GOSpawns)
            {
                GOSpawnEntry spawnEntry = GOMgr.GetSpawnEntry(goSpawn.Guid);
                Map          map        = spawnEntry.Map;
                if (map != null)
                {
                    if (goSpawn.Spawn)
                    {
                        map.RemoveGOSpawnPool(spawnEntry.PoolTemplate);
                    }
                    else
                    {
                        foreach (SpawnPoint <GOSpawnPoolTemplate, GOSpawnEntry, GameObject, GOSpawnPoint, GOSpawnPool>
                                 spawnPoint in spawnEntry.SpawnPoints.ToArray())
                        {
                            spawnPoint.Respawn();
                        }
                    }
                }
            }
        }