Colour column of green option #773

This commit is contained in:
Daniël van Noord
2021-05-06 21:02:26 +02:00
parent 5a045e7ac4
commit 210f4d4aee
5 changed files with 23 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,6 +3,7 @@ import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
import { ColourGray } from '../../Disp/VariablesAndData'; import { ColourGray } from '../../Disp/VariablesAndData';
import { import {
CacheMinPP, // eslint-disable-line no-unused-vars CacheMinPP, // eslint-disable-line no-unused-vars
CacheMinPPBulk, // eslint-disable-line no-unused-vars
CacheObjects1, CacheObjects1,
CacheObjects10, CacheObjects10,
CacheObjects100, CacheObjects100,
@@ -38,7 +39,8 @@ function CachePP(target, amount) {
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs + Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs +
price / target[i].bonus; price / target[i].bonus;
} else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign } else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
if (!(CMOptions.PPRigidelMode && amount === 1)) CachePPArray.push([target[i].pp, amount]); if (!(CMOptions.PPRigidelMode && amount === 1))
CachePPArray.push([target[i].pp, amount, price]);
}); });
} }
@@ -58,16 +60,17 @@ export default function CacheBuildingsPP() {
// Set CM.Cache.min to best non-excluded buidliung // Set CM.Cache.min to best non-excluded buidliung
CachePPArray.sort((a, b) => a[0] - b[0]); CachePPArray.sort((a, b) => a[0] - b[0]);
let indexOfMin = 0; let indexOfMin = CMOptions.PPExcludeTop;
if (CMOptions.PPOnlyConsiderBuyable) { if (CMOptions.PPOnlyConsiderBuyable) {
while (CachePPArray[indexOfMin][1] > Game.cookies) { while (CachePPArray[indexOfMin][2] > Game.cookies) {
indexOfMin += 1; indexOfMin += 1;
if (CachePPArray.length === indexOfMin + 1) { if (CachePPArray.length === indexOfMin + 1) {
break; break;
} }
} }
} }
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; CacheMinPP = CachePPArray[indexOfMin][0];
CacheMinPPBulk = CachePPArray[indexOfMin][1];
CacheColour(CacheObjects1, 1); CacheColour(CacheObjects1, 1);
CacheColour(CacheObjects10, 10); CacheColour(CacheObjects10, 10);

View File

@@ -69,6 +69,8 @@ export let CacheTimeTillNextPrestige = 0;
/** Stores lowest PP value */ /** Stores lowest PP value */
export let CacheMinPP = 0; export let CacheMinPP = 0;
/** Stores lowest PP value category */
export let CacheMinPPBulk = 0;
/** Stores all PP values of all buildings for all buy settings (1, 10, 100) */ /** Stores all PP values of all buildings for all buy settings (1, 10, 100) */
export let CachePPArray = []; export let CachePPArray = [];

View File

@@ -1,4 +1,9 @@
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData'; import {
CacheMinPPBulk,
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding'; import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -24,11 +29,17 @@ export default function UpdateBuildings() {
else if (target === 10) target = CacheObjects10; else if (target === 10) target = CacheObjects10;
else if (target === 100) target = CacheObjects100; else if (target === 100) target = CacheObjects100;
// Remove colour if applied
l(`storeBulk1`).style.removeProperty('color');
l(`storeBulk10`).style.removeProperty('color');
l(`storeBulk100`).style.removeProperty('color');
if (Game.buyMode === 1) { if (Game.buyMode === 1) {
if (CMOptions.BuildColour === 1) { if (CMOptions.BuildColour === 1) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`]; l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
}); });
l(`storeBulk${CacheMinPPBulk}`).style.color = CMOptions.ColourGreen;
} else { } else {
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color'); l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');