Ejemplo n.º 1
0
        public void MicroSync()
        {
            if (Members != null && Idlers != null && Battle != null && Battle.State == PvPBattleState.Running)
            {
                var now = DateTime.UtcNow;

                foreach (var kvp in Members)
                {
                    if (!Battle.IdleKick || IsDead(kvp.Key))
                    {
                        Idlers.Remove(kvp.Key);
                        continue;
                    }

                    if (kvp.Value + Battle.IdleThreshold < now && !IsIdle(kvp.Key))
                    {
                        Idlers.Add(kvp.Key);
                    }
                }

                if (Battle.IdleKick && Idlers.Count > 0)
                {
                    Idlers.AsEnumerable().ForEach(pm => Battle.Eject(pm, true));
                }
            }

            OnMicroSync();

            if (Battle != null)
            {
                Battle.OnTeamMicroSync(this);
            }
        }
Ejemplo n.º 2
0
        public void MicroSync()
        {
            if (Battle.State == PvPBattleState.Running)
            {
                DateTime now = DateTime.UtcNow;

                foreach (var kvp in Members)
                {
                    if (IsDead(kvp.Key))
                    {
                        Idlers.Remove(kvp.Key);
                        continue;
                    }

                    if (kvp.Value + Battle.IdleThreshold < now && !IsIdle(kvp.Key))
                    {
                        Idlers.Add(kvp.Key);
                    }
                }

                if (Battle.IdleKick)
                {
                    Idlers.Not(IsDead).ForEach(pm => Battle.Eject(pm, true));
                }
            }

            OnMicroSync();

            Battle.OnTeamMicroSync(this);
        }
Ejemplo n.º 3
0
        public virtual void UpdateActivity(PlayerMobile pm)
        {
            if (pm == null || pm.Deleted)
            {
                return;
            }

            Idlers.Remove(pm);

            if (IsMember(pm))
            {
                Members[pm] = DateTime.UtcNow;
            }
        }
Ejemplo n.º 4
0
        public virtual void RemoveMember(PlayerMobile pm, bool teleport)
        {
            if (!IsMember(pm))
            {
                return;
            }

            Dead.Remove(pm);
            Idlers.Remove(pm);

            Members.Remove(pm);
            OnMemberRemoved(pm);

            if (teleport)
            {
                Battle.TeleportToSpectateLocation(pm);
            }
        }
Ejemplo n.º 5
0
        public void MicroSync()
        {
            if (!Members.IsNullOrEmpty() && !Idlers.IsNullOrEmpty() && Battle != null && Battle.IsRunning)
            {
                if (Battle.IdleKick)
                {
                    var then = DateTime.UtcNow - Battle.IdleThreshold;

                    foreach (var o in Members)
                    {
                        if (o.Value > then)
                        {
                            Idlers.Remove(o.Key);
                        }
                        else if (o.Value < then)
                        {
                            Idlers.Update(o.Key);
                        }
                    }

                    Idlers.RemoveAll(IsDead);

                    if (Idlers.Count > 0)
                    {
                        Idlers.ForEachReverse(pm => Battle.Quit(pm, true));
                    }
                }
                else
                {
                    Idlers.Clear();
                }
            }

            OnMicroSync();

            if (Battle != null)
            {
                Battle.OnTeamMicroSync(this);
            }
        }