Example #1
0
        void HandleUpdateMissileTrajectory(UpdateMissileTrajectory packet)
        {
            Unit  caster = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Guid);
            Spell spell  = caster ? caster.GetCurrentSpell(CurrentSpellTypes.Generic) : null;

            if (!spell || spell.m_spellInfo.Id != packet.SpellID || !spell.m_targets.HasDst() || !spell.m_targets.HasSrc())
            {
                return;
            }

            Position pos = spell.m_targets.GetSrcPos();

            pos.Relocate(packet.FirePos);
            spell.m_targets.ModSrc(pos);

            pos = spell.m_targets.GetDstPos();
            pos.Relocate(packet.ImpactPos);
            spell.m_targets.ModDst(pos);

            spell.m_targets.SetPitch(packet.Pitch);
            spell.m_targets.SetSpeed(packet.Speed);

            if (packet.Status.HasValue)
            {
                GetPlayer().ValidateMovementInfo(packet.Status.Value);

                /*public uint opcode;
                 * recvPacket >> opcode;
                 * recvPacket.SetOpcode(CMSG_MOVE_STOP); // always set to CMSG_MOVE_STOP in client SetOpcode
                 * //HandleMovementOpcodes(recvPacket);*/
            }
        }
Example #2
0
        void HandleMissileTrajectoryCollision(MissileTrajectoryCollision packet)
        {
            Unit caster = Global.ObjAccessor.GetUnit(_player, packet.Target);

            if (caster == null)
            {
                return;
            }

            Spell spell = caster.FindCurrentSpellBySpellId(packet.SpellID);

            if (spell == null || !spell.m_targets.HasDst())
            {
                return;
            }

            Position pos = spell.m_targets.GetDstPos();

            pos.Relocate(packet.CollisionPos);
            spell.m_targets.ModDst(pos);

            NotifyMissileTrajectoryCollision data = new NotifyMissileTrajectoryCollision();

            data.Caster       = packet.Target;
            data.CastID       = packet.CastID;
            data.CollisionPos = packet.CollisionPos;
            caster.SendMessageToSet(data, true);
        }