Updates Combat Packets & Moves Tracking to Content (#298)

- [X] Changes outgoing combat packets
- [X] Moves quest arrow to PlayerMobile and moves quest arrow packets to content.

Bumps release version
This commit is contained in:
Kamron Batman 2020-11-01 21:33:01 -08:00 committed by GitHub
parent 55935d30b4
commit 6f5cb00cdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 373 additions and 319 deletions

View file

@ -13,22 +13,13 @@ namespace Server.Tests.Network
Serial attacker = 0x1000;
Serial defender = 0x2000;
var data = new Swing(attacker, defender).Compile();
var expected = new Swing(attacker, defender).Compile();
Span<byte> expectedData = stackalloc byte[10];
var pos = 0;
using var ns = PacketTestUtilities.CreateTestNetState();
ns.SendSwing(attacker, defender);
expectedData.Write(ref pos, (byte)0x2F); // Packet ID
#if NO_LOCAL_INIT
expectedData.Write(ref pos, (byte)0);
#else
pos++;
#endif
expectedData.Write(ref pos, attacker);
expectedData.Write(ref pos, defender);
AssertThat.Equal(data, expectedData);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
}
[Theory]
@ -36,45 +27,27 @@ namespace Server.Tests.Network
[InlineData(false)]
public void TestSetWarMode(bool warmode)
{
var data = new SetWarMode(warmode).Compile();
var expected = new SetWarMode(warmode).Compile();
Span<byte> expectedData = stackalloc byte[5];
var pos = 0;
using var ns = PacketTestUtilities.CreateTestNetState();
ns.SendSetWarMode(warmode);
expectedData.Write(ref pos, (byte)0x72); // Packet ID
expectedData.Write(ref pos, warmode);
#if NO_LOCAL_INIT
expectedData.Write(ref pos, (byte)0);
#else
pos++;
#endif
expectedData.Write(ref pos, (byte)0x32);
#if NO_LOCAL_INIT
expectedData.Write(ref pos, (byte)0);
#else
pos++;
#endif
AssertThat.Equal(data, expectedData);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
}
[Fact]
public void TestChangeCombatant()
{
Serial combatant = 0x1000;
Serial serial = 0x1024;
var data = new ChangeCombatant(combatant).Compile();
var expected = new ChangeCombatant(serial).Compile();
Span<byte> expectedData = stackalloc byte[5];
var pos = 0;
using var ns = PacketTestUtilities.CreateTestNetState();
ns.SendChangeCombatant(serial);
expectedData.Write(ref pos, (byte)0xAA); // Packet ID
expectedData.Write(ref pos, combatant);
AssertThat.Equal(data, expectedData);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
}
}
}