fix(content): Converts buff icon packets (#389)
- [X] Converts buff icon packets, and avoids string formatting.
This commit is contained in:
parent
0912876f7c
commit
03bdff2293
8 changed files with 243 additions and 96 deletions
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Tests;
|
||||
using Server.Tests.Network;
|
||||
using Xunit;
|
||||
|
||||
namespace UOContent.Tests
|
||||
{
|
||||
public class BuffIconPacketTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0x1024u, BuffIcon.Clumsy, 500100, 300200, "123456", 8000)]
|
||||
[InlineData(0x2048u, BuffIcon.Disguised, 500102, 300203, null, 9000)]
|
||||
public void TestAddBuffIcon(uint mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, string args, int ts)
|
||||
{
|
||||
var timeSpan = new TimeSpan(ts);
|
||||
var expected = new AddBuffPacket(
|
||||
mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan
|
||||
).Compile();
|
||||
|
||||
using var ns = PacketTestUtilities.CreateTestNetState();
|
||||
BuffInfo.SendAddBuffPacket(ns, mob, iconID, titleCliloc, secondaryCliloc, args, timeSpan);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestRemoveBuffIcon()
|
||||
{
|
||||
Serial m = 0x1024;
|
||||
var buffIcon = BuffIcon.Disguised;
|
||||
var expected = new RemoveBuffPacket(m, buffIcon).Compile();
|
||||
|
||||
using var ns = PacketTestUtilities.CreateTestNetState();
|
||||
BuffInfo.SendRemoveBuffPacket(ns, m, buffIcon);
|
||||
|
||||
var result = ns.SendPipe.Reader.TryRead();
|
||||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue