public void Initialise() { if (Initialised) { return; } List <SpawnlistContract> spawnsList = _serverService.GetAllSpawns(); spawnsList.ForEach((spawn) => { L2Spawn l2Spawn = new L2Spawn(NpcTable.Instance.GetTemplate(spawn.TemplateId), _idFactory, this) { Location = new SpawnLocation(spawn.LocX, spawn.LocY, spawn.LocZ, spawn.Heading, spawn.RespawnDelay) }; l2Spawn.Spawn(false); Spawns.Add(l2Spawn); }); Log.Info($"Spawned {spawnsList.Count} npcs."); if (_config.GameplayConfig.NpcConfig.Misc.AutoMobRespawn) { RespawnTimerTask = new Timer(); RespawnTimerTask.Elapsed += new ElapsedEventHandler(RespawnTimerTick); RespawnTimerTask.Interval = 2000; RespawnTimerTask.Start(); Log.Info($"Started RespawnTimerTask."); } Initialised = true; }
private void DeRegisterRespawn(L2Spawn spawn) { RespawnDict.Remove(spawn); }
public void RegisterRespawn(L2Spawn spawn) { RespawnDict.Add(spawn, DateTime.Now); }