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:
Kamron Batman 2021-08-25 00:27:19 -07:00 • committed by GitHub
parent 17521c9cd7
commit 0dc4acc164
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 319 additions and 248 deletions

View file

@ -12,7 +12,7 @@ namespace Server.Tests.Network
[InlineData(StatLockType.Down, StatLockType.Up, StatLockType.Locked)]
public void TestStatLockInfo(StatLockType str, StatLockType intel, StatLockType dex)
{
var m = new Mobile(0x1);
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
m.StrLock = str;
m.IntLock = intel;
@ -77,11 +77,10 @@ namespace Server.Tests.Network
[InlineData(0x1000u, null, null, null)]
public void TestDisplayProfile(uint serial, string header, string body, string footer)
{
Serial m = serial;
var expected = new DisplayProfile(m, header, body, footer).Compile();
var expected = new DisplayProfile((Serial)serial, header, body, footer).Compile();
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendDisplayProfile(m, header, body, footer);
ns.SendDisplayProfile((Serial)serial, header, body, footer);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
@ -146,7 +145,7 @@ namespace Server.Tests.Network
[Fact]
public void TestSkillsUpdate()
{
var m = new Mobile(0x1);
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var skills = m.Skills;
@ -182,7 +181,7 @@ namespace Server.Tests.Network
[InlineData(SkillName.Begging, 100000, 1000)]
public void TestSkillChange(SkillName skillName, int baseFixedPoint, int capFixedPoint)
{
var m = new Mobile(0x1);
var m = new Mobile((Serial)0x1);
m.DefaultMobileInit();
var skill = m.Skills[skillName];
@ -222,8 +221,8 @@ namespace Server.Tests.Network
int itemId, int hue, int amount
)
{
var src = new Entity(srcSerial, new Point3D(srcX, srcY, srcZ), null);
var targ = new Entity(trgSerial, new Point3D(trgX, trgY, trgZ), null);
var src = new Entity((Serial)srcSerial, new Point3D(srcX, srcY, srcZ), null);
var targ = new Entity((Serial)trgSerial, new Point3D(trgX, trgY, trgZ), null);
var expected = new DragEffect(src, targ, itemId, hue, amount).Compile();
@ -258,10 +257,10 @@ namespace Server.Tests.Network
[InlineData(0x1024u, "Test Title", true, false)]
public void TestDisplayPaperdoll(uint m, string title, bool warmode, bool canLift)
{
var expected = new DisplayPaperdoll(m, title, warmode, canLift).Compile();
var expected = new DisplayPaperdoll((Serial)m, title, warmode, canLift).Compile();
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendDisplayPaperdoll(m, title, warmode, canLift);
ns.SendDisplayPaperdoll((Serial)m, title, warmode, canLift);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);