Exemplo n.º 1
0
        public static void StartEvent(WorldEvent worldEvent)
        {
            WorldEvent worldEvent1        = worldEvent;
            TimeSpan?  timeUntilNextStart = worldEvent1.TimeUntilNextStart;
            TimeSpan   occurence          = worldEvent.Occurence;

            worldEvent1.TimeUntilNextStart = timeUntilNextStart.HasValue
                ? new TimeSpan?(timeUntilNextStart.GetValueOrDefault() + occurence)
                : new TimeSpan?();
            if (WorldEventMgr.IsEventActive(worldEvent.Id))
            {
                return;
            }
            WorldEventMgr.Log.Info("Starting event {0}: {1}", (object)worldEvent.Id, (object)worldEvent.Description);
            ArrayUtil.Set <WorldEvent>(ref WorldEventMgr.ActiveEvents, worldEvent.Id, worldEvent);
            WorldEventMgr.SpawnEvent(worldEvent);
            WorldEventMgr.ApplyEventNPCData(worldEvent);
        }
Exemplo n.º 2
0
        public static void StopEvent(WorldEvent worldEvent)
        {
            WorldEvent worldEvent1  = worldEvent;
            TimeSpan?  timeUntilEnd = worldEvent1.TimeUntilEnd;
            TimeSpan   timeSpan     = worldEvent.Occurence + worldEvent.Duration;

            worldEvent1.TimeUntilEnd = timeUntilEnd.HasValue
                ? new TimeSpan?(timeUntilEnd.GetValueOrDefault() + timeSpan)
                : new TimeSpan?();
            if (!WorldEventMgr.IsEventActive(worldEvent.Id))
            {
                return;
            }
            WorldEventMgr.Log.Info("Stopping event {0}: {1}", (object)worldEvent.Id, (object)worldEvent.Description);
            WorldEventMgr.ActiveEvents[worldEvent.Id] = (WorldEvent)null;
            if (worldEvent.QuestIds.Count != 0)
            {
                WorldEventMgr.ClearActiveQuests((IEnumerable <uint>)worldEvent.QuestIds);
            }
            WorldEventMgr.DeSpawnEvent(worldEvent);
            WorldEventMgr.ResetEventNPCData(worldEvent);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Checks if the event is currently active
 /// </summary>
 /// <param name="eventId">Id of the event to check</param>
 /// <returns></returns>
 public bool IsEventActive(uint eventId)
 {
     return(WorldEventMgr.IsEventActive(eventId));
 }