Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
641471b5bc | ||
|
|
b470d13316 | ||
|
|
36534be654 | ||
|
|
1c3a27bc9a | ||
|
|
8f5e40d3be | ||
|
|
2c309c04c2 | ||
|
|
6b2425fa19 | ||
|
|
104159e4ac | ||
|
|
00edec127c | ||
|
|
4d716e77e4 | ||
|
|
1a0750e8d7 | ||
|
|
ff81b4ff02 | ||
|
|
f3b0bfa16d | ||
|
|
9c2350a8e3 | ||
|
|
b66caab11e | ||
|
|
5390c1af58 | ||
|
|
af508ceee5 | ||
|
|
f6b2e70f9b | ||
|
|
6caee4d8fb | ||
|
|
e3d3f649c3 | ||
|
|
f138745a0f | ||
|
|
0253e9b80d | ||
|
|
d35217b6d5 | ||
|
|
b201e15c8e | ||
|
|
0a30d8e3e8 | ||
|
|
a65af049b6 | ||
|
|
26d8e75935 | ||
|
|
87eac02185 | ||
|
|
8ff50fbbb9 | ||
|
|
c3b1637d08 | ||
|
|
c72e01687f | ||
|
|
022b3860eb | ||
|
|
b09dcd6f47 | ||
|
|
eee72bceb6 | ||
|
|
7b3a7816f1 | ||
|
|
403eb59cfd | ||
|
|
220b67b440 | ||
|
|
b6d9ca8dbb | ||
|
|
1c955e5da3 | ||
|
|
9e9158ce81 | ||
|
|
71479a05e7 | ||
|
|
7ec13d80bd | ||
|
|
fd2aa16c60 | ||
|
|
7831521bc5 | ||
|
|
6193fc8d3e | ||
|
|
f85cde5fea | ||
|
|
2f34b26602 | ||
|
|
189ccbce49 | ||
|
|
3e07541fd5 | ||
|
|
932509a877 | ||
|
|
f3e7964262 | ||
|
|
9b0429c141 | ||
|
|
5dda8cac55 | ||
|
|
d6675fe86d | ||
|
|
80b8a0b834 | ||
|
|
817c5b0e3c | ||
|
|
49b8414edf | ||
|
|
99ae657c45 | ||
|
|
409a8e2911 | ||
|
|
08c2f99b21 | ||
|
|
3247057394 | ||
|
|
d1fe5c013c |
19
.eslintrc.js
19
.eslintrc.js
@@ -8,33 +8,20 @@ module.exports = {
|
||||
l: 'readonly',
|
||||
b64_to_utf8: 'readonly',
|
||||
utf8_to_b64: 'readonly',
|
||||
realAudio: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
CM: 'writable',
|
||||
unsafeWindow: 'readonly',
|
||||
},
|
||||
extends: 'airbnb-base',
|
||||
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
rules: {
|
||||
indent: ['error', 'tab'],
|
||||
'import/no-named-default': 'off',
|
||||
'import/no-mutable-exports': 'off',
|
||||
'no-tabs': 'off',
|
||||
'max-len': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-new-func': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'prefer-destructuring': 'off',
|
||||
'func-names': 'off',
|
||||
'no-console': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
'prefer-arrow-callback': 'off',
|
||||
'no-new': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'prefer-destructuring': ['error', { object: true, array: false }],
|
||||
},
|
||||
};
|
||||
|
||||
18
.github/CONTRIBUTING.md
vendored
Normal file
18
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data.
|
||||
|
||||
The following is a short description of the various `src` directories and their contents:
|
||||
|
||||
JS | Description
|
||||
-- | -
|
||||
Cache | Functions related to creating and storing data cache
|
||||
Config | Functions related to manipulating CM configuration
|
||||
Data | Hard coded values
|
||||
Disp | Functions related to displaying CM's UI
|
||||
InitSaveLoad | Functions related to registering the CM object with the Game's Modding API
|
||||
Main | Functions related to the main loop and initializing CM
|
||||
Sim | Functions related to simulate something
|
||||
|
||||
These are some additional guidelines:
|
||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
||||
- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message.
|
||||
- PR's should target the `dev` branch
|
||||
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -19,5 +19,6 @@ If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Save file**
|
||||
```
|
||||
If applicable please copy your save file here
|
||||
Please add a save file here.
|
||||
This makes debugging much easier as we do not always have a good test save to debug the issue
|
||||
```
|
||||
|
||||
0
LICENSE → .github/LICENSE.md
vendored
0
LICENSE → .github/LICENSE.md
vendored
5
.prettierrc.json
Normal file
5
.prettierrc.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 80
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
The following is a description of the our approach to the project.
|
||||
|
||||
Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data.
|
||||
|
||||
Here is a description of what should be stored in each of the source JS. Make edits to the source file first and then use the combine file to compile the final file:
|
||||
|
||||
JS | Description
|
||||
-- | -
|
||||
Cache | Functions related to creating and storing data cache
|
||||
Config | Functions related to manipulating CM configuration
|
||||
Data | Hard coded values
|
||||
Disp | Functions related to displaying CM's UI
|
||||
Footer | The footer of CM's JS (not modified often or ever)
|
||||
Header | The header of CM's JS (not modified often or ever)
|
||||
Main | Functions related to the main loop and initializing CM
|
||||
Sim | Functions related to simulate something
|
||||
|
||||
These are some additional guidelines:
|
||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
||||
- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message.
|
||||
- Try to follow the formatting and annotation as specified by JSCode
|
||||
- PR's should target the `dev` branch
|
||||
File diff suppressed because one or more lines are too long
14
README.md
14
README.md
@@ -18,13 +18,13 @@ Cookie Monster also indicates the time left before being able to buy an upgrade
|
||||
|
||||
This index is computed for buildings and upgrades. If the relevant option is enabled, it will color-code each of them based on their value:
|
||||
|
||||
* Light Blue: (upgrades) This item has a better PP than any building
|
||||
* Green: This item has the best PP
|
||||
* Yellow: This item is not the best, but it is closer to best than it is to worst
|
||||
* Orange: This item is not the worst, but it is closer to worst than it is to best
|
||||
* Red: This item has the worst PP
|
||||
* Purple: (upgrades) This item has a worse PP than any building
|
||||
* Gray: (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth.
|
||||
* Light Blue: (upgrades) This item has a better PP than the best building to buy
|
||||
* Green: This building has the best PP
|
||||
* Yellow: This building is within the top 10 of best PP's
|
||||
* Orange: This building is within the top 20 of best PP's
|
||||
* Red: This building is within the top 30 of best PP's
|
||||
* Purple: This building is worse than the top 10 of best PP's
|
||||
* Gray: This item does not have a PP, often this means that there is no change to CPS
|
||||
|
||||
Note: For this index, **lower is better**, meaning a building with a PP of 1 is more interesting than one with a PP of 3.
|
||||
|
||||
|
||||
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
2363
package-lock.json
generated
2363
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cookiemonster-mod",
|
||||
"version": "2.031.5",
|
||||
"version": "2.031.6",
|
||||
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||
"main": "CookieMonster.js",
|
||||
"keywords": [
|
||||
@@ -11,12 +11,13 @@
|
||||
"Orteil"
|
||||
],
|
||||
"scripts": {
|
||||
"eslint_src": "eslint src",
|
||||
"build": "run-s eslint_src pack_prod remove_comment",
|
||||
"build_test": "run-s pack_dev",
|
||||
"pack_prod": "webpack --env production",
|
||||
"pack_dev": "webpack",
|
||||
"remove_comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
||||
"copy-file": "cp dist/CookieMonster.js CookieMonster.js",
|
||||
"eslint-src": "eslint src",
|
||||
"build": "run-s eslint-src pack-prod remove-comment copy-file",
|
||||
"build-test": "run-s pack-dev",
|
||||
"pack-prod": "webpack --env production",
|
||||
"pack-dev": "webpack",
|
||||
"remove-comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -45,8 +46,11 @@
|
||||
"devDependencies": {
|
||||
"eslint": "^7.19.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "2.2.1",
|
||||
"webpack": "^5.24.4",
|
||||
"webpack-cli": "^4.5.0"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
ChoEggDiff, ClicksDiff, CookiesDiff, WrinkDiff, WrinkFattestDiff,
|
||||
ChoEggDiff,
|
||||
ClicksDiff,
|
||||
CookiesDiff,
|
||||
WrinkDiff,
|
||||
WrinkFattestDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -30,16 +34,21 @@ export class CMAvgQueue {
|
||||
* @returns {number} ret The average
|
||||
*/
|
||||
calcAverage(timePeriod) {
|
||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
||||
let time = timePeriod;
|
||||
if (time > this.maxLength) time = this.maxLength;
|
||||
if (time > this.queue.length) time = this.queue.length;
|
||||
let ret = 0;
|
||||
for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) {
|
||||
for (
|
||||
let i = this.queue.length - 1;
|
||||
i >= 0 && i > this.queue.length - 1 - time;
|
||||
i--
|
||||
) {
|
||||
ret += this.queue[i];
|
||||
}
|
||||
if (ret === 0) {
|
||||
return 0;
|
||||
}
|
||||
return ret / timePeriod;
|
||||
return ret / time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,28 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
CacheAverageClicks, CacheAverageCPS, CacheAverageGainBank, CacheAverageGainChoEgg, CacheAverageGainWrink, CacheAverageGainWrinkFattest, CacheAvgCPSWithChoEgg, CacheLastChoEgg, CacheLastClicks, CacheLastCookies, CacheLastCPSCheck, CacheLastWrinkCookies, CacheLastWrinkFattestCookies, CacheRealCookiesEarned, CacheSellForChoEgg, CacheWrinklersFattest, CacheWrinklersTotal, ChoEggDiff, ClicksDiff, CookiesDiff, WrinkDiff, WrinkFattestDiff,
|
||||
CacheAverageClicks,
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainChoEgg,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheLastChoEgg,
|
||||
CacheLastClicks,
|
||||
CacheLastCookies,
|
||||
CacheLastCPSCheck,
|
||||
CacheLastWrinkCookies,
|
||||
CacheLastWrinkFattestCookies,
|
||||
CacheRealCookiesEarned,
|
||||
CacheSellForChoEgg,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
ChoEggDiff,
|
||||
ClicksDiff,
|
||||
CookiesDiff,
|
||||
WrinkDiff,
|
||||
WrinkFattestDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -25,10 +46,13 @@ export default function CacheAvgCPS() {
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
const timeDiff = currDate - CacheLastCPSCheck;
|
||||
const bankDiffAvg = Math.max(0, (Game.cookies - CacheLastCookies)) / timeDiff;
|
||||
const wrinkDiffAvg = Math.max(0, (CacheWrinklersTotal - CacheLastWrinkCookies)) / timeDiff;
|
||||
const wrinkFattestDiffAvg = Math.max(0, (CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies)) / timeDiff;
|
||||
const choEggDiffAvg = Math.max(0, (choEggTotal - CacheLastChoEgg)) / timeDiff;
|
||||
const bankDiffAvg = Math.max(0, Game.cookies - CacheLastCookies) / timeDiff;
|
||||
const wrinkDiffAvg =
|
||||
Math.max(0, CacheWrinklersTotal - CacheLastWrinkCookies) / timeDiff;
|
||||
const wrinkFattestDiffAvg =
|
||||
Math.max(0, CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies) /
|
||||
timeDiff;
|
||||
const choEggDiffAvg = Math.max(0, choEggTotal - CacheLastChoEgg) / timeDiff;
|
||||
const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
CookiesDiff.addLatest(bankDiffAvg);
|
||||
@@ -54,14 +78,21 @@ export default function CacheAvgCPS() {
|
||||
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
|
||||
CacheAverageCPS = CacheAverageGainBank;
|
||||
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink;
|
||||
if (CMOptions.CalcWrink === 2) CacheAverageCPS += CacheAverageGainWrinkFattest;
|
||||
if (CMOptions.CalcWrink === 2)
|
||||
CacheAverageCPS += CacheAverageGainWrinkFattest;
|
||||
|
||||
const choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
|
||||
const choEgg =
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
|
||||
if (choEgg || CMOptions.CalcWrink === 0) {
|
||||
CacheAvgCPSWithChoEgg = CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
||||
CacheAvgCPSWithChoEgg =
|
||||
CacheAverageGainBank +
|
||||
CacheAverageGainWrink +
|
||||
(choEgg ? CacheAverageGainChoEgg : 0);
|
||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(ClickTimes[CMOptions.AvgClicksHist]);
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(
|
||||
ClickTimes[CMOptions.AvgClicksHist],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData';
|
||||
import {
|
||||
CacheCurrWrinklerCount,
|
||||
CacheCurrWrinklerCPSMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the current Wrinkler CPS multiplier
|
||||
@@ -10,9 +13,9 @@ import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAn
|
||||
export default function CacheCurrWrinklerCPS() {
|
||||
CacheCurrWrinklerCPSMult = 0;
|
||||
let count = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) count++;
|
||||
}
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) count += 1;
|
||||
});
|
||||
let godMult = 1;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
@@ -21,5 +24,10 @@ export default function CacheCurrWrinklerCPS() {
|
||||
else if (godLvl === 3) godMult *= 1.05;
|
||||
}
|
||||
CacheCurrWrinklerCount = count;
|
||||
CacheCurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult;
|
||||
CacheCurrWrinklerCPSMult =
|
||||
count *
|
||||
(count * 0.05 * 1.1) *
|
||||
(Game.Has('Sacrilegious corruption') * 0.05 + 1) *
|
||||
(Game.Has('Wrinklerspawn') * 0.05 + 1) *
|
||||
godMult;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
*/
|
||||
export default function GetCPSBuffMult() {
|
||||
let mult = 1;
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS;
|
||||
}
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined')
|
||||
mult *= Game.buffs[i].multCpS;
|
||||
});
|
||||
return mult;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ export default function CacheSellAllForChoEgg() {
|
||||
if (Game.Objects.Bank.minigameLoaded) {
|
||||
const marketGoods = Game.Objects.Bank.minigame.goods;
|
||||
let goodsVal = 0;
|
||||
for (const i of Object.keys(marketGoods)) {
|
||||
Object.keys(marketGoods).forEach((i) => {
|
||||
const marketGood = marketGoods[i];
|
||||
goodsVal += marketGood.stock * marketGood.val;
|
||||
}
|
||||
});
|
||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
|
||||
@@ -3,12 +3,18 @@ import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
||||
import CachePP from './PP/PP';
|
||||
import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome';
|
||||
import {
|
||||
CacheBuildingsPrices,
|
||||
CacheIncome,
|
||||
} from './PriceAndIncome/PriceAndIncome';
|
||||
import { CacheChain } from './Stats/ChainCookies';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
||||
import CacheSeasonSpec from './Stats/Reindeer';
|
||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
|
||||
import {
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from './Stats/Stats';
|
||||
import { HeavenlyChipsDiff } from './VariablesAndData';
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ export default function LoopCache() {
|
||||
CacheAvgCPS();
|
||||
CacheHeavenlyChipsPS();
|
||||
|
||||
const cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset);
|
||||
const cookiesToNext =
|
||||
Game.HowManyCookiesReset(
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) +
|
||||
1,
|
||||
) -
|
||||
(Game.cookiesEarned + Game.cookiesReset);
|
||||
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS());
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
@@ -5,7 +6,10 @@ import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheCostDragonUpgrade, CacheDragonAura, CacheDragonAura2, CacheLastDragonLevel,
|
||||
CacheCostDragonUpgrade,
|
||||
CacheDragonAura,
|
||||
CacheDragonAura2,
|
||||
CacheLastDragonLevel,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -13,9 +17,16 @@ import {
|
||||
*/
|
||||
export default function CacheDragonCost() {
|
||||
if (CacheLastDragonLevel !== Game.dragonLevel || SimDoSims) {
|
||||
if (Game.dragonLevel < 25 && Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')) {
|
||||
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
|
||||
const amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
|
||||
if (
|
||||
Game.dragonLevel < 25 &&
|
||||
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
||||
) {
|
||||
let target = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/Objects\[(.*)\]/)[1];
|
||||
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/sacrifice\((.*?)\)/)[1];
|
||||
if (target !== 'i') {
|
||||
target = target.replaceAll("'", '');
|
||||
if (Game.Objects[target].amount < amount) {
|
||||
@@ -24,13 +35,19 @@ export default function CacheDragonCost() {
|
||||
let cost = 0;
|
||||
CopyData();
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price = SimObjects[target].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
|
||||
let price =
|
||||
SimObjects[target].basePrice *
|
||||
Game.priceIncrease **
|
||||
Math.max(
|
||||
0,
|
||||
SimObjects[target].amount - 1 - SimObjects[target].free,
|
||||
);
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${(cost)}`;
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
|
||||
}
|
||||
} else {
|
||||
let cost = 0;
|
||||
@@ -42,11 +59,17 @@ export default function CacheDragonCost() {
|
||||
break;
|
||||
} else {
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price = SimObjects[target].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
|
||||
let price =
|
||||
SimObjects[target].basePrice *
|
||||
Game.priceIncrease **
|
||||
Math.max(
|
||||
0,
|
||||
SimObjects[target].amount - 1 - SimObjects[target].free,
|
||||
);
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGray } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
CacheArrayOfPPs,
|
||||
CacheMaxPP, CacheMidPP, CacheMinPP, CacheObjects1, CacheObjects10, CacheObjects100,
|
||||
CacheMinPP,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CachePPArray,
|
||||
} from '../VariablesAndData';
|
||||
import ColourOfPP from './ColourOfPP';
|
||||
|
||||
@@ -13,14 +17,30 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It saves all date in CM.Cache.Objects...
|
||||
* It is called by CM.Cache.CacheBuildingsPP()
|
||||
*/
|
||||
function CacheBuildingsBulkPP(target) {
|
||||
for (const i of Object.keys(target)) {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp = (Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (target[i].price / target[i].bonus);
|
||||
} else target[i].pp = (target[i].price / target[i].bonus);
|
||||
|
||||
target[i].color = ColourOfPP(target[i], target[i].price);
|
||||
function CacheColor(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
target[i].color = ColourOfPP(
|
||||
target[i],
|
||||
Game.Objects[i].getSumPrice(amount),
|
||||
);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColorGray;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function CachePP(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
const price = Game.Objects[i].getSumPrice(amount);
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||
Game.cookiesPs +
|
||||
price / target[i].bonus;
|
||||
} else target[i].pp = price / target[i].bonus;
|
||||
CachePPArray.push([target[i].pp, amount]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,73 +49,28 @@ function CacheBuildingsBulkPP(target) {
|
||||
*/
|
||||
export default function CacheBuildingsPP() {
|
||||
CacheMinPP = Infinity;
|
||||
CacheMaxPP = 1;
|
||||
CacheArrayOfPPs = [];
|
||||
CachePPArray = [];
|
||||
if (typeof CMOptions.PPExcludeTop === 'undefined') CMOptions.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||
|
||||
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
||||
if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) {
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
if (Game.cookiesPs) {
|
||||
CacheObjects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CacheObjects1[i].bonus);
|
||||
} else CacheObjects1[i].pp = (Game.Objects[i].getPrice() / CacheObjects1[i].bonus);
|
||||
CacheArrayOfPPs.push([CacheObjects1[i].pp, Game.Objects[i].getPrice()]);
|
||||
}
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
while (CacheArrayOfPPs[0][1] > Game.cookies) {
|
||||
if (CacheArrayOfPPs.length === 1) {
|
||||
break;
|
||||
}
|
||||
CacheArrayOfPPs.shift();
|
||||
}
|
||||
}
|
||||
CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0];
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = ((CacheMaxPP - CacheMinPP) / 2) + CacheMinPP;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
CacheObjects1[i].color = ColourOfPP(CacheObjects1[i], Game.Objects[i].getPrice());
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (CacheObjects1[i].pp === CacheArrayOfPPs[j][0]) CacheObjects1[i].color = ColorGray;
|
||||
}
|
||||
}
|
||||
// Calculate PP of bulk-buy modes
|
||||
CacheBuildingsBulkPP(CacheObjects10);
|
||||
CacheBuildingsBulkPP(CacheObjects100);
|
||||
} else if (Game.buyMode > 0) {
|
||||
// Calculate PP and colors when compared to purchase of selected bulk mode
|
||||
let target;
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
for (const i of Object.keys(target)) {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / target[i].bonus);
|
||||
} else target[i].pp = (Game.Objects[i].bulkPrice / target[i].bonus);
|
||||
CacheArrayOfPPs.push([target[i].pp, Game.Objects[i].bulkPrice]);
|
||||
}
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
while (CacheArrayOfPPs[0][1] > Game.cookies) {
|
||||
if (CacheArrayOfPPs.length === 1) {
|
||||
break;
|
||||
}
|
||||
CacheArrayOfPPs.shift();
|
||||
}
|
||||
}
|
||||
CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0];
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = ((CacheMaxPP - CacheMinPP) / 2) + CacheMinPP;
|
||||
// Calculate PP and colors
|
||||
CachePP(CacheObjects1, 1);
|
||||
CachePP(CacheObjects10, 10);
|
||||
CachePP(CacheObjects100, 100);
|
||||
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray;
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CachePPArray.sort((a, b) => a[0] - b[0]);
|
||||
let indexOfMin = 0;
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
while (CachePPArray[indexOfMin][1] > Game.cookies) {
|
||||
indexOfMin += 1;
|
||||
if (CachePPArray.length === indexOfMin + 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin];
|
||||
|
||||
CacheColor(CacheObjects1, 1);
|
||||
CacheColor(CacheObjects10, 10);
|
||||
CacheColor(CacheObjects100, 100);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import {
|
||||
ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorYellow,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../../Disp/VariablesAndData';
|
||||
import { CacheMaxPP, CacheMidPP, CacheMinPP } from '../VariablesAndData';
|
||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions return the colour assosciated with the given pp value
|
||||
@@ -18,14 +24,15 @@ export default function ColourOfPP(me, price) {
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = ColorGray;
|
||||
else if (me.pp < CacheMinPP) color = ColorBlue;
|
||||
else if (me.pp === CacheMinPP) color = ColorGreen;
|
||||
else if (me.pp === CacheMaxPP) color = ColorRed;
|
||||
else if (me.pp > CacheMaxPP) color = ColorPurple;
|
||||
else if (me.pp > CacheMidPP) color = ColorOrange;
|
||||
else color = ColorYellow;
|
||||
else if (me.pp < CachePPArray[10][0]) color = ColorYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) color = ColorOrange;
|
||||
else if (me.pp > CachePPArray[30][0]) color = ColorRed;
|
||||
else color = ColorPurple;
|
||||
|
||||
// Colour based on price in terms of CPS
|
||||
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColorBlue;
|
||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit))
|
||||
color = ColorBlue;
|
||||
}
|
||||
// Colour based on being able to purchase
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
|
||||
@@ -7,12 +7,23 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
export default function CacheUpgradePP() {
|
||||
for (const i of Object.keys(CacheUpgrades)) {
|
||||
Object.keys(CacheUpgrades).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheUpgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus);
|
||||
} else CacheUpgrades[i].pp = (Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus);
|
||||
CacheUpgrades[i].pp =
|
||||
Math.max(
|
||||
Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()),
|
||||
0,
|
||||
) /
|
||||
Game.cookiesPs +
|
||||
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
||||
} else
|
||||
CacheUpgrades[i].pp =
|
||||
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
||||
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
|
||||
|
||||
CacheUpgrades[i].color = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
|
||||
}
|
||||
CacheUpgrades[i].color = ColourOfPP(
|
||||
CacheUpgrades[i],
|
||||
Game.Upgrades[i].getPrice(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
13
src/Cache/PantheonGods/CacheGods.js
Normal file
13
src/Cache/PantheonGods/CacheGods.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange';
|
||||
import { CacheGods } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the cps effect of each God in slot 1, 2 or 3
|
||||
*/
|
||||
export default function CachePantheonGods() {
|
||||
for (let god = 0; god < 11; god += 1) {
|
||||
for (let slot = 0; slot < 3; slot += 1) {
|
||||
CacheGods[god][slot] = CalculateChangeGod(god, slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Section: Functions related to caching income */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices, CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades,
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheDoRemakeBuildPrices,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheUpgrades,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -16,13 +26,13 @@ import {
|
||||
*/
|
||||
function CacheBuildingIncome(amount, target) {
|
||||
const result = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
result[i] = {};
|
||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -32,23 +42,50 @@ function CacheBuildingIncome(amount, target) {
|
||||
*/
|
||||
function CacheUpgradeIncome() {
|
||||
CacheUpgrades = [];
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||
if (i === 'Elder Pledge') {
|
||||
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
|
||||
if (CMOptions.CalcWrink === 1)
|
||||
CacheUpgrades[i].bonus -= CacheAverageGainWrink;
|
||||
else if (CMOptions.CalcWrink === 2)
|
||||
CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
|
||||
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
|
||||
} else {
|
||||
CacheUpgrades[i] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches the price of each building and stores it in the cache
|
||||
*/
|
||||
export function CacheBuildingsPrices() {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
CacheObjects1[i].price = BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1);
|
||||
CacheObjects10[i].price = BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
|
||||
CacheObjects100[i].price = BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100);
|
||||
}
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CacheObjects1[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
1,
|
||||
);
|
||||
CacheObjects10[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
10,
|
||||
);
|
||||
CacheObjects100[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
100,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheChainFrenzyMaxReward, CacheChainFrenzyRequired, CacheChainFrenzyRequiredNext, CacheChainFrenzyWrathMaxReward, CacheChainFrenzyWrathRequired, CacheChainFrenzyWrathRequiredNext, CacheChainMaxReward, CacheChainRequired, CacheChainRequiredNext, CacheChainWrathMaxReward, CacheChainWrathRequired, CacheChainWrathRequiredNext, CacheDragonsFortuneMultAdjustment, CacheGoldenCookiesMult, CacheNoGoldSwitchCookiesPS, CacheWrathCookiesMult,
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
CacheChainFrenzyWrathMaxReward,
|
||||
CacheChainFrenzyWrathRequired,
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
CacheChainMaxReward,
|
||||
CacheChainRequired,
|
||||
CacheChainRequiredNext,
|
||||
CacheChainWrathMaxReward,
|
||||
CacheChainWrathRequired,
|
||||
CacheChainWrathRequiredNext,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -17,13 +32,26 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
|
||||
let moni = 0;
|
||||
let nextMoni = 0;
|
||||
let nextRequired = 0;
|
||||
let chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
|
||||
let chain =
|
||||
1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
|
||||
while (nextMoni < maxPayout) {
|
||||
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** chain * digit * mult), maxPayout * mult));
|
||||
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult), maxPayout * mult));
|
||||
nextRequired = Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult);
|
||||
moni = Math.max(
|
||||
digit,
|
||||
Math.min(
|
||||
Math.floor((1 / 9) * 10 ** chain * digit * mult),
|
||||
maxPayout * mult,
|
||||
),
|
||||
);
|
||||
nextMoni = Math.max(
|
||||
digit,
|
||||
Math.min(
|
||||
Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult),
|
||||
maxPayout * mult,
|
||||
),
|
||||
);
|
||||
nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult);
|
||||
totalFromChain += moni;
|
||||
chain++;
|
||||
chain += 1;
|
||||
}
|
||||
return [totalFromChain, moni, nextRequired];
|
||||
}
|
||||
@@ -45,25 +73,65 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
|
||||
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
|
||||
*/
|
||||
export function CacheChain() {
|
||||
let maxPayout = CacheNoGoldSwitchCookiesPS * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment;
|
||||
let maxPayout =
|
||||
CacheNoGoldSwitchCookiesPS *
|
||||
60 *
|
||||
60 *
|
||||
6 *
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
// Removes effect of Frenzy etc.
|
||||
const cpsBuffMult = GetCPSBuffMult();
|
||||
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
||||
else maxPayout = 0;
|
||||
|
||||
CacheChainMaxReward = MaxChainCookieReward(7, maxPayout, CacheGoldenCookiesMult);
|
||||
CacheChainRequired = CacheChainMaxReward[1] * 2 / CacheGoldenCookiesMult;
|
||||
CacheChainRequiredNext = CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
CacheChainMaxReward = MaxChainCookieReward(
|
||||
7,
|
||||
maxPayout,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainRequiredNext =
|
||||
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainWrathMaxReward = MaxChainCookieReward(6, maxPayout, CacheWrathCookiesMult);
|
||||
CacheChainWrathRequired = CacheChainWrathMaxReward[1] * 2 / CacheWrathCookiesMult;
|
||||
CacheChainWrathRequiredNext = CacheChainWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
CacheChainWrathMaxReward = MaxChainCookieReward(
|
||||
6,
|
||||
maxPayout,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainWrathRequired =
|
||||
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainWrathRequiredNext =
|
||||
CacheChainWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainFrenzyMaxReward = MaxChainCookieReward(7, maxPayout * 7, CacheGoldenCookiesMult);
|
||||
CacheChainFrenzyRequired = CacheChainFrenzyMaxReward[1] * 2 / CacheGoldenCookiesMult;
|
||||
CacheChainFrenzyRequiredNext = CacheChainFrenzyMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
CacheChainFrenzyMaxReward = MaxChainCookieReward(
|
||||
7,
|
||||
maxPayout * 7,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyRequired =
|
||||
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainFrenzyRequiredNext =
|
||||
CacheChainFrenzyMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(6, maxPayout * 7, CacheWrathCookiesMult);
|
||||
CacheChainFrenzyWrathRequired = CacheChainFrenzyWrathMaxReward[1] * 2 / CacheWrathCookiesMult;
|
||||
CacheChainFrenzyWrathRequiredNext = CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(
|
||||
6,
|
||||
maxPayout * 7,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyWrathRequired =
|
||||
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainFrenzyWrathRequiredNext =
|
||||
CacheChainFrenzyWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
CacheHCPerSecond, CacheLastHeavenlyCheck, CacheLastHeavenlyChips, HeavenlyChipsDiff,
|
||||
CacheHCPerSecond,
|
||||
CacheLastHeavenlyCheck,
|
||||
CacheLastHeavenlyChips,
|
||||
HeavenlyChipsDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -13,12 +16,15 @@ export default function CacheHeavenlyChipsPS() {
|
||||
// Only calculate every new second
|
||||
if ((Game.T / Game.fps) % 1 === 0) {
|
||||
const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset);
|
||||
const ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
const ascendNowToOwn = Math.floor(
|
||||
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
|
||||
);
|
||||
const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned);
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
const timeDiff = currDate - CacheLastHeavenlyCheck;
|
||||
const heavenlyChipsDiffAvg = Math.max(0, (ascendNowToGet - CacheLastHeavenlyChips)) / timeDiff;
|
||||
const heavenlyChipsDiffAvg =
|
||||
Math.max(0, ascendNowToGet - CacheLastHeavenlyChips) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { crateMissing } from '../../Disp/MenuSections/CreateMissingUpgrades';
|
||||
import { CacheMissingUpgrades, CacheMissingUpgradesCookies, CacheMissingUpgradesPrestige } from '../VariablesAndData';
|
||||
import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
CacheMissingUpgradesPrestige,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches variables related to missing upgrades
|
||||
@@ -15,9 +19,9 @@ export default function CacheAllMissingUpgrades() {
|
||||
CacheMissingUpgradesPrestige = '';
|
||||
const list = [];
|
||||
// sort the upgrades
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
list.push(Game.Upgrades[i]);
|
||||
}
|
||||
});
|
||||
const sortMap = function (a, b) {
|
||||
if (a.order > b.order) return 1;
|
||||
if (a.order < b.order) return -1;
|
||||
@@ -25,7 +29,7 @@ export default function CacheAllMissingUpgrades() {
|
||||
};
|
||||
list.sort(sortMap);
|
||||
|
||||
for (const i of Object.keys(list)) {
|
||||
Object.keys(list).forEach((i) => {
|
||||
const me = list[i];
|
||||
|
||||
if (me.bought === 0) {
|
||||
@@ -34,7 +38,12 @@ export default function CacheAllMissingUpgrades() {
|
||||
str += crateMissing(me);
|
||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug') CacheMissingUpgrades += str;
|
||||
}
|
||||
else if (
|
||||
me.pool !== 'toggle' &&
|
||||
me.pool !== 'unused' &&
|
||||
me.pool !== 'debug'
|
||||
)
|
||||
CacheMissingUpgrades += str;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,20 @@
|
||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheConjure, CacheConjureReward, CacheDragonsFortuneMultAdjustment, CacheEdifice, CacheEdificeBuilding, CacheGoldenCookiesMult, CacheLucky, CacheLuckyFrenzy, CacheLuckyReward, CacheLuckyRewardFrenzy, CacheLuckyWrathReward, CacheLuckyWrathRewardFrenzy, CacheNoGoldSwitchCookiesPS, CacheWrathCookiesMult,
|
||||
CacheConjure,
|
||||
CacheConjureReward,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheLucky,
|
||||
CacheLuckyFrenzy,
|
||||
CacheLuckyReward,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -19,26 +32,30 @@ export function CacheStatsCookies() {
|
||||
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyFrenzy = CacheLucky * 7;
|
||||
CacheLuckyRewardFrenzy = CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheLuckyWrathRewardFrenzy = CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheLuckyRewardFrenzy =
|
||||
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheLuckyWrathRewardFrenzy =
|
||||
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheConjure = CacheLucky * 2;
|
||||
CacheConjureReward = CacheConjure * 0.15;
|
||||
|
||||
CacheEdifice = 0;
|
||||
let max = 0;
|
||||
let n = 0;
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||
if (Game.Objects[i].amount > 0) n++;
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
if ((Game.Objects[i].amount < max || n === 1)
|
||||
&& Game.Objects[i].amount < 400
|
||||
&& Game.Objects[i].price * 2 > CacheEdifice) {
|
||||
if (Game.Objects[i].amount > 0) n += 1;
|
||||
});
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (
|
||||
(Game.Objects[i].amount < max || n === 1) &&
|
||||
Game.Objects[i].amount < 400 &&
|
||||
Game.Objects[i].price * 2 > CacheEdifice
|
||||
) {
|
||||
CacheEdifice = Game.Objects[i].price * 2;
|
||||
CacheEdificeBuilding = i;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,6 +85,7 @@ export function CacheGoldenAndWrathCookiesMults() {
|
||||
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
|
||||
CacheDragonsFortuneMultAdjustment = 1;
|
||||
if (Game.shimmerTypes.golden.n === 0) {
|
||||
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult('Dragon\'s Fortune') * 1.23;
|
||||
CacheDragonsFortuneMultAdjustment *=
|
||||
1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ export let CacheWrinklersTotal = 0;
|
||||
export let CacheWrinklersNormal = 0;
|
||||
export let CacheWrinklersFattest = [0, null];
|
||||
|
||||
export let CacheAvgCps = 0;
|
||||
export let CacheCurrWrinklerCPSMult = 0;
|
||||
export let CacheCurrWrinklerCount = 0;
|
||||
|
||||
@@ -66,10 +65,10 @@ export let CacheSeasonPopShimmer = {};
|
||||
|
||||
export let CacheTimeTillNextPrestige = 0;
|
||||
|
||||
/** Stores lowest PP value */
|
||||
export let CacheMinPP = 0;
|
||||
export let CacheMidPP = 0;
|
||||
export let CacheMaxPP = 0;
|
||||
export let CacheArrayOfPPs = [];
|
||||
/** Stores all PP values of all buildings for all buy settings (1, 10, 100) */
|
||||
export let CachePPArray = [];
|
||||
|
||||
export let CacheGoldenShimmersByID = {};
|
||||
|
||||
@@ -100,3 +99,18 @@ export let CacheLastHeavenlyChips;
|
||||
export let CacheDoRemakeBuildPrices;
|
||||
|
||||
export let CacheHadBuildAura;
|
||||
|
||||
/** Store the CPS effect of each god if it was put into each slot */
|
||||
export let CacheGods = {
|
||||
0: [0, 0, 0],
|
||||
1: [0, 0, 0],
|
||||
2: [0, 0, 0],
|
||||
3: [0, 0, 0],
|
||||
4: [0, 0, 0],
|
||||
5: [0, 0, 0],
|
||||
6: [0, 0, 0],
|
||||
7: [0, 0, 0],
|
||||
8: [0, 0, 0],
|
||||
9: [0, 0, 0],
|
||||
10: [0, 0, 0],
|
||||
};
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheWrinklersFattest, CacheWrinklersNormal, CacheWrinklersTotal,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -14,8 +16,11 @@ import {
|
||||
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
|
||||
*/
|
||||
export default function CacheWrinklers() {
|
||||
CacheWrinklersTotal = 0;
|
||||
CacheWrinklersNormal = 0;
|
||||
CacheWrinklersFattest = [0, null];
|
||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||
let sucked = Game.wrinklers[i].sucked;
|
||||
let { sucked } = Game.wrinklers[i];
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
@@ -30,7 +35,8 @@ export default function CacheWrinklers() {
|
||||
CacheWrinklersTotal += sucked;
|
||||
if (Game.wrinklers[i].type === 0) {
|
||||
CacheWrinklersNormal += sucked;
|
||||
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
||||
if (sucked > CacheWrinklersFattest[0])
|
||||
CacheWrinklersFattest = [sucked, i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { default as ConfigDefault } from '../../Data/SettingsDefault';
|
||||
import { default as ConfigData } from '../../Data/SettingsData';
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import ConfigData from '../../Data/SettingsData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import save from '../../InitSaveLoad/save';
|
||||
import CMLoop from '../../Main/Loop';
|
||||
@@ -13,11 +13,19 @@ import CMLoop from '../../Main/Loop';
|
||||
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
||||
*/
|
||||
export function SaveConfig() {
|
||||
const saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]);
|
||||
const saveString = b64_to_utf8(
|
||||
unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0],
|
||||
);
|
||||
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
||||
if (CookieMonsterSave !== null) {
|
||||
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
|
||||
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
|
||||
const newSaveString = saveString.replace(
|
||||
CookieMonsterSave[0],
|
||||
`CookieMonster:${save()}`,
|
||||
);
|
||||
localStorage.setItem(
|
||||
'CookieClickerGame',
|
||||
escape(`${utf8_to_b64(newSaveString)}!END!`),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,44 +43,55 @@ export function LoadConfig(settings) {
|
||||
|
||||
// Check values
|
||||
let mod = false;
|
||||
for (const i in ConfigDefault) {
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (typeof CMOptions[i] === 'undefined') {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
} else if (i !== 'Header' && i !== 'Colors') {
|
||||
if (i.indexOf('SoundURL') === -1) {
|
||||
if (!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)) {
|
||||
if (
|
||||
!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (typeof CMOptions[i] !== 'string') { // Sound URLs
|
||||
} else if (typeof CMOptions[i] !== 'string') {
|
||||
// Sound URLs
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (i === 'Header') {
|
||||
for (const j in ConfigDefault.Header) {
|
||||
if (typeof CMOptions[i][j] === 'undefined' || !(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)) {
|
||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
}
|
||||
} else { // Colors
|
||||
for (const j in ConfigDefault.Colors) {
|
||||
if (typeof CMOptions[i][j] === 'undefined' || typeof CMOptions[i][j] !== 'string') {
|
||||
});
|
||||
} else {
|
||||
// Colors
|
||||
Object.keys(ConfigDefault.Colors).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
typeof CMOptions[i][j] !== 'string'
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mod) SaveConfig();
|
||||
CMLoop(); // Do loop once
|
||||
for (const i in ConfigDefault) {
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||
ConfigData[i].func();
|
||||
}
|
||||
}
|
||||
} else { // Default values
|
||||
});
|
||||
} else {
|
||||
// Default values
|
||||
LoadConfig(ConfigDefault);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,22 @@ import { CMOptions } from './VariablesAndData';
|
||||
* This function changes the position of both the bottom and timer bar
|
||||
*/
|
||||
export function UpdateBotTimerBarPosition() {
|
||||
if (CMOptions.BotBar === 1 && CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||
if (
|
||||
CMOptions.BotBar === 1 &&
|
||||
CMOptions.TimerBar === 1 &&
|
||||
CMOptions.TimerBarPos === 1
|
||||
) {
|
||||
l('CMBotBar').style.bottom = l('CMTimerBar').style.height;
|
||||
l('game').style.bottom = `${Number(l('CMTimerBar').style.height.replace('px', '')) + 70}px`;
|
||||
l('game').style.bottom = `${
|
||||
Number(l('CMTimerBar').style.height.replace('px', '')) + 70
|
||||
}px`;
|
||||
} else if (CMOptions.BotBar === 1) {
|
||||
l('CMBotBar').style.bottom = '0px';
|
||||
l('game').style.bottom = '70px';
|
||||
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||
l('game').style.bottom = l('CMTimerBar').style.height;
|
||||
} else { // No bars
|
||||
} else {
|
||||
// No bars
|
||||
l('game').style.bottom = '0px';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { default as ConfigData } from '../Data/SettingsData';
|
||||
import ConfigData from '../Data/SettingsData';
|
||||
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
|
||||
@@ -13,18 +13,20 @@ export const ConfigPrefix = 'CMConfig';
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
export function ToggleConfig(config) {
|
||||
CMOptions[config]++;
|
||||
CMOptions[config] += 1;
|
||||
|
||||
if (CMOptions[config] === ConfigData[config].label.length) {
|
||||
CMOptions[config] = 0;
|
||||
if (ConfigData[config].toggle) l(ConfigPrefix + config).className = 'option off';
|
||||
if (ConfigData[config].toggle)
|
||||
l(ConfigPrefix + config).className = 'option off';
|
||||
} else l(ConfigPrefix + config).className = 'option';
|
||||
|
||||
if (typeof ConfigData[config].func !== 'undefined') {
|
||||
ConfigData[config].func();
|
||||
}
|
||||
|
||||
l(ConfigPrefix + config).innerHTML = ConfigData[config].label[CMOptions[config]];
|
||||
l(ConfigPrefix + config).innerHTML =
|
||||
ConfigData[config].label[CMOptions[config]];
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ export function ToggleConfigVolume(config) {
|
||||
* @param {string} config The name of the header
|
||||
*/
|
||||
export function ToggleHeader(config) {
|
||||
CMOptions.Header[config]++;
|
||||
CMOptions.Header[config] += 1;
|
||||
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-return-assign */
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
@@ -8,12 +9,12 @@ import { CMOptions } from '../VariablesAndData';
|
||||
*/
|
||||
export default function ToggleGCTimer() {
|
||||
if (CMOptions.GCTimer === 1) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.display = 'block';
|
||||
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
||||
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (const i of Object.keys(GCTimers)) GCTimers[i].style.display = 'none';
|
||||
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
|
||||
}
|
||||
}
|
||||
|
||||
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
|
||||
* It is called by changes in CM.Options.WrinklerButtons
|
||||
*/
|
||||
export default function ToggleSectionHideButtons() {
|
||||
if (CMOptions.HideSectionsButtons) {
|
||||
l('CMSectionHidButtons').style.display = '';
|
||||
} else {
|
||||
l('CMSectionHidButtons').style.display = 'none';
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,16 @@ import { CMOptions } from '../VariablesAndData';
|
||||
* It is called by a change in CM.Options.UpBarColor
|
||||
*/
|
||||
export default function ToggleUpgradeBarAndColor() {
|
||||
if (CMOptions.UpBarColor === 1) { // Colours and bar on
|
||||
if (CMOptions.UpBarColor === 1) {
|
||||
// Colours and bar on
|
||||
l('CMUpgradeBar').style.display = '';
|
||||
UpdateUpgrades();
|
||||
} else if (CMOptions.UpBarColor === 2) { // Colours on and bar off
|
||||
} else if (CMOptions.UpBarColor === 2) {
|
||||
// Colours on and bar off
|
||||
l('CMUpgradeBar').style.display = 'none';
|
||||
UpdateUpgrades();
|
||||
} else { // Colours and bar off
|
||||
} else {
|
||||
// Colours and bar off
|
||||
l('CMUpgradeBar').style.display = 'none';
|
||||
Game.RebuildUpgrades();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ import { CMOptions } from '../VariablesAndData';
|
||||
* It is called by a change in CM.Options.UpgradeBarFixedPos
|
||||
*/
|
||||
export default function ToggleUpgradeBarFixedPos() {
|
||||
if (CMOptions.UpgradeBarFixedPos === 1) { // Fix to top of screen when scrolling
|
||||
if (CMOptions.UpgradeBarFixedPos === 1) {
|
||||
// Fix to top of screen when scrolling
|
||||
l('CMUpgradeBar').style.position = 'sticky';
|
||||
l('CMUpgradeBar').style.top = '0px';
|
||||
} else {
|
||||
|
||||
@@ -39,7 +39,8 @@ export const HalloCookies = [
|
||||
];
|
||||
|
||||
/** Array of the names of all Christmas cookies */
|
||||
export const ChristCookies = ['Christmas tree biscuits',
|
||||
export const ChristCookies = [
|
||||
'Christmas tree biscuits',
|
||||
'Snowflake biscuits',
|
||||
'Snowman biscuits',
|
||||
'Holly biscuits',
|
||||
@@ -49,7 +50,8 @@ export const ChristCookies = ['Christmas tree biscuits',
|
||||
];
|
||||
|
||||
/** Array of the names of all Valentine cookies */
|
||||
export const ValCookies = ['Pure heart biscuits',
|
||||
export const ValCookies = [
|
||||
'Pure heart biscuits',
|
||||
'Ardent heart biscuits',
|
||||
'Sour heart biscuits',
|
||||
'Weeping heart biscuits',
|
||||
@@ -59,7 +61,8 @@ export const ValCookies = ['Pure heart biscuits',
|
||||
];
|
||||
|
||||
/** Array of the names of all plant drops */
|
||||
export const PlantDrops = ['Elderwort biscuits',
|
||||
export const PlantDrops = [
|
||||
'Elderwort biscuits',
|
||||
'Bakeberry cookies',
|
||||
'Duketater cookies',
|
||||
'Green yeast digestives',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Data related directly to Cookie Monster */
|
||||
|
||||
export const VersionMajor = '2.031';
|
||||
export const VersionMinor = '5';
|
||||
export const VersionMinor = '6';
|
||||
|
||||
/** Information about Cookie Monster to be displayed in the info section */
|
||||
export const ModDescription = `<div class="listing">
|
||||
@@ -15,15 +15,27 @@ export const ModDescription = `<div class="listing">
|
||||
|
||||
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
|
||||
export const LatestReleaseNotes = `<div class="listing">
|
||||
The latest update (v 2.031.5) sees a total rehaul of the backend of the mod. It does not introduce any new functions, this is planned for the next release.</br>
|
||||
We believe we have fixed all bugs related to this new code, but if you find any bugs, please report them on the GitHub!</br>
|
||||
The latest update (v 2.031.6) has revamped the way PP is colourcoded. In the previous versions this was not always correct and we had some settings that made it even more incorrect. With this update Cookie Monster compares the PP of a building to all other possibilities (also buying 10 or 100) of a building and colors the PP accordingly.</br>
|
||||
This means that if it is better to buy 10 of a building immediately rather than to buy in increments of 1 Cookie Monster will now show this! In this case the buy 1 option will be yellow, while the buy 10 option will be green.</br>
|
||||
This also means that you will see some more diverse colors. Rather than coloring according to arbitrary "middle values" Cookie Monster now uses a top 10, 20 and 30. While this might take some getting used to we believe the new system is much better in conveying useful information to the user while also being more correct!</br>
|
||||
</br>
|
||||
<b>Besides, this update fixes the following bugs:</b></br>
|
||||
- Fixed some upgrade tooltips which did not display the full effect of buying the upgrades</br>
|
||||
- Fixed not always being able to sell when "blocking bulk buy"</br>
|
||||
- Fixed heavenly chips per second display</br>
|
||||
- Fixed small display bug when pressing shift and hovering over garden plots</br>
|
||||
- Fixed some bugs with the display of numbers and formatting of them</br>
|
||||
This update also implements the following functions:</br>
|
||||
- Added a tooltip displaying the reward to the extra pop wrinkler buttons</br>
|
||||
- Added tooltips to the Gods in the Pantheon</br>
|
||||
- The tooltip for Elder Pledge now displays correctly, although it takes some time to load after Cookie Monster has been loaded</br>
|
||||
- You can now test the volume and sound of notifications in the settings screen</br>
|
||||
- The bottom bar will now flicker less and each column has received a bit of padding</br>
|
||||
- Introduced new colour scheme for PP, see the explanation of colors in the Readme or the settings</br>
|
||||
- Added option to show buttons that can hide the upgrade and building section</br>
|
||||
- Added option to display PP as a time unit, note that these are only approximations. PP does not translate directly into time (the name is deceptive, we know...)</br>
|
||||
- Statistics page now shows chance for random drops when they have not been achieved</br>
|
||||
</br>
|
||||
This update fixes the following bugs:</br>
|
||||
- Incorrect amount for "required for max plant reward" in statistics page</br>
|
||||
- Fixed the tooltips of the '?' buttons in the statistics page not showing</br>
|
||||
- Fixed some unclear settings descriptions </br>
|
||||
</br>
|
||||
Please submit any bug reports or feature requests to the <a href="https://github.com/Aktanusa/CookieMonster">GitHub page!</a>
|
||||
</br>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
/** Data related directly to the scales used by Cookie Monster */
|
||||
|
||||
/** Array of abbreviations used in the "Metric" scale */
|
||||
export const metric = ['',
|
||||
'',
|
||||
'M',
|
||||
'G',
|
||||
'T',
|
||||
'P',
|
||||
'E',
|
||||
'Z',
|
||||
'Y',
|
||||
];
|
||||
export const metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
|
||||
/** Array of abbreviations used in the "Short" scale */
|
||||
export const shortScale = ['',
|
||||
export const shortScale = [
|
||||
'',
|
||||
'',
|
||||
'M',
|
||||
'B',
|
||||
@@ -42,7 +34,8 @@ export const shortScale = ['',
|
||||
];
|
||||
|
||||
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
||||
export const shortScaleAbbreviated = ['',
|
||||
export const shortScaleAbbreviated = [
|
||||
'',
|
||||
'K',
|
||||
'M',
|
||||
'B',
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import CachePP from '../Cache/PP/PP';
|
||||
/* eslint-disable no-unused-vars */
|
||||
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
|
||||
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
|
||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime';
|
||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer';
|
||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons';
|
||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
|
||||
import ToggleUpgradeBarAndColor from '../Config/Toggles/ToggleUpgradeBarAndColor';
|
||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
|
||||
@@ -14,8 +15,12 @@ import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
||||
import UpdateColors from '../Disp/HelperFunctions/UpdateColors';
|
||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||
import { SimDoSims } from '../Sim/VariablesAndData';
|
||||
import {
|
||||
SettingStandard, SettingColours, SettingVolume, SettingInputNumber,
|
||||
SettingStandard,
|
||||
SettingColours,
|
||||
SettingVolume,
|
||||
SettingInputNumber,
|
||||
} from './SettingClasses';
|
||||
|
||||
/** This includes all options of CookieMonster and their relevant data */
|
||||
@@ -27,7 +32,9 @@ const Config = {
|
||||
['Bottom Bar OFF', 'Bottom Bar ON'],
|
||||
'Building Information',
|
||||
true,
|
||||
function () { ToggleBotBar(); },
|
||||
function () {
|
||||
ToggleBotBar();
|
||||
},
|
||||
),
|
||||
TimerBar: new SettingStandard(
|
||||
'bool',
|
||||
@@ -35,7 +42,9 @@ const Config = {
|
||||
['Timer Bar OFF', 'Timer Bar ON'],
|
||||
'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy',
|
||||
true,
|
||||
function () { ToggleTimerBar(); },
|
||||
function () {
|
||||
ToggleTimerBar();
|
||||
},
|
||||
),
|
||||
TimerBarPos: new SettingStandard(
|
||||
'bool',
|
||||
@@ -43,22 +52,34 @@ const Config = {
|
||||
['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'],
|
||||
'Placement of the Timer Bar',
|
||||
false,
|
||||
function () { ToggleTimerBarPos(); },
|
||||
function () {
|
||||
ToggleTimerBarPos();
|
||||
},
|
||||
),
|
||||
TimerBarOverlay: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Timer Bar Overlay OFF', 'Timer Bar Overlay Only Seconds', 'Timer Bar Overlay Full'],
|
||||
[
|
||||
'Timer Bar Overlay OFF',
|
||||
'Timer Bar Overlay Only Seconds',
|
||||
'Timer Bar Overlay Full',
|
||||
],
|
||||
'Overlay on timers displaying seconds and/or percentage left',
|
||||
true,
|
||||
),
|
||||
SortBuildings: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Sort Buildings: Default', 'Sort Buildings: PP'],
|
||||
[
|
||||
'Sort Buildings: Default',
|
||||
'Sort Buildings: PP of x1 purchase',
|
||||
'Sort Buildings: PP of selected bulk mode',
|
||||
],
|
||||
'Sort the display of buildings in either default order or by PP',
|
||||
false,
|
||||
function () { UpdateBuildings(); },
|
||||
function () {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
SortUpgrades: new SettingStandard(
|
||||
'bool',
|
||||
@@ -66,7 +87,9 @@ const Config = {
|
||||
['Sort Upgrades: Default', 'Sort Upgrades: PP'],
|
||||
'Sort the display of upgrades in either default order or by PP',
|
||||
false,
|
||||
function () { UpdateUpgrades(); },
|
||||
function () {
|
||||
UpdateUpgrades();
|
||||
},
|
||||
),
|
||||
BuildColor: new SettingStandard(
|
||||
'bool',
|
||||
@@ -74,39 +97,55 @@ const Config = {
|
||||
['Building Colors OFF', 'Building Colors ON'],
|
||||
'Color code buildings',
|
||||
true,
|
||||
function () { UpdateBuildings(); },
|
||||
function () {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
BulkBuildColor: new SettingStandard(
|
||||
PPDisplayTime: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'],
|
||||
'Color code bulk buildings based on single buildings color or calculated bulk value color',
|
||||
['PP As Value (Standard)', 'PP As Time Unit'],
|
||||
'Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.',
|
||||
false,
|
||||
function () { UpdateBuildings(); },
|
||||
),
|
||||
UpBarColor: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'],
|
||||
[
|
||||
'Upgrade Colors/Bar OFF',
|
||||
'Upgrade Colors with Bar ON',
|
||||
'Upgrade Colors without Bar ON',
|
||||
],
|
||||
'Color code upgrades and optionally add a counter bar',
|
||||
false,
|
||||
function () { ToggleUpgradeBarAndColor(); },
|
||||
function () {
|
||||
ToggleUpgradeBarAndColor();
|
||||
},
|
||||
),
|
||||
Colors: new SettingColours(
|
||||
'color',
|
||||
'BarsColors',
|
||||
{
|
||||
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels',
|
||||
Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels',
|
||||
Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels',
|
||||
Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels',
|
||||
Gray: 'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Blue:
|
||||
'Color Blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green:
|
||||
'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow:
|
||||
'Color Yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
|
||||
Orange:
|
||||
'Color Orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
|
||||
Red:
|
||||
'Color Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
|
||||
Purple:
|
||||
'Color Purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
|
||||
Gray:
|
||||
'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Pink: 'Color Pink. Used for Dragonflight bar',
|
||||
Brown: 'Color Brown. Used for Dragon Harvest bar',
|
||||
},
|
||||
function () { UpdateColors(); },
|
||||
function () {
|
||||
UpdateColors();
|
||||
},
|
||||
),
|
||||
UpgradeBarFixedPos: new SettingStandard(
|
||||
'bool',
|
||||
@@ -114,16 +153,25 @@ const Config = {
|
||||
['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'],
|
||||
'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling',
|
||||
true,
|
||||
function () { ToggleUpgradeBarFixedPos(); },
|
||||
function () {
|
||||
ToggleUpgradeBarFixedPos();
|
||||
},
|
||||
),
|
||||
|
||||
// Calculation
|
||||
CalcWrink: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'],
|
||||
[
|
||||
'Calculate with Wrinklers OFF',
|
||||
'Calculate with Wrinklers ON',
|
||||
'Calculate with Single Fattest Wrinkler ON',
|
||||
],
|
||||
'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers',
|
||||
true,
|
||||
function () {
|
||||
SimDoSims = true;
|
||||
},
|
||||
),
|
||||
CPSMode: new SettingStandard(
|
||||
'bool',
|
||||
@@ -135,29 +183,41 @@ const Config = {
|
||||
AvgCPSHist: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'],
|
||||
[
|
||||
'Average CPS for past 10s',
|
||||
'Average CPS for past 15s',
|
||||
'Average CPS for past 30s',
|
||||
'Average CPS for past 1m',
|
||||
'Average CPS for past 5m',
|
||||
'Average CPS for past 10m',
|
||||
'Average CPS for past 15m',
|
||||
'Average CPS for past 30m',
|
||||
],
|
||||
'How much time average Cookies Per Second should consider',
|
||||
false,
|
||||
),
|
||||
AvgClicksHist: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'],
|
||||
[
|
||||
'Average Cookie Clicks for past 1s',
|
||||
'Average Cookie Clicks for past 5s',
|
||||
'Average Cookie Clicks for past 10s',
|
||||
'Average Cookie Clicks for past 15s',
|
||||
'Average Cookie Clicks for past 30s',
|
||||
],
|
||||
'How much time average Cookie Clicks should consider',
|
||||
false,
|
||||
),
|
||||
ColorPPBulkMode: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'],
|
||||
'Color PP-values based on comparison with single purchase or with selected bulk-buy mode',
|
||||
false,
|
||||
function () { CachePP(); },
|
||||
),
|
||||
PPExcludeTop: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'],
|
||||
[
|
||||
"Don't Ignore Any",
|
||||
'Ignore 1st Best',
|
||||
'Ignore 1st and 2nd Best',
|
||||
'Ignore 1st, 2nd and 3rd Best',
|
||||
],
|
||||
'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values',
|
||||
true,
|
||||
),
|
||||
@@ -179,7 +239,10 @@ const Config = {
|
||||
ToolWarnBon: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'],
|
||||
[
|
||||
'Calculate Tooltip Warning With Bonus CPS OFF',
|
||||
'Calculate Tooltip Warning With Bonus CPS ON',
|
||||
],
|
||||
'Calculate the warning with or without the bonus CPS you get from buying',
|
||||
true,
|
||||
),
|
||||
@@ -205,7 +268,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when Golden Cookie spawns',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.GCNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.GCNotification);
|
||||
},
|
||||
),
|
||||
GCFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -221,12 +286,7 @@ const Config = {
|
||||
'Play a sound on Golden Cookie',
|
||||
true,
|
||||
),
|
||||
GCVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationGC',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
GCVolume: new SettingVolume('vol', 'NotificationGC', [], 'Volume'),
|
||||
GCSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationGC',
|
||||
@@ -239,7 +299,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when Fortune Cookie is on the Ticker',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.FortuneNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.FortuneNotification);
|
||||
},
|
||||
),
|
||||
FortuneFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -255,12 +317,7 @@ const Config = {
|
||||
'Play a sound on Fortune Cookie',
|
||||
true,
|
||||
),
|
||||
FortuneVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationFC',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
FortuneVolume: new SettingVolume('vol', 'NotificationFC', [], 'Volume'),
|
||||
|
||||
FortuneSoundURL: new SettingStandard(
|
||||
'url',
|
||||
@@ -274,7 +331,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification on Season Popup',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.SeaNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.SeaNotification);
|
||||
},
|
||||
),
|
||||
SeaFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -290,12 +349,7 @@ const Config = {
|
||||
'Play a sound on Season Popup',
|
||||
true,
|
||||
),
|
||||
SeaVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationSea',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
SeaVolume: new SettingVolume('vol', 'NotificationSea', [], 'Volume'),
|
||||
SeaSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationSea',
|
||||
@@ -316,12 +370,7 @@ const Config = {
|
||||
'Play a sound on Garden Tick',
|
||||
true,
|
||||
),
|
||||
GardVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationGard',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
GardVolume: new SettingVolume('vol', 'NotificationGard', [], 'Volume'),
|
||||
GardSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationGard',
|
||||
@@ -334,7 +383,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when magic reaches maximum',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.MagicNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.MagicNotification);
|
||||
},
|
||||
),
|
||||
MagicFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -350,12 +401,7 @@ const Config = {
|
||||
'Play a sound when magic reaches maximum',
|
||||
true,
|
||||
),
|
||||
MagicVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationMagi',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
MagicVolume: new SettingVolume('vol', 'NotificationMagi', [], 'Volume'),
|
||||
MagicSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationMagi',
|
||||
@@ -368,7 +414,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when a Wrinkler appears',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.WrinklerNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerNotification);
|
||||
},
|
||||
),
|
||||
WrinklerFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -384,12 +432,7 @@ const Config = {
|
||||
'Play a sound when a Wrinkler appears',
|
||||
true,
|
||||
),
|
||||
WrinklerVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationWrink',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
WrinklerVolume: new SettingVolume('vol', 'NotificationWrink', [], 'Volume'),
|
||||
WrinklerSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationWrink',
|
||||
@@ -402,7 +445,9 @@ const Config = {
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when the maximum amount of Wrinklers has appeared',
|
||||
true,
|
||||
function () { CheckNotificationPermissions(CMOptions.WrinklerMaxNotification); },
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerMaxNotification);
|
||||
},
|
||||
),
|
||||
WrinklerMaxFlash: new SettingStandard(
|
||||
'bool',
|
||||
@@ -435,14 +480,20 @@ const Config = {
|
||||
TooltipBuildUpgrade: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Building/Upgrade Tooltip Information OFF', 'Building/Upgrade Tooltip Information ON'],
|
||||
[
|
||||
'Building/Upgrade Tooltip Information OFF',
|
||||
'Building/Upgrade Tooltip Information ON',
|
||||
],
|
||||
'Extra information in Building/Upgrade tooltips',
|
||||
true,
|
||||
),
|
||||
TooltipAmor: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'],
|
||||
[
|
||||
'Buildings Tooltip Amortization Information OFF',
|
||||
'Buildings Tooltip Amortization Information ON',
|
||||
],
|
||||
'Add amortization information to buildings tooltip',
|
||||
true,
|
||||
),
|
||||
@@ -495,7 +546,9 @@ const Config = {
|
||||
['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'],
|
||||
'Placement of the warning boxes',
|
||||
false,
|
||||
function () { ToggleToolWarnPos(); },
|
||||
function () {
|
||||
ToggleToolWarnPos();
|
||||
},
|
||||
),
|
||||
TooltipGrim: new SettingStandard(
|
||||
'bool',
|
||||
@@ -525,6 +578,16 @@ const Config = {
|
||||
'Shows a tooltip for plants that have a cookie reward.',
|
||||
true,
|
||||
),
|
||||
TooltipPantheon: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
[
|
||||
'Show Extra Info Pantheon Tooltip OFF',
|
||||
'Show Extra Info Pantheon Tooltip ON',
|
||||
],
|
||||
'Shows additional info in the pantheon tooltip',
|
||||
true,
|
||||
),
|
||||
DragonAuraInfo: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
@@ -575,7 +638,9 @@ const Config = {
|
||||
['Detailed Time OFF', 'Detailed Time ON'],
|
||||
'Change how time is displayed in certain statistics and tooltips',
|
||||
true,
|
||||
function () { ToggleDetailedTime(); },
|
||||
function () {
|
||||
ToggleDetailedTime();
|
||||
},
|
||||
),
|
||||
GrimoireBar: new SettingStandard(
|
||||
'bool',
|
||||
@@ -604,18 +669,29 @@ const Config = {
|
||||
Scale: new SettingStandard(
|
||||
'bool',
|
||||
'Notation',
|
||||
['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'],
|
||||
[
|
||||
"Game's Setting Scale",
|
||||
'Metric',
|
||||
'Short Scale',
|
||||
'Short Scale (Abbreviated)',
|
||||
'Scientific Notation',
|
||||
'Engineering Notation',
|
||||
],
|
||||
'Change how long numbers are handled',
|
||||
false,
|
||||
function () { RefreshScale(); },
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleDecimals: new SettingStandard(
|
||||
'bool',
|
||||
'Notation',
|
||||
['1 decimals', '2 decimals', '3 decimals'],
|
||||
'Set the number of decimals used when applicable',
|
||||
`Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game's Setting Scale"`,
|
||||
false,
|
||||
function () { RefreshScale(); },
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleSeparator: new SettingStandard(
|
||||
'bool',
|
||||
@@ -623,7 +699,9 @@ const Config = {
|
||||
['. for decimals (Standard)', '. for thousands'],
|
||||
'Set the separator used for decimals and thousands',
|
||||
false,
|
||||
function () { RefreshScale(); },
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleCutoff: new SettingInputNumber(
|
||||
'numscale',
|
||||
@@ -641,7 +719,9 @@ const Config = {
|
||||
['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'],
|
||||
'A timer on the Golden Cookie when it has been spawned',
|
||||
true,
|
||||
function () { ToggleGCTimer(); },
|
||||
function () {
|
||||
ToggleGCTimer();
|
||||
},
|
||||
),
|
||||
Favicon: new SettingStandard(
|
||||
'bool',
|
||||
@@ -649,15 +729,29 @@ const Config = {
|
||||
['Favicon OFF', 'Favicon ON'],
|
||||
'Update favicon with Golden/Wrath Cookie',
|
||||
true,
|
||||
function () { UpdateFavicon(); },
|
||||
function () {
|
||||
UpdateFavicon();
|
||||
},
|
||||
),
|
||||
WrinklerButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Extra Buttons OFF', 'Extra Buttons ON'],
|
||||
['Extra Wrinkler Buttons OFF', 'Extra Wrinkler Buttons ON'],
|
||||
'Show buttons for popping wrinklers at bottom of cookie section',
|
||||
true,
|
||||
function () { ToggleWrinklerButtons(); },
|
||||
function () {
|
||||
ToggleWrinklerButtons();
|
||||
},
|
||||
),
|
||||
HideSectionsButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Hide Upgrades/Buildings Button OFF', 'Hide Upgrades/Buildings Button ON'],
|
||||
'Show buttons for hiding and showing the upgrades and buildings section in the right column',
|
||||
true,
|
||||
function () {
|
||||
ToggleSectionHideButtons();
|
||||
},
|
||||
),
|
||||
BulkBuyBlock: new SettingStandard(
|
||||
'bool',
|
||||
|
||||
@@ -5,18 +5,17 @@ const ConfigDefault = {
|
||||
TimerBarPos: 0,
|
||||
TimerBarOverlay: 2,
|
||||
BuildColor: 1,
|
||||
BulkBuildColor: 0,
|
||||
PPDisplayTime: 0,
|
||||
UpBarColor: 1,
|
||||
UpgradeBarFixedPos: 1,
|
||||
CalcWrink: 0,
|
||||
CPSMode: 1,
|
||||
AvgCPSHist: 3,
|
||||
AvgClicksHist: 0,
|
||||
ColorPPBulkMode: 1,
|
||||
PPExcludeTop: 0,
|
||||
PPSecondsLowerLimit: 0,
|
||||
PPOnlyConsiderBuyable: 0,
|
||||
ToolWarnBon: 0,
|
||||
ToolWarnBon: 1,
|
||||
Title: 1,
|
||||
GeneralSound: 1,
|
||||
GCNotification: 0,
|
||||
@@ -28,12 +27,14 @@ const ConfigDefault = {
|
||||
FortuneFlash: 1,
|
||||
FortuneSound: 1,
|
||||
FortuneVolume: 100,
|
||||
FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
FortuneSoundURL:
|
||||
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
SeaNotification: 0,
|
||||
SeaFlash: 1,
|
||||
SeaSound: 1,
|
||||
SeaVolume: 100,
|
||||
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
SeaSoundURL:
|
||||
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
GardFlash: 1,
|
||||
GardSound: 1,
|
||||
GardVolume: 100,
|
||||
@@ -42,17 +43,20 @@ const ConfigDefault = {
|
||||
MagicFlash: 1,
|
||||
MagicSound: 1,
|
||||
MagicVolume: 100,
|
||||
MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
MagicSoundURL:
|
||||
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
WrinklerNotification: 0,
|
||||
WrinklerFlash: 1,
|
||||
WrinklerSound: 1,
|
||||
WrinklerVolume: 100,
|
||||
WrinklerSoundURL: 'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
WrinklerSoundURL:
|
||||
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
WrinklerMaxNotification: 0,
|
||||
WrinklerMaxFlash: 1,
|
||||
WrinklerMaxSound: 1,
|
||||
WrinklerMaxVolume: 100,
|
||||
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
WrinklerMaxSoundURL:
|
||||
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
TooltipBuildUpgrade: 1,
|
||||
TooltipAmor: 0,
|
||||
ToolWarnLucky: 1,
|
||||
@@ -66,6 +70,7 @@ const ConfigDefault = {
|
||||
TooltipWrink: 1,
|
||||
TooltipLump: 1,
|
||||
TooltipPlots: 1,
|
||||
TooltipPantheon: 1,
|
||||
DragonAuraInfo: 1,
|
||||
TooltipAscendButton: 1,
|
||||
Stats: 1,
|
||||
@@ -81,16 +86,48 @@ const ConfigDefault = {
|
||||
ScaleSeparator: 0,
|
||||
ScaleCutoff: 999999,
|
||||
Colors: {
|
||||
Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513',
|
||||
Blue: '#4bb8f0',
|
||||
Green: '#00ff00',
|
||||
Yellow: '#ffff00',
|
||||
Orange: '#ff7f00',
|
||||
Red: '#ff0000',
|
||||
Purple: '#ff00ff',
|
||||
Gray: '#b3b3b3',
|
||||
Pink: '#ff1493',
|
||||
Brown: '#8b4513',
|
||||
},
|
||||
SortBuildings: 0,
|
||||
SortUpgrades: 0,
|
||||
GCTimer: 1,
|
||||
Favicon: 1,
|
||||
WrinklerButtons: 1,
|
||||
HideSectionsButtons: 0,
|
||||
BulkBuyBlock: 0,
|
||||
Header: {
|
||||
BarsColors: 1, Calculation: 1, Notification: 1, NotificationGeneral: 1, NotificationGC: 1, NotificationFC: 1, NotificationSea: 1, NotificationGard: 1, NotificationMagi: 1, NotificationWrink: 1, NotificationWrinkMax: 1, Tooltip: 1, Statistics: 1, Notation: 1, Miscellaneous: 1, Lucky: 1, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1,
|
||||
BarsColors: 1,
|
||||
Calculation: 1,
|
||||
Notification: 1,
|
||||
NotificationGeneral: 1,
|
||||
NotificationGC: 1,
|
||||
NotificationFC: 1,
|
||||
NotificationSea: 1,
|
||||
NotificationGard: 1,
|
||||
NotificationMagi: 1,
|
||||
NotificationWrink: 1,
|
||||
NotificationWrinkMax: 1,
|
||||
Tooltip: 1,
|
||||
Statistics: 1,
|
||||
Notation: 1,
|
||||
Miscellaneous: 1,
|
||||
Lucky: 1,
|
||||
Chain: 1,
|
||||
Spells: 1,
|
||||
Garden: 1,
|
||||
Prestige: 1,
|
||||
Wrink: 1,
|
||||
Sea: 1,
|
||||
Misc: 1,
|
||||
InfoTab: 1,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
/** General functions to format or beautify strings */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
import {
|
||||
ColorGreen, ColorOrange, ColorRed, ColorYellow,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -18,49 +22,68 @@ export function Beautify(num, floats, forced) {
|
||||
const decimals = CMOptions.ScaleDecimals + 1;
|
||||
if (num === Infinity) {
|
||||
return 'Infinity';
|
||||
} if (typeof num === 'undefined') {
|
||||
}
|
||||
if (typeof num === 'undefined') {
|
||||
return '0';
|
||||
} if (CMOptions.Scale === 0) {
|
||||
}
|
||||
if (CMOptions.Scale === 0) {
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
} if (Number.isFinite(num)) {
|
||||
}
|
||||
if (Number.isFinite(num)) {
|
||||
let answer = '';
|
||||
if (num === 0) {
|
||||
return num.toString();
|
||||
} if (num > 0.001 && num < CMOptions.ScaleCutoff) {
|
||||
}
|
||||
if (num > 0.001 && num < CMOptions.ScaleCutoff) {
|
||||
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
|
||||
else answer = num.toLocaleString('en');
|
||||
return answer;
|
||||
} if (CMOptions.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8
|
||||
}
|
||||
if ((CMOptions.Scale === 4 && !forced) || forced === 4) {
|
||||
// Scientific notation, 123456789 => 1.235E+8
|
||||
answer = num.toExponential(decimals).toString().replace('e', 'E');
|
||||
} else {
|
||||
const exponential = num.toExponential().toString();
|
||||
const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3);
|
||||
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals);
|
||||
const AmountOfTenPowerThree = Math.floor(
|
||||
exponential.slice(exponential.indexOf('e') + 1) / 3,
|
||||
);
|
||||
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(
|
||||
decimals,
|
||||
);
|
||||
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
|
||||
if (CMOptions.Scale === 1 && !forced || forced === 1) { // Metric scale, 123456789 => 123.457 M
|
||||
if ((CMOptions.Scale === 1 && !forced) || forced === 1) {
|
||||
// Metric scale, 123456789 => 123.457 M
|
||||
if (num >= 0.01 && num < Number(`1e${metric.length * 3}`)) {
|
||||
answer += ` ${metric[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if (CMOptions.Scale === 2 && !forced || forced === 2) { // Short scale, 123456789 => 123.457 M
|
||||
} else if ((CMOptions.Scale === 2 && !forced) || forced === 2) {
|
||||
// Short scale, 123456789 => 123.457 M
|
||||
if (num >= 0.01 && num < Number(`1e${shortScale.length * 3}`)) {
|
||||
answer += ` ${shortScale[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if (CMOptions.Scale === 3 && !forced || forced === 3) { // Short scale, 123456789 => 123.457 M
|
||||
if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) {
|
||||
} else if ((CMOptions.Scale === 3 && !forced) || forced === 3) {
|
||||
// Short scale, 123456789 => 123.457 M
|
||||
if (
|
||||
num >= 0.01 &&
|
||||
num < Number(`1e${shortScaleAbbreviated.length * 3}`)
|
||||
) {
|
||||
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if (CMOptions.Scale === 5 && !forced || forced === 5) { // Engineering notation, 123456789 => 123.457E+6
|
||||
} else if ((CMOptions.Scale === 5 && !forced) || forced === 5) {
|
||||
// Engineering notation, 123456789 => 123.457E+6
|
||||
answer += `E${AmountOfTenPowerThree * 3}`;
|
||||
}
|
||||
}
|
||||
if (answer === '') {
|
||||
console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`);
|
||||
console.log(
|
||||
`Could not beautify number with Cookie Monster Beautify: ${num}`,
|
||||
);
|
||||
answer = BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
|
||||
return answer;
|
||||
}
|
||||
console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`);
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
|
||||
@@ -71,27 +94,36 @@ export function Beautify(num, floats, forced) {
|
||||
* @returns {string} Formatted time
|
||||
*/
|
||||
export function FormatTime(time, longFormat) {
|
||||
let formattedTime = time;
|
||||
if (time === Infinity) return time;
|
||||
time = Math.ceil(time);
|
||||
const y = Math.floor(time / 31557600);
|
||||
const d = Math.floor(time % 31557600 / 86400);
|
||||
const h = Math.floor(time % 86400 / 3600);
|
||||
const m = Math.floor(time % 3600 / 60);
|
||||
const s = Math.floor(time % 60);
|
||||
if (time < 0) return 'Negative time period';
|
||||
formattedTime = Math.ceil(time);
|
||||
const y = Math.floor(formattedTime / 31557600);
|
||||
const d = Math.floor((formattedTime % 31557600) / 86400);
|
||||
const h = Math.floor((formattedTime % 86400) / 3600);
|
||||
const m = Math.floor((formattedTime % 3600) / 60);
|
||||
const s = Math.floor(formattedTime % 60);
|
||||
let str = '';
|
||||
if (CMOptions.TimeFormat) {
|
||||
if (time > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||
str += `${(h < 10 ? '0' : '') + h}:`;
|
||||
str += `${(m < 10 ? '0' : '') + m}:`;
|
||||
str += (s < 10 ? '0' : '') + s;
|
||||
} else {
|
||||
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str += (y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '');
|
||||
str += (d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '');
|
||||
if (str.length > 0 || h > 0) str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||
if (str.length > 0 || m > 0) str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
|
||||
if (formattedTime > 777600000)
|
||||
return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str +=
|
||||
y > 0
|
||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
|
||||
: '';
|
||||
str +=
|
||||
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '';
|
||||
if (str.length > 0 || h > 0)
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||
if (str.length > 0 || m > 0)
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
||||
}
|
||||
return str;
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
@@ -26,16 +31,17 @@ export default function UpdateBuildings() {
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColor === 1) {
|
||||
for (const i of Object.keys(target)) {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions.Colors[target[i].color];
|
||||
}
|
||||
Object.keys(target).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||
CMOptions.Colors[target[i].color];
|
||||
});
|
||||
} else {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (Game.buyMode === -1) {
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
const o = Game.Objects[i];
|
||||
l(`productPrice${o.id}`).style.color = '';
|
||||
/*
|
||||
@@ -46,22 +52,52 @@ export default function UpdateBuildings() {
|
||||
*
|
||||
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
|
||||
*/
|
||||
l(`productPrice${o.id}`).innerHTML = Beautify(BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1));
|
||||
}
|
||||
l(`productPrice${o.id}`).innerHTML = Beautify(
|
||||
BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
||||
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
|
||||
// This regulates sorting of buildings
|
||||
if (Game.buyMode === 1 && CMOptions.SortBuildings) {
|
||||
const arr = Object.keys(target).map((k) => {
|
||||
let arr;
|
||||
if (CMOptions.SortBuildings === 1) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = CacheObjects1[k];
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
return o;
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
} else if (CMOptions.SortBuildings === 2) {
|
||||
arr = Object.keys(target).map((k) => {
|
||||
const o = target[k];
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
return o;
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) { return (Colors.indexOf(a.color) > Colors.indexOf(b.color) ? 1 : (Colors.indexOf(a.color) < Colors.indexOf(b.color) ? -1 : (a.pp < b.pp) ? -1 : 0)); });
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
}
|
||||
|
||||
for (let x = 0; x < arr.length; x++) {
|
||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import {
|
||||
ColorBackPre, ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorTextPre, ColorYellow,
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -32,8 +40,18 @@ function CreateUpgradeBarLegend() {
|
||||
|
||||
legend.appendChild(legendLine(ColorBlue, 'Better than best PP building'));
|
||||
legend.appendChild(legendLine(ColorGreen, 'Same as best PP building'));
|
||||
legend.appendChild(legendLine(ColorYellow, 'Between best and worst PP buildings closer to best'));
|
||||
legend.appendChild(legendLine(ColorOrange, 'Between best and worst PP buildings closer to worst'));
|
||||
legend.appendChild(
|
||||
legendLine(
|
||||
ColorYellow,
|
||||
'Between best and worst PP buildings closer to best',
|
||||
),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(
|
||||
ColorOrange,
|
||||
'Between best and worst PP buildings closer to worst',
|
||||
),
|
||||
);
|
||||
legend.appendChild(legendLine(ColorRed, 'Same as worst PP building'));
|
||||
legend.appendChild(legendLine(ColorPurple, 'Worse than worst PP building'));
|
||||
legend.appendChild(legendLine(ColorGray, 'Negative or infinity PP'));
|
||||
@@ -52,11 +70,15 @@ export default function CreateUpgradeBar() {
|
||||
UpgradeBar.style.fontWeight = 'bold';
|
||||
UpgradeBar.style.display = 'none';
|
||||
UpgradeBar.style.zIndex = '21';
|
||||
UpgradeBar.onmouseout = function () { Game.tooltip.hide(); };
|
||||
UpgradeBar.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
|
||||
const placeholder = document.createElement('div');
|
||||
placeholder.appendChild(CreateUpgradeBarLegend());
|
||||
UpgradeBar.onmouseover = function () { Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store'); };
|
||||
UpgradeBar.onmouseover = function () {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
|
||||
};
|
||||
|
||||
const upgradeNumber = function (id, color) {
|
||||
const span = document.createElement('span');
|
||||
@@ -75,5 +97,8 @@ export default function CreateUpgradeBar() {
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColorPurple));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColorGray));
|
||||
|
||||
l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
|
||||
l('upgrades').parentNode.insertBefore(
|
||||
UpgradeBar,
|
||||
l('upgrades').parentNode.childNodes[3],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorBackPre, ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, Colors, ColorYellow,
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
Colors,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -21,12 +30,15 @@ export default function UpdateUpgrades() {
|
||||
let purple = 0;
|
||||
let gray = 0;
|
||||
|
||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
||||
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||
const me = Game.UpgradesInStore[i];
|
||||
let addedColor = false;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j++) {
|
||||
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1) {
|
||||
l(`upgrade${i}`).childNodes[j].className = ColorBackPre + CacheUpgrades[me.name].color;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||
if (
|
||||
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
|
||||
) {
|
||||
l(`upgrade${i}`).childNodes[j].className =
|
||||
ColorBackPre + CacheUpgrades[me.name].color;
|
||||
addedColor = true;
|
||||
break;
|
||||
}
|
||||
@@ -38,14 +50,14 @@ export default function UpdateUpgrades() {
|
||||
div.className = ColorBackPre + CacheUpgrades[me.name].color;
|
||||
l(`upgrade${i}`).appendChild(div);
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColorBlue) blue++;
|
||||
else if (CacheUpgrades[me.name].color === ColorGreen) green++;
|
||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow++;
|
||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange++;
|
||||
else if (CacheUpgrades[me.name].color === ColorRed) red++;
|
||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple++;
|
||||
else if (CacheUpgrades[me.name].color === ColorGray) gray++;
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColorBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGray) gray += 1;
|
||||
});
|
||||
|
||||
l('CMUpgradeBarBlue').textContent = blue;
|
||||
l('CMUpgradeBarGreen').textContent = green;
|
||||
@@ -59,7 +71,7 @@ export default function UpdateUpgrades() {
|
||||
const arr = [];
|
||||
// Build array of pointers, sort by pp, set flex positions
|
||||
// This regulates sorting of upgrades
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
const o = {};
|
||||
o.name = Game.UpgradesInStore[x].name;
|
||||
o.price = Game.UpgradesInStore[x].basePrice;
|
||||
@@ -68,7 +80,15 @@ export default function UpdateUpgrades() {
|
||||
}
|
||||
|
||||
if (CMOptions.SortUpgrades) {
|
||||
arr.sort(function (a, b) { return (Colors.indexOf(a.color) > Colors.indexOf(b.color) ? 1 : (Colors.indexOf(a.color) < Colors.indexOf(b.color) ? -1 : (a.pp < b.pp) ? -1 : 0)); });
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
} else {
|
||||
arr.sort((a, b) => a.price - b.price);
|
||||
}
|
||||
@@ -76,7 +96,8 @@ export default function UpdateUpgrades() {
|
||||
const nameChecker = function (arr2, upgrade) {
|
||||
return arr2.findIndex((e) => e.name === upgrade.name);
|
||||
};
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
|
||||
l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
l(`upgrade${x}`).style.order =
|
||||
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@ import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
||||
import { Beautify, FormatTime } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
/**
|
||||
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||
@@ -13,16 +16,21 @@ import { Beautify, FormatTime } from '../BeautifyAndFormatting/BeautifyFormattin
|
||||
export function AddAuraInfo(aura) {
|
||||
if (CMOptions.DragonAuraInfo === 1) {
|
||||
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
|
||||
const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
|
||||
const timeToRecover = FormatTime(
|
||||
priceOfChange / (bonusCPS + Game.cookiesPs),
|
||||
);
|
||||
const bonusCPSPercentage = Beautify(bonusCPS / Game.cookiesPs);
|
||||
|
||||
l('dragonAuraInfo').style.minHeight = '60px';
|
||||
l('dragonAuraInfo').style.margin = '8px';
|
||||
l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
|
||||
l('dragonAuraInfo').appendChild(document.createElement('div')).className =
|
||||
'line';
|
||||
const div = document.createElement('div');
|
||||
div.style.minWidth = '200px';
|
||||
div.style.textAlign = 'center';
|
||||
div.textContent = `Picking this aura will change CPS by ${Beautify(bonusCPS)} (${bonusCPSPercentage}% of current CPS).`;
|
||||
div.textContent = `Picking this aura will change CPS by ${Beautify(
|
||||
bonusCPS,
|
||||
)} (${bonusCPSPercentage}% of current CPS).`;
|
||||
l('dragonAuraInfo').appendChild(div);
|
||||
const div2 = document.createElement('div');
|
||||
div2.style.minWidth = '200px';
|
||||
@@ -38,16 +46,25 @@ export function AddAuraInfo(aura) {
|
||||
*/
|
||||
export function AddDragonLevelUpTooltip() {
|
||||
// Check if it is the dragon popup that is on screen
|
||||
if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) !== null) {
|
||||
if (
|
||||
(l('specialPopup').className.match(/onScreen/) &&
|
||||
l('specialPopup').children[0].style.background.match(/dragon/)) !== null
|
||||
) {
|
||||
for (let i = 0; i < l('specialPopup').childNodes.length; i++) {
|
||||
if (l('specialPopup').childNodes[i].className === 'optionBox') {
|
||||
l('specialPopup').children[i].onmouseover = function () {
|
||||
CacheDragonCost();
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(l('specialPopup'), `<div style="min-width:200px;text-align:center;">${CacheCostDragonUpgrade}</div>`, 'this');
|
||||
Game.tooltip.draw(
|
||||
l('specialPopup'),
|
||||
`<div style="min-width:200px;text-align:center;">${CacheCostDragonUpgrade}</div>`,
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('specialPopup').children[i].onmouseout = function () { Game.tooltip.shouldHide = 1; };
|
||||
l('specialPopup').children[i].onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,11 @@ import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
|
||||
import { UpdateBotBar } from './InfoBars/BottomBar';
|
||||
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
||||
import RefreshMenu from './MenuSections/Refreshmenu';
|
||||
import { UpdateTooltips } from './Tooltips/Tooltip';
|
||||
import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/WrinklerTooltips';
|
||||
import UpdateTooltips from './Tooltips/UpdateTooltips';
|
||||
import {
|
||||
CheckWrinklerTooltip,
|
||||
UpdateWrinklerTooltip,
|
||||
} from './Tooltips/WrinklerTooltips';
|
||||
|
||||
/**
|
||||
* This function handles all custom drawing for the Game.Draw() function.
|
||||
@@ -15,12 +18,17 @@ import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/Wrinkler
|
||||
export default function Draw() {
|
||||
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
|
||||
if (
|
||||
(Game.prefs.autosave && Game.drawT % 10 === 0) // with autosave ON and every 10 ticks
|
||||
&& (Game.onMenu === 'stats' && CMOptions.Stats) // while being on the stats menu only
|
||||
Game.prefs.autosave &&
|
||||
Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks
|
||||
Game.onMenu === 'stats' &&
|
||||
CMOptions.Stats // while being on the stats menu only
|
||||
) {
|
||||
const timer = document.getElementById('CMStatsAutosaveTimer');
|
||||
if (timer) {
|
||||
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
|
||||
timer.innerText = Game.sayTime(
|
||||
Game.fps * 60 - (Game.T % (Game.fps * 60)),
|
||||
4,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,5 +53,10 @@ export default function Draw() {
|
||||
RefreshMenu();
|
||||
|
||||
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
|
||||
l('cookies').innerHTML = l('cookies').innerHTML.replace(/.*(?=<br>)/i, Beautify(Game.cookies));
|
||||
let str = l('cookies').innerHTML.replace(
|
||||
/.*(?=<br>)/i,
|
||||
Beautify(Game.cookies),
|
||||
);
|
||||
if (Game.prefs.monospace) str = `<span class="monospace">${str}</span>`;
|
||||
l('cookies').innerHTML = str;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
@@ -23,9 +24,19 @@ export default function CreateGCTimer(cookie) {
|
||||
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
||||
GCTimer.style.left = cookie.l.style.left;
|
||||
GCTimer.style.top = cookie.l.style.top;
|
||||
GCTimer.onclick = function () { cookie.pop(); };
|
||||
GCTimer.onmouseover = function () { cookie.l.style.filter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; cookie.l.style.webkitFilter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; };
|
||||
GCTimer.onmouseout = function () { cookie.l.style.filter = ''; cookie.l.style.webkitFilter = ''; };
|
||||
GCTimer.onclick = function () {
|
||||
cookie.pop();
|
||||
};
|
||||
GCTimer.onmouseover = function () {
|
||||
cookie.l.style.filter =
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
cookie.l.style.webkitFilter =
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
};
|
||||
GCTimer.onmouseout = function () {
|
||||
cookie.l.style.filter = '';
|
||||
cookie.l.style.webkitFilter = '';
|
||||
};
|
||||
|
||||
GCTimers[cookie.id] = GCTimer;
|
||||
l('shimmers').appendChild(GCTimer);
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
* @param {number} targetMagic The target magic level
|
||||
* @returns {number} count / Game.fps The time it takes to reach targetMagic
|
||||
*/
|
||||
export default function CalculateGrimoireRefillTime(currentMagic, maxMagic, targetMagic) {
|
||||
export default function CalculateGrimoireRefillTime(
|
||||
currentMagic,
|
||||
maxMagic,
|
||||
targetMagic,
|
||||
) {
|
||||
let magic = currentMagic;
|
||||
let count = 0;
|
||||
while (currentMagic < targetMagic) {
|
||||
currentMagic += Math.max(0.002, (currentMagic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||
count++;
|
||||
while (magic < targetMagic) {
|
||||
magic += Math.max(0.002, (magic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||
count += 1;
|
||||
}
|
||||
return count / Game.fps;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import {
|
||||
CacheAvgCps, CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult, CacheWrinklersFattest,
|
||||
CacheAverageCPS,
|
||||
CacheCurrWrinklerCount,
|
||||
CacheCurrWrinklerCPSMult,
|
||||
CacheWrinklersFattest,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
@@ -9,13 +12,30 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
*/
|
||||
export default function GetCPS() {
|
||||
if (CMOptions.CPSMode) {
|
||||
return CacheAvgCps;
|
||||
} if (CMOptions.CalcWrink === 0) {
|
||||
return (Game.cookiesPs * (1 - Game.cpsSucked));
|
||||
} if (CMOptions.CalcWrink === 1) {
|
||||
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - (CacheCurrWrinklerCount * 0.05)));
|
||||
} if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) {
|
||||
return Game.cookiesPs * ((CacheCurrWrinklerCPSMult * 3 / CacheCurrWrinklerCount) + (1 - (CacheCurrWrinklerCount * 0.05)));
|
||||
return CacheAverageCPS;
|
||||
}
|
||||
return Game.cookiesPs * ((CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount) + (1 - (CacheCurrWrinklerCount * 0.05)));
|
||||
if (CMOptions.CalcWrink === 0) {
|
||||
return Game.cookiesPs * (1 - Game.cpsSucked);
|
||||
}
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
(CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
if (
|
||||
CMOptions.CalcWrink === 2 &&
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
|
||||
) {
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
|
||||
(1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
(CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount +
|
||||
(1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import {
|
||||
ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorYellow,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -11,13 +16,17 @@ import {
|
||||
export default function GetLumpColor(type) {
|
||||
if (type === 0) {
|
||||
return { text: 'Normal', color: ColorGray };
|
||||
} if (type === 1) {
|
||||
}
|
||||
if (type === 1) {
|
||||
return { text: 'Bifurcated', color: ColorGreen };
|
||||
} if (type === 2) {
|
||||
}
|
||||
if (type === 2) {
|
||||
return { text: 'Golden', color: ColorYellow };
|
||||
} if (type === 3) {
|
||||
}
|
||||
if (type === 3) {
|
||||
return { text: 'Meaty', color: ColorOrange };
|
||||
} if (type === 4) {
|
||||
}
|
||||
if (type === 4) {
|
||||
return { text: 'Caramelized', color: ColorPurple };
|
||||
}
|
||||
return { text: 'Unknown Sugar Lump', color: ColorRed };
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -9,7 +12,8 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
export default function GetWrinkConfigBank() {
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
return CacheWrinklersTotal;
|
||||
} if (CMOptions.CalcWrink === 2) {
|
||||
}
|
||||
if (CMOptions.CalcWrink === 2) {
|
||||
return CacheWrinklersFattest[0];
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
|
||||
*/
|
||||
export default function PopAllNormalWrinklers() {
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
|
||||
Game.wrinklers[i].hp = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
*/
|
||||
export default function UpdateBackground() {
|
||||
Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth;
|
||||
Game.Background.canvas.height = Game.Background.canvas.parentNode.offsetHeight;
|
||||
Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.parentNode.offsetWidth;
|
||||
Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight;
|
||||
Game.Background.canvas.height =
|
||||
Game.Background.canvas.parentNode.offsetHeight;
|
||||
Game.LeftBackground.canvas.width =
|
||||
Game.LeftBackground.canvas.parentNode.offsetWidth;
|
||||
Game.LeftBackground.canvas.height =
|
||||
Game.LeftBackground.canvas.parentNode.offsetHeight;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import {
|
||||
ColorBackPre, ColorBorderPre, Colors, ColorTextPre,
|
||||
ColorBackPre,
|
||||
ColorBorderPre,
|
||||
Colors,
|
||||
ColorTextPre,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -11,13 +14,19 @@ import {
|
||||
export default function UpdateColors() {
|
||||
let str = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorTextPre}${Colors[i]} { color: ${CMOptions.Colors[Colors[i]]}; }\n`;
|
||||
str += `.${ColorTextPre}${Colors[i]} { color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBackPre}${Colors[i]} { background-color: ${CMOptions.Colors[Colors[i]]}; }\n`;
|
||||
str += `.${ColorBackPre}${Colors[i]} { background-color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBorderPre}${Colors[i]} { border: 1px solid ${CMOptions.Colors[Colors[i]]}; }\n`;
|
||||
str += `.${ColorBorderPre}${Colors[i]} { border: 1px solid ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
UpdateBuildings(); // Class has been already set
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
/** Functions related to the Bottom Bar */
|
||||
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata';
|
||||
import { Beautify, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorBlue, ColorTextPre, ColorYellow, LastTargetBotBar,
|
||||
ColorBlue,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
LastTargetBotBar,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
|
||||
@@ -25,7 +36,8 @@ export function CreateBotBar() {
|
||||
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
|
||||
BotBar.style.borderTop = '1px solid black';
|
||||
BotBar.style.overflow = 'auto';
|
||||
BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
|
||||
BotBar.style.textShadow =
|
||||
'-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
|
||||
|
||||
const table = BotBar.appendChild(document.createElement('table'));
|
||||
table.style.width = '100%';
|
||||
@@ -52,9 +64,9 @@ export function CreateBotBar() {
|
||||
|
||||
l('wrapper').appendChild(BotBar);
|
||||
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CreateBotBarBuildingColumn(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +75,7 @@ export function CreateBotBar() {
|
||||
export function UpdateBotBar() {
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
let count = 0;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBotBar = target;
|
||||
@@ -73,16 +85,41 @@ export function UpdateBotBar() {
|
||||
if (target === 1) target = CacheObjects1;
|
||||
if (target === 10) target = CacheObjects10;
|
||||
if (target === 100) target = CacheObjects100;
|
||||
count++;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className = ColorTextPre + target[i].color;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(target[i].pp, 2);
|
||||
const timeColor = GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className = ColorTextPre + timeColor.color;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text;
|
||||
}
|
||||
count += 1;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
|
||||
count
|
||||
].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[
|
||||
count
|
||||
].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + target[i].color;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
else PPString = Beautify(Math.round(target[i].pp), 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].textContent = PPString;
|
||||
const timeColor = GetTimeColor(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + timeColor.color;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < Game.Objects[i].bulkPrice
|
||||
) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = timeColor.text;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,14 +76,22 @@ export function CreateBotBarBuildingColumn(buildingName) {
|
||||
|
||||
const i = buildingName;
|
||||
const header = type.appendChild(document.createElement('td'));
|
||||
header.appendChild(document.createTextNode(`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`));
|
||||
header.appendChild(
|
||||
document.createTextNode(
|
||||
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
|
||||
),
|
||||
);
|
||||
|
||||
const span = header.appendChild(document.createElement('span'));
|
||||
span.className = ColorTextPre + ColorBlue;
|
||||
|
||||
header.appendChild(document.createTextNode(')'));
|
||||
type.lastChild.style.paddingLeft = '8px';
|
||||
bonus.appendChild(document.createElement('td'));
|
||||
bonus.lastChild.style.paddingLeft = '8px';
|
||||
pp.appendChild(document.createElement('td'));
|
||||
pp.lastChild.style.paddingLeft = '8px';
|
||||
time.appendChild(document.createElement('td'));
|
||||
time.lastChild.style.paddingLeft = '2px';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
BuffColors,
|
||||
ColorBackPre, ColorGray, ColorOrange, ColorPurple, LastNumberOfTimers,
|
||||
ColorBackPre,
|
||||
ColorGray,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
LastNumberOfTimers,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateTimer } from './CreateDOMElements';
|
||||
|
||||
@@ -22,16 +26,21 @@ export function CreateTimerBar() {
|
||||
TimerBar.style.backgroundColor = 'black';
|
||||
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC',
|
||||
'Next Cookie',
|
||||
[{ id: 'CMTimerBarGCMinBar', color: ColorGray }, { id: 'CMTimerBarGCBar', color: ColorPurple }]);
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColorPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen',
|
||||
'Next Reindeer',
|
||||
[{ id: 'CMTimerBarRenMinBar', color: ColorGray }, { id: 'CMTimerBarRenBar', color: ColorOrange }]);
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColorOrange },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
TimerBarBuffTimers.id = 'CMTimerBarBuffTimers';
|
||||
TimerBar.appendChild(TimerBarBuffTimers);
|
||||
|
||||
l('wrapper').appendChild(TimerBar);
|
||||
}
|
||||
@@ -48,45 +57,114 @@ export function UpdateTimerBar() {
|
||||
let numberOfTimers = 0;
|
||||
|
||||
// Regulates visibility of Golden Cookie timer
|
||||
if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) {
|
||||
if (
|
||||
Game.shimmerTypes.golden.spawned === 0 &&
|
||||
!Game.Has('Golden switch [off]')
|
||||
) {
|
||||
l('CMTimerBarGC').style.display = '';
|
||||
l('CMTimerBarGCMinBar').style.width = `${Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil((Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
l('CMTimerBarGCMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCMinBar').textContent = '';
|
||||
if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) {
|
||||
if (
|
||||
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
|
||||
) {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
|
||||
} else {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
|
||||
}
|
||||
l('CMTimerBarGCBar').style.width = `${Math.round(Math.min(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarGCBar').textContent = Math.ceil(Math.min(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
l('CMTimerBarGCBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCBar').textContent = '';
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil((Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
numberOfTimers++;
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
|
||||
// Regulates visibility of Reindeer timer
|
||||
if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) {
|
||||
if (
|
||||
Game.season === 'christmas' &&
|
||||
Game.shimmerTypes.reindeer.spawned === 0
|
||||
) {
|
||||
l('CMTimerBarRen').style.display = '';
|
||||
l('CMTimerBarRenMinBar').style.width = `${Math.round(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarRenMinBar').textContent = Math.ceil((Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
l('CMTimerBarRenMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.minTime -
|
||||
Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenMinBar').textContent = '';
|
||||
l('CMTimerBarRenBar').style.width = `${Math.round(Math.min(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarRenBar').textContent = Math.ceil(Math.min(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
l('CMTimerBarRenBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenBar').textContent = '';
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil((Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
numberOfTimers++;
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
}
|
||||
|
||||
// On every frame all buff-timers are deleted and re-created
|
||||
const BuffTimerBars = {};
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
l('CMTimerBarBuffTimers').innerHTML = '';
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (Game.buffs[i]) {
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [{ id: `${Game.buffs[i].name}Bar` }]);
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [
|
||||
{ id: `${Game.buffs[i].name}Bar` },
|
||||
]);
|
||||
timer.style.display = '';
|
||||
let classColor = '';
|
||||
// Gives specific timers specific colors
|
||||
@@ -95,17 +173,27 @@ export function UpdateTimerBar() {
|
||||
} else classColor = ColorPurple;
|
||||
timer.lastChild.children[1].className = ColorBackPre + classColor;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2) timer.lastChild.children[1].textContent = `${Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime))}%`;
|
||||
if (CMOptions.TimerBarOverlay === 2)
|
||||
timer.lastChild.children[1].textContent = `${Math.round(
|
||||
100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
|
||||
)}%`;
|
||||
else timer.lastChild.children[1].textContent = '';
|
||||
timer.lastChild.children[1].style.width = `${Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime)}px`;
|
||||
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
|
||||
numberOfTimers++;
|
||||
timer.lastChild.children[1].style.width = `${Math.round(
|
||||
(Game.buffs[i].time *
|
||||
(maxWidthOneBar -
|
||||
Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
|
||||
Game.buffs[i].maxTime,
|
||||
)}px`;
|
||||
timer.lastChild.children[2].textContent = Math.ceil(
|
||||
Game.buffs[i].time / Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
BuffTimerBars[Game.buffs[i].name] = timer;
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(BuffTimerBars)) {
|
||||
l('CMTimerBar').appendChild(BuffTimerBars[i]);
|
||||
}
|
||||
});
|
||||
Object.keys(BuffTimerBars).forEach((i) => {
|
||||
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
|
||||
});
|
||||
|
||||
if (numberOfTimers !== 0) {
|
||||
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
|
||||
|
||||
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This function creates two objects at the top of the right column that allowing hiding the upgrade and building section
|
||||
*/
|
||||
export default function CreateSectionHideButtons() {
|
||||
const div = document.createElement('div');
|
||||
div.id = 'CMSectionHidButtons';
|
||||
div.style.textAlign = 'center';
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
if (l('upgrades').style.display === 'flex') {
|
||||
l('upgrades').style.display = 'none';
|
||||
l('toggleUpgrades').style.display = 'none';
|
||||
l('techUpgrades').style.display = 'none';
|
||||
l('vaultUpgrades').style.display = 'none';
|
||||
} else {
|
||||
l('upgrades').style.display = 'flex';
|
||||
if (l('toggleUpgrades').children.length !== 0)
|
||||
l('toggleUpgrades').style.display = 'block';
|
||||
if (l('techUpgrades').children.length !== 0)
|
||||
l('techUpgrades').style.display = 'block';
|
||||
if (l('vaultUpgrades').children.length !== 0)
|
||||
l('vaultUpgrades').style.display = 'block';
|
||||
}
|
||||
};
|
||||
a.textContent = 'Hide/Show Upgrades';
|
||||
div.appendChild(a);
|
||||
const b = document.createElement('a');
|
||||
b.className = 'option';
|
||||
b.onclick = function () {
|
||||
if (l('products').style.display === 'grid')
|
||||
l('products').style.display = 'none';
|
||||
else l('products').style.display = 'grid';
|
||||
};
|
||||
b.textContent = 'Hide/Show Buildings';
|
||||
div.appendChild(b);
|
||||
l('store').insertBefore(div, l('store').childNodes[2]);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { CreateTooltip } from '../Tooltips/Tooltip';
|
||||
|
||||
/**
|
||||
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
||||
@@ -9,12 +10,45 @@ export default function CreateWrinklerButtons() {
|
||||
popAllA.id = 'PopAllNormalWrinklerButton';
|
||||
popAllA.textContent = 'Pop All Normal';
|
||||
popAllA.className = 'option';
|
||||
popAllA.onclick = function () { PopAllNormalWrinklers(); };
|
||||
popAllA.onclick = function () {
|
||||
PopAllNormalWrinklers();
|
||||
};
|
||||
popAllA.onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
popAllA.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('wb', 'PopAll');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('sectionLeftExtra').children[0].append(popAllA);
|
||||
const popFattestA = document.createElement('a');
|
||||
popFattestA.id = 'PopFattestWrinklerButton';
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function () { if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0; };
|
||||
popFattestA.onclick = function () {
|
||||
if (CacheWrinklersFattest[1] !== null)
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
||||
};
|
||||
popFattestA.onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
popFattestA.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('wb', 'PopFattest');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('sectionLeftExtra').children[0].append(popFattestA);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import * as GameData from '../../Data/Gamedata';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
import {
|
||||
CacheAverageClicks, CacheCentEgg, CacheLastChoEgg, CacheSeaSpec, CacheWrinklersFattest, CacheWrinklersNormal, CacheWrinklersTotal,
|
||||
CacheAverageClicks,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { ClickTimes, CookieTimes } from '../VariablesAndData';
|
||||
@@ -57,113 +60,113 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Wrinklers', 'Wrink'));
|
||||
if (CMOptions.Header.Wrink) {
|
||||
const popAllFrag = document.createDocumentFragment();
|
||||
popAllFrag.appendChild(document.createTextNode(`${Beautify(CacheWrinklersTotal)} / ${Beautify(CacheWrinklersNormal)} `));
|
||||
popAllFrag.appendChild(
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheWrinklersTotal)} / ${Beautify(
|
||||
CacheWrinklersNormal,
|
||||
)} `,
|
||||
),
|
||||
);
|
||||
const popAllA = document.createElement('a');
|
||||
popAllA.textContent = 'Pop All Normal';
|
||||
popAllA.className = 'option';
|
||||
popAllA.onclick = function () { PopAllNormalWrinklers(); };
|
||||
popAllA.onclick = function () {
|
||||
PopAllNormalWrinklers();
|
||||
};
|
||||
popAllFrag.appendChild(popAllA);
|
||||
stats.appendChild(CreateElements.StatsListing('basic', 'Rewards of Popping (All/Normal)', popAllFrag));
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Rewards of Popping (All/Normal)',
|
||||
popAllFrag,
|
||||
),
|
||||
);
|
||||
const popFattestFrag = document.createDocumentFragment();
|
||||
popFattestFrag.appendChild(document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `));
|
||||
popFattestFrag.appendChild(
|
||||
document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `),
|
||||
);
|
||||
const popFattestA = document.createElement('a');
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function () { if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0; };
|
||||
popFattestA.onclick = function () {
|
||||
if (CacheWrinklersFattest[1] !== null)
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
||||
};
|
||||
popFattestFrag.appendChild(popFattestA);
|
||||
stats.appendChild(CreateElements.StatsListing('basic', `Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${CacheWrinklersFattest[1] !== null ? CacheWrinklersFattest[1] : 'None'})`, popFattestFrag));
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${
|
||||
CacheWrinklersFattest[1] !== null
|
||||
? CacheWrinklersFattest[1]
|
||||
: 'None'
|
||||
})`,
|
||||
popFattestFrag,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let specDisp = false;
|
||||
const missingHalloweenCookies = [];
|
||||
for (const i of Object.keys(GameData.HalloCookies)) {
|
||||
if (!Game.Has(GameData.HalloCookies[i])) {
|
||||
missingHalloweenCookies.push(GameData.HalloCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const missingChristmasCookies = [];
|
||||
for (const i of Object.keys(GameData.ChristCookies)) {
|
||||
if (!Game.Has(GameData.ChristCookies[i])) {
|
||||
missingChristmasCookies.push(GameData.ChristCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const missingValentineCookies = [];
|
||||
for (const i of Object.keys(GameData.ValCookies)) {
|
||||
if (!Game.Has(GameData.ValCookies[i])) {
|
||||
missingValentineCookies.push(GameData.ValCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const missingNormalEggs = [];
|
||||
for (const i of Object.keys(Game.eggDrops)) {
|
||||
if (!Game.HasUnlocked(Game.eggDrops[i])) {
|
||||
missingNormalEggs.push(Game.eggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const missingRareEggs = [];
|
||||
for (const i of Object.keys(Game.rareEggDrops)) {
|
||||
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
|
||||
missingRareEggs.push(Game.rareEggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const missingPlantDrops = [];
|
||||
for (const i of Object.keys(GameData.PlantDrops)) {
|
||||
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
|
||||
missingPlantDrops.push(GameData.PlantDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
const choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
|
||||
const centEgg = Game.Has('Century egg');
|
||||
|
||||
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Season Specials', 'Sea'));
|
||||
if (CMOptions.Header.Sea) {
|
||||
if (missingHalloweenCookies.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Halloween Cookies Left to Buy', CreateElements.StatsMissDisp(missingHalloweenCookies)));
|
||||
if (missingChristmasCookies.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Christmas Cookies Left to Buy', CreateElements.StatsMissDisp(missingChristmasCookies)));
|
||||
if (missingValentineCookies.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Valentine Cookies Left to Buy', CreateElements.StatsMissDisp(missingValentineCookies)));
|
||||
if (missingNormalEggs.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Normal Easter Eggs Left to Unlock', CreateElements.StatsMissDisp(missingNormalEggs)));
|
||||
if (missingRareEggs.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Rare Easter Eggs Left to Unlock', CreateElements.StatsMissDisp(missingRareEggs)));
|
||||
if (missingPlantDrops.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Rare Plant Drops Left to Unlock', CreateElements.StatsMissDisp(missingPlantDrops)));
|
||||
|
||||
if (Game.season === 'christmas') stats.appendChild(CreateElements.StatsListing('basic', 'Reindeer Reward', document.createTextNode(Beautify(CacheSeaSpec))));
|
||||
if (choEgg) {
|
||||
stats.appendChild(CreateElements.StatsListing('withTooltip', 'Chocolate Egg Cookies', document.createTextNode(Beautify(CacheLastChoEgg)), 'ChoEggTooltipPlaceholder'));
|
||||
}
|
||||
if (centEgg) {
|
||||
stats.appendChild(CreateElements.StatsListing('basic', 'Century Egg Multiplier', document.createTextNode(`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stats.appendChild(CreateSections.SeasonSection());
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc'));
|
||||
if (CMOptions.Header.Misc) {
|
||||
stats.appendChild(CreateElements.StatsListing('basic',
|
||||
`Average Cookies Per Second (Past ${CookieTimes[CMOptions.AvgCPSHist] < 60 ? (`${CookieTimes[CMOptions.AvgCPSHist]} seconds`) : ((CookieTimes[CMOptions.AvgCPSHist] / 60) + (CMOptions.AvgCPSHist === 3 ? ' minute' : ' minutes'))})`,
|
||||
document.createTextNode(Beautify(GetCPS(), 3))));
|
||||
stats.appendChild(CreateElements.StatsListing('basic', `Average Cookie Clicks Per Second (Past ${ClickTimes[CMOptions.AvgClicksHist]}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`, document.createTextNode(Beautify(CacheAverageClicks, 1))));
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookies Per Second (Past ${
|
||||
CookieTimes[CMOptions.AvgCPSHist] < 60
|
||||
? `${CookieTimes[CMOptions.AvgCPSHist]} seconds`
|
||||
: CookieTimes[CMOptions.AvgCPSHist] / 60 +
|
||||
(CMOptions.AvgCPSHist === 3 ? ' minute' : ' minutes')
|
||||
})`,
|
||||
document.createTextNode(Beautify(GetCPS(), 3)),
|
||||
),
|
||||
);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookie Clicks Per Second (Past ${
|
||||
ClickTimes[CMOptions.AvgClicksHist]
|
||||
}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`,
|
||||
document.createTextNode(Beautify(CacheAverageClicks, 1)),
|
||||
),
|
||||
);
|
||||
if (Game.Has('Fortune cookies')) {
|
||||
const fortunes = [];
|
||||
for (const i of Object.keys(GameData.Fortunes)) {
|
||||
Object.keys(GameData.Fortunes).forEach((i) => {
|
||||
if (!Game.Has(GameData.Fortunes[i])) {
|
||||
fortunes.push(GameData.Fortunes[i]);
|
||||
}
|
||||
}
|
||||
if (fortunes.length !== 0) stats.appendChild(CreateElements.StatsListing('basic', 'Fortune Upgrades Left to Buy', CreateElements.StatsMissDisp(fortunes)));
|
||||
});
|
||||
if (fortunes.length !== 0)
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Fortune Upgrades Left to Buy',
|
||||
CreateElements.StatsMissDisp(fortunes),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (CMOptions.ShowMissedGC) {
|
||||
stats.appendChild(CreateElements.StatsListing('basic', 'Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks))));
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Missed Golden Cookies',
|
||||
document.createTextNode(Beautify(Game.missedGoldenClicks)),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (Game.prefs.autosave) {
|
||||
const timer = document.createElement('span');
|
||||
timer.id = 'CMStatsAutosaveTimer';
|
||||
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.OnAscend ? 0 : (Game.T % (Game.fps * 60))), 4);
|
||||
stats.appendChild(CreateElements.StatsListing('basic', 'Time till autosave', timer));
|
||||
timer.innerText = Game.sayTime(
|
||||
Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60)),
|
||||
4,
|
||||
);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing('basic', 'Time till autosave', timer),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ToggleHeader } from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { TooltipText } from '../VariablesAndData';
|
||||
import { SimpleTooltipElements } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the stats page
|
||||
@@ -31,7 +31,10 @@ export function StatsHeader(text, config) {
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () { ToggleHeader(config); Game.UpdateMenu(); };
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
@@ -57,8 +60,15 @@ export function StatsListing(type, name, text, placeholder) {
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
|
||||
const tooltip = document.createElement('span');
|
||||
tooltip.onmouseout = function () { Game.tooltip.hide(); };
|
||||
tooltip.onmouseover = function () { Game.tooltip.draw(this, escape(TooltipText[placeholder].innerHTML)); };
|
||||
tooltip.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
tooltip.onmouseover = function () {
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
escape(SimpleTooltipElements[placeholder].innerHTML),
|
||||
);
|
||||
};
|
||||
tooltip.style.cursor = 'default';
|
||||
tooltip.style.display = 'inline-block';
|
||||
tooltip.style.height = '10px';
|
||||
@@ -86,7 +96,9 @@ export function StatsMissDisp(theMissDisp) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(document.createTextNode(`${theMissDisp.length} `));
|
||||
const span = document.createElement('span');
|
||||
span.onmouseout = function () { Game.tooltip.hide(); };
|
||||
span.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
const placeholder = document.createElement('div');
|
||||
const missing = document.createElement('div');
|
||||
missing.style.minWidth = '140px';
|
||||
@@ -97,14 +109,16 @@ export function StatsMissDisp(theMissDisp) {
|
||||
title.style.textAlign = 'center';
|
||||
title.textContent = 'Missing';
|
||||
missing.appendChild(title);
|
||||
for (const i of Object.keys(theMissDisp)) {
|
||||
Object.keys(theMissDisp).forEach((i) => {
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'center';
|
||||
div.appendChild(document.createTextNode(theMissDisp[i]));
|
||||
missing.appendChild(div);
|
||||
}
|
||||
});
|
||||
placeholder.appendChild(missing);
|
||||
span.onmouseover = function () { Game.tooltip.draw(this, escape(placeholder.innerHTML)); };
|
||||
span.onmouseover = function () {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
};
|
||||
span.style.cursor = 'default';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '10px';
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
/** Functions related to displaying the missing upgrades in the Statistics page */
|
||||
|
||||
import { CacheMissingUpgrades, CacheMissingUpgradesCookies, CacheMissingUpgradesPrestige } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
CacheMissingUpgradesPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
||||
*/
|
||||
export function AddMissingUpgrades() {
|
||||
for (const menuSection of (l('menu').children)) {
|
||||
l('menu').childNodes.forEach((menuSection) => {
|
||||
if (menuSection.children[0]) {
|
||||
if (menuSection.children[0].innerHTML === 'Prestige' && CacheMissingUpgradesPrestige) {
|
||||
const prestigeUpgradesMissing = CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || []).length / 2;
|
||||
if (
|
||||
menuSection.children[0].innerHTML === 'Prestige' &&
|
||||
CacheMissingUpgradesPrestige
|
||||
) {
|
||||
const prestigeUpgradesMissing =
|
||||
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || [])
|
||||
.length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesPrestigeTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${Game.PrestigeUpgrades.length} (${Math.floor((prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100)}%)`;
|
||||
titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${
|
||||
Game.PrestigeUpgrades.length
|
||||
} (${Math.floor(
|
||||
(prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.appendChild(title);
|
||||
const upgrades = document.createElement('div');
|
||||
@@ -23,26 +36,43 @@ export function AddMissingUpgrades() {
|
||||
menuSection.appendChild(upgrades);
|
||||
} else if (menuSection.children[0].innerHTML === 'Upgrades') {
|
||||
if (CacheMissingUpgrades) {
|
||||
const normalUpgradesMissing = CacheMissingUpgrades.match(new RegExp('div', 'g') || []).length / 2;
|
||||
const normalUpgradesMissing =
|
||||
CacheMissingUpgrades.match(new RegExp('div', 'g') || []).length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing normal upgrades:</b> ${normalUpgradesMissing}/${Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length} (${Math.floor((normalUpgradesMissing / (Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length)) * 100)}%)`;
|
||||
titlefrag.innerHTML = `<b>Missing normal upgrades:</b> ${normalUpgradesMissing}/${
|
||||
Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length
|
||||
} (${Math.floor(
|
||||
(normalUpgradesMissing /
|
||||
(Game.UpgradesByPool[''].length +
|
||||
Game.UpgradesByPool.tech.length)) *
|
||||
100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.insertBefore(title, menuSection.childNodes[3]);
|
||||
const upgrades = document.createElement('div');
|
||||
upgrades.className = 'listing crateBox';
|
||||
upgrades.innerHTML = CacheMissingUpgrades;
|
||||
menuSection.insertBefore(upgrades, document.getElementById('CMMissingUpgradesTitle').nextSibling);
|
||||
menuSection.insertBefore(
|
||||
upgrades,
|
||||
document.getElementById('CMMissingUpgradesTitle').nextSibling,
|
||||
);
|
||||
}
|
||||
if (CacheMissingUpgradesCookies) {
|
||||
const cookieUpgradesMissing = CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || []).length / 2;
|
||||
const cookieUpgradesMissing =
|
||||
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || [])
|
||||
.length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesCookiesTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${Game.UpgradesByPool.cookie.length} (${Math.floor((cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100)}%)`;
|
||||
titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${
|
||||
Game.UpgradesByPool.cookie.length
|
||||
} (${Math.floor(
|
||||
(cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.appendChild(title);
|
||||
const upgrades = document.createElement('div');
|
||||
@@ -52,7 +82,7 @@ export function AddMissingUpgrades() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,11 +99,13 @@ export function crateMissing(me) {
|
||||
if (!Game.prefs.crates) noFrame = 1;
|
||||
if (noFrame) classes += ' noFrame';
|
||||
|
||||
let icon = me.icon;
|
||||
let { icon } = me;
|
||||
if (me.iconFunction) icon = me.iconFunction();
|
||||
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
|
||||
return `<div class="${classes}"
|
||||
${Game.getDynamicTooltip(tooltip, 'top', true)}
|
||||
style = "${(`${icon[2] ? `background-image: url(${icon[2]});` : ''}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`)};">
|
||||
style = "${`${
|
||||
icon[2] ? `background-image: url(${icon[2]});` : ''
|
||||
}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`};">
|
||||
</div>`;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/** Functions to create the individual sections of the Statistics page */
|
||||
|
||||
import * as GameData from '../../Data/Gamedata';
|
||||
import { MaxChainCookieReward } from '../../Cache/Stats/ChainCookies';
|
||||
import {
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheCentEgg,
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
@@ -20,16 +22,31 @@ import {
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheHCPerSecond, CacheLastChoEgg, CacheLucky, CacheLuckyFrenzy, CacheLuckyReward, CacheLuckyRewardFrenzy, CacheLuckyWrathReward, CacheLuckyWrathRewardFrenzy, CacheNoGoldSwitchCookiesPS, CacheRealCookiesEarned, CacheWrathCookiesMult, CacheWrinklersTotal,
|
||||
CacheHCPerSecond,
|
||||
CacheLastChoEgg,
|
||||
CacheLucky,
|
||||
CacheLuckyFrenzy,
|
||||
CacheLuckyReward,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheRealCookiesEarned,
|
||||
CacheSeaSpec,
|
||||
CacheWrathCookiesMult,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import ResetBonus from '../../Sim/SimulationEvents/ResetAscension';
|
||||
import { Beautify, FormatTime } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGreen, ColorRed, ColorTextPre } from '../VariablesAndData';
|
||||
import { StatsListing } from './CreateDOMElements';
|
||||
import { StatsListing, StatsHeader, StatsMissDisp } from './CreateDOMElements';
|
||||
|
||||
/**
|
||||
* This function creates the "Lucky" section of the stats page
|
||||
@@ -37,13 +54,21 @@ import { StatsListing } from './CreateDOMElements';
|
||||
*/
|
||||
export function LuckySection() {
|
||||
// This sets which tooltip to display for certain stats
|
||||
const goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder';
|
||||
const goldCookTooltip = Game.auraMult("Dragon's Fortune")
|
||||
? 'GoldCookDragonsFortuneTooltipPlaceholder'
|
||||
: 'GoldCookTooltipPlaceholder';
|
||||
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsLuckySection';
|
||||
|
||||
const luckyColor = ((Game.cookies + GetWrinkConfigBank()) < CacheLucky) ? ColorRed : ColorGreen;
|
||||
const luckyTime = ((Game.cookies + GetWrinkConfigBank()) < CacheLucky) ? FormatTime((CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const luckyColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColorRed : ColorGreen;
|
||||
const luckyTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky
|
||||
? FormatTime(
|
||||
(CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const luckyReqFrag = document.createDocumentFragment();
|
||||
const luckyReqSpan = document.createElement('span');
|
||||
luckyReqSpan.style.fontWeight = 'bold';
|
||||
@@ -55,10 +80,25 @@ export function LuckySection() {
|
||||
luckyReqSmall.textContent = ` (${luckyTime})`;
|
||||
luckyReqFrag.appendChild(luckyReqSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Lucky!" Cookies Required', luckyReqFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required',
|
||||
luckyReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyColorFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheLuckyFrenzy) ? ColorRed : ColorGreen;
|
||||
const luckyTimeFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheLuckyFrenzy) ? FormatTime((CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const luckyColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const luckyTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? FormatTime(
|
||||
(CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const luckyReqFrenFrag = document.createDocumentFragment();
|
||||
const luckyReqFrenSpan = document.createElement('span');
|
||||
luckyReqFrenSpan.style.fontWeight = 'bold';
|
||||
@@ -70,28 +110,66 @@ export function LuckySection() {
|
||||
luckyReqFrenSmall.textContent = ` (${luckyTimeFrenzy})`;
|
||||
luckyReqFrenFrag.appendChild(luckyReqFrenSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Lucky!" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required (Frenzy)',
|
||||
luckyReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckySplit = CacheLuckyReward !== CacheLuckyWrathReward;
|
||||
|
||||
const luckyRewardMaxSpan = document.createElement('span');
|
||||
luckyRewardMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardMaxSpan.className = ColorTextPre + CacheLuckyReward;
|
||||
luckyRewardMaxSpan.textContent = Beautify(CacheLuckyReward) + (luckySplit ? (` / ${Beautify(CacheLuckyWrathReward)}`) : '');
|
||||
section.appendChild(StatsListing('withTooltip', `"Lucky!" Reward (MAX)${luckySplit ? ' (Golden / Wrath)' : ''}`, luckyRewardMaxSpan, goldCookTooltip));
|
||||
luckyRewardMaxSpan.textContent =
|
||||
Beautify(CacheLuckyReward) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyRewardMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyRewardFrenzyMaxSpan = document.createElement('span');
|
||||
luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardFrenzyMaxSpan.className = ColorTextPre + luckyRewardFrenzyMaxSpan;
|
||||
luckyRewardFrenzyMaxSpan.textContent = Beautify(CacheLuckyRewardFrenzy) + (luckySplit ? (` / ${Beautify(CacheLuckyWrathRewardFrenzy)}`) : '');
|
||||
section.appendChild(StatsListing('withTooltip', `"Lucky!" Reward (MAX) (Frenzy)${luckySplit ? ' (Golden / Wrath)' : ''}`, luckyRewardFrenzyMaxSpan, goldCookTooltip));
|
||||
luckyRewardFrenzyMaxSpan.textContent =
|
||||
Beautify(CacheLuckyRewardFrenzy) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathRewardFrenzy)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX) (Frenzy)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyRewardFrenzyMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyCurBase = Math.min((Game.cookies + GetWrinkConfigBank()) * 0.15, CacheNoGoldSwitchCookiesPS * CacheDragonsFortuneMultAdjustment * 60 * 15) + 13;
|
||||
const luckyCurBase =
|
||||
Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * CacheDragonsFortuneMultAdjustment * 60 * 15,
|
||||
) + 13;
|
||||
const luckyCurSpan = document.createElement('span');
|
||||
luckyCurSpan.style.fontWeight = 'bold';
|
||||
luckyCurSpan.className = ColorTextPre + luckyCurSpan;
|
||||
luckyCurSpan.textContent = Beautify(CacheGoldenCookiesMult * luckyCurBase) + (luckySplit ? (` / ${Beautify(CacheWrathCookiesMult * luckyCurBase)}`) : '');
|
||||
section.appendChild(StatsListing('withTooltip', `"Lucky!" Reward (CUR)${luckySplit ? ' (Golden / Wrath)' : ''}`, luckyCurSpan, goldCookTooltip));
|
||||
luckyCurSpan.textContent =
|
||||
Beautify(CacheGoldenCookiesMult * luckyCurBase) +
|
||||
(luckySplit ? ` / ${Beautify(CacheWrathCookiesMult * luckyCurBase)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (CUR)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyCurSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -101,13 +179,24 @@ export function LuckySection() {
|
||||
*/
|
||||
export function ChainSection() {
|
||||
// This sets which tooltip to display for certain stats
|
||||
const goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder';
|
||||
const goldCookTooltip = Game.auraMult("Dragon's Fortune")
|
||||
? 'GoldCookDragonsFortuneTooltipPlaceholder'
|
||||
: 'GoldCookTooltipPlaceholder';
|
||||
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsChainSection';
|
||||
|
||||
const chainColor = ((Game.cookies + GetWrinkConfigBank()) < CacheChainRequired) ? ColorRed : ColorGreen;
|
||||
const chainTime = ((Game.cookies + GetWrinkConfigBank()) < CacheChainRequired) ? FormatTime((CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const chainColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? FormatTime(
|
||||
(CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainReqFrag = document.createDocumentFragment();
|
||||
const chainReqSpan = document.createElement('span');
|
||||
chainReqSpan.style.fontWeight = 'bold';
|
||||
@@ -119,10 +208,26 @@ export function ChainSection() {
|
||||
chainReqSmall.textContent = ` (${chainTime})`;
|
||||
chainReqFrag.appendChild(chainReqSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Cookies Required', chainReqFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required',
|
||||
chainReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColor = ((Game.cookies + GetWrinkConfigBank()) < CacheChainWrathRequired) ? ColorRed : ColorGreen;
|
||||
const chainWrathTime = ((Game.cookies + GetWrinkConfigBank()) < CacheChainWrathRequired) ? FormatTime((CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const chainWrathColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainWrathTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? FormatTime(
|
||||
(CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainWrathReqFrag = document.createDocumentFragment();
|
||||
const chainWrathReqSpan = document.createElement('span');
|
||||
chainWrathReqSpan.style.fontWeight = 'bold';
|
||||
@@ -134,10 +239,26 @@ export function ChainSection() {
|
||||
chainWrathReqSmall.textContent = ` (${chainWrathTime})`;
|
||||
chainWrathReqFrag.appendChild(chainWrathReqSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Wrath)',
|
||||
chainWrathReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainColorFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheChainFrenzyRequired) ? ColorRed : ColorGreen;
|
||||
const chainTimeFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheChainFrenzyRequired) ? FormatTime((CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const chainColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? FormatTime(
|
||||
(CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainReqFrenFrag = document.createDocumentFragment();
|
||||
const chainReqFrenSpan = document.createElement('span');
|
||||
chainReqFrenSpan.style.fontWeight = 'bold';
|
||||
@@ -149,10 +270,27 @@ export function ChainSection() {
|
||||
chainReqFrenSmall.textContent = ` (${chainTimeFrenzy})`;
|
||||
chainReqFrenFrag.appendChild(chainReqFrenSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy)',
|
||||
chainReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColorFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheChainFrenzyWrathRequired) ? ColorRed : ColorGreen;
|
||||
const chainWrathTimeFrenzy = ((Game.cookies + GetWrinkConfigBank()) < CacheChainFrenzyWrathRequired) ? FormatTime((CacheChainFrenzyWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const chainWrathColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainWrathTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? FormatTime(
|
||||
(CacheChainFrenzyWrathRequired -
|
||||
(Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainWrathReqFrenFrag = document.createDocumentFragment();
|
||||
const chainWrathReqFrenSpan = document.createElement('span');
|
||||
chainWrathReqFrenSpan.style.fontWeight = 'bold';
|
||||
@@ -164,19 +302,90 @@ export function ChainSection() {
|
||||
chainWrathReqFrenSmall.textContent = ` (${chainWrathTimeFrenzy})`;
|
||||
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy) (Wrath)',
|
||||
chainWrathReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(`${Beautify(CacheChainMaxReward[0])} / ${Beautify(CacheChainWrathMaxReward[0])}`), goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainMaxReward[0])} / ${Beautify(
|
||||
CacheChainWrathMaxReward[0],
|
||||
)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(CacheChainFrenzyMaxReward[0])}`)), goldCookTooltip));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(
|
||||
CacheChainFrenzyMaxReward[0],
|
||||
)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainCurMax = Math.min(Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment, Game.cookies * 0.5);
|
||||
const chainCur = MaxChainCookieReward(7, chainCurMax, CacheGoldenCookiesMult)[0];
|
||||
const chainCurWrath = MaxChainCookieReward(6, chainCurMax, CacheWrathCookiesMult)[0];
|
||||
section.appendChild(StatsListing('withTooltip', '"Chain" Reward (CUR) (Golden / Wrath)', document.createTextNode((`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`)), goldCookTooltip));
|
||||
const chainCurMax = Math.min(
|
||||
Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment,
|
||||
Game.cookies * 0.5,
|
||||
);
|
||||
const chainCur = MaxChainCookieReward(
|
||||
7,
|
||||
chainCurMax,
|
||||
CacheGoldenCookiesMult,
|
||||
)[0];
|
||||
const chainCurWrath = MaxChainCookieReward(
|
||||
6,
|
||||
chainCurMax,
|
||||
CacheWrathCookiesMult,
|
||||
)[0];
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (CUR) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(StatsListing('withTooltip', 'CPS Needed For Next Level (G / W)', document.createTextNode((`${Beautify(CacheChainRequiredNext)} / ${Beautify(CacheChainWrathRequiredNext)}`)), 'ChainNextLevelPlaceholder'));
|
||||
section.appendChild(StatsListing('withTooltip', 'CPS Needed For Next Level (Frenzy) (G / W)', document.createTextNode((`${Beautify(CacheChainFrenzyRequiredNext)} / ${Beautify(CacheChainFrenzyWrathRequiredNext)}`)), 'ChainNextLevelPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (G / W)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainRequiredNext)} / ${Beautify(
|
||||
CacheChainWrathRequiredNext,
|
||||
)}`,
|
||||
),
|
||||
'ChainNextLevelPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (Frenzy) (G / W)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyRequiredNext)} / ${Beautify(
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
)}`,
|
||||
),
|
||||
'ChainNextLevelPlaceholder',
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -188,8 +397,14 @@ export function SpellsSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsSpellsSection';
|
||||
|
||||
const conjureColor = ((Game.cookies + GetWrinkConfigBank()) < CacheConjure) ? ColorRed : ColorGreen;
|
||||
const conjureTime = ((Game.cookies + GetWrinkConfigBank()) < CacheConjure) ? FormatTime((CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const conjureColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure ? ColorRed : ColorGreen;
|
||||
const conjureTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure
|
||||
? FormatTime(
|
||||
(CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
|
||||
const conjureReqFrag = document.createDocumentFragment();
|
||||
const conjureReqSpan = document.createElement('span');
|
||||
@@ -202,12 +417,37 @@ export function SpellsSection() {
|
||||
conjureReqSmall.textContent = ` (${conjureTime})`;
|
||||
conjureReqFrag.appendChild(conjureReqSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Conjure Baked Goods" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(StatsListing('withTooltip', '"Conjure Baked Goods" Reward (MAX)', document.createTextNode(Beautify(CacheConjureReward)), 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required',
|
||||
conjureReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX)',
|
||||
document.createTextNode(Beautify(CacheConjureReward)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const conjureFrenzyColor = ((Game.cookies + GetWrinkConfigBank()) < CacheConjure * 7) ? ColorRed : ColorGreen;
|
||||
const conjureFrenzyCur = Math.min((Game.cookies + GetWrinkConfigBank()) * 0.15, CacheNoGoldSwitchCookiesPS * 60 * 30);
|
||||
const conjureFrenzyTime = ((Game.cookies + GetWrinkConfigBank()) < CacheConjure * 7) ? FormatTime((CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS()) : '';
|
||||
const conjureFrenzyColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const conjureFrenzyCur = Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
||||
);
|
||||
const conjureFrenzyTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
|
||||
? FormatTime(
|
||||
(CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
|
||||
const conjureFrenzyReqFrag = document.createDocumentFragment();
|
||||
const conjureFrenzyReqSpan = document.createElement('span');
|
||||
@@ -220,11 +460,41 @@ export function SpellsSection() {
|
||||
conjureFrenzyReqSmall.textContent = ` (${conjureFrenzyTime})`;
|
||||
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', '"Conjure Baked Goods" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(StatsListing('withTooltip', '"Conjure Baked Goods" Reward (MAX) (Frenzy)', document.createTextNode(Beautify(CacheConjureReward * 7)), 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(StatsListing('withTooltip', '"Conjure Baked Goods" Reward (CUR)', document.createTextNode(Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required (Frenzy)',
|
||||
conjureFrenzyReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX) (Frenzy)',
|
||||
document.createTextNode(Beautify(CacheConjureReward * 7)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (CUR)',
|
||||
document.createTextNode(Beautify(conjureFrenzyCur)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
if (CacheEdifice) {
|
||||
section.appendChild(StatsListing('withTooltip', '"Spontaneous Edifice" Cookies Required (most expensive building)', document.createTextNode(`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`), 'GoldCookTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Spontaneous Edifice" Cookies Required (most expensive building)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`,
|
||||
),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
@@ -237,33 +507,61 @@ export function GardenSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsGardenSection';
|
||||
|
||||
const bakeberryColor = (Game.cookies < Game.cookiesPs * 60 * 30) ? ColorRed : ColorGreen;
|
||||
const bakeberryColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColorRed : ColorGreen;
|
||||
const bakeberryFrag = document.createElement('span');
|
||||
bakeberryFrag.style.fontWeight = 'bold';
|
||||
bakeberryFrag.className = ColorTextPre + bakeberryColor;
|
||||
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 30);
|
||||
section.appendChild(StatsListing('basic', 'Cookies required for max reward of Bakeberry: ', bakeberryFrag));
|
||||
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Bakeberry: ',
|
||||
bakeberryFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const chocorootColor = (Game.cookies < Game.cookiesPs * 60 * 3) ? ColorRed : ColorGreen;
|
||||
const chocorootColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 100 ? ColorRed : ColorGreen;
|
||||
const chocorootFrag = document.createElement('span');
|
||||
chocorootFrag.style.fontWeight = 'bold';
|
||||
chocorootFrag.className = ColorTextPre + chocorootColor;
|
||||
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 3);
|
||||
section.appendChild(StatsListing('basic', 'Cookies required for max reward of Chocoroot: ', chocorootFrag));
|
||||
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Chocoroot: ',
|
||||
chocorootFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const queenbeetColor = (Game.cookies < Game.cookiesPs * 60 * 60) ? ColorRed : ColorGreen;
|
||||
const queenbeetColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColorRed : ColorGreen;
|
||||
const queenbeetFrag = document.createElement('span');
|
||||
queenbeetFrag.style.fontWeight = 'bold';
|
||||
queenbeetFrag.className = ColorTextPre + queenbeetColor;
|
||||
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60);
|
||||
section.appendChild(StatsListing('basic', 'Cookies required for max reward of Queenbeet: ', queenbeetFrag));
|
||||
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Queenbeet: ',
|
||||
queenbeetFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const duketaterColor = (Game.cookies < Game.cookiesPs * 60 * 120) ? ColorRed : ColorGreen;
|
||||
const duketaterColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColorRed : ColorGreen;
|
||||
const duketaterFrag = document.createElement('span');
|
||||
duketaterFrag.style.fontWeight = 'bold';
|
||||
duketaterFrag.className = ColorTextPre + duketaterColor;
|
||||
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 120);
|
||||
section.appendChild(StatsListing('basic', 'Cookies required for max reward of Duketater: ', duketaterFrag));
|
||||
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Duketater: ',
|
||||
duketaterFrag,
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -275,45 +573,126 @@ export function PrestigeSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsPrestigeSection';
|
||||
|
||||
const possiblePresMax = Math.floor(Game.HowMuchPrestige(CacheRealCookiesEarned
|
||||
+ Game.cookiesReset + CacheWrinklersTotal
|
||||
+ (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0)));
|
||||
section.appendChild(StatsListing('withTooltip', 'Prestige Level (CUR / MAX)', document.createTextNode(`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`), 'PrestMaxTooltipPlaceholder'));
|
||||
const possiblePresMax = Math.floor(
|
||||
Game.HowMuchPrestige(
|
||||
CacheRealCookiesEarned +
|
||||
Game.cookiesReset +
|
||||
CacheWrinklersTotal +
|
||||
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
|
||||
? CacheLastChoEgg
|
||||
: 0),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Prestige Level (CUR / MAX)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`,
|
||||
),
|
||||
'PrestMaxTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CacheRealCookiesEarned + Game.cookiesReset + CacheWrinklersTotal + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0) ? CacheLastChoEgg : 0));
|
||||
const neededCook = Math.max(
|
||||
0,
|
||||
Game.HowManyCookiesReset(possiblePresMax + 1) -
|
||||
(CacheRealCookiesEarned +
|
||||
Game.cookiesReset +
|
||||
CacheWrinklersTotal +
|
||||
((
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
|
||||
? CacheLastChoEgg
|
||||
: 0
|
||||
)
|
||||
? CacheLastChoEgg
|
||||
: 0)),
|
||||
);
|
||||
const cookiesNextFrag = document.createDocumentFragment();
|
||||
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
|
||||
const cookiesNextSmall = document.createElement('small');
|
||||
cookiesNextSmall.textContent = ` (${FormatTime(neededCook / CacheAvgCPSWithChoEgg, 1)})`;
|
||||
cookiesNextSmall.textContent = ` (${FormatTime(
|
||||
neededCook / CacheAvgCPSWithChoEgg,
|
||||
1,
|
||||
)})`;
|
||||
cookiesNextFrag.appendChild(cookiesNextSmall);
|
||||
section.appendChild(StatsListing('withTooltip', 'Cookies To Next Level', cookiesNextFrag, 'NextPrestTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Cookies To Next Level',
|
||||
cookiesNextFrag,
|
||||
'NextPrestTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(StatsListing('withTooltip', 'Heavenly Chips (CUR / MAX)', document.createTextNode(`${Beautify(Game.heavenlyChips)} / ${Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)}`), 'HeavenChipMaxTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Heavenly Chips (CUR / MAX)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.heavenlyChips)} / ${Beautify(
|
||||
possiblePresMax - Game.prestige + Game.heavenlyChips,
|
||||
)}`,
|
||||
),
|
||||
'HeavenChipMaxTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(StatsListing('basic', 'Heavenly Chips Per Second (last 5 seconds)', document.createTextNode(Beautify(CacheHCPerSecond, 2))));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips Per Second (last 5 seconds)',
|
||||
document.createTextNode(Beautify(CacheHCPerSecond, 2)),
|
||||
),
|
||||
);
|
||||
|
||||
const HCTarget = Number(CMOptions.HeavenlyChipsTarget);
|
||||
if (!Number.isNaN(HCTarget)) {
|
||||
const CookiesTillTarget = HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
const CookiesTillTarget =
|
||||
HCTarget -
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
if (CookiesTillTarget > 0) {
|
||||
section.appendChild(StatsListing('basic', 'Heavenly Chips To Target Set In Settings (CUR)', document.createTextNode(Beautify(CookiesTillTarget))));
|
||||
section.appendChild(StatsListing('basic', 'Time To Target (CUR, Current 5 Second Average)', document.createTextNode(FormatTime(CookiesTillTarget / CacheHCPerSecond))));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips To Target Set In Settings (CUR)',
|
||||
document.createTextNode(Beautify(CookiesTillTarget)),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Time To Target (CUR, Current 5 Second Average)',
|
||||
document.createTextNode(
|
||||
FormatTime(CookiesTillTarget / CacheHCPerSecond),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const resetBonus = ResetBonus(possiblePresMax);
|
||||
const resetFrag = document.createDocumentFragment();
|
||||
resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));
|
||||
const increase = Math.round(resetBonus / Game.cookiesPs * 10000);
|
||||
const increase = Math.round((resetBonus / Game.cookiesPs) * 10000);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
const resetSmall = document.createElement('small');
|
||||
resetSmall.textContent = ` (${increase / 100}% of income)`;
|
||||
resetFrag.appendChild(resetSmall);
|
||||
}
|
||||
section.appendChild(StatsListing('withTooltip', 'Reset Bonus Income', resetFrag, 'ResetTooltipPlaceholder'));
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Reset Bonus Income',
|
||||
resetFrag,
|
||||
'ResetTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
||||
const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
const willHave = Math.floor(
|
||||
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
|
||||
);
|
||||
const willGet = willHave - currentPrestige;
|
||||
if (!Game.Has('Lucky digit')) {
|
||||
let delta7 = 7 - (willHave % 10);
|
||||
@@ -321,8 +700,14 @@ export function PrestigeSection() {
|
||||
const next7Reset = willGet + delta7;
|
||||
const next7Total = willHave + delta7;
|
||||
const frag7 = document.createDocumentFragment();
|
||||
frag7.appendChild(document.createTextNode(`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`));
|
||||
section.appendChild(StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7));
|
||||
frag7.appendChild(
|
||||
document.createTextNode(
|
||||
`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7),
|
||||
);
|
||||
}
|
||||
|
||||
if (!Game.Has('Lucky number')) {
|
||||
@@ -331,8 +716,14 @@ export function PrestigeSection() {
|
||||
const next777Reset = willGet + delta777;
|
||||
const next777Total = willHave + delta777;
|
||||
const frag777 = document.createDocumentFragment();
|
||||
frag777.appendChild(document.createTextNode(`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`));
|
||||
section.appendChild(StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777));
|
||||
frag777.appendChild(
|
||||
document.createTextNode(
|
||||
`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777),
|
||||
);
|
||||
}
|
||||
|
||||
if (!Game.Has('Lucky payout')) {
|
||||
@@ -341,9 +732,257 @@ export function PrestigeSection() {
|
||||
const next777777Reset = willGet + delta777777;
|
||||
const next777777Total = willHave + delta777777;
|
||||
const frag777777 = document.createDocumentFragment();
|
||||
frag777777.appendChild(document.createTextNode(`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`));
|
||||
section.appendChild(StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777));
|
||||
frag777777.appendChild(
|
||||
document.createTextNode(
|
||||
`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777),
|
||||
);
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Season Specials" section of the stats page
|
||||
* @returns {object} section The object contating the Season Specials section
|
||||
*/
|
||||
export function SeasonSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsSeasonSection';
|
||||
|
||||
let specDisp = false;
|
||||
const missingHalloweenCookies = [];
|
||||
Object.keys(GameData.HalloCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.HalloCookies[i])) {
|
||||
missingHalloweenCookies.push(GameData.HalloCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingChristmasCookies = [];
|
||||
Object.keys(GameData.ChristCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ChristCookies[i])) {
|
||||
missingChristmasCookies.push(GameData.ChristCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingValentineCookies = [];
|
||||
Object.keys(GameData.ValCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ValCookies[i])) {
|
||||
missingValentineCookies.push(GameData.ValCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingNormalEggs = [];
|
||||
Object.keys(Game.eggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.eggDrops[i])) {
|
||||
missingNormalEggs.push(Game.eggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingRareEggs = [];
|
||||
Object.keys(Game.rareEggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
|
||||
missingRareEggs.push(Game.rareEggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingPlantDrops = [];
|
||||
Object.keys(GameData.PlantDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
|
||||
missingPlantDrops.push(GameData.PlantDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const choEgg =
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
const centEgg = Game.Has('Century egg');
|
||||
|
||||
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
|
||||
section.appendChild(StatsHeader('Season Specials', 'Sea'));
|
||||
if (CMOptions.Header.Sea) {
|
||||
if (missingHalloweenCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Halloween cookies left to buy',
|
||||
StatsMissDisp(missingHalloweenCookies),
|
||||
),
|
||||
);
|
||||
let failRateHalloween = 0.95;
|
||||
if (Game.HasAchiev('Spooky cookies')) failRateHalloween = 0.8;
|
||||
if (Game.Has('Starterror')) failRateHalloween *= 0.9;
|
||||
failRateHalloween *= 1 / Game.dropRateMult();
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateHalloween *= 0.9;
|
||||
else if (godLvl === 2) failRateHalloween *= 0.95;
|
||||
else if (godLvl === 3) failRateHalloween *= 0.97;
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from wrinkler/shiny wrinkler',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateHalloween) * 100)}% / ${Beautify(
|
||||
(1 - failRateHalloween * 0.9) * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingChristmasCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Christmas cookies left to buy',
|
||||
StatsMissDisp(missingChristmasCookies),
|
||||
),
|
||||
);
|
||||
let failRateChristmas = 0.8;
|
||||
if (Game.HasAchiev('Let it snow')) failRateChristmas = 0.6;
|
||||
failRateChristmas *= 1 / Game.dropRateMult();
|
||||
if (Game.Has('Starsnow')) failRateChristmas *= 0.95;
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateChristmas *= 0.9;
|
||||
else if (godLvl === 2) failRateChristmas *= 0.95;
|
||||
else if (godLvl === 3) failRateChristmas *= 0.97;
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from reindeer',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateChristmas) * 100)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingValentineCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Valentine cookies left to buy',
|
||||
StatsMissDisp(missingValentineCookies),
|
||||
),
|
||||
);
|
||||
}
|
||||
const dropRateEgg = function (StartingFailRate) {
|
||||
let failRateEgg = StartingFailRate * (1 / Game.dropRateMult());
|
||||
if (Game.HasAchiev('Hide & seek champion')) failRateEgg *= 0.7;
|
||||
if (Game.Has('Omelette')) failRateEgg *= 0.9;
|
||||
if (Game.Has('Starspawn')) failRateEgg *= 0.9;
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateEgg *= 0.9;
|
||||
else if (godLvl === 2) failRateEgg *= 0.95;
|
||||
else if (godLvl === 3) failRateEgg *= 0.97;
|
||||
}
|
||||
// Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25
|
||||
const succesRateEgg = 1 - failRateEgg;
|
||||
const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length;
|
||||
const obtainedRareEggs =
|
||||
Game.rareEggDrops.length - missingRareEggs.length;
|
||||
const pNormal1 =
|
||||
succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
|
||||
const pRare1 =
|
||||
succesRateEgg *
|
||||
0.1 *
|
||||
(1 - obtainedRareEggs / Game.rareEggDrops.length);
|
||||
const pRedropNormal =
|
||||
succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
|
||||
const pRedropRare =
|
||||
succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
|
||||
const pRedrop = pRedropNormal + pRedropRare;
|
||||
const pNormal2 =
|
||||
pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
|
||||
const pRare2 =
|
||||
pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
|
||||
return [pNormal1 + pNormal2, pRare1 + pRare2];
|
||||
};
|
||||
if (missingNormalEggs.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Normal easter eggs left to unlock',
|
||||
StatsMissDisp(missingNormalEggs),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving an egg from wrinkler/golden cookie',
|
||||
document.createTextNode(
|
||||
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(
|
||||
dropRateEgg(0.9)[0] * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingRareEggs.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare easter eggs left to unlock',
|
||||
StatsMissDisp(missingRareEggs),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a rare egg from wrinkler/golden cookie',
|
||||
document.createTextNode(
|
||||
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(
|
||||
dropRateEgg(0.9)[1] * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingPlantDrops.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare plant drops left to unlock',
|
||||
StatsMissDisp(missingPlantDrops),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (Game.season === 'christmas')
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Reindeer reward',
|
||||
document.createTextNode(Beautify(CacheSeaSpec)),
|
||||
),
|
||||
);
|
||||
if (choEgg) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Chocolate egg cookies',
|
||||
document.createTextNode(Beautify(CacheLastChoEgg)),
|
||||
'ChoEggTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
}
|
||||
if (centEgg) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Century egg multiplier',
|
||||
document.createTextNode(
|
||||
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,10 @@ export default function AddMenuInfo(title) {
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header.InfoTab ? '-' : '+';
|
||||
span.onclick = function () { ToggleHeader('InfoTab'); Game.UpdateMenu(); };
|
||||
span.onclick = function () {
|
||||
ToggleHeader('InfoTab');
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
title.appendChild(span);
|
||||
info.appendChild(title);
|
||||
|
||||
|
||||
@@ -5,5 +5,11 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
* It is called by CM.Disp.Draw()
|
||||
*/
|
||||
export default function RefreshMenu() {
|
||||
if (CMOptions.UpStats && Game.onMenu === 'stats' && (Game.drawT - 1) % (Game.fps * 5) !== 0 && (Game.drawT - 1) % Game.fps === 0) Game.UpdateMenu();
|
||||
if (
|
||||
CMOptions.UpStats &&
|
||||
Game.onMenu === 'stats' &&
|
||||
(Game.drawT - 1) % (Game.fps * 5) !== 0 &&
|
||||
(Game.drawT - 1) % Game.fps === 0
|
||||
)
|
||||
Game.UpdateMenu();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
/** Functions related to the Options/Preferences page */
|
||||
|
||||
import jscolor, * as JsColor from '@eastdesire/jscolor';
|
||||
import { LoadConfig, SaveConfig } from '../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import {
|
||||
ConfigPrefix, ToggleConfig, ToggleConfigVolume, ToggleHeader,
|
||||
LoadConfig,
|
||||
SaveConfig,
|
||||
} from '../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import {
|
||||
ConfigPrefix,
|
||||
ToggleConfig,
|
||||
ToggleConfigVolume,
|
||||
ToggleHeader,
|
||||
} from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ConfigGroups, ConfigGroupsNotification } from '../../Data/Sectionheaders';
|
||||
import {
|
||||
ConfigGroups,
|
||||
ConfigGroupsNotification,
|
||||
} from '../../Data/Sectionheaders';
|
||||
import Config from '../../Data/SettingsData';
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import RefreshScale from '../HelperFunctions/RefreshScale';
|
||||
import UpdateColors from '../HelperFunctions/UpdateColors';
|
||||
import PlaySound from '../Notifications/Sound';
|
||||
import { Colors } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -38,7 +48,10 @@ function CreatePrefHeader(config, text) {
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () { ToggleHeader(config); Game.UpdateMenu(); };
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
@@ -59,14 +72,17 @@ function CreatePrefOption(config) {
|
||||
a.className = 'option';
|
||||
}
|
||||
a.id = ConfigPrefix + config;
|
||||
a.onclick = function () { ToggleConfig(config); };
|
||||
a.onclick = function () {
|
||||
ToggleConfig(config);
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
} if (Config[config].type === 'vol') {
|
||||
}
|
||||
if (Config[config].type === 'vol') {
|
||||
const volume = document.createElement('div');
|
||||
volume.className = 'sliderBox';
|
||||
const title = document.createElement('div');
|
||||
@@ -87,12 +103,29 @@ function CreatePrefOption(config) {
|
||||
slider.max = '100';
|
||||
slider.step = '1';
|
||||
slider.value = CMOptions[config];
|
||||
slider.oninput = function () { ToggleConfigVolume(config); };
|
||||
slider.onchange = function () { ToggleConfigVolume(config); };
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
slider.onchange = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
volume.appendChild(slider);
|
||||
div.appendChild(volume);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
PlaySound(
|
||||
CMOptions[config.replace('Volume', 'SoundURL')],
|
||||
config.replace('Volume', 'Sound'),
|
||||
config,
|
||||
true,
|
||||
);
|
||||
};
|
||||
a.textContent = 'Test sound';
|
||||
div.appendChild(a);
|
||||
return div;
|
||||
} if (Config[config].type === 'url') {
|
||||
}
|
||||
if (Config[config].type === 'url') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
@@ -114,7 +147,18 @@ function CreatePrefOption(config) {
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
Game.Prompt(inputPrompt.outerHTML, [['Save', function () { CMOptions[`${config}`] = l(`${ConfigPrefix}${config}Prompt`).value; SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu(); }], 'Cancel']);
|
||||
Game.Prompt(inputPrompt.outerHTML, [
|
||||
[
|
||||
'Save',
|
||||
function () {
|
||||
CMOptions[`${config}`] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||
SaveConfig();
|
||||
Game.ClosePrompt();
|
||||
Game.UpdateMenu();
|
||||
},
|
||||
],
|
||||
'Cancel',
|
||||
]);
|
||||
};
|
||||
a.textContent = 'Edit';
|
||||
div.appendChild(a);
|
||||
@@ -122,7 +166,8 @@ function CreatePrefOption(config) {
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
} if (Config[config].type === 'color') {
|
||||
}
|
||||
if (Config[config].type === 'color') {
|
||||
div.className = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
const innerDiv = document.createElement('div');
|
||||
@@ -138,6 +183,7 @@ function CreatePrefOption(config) {
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
// eslint-disable-next-line no-new
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config.Colors.desc[Colors[i]];
|
||||
@@ -146,7 +192,8 @@ function CreatePrefOption(config) {
|
||||
}
|
||||
jscolor.init();
|
||||
return div;
|
||||
} if (Config[config].type === 'numscale') {
|
||||
}
|
||||
if (Config[config].type === 'numscale') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
@@ -155,7 +202,7 @@ function CreatePrefOption(config) {
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'number';
|
||||
input.value = (CMOptions[config]);
|
||||
input.value = CMOptions[config];
|
||||
input.min = Config[config].min;
|
||||
input.max = Config[config].max;
|
||||
input.oninput = function () {
|
||||
@@ -183,39 +230,52 @@ export default function AddMenuPref(title) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(title);
|
||||
|
||||
for (const group of Object.keys(ConfigGroups)) {
|
||||
Object.keys(ConfigGroups).forEach((group) => {
|
||||
const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group)
|
||||
frag.appendChild(groupObject);
|
||||
if (CMOptions.Header[group]) { // 0 is show, 1 is collapsed
|
||||
if (CMOptions.Header[group]) {
|
||||
// 0 is show, 1 is collapsed
|
||||
// Make sub-sections of Notification section
|
||||
if (group === 'Notification') {
|
||||
for (const subGroup of Object.keys(ConfigGroupsNotification)) {
|
||||
const subGroupObject = CreatePrefHeader(subGroup, ConfigGroupsNotification[subGroup]); // (group, display-name of group)
|
||||
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
|
||||
const subGroupObject = CreatePrefHeader(
|
||||
subGroup,
|
||||
ConfigGroupsNotification[subGroup],
|
||||
); // (group, display-name of group)
|
||||
subGroupObject.style.fontSize = '15px';
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
for (const option in Config) {
|
||||
if (Config[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
|
||||
}
|
||||
}
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (const option of Object.keys(Config)) {
|
||||
if (Config[option].group === group) frag.appendChild(CreatePrefOption(option));
|
||||
}
|
||||
}
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const resDef = document.createElement('div');
|
||||
resDef.className = 'listing';
|
||||
const resDefBut = document.createElement('a');
|
||||
resDefBut.className = 'option';
|
||||
resDefBut.onclick = function () { LoadConfig(ConfigDefault); };
|
||||
resDefBut.onclick = function () {
|
||||
LoadConfig(ConfigDefault);
|
||||
};
|
||||
resDefBut.textContent = 'Restore Default';
|
||||
resDef.appendChild(resDefBut);
|
||||
frag.appendChild(resDef);
|
||||
|
||||
l('menu').childNodes[2].insertBefore(frag, l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1]);
|
||||
l('menu').childNodes[2].insertBefore(
|
||||
frag,
|
||||
l('menu').childNodes[2].childNodes[
|
||||
l('menu').childNodes[2].childNodes.length - 1
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,16 +10,25 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
*/
|
||||
export default function Flash(mode, config) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if ((CMOptions[config] === 1 && mode === 3 && isInitializing === false) || mode === 1) {
|
||||
if (
|
||||
(CMOptions[config] === 1 && mode === 3 && isInitializing === false) ||
|
||||
mode === 1
|
||||
) {
|
||||
l('CMWhiteScreen').style.opacity = '0.5';
|
||||
if (mode === 3) {
|
||||
l('CMWhiteScreen').style.display = 'inline';
|
||||
setTimeout(function () { Flash(2, config); }, 1000 / Game.fps);
|
||||
setTimeout(function () {
|
||||
Flash(2, config);
|
||||
}, 1000 / Game.fps);
|
||||
} else {
|
||||
setTimeout(function () { Flash(0, config); }, 1000 / Game.fps);
|
||||
setTimeout(function () {
|
||||
Flash(0, config);
|
||||
}, 1000 / Game.fps);
|
||||
}
|
||||
} else if (mode === 2) {
|
||||
l('CMWhiteScreen').style.opacity = '1';
|
||||
setTimeout(function () { Flash(1, config); }, 1000 / Game.fps);
|
||||
setTimeout(function () {
|
||||
Flash(1, config);
|
||||
}, 1000 / Game.fps);
|
||||
} else if (mode === 0) l('CMWhiteScreen').style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -10,10 +10,15 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
* @param {string} title The title of the to-be created notifications
|
||||
* @param {string} message The text of the to-be created notifications
|
||||
*/
|
||||
export default function Notification(notifyConfig, title, message) {
|
||||
export default function CreateNotification(notifyConfig, title, message) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (CMOptions[notifyConfig] === 1 && document.visibilityState === 'hidden' && isInitializing === false) {
|
||||
if (
|
||||
CMOptions[notifyConfig] === 1 &&
|
||||
document.visibilityState === 'hidden' &&
|
||||
isInitializing === false
|
||||
) {
|
||||
const CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
|
||||
// eslint-disable-next-line no-new
|
||||
new Notification(title, { body: message, badge: CookieIcon });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,16 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
* @param {variable} url A variable that gives the url for the sound (e.g., CM.Options.GCSoundURL)
|
||||
* @param {string} sndConfig The setting in CM.Options that is checked before creating the sound
|
||||
* @param {string} volConfig The setting in CM.Options that is checked to determine volume
|
||||
* @param {bool} forced Whether the sound should play regardless of settings, used to test the sound
|
||||
*/
|
||||
export default function PlaySound(url, sndConfig, volConfig) {
|
||||
export default function PlaySound(url, sndConfig, volConfig, forced) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (CMOptions[sndConfig] === 1 && isInitializing === false) {
|
||||
if ((CMOptions[sndConfig] === 1 || forced) && isInitializing === false) {
|
||||
// eslint-disable-next-line new-cap
|
||||
const sound = new realAudio(url);
|
||||
if (CMOptions.GeneralSound) sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
|
||||
else sound.volume = (CMOptions[volConfig] / 100);
|
||||
const sound = new Audio(url);
|
||||
if (CMOptions.GeneralSound)
|
||||
sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
|
||||
else sound.volume = CMOptions[volConfig] / 100;
|
||||
sound.play();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,13 @@ export function CreateFavicon() {
|
||||
*/
|
||||
export function UpdateFavicon() {
|
||||
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) {
|
||||
if (CacheSpawnedGoldenShimmer.wrath) l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
|
||||
else l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
|
||||
} else l('CMFavicon').href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
|
||||
if (CacheSpawnedGoldenShimmer.wrath)
|
||||
l('CMFavicon').href =
|
||||
'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
|
||||
else
|
||||
l('CMFavicon').href =
|
||||
'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
|
||||
} else
|
||||
l('CMFavicon').href =
|
||||
'https://orteil.dashnet.org/cookieclicker/favicon.ico';
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
/** Functions related to updating the tab in the browser's tab-bar */
|
||||
|
||||
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheSeasonPopShimmer,
|
||||
CacheSpawnedGoldenShimmer,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData';
|
||||
import {
|
||||
LastSeasonPopupState,
|
||||
LastTickerFortuneState,
|
||||
} from '../../Main/VariablesAndData';
|
||||
import { Title } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -20,10 +26,17 @@ export default function UpdateTitle() {
|
||||
let titleSP;
|
||||
|
||||
if (CacheSpawnedGoldenShimmer) {
|
||||
if (CacheSpawnedGoldenShimmer.wrath) titleGC = `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
else titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
if (CacheSpawnedGoldenShimmer.wrath)
|
||||
titleGC = `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
else
|
||||
titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
} else if (!Game.Has('Golden switch [off]')) {
|
||||
titleGC = `[${Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : ''}${Math.ceil((Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps)}]`;
|
||||
titleGC = `[${
|
||||
Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : ''
|
||||
}${Math.ceil(
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
)}]`;
|
||||
} else titleGC = '[GS]';
|
||||
|
||||
if (LastTickerFortuneState) {
|
||||
@@ -33,9 +46,16 @@ export default function UpdateTitle() {
|
||||
|
||||
if (Game.season === 'christmas') {
|
||||
addSP = true;
|
||||
if (LastSeasonPopupState) titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
|
||||
if (LastSeasonPopupState)
|
||||
titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
|
||||
else {
|
||||
titleSP = `[${Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''}${Math.ceil((Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps)}]`;
|
||||
titleSP = `[${
|
||||
Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''
|
||||
}${Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
)}]`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,13 +64,16 @@ export default function UpdateTitle() {
|
||||
if (str.charAt(0) === '[') {
|
||||
str = str.substring(str.lastIndexOf(']') + 1);
|
||||
}
|
||||
document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`;
|
||||
document.title = `${
|
||||
titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')
|
||||
} ${str}`;
|
||||
} else if (CMOptions.Title === 2) {
|
||||
let str = '';
|
||||
let spawn = false;
|
||||
if (CacheSpawnedGoldenShimmer) {
|
||||
spawn = true;
|
||||
if (CacheSpawnedGoldenShimmer.wrath) str += `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
if (CacheSpawnedGoldenShimmer.wrath)
|
||||
str += `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
else str += `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
|
||||
}
|
||||
if (LastTickerFortuneState) {
|
||||
|
||||
65
src/Disp/Tooltips/AscendButton.js
Normal file
65
src/Disp/Tooltips/AscendButton.js
Normal file
@@ -0,0 +1,65 @@
|
||||
import {
|
||||
CacheHCPerSecond,
|
||||
CacheLastHeavenlyChips,
|
||||
CacheTimeTillNextPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
/**
|
||||
* This function creates a header object for tooltips.
|
||||
* @param {string} text Title of header
|
||||
* @returns {object} div An object containing the stylized header
|
||||
*/
|
||||
export default function ReplaceAscendTooltip() {
|
||||
const cookiesToNext = Math.max(
|
||||
0,
|
||||
Game.HowManyCookiesReset(
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) +
|
||||
1,
|
||||
) -
|
||||
(Game.cookiesEarned + Game.cookiesReset),
|
||||
);
|
||||
|
||||
const startDate = Game.sayTime(
|
||||
((Date.now() - Game.startDate) / 1000) * Game.fps,
|
||||
-1,
|
||||
);
|
||||
let str = '';
|
||||
str += `You've been on this run for <b>${
|
||||
startDate === '' ? 'not very long' : startDate
|
||||
}</b>.<br>`;
|
||||
str += '<div class="line"></div>';
|
||||
if (Game.prestige > 0) {
|
||||
str += `Your prestige level is currently <b>${Beautify(
|
||||
Game.prestige,
|
||||
)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
|
||||
str += '<div class="line"></div>';
|
||||
}
|
||||
if (CacheLastHeavenlyChips < 1)
|
||||
str += 'Ascending now would grant you no prestige.';
|
||||
else if (CacheLastHeavenlyChips < 2)
|
||||
str +=
|
||||
'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
|
||||
else
|
||||
str += `Ascending now would grant you<br><b>${Beautify(
|
||||
CacheLastHeavenlyChips,
|
||||
)} prestige levels</b> (+${Beautify(
|
||||
CacheLastHeavenlyChips,
|
||||
)}% CpS)<br>and <b>${Beautify(
|
||||
CacheLastHeavenlyChips,
|
||||
)} heavenly chips</b> to spend.`;
|
||||
str += '<div class="line"></div>';
|
||||
str += `You need <b>${Beautify(
|
||||
cookiesToNext,
|
||||
)} more cookies</b> for the next level.<br>`;
|
||||
str += `${
|
||||
CMOptions.TooltipAscendButton
|
||||
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${Beautify(
|
||||
CacheHCPerSecond,
|
||||
2,
|
||||
)} chips on average in the last 5 seconds.<br>`
|
||||
: ''
|
||||
}`;
|
||||
l('ascendTooltip').innerHTML = str;
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorTextPre, ColorBorderPre, ColorGray, ColorBlue, ColorRed, ColorYellow, ColorPurple, TooltipType,
|
||||
ColorTextPre,
|
||||
ColorBorderPre,
|
||||
ColorGray,
|
||||
ColorBlue,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
ColorPurple,
|
||||
TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/** Creates various sections of tooltips */
|
||||
@@ -47,7 +55,13 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.style.bottom = 'auto';
|
||||
TooltipWarn.id = 'CMDispTooltipWarningParent';
|
||||
|
||||
const create = function (boxId, color, labelTextFront, labelTextBack, deficitId) {
|
||||
const create = function (
|
||||
boxId,
|
||||
color,
|
||||
labelTextFront,
|
||||
labelTextBack,
|
||||
deficitId,
|
||||
) {
|
||||
const box = document.createElement('div');
|
||||
box.id = boxId;
|
||||
box.style.display = 'none';
|
||||
@@ -72,17 +86,65 @@ export function TooltipCreateWarningSection() {
|
||||
return box;
|
||||
};
|
||||
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnLucky', ColorRed, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!"', 'CMDispTooltipWarnLuckyText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLucky',
|
||||
ColorRed,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!"',
|
||||
'CMDispTooltipWarnLuckyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.firstChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnLuckyFrenzy', ColorYellow, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)', 'CMDispTooltipWarnLuckyFrenzyText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLuckyFrenzy',
|
||||
ColorYellow,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',
|
||||
'CMDispTooltipWarnLuckyFrenzyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjure',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',
|
||||
'CMDispTooltipWarnConjureText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjureFrenzy',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',
|
||||
'CMDispTooltipWarnConjureFrenzyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnEdifice',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',
|
||||
'CMDispTooltipWarnEdificeText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnUser', ColorRed, 'Warning: ', `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`, 'CMDispTooltipWarnUserText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnUser',
|
||||
ColorRed,
|
||||
'Warning: ',
|
||||
`Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`,
|
||||
'CMDispTooltipWarnUserText',
|
||||
),
|
||||
);
|
||||
|
||||
return TooltipWarn;
|
||||
}
|
||||
@@ -121,7 +183,9 @@ export function TooltipCreateCalculationSection(tooltip) {
|
||||
tooltip.appendChild(time);
|
||||
|
||||
if (TooltipType === 'b') {
|
||||
tooltip.appendChild(TooltipCreateHeader('Production left till next achievement'));
|
||||
tooltip.appendChild(
|
||||
TooltipCreateHeader('Production left till next achievement'),
|
||||
);
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipProduction';
|
||||
|
||||
@@ -7,10 +7,21 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
export default function UpdateTooltipLocation() {
|
||||
if (Game.tooltip.origin === 'store') {
|
||||
let warnOffset = 0;
|
||||
if (CMOptions.ToolWarnLucky === 1 && CMOptions.ToolWarnPos === 1 && l('CMDispTooltipWarningParent') !== null) {
|
||||
if (
|
||||
CMOptions.ToolWarnLucky === 1 &&
|
||||
CMOptions.ToolWarnPos === 1 &&
|
||||
l('CMDispTooltipWarningParent') !== null
|
||||
) {
|
||||
warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4;
|
||||
}
|
||||
Game.tooltip.tta.style.top = `${Math.min(parseInt(Game.tooltip.tta.style.top, 10), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46)}px`;
|
||||
Game.tooltip.tta.style.top = `${Math.min(
|
||||
parseInt(Game.tooltip.tta.style.top, 10),
|
||||
l('game').clientHeight +
|
||||
l('topBar').clientHeight -
|
||||
Game.tooltip.tt.clientHeight -
|
||||
warnOffset -
|
||||
46,
|
||||
)}px`;
|
||||
}
|
||||
// Kept for future possible use if the code changes again
|
||||
/* else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import * as UpdateTooltip from './UpdateTooltips';
|
||||
import UpdateTooltips, * as UpdateTooltip from './UpdateTooltips';
|
||||
import { TooltipCreateTooltipBox } from './CreateTooltip';
|
||||
import { Beautify, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { TooltipName, TooltipType } from '../VariablesAndData';
|
||||
import {
|
||||
SimpleTooltipElements,
|
||||
TooltipName,
|
||||
TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
|
||||
@@ -27,37 +34,7 @@ export function CreateSimpleTooltip(placeholder, text, minWidth) {
|
||||
div.textContent = text;
|
||||
desc.appendChild(div);
|
||||
Tooltip.appendChild(desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates the sections of the tooltips created by CookieMonster
|
||||
*/
|
||||
export function UpdateTooltips() {
|
||||
CopyData();
|
||||
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||
l('CMTooltipArea').innerHTML = '';
|
||||
const tooltipBox = TooltipCreateTooltipBox();
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
|
||||
if (TooltipType === 'b') {
|
||||
UpdateTooltip.Building();
|
||||
} else if (TooltipType === 'u') {
|
||||
UpdateTooltip.Upgrade();
|
||||
} else if (TooltipType === 's') {
|
||||
UpdateTooltip.SugarLump();
|
||||
} else if (TooltipType === 'g') {
|
||||
UpdateTooltip.Grimoire();
|
||||
} else if (TooltipType === 'p') {
|
||||
UpdateTooltip.GardenPlots();
|
||||
} else if (TooltipType === 'ha') {
|
||||
UpdateTooltip.HarvestAll();
|
||||
}
|
||||
UpdateTooltip.Warnings();
|
||||
} else if (l('CMTooltipArea') === null) { // Remove warnings if its a basic tooltip
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
SimpleTooltipElements[placeholder] = Tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,16 +45,32 @@ export function UpdateTooltips() {
|
||||
* @returns {string} l('tooltip').innerHTML The HTML of the l('tooltip')-object
|
||||
*/
|
||||
export function CreateTooltip(type, name) {
|
||||
if (type === 'b') { // Buildings
|
||||
if (type === 'b') {
|
||||
// Buildings
|
||||
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
||||
// Adds amortization info to the list of info per building
|
||||
if (CMOptions.TooltipAmor === 1) {
|
||||
const buildPrice = BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount);
|
||||
const buildPrice = BuildingGetPrice(
|
||||
Game.Objects[name],
|
||||
Game.Objects[name].basePrice,
|
||||
0,
|
||||
Game.Objects[name].free,
|
||||
Game.Objects[name].amount,
|
||||
);
|
||||
const amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
|
||||
if (amortizeAmount > 0) {
|
||||
l('tooltip').innerHTML = l('tooltip').innerHTML
|
||||
.split('so far</div>')
|
||||
.join(`so far<br/>• <b>${Beautify(amortizeAmount)}</b> ${Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies'} left to amortize (${GetTimeColor((buildPrice - Game.Objects[name].totalCookies) / (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text})</div>`);
|
||||
l('tooltip').innerHTML = l('tooltip')
|
||||
.innerHTML.split('so far</div>')
|
||||
.join(
|
||||
`so far<br/>• <b>${Beautify(amortizeAmount)}</b> ${
|
||||
Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies'
|
||||
} left to amortize (${
|
||||
GetTimeColor(
|
||||
(buildPrice - Game.Objects[name].totalCookies) /
|
||||
(Game.Objects[name].storedTotalCps * Game.globalCpsMult),
|
||||
).text
|
||||
})</div>`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Game.buyMode === -1) {
|
||||
@@ -89,18 +82,61 @@ export function CreateTooltip(type, name) {
|
||||
*
|
||||
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
|
||||
*/
|
||||
l('tooltip').innerHTML = l('tooltip').innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify((Game.Objects[name], Game.Objects[name].basePrice, Game.Objects[name].amount, Game.Objects[name].free, Game.buyBulk, 1)));
|
||||
l('tooltip').innerHTML = l('tooltip')
|
||||
.innerHTML.split(Beautify(Game.Objects[name].bulkPrice))
|
||||
.join(
|
||||
Beautify(
|
||||
(Game.Objects[name],
|
||||
Game.Objects[name].basePrice,
|
||||
Game.Objects[name].amount,
|
||||
Game.Objects[name].free,
|
||||
Game.buyBulk,
|
||||
1),
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if (type === 'u') { // Upgrades
|
||||
} else if (type === 'u') {
|
||||
// Upgrades
|
||||
if (!Game.UpgradesInStore[name]) return '';
|
||||
l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
|
||||
} else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
|
||||
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
|
||||
else if (type === 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots
|
||||
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
|
||||
l('tooltip').innerHTML = Game.crateTooltip(
|
||||
Game.UpgradesInStore[name],
|
||||
'store',
|
||||
);
|
||||
} else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip();
|
||||
// Sugar Lumps
|
||||
else if (type === 'g')
|
||||
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(
|
||||
name,
|
||||
)();
|
||||
// Grimoire
|
||||
else if (type === 'p')
|
||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(
|
||||
name[0],
|
||||
name[1],
|
||||
)();
|
||||
// Harvest all button in garden
|
||||
else if (type === 'ha')
|
||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
|
||||
else if (type === 'wb') l('tooltip').innerHTML = '';
|
||||
else if (type === 'pag')
|
||||
l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
|
||||
else if (type === 'pas')
|
||||
l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip(
|
||||
name[0],
|
||||
)();
|
||||
|
||||
// Adds area for extra tooltip-sections
|
||||
if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || (type === 'p' && !Game.keys[16]) || type === 'ha') {
|
||||
if (
|
||||
(type === 'b' && Game.buyMode === 1) ||
|
||||
type === 'u' ||
|
||||
type === 's' ||
|
||||
type === 'g' ||
|
||||
(type === 'p' && !Game.keys[16]) ||
|
||||
type === 'ha' ||
|
||||
type === 'wb' ||
|
||||
type === 'pag' ||
|
||||
(type === 'pas' && name[1] !== -1)
|
||||
) {
|
||||
const area = document.createElement('div');
|
||||
area.id = 'CMTooltipArea';
|
||||
l('tooltip').appendChild(area);
|
||||
|
||||
99
src/Disp/Tooltips/TypesOfTooltips/Building.js
Normal file
99
src/Disp/Tooltips/TypesOfTooltips/Building.js
Normal file
@@ -0,0 +1,99 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre,
|
||||
LastTargetTooltipBuilding,
|
||||
TooltipBonusIncome,
|
||||
TooltipName,
|
||||
TooltipPrice,
|
||||
} from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Building tooltips
|
||||
*/
|
||||
export default function Building() {
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
let target;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetTooltipBuilding = target;
|
||||
} else {
|
||||
target = LastTargetTooltipBuilding;
|
||||
}
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
|
||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||
TooltipBonusIncome = target[TooltipName].bonus;
|
||||
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round(
|
||||
(TooltipBonusIncome / Game.cookiesPs) * 10000,
|
||||
);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
l('CMTooltipIncome').textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
|
||||
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < target[TooltipName].price
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
}
|
||||
|
||||
// Add "production left till next achievement"-bar
|
||||
l('CMTooltipProductionHeader').style.display = 'none';
|
||||
l('CMTooltipTime').style.marginBottom = '0px';
|
||||
for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) {
|
||||
if (
|
||||
!Game.HasAchiev(
|
||||
Game.Objects[TooltipName].productionAchievs[i].achiev.name,
|
||||
)
|
||||
) {
|
||||
const nextProductionAchiev =
|
||||
Game.Objects[TooltipName].productionAchievs[i];
|
||||
l('CMTooltipTime').style.marginBottom = '4px';
|
||||
l('CMTooltipProductionHeader').style.display = '';
|
||||
l('CMTooltipProduction').className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProduction').textContent = Beautify(
|
||||
nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies,
|
||||
15,
|
||||
);
|
||||
l('CMTooltipProduction').style.color = 'white';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
55
src/Disp/Tooltips/TypesOfTooltips/GardenPlots.js
Normal file
55
src/Disp/Tooltips/TypesOfTooltips/GardenPlots.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { TooltipName } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Garden plots tooltips
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function GardenPlots() {
|
||||
const { minigame } = Game.Objects.Farm;
|
||||
if (
|
||||
CMOptions.TooltipPlots &&
|
||||
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
|
||||
) {
|
||||
const mature =
|
||||
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
|
||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
||||
.matureBase;
|
||||
const plantName =
|
||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
||||
.name;
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Reward (Current / Maximum)'),
|
||||
);
|
||||
const reward = document.createElement('div');
|
||||
reward.id = 'CMTooltipPlantReward';
|
||||
l('CMTooltipBorder').appendChild(reward);
|
||||
if (plantName === 'Bakeberry') {
|
||||
l('CMTooltipPlantReward').textContent = `${
|
||||
mature
|
||||
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30))
|
||||
: '0'
|
||||
} / ${Beautify(Game.cookiesPs * 60 * 30)}`;
|
||||
} else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
|
||||
l('CMTooltipPlantReward').textContent = `${
|
||||
mature
|
||||
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3))
|
||||
: '0'
|
||||
} / ${Beautify(Game.cookiesPs * 60 * 3)}`;
|
||||
} else if (plantName === 'Queenbeet') {
|
||||
l('CMTooltipPlantReward').textContent = `${
|
||||
mature
|
||||
? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60))
|
||||
: '0'
|
||||
} / ${Beautify(Game.cookiesPs * 60 * 60)}`;
|
||||
} else if (plantName === 'Duketater') {
|
||||
l('CMTooltipPlantReward').textContent = `${
|
||||
mature
|
||||
? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120))
|
||||
: '0'
|
||||
} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
80
src/Disp/Tooltips/TypesOfTooltips/Grimoire.js
Normal file
80
src/Disp/Tooltips/TypesOfTooltips/Grimoire.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorTextPre, TooltipName } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Grimoire tooltips
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function Grimoire() {
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||
|
||||
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
// Time left till enough magic for spell
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(time);
|
||||
const timeColor = GetTimeColor(
|
||||
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
|
||||
);
|
||||
time.textContent = timeColor.text;
|
||||
time.className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Time left untill magic spent is recovered
|
||||
if (spellCost <= minigame.magic) {
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Recover Time'));
|
||||
const recover = document.createElement('div');
|
||||
recover.id = 'CMTooltipRecover';
|
||||
tooltipBox.appendChild(recover);
|
||||
const recoverColor = GetTimeColor(
|
||||
CalculateGrimoireRefillTime(
|
||||
Math.max(0, minigame.magic - spellCost),
|
||||
minigame.magicM,
|
||||
minigame.magic,
|
||||
),
|
||||
);
|
||||
recover.textContent = recoverColor.text;
|
||||
recover.className = ColorTextPre + recoverColor.color;
|
||||
}
|
||||
|
||||
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
|
||||
if (TooltipName === '0') {
|
||||
tooltipBox.appendChild(
|
||||
Create.TooltipCreateHeader('Cookies to be gained/lost'),
|
||||
);
|
||||
const conjure = document.createElement('div');
|
||||
conjure.id = 'x';
|
||||
tooltipBox.appendChild(conjure);
|
||||
const reward = document.createElement('span');
|
||||
reward.style.color = '#33FF00';
|
||||
reward.textContent = Beautify(
|
||||
Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
||||
),
|
||||
2,
|
||||
);
|
||||
conjure.appendChild(reward);
|
||||
const seperator = document.createElement('span');
|
||||
seperator.textContent = ' / ';
|
||||
conjure.appendChild(seperator);
|
||||
const loss = document.createElement('span');
|
||||
loss.style.color = 'red';
|
||||
loss.textContent = Beautify(CacheNoGoldSwitchCookiesPS * 60 * 15, 2);
|
||||
conjure.appendChild(loss);
|
||||
}
|
||||
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
57
src/Disp/Tooltips/TypesOfTooltips/HarvestAll.js
Normal file
57
src/Disp/Tooltips/TypesOfTooltips/HarvestAll.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Garden Harvest All tooltip
|
||||
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function HarvestAll() {
|
||||
const { minigame } = Game.Objects.Farm;
|
||||
if (CMOptions.TooltipLump) {
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Cookies gained from harvesting:'),
|
||||
);
|
||||
let totalGain = 0;
|
||||
let mortal = 0;
|
||||
if (Game.keys[16] && Game.keys[17]) mortal = 1;
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (minigame.plot[y][x][0] >= 1) {
|
||||
const tile = minigame.plot[y][x];
|
||||
const me = minigame.plantsById[tile[0] - 1];
|
||||
const plantName = me.name;
|
||||
|
||||
let count = true;
|
||||
if (mortal && me.immortal) count = false;
|
||||
if (tile[1] < me.matureBase) count = false;
|
||||
if (count && plantName === 'Bakeberry') {
|
||||
totalGain += Math.min(
|
||||
Game.cookies * 0.03,
|
||||
Game.cookiesPs * 60 * 30,
|
||||
);
|
||||
} else if (
|
||||
(count && plantName === 'Chocoroot') ||
|
||||
plantName === 'White chocoroot'
|
||||
) {
|
||||
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3);
|
||||
} else if (count && plantName === 'Queenbeet') {
|
||||
totalGain += Math.min(
|
||||
Game.cookies * 0.04,
|
||||
Game.cookiesPs * 60 * 60,
|
||||
);
|
||||
} else if (count && plantName === 'Duketater') {
|
||||
totalGain += Math.min(
|
||||
Game.cookies * 0.08,
|
||||
Game.cookiesPs * 60 * 120,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l('CMTooltipBorder').appendChild(
|
||||
document.createTextNode(Beautify(totalGain)),
|
||||
);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
76
src/Disp/Tooltips/TypesOfTooltips/PantheonGods.js
Normal file
76
src/Disp/Tooltips/TypesOfTooltips/PantheonGods.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import { CacheGods } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { TooltipName, TooltipType } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Pantheon Gods tooltip
|
||||
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function PantheonGods() {
|
||||
if (CMOptions.TooltipPantheon === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
let GodID;
|
||||
if (TooltipType === 'pas') GodID = TooltipName[1];
|
||||
else GodID = TooltipName;
|
||||
|
||||
// Time left till enough magic for spell
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 1:'));
|
||||
const cps1 = document.createElement('div');
|
||||
cps1.id = 'CMPantheonTooltipPosition1';
|
||||
if (CacheGods[GodID][0] !== 0) {
|
||||
cps1.textContent = Beautify(CacheGods[GodID][0]);
|
||||
const increase = Math.round(
|
||||
(CacheGods[GodID][0] / Game.cookiesPs) * 10000,
|
||||
);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps1.textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
cps1.textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
} else cps1.textContent = 'No effect to CPS';
|
||||
tooltipBox.appendChild(cps1);
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 2:'));
|
||||
const cps2 = document.createElement('div');
|
||||
cps2.id = 'CMPantheonTooltipPosition2';
|
||||
if (CacheGods[GodID][1] !== 0) {
|
||||
cps2.textContent = Beautify(CacheGods[GodID][1]);
|
||||
const increase = Math.round(
|
||||
(CacheGods[GodID][1] / Game.cookiesPs) * 10000,
|
||||
);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps2.textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
cps2.textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
} else cps2.textContent = 'No effect to CPS';
|
||||
tooltipBox.appendChild(cps2);
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 3:'));
|
||||
const cps3 = document.createElement('div');
|
||||
cps3.id = 'CMPantheonTooltipPosition2';
|
||||
if (CacheGods[GodID][2] !== 0) {
|
||||
cps3.textContent = Beautify(CacheGods[GodID][2]);
|
||||
const increase = Math.round(
|
||||
(CacheGods[GodID][2] / Game.cookiesPs) * 10000,
|
||||
);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps3.textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
cps3.textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
} else cps3.textContent = 'No effect to CPS';
|
||||
tooltipBox.appendChild(cps3);
|
||||
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
22
src/Disp/Tooltips/TypesOfTooltips/SugarLump.js
Normal file
22
src/Disp/Tooltips/TypesOfTooltips/SugarLump.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import GetLumpColor from '../../HelperFunctions/GetLumpColor';
|
||||
import { ColorTextPre } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
/**
|
||||
* This function adds extra info to the Sugar Lump tooltip
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function SugarLump() {
|
||||
if (CMOptions.TooltipLump === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));
|
||||
|
||||
const lumpType = document.createElement('div');
|
||||
lumpType.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(lumpType);
|
||||
const lumpColor = GetLumpColor(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColor.text;
|
||||
lumpType.className = ColorTextPre + lumpColor.color;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
114
src/Disp/Tooltips/TypesOfTooltips/Upgrade.js
Normal file
114
src/Disp/Tooltips/TypesOfTooltips/Upgrade.js
Normal file
@@ -0,0 +1,114 @@
|
||||
import {
|
||||
CacheLastChoEgg,
|
||||
CacheUpgrades,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre,
|
||||
TooltipBonusIncome,
|
||||
TooltipBonusMouse,
|
||||
TooltipName,
|
||||
TooltipPrice,
|
||||
TooltipType,
|
||||
} from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Upgrade tooltips
|
||||
*/
|
||||
export default function Upgrade() {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
TooltipBonusIncome =
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus;
|
||||
TooltipPrice = Game.Upgrades[
|
||||
Game.UpgradesInStore[TooltipName].name
|
||||
].getPrice();
|
||||
TooltipBonusMouse =
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
|
||||
|
||||
if (CMOptions.TooltipBuildUpgrade === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
|
||||
// Don't display certain parts of tooltip if not applicable
|
||||
if (
|
||||
l('CMTooltipIncome').textContent === '0' &&
|
||||
(TooltipType === 'b' || TooltipType === 'u')
|
||||
) {
|
||||
l('Bonus IncomeTitle').style.display = 'none';
|
||||
l('CMTooltipIncome').style.display = 'none';
|
||||
l('Payback PeriodTitle').style.display = 'none';
|
||||
l('CMTooltipPP').style.display = 'none';
|
||||
} else {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
l('CMTooltipIncome').textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className =
|
||||
ColorTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
// If clicking power upgrade
|
||||
if (TooltipBonusMouse) {
|
||||
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
|
||||
l('CMTooltipCookiePerClick').style.display = 'block';
|
||||
l('CMTooltipCookiePerClick').previousSibling.style.display = 'block';
|
||||
}
|
||||
// If only a clicking power upgrade change PP to click-based period
|
||||
if (TooltipBonusIncome === 0 && TooltipBonusMouse) {
|
||||
l('CMTooltipPP').textContent = `${Beautify(
|
||||
TooltipPrice / TooltipBonusMouse,
|
||||
)} Clicks`;
|
||||
l('CMTooltipPP').style.color = 'white';
|
||||
} else {
|
||||
if (CMOptions.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
);
|
||||
else
|
||||
l('CMTooltipPP').textContent = Beautify(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
2,
|
||||
);
|
||||
l('CMTooltipPP').className =
|
||||
ColorTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
}
|
||||
}
|
||||
const timeColor = GetTimeColor(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < Game.UpgradesInStore[TooltipName].getPrice()
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Add extra info to Chocolate egg tooltip
|
||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||
l('CMTooltipBorder').lastChild.style.marginBottom = '4px';
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Cookies to be gained (Currently/Max)'),
|
||||
);
|
||||
const chocolate = document.createElement('div');
|
||||
chocolate.style.color = 'white';
|
||||
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(
|
||||
CacheLastChoEgg,
|
||||
)}`;
|
||||
l('CMTooltipBorder').appendChild(chocolate);
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
144
src/Disp/Tooltips/TypesOfTooltips/Warnings.js
Normal file
144
src/Disp/Tooltips/TypesOfTooltips/Warnings.js
Normal file
@@ -0,0 +1,144 @@
|
||||
import GetCPSBuffMult from '../../../Cache/CPS/GetCPSBuffMult';
|
||||
import { CacheEdifice, CacheLucky } from '../../../Cache/VariablesAndData';
|
||||
import ToggleToolWarnPos from '../../../Config/Toggles/ToggleToolWarnPos';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
TooltipBonusIncome,
|
||||
TooltipPrice,
|
||||
TooltipType,
|
||||
} from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function updates the warnings section of the building and upgrade tooltips
|
||||
*/
|
||||
export default function Warnings() {
|
||||
if (TooltipType === 'b' || TooltipType === 'u') {
|
||||
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
||||
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
||||
ToggleToolWarnPos();
|
||||
}
|
||||
|
||||
if (CMOptions.ToolWarnPos === 0)
|
||||
l('CMDispTooltipWarningParent').style.right = '0px';
|
||||
else
|
||||
l('CMDispTooltipWarningParent').style.top = `${
|
||||
l('tooltip').offsetHeight
|
||||
}px`;
|
||||
|
||||
l('CMDispTooltipWarningParent').style.width = `${
|
||||
l('tooltip').offsetWidth - 6
|
||||
}px`;
|
||||
|
||||
const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice;
|
||||
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0;
|
||||
let limitLucky = CacheLucky;
|
||||
if (CMOptions.ToolWarnBon === 1) {
|
||||
let bonusNoFren = TooltipBonusIncome;
|
||||
bonusNoFren /= GetCPSBuffMult();
|
||||
limitLucky += (bonusNoFren * 60 * 15) / 0.15;
|
||||
}
|
||||
|
||||
if (CMOptions.ToolWarnLucky === 1) {
|
||||
if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLucky').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
|
||||
limitLucky - amount,
|
||||
)} (${FormatTime(
|
||||
(limitLucky - amount) / (GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnLuckyFrenzy === 1) {
|
||||
const limitLuckyFrenzy = limitLucky * 7;
|
||||
if (
|
||||
amount < limitLuckyFrenzy &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(
|
||||
limitLuckyFrenzy - amount,
|
||||
)} (${FormatTime(
|
||||
(limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnConjure === 1) {
|
||||
const limitConjure = limitLucky * 2;
|
||||
if (
|
||||
amount < limitConjure &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnConjure').style.display = '';
|
||||
l('CMDispTooltipWarnConjureText').textContent = `${Beautify(
|
||||
limitConjure - amount,
|
||||
)} (${FormatTime(
|
||||
(limitConjure - amount) / (GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnConjureFrenzy === 1) {
|
||||
const limitConjureFrenzy = limitLucky * 2 * 7;
|
||||
if (
|
||||
amount < limitConjureFrenzy &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(
|
||||
limitConjureFrenzy - amount,
|
||||
)} (${FormatTime(
|
||||
(limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
|
||||
if (
|
||||
CMOptions.ToolWarnEdifice === 1 &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
if (
|
||||
CacheEdifice &&
|
||||
amount < CacheEdifice &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnEdifice').style.display = '';
|
||||
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
|
||||
CacheEdifice - amount,
|
||||
)} (${FormatTime(
|
||||
(CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnUser > 0) {
|
||||
if (
|
||||
amount < CMOptions.ToolWarnUser * GetCPS() &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnUser').style.display = '';
|
||||
// Need to update tooltip text dynamically
|
||||
l(
|
||||
'CMDispTooltipWarnUser',
|
||||
).children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`;
|
||||
l('CMDispTooltipWarnUserText').textContent = `${Beautify(
|
||||
CMOptions.ToolWarnUser * GetCPS() - amount,
|
||||
)} (${FormatTime(
|
||||
(CMOptions.ToolWarnUser * GetCPS() - amount) /
|
||||
(GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
25
src/Disp/Tooltips/TypesOfTooltips/WrinklerButton.js
Normal file
25
src/Disp/Tooltips/TypesOfTooltips/WrinklerButton.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { TooltipName } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the wrinkler button tooltip
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function WrinklerButton() {
|
||||
l('tooltip').innerHTML = '';
|
||||
l('tooltip').appendChild(Create.TooltipCreateHeader('Reward:'));
|
||||
|
||||
const WrinklerReward = document.createElement('div');
|
||||
WrinklerReward.id = 'CMWrinklerReward';
|
||||
if (TooltipName === 'PopAll') {
|
||||
WrinklerReward.textContent = CacheWrinklersTotal;
|
||||
} else if (TooltipName === 'PopFattest') {
|
||||
WrinklerReward.textContent = CacheWrinklersFattest[0];
|
||||
}
|
||||
|
||||
l('tooltip').appendChild(WrinklerReward);
|
||||
}
|
||||
@@ -1,344 +1,51 @@
|
||||
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheEdifice, CacheLastChoEgg, CacheLucky, CacheNoGoldSwitchCookiesPS, CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import ToggleToolWarnPos from '../../Config/Toggles/ToggleToolWarnPos';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { Beautify, FormatTime, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CalculateGrimoireRefillTime from '../HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetLumpColor from '../HelperFunctions/GetLumpColor';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre, LastTargetTooltipBuilding, TooltipBonusIncome, TooltipBonusMouse, TooltipName, TooltipPrice, TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { TooltipName, TooltipType } from '../VariablesAndData';
|
||||
import * as Create from './CreateTooltip';
|
||||
|
||||
/** Functions that update specific types of tooltips */
|
||||
import Building from './TypesOfTooltips/Building';
|
||||
import GardenPlots from './TypesOfTooltips/GardenPlots';
|
||||
import Grimoire from './TypesOfTooltips/Grimoire';
|
||||
import HarvestAll from './TypesOfTooltips/HarvestAll';
|
||||
import PantheonGods from './TypesOfTooltips/PantheonGods';
|
||||
import SugarLump from './TypesOfTooltips/SugarLump';
|
||||
import Upgrade from './TypesOfTooltips/Upgrade';
|
||||
import Warnings from './TypesOfTooltips/Warnings';
|
||||
import WrinklerButton from './TypesOfTooltips/WrinklerButton';
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Building tooltips
|
||||
* This function updates the sections of the tooltips created by CookieMonster
|
||||
*/
|
||||
export function Building() {
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
let target;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetTooltipBuilding = target;
|
||||
} else {
|
||||
target = LastTargetTooltipBuilding;
|
||||
}
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
|
||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||
TooltipBonusIncome = target[TooltipName].bonus;
|
||||
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round(TooltipBonusIncome / Game.cookiesPs * 10000);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor((TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < target[TooltipName].price) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
}
|
||||
|
||||
// Add "production left till next achievement"-bar
|
||||
l('CMTooltipProductionHeader').style.display = 'none';
|
||||
l('CMTooltipTime').style.marginBottom = '0px';
|
||||
for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) {
|
||||
if (!Game.HasAchiev(Game.Objects[TooltipName].productionAchievs[i].achiev.name)) {
|
||||
const nextProductionAchiev = Game.Objects[TooltipName].productionAchievs[i];
|
||||
l('CMTooltipTime').style.marginBottom = '4px';
|
||||
l('CMTooltipProductionHeader').style.display = '';
|
||||
l('CMTooltipProduction').className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProduction').textContent = Beautify(nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies, 15);
|
||||
l('CMTooltipProduction').style.color = 'white';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Upgrade tooltips
|
||||
*/
|
||||
export function Upgrade() {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
TooltipBonusIncome = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus;
|
||||
TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice();
|
||||
TooltipBonusMouse = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
|
||||
|
||||
if (CMOptions.TooltipBuildUpgrade === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round(TooltipBonusIncome / Game.cookiesPs * 10000);
|
||||
// Don't display certain parts of tooltip if not applicable
|
||||
if (l('CMTooltipIncome').textContent === '0' && (TooltipType === 'b' || TooltipType === 'u')) {
|
||||
l('Bonus IncomeTitle').style.display = 'none';
|
||||
l('CMTooltipIncome').style.display = 'none';
|
||||
l('Payback PeriodTitle').style.display = 'none';
|
||||
l('CMTooltipPP').style.display = 'none';
|
||||
} else {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
// If clicking power upgrade
|
||||
if (TooltipBonusMouse) {
|
||||
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
|
||||
l('CMTooltipCookiePerClick').style.display = 'block';
|
||||
l('CMTooltipCookiePerClick').previousSibling.style.display = 'block';
|
||||
}
|
||||
// If only a clicking power upgrade change PP to click-based period
|
||||
if (TooltipBonusIncome === 0 && TooltipBonusMouse) {
|
||||
l('CMTooltipPP').textContent = `${Beautify(TooltipPrice / TooltipBonusMouse)} Clicks`;
|
||||
l('CMTooltipPP').style.color = 'white';
|
||||
} else {
|
||||
l('CMTooltipPP').textContent = Beautify(CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
}
|
||||
}
|
||||
const timeColor = GetTimeColor((TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < Game.UpgradesInStore[TooltipName].getPrice()) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Add extra info to Chocolate egg tooltip
|
||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||
l('CMTooltipBorder').lastChild.style.marginBottom = '4px';
|
||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies to be gained (Currently/Max)'));
|
||||
const chocolate = document.createElement('div');
|
||||
chocolate.style.color = 'white';
|
||||
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(CacheLastChoEgg)}`;
|
||||
l('CMTooltipBorder').appendChild(chocolate);
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Sugar Lump tooltip
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function SugarLump() {
|
||||
if (CMOptions.TooltipLump === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));
|
||||
|
||||
const lumpType = document.createElement('div');
|
||||
lumpType.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(lumpType);
|
||||
const lumpColor = GetLumpColor(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColor.text;
|
||||
lumpType.className = ColorTextPre + lumpColor.color;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Grimoire tooltips
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function Grimoire() {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||
|
||||
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
// Time left till enough magic for spell
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(time);
|
||||
const timeColor = GetTimeColor(CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost));
|
||||
time.textContent = timeColor.text;
|
||||
time.className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Time left untill magic spent is recovered
|
||||
if (spellCost <= minigame.magic) {
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Recover Time'));
|
||||
const recover = document.createElement('div');
|
||||
recover.id = 'CMTooltipRecover';
|
||||
tooltipBox.appendChild(recover);
|
||||
const recoverColor = GetTimeColor(CalculateGrimoireRefillTime(Math.max(0, minigame.magic - spellCost), minigame.magicM, minigame.magic));
|
||||
recover.textContent = recoverColor.text;
|
||||
recover.className = ColorTextPre + recoverColor.color;
|
||||
}
|
||||
|
||||
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
|
||||
if (TooltipName === '0') {
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Cookies to be gained/lost'));
|
||||
const conjure = document.createElement('div');
|
||||
conjure.id = 'x';
|
||||
tooltipBox.appendChild(conjure);
|
||||
const reward = document.createElement('span');
|
||||
reward.style.color = '#33FF00';
|
||||
reward.textContent = Beautify(Math.min((Game.cookies + GetWrinkConfigBank()) * 0.15, CacheNoGoldSwitchCookiesPS * 60 * 30), 2);
|
||||
conjure.appendChild(reward);
|
||||
const seperator = document.createElement('span');
|
||||
seperator.textContent = ' / ';
|
||||
conjure.appendChild(seperator);
|
||||
const loss = document.createElement('span');
|
||||
loss.style.color = 'red';
|
||||
loss.textContent = Beautify((CacheNoGoldSwitchCookiesPS * 60 * 15), 2);
|
||||
conjure.appendChild(loss);
|
||||
}
|
||||
|
||||
export default function UpdateTooltips() {
|
||||
CopyData();
|
||||
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||
l('CMTooltipArea').innerHTML = '';
|
||||
const tooltipBox = Create.TooltipCreateTooltipBox();
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Garden plots tooltips
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function GardenPlots() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
if (CMOptions.TooltipPlots && minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0) {
|
||||
const mature = minigame.plot[TooltipName[1]][TooltipName[0]][1] > minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].matureBase;
|
||||
const plantName = minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].name;
|
||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Reward (Current / Maximum)'));
|
||||
const reward = document.createElement('div');
|
||||
reward.id = 'CMTooltipPlantReward';
|
||||
l('CMTooltipBorder').appendChild(reward);
|
||||
if (plantName === 'Bakeberry') {
|
||||
l('CMTooltipPlantReward').textContent = `${mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : '0'} / ${Beautify(Game.cookiesPs * 60 * 30)}`;
|
||||
} else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
|
||||
l('CMTooltipPlantReward').textContent = `${mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : '0'} / ${Beautify(Game.cookiesPs * 60 * 3)}`;
|
||||
} else if (plantName === 'Queenbeet') {
|
||||
l('CMTooltipPlantReward').textContent = `${mature ? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : '0'} / ${Beautify(Game.cookiesPs * 60 * 60)}`;
|
||||
} else if (plantName === 'Duketater') {
|
||||
l('CMTooltipPlantReward').textContent = `${mature ? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : '0'} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Garden Harvest All tooltip
|
||||
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function HarvestAll() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
if (CMOptions.TooltipLump) {
|
||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:'));
|
||||
let totalGain = 0;
|
||||
let mortal = 0;
|
||||
if (Game.keys[16] && Game.keys[17]) mortal = 1;
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (minigame.plot[y][x][0] >= 1) {
|
||||
const tile = minigame.plot[y][x];
|
||||
const me = minigame.plantsById[tile[0] - 1];
|
||||
const plantName = me.name;
|
||||
|
||||
let count = true;
|
||||
if (mortal && me.immortal) count = false;
|
||||
if (tile[1] < me.matureBase) count = false;
|
||||
if (count && plantName === 'Bakeberry') {
|
||||
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30);
|
||||
} else if (count && plantName === 'Chocoroot' || plantName === 'White chocoroot') {
|
||||
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3);
|
||||
} else if (count && plantName === 'Queenbeet') {
|
||||
totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60);
|
||||
} else if (count && plantName === 'Duketater') {
|
||||
totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120);
|
||||
if (TooltipType === 'b') {
|
||||
Building();
|
||||
} else if (TooltipType === 'u') {
|
||||
Upgrade();
|
||||
} else if (TooltipType === 's') {
|
||||
SugarLump();
|
||||
} else if (TooltipType === 'g') {
|
||||
Grimoire();
|
||||
} else if (TooltipType === 'p') {
|
||||
GardenPlots();
|
||||
} else if (TooltipType === 'ha') {
|
||||
HarvestAll();
|
||||
} else if (TooltipType === 'wb') {
|
||||
WrinklerButton();
|
||||
} else if (
|
||||
TooltipType === 'pag' ||
|
||||
(TooltipType === 'pas' && TooltipName[1] !== -1)
|
||||
) {
|
||||
PantheonGods();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l('CMTooltipBorder').appendChild(document.createTextNode(Beautify(totalGain)));
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates the warnings section of the building and upgrade tooltips
|
||||
* It is called by CM.Disp.UpdateTooltip()
|
||||
*/
|
||||
export function Warnings() {
|
||||
if (TooltipType === 'b' || TooltipType === 'u') {
|
||||
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
||||
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
||||
ToggleToolWarnPos();
|
||||
}
|
||||
|
||||
if (CMOptions.ToolWarnPos === 0) l('CMDispTooltipWarningParent').style.right = '0px';
|
||||
else l('CMDispTooltipWarningParent').style.top = `${l('tooltip').offsetHeight}px`;
|
||||
|
||||
l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`;
|
||||
|
||||
const amount = (Game.cookies + GetWrinkConfigBank()) - TooltipPrice;
|
||||
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0;
|
||||
let limitLucky = CacheLucky;
|
||||
if (CMOptions.ToolWarnBon === 1) {
|
||||
let bonusNoFren = TooltipBonusIncome;
|
||||
bonusNoFren /= GetCPSBuffMult();
|
||||
limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
|
||||
}
|
||||
|
||||
if (CMOptions.ToolWarnLucky === 1) {
|
||||
if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLucky').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(limitLucky - amount)} (${FormatTime((limitLucky - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnLuckyFrenzy === 1) {
|
||||
const limitLuckyFrenzy = limitLucky * 7;
|
||||
if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(limitLuckyFrenzy - amount)} (${FormatTime((limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnConjure === 1) {
|
||||
const limitConjure = limitLucky * 2;
|
||||
if ((amount < limitConjure) && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnConjure').style.display = '';
|
||||
l('CMDispTooltipWarnConjureText').textContent = `${Beautify(limitConjure - amount)} (${FormatTime((limitConjure - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnConjureFrenzy === 1) {
|
||||
const limitConjureFrenzy = limitLucky * 2 * 7;
|
||||
if ((amount < limitConjureFrenzy) && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(limitConjureFrenzy - amount)} (${FormatTime((limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnEdifice === 1 && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
if (CacheEdifice && amount < CacheEdifice && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnEdifice').style.display = '';
|
||||
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(CacheEdifice - amount)} (${FormatTime((CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnUser > 0) {
|
||||
if (amount < CMOptions.ToolWarnUser * GetCPS() && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnUser').style.display = '';
|
||||
// Need to update tooltip text dynamically
|
||||
l('CMDispTooltipWarnUser').children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`;
|
||||
l('CMDispTooltipWarnUserText').textContent = `${Beautify(CMOptions.ToolWarnUser * GetCPS() - amount)} (${FormatTime((CMOptions.ToolWarnUser * GetCPS() - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else if (l('CMDispTooltipWarningParent') !== null) {
|
||||
Warnings();
|
||||
} else if (l('CMTooltipArea') === null) {
|
||||
// Remove warnings if its a basic tooltip
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { TooltipWrinkler, TooltipWrinklerArea, TooltipWrinklerBeingShown } from '../VariablesAndData';
|
||||
import {
|
||||
TooltipWrinkler,
|
||||
TooltipWrinklerArea,
|
||||
TooltipWrinklerBeingShown,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function checks and create a tooltip for the wrinklers
|
||||
@@ -9,13 +13,17 @@ import { TooltipWrinkler, TooltipWrinklerArea, TooltipWrinklerBeingShown } from
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
export function CheckWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect
|
||||
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) {
|
||||
// Latter is set by CM.Main.AddWrinklerAreaDetect
|
||||
let showingTooltip = false;
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
const me = Game.wrinklers[i];
|
||||
if (me.phase > 0 && me.selected) {
|
||||
showingTooltip = true;
|
||||
if (TooltipWrinklerBeingShown[i] === 0 || TooltipWrinklerBeingShown[i] === undefined) {
|
||||
if (
|
||||
TooltipWrinklerBeingShown[i] === 0 ||
|
||||
TooltipWrinklerBeingShown[i] === undefined
|
||||
) {
|
||||
const placeholder = document.createElement('div');
|
||||
const wrinkler = document.createElement('div');
|
||||
wrinkler.style.minWidth = '120px';
|
||||
@@ -28,11 +36,11 @@ export function CheckWrinklerTooltip() {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
TooltipWrinkler = i;
|
||||
TooltipWrinklerBeingShown[i] = 1;
|
||||
} else break;
|
||||
}
|
||||
} else {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!showingTooltip) {
|
||||
Game.tooltip.hide();
|
||||
}
|
||||
@@ -46,7 +54,7 @@ export function CheckWrinklerTooltip() {
|
||||
*/
|
||||
export function UpdateWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) {
|
||||
let sucked = Game.wrinklers[TooltipWrinkler].sucked;
|
||||
let { sucked } = Game.wrinklers[TooltipWrinkler];
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
|
||||
@@ -23,7 +23,17 @@ export const ColorPurple = 'Purple';
|
||||
export const ColorGray = 'Gray';
|
||||
export const ColorPink = 'Pink';
|
||||
export const ColorBrown = 'Brown';
|
||||
export const Colors = [ColorGray, ColorBlue, ColorGreen, ColorYellow, ColorOrange, ColorRed, ColorPurple, ColorPink, ColorBrown];
|
||||
export const Colors = [
|
||||
ColorGray,
|
||||
ColorBlue,
|
||||
ColorGreen,
|
||||
ColorYellow,
|
||||
ColorOrange,
|
||||
ColorRed,
|
||||
ColorPurple,
|
||||
ColorPink,
|
||||
ColorBrown,
|
||||
];
|
||||
|
||||
/**
|
||||
* This list is used to make some very basic tooltips.
|
||||
@@ -34,14 +44,43 @@ export const Colors = [ColorGray, ColorBlue, ColorGreen, ColorYellow, ColorOrang
|
||||
*/
|
||||
export const TooltipText = [
|
||||
['GoldCookTooltipPlaceholder', 'Calculated with Golden Switch off', '200px'],
|
||||
['GoldCookDragonsFortuneTooltipPlaceholder', 'Calculated with Golden Switch off and at least one golden cookie on-screen', '240px'],
|
||||
['PrestMaxTooltipPlaceholder', 'The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg', '320px'],
|
||||
['NextPrestTooltipPlaceholder', 'Calculated with cookies gained from wrinklers and Chocolate egg', '200px'],
|
||||
['HeavenChipMaxTooltipPlaceholder', 'The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg', '330px'],
|
||||
['ResetTooltipPlaceholder', 'The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset', '370px'],
|
||||
['ChoEggTooltipPlaceholder', 'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg', '300px'],
|
||||
['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'],
|
||||
[
|
||||
'GoldCookDragonsFortuneTooltipPlaceholder',
|
||||
'Calculated with Golden Switch off and at least one golden cookie on-screen',
|
||||
'240px',
|
||||
],
|
||||
[
|
||||
'PrestMaxTooltipPlaceholder',
|
||||
'The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg',
|
||||
'320px',
|
||||
],
|
||||
[
|
||||
'NextPrestTooltipPlaceholder',
|
||||
'Calculated with cookies gained from wrinklers and Chocolate egg',
|
||||
'200px',
|
||||
],
|
||||
[
|
||||
'HeavenChipMaxTooltipPlaceholder',
|
||||
'The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg',
|
||||
'330px',
|
||||
],
|
||||
[
|
||||
'ResetTooltipPlaceholder',
|
||||
'The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset',
|
||||
'370px',
|
||||
],
|
||||
[
|
||||
'ChoEggTooltipPlaceholder',
|
||||
'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg',
|
||||
'300px',
|
||||
],
|
||||
[
|
||||
'ChainNextLevelPlaceholder',
|
||||
'Cheated cookies might break this formula',
|
||||
'250px',
|
||||
],
|
||||
];
|
||||
export const SimpleTooltipElements = {};
|
||||
|
||||
/**
|
||||
* These are variables used by the functions that create tooltips for wrinklers
|
||||
@@ -78,7 +117,12 @@ export const ClickTimes = [1, 5, 10, 15, 30];
|
||||
* This array is used to give certain timers specific colours
|
||||
*/
|
||||
export const BuffColors = {
|
||||
Frenzy: ColorYellow, 'Dragon Harvest': ColorBrown, 'Elder frenzy': ColorGreen, Clot: ColorRed, 'Click frenzy': ColorBlue, Dragonflight: ColorPink,
|
||||
Frenzy: ColorYellow,
|
||||
'Dragon Harvest': ColorBrown,
|
||||
'Elder frenzy': ColorGreen,
|
||||
Clot: ColorRed,
|
||||
'Click frenzy': ColorBlue,
|
||||
Dragonflight: ColorPink,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,9 @@ export default function init() {
|
||||
isInitializing = true;
|
||||
let proceed = true;
|
||||
if (Game.version !== Number(VersionMajor)) {
|
||||
proceed = confirm(`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`);
|
||||
proceed = confirm(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`,
|
||||
);
|
||||
}
|
||||
if (proceed) {
|
||||
InitializeCookieMonster();
|
||||
|
||||
@@ -11,7 +11,17 @@ export default function load(str) {
|
||||
InitData();
|
||||
LoadConfig(save.settings);
|
||||
if (save.version !== `${VersionMajor}.${VersionMinor}`) {
|
||||
if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!');
|
||||
else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1);
|
||||
if (Game.prefs.popups)
|
||||
Game.Popup(
|
||||
'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!',
|
||||
);
|
||||
else
|
||||
Game.Notify(
|
||||
'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,13 @@ import { LastGardenNextStep } from '../VariablesAndData';
|
||||
* This function checks if a garden tick has happened
|
||||
*/
|
||||
export default function CheckGardenTick() {
|
||||
if (Game.Objects.Farm.minigameLoaded && LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) {
|
||||
if (
|
||||
Game.Objects.Farm.minigameLoaded &&
|
||||
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
|
||||
) {
|
||||
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
||||
Flash(3, 'GardFlash');
|
||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume');
|
||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false);
|
||||
}
|
||||
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheSpawnedGoldenShimmer,
|
||||
CacheGoldenShimmersByID,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenCookieState } from '../VariablesAndData';
|
||||
import {
|
||||
CurrSpawnedGoldenCookieState,
|
||||
LastGoldenCookieState,
|
||||
LastSpawnedGoldenCookieState,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Auxilirary function that finds all currently spawned shimmers.
|
||||
@@ -17,13 +24,13 @@ import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenC
|
||||
function FindShimmer() {
|
||||
CurrSpawnedGoldenCookieState = 0;
|
||||
CacheGoldenShimmersByID = {};
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
|
||||
CacheSpawnedGoldenShimmer = Game.shimmers[i];
|
||||
CurrSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,35 +39,42 @@ function FindShimmer() {
|
||||
*/
|
||||
export default function CheckGoldenCookie() {
|
||||
FindShimmer();
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
|
||||
GCTimers[i].parentNode.removeChild(GCTimers[i]);
|
||||
delete GCTimers[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
|
||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (LastGoldenCookieState) {
|
||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||
Flash(3, 'GCFlash');
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!');
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume', false);
|
||||
CreateNotification(
|
||||
'GCNotification',
|
||||
'Golden Cookie Spawned',
|
||||
'A Golden Cookie has spawned. Click it now!',
|
||||
);
|
||||
}
|
||||
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
|
||||
CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
UpdateFavicon();
|
||||
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
|
||||
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
|
||||
GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform;
|
||||
GCTimers[i].textContent = Math.ceil(CacheGoldenShimmersByID[i].life / Game.fps);
|
||||
}
|
||||
GCTimers[i].style.transform =
|
||||
CacheGoldenShimmersByID[i].l.style.transform;
|
||||
GCTimers[i].textContent = Math.ceil(
|
||||
CacheGoldenShimmersByID[i].life / Game.fps,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastMagicBarFull } from '../VariablesAndData';
|
||||
|
||||
@@ -9,14 +9,21 @@ import { LastMagicBarFull } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckMagicMeter() {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded && CMOptions.GrimoireBar === 1) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
if (
|
||||
Game.Objects['Wizard tower'].minigameLoaded &&
|
||||
CMOptions.GrimoireBar === 1
|
||||
) {
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||
else if (!LastMagicBarFull) {
|
||||
LastMagicBarFull = true;
|
||||
Flash(3, 'MagicFlash');
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!');
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume', false);
|
||||
CreateNotification(
|
||||
'MagicNotification',
|
||||
'Magic Meter full',
|
||||
'Your Magic Meter is full. Cast a spell!',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastSeasonPopupState } from '../VariablesAndData';
|
||||
|
||||
@@ -13,14 +13,17 @@ import { LastSeasonPopupState } from '../VariablesAndData';
|
||||
export default function CheckSeasonPopup() {
|
||||
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
|
||||
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
Flash(3, 'SeaFlash');
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!');
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume', false);
|
||||
CreateNotification(
|
||||
'SeaNotification',
|
||||
'Reindeer sighted!',
|
||||
'A Reindeer has spawned. Click it now!',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastTickerFortuneState } from '../VariablesAndData';
|
||||
|
||||
@@ -8,12 +9,25 @@ import { LastTickerFortuneState } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckTickerFortune() {
|
||||
if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
|
||||
LastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
|
||||
if (
|
||||
LastTickerFortuneState !==
|
||||
(Game.TickerEffect && Game.TickerEffect.type === 'fortune')
|
||||
) {
|
||||
LastTickerFortuneState =
|
||||
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
|
||||
if (LastTickerFortuneState) {
|
||||
Flash(3, 'FortuneFlash');
|
||||
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.');
|
||||
PlaySound(
|
||||
CMOptions.FortuneSoundURL,
|
||||
'FortuneSound',
|
||||
'FortuneVolume',
|
||||
false,
|
||||
);
|
||||
CreateNotification(
|
||||
'FortuneNotification',
|
||||
'Fortune Cookie found',
|
||||
'A Fortune Cookie has appeared on the Ticker.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastWrinklerCount } from '../VariablesAndData';
|
||||
|
||||
@@ -11,25 +11,52 @@ import { LastWrinklerCount } from '../VariablesAndData';
|
||||
export default function CheckWrinklerCount() {
|
||||
if (Game.elderWrath > 0) {
|
||||
let CurrentWrinklers = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
|
||||
}
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers += 1;
|
||||
});
|
||||
if (CurrentWrinklers > LastWrinklerCount) {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxFlash) {
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxFlash
|
||||
) {
|
||||
Flash(3, 'WrinklerMaxFlash');
|
||||
} else {
|
||||
Flash(3, 'WrinklerFlash');
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxSound) {
|
||||
PlaySound(CMOptions.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxSound
|
||||
) {
|
||||
PlaySound(
|
||||
CMOptions.WrinklerMaxSoundURL,
|
||||
'WrinklerMaxSound',
|
||||
'WrinklerMaxVolume',
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
PlaySound(CMOptions.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
|
||||
PlaySound(
|
||||
CMOptions.WrinklerSoundURL,
|
||||
'WrinklerSound',
|
||||
'WrinklerVolume',
|
||||
false,
|
||||
);
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxNotification) {
|
||||
Notification('WrinklerMaxNotification', 'Maximum Wrinklers Reached', 'You have reached your maximum ammount of wrinklers');
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxNotification
|
||||
) {
|
||||
CreateNotification(
|
||||
'WrinklerMaxNotification',
|
||||
'Maximum Wrinklers Reached',
|
||||
'You have reached your maximum ammount of wrinklers',
|
||||
);
|
||||
} else {
|
||||
Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared');
|
||||
CreateNotification(
|
||||
'WrinklerNotification',
|
||||
'A Wrinkler appeared',
|
||||
'A new wrinkler has appeared',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
|
||||
import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
|
||||
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
|
||||
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
|
||||
import CreateWrinklerButtons from '../Disp/Initialization/CreateWrinklerButton';
|
||||
import CreateCssArea from '../Disp/Initialization/CssArea';
|
||||
import UpdateBuildingUpgradeStyle from '../Disp/Initialization/UpdateBuildingUpgradeStyle';
|
||||
@@ -37,10 +38,15 @@ export default function InitializeCookieMonster() {
|
||||
CreateTimerBar();
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateSectionHideButtons();
|
||||
CreateFavicon();
|
||||
for (const i of Object.keys(TooltipText)) {
|
||||
CreateSimpleTooltip(TooltipText[i][0], TooltipText[i][1], TooltipText[i][2]);
|
||||
}
|
||||
Object.keys(TooltipText).forEach((i) => {
|
||||
CreateSimpleTooltip(
|
||||
TooltipText[i][0],
|
||||
TooltipText[i][1],
|
||||
TooltipText[i][2],
|
||||
);
|
||||
});
|
||||
CreateWrinklerButtons();
|
||||
UpdateBuildingUpgradeStyle();
|
||||
|
||||
@@ -55,8 +61,18 @@ export default function InitializeCookieMonster() {
|
||||
LoadConfig(); // Must be after all things are created!
|
||||
CMLastAscendState = Game.OnAscend;
|
||||
|
||||
if (Game.prefs.popups) Game.Popup(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`);
|
||||
else Game.Notify(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`, '', '', 1, 1);
|
||||
if (Game.prefs.popups)
|
||||
Game.Popup(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`,
|
||||
);
|
||||
else
|
||||
Game.Notify(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`,
|
||||
'',
|
||||
'',
|
||||
1,
|
||||
1,
|
||||
);
|
||||
|
||||
Game.Win('Third-party');
|
||||
}
|
||||
|
||||
@@ -3,13 +3,21 @@ import LoopCache from '../Cache/CacheLoop';
|
||||
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
|
||||
import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg';
|
||||
import CacheDragonCost from '../Cache/Dragon/Dragon';
|
||||
import { CacheBuildingsPrices, CacheIncome } from '../Cache/PriceAndIncome/PriceAndIncome';
|
||||
import CachePantheonGods from '../Cache/PantheonGods/CacheGods';
|
||||
import {
|
||||
CacheBuildingsPrices,
|
||||
CacheIncome,
|
||||
} from '../Cache/PriceAndIncome/PriceAndIncome';
|
||||
import { CacheChain } from '../Cache/Stats/ChainCookies';
|
||||
import CacheAllMissingUpgrades from '../Cache/Stats/MissingUpgrades';
|
||||
import CacheSeasonSpec from '../Cache/Stats/Reindeer';
|
||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from '../Cache/Stats/Stats';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices, CacheHadBuildAura,
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from '../Cache/Stats/Stats';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices,
|
||||
CacheHadBuildAura,
|
||||
} from '../Cache/VariablesAndData';
|
||||
import UpdateAscendState from '../Disp/HelperFunctions/UpdateAscendState';
|
||||
import { LastAscendState } from '../Disp/VariablesAndData';
|
||||
@@ -50,6 +58,7 @@ export default function CMLoop() {
|
||||
CacheAllMissingUpgrades();
|
||||
CacheChain();
|
||||
CacheDragonCost();
|
||||
CachePantheonGods();
|
||||
|
||||
CacheSeasonSpec();
|
||||
CacheSellAllForChoEgg();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user