コード例 #1
0
        private void StartPacketReplay()
        {
            var packetIndex     = GetRandomPacketIndex();
            var packet          = attackPackets[packetIndex];
            var timeSpanCounter = 0;
            var isPickingItems  = true;

            manager.AddFilterAction(attackResponseCode, (RecordedPacket packt) =>
            {
                timeSpanCounter = 3;
                this.Invoke(new Action(() => { richTextBox1.Text += "Attack response coming from the monster\n"; }));
            });

            timeAfterLastHit.Tick += (Object myObject, EventArgs myEventArgs) => {
                --timeSpanCounter;

                if (timeSpanCounter <= 0)
                {
                    if (isPickingItems || !pickupCheckbox.Checked)
                    {
                        timeSpanCounter = 6;
                        isPickingItems  = false;

                        richTextBox1.Text += "\nBeginning attack on monster " + packetIndex + "\n\n";

                        for (int index = 0; index < 5; ++index)
                        {
                            manager.WriteMessage(packet.Socket, packet.Data);
                            Thread.Sleep(100);
                        }

                        packetIndex = GetRandomPacketIndex(packetIndex);
                        packet      = attackPackets[packetIndex];

                        return;
                    }

                    if (pickupCheckbox.Checked && !isPickingItems)
                    {
                        timeSpanCounter = 2;
                        isPickingItems  = true;

                        richTextBox1.Text += "\nPicking items...\n\n";

                        this.movementPacket.SetNextPosX(packet.GetNextPosX());
                        this.movementPacket.SetNextPosY(packet.GetNextPosY());

                        manager.WriteMessage(this.movementPacket.Socket, this.movementPacket.Data);
                        ProcessUtilities.SendKeys("^A", 2);

                        return;
                    }
                }
            };

            timeAfterLastHit.Interval = 1000;
            timeAfterLastHit.Start();
        }
コード例 #2
0
 private void PickUpButton_Click(object sender, EventArgs e)
 {
     ProcessUtilities.SendKeys("^A", 5);
 }