public override void SendWave() { if (!Waves.ContainsKey(Wave) || WavesLeftTillEnd <= 0) { return; } Waves[Wave].Create(VirtualMap, VWID, Owner.Position, 2000); Wave++; WavesLeftTillEnd--; foreach (var joined in JoinedPlayers.Values) { if (joined.GetGameSession() == null) { continue; } Packet.Builder.LegacyModule(joined.GetGameSession(), "0|A|STD|Wave " + Wave); } LastSentWaveTime = DateTime.Now; }
public virtual void Tick() { try { if (Finished && Rewarded) { foreach (var joined in JoinedPlayers) { MoveOut(joined.Value); } return; } if (PendingPlayers.Count > 0) { foreach (var pendingPlayer in PendingPlayers.Values) { Player removedCharacter = null; if (!pendingPlayer.Controller.Jumping && pendingPlayer.Spacemap != VirtualMap) { PendingPlayers.TryRemove(pendingPlayer.Id, out removedCharacter); continue; } if (pendingPlayer.Spacemap == VirtualMap) { PendingPlayers.TryRemove(pendingPlayer.Id, out removedCharacter); JoinedPlayers.TryAdd(pendingPlayer.Id, pendingPlayer); } } } if (JoinedPlayers.Count == 0) { //TODO CheckOwnerActivity(); return; } if (JoinedPlayers.Count > 0) { CheckPlayersActivity(); } if (CountdownInProcess) { Count(); return; } if (Active) { if (!VirtualMap.Entities.Any(pair => pair.Value is Npc)) { End(); } else { NpcChecker(); } CheckOwnerActivity(); } else if (!CountdownInProcess && DateTime.Now > WaitingPhaseEnd && Waves.ContainsKey(Wave)) { if (JoinedPlayers.Count > 0) { CountdownEnd = DateTime.Now.AddSeconds(30); CountdownInProcess = true; } } if (!Waves.ContainsKey(Wave + 1) && VirtualMap.Entities.Count(x => x.Value is Npc) == 0) { Reward(); } } catch (Exception e) { Console.WriteLine("TICK"); Console.WriteLine(e); new ExceptionLog("low-tick", "", e); } }