public void EndBattle() { EndTimer(); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; } CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(Cooldown); ViceVsVirtueSystem.Instance.OnBattleEnd(); foreach (VvVAltar altar in Altars) { if (!altar.Deleted) { altar.Delete(); } } foreach (VvVTrap trap in Traps) { if (!trap.Deleted) { trap.Delete(); } } foreach (CannonTurret turret in Turrets) { if (!turret.Deleted) { turret.Delete(); } } if (VicePriest != null) { VicePriest.Delete(); VicePriest = null; } if (VirtuePriest != null) { VirtuePriest.Delete(); VirtuePriest = null; } if (Sigil != null) { Sigil.Delete(); Sigil = null; } Guild leader = GetLeader(); foreach (Mobile m in this.Region.GetEnumeratedMobiles()) { Guild g = m.Guild as Guild; if (leader != null && (g == leader || leader.IsAlly(g))) { System.AwardPoints(m, WinSilver + (OppositionCount(g) * 50), message: false); } } SendBattleStatsGump(); System.SendVvVMessage(1154722); // A VvV battle has just concluded. The next battle will begin in less than five minutes! Altars.Clear(); GuildStats.Clear(); KillCooldown.Clear(); Participants.Clear(); Participants.TrimExcess(); Messages.Clear(); Messages.TrimExcess(); Traps.Clear(); Traps.TrimExcess(); Warned.Clear(); Warned.TrimExcess(); Turrets.Clear(); Turrets.TrimExcess(); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; } OnGoing = false; NextSigilSpawn = DateTime.MinValue; LastOccupationCheck = DateTime.MinValue; NextAnnouncement = DateTime.MinValue; StartTime = DateTime.MinValue; NextAltarActivate = DateTime.MinValue; ManaSpikeEndEffects = DateTime.MinValue; NextManaSpike = DateTime.MinValue; }
public void EndBattle() { OnGoing = false; EndTimer(); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; foreach (PlayerMobile pm in Region.GetEnumeratedMobiles().OfType <PlayerMobile>()) { pm.RecheckTownProtection(); } } foreach (VvVAltar altar in Altars) { if (!altar.Deleted) { altar.Delete(); } } foreach (VvVTrap trap in Traps) { if (!trap.Deleted) { trap.Delete(); } } foreach (CannonTurret turret in Turrets) { if (!turret.Deleted) { turret.Delete(); } } if (VicePriest != null) { VicePriest.Delete(); VicePriest = null; } if (VirtuePriest != null) { VirtuePriest.Delete(); VirtuePriest = null; } if (Sigil != null) { Sigil.Delete(); Sigil = null; } TallyStats(); SendBattleStatsGump(); System.SendVvVMessage(1154722); // A VvV battle has just concluded. The next battle will begin in less than five minutes! if (BattleAggression != null) { BattleAggression.Clear(); } ColUtility.Free(Altars); ColUtility.Free(Teams); KillCooldown.Clear(); ColUtility.Free(Messages); ColUtility.Free(Traps); ColUtility.Free(Warned); ColUtility.Free(Turrets); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; } NextSigilSpawn = DateTime.MinValue; LastOccupationCheck = DateTime.MinValue; NextAnnouncement = DateTime.MinValue; StartTime = DateTime.MinValue; NextAltarActivate = DateTime.MinValue; ManaSpikeEndEffects = DateTime.MinValue; NextManaSpike = DateTime.MinValue; CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(Cooldown); Timer.DelayCall(TimeSpan.FromMinutes(Cooldown), () => { System.CheckBattleStatus(); }); }