public void TestStatLockInfo(StatLockType str, StatLockType intel, StatLockType dex) { var m = new Mobile(0x1); m.DefaultMobileInit(); m.StrLock = str; m.IntLock = intel; m.DexLock = dex; var expected = new StatLockInfo(m).Compile(); using var ns = PacketTestUtilities.CreateTestNetState(); ns.SendStatLockInfo(m); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
public void TestStatLockInfo() { var m = new Mobile(0x1); m.DefaultMobileInit(); var data = new StatLockInfo(m).Compile(); Span <byte> expectedData = stackalloc byte[12]; var pos = 0; expectedData.Write(ref pos, (byte)0xBF); // Packet ID expectedData.Write(ref pos, (ushort)12); // Length expectedData.Write(ref pos, (ushort)0x19); // Sub-packet expectedData.Write(ref pos, (byte)2); // Command expectedData.Write(ref pos, m.Serial); expectedData.Write(ref pos, (ushort)(((int)m.StrLock << 4) | ((int)m.DexLock << 2) | (int)m.IntLock)); AssertThat.Equal(data, expectedData); }