Esempio n. 1
0
        public void OnPacketReceived(RotMGClient client, ServerPacket pkt)
        {
            switch (pkt.ID)
            {
            case PacketID.TRADEREQUESTED:
                if ((pkt as TradeRequestedPacket).Name == playerOwner.Text)
                {
                    client.SendPacket(new RequestTradePacket {
                        Name = playerOwner.Text
                    });
                }
                break;

            case PacketID.TRADEACCEPTED:
                client.SendPacket(new AcceptTradePacket {
                    MyOffers = SelectedItems.Values.ToArray(), YourOffers = (pkt as TradeAcceptedPacket).YourOffers
                });
                break;

            case PacketID.TRADEDONE:
                for (int i = 0; i < 12; i++)
                {
                    SelectedItems[i] = false;
                }
                break;
            }
        }
Esempio n. 2
0
        private void inventorySlot_clicked(object sender, EventArgs e)
        {
            if (sender is PictureBox)
            {
                if ((sender as PictureBox).BackColor == Color.Yellow)
                {
                    (sender as PictureBox).BackColor = Color.DimGray;
                    SelectedItems[Convert.ToInt32((sender as PictureBox).Tag)] = false;
                }
                else
                {
                    (sender as PictureBox).BackColor = Color.Yellow;
                    SelectedItems[Convert.ToInt32((sender as PictureBox).Tag)] = true;
                }
            }

            client.SendPacket(new ChangeTradePacket
            {
                Offers = SelectedItems.Values.ToArray()
            });
        }
Esempio n. 3
0
        public static void client_OnPacketReceive(RotMGClient client, ServerPacket pkt)
        {
            switch (pkt.ID)
            {
            case PacketID.TEXT:
                break;

            case PacketID.TRADEREQUESTED:
                TradeRequestedPacket tp = pkt as TradeRequestedPacket;
                name = tp.Name;
                client.SendPacket(new PlayerTextPacket {
                    Text = "/tell " + tp.Name + " Hai " + tp.Name + ", have a nice cheesy day c:"
                });
                client.SendPacket(new RequestTradePacket {
                    Name = tp.Name
                });
                break;

            //case PacketID.TRADEACCEPTED:
            //    client.SendPacket(new AcceptTradePacket
            //    {
            //        MyOffers = new bool[12],
            //        YourOffers = new bool[12]
            //    });
            //    client.SendPacket(new PlayerTextPacket
            //    {
            //        Text = ("/tell " + name + " Thank u m8 c:")
            //    });
            //    break;
            //case PacketID.SHOOT2:
            //    client.SendPacket(new PlayerTextPacket
            //    {
            //        Text = pkt.ToString()//"Shoot ur spell again to receive some more random numbers like this: " + new Random().Next(100000, 100000000) + "  c:"
            //    });
            //    break;
            default:
                //Console.WriteLine("Unhandled packet {0}", pkt.GetType().Name);
                break;
            }
        }
Esempio n. 4
0
        private void ticker_Tick(object sender, EventArgs e)
        {
            string spamtext = String.Empty;

            foreach (char c in spamtextbox.Text)
            {
                if (c == '%')
                {
                    spamtext += getRandomChar();
                }
                else
                {
                    spamtext += c;
                }
            }

            client.SendPacket(new PlayerTextPacket
            {
                Text = spamtext
            });
        }
Esempio n. 5
0
        public void OnPacketReceived(RotMGClient client, ServerPacket pkt)
        {
            if (!botStarted)
            {
                switch (pkt.ID)
                {
                case PacketID.TRADEREQUESTED:
                    if ((pkt as TradeRequestedPacket).Name == playerOwner.Text)
                    {
                        client.SendPacket(new RequestTradePacket {
                            Name = playerOwner.Text
                        });
                        trading = true;
                    }
                    break;

                case PacketID.TRADESTART:
                    if ((pkt as TradeStartPacket).YourName != playerOwner.Text)
                    {
                        client.SendPacket(new CancelTradePacket());
                        trading = false;
                    }
                    else
                    {
                        trading = true;
                    }
                    break;

                case PacketID.TRADEACCEPTED:
                    client.SendPacket(new AcceptTradePacket {
                        MyOffers = SelectedItems.Values.ToArray(), YourOffers = (pkt as TradeAcceptedPacket).YourOffers
                    });
                    break;

                case PacketID.TRADEDONE:
                    for (int i = 0; i < 12; i++)
                    {
                        SelectedItems[i] = false;
                    }
                    trading = false;
                    break;
                }
            }
            else
            {
                switch (pkt.ID)
                {
                case PacketID.TRADEREQUESTED:
                    if (requestedItemsInInventory((pkt as TradeRequestedPacket).Name, reqItemName, (int)buyAmount.Value))
                    {
                        client.SendPacket(new RequestTradePacket {
                            Name = (pkt as TradeRequestedPacket).Name
                        });
                    }
                    else
                    {
                        currentTradePlayer = -1;
                    }
                    break;

                case PacketID.TRADESTART:
                    client.SendPacket(new PlayerTextPacket {
                        Text = String.Format("/tell {0} Please select {1} {2}.", (pkt as TradeStartPacket).YourName, buyAmount.Value, reqItemName)
                    });
                    break;

                case PacketID.TRADECHANGED:
                    if (IsSelectValid(currentTradePlayer, reqItemName, (int)buyAmount.Value, (pkt as TradeChangedPacket)))
                    {
                        client.SendPacket(new ChangeTradePacket
                        {
                            Offers = myoffers()
                        });
                        client.SendPacket(new AcceptTradePacket
                        {
                            MyOffers   = myoffers(),
                            YourOffers = (pkt as TradeChangedPacket).Offers
                        });
                    }
                    break;

                case PacketID.TRADEDONE:
                    if ((pkt as TradeDonePacket).Result == 0)
                    {
                        notifyIcon1.BalloonTipText  = String.Format("Successfuly sold {0} {1} for {2} {3}", sellAmount.Value, sellItemName, buyAmount.Value, reqItemName);
                        notifyIcon1.BalloonTipTitle = "TradeBot";
                        notifyIcon1.ShowBalloonTip(4000);
                    }
                    break;
                }
            }
        }