public static bool IsLockedOut(PlayerMobile pm, DungeonID id, out TimeSpan t) { t = TimeSpan.Zero; if (pm == null || pm.Deleted || id == DungeonID.None) { return(false); } var s = false; var state = Lockouts.GetValue(pm); if (state != null) { s = state.IsLockedOut(id, out t); if (state.IsEmpty) { Lockouts.Remove(pm); } } return(s); }
public static void SetLockout(PlayerMobile pm, DungeonID id, TimeSpan t) { if (pm == null || pm.Deleted || id == DungeonID.None) { return; } var state = Lockouts.GetValue(pm); if (state == null) { if (t <= TimeSpan.Zero) { return; } Lockouts[pm] = state = new LockoutState(pm); } state.SetLockout(id, t); if (state.IsEmpty) { Lockouts.Remove(pm); } }
public static TimeSpan GetLockout(PlayerMobile pm, DungeonID id) { if (pm == null || pm.Deleted || id == DungeonID.None) { return(TimeSpan.Zero); } var t = TimeSpan.Zero; var state = Lockouts.GetValue(pm); if (state != null) { t = state.GetLockout(id); if (state.IsEmpty) { Lockouts.Remove(pm); } } return(t); }