Skip to content

Commit

Permalink
Add Magmite Spender (Always).
Browse files Browse the repository at this point in the history
Fix game-breaking error in AutoSpendNulli if you have no heirlooms.
Fix error of delay-autoportal not resetting if you portal manually.
Make BAF2 avoid the dimensional magma generator loop more. When it triggers "BAF2 genbtc#3" it will most likely fight with lower anti stacks and cause some Geneticists to be fired temporarily. Still figuring out how this should work best.
  • Loading branch information
gen BTC authored and gen BTC committed Nov 23, 2016
1 parent 70502f1 commit 6568ab6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
40 changes: 31 additions & 9 deletions AutoTrimps2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name AutoTrimpsV2+genBTC
// @namespace http://tampermonkey.net/
// @version 2.1.3.0-genbtc-11-22-2016+AutoPerks
// @version 2.1.3.1-genbtc-11-23-2016+AutoPerks
// @description try to take over the world!
// @author zininzinin, spindrjr, belaith, ishakaru, genBTC
// @include *trimps.github.io*
Expand All @@ -12,7 +12,7 @@
////////////////////////////////////////
//Variables/////////////////////////////
////////////////////////////////////////
var ATversion = '2.1.3.0-genbtc-11-22-2016+AutoPerks';
var ATversion = '2.1.3.1-genbtc-11-23-2016+AutoPerks';
var AutoTrimpsDebugTabVisible = true;
var enableDebug = true; //Spam console
var autoTrimpSettings = {};
Expand Down Expand Up @@ -724,7 +724,12 @@ function heirloomUpgradeHighlighting() {

//Automatically upgrades the best mod on the equipped shield and equipped staff. Runs until you run out of nullifium.
//Do not tamper with this.
function autoNull(){for(var e,d=[game.global.ShieldEquipped,game.global.StaffEquipped],o=0;2>o;o++){var l=d[o];if(e=evaluateHeirloomMods(0,l.type+"Equipped",!0),e.index){selectedMod=e.index;var a=getModUpgradeCost(l,selectedMod);if(game.global.nullifium<a)continue;game.global.nullifium-=a;var i=getModUpgradeValue(l,selectedMod),t=l.mods[selectedMod];t[1]=i,"undefined"!=typeof t[3]?t[3]++:(t[2]=0,t[3]=1),game.heirlooms[l.type][l.mods[selectedMod][0]].currentBonus=i}}}
function autoNull(){try {
for(var e,d=[game.global.ShieldEquipped,game.global.StaffEquipped],o=0;2>o;o++){var l=d[o];if(e=evaluateHeirloomMods(0,l.type+"Equipped",!0),e.index){selectedMod=e.index;var a=getModUpgradeCost(l,selectedMod);if(game.global.nullifium<a)continue;game.global.nullifium-=a;var i=getModUpgradeValue(l,selectedMod),t=l.mods[selectedMod];t[1]=i,"undefined"!=typeof t[3]?t[3]++:(t[2]=0,t[3]=1),game.heirlooms[l.type][l.mods[selectedMod][0]].currentBonus=i}}
} catch (err) {
debug("AutoSpendNull Error encountered, no Heirloom detected?: " + err.message,"general");
}
}

//commented out because it was never finished.
/*
Expand Down Expand Up @@ -2826,10 +2831,10 @@ function betterAutoFight2() {
battle(true);
debug("AutoFight: BAF1 #2, breed &lt;= 0.5s", "other");
}
//Click fight anyway if we are stuck in a loop due to Dimensional Generator and we can get away with it.
else if (game.global.soldierHealth == 0 &&(getBreedTime() + getBreedTime(true) + addTime <= autoTrimpSettings.GeneticistTimer.value)&&(breeding>=adjustedMax)){
//Click fight anyway if we are dead and stuck in a loop due to Dimensional Generator and we can get away with adding time to it.
else if (game.global.soldierHealth == 0 && (getBreedTime(true)+addTime <= autoTrimpSettings.GeneticistTimer.value) && (breeding>=adjustedMax)){
battle(true);
debug("AutoFight: NEW: BAF2 #3, both Timers + addTime &lt; GeneTimer", "other");
debug("AutoFight: NEW: BAF2 #3, RemainingTime + ArmyAdd.Time &lt; GeneTimer", "other");
}
}
}
Expand Down Expand Up @@ -3102,7 +3107,7 @@ function checkSettings() {
function doPortal(challenge) {
if(!game.global.portalActive) return;
try {
if (getPageSetting('AutoMagmiteSpender'))
if (getPageSetting('AutoMagmiteSpender2')==1)
autoMagmiteSpender();
} catch (err) {
debug("Error encountered in AutoMagmiteSpender: " + err.message,"general");
Expand Down Expand Up @@ -3151,7 +3156,7 @@ function delayStart() {
function delayStartAgain(){
setInterval(mainLoop, runInterval);
updateCustomButtons();
tooltip('confirm', null, 'update', '<b>ChangeLog: -Please Read- </b><br><b>11/23 Patch 4.0 fixes are still happening!<br>AutoTrimpicide/Force-Abandon is now toggleable<br>Fix Bugs I created<br>NEW: Better AutoFight 2</b><br><a href="https://puu.sh/srfQq/38a0be6656.png" target="#">Screenshot of new hover tooltips beta0.1</a>, more to come.<br>Auto Spend Magmite before portaling - setting in genBTC page (read tooltip)<br>Buy 2 buildings instead of 1 if we have the mastery.<br>Entirely remove high lumberjack ratio during Spire.<br>During Magma with 3000+ Tributes, switch to 1/12/12 auto-worker-ratios instead of 1/2/22.<br>Add a 10 second timeout Popup window that can postpone Autoportal when clicked.<br>Added a No Nurseries Until setting in genBTC page', 'cancelTooltip()', 'Script Update Notice ' + ATversion);
tooltip('confirm', null, 'update', '<b>ChangeLog: -Please Read- </b><br><b>11/23 Patch 4.0 fixes are still happening!<br>Auto Magmite Spender can now be toggled to Always Run<br>AutoTrimpicide/Force-Abandon is now toggleable<br>Fix Bugs I created<br>NEW: Better AutoFight 2</b><br><a href="https://puu.sh/srfQq/38a0be6656.png" target="#">Screenshot of new hover tooltips beta0.1</a>, more to come.<br>Auto Spend Magmite before portaling - setting in genBTC page (read tooltip)<br>Buy 2 buildings instead of 1 if we have the mastery.<br>Entirely remove high lumberjack ratio during Spire.<br>During Magma with 3000+ Tributes, switch to 1/12/12 auto-worker-ratios instead of 1/2/22.<br>Add a 10 second timeout Popup window that can postpone Autoportal when clicked.<br>Added a No Nurseries Until setting in genBTC page', 'cancelTooltip()', 'Script Update Notice ' + ATversion);
document.getElementById('Prestige').value = autoTrimpSettings.PrestigeBackup.selected;
}

Expand All @@ -3160,10 +3165,20 @@ function delayStartAgain(){
////////////////////////////////////////

var OVKcellsWorld = 0;
//reset stuff that may not have gotten cleaned up on portal
function mainCleanup() {
//runs at zone 1 only.
if (game.global.world == 1) {
stopScientistsatFarmers = 250000; //put this here so it reverts every cycle (in case we portal out of watch challenge)
lastHeliumZone = 0;
zonePostpone = 0;
OVKcellsWorld = 0;
}
}
function mainLoop() {
if(game.options.menu.showFullBreed.enabled != 1) toggleSetting("showFullBreed"); //just better.
addbreedTimerInsideText.innerHTML = parseFloat(game.global.lastBreedTime/1000).toFixed(1) + 's'; //add hidden next group breed timer;
stopScientistsatFarmers = 250000; //put this here so it reverts every cycle (in case we portal out of watch challenge)
mainCleanup();
game.global.addonUser = true;
game.global.autotrimps = {
firstgiga: getPageSetting('FirstGigastation'),
Expand Down Expand Up @@ -3214,6 +3229,13 @@ function mainLoop() {

//Runs any user provided scripts - by copying and pasting a function named userscripts() into the Chrome Dev console. (F12)
userscripts();

try {
if (getPageSetting('AutoMagmiteSpender2')==2)
autoMagmiteSpender();
} catch (err) {
debug("Error encountered in AutoMagmiteSpender(Always): " + err.message,"general");
}
}

//left blank intentionally. the user will provide this. blank global vars are included as an example
Expand Down
8 changes: 7 additions & 1 deletion NewUI2.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ createSetting('AutoHeirlooms2', 'Auto Heirlooms2', 'IMPORTANT SETTING. New algor
createSetting('AutoUpgradeHeirlooms', 'Auto Upgrade Heirlooms', 'Automatically buys the upgrades the script advises for the Equipped shield and staff, until we are out of nullifium.', 'boolean', null, null,'genBTC');
createSetting('TrainerCaptoTributes', 'Cap Trainers to a % of Tributes', 'Only Buy a Trainer when its cost is LESS than X% of cost of a tribute. This setting can work in combination with the other one, or set the other one to -1 and this will take full control. Default: -1 (Disabled). 50% is close to the point where the cap does nothing. You can go as low as you want but recommended is 10% to 1%. (example: Trainer cost of 5001, Tribute cost of 100000, @ 5%, it would NOT buy the trainer.)', 'value', '-1', null, 'genBTC');
createSetting('NoNurseriesUntil', 'No Nurseries Until z', 'For Magma z230+ purposes. Nurseries get shut down, and wasting nurseries early on is probably a bad idea. Might want to set this to 230+ for now. Can use combined with the old Max Nurseries cap setting.', 'value', 0, null, 'genBTC');
createSetting('AutoMagmiteSpender', 'Auto Spend Magmite', 'Auto Spends any unspent Magmite immediately before portaling. Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then finds/buys the cheapest non-permanent multi-upgrade and repeats itself until you cant buy anymore. For Magma z230+ purposes. EXPERIMENTAL.', 'boolean', false, null, 'genBTC');
//migrate old magmite to new magmite
if (autoTrimpSettings["AutoMagmiteSpender2"] === undefined && autoTrimpSettings["AutoMagmiteSpender"]) {
createSetting('AutoMagmiteSpender2', ['Spend Magmite OFF','Spend Magmite (Portal)','Spend Magmite Always'], 'Auto Spends any unspent Magmite immediately before portaling. (Or Always, if toggled). Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then finds/buys the cheapest non-permanent multi-upgrade and repeats itself until you cant buy anymore. For Magma z230+ purposes. EXPERIMENTAL.', 'multitoggle', 1, null, 'genBTC');
setPageSetting("AutoMagmiteSpender2",1 * autoTrimpSettings["AutoMagmiteSpender"].enabled);
} else {
createSetting('AutoMagmiteSpender2', ['Spend Magmite OFF','Spend Magmite (Portal)','Spend Magmite Always'], 'Auto Spends any unspent Magmite immediately before portaling. (Or Always, if toggled). Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then finds/buys the cheapest non-permanent multi-upgrade and repeats itself until you cant buy anymore. For Magma z230+ purposes. EXPERIMENTAL.', 'multitoggle', 1, null, 'genBTC');
}
createSetting('ForceAbandon', 'Auto Force-Abandon', '(Trimpicide). If a new fight group is available and anticipation stacks arent maxed, force abandon and grab a new group. Located in the geneticist management script. I would leave this on. ', 'boolean', true, null, 'genBTC');

// Scryer settings
Expand Down

0 comments on commit 6568ab6

Please sign in to comment.