Example #1
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var      mod      = trigger.Text.NextModifiers();
                TimeSpan?duration = null;

                if (mod == "t")
                {
                    duration = trigger.Text.NextTimeSpan();
                    if (duration == null)
                    {
                        trigger.Reply("Invalid Duration specified {0}", EnglishParamInfo);
                        return;
                    }
                }
                var id = trigger.Text.NextUInt();


                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    if (id == 0)
                    {
                        trigger.Reply("Usage:" + EnglishParamInfo);
                    }
                    return;
                }
                worldEvent.TimeUntilNextStart = TimeSpan.Zero;
                worldEvent.TimeUntilEnd       = duration ?? worldEvent.Duration;
            }
Example #2
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var id = trigger.Text.NextUInt();

                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    if (id == 0)
                    {
                        trigger.Reply("Usage:" + EnglishParamInfo);
                    }
                    return;
                }

                trigger.Reply("Event ({0}) {1}", id, worldEvent.Description);
                trigger.Reply("Absolute start date: {0}", worldEvent.From);
                trigger.Reply("Absolute end date:   {0}", worldEvent.Until);
                trigger.Reply("Duration:            {0}", worldEvent.Duration);
                trigger.Reply("Occurence interval:  {0}", worldEvent.Occurence);
                trigger.Reply("Next start in:       {0}", worldEvent.TimeUntilNextStart);
                trigger.Reply("Next end in:         {0}", worldEvent.TimeUntilEnd);
                trigger.Reply("Holiday Id:          {0}", worldEvent.HolidayId);
                trigger.Reply("GO Spawn count:      {0}", worldEvent.GOSpawns.Count);
                trigger.Reply("NPC Spawn count:     {0}", worldEvent.NPCSpawns.Count);
                trigger.Reply("NPC Data count:      {0}", worldEvent.ModelEquips.Count);
                trigger.Reply("Quest count:         {0}", worldEvent.QuestIds.Count);
            }
Example #3
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var occurence = trigger.Text.NextTimeSpan();
                var id        = trigger.Text.NextUInt();


                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    return;
                }

                if (occurence == null)
                {
                    trigger.Reply("Invalid Occurence specified {0}", EnglishParamInfo);
                    return;
                }

                if (occurence < worldEvent.Duration)
                {
                    trigger.Reply("Invalid Occurence {0} specified, must be greater than the duration {1}", occurence, worldEvent.Duration);
                    return;
                }
                worldEvent.Occurence = (TimeSpan)occurence;
                WorldEvent.CalculateEventDelays(worldEvent);
            }
Example #4
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var duration = trigger.Text.NextTimeSpan();
                var id       = trigger.Text.NextUInt();


                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    return;
                }

                if (duration == null)
                {
                    trigger.Reply("Invalid Duration specified {0}", EnglishParamInfo);
                    return;
                }

                if (duration > worldEvent.Occurence)
                {
                    trigger.Reply("Invalid Duration {0} specified, must be less than the occurence {1}", duration, worldEvent.Occurence);
                    return;
                }
                worldEvent.Duration = (TimeSpan)duration;
                WorldEvent.CalculateEventDelays(worldEvent);
            }
Example #5
0
        /// <summary>Finalize this NPCSpawnEntry</summary>
        /// <param name="addToPool">If set to false, will not try to add it to any pool (recommended for custom NPCSpawnEntry that share a pool)</param>
        public override void FinalizeDataHolder(bool addToPool)
        {
            if (Entry == null)
            {
                Entry = NPCMgr.GetEntry(EntryId);
                if (Entry == null)
                {
                    ContentMgr.OnInvalidDBData("{0} had an invalid EntryId.", (object)this);
                    return;
                }
            }

            if (EquipmentId != 0U)
            {
                Equipment = NPCMgr.GetEquipment(EquipmentId);
            }
            if (DisplayIdOverride == 16777215U)
            {
                DisplayIdOverride = 0U;
            }
            base.FinalizeDataHolder(addToPool);
            if (MapId != MapId.End)
            {
                Entry.SpawnEntries.Add(this);
                ArrayUtil.Set(ref NPCMgr.SpawnEntries, SpawnId, this);
                if (addToPool)
                {
                    AddToPoolTemplate();
                }
            }

            if (_eventId != 0)
            {
                uint       id         = (uint)Math.Abs(_eventId);
                WorldEvent worldEvent = WorldEventMgr.GetEvent(id);
                if (worldEvent != null)
                {
                    WorldEventNPC worldEventNpc = new WorldEventNPC
                    {
                        _eventId = _eventId,
                        EventId  = id,
                        Guid     = SpawnId,
                        Spawn    = _eventId > 0
                    };
                    worldEvent.NPCSpawns.Add(worldEventNpc);
                }

                EventId = id;
            }

            foreach (NPCSpawnTypeHandler spawnTypeHandler in Entry.SpawnTypeHandlers)
            {
                if (spawnTypeHandler != null)
                {
                    spawnTypeHandler(this);
                }
            }
        }
Example #6
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var id = trigger.Text.NextUInt();

                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    if (id == 0)
                    {
                        trigger.Reply("Usage:" + EnglishParamInfo);
                    }
                    return;
                }

                WorldEvent.CalculateEventDelays(worldEvent);
            }
