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); }
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); }
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); }
public MobileManaN(Mobile m) : base(0xA2, 9) { Stream.Write(m.Serial); AttributeNormalizer.Write(Stream, m.Mana, m.ManaMax); }
public MobileHitsN(Mobile m) : base(0xA1, 9) { Stream.Write(m.Serial); AttributeNormalizer.Write(Stream, m.Hits, m.HitsMax); }
public MobileStamN(Mobile m) : base(0xA3, 9) { Stream.Write(m.Serial); AttributeNormalizer.Write(Stream, m.Stam, m.StamMax); }