public static int CreateMessageLocalizedAffix(
            Span <byte> buffer,
            Serial serial, int graphic, MessageType type, int hue, int font, int number, string name,
            AffixType affixType, string affix = "", string args = ""
            )
        {
            name ??= "";
            affix ??= "";
            args ??= "";

            if (hue == 0)
            {
                hue = 0x3B2;
            }

            var writer = new SpanWriter(buffer);

            writer.Write((byte)0xCC);
            writer.Seek(2, SeekOrigin.Current);
            writer.Write(serial);
            writer.Write((short)graphic);
            writer.Write((byte)type);
            writer.Write((short)hue);
            writer.Write((short)font);
            writer.Write(number);
            writer.Write((byte)affixType);
            writer.WriteAscii(name, 30);
            writer.WriteAsciiNull(affix);
            writer.WriteBigUniNull(args);

            writer.WritePacketLength();
            return(writer.Position);
        }
        public static int CreateMessage(
            Span <byte> buffer,
            Serial serial,
            int graphic,
            MessageType type,
            int hue,
            int font,
            bool ascii,
            string lang,
            string name,
            string text
            )
        {
            if (buffer[0] != 0)
            {
                return(buffer.Length);
            }

            name ??= "";
            text ??= "";
            lang ??= "ENU";

            if (hue == 0)
            {
                hue = 0x3B2;
            }

            var writer = new SpanWriter(buffer);

            writer.Write((byte)(ascii ? 0x1C : 0xAE)); // Packet ID
            writer.Seek(2, SeekOrigin.Current);
            writer.Write(serial);
            writer.Write((short)graphic);
            writer.Write((byte)type);
            writer.Write((short)hue);
            writer.Write((short)font);
            if (ascii)
            {
                writer.WriteAscii(name, 30);
                writer.WriteAsciiNull(text);
            }
            else
            {
                writer.WriteAscii(lang, 4);
                writer.WriteAscii(name, 30);
                writer.WriteBigUniNull(text);
            }

            writer.WritePacketLength();
            return(writer.Position);
        }