Exemple #1
0
        public void TestMobileAttributes()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();

            var data = new MobileAttributes(m).Compile();

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

            expectedData.Write(ref pos, (byte)0x2D); // Packet ID
            expectedData.Write(ref pos, m.Serial);
            expectedData.WriteAttribute(ref pos, m.Hits, m.HitsMax, false);
            expectedData.WriteAttribute(ref pos, m.Mana, m.ManaMax, false);
            expectedData.WriteAttribute(ref pos, m.Stam, m.StamMax, false);

            AssertThat.Equal(data, expectedData);
        }
        public void TestMobileAttributes()
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();
            m.Str  = 50;
            m.Hits = 100;
            m.Int  = 75;
            m.Mana = 100;
            m.Dex  = 25;
            m.Stam = 100;

            var expected = new MobileAttributes(m).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendMobileAttributes(m);

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

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