Пример #1
0
        void AutomationRoutine()
        {
            try
            {
                if (!Settings.GlobalEnabled)
                {
                    _timeLeft = 10f;
                    return;
                }

                if (Settings.ManageInventory)
                {
                    var converted  = Character.inventory.GetConvertedInventory().ToArray();
                    var boostSlots = _invManager.GetBoostSlots(converted);
                    _invManager.EnsureFiltered(converted);
                    _invManager.ManageConvertibles(converted);
                    _invManager.MergeEquipped();
                    _invManager.MergeInventory(converted);
                    _invManager.MergeBoosts(converted);
                    _invManager.MergeGuffs(converted);
                    _invManager.BoostInventory(boostSlots);
                    _invManager.BoostInfinityCube();
                    _invManager.ManageBoostConversion(boostSlots);
                }

                if (Settings.SwapTitanLoadouts)
                {
                    LoadoutManager.TryTitanSwap();
                    DiggerManager.TryTitanSwap();
                }

                if (Settings.ManageYggdrasil && Character.buttons.yggdrasil.interactable)
                {
                    _yggManager.ManageYggHarvest();
                    _yggManager.CheckFruits();
                }

                if (Settings.AutoBuyEM)
                {
                    //We haven't unlocked custom purchases yet
                    if (Character.highestBoss < 17)
                    {
                        return;
                    }
                    //Magic isn't unlocked yet
                    if (Character.highestBoss < 37)
                    {
                        var ePurchase    = Character.energyPurchases;
                        var total        = ePurchase.customAllCost();
                        var numPurchases = Math.Floor((double)(Character.realExp / total));
                        if (numPurchases > 0)
                        {
                            var ePurchaseMethod = ePurchase.GetType().GetMethod("buyCustomAll",
                                                                                BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                            if (ePurchaseMethod != null)
                            {
                                Log($"Buying {numPurchases} exp purchases");
                                for (var i = 0; i < numPurchases; i++)
                                {
                                    ePurchaseMethod.Invoke(ePurchase, null);
                                }
                            }
                        }
                    }
                    else
                    {
                        var ePurchase    = Character.energyPurchases;
                        var mPurchase    = Character.magicPurchases;
                        var total        = ePurchase.customAllCost() + mPurchase.customAllCost();
                        var numPurchases = Math.Floor((double)(Character.realExp / total));
                        if (numPurchases > 0)
                        {
                            var ePurchaseMethod = ePurchase.GetType().GetMethod("buyCustomAll",
                                                                                BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                            var mPurchaseMethod = mPurchase.GetType().GetMethod("buyCustomAll",
                                                                                BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                            if (ePurchaseMethod != null && mPurchaseMethod != null)
                            {
                                Log($"Buying {numPurchases} e/m purchases");
                                for (var i = 0; i < numPurchases; i++)
                                {
                                    ePurchaseMethod.Invoke(ePurchase, null);
                                    mPurchaseMethod.Invoke(mPurchase, null);
                                }
                            }
                        }
                    }
                }

                if (Settings.ManageGear)
                {
                    _profile.EquipGear();
                }
                if (Settings.ManageEnergy)
                {
                    _profile.AllocateEnergy();
                }
                if (Settings.ManageMagic)
                {
                    _profile.AllocateMagic();
                }
                if (Settings.ManageR3)
                {
                    _profile.AllocateR3();
                }

                if (Settings.ManageDiggers && Character.buttons.diggers.interactable)
                {
                    _profile.EquipDiggers();
                    DiggerManager.RecapDiggers();
                }

                if (Settings.ManageWandoos && Character.buttons.wandoos.interactable)
                {
                    _profile.SwapOS();
                }

                if (Settings.AutoQuest && Character.buttons.beast.interactable)
                {
                    var converted = Character.inventory.GetConvertedInventory().ToArray();
                    _invManager.ManageQuestItems(converted);
                    _questManager.CheckQuestTurnin();
                    _questManager.ManageQuests();
                }

                if (Settings.AutoRebirth)
                {
                    _profile.DoRebirth();
                }
            }
            catch (Exception e)
            {
                Log(e.Message);
                Log(e.StackTrace);
            }
            _timeLeft = 10f;
        }
Пример #2
0
        // Runs every 10 seconds, our main loop
        void AutomationRoutine()
        {
            try
            {
                if (!Settings.GlobalEnabled)
                {
                    _timeLeft = 10f;
                    return;
                }

                ZoneHelpers.OptimizeITOPOD();

                if (Settings.ManageInventory && !Controller.midDrag)
                {
                    var converted  = Character.inventory.GetConvertedInventory().ToArray();
                    var boostSlots = _invManager.GetBoostSlots(converted);
                    _invManager.EnsureFiltered(converted);
                    _invManager.ManageConvertibles(converted);
                    _invManager.MergeEquipped(converted);
                    _invManager.MergeInventory(converted);
                    _invManager.MergeBoosts(converted);
                    _invManager.MergeGuffs(converted);
                    _invManager.BoostInventory(boostSlots);
                    _invManager.BoostInfinityCube();
                    _invManager.ManageBoostConversion(boostSlots);
                }

                //if (Settings.ManageInventory && !Controller.midDrag)
                //{
                //    var watch = Stopwatch.StartNew();
                //    var converted = Character.inventory.GetConvertedInventory().ToArray();
                //    Log($"Creating CI: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    var boostSlots = _invManager.GetBoostSlots(converted);
                //    Log($"Get Boost Slots: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.EnsureFiltered(converted);
                //    Log($"Filtering: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.ManageConvertibles(converted);
                //    Log($"Convertibles: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.MergeEquipped(converted);
                //    Log($"Merge Equipped: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.MergeInventory(converted);
                //    Log($"Merge Inventory: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.MergeBoosts(converted);
                //    Log($"Merge Boosts: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.MergeGuffs(converted);
                //    Log($"Merge Guffs: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.BoostInventory(boostSlots);
                //    Log($"Boost Inventory: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.BoostInfinityCube();
                //    Log($"Boost Cube: {watch.ElapsedMilliseconds}");
                //    watch = Stopwatch.StartNew();
                //    _invManager.ManageBoostConversion(boostSlots);
                //    Log($"Boost Conversion: {watch.ElapsedMilliseconds}");
                //    watch.Stop();
                //}

                if (Settings.SwapTitanLoadouts || Settings.ManageGoldLoadouts && Settings.NeedsGoldSwap())
                {
                    LoadoutManager.TryTitanSwap();
                    DiggerManager.TryTitanSwap();
                }

                if (Settings.ManageYggdrasil && Character.buttons.yggdrasil.interactable)
                {
                    _yggManager.ManageYggHarvest();
                    _yggManager.CheckFruits();
                }

                if (Settings.AutoBuyEM)
                {
                    //We haven't unlocked custom purchases yet
                    if (Character.highestBoss < 17)
                    {
                        return;
                    }

                    var ePurchase  = Character.energyPurchases;
                    var mPurchase  = Character.magicPurchases;
                    var r3Purchase = Character.res3Purchases;

                    var energy = ePurchase.customAllCost() > 0;
                    var r3     = Character.res3.res3On && r3Purchase.customAllCost() > 0;
                    var magic  = Character.highestBoss >= 37 && mPurchase.customAllCost() > 0;

                    long total = 0;

                    if (energy)
                    {
                        total += ePurchase.customAllCost();
                    }

                    if (magic)
                    {
                        total += mPurchase.customAllCost();
                    }

                    if (r3)
                    {
                        total += r3Purchase.customAllCost();
                    }

                    if (total > 0)
                    {
                        var numPurchases = Math.Floor((double)(Character.realExp / total));

                        if (numPurchases > 0)
                        {
                            var t = string.Empty;
                            if (energy)
                            {
                                t += "/exp";
                            }

                            if (magic)
                            {
                                t += "/magic";
                            }

                            if (r3)
                            {
                                t += "/res3";
                            }

                            t = t.Substring(1);

                            Log($"Buying {numPurchases} {t} purchases");
                            for (var i = 0; i < numPurchases; i++)
                            {
                                if (energy)
                                {
                                    var ePurchaseMethod = ePurchase.GetType().GetMethod("buyCustomAll",
                                                                                        BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                                    ePurchaseMethod?.Invoke(ePurchase, null);
                                }

                                if (magic)
                                {
                                    var mPurchaseMethod = mPurchase.GetType().GetMethod("buyCustomAll",
                                                                                        BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                                    mPurchaseMethod?.Invoke(mPurchase, null);
                                }

                                if (r3)
                                {
                                    var r3PurchaseMethod = r3Purchase.GetType().GetMethod("buyCustomAll",
                                                                                          BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                                    r3PurchaseMethod?.Invoke(r3Purchase, null);
                                }
                            }
                        }
                    }
                }

                _profile.DoAllocations();

                _profile.CastBloodSpells();

                if (Settings.AutoQuest && Character.buttons.beast.interactable)
                {
                    var converted = Character.inventory.GetConvertedInventory().ToArray();
                    if (!Character.inventoryController.midDrag)
                    {
                        _invManager.ManageQuestItems(converted);
                    }
                    _questManager.CheckQuestTurnin();
                    _questManager.ManageQuests();
                }

                if (Settings.AutoRebirth)
                {
                    _profile.DoRebirth();
                }

                if (Settings.ManageMayo)
                {
                    _cardManager.CheckManas();
                }

                if (Settings.TrashCards)
                {
                    _cardManager.TrashCards();
                }
                if (Settings.AutoCastCards)
                {
                    _cardManager.CastCards();
                }

                if (Settings.ManageCooking)
                {
                    _cookingManager.manageFood();
                }
            }
            catch (Exception e)
            {
                Log(e.Message);
                Log(e.StackTrace);
            }
            _timeLeft = 10f;
        }