tracking fixes
This commit is contained in:
parent
bb71524216
commit
87feddc401
3 changed files with 68 additions and 13 deletions
|
|
@ -326,7 +326,7 @@ namespace Server.SkillHandlers
|
||||||
private Mobile m_From;
|
private Mobile m_From;
|
||||||
private Timer m_Timer;
|
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_From = from;
|
||||||
m_Timer = new TrackTimer( from, target, range, this );
|
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 ) )
|
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_Arrow.Stop();
|
||||||
m_From.SendLocalizedMessage( 503177 ); // You have lost your quarry.
|
|
||||||
|
|
||||||
Tracking.ClearTrackingInfo( m_From );
|
|
||||||
|
|
||||||
Stop();
|
Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -397,7 +393,7 @@ namespace Server.SkillHandlers
|
||||||
m_LastX = m_Target.X;
|
m_LastX = m_Target.X;
|
||||||
m_LastY = m_Target.Y;
|
m_LastY = m_Target.Y;
|
||||||
|
|
||||||
m_Arrow.Update( m_LastX, m_LastY );
|
m_Arrow.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 sealed class DisplaySecureTrade : Packet
|
||||||
{
|
{
|
||||||
public DisplaySecureTrade( Mobile them, Container first, Container second, string name ) : base( 0x6F )
|
public DisplaySecureTrade( Mobile them, Container first, Container second, string name ) : base( 0x6F )
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ namespace Server
|
||||||
public class QuestArrow
|
public class QuestArrow
|
||||||
{
|
{
|
||||||
private Mobile m_Mobile;
|
private Mobile m_Mobile;
|
||||||
|
private Mobile m_Target;
|
||||||
private bool m_Running;
|
private bool m_Running;
|
||||||
|
|
||||||
public Mobile Mobile
|
public Mobile Mobile
|
||||||
|
|
@ -37,6 +38,14 @@ namespace Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mobile Target
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_Target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Running
|
public bool Running
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -45,22 +54,49 @@ namespace Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
Update( m_Target.X, m_Target.Y );
|
||||||
|
}
|
||||||
|
|
||||||
public void Update( int x, int y )
|
public void Update( int x, int y )
|
||||||
{
|
{
|
||||||
if ( m_Running )
|
if ( !m_Running )
|
||||||
m_Mobile.Send( new SetArrow( x, y ) );
|
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()
|
public void Stop()
|
||||||
|
{
|
||||||
|
Stop( m_Target.X, m_Target.Y );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop( int x, int y )
|
||||||
{
|
{
|
||||||
if ( !m_Running )
|
if ( !m_Running )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Mobile.ClearQuestArrow();
|
m_Mobile.ClearQuestArrow();
|
||||||
|
|
||||||
m_Mobile.Send( new CancelArrow() );
|
NetState ns = m_Mobile.NetState;
|
||||||
m_Running = false;
|
|
||||||
|
|
||||||
|
if ( ns != null ) {
|
||||||
|
if ( ns.HighSeas )
|
||||||
|
ns.Send( new CancelArrowHS( x, y, m_Target.Serial ) );
|
||||||
|
else
|
||||||
|
ns.Send( new CancelArrow() );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Running = false;
|
||||||
OnStop();
|
OnStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,13 +108,14 @@ namespace Server
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestArrow( Mobile m )
|
public QuestArrow( Mobile m, Mobile t )
|
||||||
{
|
{
|
||||||
m_Running = true;
|
m_Running = true;
|
||||||
m_Mobile = m;
|
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 );
|
Update( x, y );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue