Ejemplo n.º 1
0
        public override void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            AbtInterface.NPCAbilities.Clear();

            // Remove any owner events before disposing
            Owner.EvtInterface.RemoveEventNotify(EventName.OnDealDamage, Attack);
            Owner.EvtInterface.RemoveEventNotify(EventName.OnLeaveCombat, Recall);
            Owner.EvtInterface.RemoveEventNotify(EventName.OnDie, Dismiss);
            Owner.EvtInterface.RemoveEventNotify(EventName.OnRemoveFromWorld, Dismiss);
#if DIST_DEBUG && DEBUG
            Owner.EvtInterface.RemoveEvent(DistanceDebug);
#endif

            if (_ownerUILinked)
            {
                IPetCareerInterface petInterface = Owner.CrrInterface as IPetCareerInterface;

                petInterface?.Notify_PetDown();

                _ownerUILinked = false;
            }

            base.Dispose();
        }
Ejemplo n.º 2
0
        public override void Destroy()
        {
            if (!PendingDisposal)
            {
                PendingDisposal = true;

                if (!IsDead)
                {
                    IPetCareerInterface petInterface = Owner.CrrInterface as IPetCareerInterface;

                    petInterface?.Notify_PetDown();
                }
            }
        }
Ejemplo n.º 3
0
        protected override void SetDeath(Unit killer)
        {
            Health = 0;

            States.Add((byte)CreatureState.Dead); // Death State

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH, 12);

            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(killer.IsPet() ? killer.GetPet().Owner.Oid : killer.Oid);
            Out.Fill(0, 6);
            DispatchPacket(Out, true);

            AbtInterface.Cancel(true);
            ScrInterface.OnDie(this);

            BuffInterface.RemoveBuffsOnDeath();

            EvtInterface.Notify(EventName.OnDie, this, killer);

            AiInterface.ProcessCombatEnd();

            EvtInterface.AddEvent(RezUnit, 10000, 1); // Clear the object in 10 seconds.

            if (_ownerUILinked)
            {
                SendPetRemove(true);

                IPetCareerInterface petInterface = Owner.CrrInterface as IPetCareerInterface;

                petInterface?.Notify_PetDown();

                _ownerUILinked = false;
            }
        }