Beispiel #1
0
        public void Merge(bool equip, List <InventarSlot> inventarSlots)
        {
            window.Log($"Merge");

            window.Click(InventoryConstants.pointPageInventory, false, true);

            int page = 0;

            if (equip)
            {
                foreach (Point point in equipPoints)
                {
                    window.Click(point, false, true);
                    window.SendString("d", true);
                }
            }

            foreach (InventarSlot inventarSlot in inventarSlots)
            {
                if (inventarSlot.page < 1 || inventarSlot.page > 3 || inventarSlot.row < 1 || inventarSlot.row > 5 || inventarSlot.column < 1 || inventarSlot.column > 12)
                {
                    continue;
                }

                if (inventarSlot.page != page)
                {
                    switch (inventarSlot.page)
                    {
                    case 1:
                        window.Click(InventoryConstants.pointPage1, false, true);
                        break;

                    case 2:
                        window.Click(InventoryConstants.pointPage2, false, true);
                        break;

                    case 3:
                        window.Click(InventoryConstants.pointPage3, false, true);
                        break;
                    }

                    page = inventarSlot.page;
                }

                Point point = new Point(InventoryConstants.pointInventory1x1.X + (inventarSlot.column - 1) * 50, InventoryConstants.pointInventory1x1.Y + (inventarSlot.row - 1) * 50);

                window.Click(point, false, true);
                window.SendString("d", true);
            }
        }
Beispiel #2
0
        public void Farm(int stage, int seconds, bool bossOnly, int endStage, int currentBoss)
        {
            if (window.Locked)
            {
                return;
            }

            window.Log($"Sniping Stage: {stage} BossOnly: {bossOnly} - For {seconds} seconds");

            window.Click(AdventureConstants.pointPageAdventure, false, true);
            window.Click(AdventureConstants.pointLeftArrow, true, true);

            window.SendString("q", false);

            if (!Console.IsOutputRedirected)
            {
                Console.Write($"{seconds,5}");
            }

            Stopwatch sw = new Stopwatch();

            sw.Start();

            Stopwatch swContinue = new Stopwatch();

            while (sw.ElapsedMilliseconds < seconds * 1000 && !window.Locked)
            {
                //Wait for Player HP
                swContinue.Restart();
                while (window.GetPixelColor(AdventureConstants.pointHealthPlayer, true) != AdventureConstants.colorPlayerHealthMax && !window.Locked)
                {
                    if (swContinue.ElapsedMilliseconds > 20000)
                    {
                        window.Click(AdventureConstants.pointLeftArrow, true, true);
                        break;
                    }

                    if (!Console.IsOutputRedirected)
                    {
                        Console.Write(new String('\b', 5) + $"{(seconds * 1000 - sw.ElapsedMilliseconds) / 1000,5}");
                    }

                    Thread.Sleep(5);
                }
                if (swContinue.ElapsedMilliseconds > 20000)
                {
                    continue;
                }

                if (stage < 0)
                {
                    window.Click(AdventureConstants.pointRightArrow, true, true);
                    for (int i = -1; i > stage; i--)
                    {
                        window.Click(AdventureConstants.pointLeftArrow, false, true);
                    }
                }
                else
                {
                    for (int i = 1; i < stage; i++)
                    {
                        window.Click(AdventureConstants.pointRightArrow, false, true);
                    }
                }

                //Wait for Mob
                swContinue.Restart();
                while (window.GetPixelColor(AdventureConstants.pointHealthMob, true) != AdventureConstants.colorMobHealthAlive && !window.Locked)
                {
                    if (swContinue.ElapsedMilliseconds > 6000)
                    {
                        window.Click(AdventureConstants.pointLeftArrow, true, true);
                        break;
                    }

                    if (!Console.IsOutputRedirected)
                    {
                        Console.Write(new String('\b', 5) + $"{(seconds * 1000 - sw.ElapsedMilliseconds) / 1000,5}");
                    }

                    Thread.Sleep(5);
                }
                if (swContinue.ElapsedMilliseconds > 6000)
                {
                    continue;
                }

                if (bossOnly && window.GetPixelColor(AdventureConstants.pointCrown, true) != AdventureConstants.colorCrown)
                {
                    window.Click(AdventureConstants.pointLeftArrow, true, true);
                }
                else
                {
                    //Wait for Mob death
                    swContinue.Restart();
                    while (window.GetPixelColor(AdventureConstants.pointHealthMob, true) != AdventureConstants.colorMobHealthDead && !window.Locked)
                    {
                        if (swContinue.ElapsedMilliseconds > 60000)
                        {
                            window.Click(AdventureConstants.pointLeftArrow, true, true);
                            break;
                        }

                        window.SendString("ghfytrewdsax", false);

                        if (!Console.IsOutputRedirected)
                        {
                            Console.Write(new String('\b', 5) + $"{(seconds * 1000 - sw.ElapsedMilliseconds) / 1000,5}");
                        }

                        Thread.Sleep(5);
                    }
                    if (swContinue.ElapsedMilliseconds > 60000)
                    {
                        continue;
                    }

                    window.Click(AdventureConstants.pointLeftArrow, true, true);
                }
            }

            if (!Console.IsOutputRedirected)
            {
                Console.Write(new String('\b', 5));
            }

            window.SendString("q", false);
            Farm(endStage, currentBoss);
        }
        public void SetDiggers(List <KeyValuePair <int, int> > diggerList)
        {
            window.Click(GoldDiggersConstants.pointPageGoldDiggers, false, false);

            window.Click(GoldDiggersConstants.pointClearActiveDiggers, false, false);

            int lastPage = 0;

            foreach (KeyValuePair <int, int> digger in diggerList)
            {
                int page = ((digger.Key - 1) / 4) + 1;

                if (page != lastPage)
                {
                    switch (page)
                    {
                    case 1:
                        window.Click(GoldDiggersConstants.pointPage1, false, false);
                        break;

                    case 2:
                        window.Click(GoldDiggersConstants.pointPage2, false, false);
                        break;

                    case 3:
                        window.Click(GoldDiggersConstants.pointPage3, false, false);
                        break;
                    }
                    lastPage = page;
                }

                Point offset = GoldDiggersConstants.pointDigger1Offset;

                int diggerOnPage = ((digger.Key - 1) % 4) + 1;

                switch (diggerOnPage)
                {
                case 1:
                    offset = GoldDiggersConstants.pointDigger1Offset;
                    break;

                case 2:
                    offset = GoldDiggersConstants.pointDigger2Offset;
                    break;

                case 3:
                    offset = GoldDiggersConstants.pointDigger3Offset;
                    break;

                case 4:
                    offset = GoldDiggersConstants.pointDigger4Offset;
                    break;
                }

                if (digger.Value == 0)
                {
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerCap.X, offset.Y + GoldDiggersConstants.pointDiggerCap.Y), false, false);
                }
                else if (digger.Value < 0)
                {
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerCap.X, offset.Y + GoldDiggersConstants.pointDiggerCap.Y), false, false);
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerActive.X, offset.Y + GoldDiggersConstants.pointDiggerActive.Y), false, false);
                    for (int i = digger.Value; i < 0; i++)
                    {
                        window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerMinus.X, offset.Y + GoldDiggersConstants.pointDiggerMinus.Y), false, false);
                    }
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerMinus.X, offset.Y + GoldDiggersConstants.pointDiggerMinus.Y), false, false);
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerPlus.X, offset.Y + GoldDiggersConstants.pointDiggerPlus.Y), false, false);
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerActive.X, offset.Y + GoldDiggersConstants.pointDiggerActive.Y), false, false);
                }
                else
                {
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerInput.X, offset.Y + GoldDiggersConstants.pointDiggerInput.Y), false, false);
                    window.SendString(digger.Value.ToString(), false);
                    window.Click(new Point(offset.X + GoldDiggersConstants.pointDiggerActive.X, offset.Y + GoldDiggersConstants.pointDiggerActive.Y), false, false);
                }
            }
        }
