Exemple #1
0
        protected override void OnTick()
        {
            if (!m_Arrow.Running)
            {
                Stop();
                return;
            }
            else if (m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange(m_Target, m_Range))
            {
                m_From.Send(new CancelArrow());
                m_From.SendAsciiMessage("You have lost your quarry."); // You have lost your quarry.

                Tracking.ClearTrackingInfo(m_From);

                Stop();
                return;
            }

            m_LastX = m_Target.X;
            m_LastY = m_Target.Y;

            if (m_LastDirection == m_From.GetDirectionTo(m_Target))
            {
                return;
            }

            if (m_From.GetDirectionTo(m_Target) == Direction.North)
            {
                m_LastDirection = Direction.North;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the North.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.South)
            {
                m_LastDirection = Direction.South;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the South.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.East)
            {
                m_LastDirection = Direction.East;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the East.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.West)
            {
                m_LastDirection = Direction.West;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the West.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.Up)
            {
                m_LastDirection = Direction.Up;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the Northwest.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.Left)
            {
                m_LastDirection = Direction.Left;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the Southwest.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.Right)
            {
                m_LastDirection = Direction.Right;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the Northeast.", m_Target.Name));
            }
            else if (m_From.GetDirectionTo(m_Target) == Direction.Down)
            {
                m_LastDirection = Direction.Down;
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is to the Southeast.", m_Target.Name));
            }
            else
            {
                m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} is in some direction.", m_Target.Name));
            }
        }