Exemplo n.º 1
0
        public MobileAttributesN(Mobile m) : base(0x2D, 17)
        {
            Stream.Write(m.Serial);

            AttributeNormalizer.Write(Stream, m.Hits, m.HitsMax);
            AttributeNormalizer.Write(Stream, m.Mana, m.ManaMax);
            AttributeNormalizer.Write(Stream, m.Stam, m.StamMax);
        }
Exemplo n.º 2
0
        public void TestAttributeNormalizerDisabled()
        {
            AttributeNormalizer.Enabled = false;

            var stream = new PacketWriter(4);

            const ushort cur = 50;
            const ushort max = 100;

            AttributeNormalizer.Write(stream, cur, max);

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

            expectedData.Write(ref pos, max);
            expectedData.Write(ref pos, cur);

            AssertThat.Equal(stream.ToArray(), expectedData);
        }
Exemplo n.º 3
0
        public void TestAttributeNormalizerEnabled()
        {
            AttributeNormalizer.Enabled = true;
            AttributeNormalizer.Maximum = 25;

            var stream = new PacketWriter(4);

            const ushort cur = 50;
            const ushort max = 100;

            AttributeNormalizer.Write(stream, cur, max);

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

            expectedData.Write(ref pos, (ushort)AttributeNormalizer.Maximum);
            expectedData.Write(ref pos, (ushort)(cur * 25 / max));

            AssertThat.Equal(stream.ToArray(), expectedData);
        }
Exemplo n.º 4
0
 public MobileManaN(Mobile m) : base(0xA2, 9)
 {
     Stream.Write(m.Serial);
     AttributeNormalizer.Write(Stream, m.Mana, m.ManaMax);
 }
Exemplo n.º 5
0
 public MobileHitsN(Mobile m) : base(0xA1, 9)
 {
     Stream.Write(m.Serial);
     AttributeNormalizer.Write(Stream, m.Hits, m.HitsMax);
 }
Exemplo n.º 6
0
 public MobileStamN(Mobile m) : base(0xA3, 9)
 {
     Stream.Write(m.Serial);
     AttributeNormalizer.Write(Stream, m.Stam, m.StamMax);
 }