Beispiel #1
0
        public GumpMenuSelectionRequest(GumpTypeId gumpTypeId, GumpInstanceId id, GumpControlId triggerId,
                                        GumpControlId[] selectedCheckBoxIds, Tuple <ushort, string>[] textEntries)
        {
            GumpTypeId = gumpTypeId;
            Id         = id;
            TriggerId  = triggerId;

            var packetLength = (ushort)(23 + selectedCheckBoxIds.Length * 4 +
                                        textEntries.Length * 4 +
                                        textEntries.Sum(textEntryValue => textEntryValue.Item2.Length * 2));
            var payload = new byte[packetLength];
            var writer  = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.GumpMenuSelection.Id);
            writer.WriteUShort(packetLength);
            writer.WriteUInt(id.Value);
            writer.WriteUInt(gumpTypeId.Value);
            writer.WriteUInt(triggerId.Value);
            writer.WriteUInt((uint)selectedCheckBoxIds.Length);
            foreach (var checkBoxId in selectedCheckBoxIds)
            {
                writer.WriteUInt(checkBoxId.Value);
            }
            writer.WriteUInt((uint)textEntries.Length);
            foreach (var textEntry in textEntries)
            {
                writer.WriteUShort(textEntry.Item1);
                writer.WriteUShort((ushort)textEntry.Item2.Length);
                writer.WriteUnicodeString(textEntry.Item2);
            }

            rawPacket = new Packet(PacketDefinitions.GumpMenuSelection.Id, payload);
        }
Beispiel #2
0
 public Gump(GumpInstanceId id, GumpTypeId gumpTypeId, string commands, string[] textLines)
 {
     Id         = id;
     GumpTypeId = gumpTypeId;
     Commands   = commands;
     TextLines  = textLines;
 }
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);

            GumpId     = new GumpInstanceId(reader.ReadUInt());
            GumpTypeId = new GumpTypeId(reader.ReadUInt());
            X          = reader.ReadUInt();
            Y          = reader.ReadUInt();

            var commandSectionLength = reader.ReadUShort();

            Commands = reader.ReadString(commandSectionLength);

            var textLinesCount = reader.ReadUShort();

            TextLines = new string[textLinesCount];
            for (var i = 0; i < textLinesCount; i++)
            {
                var textLength = reader.ReadUShort();
                TextLines[i] = reader.ReadUnicodeString(textLength);
            }
        }
Beispiel #4
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);
            Id         = new GumpInstanceId(reader.ReadUInt());
            GumpTypeId = new GumpTypeId(reader.ReadUInt());
            TriggerId  = new GumpControlId(reader.ReadUInt());
        }
Beispiel #5
0
 public Gump(GumpTypeId gumpTypeId, GumpInstanceId id, string commands, string[] textLines)
     : this(id, gumpTypeId, commands, textLines)
 {
 }