Beispiel #1
0
        public void TestYellowBar(bool isBlessed, bool isYellowHealth)
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();
            m.Blessed         = isBlessed;
            m.YellowHealthbar = isYellowHealth;

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

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendMobileHealthbar(m, Healthbar.Yellow);

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

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Beispiel #2
0
        public void TestYellowBar(bool isBlessed, bool isYellowHealth)
        {
            var m = new Mobile(0x1);

            m.DefaultMobileInit();
            m.Blessed         = isBlessed;
            m.YellowHealthbar = isYellowHealth;

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

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

            expectedData.Write(ref pos, (byte)0x17); // Packet ID
            expectedData.Write(ref pos, (ushort)12); // Length
            expectedData.Write(ref pos, m.Serial);
            expectedData.Write(ref pos, 0x10002);    // Show Bar?, Yellow Bar
            expectedData.Write(ref pos, isBlessed || isYellowHealth);

            AssertThat.Equal(data, expectedData);
        }