Exemple #1
0
        protected override void SetDeath(Unit killer)
        {
            Health = 0;

            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);

            Pet    pet      = killer as Pet;
            Player credited = (pet != null) ? pet.Owner : (killer as Player);

            if (credited != null)
            {
                HandleDeathRewards(credited);
            }

            ClearTrackedDamage();

            _buildState = EConstructionState.Destroying;

            foreach (Player plr in _interactors)
            {
                plr.Palisade = null;
            }

            _interactors.Clear();

            foreach (NewBuff buff in _interactionBuffs)
            {
                buff.BuffHasExpired = true;
            }

            _interactionBuffs.Clear();

            GroundTarget gt = new GroundTarget(_constructor, new Point3D(WorldPosition), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt, Zone.ZoneId);

            gt.BuffInterface.QueueBuff(new BuffQueueInfo(_constructor, 40, AbilityMgr.GetBuffInfo(23762)));

            gt.SetExpiry(TCPManager.GetTimeStampMS() + 5000);
        }
Exemple #2
0
        public bool StartAbilityAtPos(AbilityInfo abInfo, byte castSequence, Point3D worldPos, ushort zoneID)
        {
            _pendingInfo = abInfo;
            _pendingInfo.TargetPosition = worldPos;
            _pendingItemCooldownGroup   = 0;
            _pendingCastSequence        = castSequence;

            byte result = ModifyInitials();

            if (result == 1 || !AllowStartCastAtPos() || !_caster.PointWithinRadiusFeet(_pendingInfo.TargetPosition, (int)(_caster.BaseRadius + _pendingInfo.Range)))
            {
                CancelPendingCast();
                return(false);
            }

            if (result == 2)
            {
                _abInterface.SetGlobalCooldown();
                CancelPendingCast();
                return(false);
            }

            if (result == 3)
            {
                _abInterface.SetCooldown(_pendingInfo.ConstantInfo.CooldownEntry != 0 ? _pendingInfo.ConstantInfo.CooldownEntry : _pendingInfo.Entry, _pendingInfo.Cooldown * 1000);
                CancelPendingCast();
                return(false);
            }

            // Cast success. Cancel existing ability if any

            if (AbInfo != null)
            {
                CancelCast(0);
            }

            AbInfo             = _pendingInfo;
            _pendingInfo       = null;
            _itemCooldownGroup = 0;
            _castSequence      = castSequence;

            _castStartTime = TCPManager.GetTimeStampMS();

            if (AbInfo.Level == 0)
            {
                AbInfo.Level = _abInterface.GetMasteryLevelFor(AbInfo.ConstantInfo.MasteryTree);
            }

            if (AbInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM)
            {
                _caster.BuffInterface.NotifyAbilityStarted(AbInfo);
            }

            SendStart();

            if (!AbInfo.ConstantInfo.IgnoreGlobalCooldown)
            {
                _abInterface.SetGlobalCooldown();
            }

            if (AbInfo.ConstantInfo.ChannelID != 0)
            {
                // Channeled Morale 4s grant immunity and cannot be interrupted
                if (AbInfo.SpecialCost == -4)
                {
                    _caster.AddCrowdControlImmunity((int)CrowdControlTypes.Unstoppable);
                    _caster.IsImmovable = true;
                }

                GroundTarget gt = new GroundTarget(_caster, AbInfo.TargetPosition, GameObjectService.GetGameObjectProto(23));
                _caster.Region.AddObject(gt, _caster.Zone.ZoneId);

                gt.SetExpiry(TCPManager.GetTimeStampMS() + 20000);

                AbInfo.Target = gt;

                _channelHandler.Initialize(AbInfo, castSequence);
            }
            else
            {
                CastAtPosition();
            }

            return(false);
        }