fix(core): Removes implicit cast between Serial and uint (#728)
* Fixes spellbooks using serial ctor * Fixes misc items where someone thought they had an amount and it didn't * Fixes all `Food` types.
This commit is contained in:
parent
17521c9cd7
commit
0dc4acc164
74 changed files with 319 additions and 248 deletions
|
|
@ -12,7 +12,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestPartyEmptyList()
|
||||
{
|
||||
Serial m = 0x1024u;
|
||||
Serial m = (Serial)0x1024u;
|
||||
|
||||
var expected = new PartyEmptyList(m).Compile();
|
||||
|
||||
|
|
@ -26,10 +26,10 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestPartyRemoveMember()
|
||||
{
|
||||
var leader = new Mobile(0x1024u);
|
||||
var leader = new Mobile((Serial)0x1024u);
|
||||
leader.DefaultMobileInit();
|
||||
|
||||
var member = new Mobile(0x2048u);
|
||||
var member = new Mobile((Serial)0x2048u);
|
||||
member.DefaultMobileInit();
|
||||
|
||||
var p = new Party(leader);
|
||||
|
|
@ -47,10 +47,10 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestPartyMemberList()
|
||||
{
|
||||
var leader = new Mobile(0x1024u);
|
||||
var leader = new Mobile((Serial)0x1024u);
|
||||
leader.DefaultMobileInit();
|
||||
|
||||
var member = new Mobile(0x2048u);
|
||||
var member = new Mobile((Serial)0x2048u);
|
||||
member.DefaultMobileInit();
|
||||
|
||||
var p = new Party(leader);
|
||||
|
|
@ -70,7 +70,7 @@ namespace UOContent.Tests
|
|||
[InlineData(false)]
|
||||
public void TestPartyTextMessage(bool toAll)
|
||||
{
|
||||
Serial serial = 0x1024u;
|
||||
Serial serial = (Serial)0x1024u;
|
||||
var text = "[Party] Stuff Happens";
|
||||
|
||||
var expected = new PartyTextMessage(toAll, serial, text).Compile();
|
||||
|
|
@ -85,7 +85,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestPartyInvitation()
|
||||
{
|
||||
Serial m = 0x1024u;
|
||||
Serial m = (Serial)0x1024u;
|
||||
|
||||
var expected = new PartyInvitation(m).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@ namespace UOContent.Tests
|
|||
[InlineData(0x1024u, 1, 100, 200)]
|
||||
public void TestSendStatueAnimation(uint s, int status, int anim, int frame)
|
||||
{
|
||||
Serial serial = s;
|
||||
var expected = new UpdateStatueAnimation(serial, status, anim, frame).Compile();
|
||||
var expected = new UpdateStatueAnimation((Serial)s, status, anim, frame).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendStatueAnimation(serial, status, anim, frame);
|
||||
ns.SendStatueAnimation((Serial)s, status, anim, frame);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ namespace UOContent.Tests
|
|||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Author", "🅵🅰🅽🅲🆈 🆃🅴🆇🆃 Title")]
|
||||
public void TestBookCover(string author, string title)
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
Serial serial = 0x1001;
|
||||
Serial serial = (Serial)0x1001;
|
||||
var book = new TestBook(serial) { Author = author, Title = title };
|
||||
|
||||
var expected = new BookHeader(m, book).Compile();
|
||||
|
|
@ -57,10 +57,10 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestBookContent()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
Serial serial = 0x1001;
|
||||
Serial serial = (Serial)0x1001;
|
||||
var book = new TestBook(serial) { Author = "Some Author", Title = "Some Title" };
|
||||
book.Pages[0].Lines = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace UOContent.Tests
|
|||
[InlineData("🅵🅰🅽🅲🆈 🆃🅴🆇🆃", true, "First Line", "Second Line")]
|
||||
public void TestSendBBHeaderMessage(string subject, bool content, params string[] lines)
|
||||
{
|
||||
var poster = new Mobile(0x1024u) { Name = "Kamron" };
|
||||
var poster = new Mobile((Serial)0x1024u) { Name = "Kamron" };
|
||||
poster.DefaultMobileInit();
|
||||
|
||||
var bb = new TestBulletinBoard(0x234);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestMahjongJoinGame()
|
||||
{
|
||||
Serial game = 0x1024u;
|
||||
Serial game = (Serial)0x1024u;
|
||||
|
||||
var expected = new MahjongJoinGame(game).Compile();
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ namespace UOContent.Tests
|
|||
[InlineData(false)]
|
||||
public void TestMahjongPlayersInfo(bool showScores)
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var game = new MahjongGame { ShowScores = showScores };
|
||||
|
|
@ -67,7 +67,7 @@ namespace UOContent.Tests
|
|||
[InlineData(false)]
|
||||
public void TestMahjongTilesInfo(bool spectatorVision)
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var game = new MahjongGame { SpectatorVision = spectatorVision };
|
||||
|
|
@ -87,7 +87,7 @@ namespace UOContent.Tests
|
|||
[InlineData(false)]
|
||||
public void TestMahjongTileInfo(bool spectatorVision)
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var game = new MahjongGame { SpectatorVision = spectatorVision };
|
||||
|
|
@ -105,7 +105,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestMahjongRelieve()
|
||||
{
|
||||
Serial game = 0x1024u;
|
||||
Serial game = (Serial)0x1024u;
|
||||
|
||||
var expected = new MahjongRelieve(game).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestCorpseEquipPacket()
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var weapon = new VikingSword();
|
||||
|
|
@ -36,7 +36,7 @@ namespace UOContent.Tests
|
|||
[InlineData(ProtocolChanges.ContainerGridLines)]
|
||||
public void TestCorpseContainerPacket(ProtocolChanges changes)
|
||||
{
|
||||
var m = new Mobile(0x1);
|
||||
var m = new Mobile((Serial)0x1);
|
||||
m.DefaultMobileInit();
|
||||
|
||||
var weapon = new VikingSword();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace UOContent.Tests
|
|||
|
||||
var list = new List<IEntity> { item1, beholder.Object };
|
||||
var notContained = new List<IEntity> { item2 };
|
||||
var boat = new TestBoat(0x3000, list, notContained)
|
||||
var boat = new TestBoat((Serial)0x3000, list, notContained)
|
||||
{
|
||||
Location = new Point3D(10, 20, 15),
|
||||
Facing = Direction.Right,
|
||||
|
|
@ -87,7 +87,7 @@ namespace UOContent.Tests
|
|||
|
||||
var list = new List<IEntity> { item1, beholder.Object };
|
||||
var notContained = new List<IEntity> { item2 };
|
||||
var boat = new TestBoat(0x3000, list, notContained)
|
||||
var boat = new TestBoat((Serial)0x3000, list, notContained)
|
||||
{
|
||||
Location = new Point3D(10, 20, 15),
|
||||
Facing = Direction.Right
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ namespace UOContent.Tests
|
|||
[InlineData(0x1001u)]
|
||||
public void TestBeginHouseCustomization(uint serial)
|
||||
{
|
||||
var expected = new BeginHouseCustomization(serial).Compile();
|
||||
var expected = new BeginHouseCustomization((Serial)serial).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendBeginHouseCustomization(serial);
|
||||
ns.SendBeginHouseCustomization((Serial)serial);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
|
|
@ -28,10 +28,10 @@ namespace UOContent.Tests
|
|||
[InlineData(0x1001u)]
|
||||
public void TestEndHouseCustomization(uint serial)
|
||||
{
|
||||
var expected = new EndHouseCustomization(serial).Compile();
|
||||
var expected = new EndHouseCustomization((Serial)serial).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendEndHouseCustomization(serial);
|
||||
ns.SendEndHouseCustomization((Serial)serial);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
|
|
@ -42,10 +42,10 @@ namespace UOContent.Tests
|
|||
[InlineData(0x1001u, 100)]
|
||||
public void TestDesignStateGeneral(uint serial, int revision)
|
||||
{
|
||||
var expected = new DesignStateGeneral(serial, revision).Compile();
|
||||
var expected = new DesignStateGeneral((Serial)serial, revision).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendDesignStateGeneral(serial, revision);
|
||||
ns.SendDesignStateGeneral((Serial)serial, revision);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
|
|
@ -54,7 +54,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestHouseDesignStateDetailed()
|
||||
{
|
||||
Serial serial = 0x40000001;
|
||||
Serial serial = (Serial)0x40000001;
|
||||
var revision = 10;
|
||||
var tiles = new MultiTileEntry[250];
|
||||
for (var i = 0; i < tiles.Length; i++)
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ namespace Server.Network
|
|||
private readonly bool[] m_PlaneUsed = new bool[9];
|
||||
private readonly byte[] m_PrimBuffer = new byte[4];
|
||||
|
||||
public DesignStateDetailed(uint serial, int revision, int xMin, int yMin, int xMax, int yMax, MultiTileEntry[] tiles)
|
||||
public DesignStateDetailed(Serial serial, int revision, int xMin, int yMin, int xMax, int yMax, MultiTileEntry[] tiles)
|
||||
: base(0xD8)
|
||||
{
|
||||
EnsureCapacity(17 + tiles.Length * 5);
|
||||
|
||||
Write((byte)0x03); // Compression Type
|
||||
Write((byte)0x00); // Unknown
|
||||
Write(serial);
|
||||
Write(serial.Value);
|
||||
Write(revision);
|
||||
Write((short)tiles.Length);
|
||||
Write((short)0); // Buffer length : reserved
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Tests.Network
|
|||
[InlineData(100000, 100000)]
|
||||
public void TestCancelArrowHS(int x, int y)
|
||||
{
|
||||
Serial serial = 0x1024;
|
||||
Serial serial = (Serial)0x1024;
|
||||
|
||||
var expected = new CancelArrowHS(x, y, serial).Compile();
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ namespace Server.Tests.Network
|
|||
[InlineData(100000, 100000)]
|
||||
public void TestSetArrowHS(int x, int y)
|
||||
{
|
||||
Serial serial = 0x1024;
|
||||
Serial serial = (Serial)0x1024;
|
||||
|
||||
var expected = new SetArrowHS(x, y, serial).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ namespace UOContent.Tests
|
|||
{
|
||||
var timeSpan = new TimeSpan(ts);
|
||||
var expected = new AddBuffPacket(
|
||||
mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan
|
||||
(Serial)mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan
|
||||
).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
BuffInfo.SendAddBuffPacket(ns, mob, iconID, titleCliloc, secondaryCliloc, args, (int)timeSpan.TotalMilliseconds);
|
||||
BuffInfo.SendAddBuffPacket(ns, (Serial)mob, iconID, titleCliloc, secondaryCliloc, args, (int)timeSpan.TotalMilliseconds);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
|
|
@ -29,7 +29,7 @@ namespace UOContent.Tests
|
|||
[Fact]
|
||||
public void TestRemoveBuffIcon()
|
||||
{
|
||||
Serial m = 0x1024;
|
||||
Serial m = (Serial)0x1024;
|
||||
var buffIcon = BuffIcon.Disguised;
|
||||
var expected = new RemoveBuffPacket(m, buffIcon).Compile();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue