Cleanup Expansions
WorldPacketSA should not be used yet. There is much more work to be done and that version has not been looked at in quite some time.
This commit is contained in:
parent
01eee98298
commit
177eb4c6ff
26 changed files with 388 additions and 204 deletions
|
|
@ -90,7 +90,7 @@ namespace Server.Network {
|
|||
}
|
||||
}
|
||||
|
||||
private int m_Flags;
|
||||
private ClientFlags m_Flags;
|
||||
|
||||
private static bool m_Paused;
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ namespace Server.Network {
|
|||
}
|
||||
}
|
||||
|
||||
public int Flags {
|
||||
public ClientFlags Flags {
|
||||
get {
|
||||
return m_Flags;
|
||||
}
|
||||
|
|
@ -202,51 +202,74 @@ namespace Server.Network {
|
|||
m_Version = value;
|
||||
|
||||
if ( value >= m_Version7000 ) {
|
||||
m_Post7000 = m_Post60142 = m_Post6017 = true;
|
||||
_ProtocolChanges = ProtocolChanges.Version7000;
|
||||
} else if ( value >= m_Version60142 ) {
|
||||
m_Post60142 = m_Post6017 = true;
|
||||
_ProtocolChanges = ProtocolChanges.Version60142;
|
||||
} else if ( value >= m_Version6017 ) {
|
||||
m_Post6017 = true;
|
||||
_ProtocolChanges = ProtocolChanges.Version6017;
|
||||
} else if ( value >= m_Version6000 ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version6000;
|
||||
} else if ( value >= m_Version502b ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version502b;
|
||||
} else if ( value >= m_Version500a ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version500a;
|
||||
} else if ( value >= m_Version407a ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version407a;
|
||||
} else if ( value >= m_Version400a ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version400a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ExtendedSupportedFeatures
|
||||
{
|
||||
get { return m_Post60142; }
|
||||
private static ClientVersion m_Version400a = new ClientVersion( "4.0.0a" );
|
||||
private static ClientVersion m_Version407a = new ClientVersion( "4.0.7a" );
|
||||
private static ClientVersion m_Version500a = new ClientVersion( "5.0.0a" );
|
||||
private static ClientVersion m_Version502b = new ClientVersion( "5.0.2b" );
|
||||
private static ClientVersion m_Version6000 = new ClientVersion( "6.0.0.0" );
|
||||
private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" );
|
||||
private static ClientVersion m_Version60142 = new ClientVersion( "6.0.14.2" );
|
||||
private static ClientVersion m_Version7000 = new ClientVersion( "7.0.0.0" );
|
||||
|
||||
private ProtocolChanges _ProtocolChanges;
|
||||
|
||||
private enum ProtocolChanges {
|
||||
NewSpellbook = 0x00000001,
|
||||
DamagePacket = 0x00000002,
|
||||
Unpack = 0x00000004,
|
||||
BuffIcon = 0x00000008,
|
||||
NewHaven = 0x00000010,
|
||||
ContainerGridLines = 0x00000020,
|
||||
ExtendedSupportedFeatures = 0x00000040,
|
||||
StygianAbyss = 0x00000080,
|
||||
|
||||
Version400a = NewSpellbook,
|
||||
Version407a = Version400a | DamagePacket,
|
||||
Version500a = Version407a | Unpack,
|
||||
Version502b = Version500a | BuffIcon,
|
||||
Version6000 = Version502b | NewHaven,
|
||||
Version6017 = Version6000 | ContainerGridLines,
|
||||
Version60142 = Version6017 | ExtendedSupportedFeatures,
|
||||
Version7000 = Version60142 | StygianAbyss
|
||||
}
|
||||
|
||||
public bool IsUOTDClient
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((m_Flags & 0x100) != 0 || (m_Version != null && m_Version.Type == ClientType.UOTD));
|
||||
public bool NewSpellbook { get { return ((_ProtocolChanges & ProtocolChanges.NewSpellbook) != 0); } }
|
||||
public bool DamagePacket { get { return ((_ProtocolChanges & ProtocolChanges.DamagePacket) != 0); } }
|
||||
public bool Unpack { get { return ((_ProtocolChanges & ProtocolChanges.Unpack) != 0); } }
|
||||
public bool BuffIcon { get { return ((_ProtocolChanges & ProtocolChanges.BuffIcon) != 0); } }
|
||||
public bool NewHaven { get { return ((_ProtocolChanges & ProtocolChanges.NewHaven) != 0); } }
|
||||
public bool ContainerGridLines { get { return ((_ProtocolChanges & ProtocolChanges.ContainerGridLines) != 0); } }
|
||||
public bool ExtendedSupportedFeatures { get { return ((_ProtocolChanges & ProtocolChanges.ExtendedSupportedFeatures) != 0); } }
|
||||
public bool StygianAbyss { get { return ((_ProtocolChanges & ProtocolChanges.StygianAbyss) != 0); } }
|
||||
|
||||
public bool IsUOTDClient {
|
||||
get {
|
||||
return ( (m_Flags & ClientFlags.UOTD) != 0 || m_Version.Type == ClientType.UOTD );
|
||||
}
|
||||
}
|
||||
|
||||
private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" );
|
||||
private static ClientVersion m_Version60142 = new ClientVersion( "6.0.14.2" );
|
||||
private static ClientVersion m_Version7000 = new ClientVersion( "7.0.0.0" );
|
||||
|
||||
private bool m_Post6017;
|
||||
private bool m_Post60142;
|
||||
private bool m_Post7000;
|
||||
|
||||
public bool IsPost6017 {
|
||||
get {
|
||||
return m_Post6017;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPost60142 {
|
||||
get {
|
||||
return m_Post60142;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPost7000 {
|
||||
get {
|
||||
return m_Post7000;
|
||||
public bool IsSAClient {
|
||||
get {
|
||||
return ( m_Version.Type == ClientType.SA );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -574,7 +597,7 @@ namespace Server.Network {
|
|||
|
||||
public PacketHandler GetHandler( int packetID )
|
||||
{
|
||||
if ( IsPost6017 )
|
||||
if ( ContainerGridLines )
|
||||
return PacketHandlers.Get6017Handler( packetID );
|
||||
else
|
||||
return PacketHandlers.GetHandler( packetID );
|
||||
|
|
@ -949,7 +972,7 @@ namespace Server.Network {
|
|||
for ( int i = ExpansionInfo.Table.Length - 1; i >= 0; i-- ) {
|
||||
ExpansionInfo info = ExpansionInfo.Table[i];
|
||||
|
||||
if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.NetStateFlag ) != 0 ) ) {
|
||||
if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.ClientFlags ) != 0 ) ) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
@ -971,7 +994,7 @@ namespace Server.Network {
|
|||
if ( info.RequiredClient != null )
|
||||
return ( this.Version >= info.RequiredClient );
|
||||
|
||||
return ( ( this.Flags & info.NetStateFlag ) != 0 );
|
||||
return ( ( this.Flags & info.ClientFlags ) != 0 );
|
||||
}
|
||||
|
||||
public bool SupportsExpansion( Expansion ex, bool checkCoreExpansion ) {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ namespace Server.Network
|
|||
Register( 0xD1, 2, true, new OnPacketReceive( LogoutReq ) );
|
||||
Register( 0xD6, 0, true, new OnPacketReceive( BatchQueryProperties ) );
|
||||
Register( 0xD7, 0, true, new OnPacketReceive( EncodedCommand ) );
|
||||
Register( 0xE1, 0, false, new OnPacketReceive( ClientType ) );
|
||||
Register( 0xEF, 21, false, new OnPacketReceive( LoginServerSeed ) );
|
||||
|
||||
Register6017( 0x08, 15, true, new OnPacketReceive( DropReq6017 ) );
|
||||
|
|
@ -1235,7 +1236,7 @@ namespace Server.Network
|
|||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if ( state.IsPost7000 ) {
|
||||
if ( state.StygianAbyss ) {
|
||||
state.Send( new MobileUpdate( m ) );
|
||||
state.Send( new MobileIncoming( m, m ) );
|
||||
} else {
|
||||
|
|
@ -1823,6 +1824,16 @@ namespace Server.Network
|
|||
EventSink.InvokeClientVersionReceived( new ClientVersionReceivedArgs( state, version ) );
|
||||
}
|
||||
|
||||
public static void ClientType( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
pvSrc.ReadUInt16();
|
||||
|
||||
int type = pvSrc.ReadUInt16();
|
||||
CV version = state.Version = new CV( pvSrc.ReadString() );
|
||||
|
||||
//EventSink.InvokeClientVersionReceived( new ClientVersionReceivedArgs( state, version ) );//todo
|
||||
}
|
||||
|
||||
public static void MobileQuery( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
|
@ -1936,7 +1947,7 @@ namespace Server.Network
|
|||
|
||||
state.BlockAllPackets = true;
|
||||
|
||||
state.Flags = flags;
|
||||
state.Flags = (ClientFlags)flags;
|
||||
|
||||
state.Mobile = m;
|
||||
m.NetState = state;
|
||||
|
|
@ -1961,7 +1972,7 @@ namespace Server.Network
|
|||
|
||||
state.Sequence = 0;
|
||||
|
||||
if ( state.IsPost7000 ) {
|
||||
if ( state.StygianAbyss ) {
|
||||
state.Send( new MobileUpdate( m ) );
|
||||
state.Send( new MobileUpdate( m ) );
|
||||
|
||||
|
|
@ -2069,7 +2080,7 @@ namespace Server.Network
|
|||
|
||||
Race race = null;
|
||||
|
||||
if ( state.IsPost7000 ) {
|
||||
if ( state.StygianAbyss ) {
|
||||
byte raceID = (byte)(genderRace < 4 ? 0 : ((genderRace / 2) - 1));
|
||||
race = Race.Races[raceID];
|
||||
} else {
|
||||
|
|
@ -2101,7 +2112,7 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
state.Flags = flags;
|
||||
state.Flags = (ClientFlags)flags;
|
||||
|
||||
CharacterCreatedEventArgs args = new CharacterCreatedEventArgs(
|
||||
state, a,
|
||||
|
|
|
|||
|
|
@ -89,8 +89,6 @@ namespace Server.Network
|
|||
|
||||
public sealed class DamagePacket : Packet
|
||||
{
|
||||
public static readonly ClientVersion Version = new ClientVersion( "4.0.7a" );
|
||||
|
||||
public DamagePacket( Mobile m, int amount ) : base( 0x0B, 7 )
|
||||
{
|
||||
m_Stream.Write( (int) m.Serial );
|
||||
|
|
@ -1075,6 +1073,45 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class WorldItemSA : Packet
|
||||
{
|
||||
public WorldItemSA( Item item ) : base( 0xF3, 24 )
|
||||
{
|
||||
m_Stream.Write( (short) 0x1 );
|
||||
|
||||
int itemID = item.ItemID;
|
||||
|
||||
if ( item is BaseMulti ) {
|
||||
m_Stream.Write( (byte) 0x02 );
|
||||
itemID &= 0x3FFF;
|
||||
} else {
|
||||
m_Stream.Write( (byte) 0x00 );
|
||||
itemID &= 0x7FFF;
|
||||
}
|
||||
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
|
||||
m_Stream.Write( (short) itemID );
|
||||
|
||||
m_Stream.Write( (byte) item.Direction );
|
||||
|
||||
int amount = item.Amount;
|
||||
m_Stream.Write( (short) amount );
|
||||
m_Stream.Write( (short) amount );
|
||||
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.m_X & 0x7FFF;
|
||||
int y = loc.m_Y & 0x3FFF;
|
||||
m_Stream.Write( (short) x );
|
||||
m_Stream.Write( (short) y );
|
||||
m_Stream.Write( (sbyte) loc.m_Z );
|
||||
|
||||
m_Stream.Write( (byte) item.Light );
|
||||
m_Stream.Write( (short) item.Hue );
|
||||
m_Stream.Write( (byte) item.GetPacketFlags() );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class LiftRej : Packet
|
||||
{
|
||||
public LiftRej( LRReason reason ) : base( 0x27, 2 )
|
||||
|
|
@ -2515,9 +2552,9 @@ namespace Server.Network
|
|||
|
||||
public sealed class SupportedFeatures : Packet
|
||||
{
|
||||
private static int m_AdditionalFlags;
|
||||
private static FeatureFlags m_AdditionalFlags;
|
||||
|
||||
public static int Value{ get{ return m_AdditionalFlags; } set{ m_AdditionalFlags = value; } }
|
||||
public static FeatureFlags Value{ get{ return m_AdditionalFlags; } set{ m_AdditionalFlags = value; } }
|
||||
|
||||
public static SupportedFeatures Instantiate( NetState ns )
|
||||
{
|
||||
|
|
@ -2526,25 +2563,21 @@ namespace Server.Network
|
|||
|
||||
public SupportedFeatures( NetState ns ) : base( 0xB9, ns.ExtendedSupportedFeatures ? 5 : 3 )
|
||||
{
|
||||
int flags = ExpansionInfo.CurrentExpansion.SupportedFeatures;
|
||||
FeatureFlags flags = ExpansionInfo.CurrentExpansion.SupportedFeatures;
|
||||
|
||||
flags |= m_AdditionalFlags;
|
||||
/*
|
||||
int flags = 0x3 | m_AdditionalFlags;
|
||||
|
||||
if ( Core.SE )
|
||||
flags |= 0x0040;
|
||||
|
||||
if ( Core.AOS )
|
||||
flags |= 0x801C;
|
||||
* */
|
||||
|
||||
IAccount acct = ns.Account as IAccount;
|
||||
|
||||
if ( acct != null && acct.Limit >= 6 )
|
||||
{
|
||||
flags |= 0x8020;
|
||||
flags &= ~0x004;
|
||||
flags |= FeatureFlags.Unk7;
|
||||
flags &= ~FeatureFlags.UOTD;
|
||||
|
||||
if ( acct.Limit > 6 )
|
||||
flags |= FeatureFlags.SeventhCharacterSlot;
|
||||
else
|
||||
flags |= FeatureFlags.SixthCharacterSlot;
|
||||
}
|
||||
|
||||
if ( ns.ExtendedSupportedFeatures ) {
|
||||
|
|
@ -2552,8 +2585,6 @@ namespace Server.Network
|
|||
} else {
|
||||
m_Stream.Write( (ushort) flags );
|
||||
}
|
||||
|
||||
//m_Stream.Write( (ushort) m_Value ); // 0x01 = T2A, 0x02 = LBR
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3591,28 +3622,22 @@ namespace Server.Network
|
|||
m_Stream.WriteAsciiFixed( ci.City, 31 );
|
||||
m_Stream.WriteAsciiFixed( ci.Building, 31 );
|
||||
}
|
||||
/*
|
||||
int flags = 0x08; //Context Menus
|
||||
|
||||
if ( Core.SE )
|
||||
flags |= 0xA0; //SE & AOS
|
||||
else if ( Core.AOS )
|
||||
flags |= 0x20; //AOS
|
||||
* */
|
||||
CharacterListFlags flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
|
||||
|
||||
int flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
|
||||
|
||||
if ( count >= 6 )
|
||||
flags |= 0x40; // 6th character slot
|
||||
if ( count > 6 )
|
||||
flags |= (CharacterListFlags.SeventhCharacterSlot | CharacterListFlags.SixthCharacterSlot); // 7th Character Slot - TODO: Is SixthCharacterSlot Required?
|
||||
else if ( count == 6 )
|
||||
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
|
||||
else if ( a.Limit == 1 )
|
||||
flags |= 0x14; // Limit characters & one character
|
||||
flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character
|
||||
|
||||
m_Stream.Write( (int)(flags | m_AdditionalFlags) ); // flags
|
||||
m_Stream.Write( (int)(flags | m_AdditionalFlags) ); // Additional Flags
|
||||
}
|
||||
|
||||
private static int m_AdditionalFlags;
|
||||
private static CharacterListFlags m_AdditionalFlags;
|
||||
|
||||
public static int AdditionalFlags
|
||||
public static CharacterListFlags AdditionalFlags
|
||||
{
|
||||
get{ return m_AdditionalFlags; }
|
||||
set{ m_AdditionalFlags = value; }
|
||||
|
|
@ -3633,12 +3658,12 @@ namespace Server.Network
|
|||
|
||||
public enum ALRReason : byte
|
||||
{
|
||||
Invalid = 0x00,
|
||||
InUse = 0x01,
|
||||
Blocked = 0x02,
|
||||
BadPass = 0x03,
|
||||
Idle = 0xFE,
|
||||
BadComm = 0xFF
|
||||
Invalid = 0x00,
|
||||
InUse = 0x01,
|
||||
Blocked = 0x02,
|
||||
BadPass = 0x03,
|
||||
Idle = 0xFE,
|
||||
BadComm = 0xFF
|
||||
}
|
||||
|
||||
public sealed class AccountLoginRej : Packet
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue