Esempio n. 1
0
 public static void LoadSpawns(bool force)
 {
     NPCMgr.Loading = true;
     try
     {
         NPCMgr.OnlyLoadSpawns(force);
         NPCMgr.LoadWaypoints(force);
         if (!ServerApp <WCell.RealmServer.RealmServer> .Instance.IsRunning)
         {
             return;
         }
         for (MapId mapId = MapId.Silaris; mapId < MapId.End; ++mapId)
         {
             Map map = WCell.RealmServer.Global.World.GetNonInstancedMap(mapId);
             if (map != null && map.NPCsSpawned)
             {
                 List <NPCSpawnPoolTemplate> poolTemplatesByMap = NPCMgr.GetSpawnPoolTemplatesByMap(mapId);
                 if (poolTemplatesByMap != null)
                 {
                     foreach (NPCSpawnPoolTemplate spawnPoolTemplate in poolTemplatesByMap)
                     {
                         if (spawnPoolTemplate.AutoSpawns)
                         {
                             NPCSpawnPoolTemplate p = spawnPoolTemplate;
                             map.ExecuteInContext((Action)(() => map.AddNPCSpawnPoolNow(p)));
                         }
                     }
                 }
             }
         }
     }
     finally
     {
         NPCMgr.Loading = false;
     }
 }