Пример #1
0
        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);
            }
        }
Пример #2
0
        private static bool DeserializeLockouts(GenericReader reader)
        {
            var version = reader.GetVersion();

            switch (version)
            {
            case 0:
            {
                reader.ReadBlockDictionary(r =>
                    {
                        var k = r.ReadMobile <PlayerMobile>();
                        var v = new LockoutState(r);

                        return(new KeyValuePair <PlayerMobile, LockoutState>(k, v));
                    }, Lockouts);
            }
            break;
            }

            return(true);
        }