Adds more packet tests (#173)

This commit is contained in:
Kamron Batman 2020-07-05 20:14:23 -07:00 committed by GitHub
parent f868c34678
commit 9d4bc7cda2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1015 additions and 33 deletions

View file

@ -630,7 +630,7 @@ namespace Server.Network
{
var info = ExpansionInfo.Table[i];
if ((info.RequiredClient != null && Version >= info.RequiredClient) || (Flags & info.ClientFlags) != 0)
if (info.RequiredClient != null && Version >= info.RequiredClient || (Flags & info.ClientFlags) != 0)
return info;
}
@ -642,13 +642,10 @@ namespace Server.Network
public ProtocolChanges ProtocolChanges { get; set; }
public bool SupportsExpansion(ExpansionInfo info, bool checkCoreExpansion = true)
{
if (info == null || (checkCoreExpansion && (int)Core.Expansion < info.ID))
return false;
return info.RequiredClient != null ? Version >= info.RequiredClient : (Flags & info.ClientFlags) != 0;
}
public bool SupportsExpansion(ExpansionInfo info, bool checkCoreExpansion = true) =>
info != null && (!checkCoreExpansion || (int)Core.Expansion >= info.ID) && (info.RequiredClient != null
? Version >= info.RequiredClient
: (Flags & info.ClientFlags) != 0);
public bool SupportsExpansion(Expansion ex, bool checkCoreExpansion = true) =>
SupportsExpansion(ExpansionInfo.GetInfo(ex), checkCoreExpansion);

View file

@ -68,7 +68,6 @@ namespace Server.Network
}
}
// Pre-7.0.0.0 Mobile Moving
public sealed class MobileMovingOld : Packet
{
public MobileMovingOld(Mobile m, int noto) : base(0x77, 17)
@ -178,7 +177,6 @@ namespace Server.Network
}
}
// unsure of proper format, client crashes
public sealed class MobileName : Packet
{
public MobileName(Mobile m) : base(0x98)
@ -186,7 +184,8 @@ namespace Server.Network
EnsureCapacity(37);
Stream.Write(m.Serial);
Stream.WriteAsciiFixed(m.Name ?? "", 30);
Stream.WriteAsciiFixed(m.Name ?? "", 29);
Stream.Write((byte)0); // Null terminator
}
}