From 87feddc401bbb71998af31e0c15053a5683fd111 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 12 Dec 2010 23:55:08 +0000 Subject: [PATCH] tracking fixes --- Scripts/Skills/Tracking.cs | 10 +++----- Server/Network/Packets.cs | 22 +++++++++++++++++ Server/QuestArrow.cs | 49 +++++++++++++++++++++++++++++++++----- 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/Scripts/Skills/Tracking.cs b/Scripts/Skills/Tracking.cs index 9e7c87974..1b50af044 100644 --- a/Scripts/Skills/Tracking.cs +++ b/Scripts/Skills/Tracking.cs @@ -326,7 +326,7 @@ namespace Server.SkillHandlers private Mobile m_From; private Timer m_Timer; - public TrackArrow( Mobile from, Mobile target, int range ) : base( from ) + public TrackArrow( Mobile from, Mobile target, int range ) : base( from, target ) { m_From = from; m_Timer = new TrackTimer( from, target, range, this ); @@ -383,11 +383,7 @@ namespace Server.SkillHandlers } 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.SendLocalizedMessage( 503177 ); // You have lost your quarry. - - Tracking.ClearTrackingInfo( m_From ); - + m_Arrow.Stop(); Stop(); return; } @@ -397,7 +393,7 @@ namespace Server.SkillHandlers m_LastX = m_Target.X; m_LastY = m_Target.Y; - m_Arrow.Update( m_LastX, m_LastY ); + m_Arrow.Update(); } } } diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 844ee6065..82129eacf 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -138,6 +138,28 @@ namespace Server.Network } } + public sealed class CancelArrowHS : Packet + { + public CancelArrowHS( int x, int y, Serial s ) : base( 0xBA, 10 ) + { + m_Stream.Write( (byte) 0 ); + m_Stream.Write( (short) x ); + m_Stream.Write( (short) y ); + m_Stream.Write( (int) s ); + } + } + + public sealed class SetArrowHS : Packet + { + public SetArrowHS( int x, int y, Serial s ) : base( 0xBA, 10 ) + { + m_Stream.Write( (byte) 1 ); + m_Stream.Write( (short) x ); + m_Stream.Write( (short) y ); + m_Stream.Write( (int) s ); + } + } + public sealed class DisplaySecureTrade : Packet { public DisplaySecureTrade( Mobile them, Container first, Container second, string name ) : base( 0x6F ) diff --git a/Server/QuestArrow.cs b/Server/QuestArrow.cs index afae9794e..dbaa07a59 100644 --- a/Server/QuestArrow.cs +++ b/Server/QuestArrow.cs @@ -27,6 +27,7 @@ namespace Server public class QuestArrow { private Mobile m_Mobile; + private Mobile m_Target; private bool m_Running; public Mobile Mobile @@ -37,6 +38,14 @@ namespace Server } } + public Mobile Target + { + get + { + return m_Target; + } + } + public bool Running { get @@ -45,22 +54,49 @@ namespace Server } } + public void Update() + { + Update( m_Target.X, m_Target.Y ); + } + public void Update( int x, int y ) { - if ( m_Running ) - m_Mobile.Send( new SetArrow( x, y ) ); + if ( !m_Running ) + return; + + NetState ns = m_Mobile.NetState; + + if ( ns == null ) + return; + + if ( ns.HighSeas ) + ns.Send( new SetArrowHS( x, y, m_Target.Serial ) ); + else + ns.Send( new SetArrow( x, y ) ); } public void Stop() + { + Stop( m_Target.X, m_Target.Y ); + } + + public void Stop( int x, int y ) { if ( !m_Running ) return; m_Mobile.ClearQuestArrow(); - m_Mobile.Send( new CancelArrow() ); - m_Running = false; + NetState ns = m_Mobile.NetState; + if ( ns != null ) { + if ( ns.HighSeas ) + ns.Send( new CancelArrowHS( x, y, m_Target.Serial ) ); + else + ns.Send( new CancelArrow() ); + } + + m_Running = false; OnStop(); } @@ -72,13 +108,14 @@ namespace Server { } - public QuestArrow( Mobile m ) + public QuestArrow( Mobile m, Mobile t ) { m_Running = true; m_Mobile = m; + m_Target = t; } - public QuestArrow( Mobile m, int x, int y ) : this( m ) + public QuestArrow( Mobile m, Mobile t, int x, int y ) : this( m, t ) { Update( x, y ); }