Exemple #1
0
 public Gump(GumpInstanceId id, GumpTypeId gumpTypeId, string commands, string[] textLines)
 {
     Id         = id;
     GumpTypeId = gumpTypeId;
     Commands   = commands;
     TextLines  = textLines;
 }
Exemple #2
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);
        }
        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);
            }
        }
        public void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(5);
            GumpTypeId = (GumpTypeId)reader.ReadUInt();
        }
Exemple #5
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());
        }
        public CloseGenericGumpPacket(GumpTypeId gumpTypeId)
        {
            GumpTypeId = gumpTypeId;

            byte[] payload = new byte[13];
            var    writer  = new ArrayPacketWriter(payload);

            writer.WriteByte((byte)PacketDefinitions.GeneralInformationPacket.Id);
            writer.WriteUShort(13); // length
            writer.WriteUShort(4);  // subcommand
            writer.WriteUInt(gumpTypeId.Value);
            writer.WriteUInt(0);

            rawPacket = new Packet(PacketDefinitions.GeneralInformationPacket.Id, payload);
        }
Exemple #7
0
 public Gump(GumpTypeId gumpTypeId, GumpInstanceId id, string commands, string[] textLines)
     : this(id, gumpTypeId, commands, textLines)
 {
 }
Exemple #8
0
 internal ServerRequestedGumpCloseEvent(GumpTypeId gumpTypeId)
 {
     GumpTypeId = gumpTypeId;
 }