コード例 #1
0
        public void TestMobileMoving(ProtocolChanges protocolChanges)
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();

            var noto = 10;

            using var ns       = PacketTestUtilities.CreateTestNetState();
            ns.ProtocolChanges = protocolChanges;
            var expected = new MobileMoving(m, noto, ns.StygianAbyss).Compile();

            ns.SendMobileMoving(m, noto);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
コード例 #2
0
        public void TestMobileMovingOld()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();

            var noto = 10;

            var data = new MobileMoving(m, noto, false).Compile();

            Span <byte> expectedData = stackalloc byte[17];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0x77); // Packet ID
            expectedData.Write(ref pos, m.Serial);
            expectedData.Write(ref pos, (ushort)m.Body);
            expectedData.Write(ref pos, m.Location);
            expectedData.Write(ref pos, (byte)m.Direction);
            expectedData.Write(ref pos, (ushort)m.Hue);
            expectedData.Write(ref pos, (byte)m.GetPacketFlags(false));
            expectedData.Write(ref pos, (byte)noto);

            AssertThat.Equal(data, expectedData);
        }