public virtual IEnumerable <PlayerMobile> GetQueued(PvPTeam team) { foreach (var kvp in Queue.Where(kvp => kvp.Value == team)) { yield return(kvp.Key); } }
public virtual void TeamEject(PvPTeam team) { if (team != null && !team.Deleted) { team.ForEachMember(member => team.RemoveMember(member, true)); } }
public void ResetStatistics(PvPTeam t) { if (t != null) { t.Statistics.Clear(); } }
public bool UpdateStatistics(PvPTeam t, PlayerMobile pm, Action <PvPProfileHistoryEntry> update) { if (t == null || t.Deleted || pm == null || update == null) { return(false); } var s = t.GetStatistics(pm); if (s == null) { return(false); } var success = true; VitaNexCore.TryCatch( update, s, x => { AutoPvP.CMOptions.ToConsole(x); success = false; }); if (t.IsMember(pm)) { t.UpdateActivity(pm); } return(success); }
private void TransferStatistics(PvPTeam t) { if (t != null) { t.Statistics.ForEachReverse(o => TransferStatistics(o.Key, o.Value)); } }
public virtual void OnTeamMemberDeath(PvPTeam team, PlayerMobile pm) { LocalBroadcast("{0} has died.", pm.RawName); UpdateStatistics(team, pm, s => ++ s.Deaths); var pk = pm.FindMostRecentDamager(false) as PlayerMobile; if (pk != null && !pk.Deleted) { PvPTeam pkt; if (IsParticipant(pk, out pkt)) { if (KillPoints > 0 && !pk.Account.IsSharedWith(pm.Account)) { RevokePoints(pm, KillPoints); } pm.LastKiller = pk; UpdateStatistics(pkt, pk, s => ++ s.Kills); if (KillPoints > 0 && !pk.Account.IsSharedWith(pm.Account)) { AwardPoints(pk, KillPoints); } } } TeleportToHomeBase(team, pm); }
public virtual void TeleportToSpawnPoint(PvPTeam team, PlayerMobile pm) { if (pm != null && !pm.Deleted && team != null && !team.Deleted && team.IsMember(pm)) { Teleport(pm, team.SpawnPoint, Options.Locations.Map); } }
public virtual void Enqueue(PlayerMobile pm, PvPTeam team = null, bool party = true) { if (pm == null || pm.Deleted) { return; } if (!CanQueue(pm)) { OnQueueReject(pm); return; } if (team != null && team.Deleted) { team = null; } if (!IsQueued(pm)) { Queue.Add(pm, team); OnQueueJoin(pm, team); } else { Queue[pm] = team; OnQueueUpdate(pm, team); } if (party) { EnqueueParty(pm, Party.Get(pm), team); } }
public virtual int CompareTeamRank(PvPTeam a, PvPTeam b) { int result = 0; if (a.CompareNull(b, ref result)) { return(result); } if (a.Deleted && b.Deleted) { return(0); } if (b.Deleted) { return(-1); } if (a.Deleted) { return(1); } int retVal = a.Statistics.TotalKills.CompareTo(b.Statistics.TotalKills); return(retVal < 0 ? 1 : (retVal > 0 ? -1 : retVal)); }
public virtual void TeleportToSpawnPoint(PvPTeam team, PlayerMobile pm) { if (pm == null || pm.Deleted || team == null || team.Deleted || !team.IsMember(pm)) { return; } var p = team.SpawnPoint; if (team.RespawnRangeMin > 0 && team.RespawnRangeMax > 0) { var i = 10; while (--i >= 0) { p = team.SpawnPoint.GetRandomPoint3D(team.RespawnRangeMin, team.RespawnRangeMax); if (Options.Locations.Map.CanSpawnMobile(p)) { break; } } if (i < 0) { p = team.SpawnPoint; } } Teleport(pm, p, Options.Locations.Map); }
public virtual void TeamRespawn(PvPTeam team) { if (team != null && !team.Deleted) { team.ForEachMember(team.Respawn); } }
public void PlaySound(PvPTeam t, int soundID) { if (Options.Sounds.Enabled && t != null && !t.Deleted && soundID > 0) { t.PlaySound(soundID); } }
public virtual void TeleportToHomeBase(PvPTeam team, PlayerMobile pm) { if (pm != null && !pm.Deleted && team != null && !team.Deleted) { Teleport(pm, team.HomeBase, Options.Locations.Map); } }
public void ResetTeam(PvPTeam team) { if (team != null && !team.Deleted) { team.Reset(); } }
public virtual void RevokeTeamPoints(PvPTeam team) { if (team != null) { team.ForEachMember(pm => UpdateStatistics(team, pm, o => o.PointsLost += GetAwardPoints(team, pm))); } }
public static void InvokeQueueUpdate(PvPBattle battle, PvPTeam team, PlayerMobile m) { if (OnQueueUpdate != null) { OnQueueUpdate(battle, team, m); } }
public virtual void AwardTeamPoints(PvPTeam team, int points) { if (team != null && points > 0) { team.ForEachMember(pm => UpdateStatistics(team, pm, o => o.PointsGained += points)); } }
public virtual void OnTeamMemberDeath(PvPTeam team, PlayerMobile pm) { LocalBroadcast("{0} has died.", pm.RawName); EnsureStatistics(pm).Deaths++; /*if (KillPoints > 0) * { * RevokePoints(pm, KillPoints); * }*/ PlayerMobile pk = pm.FindMostRecentDamager(false) as PlayerMobile; if (pk != null && !pk.Deleted && IsParticipant(pk)) { pm.LastKiller = pk; EnsureStatistics(pk).Kills++; if (KillPoints > 0 && pk.IsOnline() && pm.IsOnline() && pk.NetState.Address != pm.NetState.Address) { AwardPoints(pk, KillPoints); } } TeleportToHomeBase(team, pm); }
public double ComputeScorePotential(PvPTeam t) { double min = 0, max = 0, total = 0; ComputeScore(t, ref min, ref max, ref total); return(total); }
public virtual double GetAssignPriority(PvPTeam team) { double weight; CalculateAssignPriority(team, out weight); return(weight); }
public virtual string GetStatus(PvPTeam team) { if (!Enabled || Team.IsEmpty) { return(String.Empty); } return(Team.GetStatus(team)); }
public virtual double ComputeScore(PvPTeam team) { if (!Enabled || Team.IsEmpty) { return(0); } return(Team.ComputeScore(team)); }
public virtual int GetAwardPoints(PvPTeam team, PlayerMobile pm) { if (!IsRunning || team == null || team.Deleted || (pm != null && !team.IsMember(pm))) { return(0); } return(PointsBase); }
protected double GetMissionsScore(PvPTeam team) { if (team != null) { return(team.GetMissionsScore()); } return(0); }
public virtual bool Completed(PvPTeam team) { if (!Enabled || Team.IsEmpty) { return(false); } return(Team.Completed(team)); }
public virtual void EnqueueParty(PlayerMobile pm, Party party, PvPTeam team = null) { if (pm != null && !pm.Deleted && party != null && party.Active && party.Leader == pm) { party.Members.Where(pmi => pmi != null && pmi.Mobile != null && !pmi.Mobile.Deleted && pmi.Mobile != pm) .Select(pmi => (PlayerMobile)pmi.Mobile) .ForEach(m => Enqueue(m, team, false)); } }
public virtual void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm) { team.Broadcast("{0} has joined the battle.", pm.RawName); if (UseTeamColors) { pm.SolidHueOverride = team.Color; } }
public bool RemoveTeam(PvPTeam team) { if (ContainsTeam(team) && Teams.Remove(team)) { OnTeamRemoved(team); return(true); } return(false); }
public virtual void TeamWinEject(PvPTeam team) { if (team == null || team.Deleted) { return; } OnTeamWin(team); team.ForEachMember(pm => team.RemoveMember(pm, true)); }
public virtual void TeamLoseEject(PvPTeam team) { if (team == null || team.Deleted) { return; } OnTeamLose(team); team.ForEachMember(member => team.RemoveMember(member, true)); }