public void FinishPortal() { Status = PortalCompleted ? PortalStatus.Finished : PortalStatus.Failed; Eject(); PortalItem.Delete(); PortalItem2.Delete(); RemoveMobs(); RemoveCrystals(); _CoreTimer.Stop(); ParticipantsScores.Clear(); if (ValidSpawnPoints != null) { ValidSpawnPoints.Clear(); ValidSpawnPoints.TrimExcess(); } Portals.GeneratePortal(); }
public void AddScore(Mobile damager, int amount) { Mobile creditMob = null; if (damager is BaseCreature) { var bc = (BaseCreature)damager; if (bc.ControlMaster is PlayerMobile) { creditMob = bc.ControlMaster; } else if (bc.SummonMaster is PlayerMobile) { creditMob = bc.SummonMaster; } else if (bc.BardMaster is PlayerMobile) { creditMob = bc.BardMaster; } } else if (damager is PlayerMobile) { creditMob = damager; } if (creditMob != null) { PlayerPortalProfile profile = Portals.EnsureProfile(creditMob as PlayerMobile); profile.AddScore(amount, this); if (ParticipantsScores.ContainsKey(creditMob as PlayerMobile)) { ParticipantsScores[creditMob as PlayerMobile] += amount; } else { ParticipantsScores.Add(creditMob as PlayerMobile, amount); } } }