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 TallyStats() { BattleTeam leader = GetLeader(); List <Guild> added = new List <Guild>(); // Should never happen if (leader.Guild == null) { return; } foreach (Mobile m in this.Region.GetEnumeratedMobiles()) { Guild g = m.Guild as Guild; if (g == null) { continue; } if (leader != null && (leader.Guild == g || leader.Guild.IsAlly(g))) { System.AwardPoints(m, WinSilver + (OppositionCount(g) * 50), message: false); } PlayerMobile pm = m as PlayerMobile; if (pm != null) { BattleTeam team = GetTeam(g); VvVPlayerBattleStats stats = GetPlayerStats(pm); VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(pm); if (entry != null) { entry.Score += team.Score; entry.Points += stats.Silver; entry.Kills += stats.Kills; entry.Deaths += stats.Deaths; entry.Assists += stats.Assists; entry.ReturnedSigils += stats.ReturnedSigils; entry.DisarmedTraps += stats.Disarmed; entry.StolenSigils += stats.Stolen; if (added.Contains(g)) { continue; } else { added.Add(g); } if (!ViceVsVirtueSystem.Instance.GuildStats.ContainsKey(g)) { ViceVsVirtueSystem.Instance.GuildStats[g] = new VvVGuildStats(g); } VvVGuildStats gstats = ViceVsVirtueSystem.Instance.GuildStats[g]; gstats.Kills += team.Kills; gstats.ReturnedSigils += team.ReturnedSigils; gstats.Score += team.Score; } } } ColUtility.Free(added); }