Example #7
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var id = trigger.Text.NextUInt();

                var worldEvent = WorldEventMgr.GetEvent(id);

                if (worldEvent == null)
                {
                    trigger.Reply("Invalid World Event {0} specified", id);
                    if (id == 0)
                    {
                        trigger.Reply("Usage:" + EnglishParamInfo);
                    }
                    return;
                }

                worldEvent.TimeUntilNextStart = null;
                WorldEventMgr.StopEvent(worldEvent);
            }
Example #8
0
        /// <summary>
        /// Finalize this GOSpawnEntry
        /// </summary>
        /// <param name="addToPool">If set to false, will not try to add it to any pool (recommended for custom GOSpawnEntry that share a pool)</param>
        public override void FinalizeDataHolder(bool addToPool)
        {
            // get Entry
            if (Entry == null)
            {
                Entry = GOMgr.GetEntry(EntryId, false);
                if (Entry == null)
                {
                    ContentMgr.OnInvalidDBData("{0} had an invalid EntryId.", this);
                    return;
                }
            }

            // fix data inconsistencies
            if (Scale == 0)
            {
                Scale = 1;
            }

            if (EntryId == 0)
            {
                EntryId = (GOEntryId)EntryIdRaw;
            }
            else
            {
                EntryIdRaw = (uint)EntryId;
            }

            if (Rotations == null)
            {
                Rotations = new float[GOConstants.MaxRotations];
            }

            //GOMgr.Templates.Add(Id, this);

            // do the default thing
            base.FinalizeDataHolder(addToPool);

            if (MapId != MapId.End)
            {
                // valid map
                Entry.SpawnEntries.Add(this);

                // add to list of GOSpawnEntries
                ArrayUtil.Set(ref GOMgr.SpawnEntries, SpawnId, this);

                if (addToPool)
                {
                    // add to pool
                    AddToPoolTemplate();
                }
            }

            // Is this GO associated with an event
            if (_eventId != 0)
            {
                // The event id loaded can be negative if this
                // entry is expected to despawn during an event
                var eventId = (uint)Math.Abs(_eventId);

                //Check if the event is valid
                var worldEvent = WorldEventMgr.GetEvent(eventId);
                if (worldEvent != null)
                {
                    // Add this GO to the list of related spawns
                    // for the given world event
                    var eventGO = new WorldEventGameObject()
                    {
                        _eventId = _eventId, EventId = eventId, Guid = SpawnId, Spawn = _eventId > 0
                    };

                    worldEvent.GOSpawns.Add(eventGO);
                }
                EventId = eventId;
            }
        }
 // 16
 public override bool Meets(Character chr, Unit target, uint miscValue)
 {
     return(WorldEventMgr.IsHolidayActive(Value1));
 }
Example #10
0
        /// <summary>
        /// Finalize this NPCSpawnEntry
        /// </summary>
        /// <param name="addToPool">If set to false, will not try to add it to any pool (recommended for custom NPCSpawnEntry that share a pool)</param>
        public override void FinalizeDataHolder(bool addToPool)
        {
            // set Entry
            if (Entry == null)
            {
                Entry = NPCMgr.GetEntry(EntryId);
                if (Entry == null)
                {
                    ContentMgr.OnInvalidDBData("{0} had an invalid EntryId.", this);
                    return;
                }
            }

            // fix data inconsistencies & load addon data
            if (EquipmentId != 0)
            {
                Equipment = NPCMgr.GetEquipment(EquipmentId);
            }

            // seems to be a DB issue where the id was inserted as a float
            if (DisplayIdOverride == 0xFFFFFF)
            {
                DisplayIdOverride = 0;
            }

            // do the default thing
            base.FinalizeDataHolder(addToPool);

            if (MapId != MapId.End)
            {
                // valid map
                // add to NPCEntry
                Entry.SpawnEntries.Add(this);

                // add to list of NPCSpawnEntries
                ArrayUtil.Set(ref NPCMgr.SpawnEntries, SpawnId, this);

                if (addToPool)
                {
                    // add to pool
                    AddToPoolTemplate();
                }
            }

            // Is this NPC associated with an event
            if (_eventId != 0)
            {
                // The event id loaded can be negative if this
                // entry is expected to despawn during an event
                var eventId = (uint)Math.Abs(_eventId);

                //Check if the event is valid
                var worldEvent = WorldEventMgr.GetEvent(eventId);
                if (worldEvent != null)
                {
                    // Add this NPC to the list of related spawns
                    // for the given world event
                    var eventNPC = new WorldEventNPC()
                    {
                        _eventId = _eventId, EventId = eventId, Guid = SpawnId, Spawn = _eventId > 0
                    };

                    worldEvent.NPCSpawns.Add(eventNPC);
                }
                EventId = eventId;
            }

            //if(MoveType == AIMotionGenerationType.RandomMotion)
            //CreateRandomWaypoints();

            // finished initializing, now call the hooks
            foreach (var handler in Entry.SpawnTypeHandlers)
            {
                if (handler != null)
                {
                    handler(this);
                }
            }
        }