Esempio n. 1
0
 public virtual IEnumerable <PlayerMobile> GetQueued(PvPTeam team)
 {
     foreach (var kvp in Queue.Where(kvp => kvp.Value == team))
     {
         yield return(kvp.Key);
     }
 }
Esempio n. 2
0
 public virtual void TeamEject(PvPTeam team)
 {
     if (team != null && !team.Deleted)
     {
         team.ForEachMember(member => team.RemoveMember(member, true));
     }
 }
Esempio n. 3
0
 public void ResetStatistics(PvPTeam t)
 {
     if (t != null)
     {
         t.Statistics.Clear();
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 private void TransferStatistics(PvPTeam t)
 {
     if (t != null)
     {
         t.Statistics.ForEachReverse(o => TransferStatistics(o.Key, o.Value));
     }
 }
Esempio n. 6
0
        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);
     }
 }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
        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));
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 public virtual void TeamRespawn(PvPTeam team)
 {
     if (team != null && !team.Deleted)
     {
         team.ForEachMember(team.Respawn);
     }
 }
Esempio n. 12
0
 public void PlaySound(PvPTeam t, int soundID)
 {
     if (Options.Sounds.Enabled && t != null && !t.Deleted && soundID > 0)
     {
         t.PlaySound(soundID);
     }
 }
Esempio n. 13
0
 public virtual void TeleportToHomeBase(PvPTeam team, PlayerMobile pm)
 {
     if (pm != null && !pm.Deleted && team != null && !team.Deleted)
     {
         Teleport(pm, team.HomeBase, Options.Locations.Map);
     }
 }
Esempio n. 14
0
 public void ResetTeam(PvPTeam team)
 {
     if (team != null && !team.Deleted)
     {
         team.Reset();
     }
 }
Esempio n. 15
0
 public virtual void RevokeTeamPoints(PvPTeam team)
 {
     if (team != null)
     {
         team.ForEachMember(pm => UpdateStatistics(team, pm, o => o.PointsLost += GetAwardPoints(team, pm)));
     }
 }
Esempio n. 16
0
 public static void InvokeQueueUpdate(PvPBattle battle, PvPTeam team, PlayerMobile m)
 {
     if (OnQueueUpdate != null)
     {
         OnQueueUpdate(battle, team, m);
     }
 }
Esempio n. 17
0
 public virtual void AwardTeamPoints(PvPTeam team, int points)
 {
     if (team != null && points > 0)
     {
         team.ForEachMember(pm => UpdateStatistics(team, pm, o => o.PointsGained += points));
     }
 }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        public double ComputeScorePotential(PvPTeam t)
        {
            double min = 0, max = 0, total = 0;

            ComputeScore(t, ref min, ref max, ref total);

            return(total);
        }
Esempio n. 20
0
        public virtual double GetAssignPriority(PvPTeam team)
        {
            double weight;

            CalculateAssignPriority(team, out weight);

            return(weight);
        }
Esempio n. 21
0
        public virtual string GetStatus(PvPTeam team)
        {
            if (!Enabled || Team.IsEmpty)
            {
                return(String.Empty);
            }

            return(Team.GetStatus(team));
        }
Esempio n. 22
0
        public virtual double ComputeScore(PvPTeam team)
        {
            if (!Enabled || Team.IsEmpty)
            {
                return(0);
            }

            return(Team.ComputeScore(team));
        }
Esempio n. 23
0
        public virtual int GetAwardPoints(PvPTeam team, PlayerMobile pm)
        {
            if (!IsRunning || team == null || team.Deleted || (pm != null && !team.IsMember(pm)))
            {
                return(0);
            }

            return(PointsBase);
        }
Esempio n. 24
0
        protected double GetMissionsScore(PvPTeam team)
        {
            if (team != null)
            {
                return(team.GetMissionsScore());
            }

            return(0);
        }
Esempio n. 25
0
        public virtual bool Completed(PvPTeam team)
        {
            if (!Enabled || Team.IsEmpty)
            {
                return(false);
            }

            return(Team.Completed(team));
        }
Esempio n. 26
0
 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));
     }
 }
Esempio n. 27
0
        public virtual void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm)
        {
            team.Broadcast("{0} has joined the battle.", pm.RawName);

            if (UseTeamColors)
            {
                pm.SolidHueOverride = team.Color;
            }
        }
Esempio n. 28
0
        public bool RemoveTeam(PvPTeam team)
        {
            if (ContainsTeam(team) && Teams.Remove(team))
            {
                OnTeamRemoved(team);
                return(true);
            }

            return(false);
        }
Esempio n. 29
0
        public virtual void TeamWinEject(PvPTeam team)
        {
            if (team == null || team.Deleted)
            {
                return;
            }

            OnTeamWin(team);
            team.ForEachMember(pm => team.RemoveMember(pm, true));
        }
Esempio n. 30
0
        public virtual void TeamLoseEject(PvPTeam team)
        {
            if (team == null || team.Deleted)
            {
                return;
            }

            OnTeamLose(team);
            team.ForEachMember(member => team.RemoveMember(member, true));
        }