internal static void CheckMoneyPit() { if (Main.Character.pit.pitTime.totalseconds < Main.Character.pitController.currentPitTime()) { return; } if (Main.Character.realGold < Main.Settings.MoneyPitThreshold) { return; } if (Main.Character.realGold < 1e5) { return; } if (Main.Settings.MoneyPitLoadout.Length > 0) { if (!LoadoutManager.TryMoneyPitSwap()) { return; } } var controller = Main.Character.pitController; typeof(PitController).GetMethod("engage", BindingFlags.NonPublic | BindingFlags.Instance) ?.Invoke(controller, null); Main.LogPitSpin($"Money Pit Reward: {controller.pitText.text}"); if (Main.Settings.MoneyPitLoadout.Length > 0) { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } }
internal static void CheckMoneyPit() { if (Main.Character.pit.pitTime.totalseconds < Main.Character.pitController.currentPitTime()) { return; } if (Main.Character.realGold < Main.Settings.MoneyPitThreshold) { return; } if (Main.Character.realGold < 1e5) { return; } if (Main.Settings.MoneyPitLoadout.Length > 0) { if (!LoadoutManager.TryMoneyPitSwap()) { return; } } if (Main.Character.realGold >= 1e50 && Main.Settings.ManageMagic && Main.Character.wishes.wishes[4].level > 0) { Main.Character.removeMostMagic(); for (var i = Main.Character.bloodMagic.ritual.Count - 1; i >= 0; i--) { Main.Character.bloodMagicController.bloodMagics[i].cap(); } if (!DiggerManager.CanSwap()) { return; } DiggerManager.SaveDiggers(); DiggerManager.EquipDiggers(new[] { 10 }); DoMoneyPit(); DiggerManager.RestoreDiggers(); } else { DoMoneyPit(); } if (Main.Settings.MoneyPitLoadout.Length > 0) { if (LoadoutManager.SwappedQuestToMoneyPit) { LoadoutManager.RestoreQuestLayoutFromPit(); } else { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } } }
internal void ManageYggHarvest() { //We need to harvest but we dont have a loadout to manage OR we're not managing loadout if (!Settings.SwapYggdrasilLoadouts || Settings.YggdrasilLoadout.Length == 0) { //Not sure why this would be true, but safety first if (LoadoutManager.CurrentLock == LockType.Yggdrasil) { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } if (DiggerManager.CurrentLock == LockType.Yggdrasil) { DiggerManager.RestoreDiggers(); DiggerManager.ReleaseLock(); } ActuallyHarvest(); return; } //We dont need to harvest anymore and we've already swapped, so swap back if (!NeedsHarvest() && LoadoutManager.CurrentLock == LockType.Yggdrasil) { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } if (!NeedsHarvest() && DiggerManager.CurrentLock == LockType.Yggdrasil) { DiggerManager.RestoreDiggers(); DiggerManager.ReleaseLock(); } //We're managing loadouts if (NeedsHarvest()) { if (NeedsSwap()) { if (!LoadoutManager.TryYggdrasilSwap() || !DiggerManager.TryYggSwap()) { return; } Log("Equipping Loadout for Yggdrasil and Harvesting"); } else { Log("Harvesting without swap because threshold not met"); } //Harvest stuff ActuallyHarvest(); } }
internal void CheckQuestTurnin() { if (_character.beastQuest.curDrops >= _character.beastQuest.targetDrops - 2) { if (!_character.beastQuest.usedButter) { if (_character.beastQuest.reducedRewards && Settings.UseButterMinor) { Log("Buttering Minor Quest"); _character.beastQuestController.tryUseButter(); } if (!_character.beastQuest.reducedRewards && Settings.UseButterMajor) { Log("Buttering Major Quest"); _character.beastQuestController.tryUseButter(); } } } if (_character.beastQuestController.readyToHandIn()) { Log("Turning in quest"); _character.beastQuestController.completeQuest(); // Check if we need to swap back gear and release lock if (LoadoutManager.HasQuestLock()) { // No more quests, swap back if (_character.beastQuest.curBankedQuests == 0) { LoadoutManager.RestoreOriginalQuestGear(); LoadoutManager.ReleaseLock(); } // else if majors are off and we're not manualing minors, swap back else if (!Settings.AllowMajorQuests && !Settings.ManualMinors) { LoadoutManager.RestoreOriginalQuestGear(); LoadoutManager.ReleaseLock(); } } } }
internal static void CheckMoneyPit() { if (Main.Character.pit.pitTime.totalseconds < Main.Character.pitController.currentPitTime()) { return; } if (Main.Character.realGold < Main.Settings.MoneyPitThreshold) { return; } if (Main.Character.realGold < 1e5) { return; } if (Main.Settings.MoneyPitLoadout.Length > 0) { if (!LoadoutManager.TryMoneyPitSwap()) { return; } } if (Main.Character.realGold >= 1e50 && Main.Settings.ManageMagic && Main.Character.wishes.wishes[4].level > 0) { Main.Character.removeMostMagic(); for (var i = Main.Character.bloodMagic.ritual.Count - 1; i >= 0; i--) { Main.Character.bloodMagicController.bloodMagics[i].cap(); } } var controller = Main.Character.pitController; typeof(PitController).GetMethod("engage", BindingFlags.NonPublic | BindingFlags.Instance) ?.Invoke(controller, null); Main.LogPitSpin($"Money Pit Reward: {controller.pitText.text}"); if (Main.Settings.MoneyPitLoadout.Length > 0) { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } }
internal int IsQuesting() { if (!Settings.AutoQuest) { return(-1); } if (!_character.beastQuest.inQuest) { return(-1); } var questZone = _character.beastQuestController.curQuestZone(); if (!CombatManager.IsZoneUnlocked(questZone)) { return(-1); } if (_character.beastQuest.reducedRewards) { if (Settings.ManualMinors) { EquipQuestingLoadout(); return(questZone); } else if (LoadoutManager.HasQuestLock()) { LoadoutManager.RestoreOriginalQuestGear(); LoadoutManager.ReleaseLock(); } return(-1); } EquipQuestingLoadout(); return(_character.beastQuestController.curQuestZone()); }
public void bestCooking() { if (cook.getCurScore() == cook.getOptimalScore()) { if (cook.character.cooking.cookTimer >= cook.eatRate()) { if (Settings.ManageCookingLoadouts && Settings.CookingLoadout.Length > 0) { if (!LoadoutManager.TryCookingSwap()) { Log("Unable to acquire lock for gear, waiting a cycle to equip gears"); return; } } cook.consumeDish(); if (LoadoutManager.HasCookingLock()) { LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); } } return; } int foodA = 0; int foodB = 0; int foodC = 0; int foodD = 0; int foodE = 0; int foodF = 0; int foodG = 0; int foodH = 0; float num = 0f; for (int i = 0; i <= cook.maxIngredientLevel(); i++) { for (int j = 0; j <= cook.maxIngredientLevel(); j++) { float num2 = 0f; if (cook.ingredientUnlocked(cook.character.cooking.pair1[0])) { num2 += cook.getLocalScore(cook.character.cooking.pair1[0], i) + cook.getLocalScore(cook.character.cooking.pair1[1], i); } if (cook.ingredientUnlocked(cook.character.cooking.pair1[1])) { num2 += cook.getLocalScore(cook.character.cooking.pair1[0], j) + cook.getLocalScore(cook.character.cooking.pair1[1], j); } if (cook.ingredientUnlocked(cook.character.cooking.pair1[0]) && cook.ingredientUnlocked(cook.character.cooking.pair1[1])) { num2 += cook.getPairedScore(1, i + j); } if (num2 > num) { foodA = i; foodB = j; num = num2; } } } float num3 = 0f; for (int k = 0; k <= cook.maxIngredientLevel(); k++) { for (int l = 0; l <= cook.maxIngredientLevel(); l++) { float num2 = 0f; if (cook.ingredientUnlocked(cook.character.cooking.pair2[0])) { num2 += cook.getLocalScore(cook.character.cooking.pair2[0], k) + cook.getLocalScore(cook.character.cooking.pair2[1], k); } if (cook.ingredientUnlocked(cook.character.cooking.pair2[1])) { num2 += cook.getLocalScore(cook.character.cooking.pair2[0], l) + cook.getLocalScore(cook.character.cooking.pair2[1], l); } if (cook.ingredientUnlocked(cook.character.cooking.pair2[0]) && cook.ingredientUnlocked(cook.character.cooking.pair2[1])) { num2 += cook.getPairedScore(2, k + l); } if (num2 > num3) { foodC = k; foodD = l; num3 = num2; } } } float num4 = 0f; for (int m = 0; m <= cook.maxIngredientLevel(); m++) { for (int n = 0; n <= cook.maxIngredientLevel(); n++) { float num2 = 0f; if (cook.ingredientUnlocked(cook.character.cooking.pair3[0])) { num2 += cook.getLocalScore(cook.character.cooking.pair3[0], m) + cook.getLocalScore(cook.character.cooking.pair3[1], m); } if (cook.ingredientUnlocked(cook.character.cooking.pair3[1])) { num2 += cook.getLocalScore(cook.character.cooking.pair3[0], n) + cook.getLocalScore(cook.character.cooking.pair3[1], n); } if (cook.ingredientUnlocked(cook.character.cooking.pair3[0]) && cook.ingredientUnlocked(cook.character.cooking.pair3[1])) { num2 += cook.getPairedScore(3, m + n); } if (num2 > num4) { foodE = m; foodF = n; num4 = num2; } } } float num5 = 0f; for (int num6 = 0; num6 <= cook.maxIngredientLevel(); num6++) { for (int num7 = 0; num7 <= cook.maxIngredientLevel(); num7++) { float num2 = 0f; if (cook.ingredientUnlocked(cook.character.cooking.pair4[0])) { num2 += cook.getLocalScore(cook.character.cooking.pair4[0], num6) + cook.getLocalScore(cook.character.cooking.pair4[1], num6); } if (cook.ingredientUnlocked(cook.character.cooking.pair4[1])) { num2 += cook.getLocalScore(cook.character.cooking.pair4[0], num7) + cook.getLocalScore(cook.character.cooking.pair4[1], num7); } if (cook.ingredientUnlocked(cook.character.cooking.pair4[0]) && cook.ingredientUnlocked(cook.character.cooking.pair4[1])) { num2 += cook.getPairedScore(4, num6 + num7); } if (num2 > num5) { foodG = num6; foodH = num7; num5 = num2; } } } Main.LogAllocation($"Best Cooking:: {cook.character.cooking.pair1[0]}@{foodA} | {cook.character.cooking.pair1[1]}@{foodB} |" + $" {cook.character.cooking.pair2[0]}@{foodC} | {cook.character.cooking.pair2[1]}@{foodD} |" + $" {cook.character.cooking.pair3[0]}@{foodE} | {cook.character.cooking.pair3[1]}@{foodF} |" + $" {cook.character.cooking.pair4[0]}@{foodG} | {cook.character.cooking.pair4[1]}@{foodH}"); if (cook.ingredientUnlocked(cook.character.cooking.pair1[0])) { cook.character.cooking.ingredients[cook.character.cooking.pair1[0]].curLevel = foodA; } if (cook.ingredientUnlocked(cook.character.cooking.pair1[1])) { cook.character.cooking.ingredients[cook.character.cooking.pair1[1]].curLevel = foodB; } if (cook.ingredientUnlocked(cook.character.cooking.pair2[0])) { cook.character.cooking.ingredients[cook.character.cooking.pair2[0]].curLevel = foodC; } if (cook.ingredientUnlocked(cook.character.cooking.pair2[1])) { cook.character.cooking.ingredients[cook.character.cooking.pair2[1]].curLevel = foodD; } if (cook.ingredientUnlocked(cook.character.cooking.pair3[0])) { cook.character.cooking.ingredients[cook.character.cooking.pair3[0]].curLevel = foodE; } if (cook.ingredientUnlocked(cook.character.cooking.pair3[1])) { cook.character.cooking.ingredients[cook.character.cooking.pair3[1]].curLevel = foodF; } if (cook.ingredientUnlocked(cook.character.cooking.pair4[0])) { cook.character.cooking.ingredients[cook.character.cooking.pair4[0]].curLevel = foodG; } if (cook.ingredientUnlocked(cook.character.cooking.pair4[1])) { cook.character.cooking.ingredients[cook.character.cooking.pair4[1]].curLevel = foodH; } }
internal void ManualZone(int zone, bool bossOnly, bool recoverHealth, bool precastBuffs, bool fastCombat) { //Start by turning off auto attack if its on unless we can only idle attack if (!_character.adventure.autoattacking) { if (_character.training.attackTraining[1] == 0) { _character.adventureController.idleAttackMove.setToggle(); } } else { if (_character.training.attackTraining[1] > 0) { _character.adventureController.idleAttackMove.setToggle(); } } //Move back to safe zone if we're in the wrong zone if (_character.adventure.zone != zone && _character.adventure.zone != -1) { MoveToZone(-1); } //If precast buffs is true and we have no enemy and charge isn't active, go back to safe zone if (precastBuffs && !ChargeActive() && _character.adventureController.currentEnemy == null) { MoveToZone(-1); } //If we're in safe zone, recover health if needed. Also precast buffs if (_character.adventure.zone == -1) { if (precastBuffs) { if (ChargeUnlocked() && !ChargeActive()) { if (CastCharge()) { return; } } if (ParryUnlocked() && !ParryActive()) { if (CastParry()) { return; } } //Wait for Charge to be ready again if (ChargeUnlocked() && !ChargeReady()) { return; } if (ParryUnlocked() && !ParryReady()) { return; } } if (recoverHealth && !HasFullHP()) { if (ChargeUnlocked() && !ChargeActive()) { if (CastCharge()) { return; } } if (ParryUnlocked() && !ParryActive()) { if (CastParry()) { return; } } return; } } //Move to the zone if (_character.adventure.zone != zone) { MoveToZone(zone); return; } //Wait for an enemy to spawn if (_character.adventureController.currentEnemy == null) { if (!precastBuffs && bossOnly) { if (!ChargeActive()) { if (CastCharge()) { return; } } if (!ParryActive()) { if (CastParry()) { return; } } if (GetHPPercentage() < .75) { if (CastHeal()) { return; } } } if (isFighting) { isFighting = false; if (precastBuffs) { MoveToZone(-1); return; } if (LoadoutManager.CurrentLock == LockType.Gold) { Settings.NextGoldSwap = false; settingsForm.UpdateGoldLoadout(Settings.NextGoldSwap); LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); MoveToZone(-1); } } return; } //We have an enemy. Lets check if we're in bossOnly mode if (bossOnly) { var ec = _character.adventureController.currentEnemy.enemyType; if (ec != enemyType.boss && !ec.ToString().Contains("bigBoss")) { MoveToZone(-1); MoveToZone(zone); return; } } isFighting = true; //We have an enemy and we're ready to fight. Run through our combat routine if (_character.training.attackTraining[1] > 0) { DoCombat(fastCombat); } }
internal void ManualZone(int zone, bool bossOnly, bool recoverHealth, bool precastBuffs, bool fastCombat, bool beastMode) { if (zone == -1) { if (_character.adventure.zone != -1) { MoveToZone(-1); return; } } //Start by turning off auto attack if its on unless we can only idle attack if (!_character.adventure.autoattacking) { if (_character.training.attackTraining[1] == 0) { _character.adventureController.idleAttackMove.setToggle(); return; } } else { if (_character.training.attackTraining[1] > 0) { _character.adventureController.idleAttackMove.setToggle(); } } if (_character.adventure.beastModeOn && !beastMode && _character.adventureController.beastModeMove.button.interactable) { _character.adventureController.beastModeMove.doMove(); return; } if (!_character.adventure.beastModeOn && beastMode && _character.adventureController.beastModeMove.button.interactable) { _character.adventureController.beastModeMove.doMove(); return; } //Move back to safe zone if we're in the wrong zone if (_character.adventure.zone != zone && _character.adventure.zone != -1) { MoveToZone(-1); } //If precast buffs is true and we have no enemy and charge isn't active, go back to safe zone if (precastBuffs && !ChargeActive() && _character.adventureController.currentEnemy == null) { MoveToZone(-1); } //If we're in safe zone, recover health if needed. Also precast buffs if (_character.adventure.zone == -1) { if (precastBuffs) { if (ChargeUnlocked() && !ChargeActive()) { if (CastCharge()) { return; } } if (ParryUnlocked() && !ParryActive()) { if (CastParry()) { return; } } //Wait for Charge to be ready again, as well as other buffs if (ChargeUnlocked() && !ChargeReady()) { return; } if (ParryUnlocked() && !ParryReady()) { return; } if (MegaBuffUnlocked() && !MegaBuffReady()) { return; } if (UltimateBuffUnlocked() && !UltimateBuffReady()) { return; } if (DefensiveBuffUnlocked() && !DefensiveBuffReady()) { return; } } if (recoverHealth && !HasFullHP()) { if (ChargeUnlocked() && !ChargeActive()) { if (CastCharge()) { return; } } if (ParryUnlocked() && !ParryActive()) { if (CastParry()) { return; } } return; } } //Move to the zone if (_character.adventure.zone != zone) { _isFighting = false; MoveToZone(zone); return; } //Wait for an enemy to spawn if (_character.adventureController.currentEnemy == null) { if (_isFighting) { _isFighting = false; if (_fightTimer > 1) { LogCombat($"{_enemyName} killed in {_fightTimer:00.0}s"); } _fightTimer = 0; if (LoadoutManager.CurrentLock == LockType.Gold) { Log("Gold Loadout kill done. Turning off setting and swapping gear"); Settings.DoGoldSwap = false; LoadoutManager.RestoreGear(); LoadoutManager.ReleaseLock(); MoveToZone(-1); return; } if (precastBuffs || recoverHealth && !HasFullHP()) { MoveToZone(-1); return; } } _fightTimer = 0; if (!precastBuffs && bossOnly) { if (!ChargeActive()) { if (CastCharge()) { return; } } if (!ParryActive()) { if (CastParry()) { return; } } if (GetHPPercentage() < .75) { if (CastHeal()) { return; } } } if (fastCombat) { if (GetHPPercentage() < .75) { if (CastHeal()) { return; } } if (GetHPPercentage() < .60) { if (CastHyperRegen()) { return; } } } return; } if (zone < 1000 && Settings.BlacklistedBosses.Contains(_character.adventureController.currentEnemy.spriteID)) { MoveToZone(-1); MoveToZone(zone); return; } //We have an enemy. Lets check if we're in bossOnly mode if (bossOnly && zone < 1000) { var ec = _character.adventureController.currentEnemy.enemyType; if (ec != enemyType.boss && !ec.ToString().Contains("bigBoss")) { MoveToZone(-1); MoveToZone(zone); return; } } _isFighting = true; _enemyName = _character.adventureController.currentEnemy.name; //We have an enemy and we're ready to fight. Run through our combat routine if (_character.training.attackTraining[1] > 0) { DoCombat(fastCombat); } }
internal void ManageQuests() { //First logic: not in a quest if (!_character.beastQuest.inQuest) { bool startedQuest = false; //If we're allowing major quests and we have a quest available if (Settings.AllowMajorQuests && _character.beastQuest.curBankedQuests > 0) { _character.settings.useMajorQuests = true; SetIdleMode(false); EquipQuestingLoadout(); _character.beastQuestController.startQuest(); startedQuest = true; } else { _character.settings.useMajorQuests = false; SetIdleMode(!Settings.ManualMinors); if (Settings.ManualMinors) { EquipQuestingLoadout(); } _character.beastQuestController.startQuest(); startedQuest = true; } // If we're not questing and we still have the lock, restore gear if (!startedQuest && LoadoutManager.HasQuestLock()) { LoadoutManager.RestoreOriginalQuestGear(); LoadoutManager.ReleaseLock(); } return; } //Second logic, we're in a quest if (_character.beastQuest.reducedRewards) { if (Settings.AllowMajorQuests && Settings.AbandonMinors && _character.beastQuest.curBankedQuests > 0) { var progress = (_character.beastQuest.curDrops / (float)_character.beastQuest.targetDrops) * 100; if (progress <= Settings.MinorAbandonThreshold) { //If all this is true get rid of this minor quest and pick up a new one. _character.settings.useMajorQuests = true; _character.beastQuestController.skipQuest(); SetIdleMode(false); EquipQuestingLoadout(); _character.beastQuestController.startQuest(); //Combat logic will pick up from here return; } } else { _character.settings.useMajorQuests = false; } SetIdleMode(!Settings.ManualMinors); } else { SetIdleMode(false); } }