Beispiel #4
0
        public BigInteger AllocateEXP(long eCapRatio, long ePowerRatio, long eBarRatio, long mCapRatio, long mPowerRatio, long mBarRatio, long tCapRatio, long tPowerRatio, long tBarRatio)
        {
            bool       spendThird  = tCapRatio > 0 || tPowerRatio > 0 || tBarRatio > 0;
            BigInteger costPerUnit = (eCapRatio > 0 ? (eCapRatio * SpendEXPConstants.costEnergyCapPer10000) / 10000 : 0)
                                     + (ePowerRatio > 0 ? (ePowerRatio * SpendEXPConstants.costEnergyPowerPer10000) / 10000 : 0)
                                     + (eBarRatio > 0 ? (eBarRatio * SpendEXPConstants.costEnergyBarPer10000) / 10000 : 0)
                                     + (mCapRatio > 0 ? (mCapRatio * SpendEXPConstants.costMagicCapPer10000) / 10000 : 0)
                                     + (mPowerRatio > 0 ? (mPowerRatio * SpendEXPConstants.costMagicPowerPer10000) / 10000 : 0)
                                     + (mBarRatio > 0 ? (mBarRatio * SpendEXPConstants.costMagicBarPer10000) / 10000 : 0)
                                     + (tCapRatio > 0 ? (tCapRatio * SpendEXPConstants.costThirdCapPer10000) / 10000 : 0)
                                     + (tPowerRatio > 0 ? (tPowerRatio * SpendEXPConstants.costThirdPowerPer10000) / 10000 : 0)
                                     + (tBarRatio > 0 ? (tBarRatio * SpendEXPConstants.costThirdBarPer10000) / 10000 : 0);

            BigInteger startExp = GetEXP();

            if (startExp < costPerUnit)
            {
                return(0);
            }

            window.Click(SpendEXPConstants.pointPageSpendEXP, false, true);
            BigInteger eCap   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseCap, false));
            BigInteger ePower = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBasePower, false));
            BigInteger eBar   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseBar, false));

            window.Click(SpendEXPConstants.pointPageMagic, false, true);
            BigInteger mCap   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseCap, false));
            BigInteger mPower = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBasePower, false));
            BigInteger mBar   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseBar, false));

            BigInteger tCap   = 0;
            BigInteger tPower = 0;
            BigInteger tBar   = 0;

            if (spendThird)
            {
                window.Click(SpendEXPConstants.pointPageThird, false, true);
                tCap   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseCap, false));
                tPower = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBasePower, false));
                tBar   = window.Parse(window.OCRTextSearch(SpendEXPConstants.rectBaseBar, false));
            }

            BigInteger eCapCurrentUnits   = eCap > 0 && eCapRatio > 0 ? eCap / eCapRatio : -1;
            BigInteger ePowerCurrentUnits = ePower > 0 && ePowerRatio > 0 ? ePower / ePowerRatio : -1;
            BigInteger eBarCurrentUnits   = eBar > 0 && eBarRatio > 0 ? eBar / eBarRatio : -1;
            BigInteger mCapCurrentUnits   = mCap > 0 && mCapRatio > 0 ? mCap / mCapRatio : -1;
            BigInteger mPowerCurrentUnits = mPower > 0 && mPowerRatio > 0 ? mPower / mPowerRatio : -1;
            BigInteger mBarCurrentUnits   = mBar > 0 && mBarRatio > 0 ? mBar / mBarRatio : -1;
            BigInteger tCapCurrentUnits   = tCap > 0 && tCapRatio > 0 ? tCap / tCapRatio : -1;
            BigInteger tPowerCurrentUnits = tPower > 0 && tPowerRatio > 0 ? tPower / tPowerRatio : -1;
            BigInteger tBarCurrentUnits   = tBar > 0 && tBarRatio > 0 ? tBar / tBarRatio : -1;

            BigInteger maxCurrentUnits = max(new BigInteger[] { eCapCurrentUnits, ePowerCurrentUnits, eBarCurrentUnits, mCapCurrentUnits, mPowerCurrentUnits, mBarCurrentUnits, tCapCurrentUnits, tPowerCurrentUnits, tBarCurrentUnits });
            BigInteger minCurrentUnits = min(new BigInteger[] { eCapCurrentUnits, ePowerCurrentUnits, eBarCurrentUnits, mCapCurrentUnits, mPowerCurrentUnits, mBarCurrentUnits, tCapCurrentUnits, tPowerCurrentUnits, tBarCurrentUnits });

            BigInteger targetUnits = minCurrentUnits + (startExp / costPerUnit);

            BigInteger eCapTarget   = targetUnits * eCapRatio;
            BigInteger ePowerTarget = targetUnits * ePowerRatio;
            BigInteger eBarTarget   = targetUnits * eBarRatio;
            BigInteger mCapTarget   = targetUnits * mCapRatio;
            BigInteger mPowerTarget = targetUnits * mPowerRatio;
            BigInteger mBarTarget   = targetUnits * mBarRatio;
            BigInteger tCapTarget   = targetUnits * tCapRatio;
            BigInteger tPowerTarget = targetUnits * tPowerRatio;
            BigInteger tBarTarget   = targetUnits * tBarRatio;

            BigInteger eCapNeeded   = eCapTarget - eCap;
            BigInteger ePowerNeeded = ePowerTarget - ePower;
            BigInteger eBarNeeded   = eBarTarget - eBar;
            BigInteger mCapNeeded   = mCapTarget - mCap;
            BigInteger mPowerNeeded = mPowerTarget - mPower;
            BigInteger mBarNeeded   = mBarTarget - mBar;
            BigInteger tCapNeeded   = tCapTarget - tCap;
            BigInteger tPowerNeeded = tPowerTarget - tPower;
            BigInteger tBarNeeded   = tBarTarget - tBar;

            window.Click(SpendEXPConstants.pointPageEnergy, false, true);
            if (eBarNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldBar, false, false);
                window.SendString(eBarNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyBar, false, false);
            }
            if (ePowerNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldPower, false, false);
                window.SendString(ePowerNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyPower, false, false);
            }
            if (eCapNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldCap, false, false);
                window.SendString(eCapNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyCap, false, false);
            }

            window.Click(SpendEXPConstants.pointPageMagic, false, true);
            if (mBarNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldBar, false, false);
                window.SendString(mBarNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyBar, false, false);
            }
            if (mPowerNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldPower, false, false);
                window.SendString(mPowerNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyPower, false, false);
            }
            if (mCapNeeded > 0)
            {
                window.Click(SpendEXPConstants.pointFieldCap, false, false);
                window.SendString(mCapNeeded.ToString(), false);
                window.Click(SpendEXPConstants.pointBuyCap, false, false);
            }

            if (spendThird)
            {
                window.Click(SpendEXPConstants.pointPageThird, false, true);
                if (tBarNeeded > 0)
                {
                    window.Click(SpendEXPConstants.pointFieldBar, false, false);
                    window.SendString(tBarNeeded.ToString(), false);
                    window.Click(SpendEXPConstants.pointBuyBar, false, false);
                }
                if (tPowerNeeded > 0)
                {
                    window.Click(SpendEXPConstants.pointFieldPower, false, false);
                    window.SendString(tPowerNeeded.ToString(), false);
                    window.Click(SpendEXPConstants.pointBuyPower, false, false);
                }
                if (tCapNeeded > 0)
                {
                    window.Click(SpendEXPConstants.pointFieldCap, false, false);
                    window.SendString(tCapNeeded.ToString(), false);
                    window.Click(SpendEXPConstants.pointBuyCap, false, false);
                }
            }

            BigInteger endExp = GetEXP();

            return(startExp - endExp);
        }