예제 #1
0
        public static bool StopEvent(uint id)
        {
            WorldEvent worldEvent = WorldEventMgr.GetEvent(id);

            if (worldEvent == null)
            {
                return(false);
            }
            WorldEventMgr.StopEvent(worldEvent);
            return(true);
        }
예제 #2
0
        public static void Update()
        {
            if (!WorldEventMgr.Loaded || !QuestMgr.Loaded || (!NPCMgr.Loaded || !GOMgr.Loaded))
            {
                return;
            }
            TimeSpan timeSpan1 = DateTime.Now - WorldEventMgr.LastUpdateTime;

            WorldEventMgr.LastUpdateTime = DateTime.Now;
            foreach (WorldEvent worldEvent1 in ((IEnumerable <WorldEvent>)WorldEventMgr.AllEvents)
                     .Where <WorldEvent>((Func <WorldEvent, bool>)(worldEvent => worldEvent != null))
                     .Where <WorldEvent>((Func <WorldEvent, bool>)(worldEvent => worldEvent.TimeUntilNextStart.HasValue)))
            {
                WorldEvent worldEvent2         = worldEvent1;
                TimeSpan?  timeUntilNextStart1 = worldEvent2.TimeUntilNextStart;
                TimeSpan   timeSpan2           = timeSpan1;
                worldEvent2.TimeUntilNextStart = timeUntilNextStart1.HasValue
                    ? new TimeSpan?(timeUntilNextStart1.GetValueOrDefault() - timeSpan2)
                    : new TimeSpan?();
                WorldEvent worldEvent3   = worldEvent1;
                TimeSpan?  timeUntilEnd1 = worldEvent3.TimeUntilEnd;
                TimeSpan   timeSpan3     = timeSpan1;
                worldEvent3.TimeUntilEnd = timeUntilEnd1.HasValue
                    ? new TimeSpan?(timeUntilEnd1.GetValueOrDefault() - timeSpan3)
                    : new TimeSpan?();
                TimeSpan?timeUntilEnd2 = worldEvent1.TimeUntilEnd;
                TimeSpan zero1         = TimeSpan.Zero;
                if ((timeUntilEnd2.HasValue ? (timeUntilEnd2.GetValueOrDefault() <= zero1 ? 1 : 0) : 0) != 0)
                {
                    WorldEventMgr.StopEvent(worldEvent1);
                }
                else
                {
                    TimeSpan?timeUntilNextStart2 = worldEvent1.TimeUntilNextStart;
                    TimeSpan zero2 = TimeSpan.Zero;
                    if ((timeUntilNextStart2.HasValue
                            ? (timeUntilNextStart2.GetValueOrDefault() <= zero2 ? 1 : 0)
                            : 0) != 0)
                    {
                        WorldEventMgr.StartEvent(worldEvent1);
                    }
                }
            }
        }