fix: Removes support for v4 Client and old gump packet. (#1739)
### Summary * Removes old gump packet support * Removes support for v4 clients * Removes `Unpack` flag and assumes it is always true. * Removes StringToBuffer since this is built into .NET now. > [!Note] > View the file changes with white space off: https://github.com/modernuo/ModernUO/pull/1739/files?diff=split&w=1
This commit is contained in:
parent
98d31bc707
commit
9cd84ba3d6
14 changed files with 1015 additions and 1191 deletions
|
|
@ -2,122 +2,115 @@ using Server.Gumps;
|
|||
using Server.Network;
|
||||
using Xunit;
|
||||
|
||||
namespace Server.Tests.Network
|
||||
namespace Server.Tests.Network;
|
||||
|
||||
public class GumpPacketTests : IClassFixture<ServerFixture>
|
||||
{
|
||||
public class GumpPacketTests : IClassFixture<ServerFixture>
|
||||
[Theory]
|
||||
[InlineData(100, 10)]
|
||||
public void TestCloseGump(int typeId, int buttonId)
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(100, 10)]
|
||||
public void TestCloseGump(int typeId, int buttonId)
|
||||
{
|
||||
var expected = new CloseGump(typeId, buttonId).Compile();
|
||||
var expected = new CloseGump(typeId, buttonId).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendCloseGump(typeId, buttonId);
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendCloseGump(typeId, buttonId);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestDisplaySignGump()
|
||||
{
|
||||
Serial gumpSerial = (Serial)0x1000;
|
||||
const int gumpId = 100;
|
||||
const string unknownString = "This is an unknown string";
|
||||
const string caption = "This is a caption";
|
||||
|
||||
var expected = new DisplaySignGump(gumpSerial, gumpId, unknownString, caption).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendDisplaySignGump(gumpSerial, gumpId, unknownString, caption);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.None)]
|
||||
[InlineData(ProtocolChanges.Unpack)]
|
||||
public void TestGumpPacketNameChange(ProtocolChanges changes)
|
||||
{
|
||||
var gump = new NameChangeDeedGump();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = gump.Compile(ns).Compile();
|
||||
|
||||
ns.SendDisplayGump(gump, out _, out _);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.None)]
|
||||
[InlineData(ProtocolChanges.Unpack)]
|
||||
public void TestGumpPacketAdmin(ProtocolChanges changes)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.RawName = "Test Mobile";
|
||||
m.AccessLevel = AccessLevel.Administrator;
|
||||
|
||||
var gump = new AdminGump(m, AdminGumpPage.Clients);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = gump.Compile(ns).Compile();
|
||||
|
||||
ns.SendDisplayGump(gump, out _, out _);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
public class NameChangeDeedGump : Gump
|
||||
[Fact]
|
||||
public void TestDisplaySignGump()
|
||||
{
|
||||
public NameChangeDeedGump() : base(50, 50)
|
||||
{
|
||||
Closable = false;
|
||||
Draggable = false;
|
||||
Resizable = false;
|
||||
Serial gumpSerial = (Serial)0x1000;
|
||||
const int gumpId = 100;
|
||||
const string unknownString = "This is an unknown string";
|
||||
const string caption = "This is a caption";
|
||||
|
||||
AddPage(0);
|
||||
var expected = new DisplaySignGump(gumpSerial, gumpId, unknownString, caption).Compile();
|
||||
|
||||
AddBlackAlpha(10, 120, 250, 85);
|
||||
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendDisplaySignGump(gumpSerial, gumpId, unknownString, caption);
|
||||
|
||||
AddLabel(73, 15, 1152, "");
|
||||
AddLabel(20, 150, 0x480, "New Name:");
|
||||
AddTextField(100, 150, 150, 20, 0);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
AddButtonLabeled(75, 180, 1, "Submit");
|
||||
}
|
||||
[Fact]
|
||||
public void TestGumpPacketNameChange()
|
||||
{
|
||||
var gump = new NameChangeDeedGump();
|
||||
|
||||
public void AddBlackAlpha(int x, int y, int width, int height)
|
||||
{
|
||||
AddImageTiled(x, y, width, height, 2624);
|
||||
AddAlphaRegion(x, y, width, height);
|
||||
}
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
|
||||
public void AddTextField(int x, int y, int width, int height, int index)
|
||||
{
|
||||
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
|
||||
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
|
||||
}
|
||||
var expected = gump.Compile(ns).Compile();
|
||||
|
||||
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
ns.SendDisplayGump(gump, out _, out _);
|
||||
|
||||
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
||||
{
|
||||
AddButton(x, y - 1, 4005, 4007, buttonID);
|
||||
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
|
||||
}
|
||||
[Fact]
|
||||
public void TestGumpPacketAdmin()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.RawName = "Test Mobile";
|
||||
m.AccessLevel = AccessLevel.Administrator;
|
||||
|
||||
var gump = new AdminGump(m, AdminGumpPage.Clients);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
|
||||
var expected = gump.Compile(ns).Compile();
|
||||
|
||||
ns.SendDisplayGump(gump, out _, out _);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
|
||||
public class NameChangeDeedGump : Gump
|
||||
{
|
||||
public NameChangeDeedGump() : base(50, 50)
|
||||
{
|
||||
Closable = false;
|
||||
Draggable = false;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBlackAlpha(10, 120, 250, 85);
|
||||
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
|
||||
|
||||
AddLabel(73, 15, 1152, "");
|
||||
AddLabel(20, 150, 0x480, "New Name:");
|
||||
AddTextField(100, 150, 150, 20, 0);
|
||||
|
||||
AddButtonLabeled(75, 180, 1, "Submit");
|
||||
}
|
||||
|
||||
public void AddBlackAlpha(int x, int y, int width, int height)
|
||||
{
|
||||
AddImageTiled(x, y, width, height, 2624);
|
||||
AddAlphaRegion(x, y, width, height);
|
||||
}
|
||||
|
||||
public void AddTextField(int x, int y, int width, int height, int index)
|
||||
{
|
||||
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
|
||||
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
|
||||
}
|
||||
|
||||
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
|
||||
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
||||
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
||||
{
|
||||
AddButton(x, y - 1, 4005, 4007, buttonID);
|
||||
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
|
|
@ -20,7 +20,7 @@ namespace Server.Tests
|
|||
void AppendLayoutNS(int val);
|
||||
void AppendLayout(string text);
|
||||
void AppendLayoutNS(string text);
|
||||
void AppendLayout(byte[] buffer);
|
||||
void AppendLayout(ReadOnlySpan<byte> buffer);
|
||||
void WriteStrings(List<string> strings);
|
||||
void Flush();
|
||||
}
|
||||
|
|
@ -39,12 +39,6 @@ namespace Server.Tests
|
|||
|
||||
public sealed class DisplayGumpPacked : Packet, IGumpWriter
|
||||
{
|
||||
private static readonly byte[] m_True = Gump.StringToBuffer(" 1");
|
||||
private static readonly byte[] m_False = Gump.StringToBuffer(" 0");
|
||||
|
||||
private static readonly byte[] m_BeginTextSeparator = Gump.StringToBuffer(" @");
|
||||
private static readonly byte[] m_EndTextSeparator = Gump.StringToBuffer("@");
|
||||
|
||||
private static readonly byte[] m_Buffer = new byte[48];
|
||||
|
||||
private readonly Gump m_Gump;
|
||||
|
|
@ -71,7 +65,7 @@ namespace Server.Tests
|
|||
|
||||
public void AppendLayout(bool val)
|
||||
{
|
||||
AppendLayout(val ? m_True : m_False);
|
||||
AppendLayout(val ? " 1"u8 : " 0"u8);
|
||||
}
|
||||
|
||||
public void AppendLayout(int val)
|
||||
|
|
@ -107,16 +101,16 @@ namespace Server.Tests
|
|||
|
||||
public void AppendLayout(string text)
|
||||
{
|
||||
AppendLayout(m_BeginTextSeparator);
|
||||
AppendLayout(" @"u8);
|
||||
|
||||
m_Layout.WriteAsciiFixed(text, text.Length);
|
||||
|
||||
AppendLayout(m_EndTextSeparator);
|
||||
AppendLayout("@"u8);
|
||||
}
|
||||
|
||||
public void AppendLayout(byte[] buffer)
|
||||
public void AppendLayout(ReadOnlySpan<byte> buffer)
|
||||
{
|
||||
m_Layout.Write(buffer, 0, buffer.Length);
|
||||
m_Layout.Write(buffer);
|
||||
}
|
||||
|
||||
public void WriteStrings(List<string> strings)
|
||||
|
|
@ -184,117 +178,6 @@ namespace Server.Tests
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class DisplayGumpFast : Packet, IGumpWriter
|
||||
{
|
||||
private static readonly byte[] m_True = Gump.StringToBuffer(" 1");
|
||||
private static readonly byte[] m_False = Gump.StringToBuffer(" 0");
|
||||
|
||||
private static readonly byte[] m_BeginTextSeparator = Gump.StringToBuffer(" @");
|
||||
private static readonly byte[] m_EndTextSeparator = Gump.StringToBuffer("@");
|
||||
|
||||
private readonly byte[] m_Buffer = new byte[48];
|
||||
private int m_LayoutLength;
|
||||
|
||||
public DisplayGumpFast(Gump g) : base(0xB0)
|
||||
{
|
||||
m_Buffer[0] = (byte)' ';
|
||||
|
||||
EnsureCapacity(4096);
|
||||
|
||||
Stream.Write(g.Serial);
|
||||
Stream.Write(g.TypeID);
|
||||
Stream.Write(g.X);
|
||||
Stream.Write(g.Y);
|
||||
Stream.Write((ushort)0xFFFF);
|
||||
}
|
||||
|
||||
public int TextEntries { get; set; }
|
||||
|
||||
public int Switches { get; set; }
|
||||
|
||||
public void AppendLayout(bool val)
|
||||
{
|
||||
AppendLayout(val ? m_True : m_False);
|
||||
}
|
||||
|
||||
public void AppendLayout(int val)
|
||||
{
|
||||
var toString = val.ToString();
|
||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1) + 1;
|
||||
|
||||
Stream.Write(m_Buffer, 0, bytes);
|
||||
m_LayoutLength += bytes;
|
||||
}
|
||||
|
||||
public void AppendLayout(uint val)
|
||||
{
|
||||
var toString = val.ToString();
|
||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1) + 1;
|
||||
|
||||
Stream.Write(m_Buffer, 0, bytes);
|
||||
m_LayoutLength += bytes;
|
||||
}
|
||||
|
||||
public void AppendLayout(Serial serial) => AppendLayout(serial.Value);
|
||||
|
||||
public void AppendLayoutNS(int val)
|
||||
{
|
||||
var toString = val.ToString();
|
||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1);
|
||||
|
||||
Stream.Write(m_Buffer, 1, bytes);
|
||||
m_LayoutLength += bytes;
|
||||
}
|
||||
|
||||
public void AppendLayoutNS(string text)
|
||||
{
|
||||
var length = text.Length;
|
||||
Stream.WriteAsciiFixed(text, length);
|
||||
m_LayoutLength += length;
|
||||
}
|
||||
|
||||
public void AppendLayout(string text)
|
||||
{
|
||||
AppendLayout(m_BeginTextSeparator);
|
||||
|
||||
var length = text.Length;
|
||||
Stream.WriteAsciiFixed(text, length);
|
||||
m_LayoutLength += length;
|
||||
|
||||
AppendLayout(m_EndTextSeparator);
|
||||
}
|
||||
|
||||
public void AppendLayout(byte[] buffer)
|
||||
{
|
||||
var length = buffer.Length;
|
||||
Stream.Write(buffer, 0, length);
|
||||
m_LayoutLength += length;
|
||||
}
|
||||
|
||||
public void WriteStrings(List<string> text)
|
||||
{
|
||||
Stream.Seek(19, SeekOrigin.Begin);
|
||||
Stream.Write((ushort)m_LayoutLength);
|
||||
Stream.Seek(0, SeekOrigin.End);
|
||||
|
||||
Stream.Write((ushort)text.Count);
|
||||
|
||||
for (var i = 0; i < text.Count; ++i)
|
||||
{
|
||||
var v = text[i] ?? "";
|
||||
|
||||
int length = (ushort)v.Length;
|
||||
|
||||
Stream.Write((ushort)length);
|
||||
Stream.WriteBigUniFixed(v, length);
|
||||
}
|
||||
}
|
||||
|
||||
public void Flush()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DisplaySignGump : Packet
|
||||
{
|
||||
public DisplaySignGump(Serial serial, int gumpID, string unknown, string caption) : base(0x8B)
|
||||
|
|
|
|||
|
|
@ -1,505 +1,502 @@
|
|||
using Server.Network;
|
||||
using Xunit;
|
||||
|
||||
namespace Server.Tests.Network
|
||||
namespace Server.Tests.Network;
|
||||
|
||||
[Collection("Sequential Tests")]
|
||||
public class MobilePacketTests : IClassFixture<ServerFixture>
|
||||
{
|
||||
[Collection("Sequential Tests")]
|
||||
public class MobilePacketTests : IClassFixture<ServerFixture>
|
||||
[Fact]
|
||||
public void TestDeathAnimation()
|
||||
{
|
||||
[Fact]
|
||||
public void TestDeathAnimation()
|
||||
Serial killed = (Serial)0x1;
|
||||
Serial corpse = (Serial)0x1000;
|
||||
|
||||
var expected = new DeathAnimation(killed, corpse).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendDeathAnimation(killed, corpse);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestBondStatus()
|
||||
{
|
||||
Serial petSerial = (Serial)0x1;
|
||||
const bool bonded = true;
|
||||
|
||||
var expected = new BondedStatus(petSerial, bonded).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendBondedStatus(petSerial, bonded);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.StygianAbyss)]
|
||||
[InlineData(ProtocolChanges.None)]
|
||||
public void TestMobileMoving(ProtocolChanges protocolChanges)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var noto = 10;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = protocolChanges;
|
||||
var expected = new MobileMoving(m, noto, ns.StygianAbyss).Compile();
|
||||
|
||||
ns.SendMobileMoving(m, noto);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("Kamron")]
|
||||
[InlineData("Some Really Long Mobile Name That Gets Cut off")]
|
||||
public void TestMobileName(string name)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1) { Name = name };
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var expected = new MobileName(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileName(m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(200, 5, 1, false, false, 5)]
|
||||
[InlineData(10, 100, 25, true, false, 0)]
|
||||
public void TestMobileAnimation(int action, int frameCount, int repeatCount, bool reverse, bool repeat, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
|
||||
var expected = new MobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
repeatCount,
|
||||
!reverse,
|
||||
repeat,
|
||||
delay
|
||||
).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
repeatCount,
|
||||
!reverse,
|
||||
repeat,
|
||||
delay
|
||||
);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(200, 5, 5)]
|
||||
[InlineData(10, 100, 20)]
|
||||
public void TestNewMobileAnimation(int action, int frameCount, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
|
||||
var expected = new NewMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
delay
|
||||
).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendNewMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
delay
|
||||
);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("None")]
|
||||
[InlineData("Lesser")]
|
||||
[InlineData("Lethal")]
|
||||
public void TestHealthbarPoison(string pName)
|
||||
{
|
||||
var p = Poison.GetPoison(pName);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Poison = p;
|
||||
|
||||
var expected = new HealthbarPoison(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false, false)]
|
||||
[InlineData(true, false)]
|
||||
[InlineData(false, true)]
|
||||
[InlineData(true, true)]
|
||||
public void TestYellowBar(bool isBlessed, bool isYellowHealth)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Blessed = isBlessed;
|
||||
m.YellowHealthbar = isYellowHealth;
|
||||
|
||||
var expected = new HealthbarYellow(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void TestMobileStatusCompact(bool canBeRenamed)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
var expected = new MobileStatusCompact(canBeRenamed, m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStatusCompact(m, canBeRenamed);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70610)]
|
||||
[InlineData(ProtocolChanges.Version502b)]
|
||||
public void TestMobileStatus(ProtocolChanges changes)
|
||||
{
|
||||
var beholder = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
beholder.DefaultMobileInit();
|
||||
beholder.Str = 50;
|
||||
beholder.Hits = 100;
|
||||
beholder.Int = 75;
|
||||
beholder.Mana = 100;
|
||||
beholder.Dex = 25;
|
||||
beholder.Stam = 100;
|
||||
|
||||
var beheld = new Mobile((Serial)0x2) { Name = "Random Mobile 2" };
|
||||
beheld.DefaultMobileInit();
|
||||
beheld.Str = 50;
|
||||
beheld.Hits = 100;
|
||||
beheld.Int = 75;
|
||||
beheld.Mana = 100;
|
||||
beheld.Dex = 25;
|
||||
beheld.Stam = 100;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = new MobileStatus(beholder, beheld, ns).Compile();
|
||||
ns.SendMobileStatus(beholder, beheld);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70610, "7.0.61.0", ClientFlags.TerMur, Expansion.HS, 6)]
|
||||
[InlineData(ProtocolChanges.Version502b, "5.0.2b", ClientFlags.Malas, Expansion.ML, 5)]
|
||||
public void TestMobileStatusExtendedSelf(
|
||||
ProtocolChanges changes,
|
||||
string version,
|
||||
ClientFlags clientFlags,
|
||||
Expansion expansion,
|
||||
int mobileStatusVersion
|
||||
)
|
||||
{
|
||||
var expansionInfo = ExpansionInfo.CoreExpansion;
|
||||
var oldExpansion = Core.Expansion;
|
||||
var oldVersion = expansionInfo.MobileStatusVersion;
|
||||
Core.Expansion = expansion;
|
||||
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
||||
|
||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
ns.Version = new ClientVersion(version);
|
||||
ns.Flags = clientFlags;
|
||||
|
||||
var expected = new MobileStatusExtended(m, ns).Compile();
|
||||
ns.SendMobileStatus(m, m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
Core.Expansion = oldExpansion;
|
||||
expansionInfo.MobileStatusVersion = oldVersion;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.None, 0)]
|
||||
[InlineData(ProtocolChanges.StygianAbyss, 100)]
|
||||
public void TestMobileUpdate(ProtocolChanges changes, int solidHueOverride)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.SolidHueOverride = solidHueOverride;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = new MobileUpdate(m, ns.StygianAbyss).Compile();
|
||||
ns.SendMobileUpdate(m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70331, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 11, 2048)]
|
||||
[InlineData(ProtocolChanges.Version6000, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 11, 2048)]
|
||||
[InlineData(ProtocolChanges.Version7000, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 11, 2048)]
|
||||
public void TestMobileIncoming(
|
||||
ProtocolChanges changes, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue
|
||||
)
|
||||
{
|
||||
var beholder = new Mobile((Serial)0x1)
|
||||
{
|
||||
Serial killed = (Serial)0x1;
|
||||
Serial corpse = (Serial)0x1000;
|
||||
Name = "Random Mobile 1"
|
||||
};
|
||||
beholder.DefaultMobileInit();
|
||||
|
||||
var expected = new DeathAnimation(killed, corpse).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendDeathAnimation(killed, corpse);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestBondStatus()
|
||||
var beheld = new Mobile((Serial)0x2)
|
||||
{
|
||||
Serial petSerial = (Serial)0x1;
|
||||
const bool bonded = true;
|
||||
|
||||
var expected = new BondedStatus(petSerial, bonded).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendBondedStatus(petSerial, bonded);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.StygianAbyss)]
|
||||
[InlineData(ProtocolChanges.None)]
|
||||
public void TestMobileMoving(ProtocolChanges protocolChanges)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var noto = 10;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = protocolChanges;
|
||||
var expected = new MobileMoving(m, noto, ns.StygianAbyss).Compile();
|
||||
|
||||
ns.SendMobileMoving(m, noto);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("Kamron")]
|
||||
[InlineData("Some Really Long Mobile Name That Gets Cut off")]
|
||||
public void TestMobileName(string name)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1) { Name = name };
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var expected = new MobileName(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileName(m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(200, 5, 1, false, false, 5)]
|
||||
[InlineData(10, 100, 25, true, false, 0)]
|
||||
public void TestMobileAnimation(int action, int frameCount, int repeatCount, bool reverse, bool repeat, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
|
||||
var expected = new MobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
repeatCount,
|
||||
!reverse,
|
||||
repeat,
|
||||
delay
|
||||
).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
repeatCount,
|
||||
!reverse,
|
||||
repeat,
|
||||
delay
|
||||
);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(200, 5, 5)]
|
||||
[InlineData(10, 100, 20)]
|
||||
public void TestNewMobileAnimation(int action, int frameCount, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
|
||||
var expected = new NewMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
delay
|
||||
).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendNewMobileAnimation(
|
||||
mobile,
|
||||
action,
|
||||
frameCount,
|
||||
delay
|
||||
);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("None")]
|
||||
[InlineData("Lesser")]
|
||||
[InlineData("Lethal")]
|
||||
public void TestHealthbarPoison(string pName)
|
||||
{
|
||||
var p = Poison.GetPoison(pName);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Poison = p;
|
||||
|
||||
var expected = new HealthbarPoison(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false, false)]
|
||||
[InlineData(true, false)]
|
||||
[InlineData(false, true)]
|
||||
[InlineData(true, true)]
|
||||
public void TestYellowBar(bool isBlessed, bool isYellowHealth)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Blessed = isBlessed;
|
||||
m.YellowHealthbar = isYellowHealth;
|
||||
|
||||
var expected = new HealthbarYellow(m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void TestMobileStatusCompact(bool canBeRenamed)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
var expected = new MobileStatusCompact(canBeRenamed, m).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStatusCompact(m, canBeRenamed);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70610)]
|
||||
[InlineData(ProtocolChanges.Version400a)]
|
||||
[InlineData(ProtocolChanges.Version502b)]
|
||||
public void TestMobileStatus(ProtocolChanges changes)
|
||||
{
|
||||
var beholder = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
beholder.DefaultMobileInit();
|
||||
beholder.Str = 50;
|
||||
beholder.Hits = 100;
|
||||
beholder.Int = 75;
|
||||
beholder.Mana = 100;
|
||||
beholder.Dex = 25;
|
||||
beholder.Stam = 100;
|
||||
|
||||
var beheld = new Mobile((Serial)0x2) { Name = "Random Mobile 2" };
|
||||
beheld.DefaultMobileInit();
|
||||
beheld.Str = 50;
|
||||
beheld.Hits = 100;
|
||||
beheld.Int = 75;
|
||||
beheld.Mana = 100;
|
||||
beheld.Dex = 25;
|
||||
beheld.Stam = 100;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = new MobileStatus(beholder, beheld, ns).Compile();
|
||||
ns.SendMobileStatus(beholder, beheld);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70610, "7.0.61.0", ClientFlags.TerMur, Expansion.HS, 6)]
|
||||
[InlineData(ProtocolChanges.Version400a, "4.0.0a", ClientFlags.Malas, Expansion.AOS, 4)]
|
||||
[InlineData(ProtocolChanges.Version502b, "5.0.2b", ClientFlags.Malas, Expansion.ML, 5)]
|
||||
public void TestMobileStatusExtendedSelf(
|
||||
ProtocolChanges changes,
|
||||
string version,
|
||||
ClientFlags clientFlags,
|
||||
Expansion expansion,
|
||||
int mobileStatusVersion
|
||||
)
|
||||
{
|
||||
var expansionInfo = ExpansionInfo.CoreExpansion;
|
||||
var oldExpansion = Core.Expansion;
|
||||
var oldVersion = expansionInfo.MobileStatusVersion;
|
||||
Core.Expansion = expansion;
|
||||
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
||||
|
||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
ns.Version = new ClientVersion(version);
|
||||
ns.Flags = clientFlags;
|
||||
|
||||
var expected = new MobileStatusExtended(m, ns).Compile();
|
||||
ns.SendMobileStatus(m, m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
Core.Expansion = oldExpansion;
|
||||
expansionInfo.MobileStatusVersion = oldVersion;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.None, 0)]
|
||||
[InlineData(ProtocolChanges.StygianAbyss, 100)]
|
||||
public void TestMobileUpdate(ProtocolChanges changes, int solidHueOverride)
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.SolidHueOverride = solidHueOverride;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var expected = new MobileUpdate(m, ns.StygianAbyss).Compile();
|
||||
ns.SendMobileUpdate(m);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ProtocolChanges.Version70331, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 11, 2048)]
|
||||
[InlineData(ProtocolChanges.Version6000, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 11, 2048)]
|
||||
[InlineData(ProtocolChanges.Version7000, 0, 0, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 0, 0)]
|
||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 11, 2048)]
|
||||
public void TestMobileIncoming(
|
||||
ProtocolChanges changes, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue
|
||||
)
|
||||
{
|
||||
var beholder = new Mobile((Serial)0x1)
|
||||
Name = "Random Mobile 2"
|
||||
};
|
||||
beheld.DefaultMobileInit();
|
||||
beheld.AddItem(
|
||||
new Item((Serial)0x1000)
|
||||
{
|
||||
Name = "Random Mobile 1"
|
||||
};
|
||||
beholder.DefaultMobileInit();
|
||||
Layer = Layer.OneHanded
|
||||
}
|
||||
);
|
||||
|
||||
var beheld = new Mobile((Serial)0x2)
|
||||
// Test Dupe
|
||||
beheld.AddItem(
|
||||
new Item((Serial)0x1001)
|
||||
{
|
||||
Name = "Random Mobile 2"
|
||||
};
|
||||
beheld.DefaultMobileInit();
|
||||
beheld.AddItem(
|
||||
new Item((Serial)0x1000)
|
||||
{
|
||||
Layer = Layer.OneHanded
|
||||
}
|
||||
);
|
||||
Layer = Layer.OneHanded
|
||||
}
|
||||
);
|
||||
|
||||
// Test Dupe
|
||||
beheld.AddItem(
|
||||
new Item((Serial)0x1001)
|
||||
{
|
||||
Layer = Layer.OneHanded
|
||||
}
|
||||
);
|
||||
beheld.HairItemID = hairItemId;
|
||||
beheld.HairHue = hairHue;
|
||||
beheld.FacialHairItemID = facialHairItemId;
|
||||
beheld.FacialHairHue = facialHairHue;
|
||||
|
||||
beheld.HairItemID = hairItemId;
|
||||
beheld.HairHue = hairHue;
|
||||
beheld.FacialHairItemID = facialHairItemId;
|
||||
beheld.FacialHairHue = facialHairHue;
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = changes;
|
||||
var expected = new MobileIncoming(ns, beholder, beheld).Compile();
|
||||
ns.SendMobileIncoming(beholder, beheld);
|
||||
|
||||
var expected = new MobileIncoming(ns, beholder, beheld).Compile();
|
||||
ns.SendMobileIncoming(beholder, beheld);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileHits()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 100;
|
||||
m.Hits = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileHits()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 100;
|
||||
m.Hits = 100;
|
||||
var expected = new MobileHits(m).Compile();
|
||||
|
||||
var expected = new MobileHits(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHits(m);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHits(m);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileHitsN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 100;
|
||||
m.Hits = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileHitsN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 100;
|
||||
m.Hits = 100;
|
||||
var expected = new MobileHitsN(m).Compile();
|
||||
|
||||
var expected = new MobileHitsN(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHits(m, true);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileHits(m, true);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileMana()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileMana()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
var expected = new MobileMana(m).Compile();
|
||||
|
||||
var expected = new MobileMana(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileMana(m);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileMana(m);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileManaN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileManaN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
var expected = new MobileManaN(m).Compile();
|
||||
|
||||
var expected = new MobileManaN(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileMana(m, true);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileMana(m, true);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileStam()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Dex = 75;
|
||||
m.Stam = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStam()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Dex = 75;
|
||||
m.Stam = 100;
|
||||
var expected = new MobileStam(m).Compile();
|
||||
|
||||
var expected = new MobileStam(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStam(m);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStam(m);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileStamN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Dex = 75;
|
||||
m.Stam = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileStamN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Dex = 75;
|
||||
m.Stam = 100;
|
||||
var expected = new MobileStamN(m).Compile();
|
||||
|
||||
var expected = new MobileStamN(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStam(m, true);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileStam(m, true);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileAttributes()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributes()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
var expected = new MobileAttributes(m).Compile();
|
||||
|
||||
var expected = new MobileAttributes(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAttributes(m);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAttributes(m);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestMobileAttributesN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
|
||||
[Fact]
|
||||
public void TestMobileAttributesN()
|
||||
{
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
m.Str = 50;
|
||||
m.Hits = 100;
|
||||
m.Int = 75;
|
||||
m.Mana = 100;
|
||||
m.Dex = 25;
|
||||
m.Stam = 100;
|
||||
var expected = new MobileAttributesN(m).Compile();
|
||||
|
||||
var expected = new MobileAttributesN(m).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAttributes(m, true);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendMobileAttributes(m, true);
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
[Fact]
|
||||
public void TestRemoveEntity()
|
||||
{
|
||||
Serial e = (Serial)0x1000;
|
||||
var expected = new RemoveEntity(e).Compile();
|
||||
|
||||
[Fact]
|
||||
public void TestRemoveEntity()
|
||||
{
|
||||
Serial e = (Serial)0x1000;
|
||||
var expected = new RemoveEntity(e).Compile();
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendRemoveEntity(e);
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendRemoveEntity(e);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue