fix: Fixes flaky tests, formatting, and sequential testing. (#2168)
This commit is contained in:
parent
415c7a6bfd
commit
7dbfc9d161
60 changed files with 1304 additions and 1289 deletions
|
|
@ -8,14 +8,14 @@ public class ArrowPacketTests
|
|||
[Fact]
|
||||
public void TestCancelArrow()
|
||||
{
|
||||
var expected = new CancelArrow().Compile();
|
||||
var expected = new CancelArrow().Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendCancelArrow(0, 0, Serial.Zero);
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendCancelArrow(0, 0, Serial.Zero);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 0)]
|
||||
|
|
@ -23,14 +23,14 @@ public class ArrowPacketTests
|
|||
[InlineData(100000, 100000)]
|
||||
public void TestSetArrow(int x, int y)
|
||||
{
|
||||
var expected = new SetArrow(x, y).Compile();
|
||||
var expected = new SetArrow(x, y).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendSetArrow(x, y, Serial.Zero);
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.SendSetArrow(x, y, Serial.Zero);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 0)]
|
||||
|
|
@ -38,17 +38,17 @@ public class ArrowPacketTests
|
|||
[InlineData(100000, 100000)]
|
||||
public void TestCancelArrowHS(int x, int y)
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
Serial serial = (Serial)0x1024;
|
||||
|
||||
var expected = new CancelArrowHS(x, y, serial).Compile();
|
||||
var expected = new CancelArrowHS(x, y, serial).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = ProtocolChanges.HighSeas;
|
||||
ns.SendCancelArrow(x, y, serial);
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = ProtocolChanges.HighSeas;
|
||||
ns.SendCancelArrow(x, y, serial);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 0)]
|
||||
|
|
@ -56,15 +56,15 @@ public class ArrowPacketTests
|
|||
[InlineData(100000, 100000)]
|
||||
public void TestSetArrowHS(int x, int y)
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
Serial serial = (Serial)0x1024;
|
||||
|
||||
var expected = new SetArrowHS(x, y, serial).Compile();
|
||||
var expected = new SetArrowHS(x, y, serial).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = ProtocolChanges.HighSeas;
|
||||
ns.SendSetArrow(x, y, serial);
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
ns.ProtocolChanges = ProtocolChanges.HighSeas;
|
||||
ns.SendSetArrow(x, y, serial);
|
||||
|
||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||
AssertThat.Equal(result, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,40 +4,40 @@ public sealed class CancelArrow : Packet
|
|||
{
|
||||
public CancelArrow() : base(0xBA, 6)
|
||||
{
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write((short)-1);
|
||||
Stream.Write((short)-1);
|
||||
}
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write((short)-1);
|
||||
Stream.Write((short)-1);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SetArrow : Packet
|
||||
{
|
||||
public SetArrow(int x, int y) : base(0xBA, 6)
|
||||
{
|
||||
Stream.Write((byte)1);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
}
|
||||
Stream.Write((byte)1);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CancelArrowHS : Packet
|
||||
{
|
||||
public CancelArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
||||
{
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
Stream.Write(s);
|
||||
}
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
Stream.Write(s);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SetArrowHS : Packet
|
||||
{
|
||||
public SetArrowHS(int x, int y, Serial s) : base(0xBA, 10)
|
||||
{
|
||||
Stream.Write((byte)1);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
Stream.Write(s);
|
||||
}
|
||||
}
|
||||
Stream.Write((byte)1);
|
||||
Stream.Write((short)x);
|
||||
Stream.Write((short)y);
|
||||
Stream.Write(s);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,84 +1,83 @@
|
|||
using System;
|
||||
using Server.Engines.BuffIcons;
|
||||
|
||||
namespace Server.Network
|
||||
namespace Server.Network;
|
||||
|
||||
public sealed class AddBuffPacket : Packet
|
||||
{
|
||||
public sealed class AddBuffPacket : Packet
|
||||
{
|
||||
public AddBuffPacket(Serial m, BuffInfo info)
|
||||
: this(
|
||||
m,
|
||||
info.ID,
|
||||
info.TitleCliloc,
|
||||
info.SecondaryCliloc,
|
||||
info.Args,
|
||||
info.Duration
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public AddBuffPacket(
|
||||
Serial mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args,
|
||||
TimeSpan length
|
||||
public AddBuffPacket(Serial m, BuffInfo info)
|
||||
: this(
|
||||
m,
|
||||
info.ID,
|
||||
info.TitleCliloc,
|
||||
info.SecondaryCliloc,
|
||||
info.Args,
|
||||
info.Duration
|
||||
)
|
||||
: base(0xDF)
|
||||
{
|
||||
var hasArgs = args != null;
|
||||
|
||||
EnsureCapacity(hasArgs ? 48 + args.ToString().Length * 2 : 44);
|
||||
Stream.Write(mob);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x1); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x01); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
|
||||
Stream.Write((short)Math.Max(length.TotalSeconds, 0)); // Time in seconds
|
||||
|
||||
Stream.Fill(3);
|
||||
Stream.Write(titleCliloc);
|
||||
Stream.Write(secondaryCliloc);
|
||||
|
||||
if (!hasArgs)
|
||||
{
|
||||
// m_Stream.Fill( 2 );
|
||||
Stream.Fill(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stream.Fill(4);
|
||||
Stream.Write((short)0x1); // Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
|
||||
// m_Stream.WriteLittleUniNull( "\t#1018280" );
|
||||
Stream.WriteLittleUniNull($"\t{args}");
|
||||
|
||||
Stream.Write((short)0x1); // Even more Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
}
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class RemoveBuffPacket : Packet
|
||||
public AddBuffPacket(
|
||||
Serial mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args,
|
||||
TimeSpan length
|
||||
)
|
||||
: base(0xDF)
|
||||
{
|
||||
public RemoveBuffPacket(Serial mob, BuffInfo info) : this(mob, info.ID)
|
||||
var hasArgs = args != null;
|
||||
|
||||
EnsureCapacity(hasArgs ? 48 + args.ToString().Length * 2 : 44);
|
||||
Stream.Write(mob);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x1); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x01); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
|
||||
Stream.Write((short)Math.Max(length.TotalSeconds, 0)); // Time in seconds
|
||||
|
||||
Stream.Fill(3);
|
||||
Stream.Write(titleCliloc);
|
||||
Stream.Write(secondaryCliloc);
|
||||
|
||||
if (!hasArgs)
|
||||
{
|
||||
// m_Stream.Fill( 2 );
|
||||
Stream.Fill(10);
|
||||
}
|
||||
|
||||
public RemoveBuffPacket(Serial mob, BuffIcon iconID) : base(0xDF)
|
||||
else
|
||||
{
|
||||
EnsureCapacity(13);
|
||||
Stream.Write(mob);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x0); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
Stream.Write((short)0x1); // Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
|
||||
// m_Stream.WriteLittleUniNull( "\t#1018280" );
|
||||
Stream.WriteLittleUniNull($"\t{args}");
|
||||
|
||||
Stream.Write((short)0x1); // Even more Unknown -> Possibly something saying 'hey, I have more data!'?
|
||||
Stream.Fill(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RemoveBuffPacket : Packet
|
||||
{
|
||||
public RemoveBuffPacket(Serial mob, BuffInfo info) : this(mob, info.ID)
|
||||
{
|
||||
}
|
||||
|
||||
public RemoveBuffPacket(Serial mob, BuffIcon iconID) : base(0xDF)
|
||||
{
|
||||
EnsureCapacity(13);
|
||||
Stream.Write(mob);
|
||||
|
||||
Stream.Write((short)iconID); // ID
|
||||
Stream.Write((short)0x0); // Type 0 for removal. 1 for add 2 for Data
|
||||
|
||||
Stream.Fill(4);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue