Esempio n. 1
0
        public void TestContainerContentUpdate6017()
        {
            Serial serial = 0x1;
            var    item   = new Item(serial);

            var data = new ContainerContentUpdate6017(item).Compile();

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

            expectedData.Write(ref pos, (byte)0x25); // Packet ID
            expectedData.Write(ref pos, item.Serial);
            expectedData.Write(ref pos, (ushort)item.ItemID);
#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (byte)0); // ItemID offset
#else
            pos++;
#endif
            expectedData.Write(ref pos, (ushort)Math.Min(item.Amount, ushort.MaxValue));
            expectedData.Write(ref pos, (ushort)item.X);
            expectedData.Write(ref pos, (ushort)item.Y);
#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (byte)0); // Grid Location?
#else
            pos++;
#endif
            expectedData.Write(ref pos, item.Parent?.Serial ?? Serial.Zero);
            expectedData.Write(ref pos, (ushort)(item.QuestItem ? Item.QuestItemHue : item.Hue));

            AssertThat.Equal(data, expectedData);
        }
Esempio n. 2
0
        public void TestContainerContentUpdate6017()
        {
            Serial serial = 0x1;
            var    item   = new Item(serial);

            var expected = new ContainerContentUpdate6017(item).Compile();

            using var ns        = PacketTestUtilities.CreateTestNetState();
            ns.ProtocolChanges |= ProtocolChanges.ContainerGridLines;
            ns.SendContainerContentUpdate(item);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }