Support for > 6.0.1.7 (Containers, SecureTrade, SpellBook, Vendors, etc)
WarningGump Fixed
This commit is contained in:
parent
3f839ed5bf
commit
57293771a2
12 changed files with 290 additions and 48 deletions
|
|
@ -167,7 +167,7 @@ namespace Server.Network
|
|||
break;
|
||||
}
|
||||
|
||||
PacketHandler handler = PacketHandlers.GetHandler( packetID );
|
||||
PacketHandler handler = ns.GetHandler( packetID );
|
||||
|
||||
if ( handler == null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -200,6 +200,11 @@ namespace Server.Network {
|
|||
}
|
||||
set {
|
||||
m_Version = value;
|
||||
|
||||
if ( value >= m_Version6017 )
|
||||
m_Post6017 = true;
|
||||
else
|
||||
m_Post6017 = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,6 +216,16 @@ namespace Server.Network {
|
|||
}
|
||||
}
|
||||
|
||||
private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" );
|
||||
|
||||
private bool m_Post6017;
|
||||
|
||||
public bool IsPost6017 {
|
||||
get {
|
||||
return m_Post6017;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SecureTrade> Trades {
|
||||
get {
|
||||
return m_Trades;
|
||||
|
|
@ -531,6 +546,14 @@ namespace Server.Network {
|
|||
}
|
||||
}
|
||||
|
||||
public PacketHandler GetHandler( int packetID )
|
||||
{
|
||||
if ( IsPost6017 )
|
||||
return PacketHandlers.Get6017Handler( packetID );
|
||||
else
|
||||
return PacketHandlers.GetHandler( packetID );
|
||||
}
|
||||
|
||||
public virtual void Send( Packet p ) {
|
||||
if ( m_Socket == null || m_BlockAllPackets ) {
|
||||
p.OnSend();
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ namespace Server.Network
|
|||
public class PacketHandlers
|
||||
{
|
||||
private static PacketHandler[] m_Handlers;
|
||||
private static PacketHandler[] m_6017Handlers;
|
||||
|
||||
private static PacketHandler[] m_ExtendedHandlersLow;
|
||||
private static Dictionary<int, PacketHandler> m_ExtendedHandlersHigh;
|
||||
|
|
@ -75,6 +76,7 @@ namespace Server.Network
|
|||
static PacketHandlers()
|
||||
{
|
||||
m_Handlers = new PacketHandler[0x100];
|
||||
m_6017Handlers = new PacketHandler[0x100];
|
||||
|
||||
m_ExtendedHandlersLow = new PacketHandler[0x100];
|
||||
m_ExtendedHandlersHigh = new Dictionary<int, PacketHandler>();
|
||||
|
|
@ -133,7 +135,7 @@ namespace Server.Network
|
|||
Register( 0xB6, 9, true, new OnPacketReceive( ObjectHelpRequest ) );
|
||||
Register( 0xB8, 0, true, new OnPacketReceive( ProfileReq ) );
|
||||
Register( 0xBB, 9, false, new OnPacketReceive( AccountID ) );
|
||||
Register( 0xBD, 0, true, new OnPacketReceive( ClientVersion ) );
|
||||
Register( 0xBD, 0, false, new OnPacketReceive( ClientVersion ) );
|
||||
Register( 0xBE, 0, true, new OnPacketReceive( AssistVersion ) );
|
||||
Register( 0xBF, 0, true, new OnPacketReceive( ExtendedCommand ) );
|
||||
Register( 0xC2, 0, true, new OnPacketReceive( UnicodePromptResponse ) );
|
||||
|
|
@ -146,6 +148,8 @@ namespace Server.Network
|
|||
Register( 0xD6, 0, true, new OnPacketReceive( BatchQueryProperties ) );
|
||||
Register( 0xD7, 0, true, new OnPacketReceive( EncodedCommand ) );
|
||||
|
||||
Register6017( 0x08, 15, true, new OnPacketReceive( DropReq6017 ) );
|
||||
|
||||
RegisterExtended( 0x05, false, new OnPacketReceive( ScreenSize ) );
|
||||
RegisterExtended( 0x06, true, new OnPacketReceive( PartyMessage ) );
|
||||
RegisterExtended( 0x07, true, new OnPacketReceive( QuestArrow ) );
|
||||
|
|
@ -171,6 +175,9 @@ namespace Server.Network
|
|||
public static void Register( int packetID, int length, bool ingame, OnPacketReceive onReceive )
|
||||
{
|
||||
m_Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive );
|
||||
|
||||
if ( m_6017Handlers[packetID] == null )
|
||||
m_6017Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive );
|
||||
}
|
||||
|
||||
public static PacketHandler GetHandler( int packetID )
|
||||
|
|
@ -178,6 +185,16 @@ namespace Server.Network
|
|||
return m_Handlers[packetID];
|
||||
}
|
||||
|
||||
public static void Register6017( int packetID, int length, bool ingame, OnPacketReceive onReceive )
|
||||
{
|
||||
m_6017Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive );
|
||||
}
|
||||
|
||||
public static PacketHandler Get6017Handler( int packetID )
|
||||
{
|
||||
return m_6017Handlers[packetID];
|
||||
}
|
||||
|
||||
public static void RegisterExtended( int packetID, bool ingame, OnPacketReceive onReceive )
|
||||
{
|
||||
if ( packetID >= 0 && packetID < 0x100 )
|
||||
|
|
@ -971,6 +988,27 @@ namespace Server.Network
|
|||
from.Drop( loc );
|
||||
}
|
||||
|
||||
public static void DropReq6017( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
pvSrc.ReadInt32(); // serial, ignored
|
||||
int x = pvSrc.ReadInt16();
|
||||
int y = pvSrc.ReadInt16();
|
||||
int z = pvSrc.ReadSByte();
|
||||
pvSrc.ReadByte(); // Grid Location?
|
||||
Serial dest = pvSrc.ReadInt32();
|
||||
|
||||
Point3D loc = new Point3D( x, y, z );
|
||||
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( dest.IsMobile )
|
||||
from.Drop( World.FindMobile( dest ), loc );
|
||||
else if ( dest.IsItem )
|
||||
from.Drop( World.FindItem( dest ), loc );
|
||||
else
|
||||
from.Drop( loc );
|
||||
}
|
||||
|
||||
public static void ConfigurationFile( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
}
|
||||
|
|
@ -1801,6 +1839,30 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
private class LoginTimer : Timer
|
||||
{
|
||||
private NetState m_State;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public LoginTimer( NetState state, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_State = state;
|
||||
m_Mobile = m;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_State == null )
|
||||
Stop();
|
||||
if ( m_State.Version != null )
|
||||
{
|
||||
m_State.BlockAllPackets = false;
|
||||
DoLogin( m_State, m_Mobile );
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void PlayCharacter( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
pvSrc.ReadInt32(); // 0xEDEDEDED
|
||||
|
|
@ -1848,6 +1910,8 @@ namespace Server.Network
|
|||
|
||||
NetState.ProcessDisposedQueue();
|
||||
|
||||
state.Send( new ClientVersionReq() );
|
||||
|
||||
state.BlockAllPackets = true;
|
||||
|
||||
state.Flags = flags;
|
||||
|
|
@ -1855,8 +1919,7 @@ namespace Server.Network
|
|||
state.Mobile = m;
|
||||
m.NetState = state;
|
||||
|
||||
state.BlockAllPackets = false;
|
||||
DoLogin( state, m );
|
||||
new LoginTimer( state, m ).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1993,6 +2056,8 @@ namespace Server.Network
|
|||
race
|
||||
);
|
||||
|
||||
state.Send( new ClientVersionReq() );
|
||||
|
||||
state.BlockAllPackets = true;
|
||||
|
||||
EventSink.InvokeCharacterCreated( args );
|
||||
|
|
@ -2003,9 +2068,7 @@ namespace Server.Network
|
|||
{
|
||||
state.Mobile = m;
|
||||
m.NetState = state;
|
||||
|
||||
state.BlockAllPackets = false;
|
||||
DoLogin( state, m );
|
||||
new LoginTimer( state, m ).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,6 +198,22 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class SecureTradeEquip6017 : Packet
|
||||
{
|
||||
public SecureTradeEquip6017( Item item, Mobile m ) : base( 0x25, 21 )
|
||||
{
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
m_Stream.Write( (short) item.ItemID );
|
||||
m_Stream.Write( (byte) 0 );
|
||||
m_Stream.Write( (short) item.Amount );
|
||||
m_Stream.Write( (short) item.X );
|
||||
m_Stream.Write( (short) item.Y );
|
||||
m_Stream.Write( (byte) 0 ); // Grid Location?
|
||||
m_Stream.Write( (int) m.Serial );
|
||||
m_Stream.Write( (short) item.Hue );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MapPatches : Packet
|
||||
{
|
||||
public MapPatches() : base( 0xBF )
|
||||
|
|
@ -261,6 +277,35 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class VendorBuyContent6017 : Packet
|
||||
{
|
||||
public VendorBuyContent6017( ArrayList list ) : base( 0x3c )
|
||||
{
|
||||
this.EnsureCapacity( list.Count*20 + 5 );
|
||||
|
||||
m_Stream.Write( (short)list.Count );
|
||||
|
||||
//The client sorts these by their X/Y value.
|
||||
//OSI sends these in wierd order. X/Y highest to lowest and serial loest to highest
|
||||
//These are already sorted by serial (done by the vendor class) but we have to send them by x/y
|
||||
//(the x74 packet is sent in 'correct' order.)
|
||||
for ( int i = list.Count - 1; i >= 0; --i )
|
||||
{
|
||||
BuyItemState bis = (BuyItemState)list[i];
|
||||
|
||||
m_Stream.Write( (int)bis.MySerial );
|
||||
m_Stream.Write( (ushort)(bis.ItemID & 0x3FFF) );
|
||||
m_Stream.Write( (byte)0 );//itemid offset
|
||||
m_Stream.Write( (ushort)bis.Amount );
|
||||
m_Stream.Write( (short)(i+1) );//x
|
||||
m_Stream.Write( (short)1 );//y
|
||||
m_Stream.Write( (byte)0 ); // Grid Location?
|
||||
m_Stream.Write( (int)bis.ContainerSerial );
|
||||
m_Stream.Write( (ushort)bis.Hue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DisplayBuyList : Packet
|
||||
{
|
||||
public DisplayBuyList( Mobile vendor ) : base( 0x24, 7 )
|
||||
|
|
@ -1527,6 +1572,39 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerContentUpdate6017 : Packet
|
||||
{
|
||||
public ContainerContentUpdate6017( Item item ) : base( 0x25, 21 )
|
||||
{
|
||||
Serial parentSerial;
|
||||
|
||||
if ( item.Parent is Item )
|
||||
{
|
||||
parentSerial = ((Item)item.Parent).Serial;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine( "Warning: ContainerContentUpdate on item with !(parent is Item)" );
|
||||
parentSerial = Serial.Zero;
|
||||
}
|
||||
|
||||
ushort cid = (ushort) item.ItemID;
|
||||
|
||||
if ( cid > 0x3FFF )
|
||||
cid = 0x9D7;
|
||||
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
m_Stream.Write( (short) cid );
|
||||
m_Stream.Write( (byte) 0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort) item.Amount );
|
||||
m_Stream.Write( (short) item.X );
|
||||
m_Stream.Write( (short) item.Y );
|
||||
m_Stream.Write( (byte) 0 ); // Grid Location?
|
||||
m_Stream.Write( (int) parentSerial );
|
||||
m_Stream.Write( (ushort) item.Hue );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerContent : Packet
|
||||
{
|
||||
public ContainerContent( Mobile beholder, Item beheld ) : base( 0x3C )
|
||||
|
|
@ -1573,6 +1651,53 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerContent6017 : Packet
|
||||
{
|
||||
public ContainerContent6017( Mobile beholder, Item beheld ) : base( 0x3C )
|
||||
{
|
||||
List<Item> items = beheld.Items;
|
||||
int count = items.Count;
|
||||
|
||||
this.EnsureCapacity( 5 + (count * 20) );
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write( (ushort) 0 );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if ( !child.Deleted && beholder.CanSee( child ) )
|
||||
{
|
||||
Point3D loc = child.Location;
|
||||
|
||||
ushort cid = (ushort) child.ItemID;
|
||||
|
||||
if ( cid > 0x3FFF )
|
||||
cid = 0x9D7;
|
||||
|
||||
m_Stream.Write( (int) child.Serial );
|
||||
m_Stream.Write( (ushort) cid );
|
||||
m_Stream.Write( (byte) 0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort) child.Amount );
|
||||
m_Stream.Write( (short) loc.m_X );
|
||||
m_Stream.Write( (short) loc.m_Y );
|
||||
m_Stream.Write( (byte) 0 ); // Grid Location?
|
||||
m_Stream.Write( (int) beheld.Serial );
|
||||
m_Stream.Write( (ushort) child.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
m_Stream.Seek( pos, SeekOrigin.Begin );
|
||||
m_Stream.Write( (ushort) written );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SetWarMode : Packet
|
||||
{
|
||||
public static readonly Packet InWarMode = Packet.SetStatic( new SetWarMode( true ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue