Пример #1
0
        public MobileStatusCompact(bool canBeRenamed, Mobile m) : base(0x11)
        {
            EnsureCapacity(43);

            Stream.Write(m.Serial);
            Stream.WriteAsciiFixed(m.Name ?? "", 30);

            AttributeNormalizer.WriteReverse(Stream, m.Hits, m.HitsMax);

            Stream.Write(canBeRenamed);

            Stream.Write((byte)0); // type
        }
Пример #2
0
        public void TestAttributeNormalizerReversedDisabled()
        {
            AttributeNormalizer.Enabled = false;

            var stream = new PacketWriter(4);

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

            AttributeNormalizer.WriteReverse(stream, cur, max);

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

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

            AssertThat.Equal(stream.ToArray(), expectedData);
        }
Пример #3
0
 private void WriteAttrNorm(int current, int maximum)
 {
     AttributeNormalizer.WriteReverse(Stream, current, maximum);
 }