Skip to content

Commit

Permalink
fix black graph checkbox and make sure error spam isnt happening unec…
Browse files Browse the repository at this point in the history
…essarily.

push prototype for dynamic Nurseries.
  • Loading branch information
genbtc committed Mar 26, 2018
1 parent 3b025f1 commit db4c3b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
5 changes: 2 additions & 3 deletions Graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,14 @@ function toggleDarkGraphs() {
removeDarkGraphs();
}
}

//Runs once on startup to color the graph footer elements Black.
//Then every time the theme is changed. Called out of updateCustomButtons() loop in SettingsGUI.
var lastTheme=-1;
MODULES["graphs"].themeChanged = function() {
//GRAPHS:
//toggleDarkGraphs();
//Everything else in Settings, (for now: all Inputs, Dropdowns)
if (game && game.options.menu.darkTheme.enabled != lastTheme) {
//GRAPHS:
toggleDarkGraphs();
debug("Theme change - AutoTrimps styles updating...");
function color1(el,i,arr) {
if(game.options.menu.darkTheme.enabled != 2)
Expand Down
29 changes: 21 additions & 8 deletions modules/buildings.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,22 @@ function buyBuildings() {
if (!game.buildings.Tribute.locked && (getPageSetting('MaxTribute') > game.buildings.Tribute.owned || getPageSetting('MaxTribute') == -1)) {
safeBuyBuilding('Tribute');
}
//Nurseries:
var targetBreed = parseInt(getPageSetting('GeneticistTimer'));
//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+ as well.'
//NURSERIES:
//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+ as well.'
var nursminlvl = getPageSetting('NoNurseriesUntil');
//Activate dynamic Nurseries to buy nurseries from NoNurseriesUntilZone up to portal before zone.
function dynamicNurseries() {
var maxNursery = getPageSetting('MaxNursery');
var finalZone = getPageSetting('HeHrDontPortalBefore')
var numZ = finalZone - nursminlvl;
var perZ = maxNursery / ((numZ / 10 + 1));
return perZ;
}
var dynNursStop = 0;
if (getPageSetting('DynamicNurseries')) {
dynNursStop = dynamicNurseries();
}
var preSpireOverride = getPageSetting('PreSpireNurseries');
//override NoNurseriesUntil and MaxNursery if on a Spire >= IgnoreSpiresUntil, or on a world zone < 200 when IgnoreSpiresUntil is set to <= 200
var overrideNurseries = preSpireOverride >= 0 && (isActiveSpireAT() || (game.global.world < 200 && getPageSetting('IgnoreSpiresUntil') <= 200));
Expand All @@ -239,24 +251,25 @@ function buyBuildings() {
return;
}
var maxNursery = overrideNurseries ? preSpireOverride : getPageSetting('MaxNursery');
if (dynNursStop > 0)
maxNursery = dynNursStop;
//only buy nurseries if enabled, and we need to lower our breed time, or our target breed time is 0, or we aren't trying to manage our breed time before geneticists, and they aren't locked
//even if we are trying to manage breed timer pre-geneticists, start buying nurseries once geneticists are unlocked AS LONG AS we can afford a geneticist (to prevent nurseries from outpacing geneticists soon after they are unlocked)
if ((targetBreed < getBreedTime() || targetBreed <= 0 ||
(targetBreed < getBreedTime(true) && game.global.challengeActive == 'Watch') ||
(!game.jobs.Geneticist.locked && canAffordJob('Geneticist', false, 1))) && !game.buildings.Nursery.locked) {
(targetBreed < getBreedTime(true) && game.global.challengeActive == 'Watch') ||
(!game.jobs.Geneticist.locked && canAffordJob('Geneticist', false, 1))) && !game.buildings.Nursery.locked) {
var nwr = customVars.nursCostRatio; //nursery to warpstation/collector cost ratio. Also for extra gems.
var nursCost = getBuildingItemPrice(game.buildings.Nursery, "gems", false, 1);
var warpCost = getBuildingItemPrice(game.buildings.Warpstation, "gems", false, 1);
var collCost = getBuildingItemPrice(game.buildings.Collector, "gems", false, 1);
var resomod = Math.pow(1 - game.portal.Resourceful.modifier, game.portal.Resourceful.level); //need to apply the resourceful mod when comparing anything other than building vs building.
//buy nurseries irrelevant of warpstations (after we unlock them) - if we have enough extra gems that its not going to impact anything. note:(we will be limited by wood anyway - might use a lot of extra wood)
var buyWithExtraGems = (!game.buildings.Warpstation.locked && nursCost * resomod < nwr * game.resources.gems.owned);
//refactored the old calc, and added new buyWithExtraGems tacked on the front
if ((maxNursery > game.buildings.Nursery.owned || maxNursery == -1) &&
(buyWithExtraGems ||
((nursCost < nwr * warpCost || game.buildings.Warpstation.locked) &&
(nursCost < nwr * collCost || game.buildings.Collector.locked || !game.buildings.Warpstation.locked)))) {
safeBuyBuilding('Nursery');
((nursCost < nwr * warpCost || game.buildings.Warpstation.locked) &&
(nursCost < nwr * collCost || game.buildings.Collector.locked || !game.buildings.Warpstation.locked)))) {
safeBuyBuilding('Nursery');
}
}
postBuy2(oldBuy);
Expand Down
3 changes: 2 additions & 1 deletion modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ window.onerror = function catchErrors(msg, url, lineNo, columnNo, error) {
'Column: ' + columnNo,
'Error object: ' + JSON.stringify(error)
].join(' - ');
console.log("AT logged error: " + message);
if (lineNo !=0)
console.log("AT logged error: " + message);
//ATServer.Upload(message);
};
/*
Expand Down

0 comments on commit db4c3b2

Please sign in to comment.