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); } }
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); }
public virtual void UpdateActivity(PlayerMobile pm) { if (pm == null || pm.Deleted) { return; } Idlers.Remove(pm); if (IsMember(pm)) { Members[pm] = DateTime.UtcNow; } }
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); } }
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); } }