Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.Write((ushort)0x7B20); // "{ "
     writer.Write(LayoutName);
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(X.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(Y.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(Width.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(Height.ToString());
     writer.Write((ushort)0x207D); // " }"
 }
Exemplo n.º 3
0
    public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
    {
        var initialState = InitialState ? "1" : "0";

        writer.WriteAscii($"{{ radio {X} {Y} {InactiveID} {ActiveID} {initialState} {SwitchID} }}");
        switches++;
    }
Exemplo n.º 4
0
    public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
    {
        var textIndex = strings.GetOrAdd(InitialText ?? "");

        writer.WriteAscii($"{{ textentry {X} {Y} {Width} {Height} {Hue} {EntryID} {textIndex} }}");
        entries++;
    }
Exemplo n.º 5
0
        public static int CreateMessageLocalized(
            Span <byte> buffer,
            Serial serial, int graphic, MessageType type, int hue, int font, int number, string name = "", string args = ""
            )
        {
            name ??= "";
            args ??= "";

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

            var writer = new SpanWriter(buffer);

            writer.Write((byte)0xC1);
            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.WriteAscii(name, 30);
            writer.WriteLittleUniNull(args);

            writer.WritePacketLength();
            return(writer.Position);
        }
Exemplo n.º 6
0
        public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
        {
            writer.Write((ushort)0x7B20); // "{ "
            writer.Write(LayoutName);
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Number.ToString());

            if (!string.IsNullOrEmpty(Args))
            {
                writer.Write((byte)0x20); // ' '
                writer.Write((byte)0x40); // '@'
                writer.WriteAscii(Args);
                writer.Write((byte)0x40); // '@'
            }

            writer.Write((ushort)0x207D); // " }"
        }
Exemplo n.º 7
0
    public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
    {
        var textIndex  = strings.GetOrAdd(Text ?? "");
        var background = Background ? "1" : "0";
        var scrollbar  = Scrollbar ? "1" : "0";

        writer.WriteAscii($"{{ htmlgump {X} {Y} {Width} {Height} {textIndex} {background} {scrollbar} }}");
    }
Exemplo n.º 8
0
        public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
        {
            writer.Write(Hue == 0 ? LayoutName : LayoutNameHue);
            writer.Write((byte)0x20); // ' '
            writer.WriteAscii(X.ToString());
            writer.Write((byte)0x20); // ' '
            writer.WriteAscii(Y.ToString());
            writer.Write((byte)0x20); // ' '
            writer.WriteAscii(ItemID.ToString());

            if (Hue != 0)
            {
                writer.Write((byte)0x20); // ' '
                writer.WriteAscii(Hue.ToString());
            }

            writer.Write((ushort)0x207D); // " }"
        }
Exemplo n.º 9
0
        public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
        {
            writer.Write((ushort)0x7B20);                     // "{ "
            writer.Write(LayoutName);
            writer.Write((byte)0x20);                         // ' '
            writer.WriteAscii(X.ToString());
            writer.Write((byte)0x20);                         // ' '
            writer.WriteAscii(Y.ToString());
            writer.Write((byte)0x20);                         // ' '
            writer.WriteAscii(InactiveID.ToString());
            writer.Write((byte)0x20);                         // ' '
            writer.WriteAscii(ActiveID.ToString());
            writer.Write((byte)0x20);                         // ' '
            writer.Write((byte)(InitialState ? 0x31 : 0x30)); // 1 or 0
            writer.Write((byte)0x20);                         // ' '
            writer.WriteAscii(SwitchID.ToString());
            writer.Write((ushort)0x207D);                     // " }"

            switches++;
        }
Exemplo n.º 10
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.Write((ushort)0x7B20);                   // "{ "
     writer.Write(LayoutName);
     writer.Write((byte)0x20);                       // ' '
     writer.WriteAscii(X.ToString());
     writer.Write((byte)0x20);                       // ' '
     writer.WriteAscii(Y.ToString());
     writer.Write((byte)0x20);                       // ' '
     writer.WriteAscii(Width.ToString());
     writer.Write((byte)0x20);                       // ' '
     writer.WriteAscii(Height.ToString());
     writer.Write((byte)0x20);                       // ' '
     writer.WriteAscii(strings.GetOrAdd(Text).ToString());
     writer.Write((byte)0x20);                       // ' '
     writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0
     writer.Write((byte)0x20);                       // ' '
     writer.Write((byte)(Scrollbar ? 0x31 : 0x30));  // 1 or 0
     writer.Write((ushort)0x207D);                   // " }"
 }
Exemplo n.º 11
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.Write((ushort)0x7B20); // "{ "
     writer.Write(LayoutName);
     writer.WriteAscii(' ');
     writer.WriteAscii(X.ToString());
     writer.WriteAscii(' ');
     writer.WriteAscii(Y.ToString());
     writer.WriteAscii(' ');
     writer.WriteAscii(Hue.ToString());
     writer.WriteAscii(' ');
     writer.WriteAscii(strings.GetOrAdd(Text).ToString());
     writer.Write((ushort)0x207D); // " }"
 }
Exemplo n.º 12
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.Write((ushort)0x7B20); // "{ "
     writer.Write(LayoutName);
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(X.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(Y.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(NormalID.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(PressedID.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(((int)Type).ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(Param.ToString());
     writer.Write((byte)0x20);     // ' '
     writer.WriteAscii(ButtonID.ToString());
     writer.Write((ushort)0x207D); // " }"
 }
Exemplo n.º 13
0
        public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
        {
            writer.Write((ushort)0x7B20); // "{ "
            writer.Write(LayoutName);
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(X.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Y.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Width.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Height.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Hue.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(EntryID.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(strings.GetOrAdd(InitialText).ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Size.ToString());
            writer.Write((ushort)0x207D); // " }"

            entries++;
        }
Exemplo n.º 14
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii("{ echandleinput }");
 }
Exemplo n.º 15
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii(Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}");
 }
Exemplo n.º 16
0
    public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
    {
        var textIndex = strings.GetOrAdd(Text ?? "");

        writer.WriteAscii($"{{ text {X} {Y} {Hue} {textIndex} }}");
    }
Exemplo n.º 17
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii($"{{ gumppictiled {X} {Y} {Width} {Height} {GumpID} }}");
 }
Exemplo n.º 18
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii($"{{ checkertrans {X} {Y} {Width} {Height} }}");
 }
Exemplo n.º 19
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii(
         $"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}"
         );
 }
Exemplo n.º 20
0
        public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
        {
            writer.Write((ushort)0x7B20); // "{ "
            writer.Write(LayoutName);
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(X.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Y.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(NormalID.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(PressedID.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(((int)Type).ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Param.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(ButtonID.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(ItemID.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Hue.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Width.ToString());
            writer.Write((byte)0x20);     // ' '
            writer.WriteAscii(Height.ToString());

            if (LocalizedTooltip > 0)
            {
                writer.Write(LayoutTooltip);
                writer.WriteAscii(LocalizedTooltip.ToString());
            }

            writer.Write((ushort)0x207D); // " }"
        }
Exemplo n.º 21
0
 public override void AppendTo(ref SpanWriter writer, OrderedHashSet <string> strings, ref int entries, ref int switches)
 {
     writer.WriteAscii(string.IsNullOrEmpty(Args) ? $"{{ tooltip {Number} }}" : $"{{ tooltip {Number} @{Args}@ }}");
 }