Beispiel #1
0
 private void button5_Click(object sender, EventArgs e)
 {
     PacketService.sendPacket(
         Process.GetProcessById(procId).Handle,
         procId,
         GoldService.AddGoldBuyPacket(Int32.Parse(textBox5.Text), Int32.Parse(textBox6.Text))
         );
 }
Beispiel #2
0
        private void checkBuy()
        {
            addToLog("");
            addToLog("Логика закупки");

            int money = ReadMemoryService.getMoneyAuction(Process.GetProcessById(procId).Handle);

            int firstPrice = 0;

            int  count     = 0;
            int  price     = 0;
            int  index     = 0;
            int  goldCount = 0;
            bool isRate    = false;

            int countBeforeMax = Int32.Parse(GetTextBoxCountMax());
            int priceStep      = Int32.Parse(GetTextBoxPriceStep());

            int maxCount = 0;

            foreach (var tmp in goldBuyArray)
            {
                price = tmp.Key;
                count = tmp.Value;

                if (index == 0)
                {
                    // первая ставка, проверяем если наша или денег нет то выходим
                    if (IsOurRateBuy(price))
                    {
                        addToLog("Наша ставка первая - return");
                        return;
                    }

                    if ((price * 1.02) > money)
                    {
                        addToLog("Денег нет (" + money + ") - return");
                        // денег нет
                        return;
                    }

                    firstPrice = price;

                    // добавляем к количеству перед нами
                    goldCount += count;
                }
                else
                {
                    // нашли нашу ставку
                    if (IsOurRateBuy(price))
                    {
                        isRate = true;
                        break;
                    }
                    else
                    {
                        // добавляем к количеству перед нами
                        goldCount += count;
                    }
                }

                index++;
            }

            // наши ставки есть в списке из 8 последних
            if (isRate)
            {
                addToLog("Ставки есть, до наших - " + goldCount);

                // до на сбольше 40
                if (goldCount > countBeforeMax)
                {
                    // делаем ставку
                    firstPrice += priceStep;

                    maxCount = getMaxCountBuy(firstPrice);

                    PacketService.sendPacket(Process.GetProcessById(procId).Handle, procId, GoldService.AddGoldBuyPacket(firstPrice, maxCount));

                    addToLog("До нас - " + goldCount + ", Делаем ставку: " + firstPrice + " - " + maxCount);
                    supplierCount++;
                }
            }
            else
            {
                // ставок нет

                // делаем ставку
                firstPrice += priceStep;

                maxCount = getMaxCountBuy(firstPrice);

                PacketService.sendPacket(Process.GetProcessById(procId).Handle, procId, GoldService.AddGoldBuyPacket(firstPrice, maxCount));

                addToLog("Ставок нет, Делаем ставку: " + firstPrice + " - " + maxCount);

                supplierCount++;
            }
        }