コード例 #1
0
ファイル: Head2.cs プロジェクト: zerodowned/UO-Forever
 public static void Initialize()
 {
     if (_ExpireTimers.All(t => t == null))
     {
         _ExpireTimers.SetAll(i => PollTimer.FromMinutes(1.0, () => ProcessHeads(i), () => AllHeads.Count > i * 5000));
     }
     else
     {
         _ExpireTimers.For(i => _ExpireTimers[i].Running = true);
     }
 }
コード例 #2
0
        static Instances()
        {
            _BounceRestore = new Dictionary <PlayerMobile, MapPoint>(0x100);
            _ItemRestore   = new Dictionary <Item, IEntity>(0x1000);

            CSOptions = new InstanceMapsOptions();

            IndexFile = IOUtility.EnsureFile(VitaNexCore.SavesDirectory + "/InstanceMaps/Maps.idx");

            RestoreFile = IOUtility.EnsureFile(VitaNexCore.CacheDirectory + "/InstanceMaps/Restore.bin");
            RestoreFile.SetHidden(true);

            Lockouts = new BinaryDataStore <PlayerMobile, LockoutState>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Lockouts")
            {
                Async         = true,
                OnSerialize   = SerializeLockouts,
                OnDeserialize = DeserializeLockouts
            };

            Maps = new BinaryDirectoryDataStore <InstanceMapSerial, InstanceMap>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Maps", "bin")
            {
                Async         = true,
                OnSerialize   = SerializeMap,
                OnDeserialize = DeserializeMap
            };

            Dungeons = new BinaryDirectoryDataStore <DungeonSerial, Dungeon>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Dungeons", "bin")
            {
                Async         = true,
                OnSerialize   = SerializeDungeon,
                OnDeserialize = DeserializeDungeon
            };

            DungeonTypes = typeof(Dungeon).GetConstructableChildren();

            var instances = DungeonTypes
                            .Select(t => t.CreateInstanceSafe <Dungeon>())
                            .Where(d => d != null && d.ID != DungeonID.None && d.GroupMax > 0)
                            .Where(d => d.MapParent != null && !(d.MapParent is InstanceMap))
                            .ToList();

            DungeonInfo = instances.Select(d => new DungeonInfo(d)).ToArray();

            instances.ForEach(d => d.Delete());
            instances.Free(true);

            DefragmentTimer = PollTimer.FromMinutes(10.0, Defragment, () => !_Defragmenting, false);
        }
コード例 #3
0
        private static void CMInvoke()
        {
            LastUpdate = DateTime.Now;

            UpdateTimer = PollTimer.FromMinutes(
                1.0,
                () =>
            {
                Update();

                if (CMOptions.UpdateInterval < UpdateTimeMax)
                {
                    //CMOptions.UpdateInterval = UpdateTimeMax;
                }
            },
                () =>
                CMOptions.ModuleEnabled && CMOptions.UpdateTimer && !_Updating &&
                (DateTime.Now - LastUpdate) > CMOptions.UpdateInterval);
        }
コード例 #4
0
        public static void Configure()
        {
            if (_StatLossDecayTimer == null || !_StatLossDecayTimer.Running)
            {
                _StatLossDecayTimer = PollTimer.FromMinutes(
                    30.0,
                    // Every 30 minutes (this used to be on FoodDecay timer...)
                    () =>
                {
                    Mobile[] mobs = NetState.Instances.Where(ns => ns != null && ns.Mobile != null).Select(ns => ns.Mobile).ToArray();

                    foreach (Mobile m in mobs)
                    {
                        StatLossDecay(m);
                    }
                },
                    () => NetState.Instances.Count > 0);
            }
        }