Compare commits
407 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cff2928535 | ||
|
|
5fec38625f | ||
|
|
1d325a253c | ||
|
|
33caf8838c | ||
|
|
2708903e92 | ||
|
|
6b346e0272 | ||
|
|
d6a3209c43 | ||
|
|
dfd0d790bc | ||
|
|
f228365978 | ||
|
|
e7536d4bd4 | ||
|
|
9a6086d823 | ||
|
|
527de03493 | ||
|
|
52d52baf8e | ||
|
|
9c1bfbf80a | ||
|
|
d4043689a4 | ||
|
|
8cb0471694 | ||
|
|
ce7f0eb7e3 | ||
|
|
70df241c8f | ||
|
|
3ba2a31363 | ||
|
|
c4907e9582 | ||
|
|
1c1afb6880 | ||
|
|
1905f9a953 | ||
|
|
23eb28e29c | ||
|
|
38f430c930 | ||
|
|
035318c33f | ||
|
|
a620efe44a | ||
|
|
26b08c77ce | ||
|
|
3e53ba7c6d | ||
|
|
9252d10f23 | ||
|
|
0278162dce | ||
|
|
ee0ed81aba | ||
|
|
f69fb191d1 | ||
|
|
c0e93f316f | ||
|
|
058555b148 | ||
|
|
dd2c4e56b4 | ||
|
|
be569ee218 | ||
|
|
c0e27f3c52 | ||
|
|
d694e82b02 | ||
|
|
ca796c0b48 | ||
|
|
6c95e341f5 | ||
|
|
f84f6fc348 | ||
|
|
be245da05f | ||
|
|
977c25e77a | ||
|
|
6ab791d762 | ||
|
|
962a709489 | ||
|
|
4fb58719d3 | ||
|
|
eaff9ef93d | ||
|
|
f403f89c20 | ||
|
|
100745946e | ||
|
|
18b151d7c0 | ||
|
|
2febfb4cbe | ||
|
|
73b9ebce7f | ||
|
|
39744d52b3 | ||
|
|
97624bd4da | ||
|
|
66549c5c96 | ||
|
|
df152fd302 | ||
|
|
ff31c45a4a | ||
|
|
9ba81afae1 | ||
|
|
66e906e878 | ||
|
|
865fc3b227 | ||
|
|
47ebed0925 | ||
|
|
734f3c38c2 | ||
|
|
fcbf1b2377 | ||
|
|
4c6dfbba69 | ||
|
|
3edcb0300b | ||
|
|
49e9711b7c | ||
|
|
a48ad37b7f | ||
|
|
ace1c9f6a9 | ||
|
|
fa942ff81d | ||
|
|
974b948583 | ||
|
|
e1e4327173 | ||
|
|
d054b55ddc | ||
|
|
6e0add10fb | ||
|
|
f431d2b6be | ||
|
|
68ad398b27 | ||
|
|
68d7295bbc | ||
|
|
2be4e2de57 | ||
|
|
ae6db8f330 | ||
|
|
5715274d1a | ||
|
|
74cdb613ca | ||
|
|
4eae4598a7 | ||
|
|
d9ef469980 | ||
|
|
5532e4d0ba | ||
|
|
e78703130e | ||
|
|
63240b01bc | ||
|
|
1a520b4d52 | ||
|
|
c7fd910a26 | ||
|
|
a3ad66a058 | ||
|
|
ee3aac59ce | ||
|
|
598a36493f | ||
|
|
507e168e24 | ||
|
|
35bd55f884 | ||
|
|
7202f0122d | ||
|
|
19edf86751 | ||
|
|
28857220f3 | ||
|
|
8d1d9697c1 | ||
|
|
6eb2b76d9f | ||
|
|
b674376433 | ||
|
|
9c24deb5aa | ||
|
|
88a6fc31a1 | ||
|
|
f791d47845 | ||
|
|
d6b0284da1 | ||
|
|
0f2bd0a10e | ||
|
|
41c28c21df | ||
|
|
67d3562659 | ||
|
|
770b238f70 | ||
|
|
305454b802 | ||
|
|
18ace33231 | ||
|
|
af803b4ead | ||
|
|
210f4d4aee | ||
|
|
5a045e7ac4 | ||
|
|
cc2a754425 | ||
|
|
e44e39bc2c | ||
|
|
48c1d12d86 | ||
|
|
195d7335f8 | ||
|
|
941ccfeb79 | ||
|
|
eb71fd9bd2 | ||
|
|
039155a607 | ||
|
|
9fe2e8b9b9 | ||
|
|
11b3a99314 | ||
|
|
932b03fd51 | ||
|
|
be8cf101e4 | ||
|
|
98e6cd1dfc | ||
|
|
c3adcf4d81 | ||
|
|
82bf56cee0 | ||
|
|
21c714008c | ||
|
|
d377702d09 | ||
|
|
32f0572ab3 | ||
|
|
89952f20c2 | ||
|
|
8bab891231 | ||
|
|
0f6cffc9bf | ||
|
|
0aebc35a8b | ||
|
|
ec87a8ad3c | ||
|
|
6ff15db4da | ||
|
|
21b8a169ef | ||
|
|
32b7bfc2c9 | ||
|
|
e66ecb2be5 | ||
|
|
ddc46113bc | ||
|
|
3e80f95947 | ||
|
|
52ac7558c7 | ||
|
|
76c6d584df | ||
|
|
fa70faf386 | ||
|
|
4222e2d275 | ||
|
|
f95609a36d | ||
|
|
209d35d30e | ||
|
|
4da9d379c5 | ||
|
|
1c8bd79640 | ||
|
|
1d12977984 | ||
|
|
0f960b9ad4 | ||
|
|
87e4a6821a | ||
|
|
134828692a | ||
|
|
1b548e2beb | ||
|
|
30602b6ff7 | ||
|
|
09b0ca83ae | ||
|
|
091b1f100e | ||
|
|
c7a3a0a329 | ||
|
|
4d7e138e09 | ||
|
|
d909f593a7 | ||
|
|
266b808c4a | ||
|
|
bc936ebf20 | ||
|
|
32b3167697 | ||
|
|
f47e1f59fe | ||
|
|
e4cdc6b85a | ||
|
|
d23719c2a8 | ||
|
|
652d00ee72 | ||
|
|
f8a13302b1 | ||
|
|
8aac67b665 | ||
|
|
8ce4e13646 | ||
|
|
80d03e1cbc | ||
|
|
d300d7c0fc | ||
|
|
fbcee9a425 | ||
|
|
bf5e44ed9e | ||
|
|
d56ffd9961 | ||
|
|
adca267cfc | ||
|
|
75dac873dc | ||
|
|
84eed2d7c4 | ||
|
|
f5e342f7c5 | ||
|
|
23db16917c | ||
|
|
077f0120b7 | ||
|
|
1545d9782b | ||
|
|
62dea78e65 | ||
|
|
309ebd6805 | ||
|
|
3e3945461d | ||
|
|
d99837df61 | ||
|
|
fc37ae1b95 | ||
|
|
1a07cb6a01 | ||
|
|
3d6e1d0c84 | ||
|
|
5cd0613398 | ||
|
|
b011556841 | ||
|
|
2d0b499a14 | ||
|
|
210ac67701 | ||
|
|
6ff8ee69f2 | ||
|
|
16c80cbf4b | ||
|
|
d02ce3cd8f | ||
|
|
df639be579 | ||
|
|
86678b0871 | ||
|
|
90be659c13 | ||
|
|
c51c900d1c | ||
|
|
ca5d9bae11 | ||
|
|
cba8eb7632 | ||
|
|
119faa5305 | ||
|
|
32c38fd9fa | ||
|
|
fd2d22564c | ||
|
|
48e8fd2154 | ||
|
|
e7cf3b076d | ||
|
|
37bff7df1e | ||
|
|
9b04663cd8 | ||
|
|
e3321ebe2f | ||
|
|
e2f99d1cf9 | ||
|
|
3f08ed3e2d | ||
|
|
444462ae53 | ||
|
|
5017f1c217 | ||
|
|
d5aaba3546 | ||
|
|
d511f4f1f2 | ||
|
|
5a14712841 | ||
|
|
383be573c9 | ||
|
|
66ede34b92 | ||
|
|
e482a62fe8 | ||
|
|
e1c6f60726 | ||
|
|
bfc54bf9de | ||
|
|
812a2aaa69 | ||
|
|
08a1e5aa6b | ||
|
|
566efbc68b | ||
|
|
66e74bb702 | ||
|
|
9a84b0abe5 | ||
|
|
ddc77b332d | ||
|
|
2cff52f5c7 | ||
|
|
3a28263099 | ||
|
|
822e8a8066 | ||
|
|
ba0ff40aba | ||
|
|
5f64d2dd9f | ||
|
|
10eb88cde1 | ||
|
|
aebd62317b | ||
|
|
305762e797 | ||
|
|
fb0f9c3bf3 | ||
|
|
f506cb136e | ||
|
|
adb020dfc2 | ||
|
|
972d4723ed | ||
|
|
fe8749e7b2 | ||
|
|
48c3bad336 | ||
|
|
212a358a6a | ||
|
|
02d49dca2e | ||
|
|
cf1c2c39f4 | ||
|
|
f7c4e23eb3 | ||
|
|
202913179c | ||
|
|
c0a13231ad | ||
|
|
5b34685cd4 | ||
|
|
d1daa6d434 | ||
|
|
9d9ef9b514 | ||
|
|
be529d0b71 | ||
|
|
68c8cc9d54 | ||
|
|
81114acfa2 | ||
|
|
e882cb15f5 | ||
|
|
ae7ea4fbd4 | ||
|
|
1653c18c55 | ||
|
|
3e5671f39e | ||
|
|
2438da6e38 | ||
|
|
79b960bde7 | ||
|
|
11554722ed | ||
|
|
a4e2b9f68c | ||
|
|
823d12fa70 | ||
|
|
51c89bdc88 | ||
|
|
9e107c7a3a | ||
|
|
9b33169fcc | ||
|
|
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 | ||
|
|
f9513d3615 | ||
|
|
c72e01687f | ||
|
|
022b3860eb | ||
|
|
b09dcd6f47 | ||
|
|
eee72bceb6 | ||
|
|
7b3a7816f1 | ||
|
|
403eb59cfd | ||
|
|
220b67b440 | ||
|
|
b6d9ca8dbb | ||
|
|
1c955e5da3 | ||
|
|
9e9158ce81 | ||
|
|
ad4e6560d6 | ||
|
|
71479a05e7 | ||
|
|
7ec13d80bd | ||
|
|
fd2aa16c60 | ||
|
|
7831521bc5 | ||
|
|
6193fc8d3e | ||
|
|
91c0fd1165 | ||
|
|
f85cde5fea | ||
|
|
2f34b26602 | ||
|
|
189ccbce49 | ||
|
|
3534466a58 | ||
|
|
3e07541fd5 | ||
|
|
932509a877 | ||
|
|
f3e7964262 | ||
|
|
9b0429c141 | ||
|
|
7a3e153319 | ||
|
|
5dda8cac55 | ||
|
|
d6675fe86d | ||
|
|
918790cad4 | ||
|
|
80b8a0b834 | ||
|
|
817c5b0e3c | ||
|
|
b4426e48db | ||
|
|
49b8414edf | ||
|
|
99ae657c45 | ||
|
|
a9c1d6a170 | ||
|
|
409a8e2911 | ||
|
|
08c2f99b21 | ||
|
|
3247057394 | ||
|
|
d1fe5c013c | ||
|
|
d9429418e9 | ||
|
|
aa89b6f13c | ||
|
|
7986f2ab46 | ||
|
|
936f538343 | ||
|
|
0310d23eb4 | ||
|
|
392c473839 | ||
|
|
84502bff4a | ||
|
|
b42daead36 | ||
|
|
314efc87f6 | ||
|
|
3f20fac752 | ||
|
|
f916008a3b | ||
|
|
1a94c4cb7c | ||
|
|
937fa23569 | ||
|
|
be1ecf306a | ||
|
|
8ebb2f85ed | ||
|
|
116679a5c9 | ||
|
|
bf95af4e58 | ||
|
|
8a709af86f | ||
|
|
46c849ea9e | ||
|
|
49b8a8c6d7 | ||
|
|
88b36becbb | ||
|
|
e800159b1e | ||
|
|
da2902dd67 | ||
|
|
09cc7ca646 | ||
|
|
e1d6defaf6 | ||
|
|
0c10027fa4 | ||
|
|
0b3a12ce33 | ||
|
|
0ea8719dbf | ||
|
|
8fc6d64219 | ||
|
|
47988a3707 | ||
|
|
3d06ee6aec | ||
|
|
49c67bd86d | ||
|
|
2b1007f7af | ||
|
|
436a22f0c7 | ||
|
|
e3fdc6854d | ||
|
|
62bc84920a | ||
|
|
7b67ea19d8 | ||
|
|
aa93b6a6d2 | ||
|
|
6fc807e3ce | ||
|
|
605927359d | ||
|
|
9f870572f4 | ||
|
|
aec0583a89 | ||
|
|
db95fe5147 | ||
|
|
a21df99b0b | ||
|
|
79de5d09c7 | ||
|
|
0d1265d533 | ||
|
|
797a0ce498 | ||
|
|
494673a371 | ||
|
|
2299d0b89c | ||
|
|
c5806799a4 | ||
|
|
f44d03c4c7 | ||
|
|
b7666cca6d | ||
|
|
3568799c32 | ||
|
|
47a8427448 | ||
|
|
2899291162 | ||
|
|
a390734890 | ||
|
|
6995e86752 | ||
|
|
dbd2b0ae51 | ||
|
|
f9141a7f4f | ||
|
|
15b80cf48f | ||
|
|
030a0a20da | ||
|
|
a1f2e0f424 | ||
|
|
581db06f0f | ||
|
|
93ffc9d67b | ||
|
|
e6c1117a11 | ||
|
|
dcf233e7c2 | ||
|
|
47437ce496 | ||
|
|
aeee5a2e9c | ||
|
|
9b81c60f1e | ||
|
|
72e745c1f4 | ||
|
|
3ffedc83fa | ||
|
|
017096df73 | ||
|
|
f3507c4046 |
@@ -1,6 +0,0 @@
|
|||||||
CookieMonster.js
|
|
||||||
CookieMonster.user.js
|
|
||||||
src/*.js
|
|
||||||
!src/CookieMonster.js
|
|
||||||
!src/*/*
|
|
||||||
dist/*
|
|
||||||
40
.eslintrc.js
40
.eslintrc.js
@@ -1,40 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2021: true,
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
Game: 'writable',
|
|
||||||
l: 'readonly',
|
|
||||||
b64_to_utf8: 'readonly',
|
|
||||||
utf8_to_b64: 'readonly',
|
|
||||||
realAudio: 'readonly',
|
|
||||||
BeautifyAll: 'readonly',
|
|
||||||
CM: 'writable',
|
|
||||||
unsafeWindow: 'readonly',
|
|
||||||
},
|
|
||||||
extends: 'airbnb-base',
|
|
||||||
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-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',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
48
.eslintrc.json
Normal file
48
.eslintrc.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"Game": "writable",
|
||||||
|
"l": "readonly",
|
||||||
|
"b64_to_utf8": "readonly",
|
||||||
|
"utf8_to_b64": "readonly",
|
||||||
|
"BeautifyAll": "readonly",
|
||||||
|
"PlaySound": "readonly"
|
||||||
|
},
|
||||||
|
"extends": ["airbnb-base", "prettier"],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 12
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["src/**/*.{ts,tsx}"],
|
||||||
|
"extends": ["plugin:@typescript-eslint/recommended"],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"rules": {
|
||||||
|
"import/extensions": "off", // To allow importing .ts without errors
|
||||||
|
"import/no-unresolved": "off" // To allow importing .ts without errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ignorePatterns": ["*CookieMonster*.js", "dist/*", "node_modules/*"],
|
||||||
|
"rules": {
|
||||||
|
"import/no-mutable-exports": "off", // We need to this throughout Cookie Monster
|
||||||
|
"no-plusplus": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allowForLoopAfterthoughts": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"func-names": "off", // To allow unnamed arrow functions
|
||||||
|
"prefer-destructuring": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"object": true,
|
||||||
|
"array": false
|
||||||
|
}
|
||||||
|
] // Importing arrays and then destructuring them seems to fail
|
||||||
|
}
|
||||||
|
}
|
||||||
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
|
||||||
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -19,5 +19,8 @@ If applicable, add screenshots to help explain your problem.
|
|||||||
|
|
||||||
**Save file**
|
**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
|
||||||
```
|
```
|
||||||
|
**Browser**
|
||||||
|
Please specify your current browser. This can help find/fix the bug!
|
||||||
|
|||||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
37
.github/workflows/CI.yml
vendored
37
.github/workflows/CI.yml
vendored
@@ -1,31 +1,32 @@
|
|||||||
name: CI
|
name: CI
|
||||||
on: pull_request
|
on: pull_request
|
||||||
jobs:
|
jobs:
|
||||||
Check_ESLint:
|
Check_linting_test_and_build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
- name: Run ESLint
|
- name: Run ESLint
|
||||||
|
run: npx eslint src
|
||||||
|
- name: Run Mocha tests
|
||||||
|
run: npx mocha
|
||||||
|
- name: Check if CookieMonsterDev.js is built correctly
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npx webpack -o ./tmp --env production
|
||||||
npx eslint src
|
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 tmp/CookieMonsterDev.js); then
|
||||||
Check_main_file:
|
echo '### SUCCESS: CookieMonsterDev is correctly built! ###'
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Check if CookieMonster.js is built correctly
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npx webpack -o ./test --env production
|
|
||||||
if cmp <(head -n 2 dist/CookieMonster.js) <(head -n 2 test/CookieMonster.js); then
|
|
||||||
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
|
||||||
else
|
else
|
||||||
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to run "npm run build" after saving all your changes! ###'
|
echo '### WARNING: CookieMonsterDev.js does not seem to be correct. Make sure to run "npm run build" after saving all your changes! ###'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if cmp <(head -n 2 CookieMonster.js) <(head -n 2 test/CookieMonster.js); then
|
- name: Check if CookieMonster.js is built correctly
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 dist/CookieMonster.js); then
|
||||||
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
||||||
else
|
else
|
||||||
echo '### WARNING: Make sure to move the file from the /dist folder to the main folder. Otherwise Github Pages won't notice it ###'
|
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to copy CookieMonsterDev.js into CookieMonster.js before merging to master! ###'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
16
.github/workflows/publish-dev.yml
vendored
Normal file
16
.github/workflows/publish-dev.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Publish
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "dev"
|
||||||
|
jobs:
|
||||||
|
publish-dev:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: everlytic/branch-merge@1.1.0
|
||||||
|
with:
|
||||||
|
github_token: ${{ github.token }}
|
||||||
|
source_ref: 'dev'
|
||||||
|
target_branch: 'gh-pages'
|
||||||
|
commit_message_template: '[Automated] Merge {source_ref} into {target_branch}'
|
||||||
4
.mocharc.json
Normal file
4
.mocharc.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"recursive": true,
|
||||||
|
"require": ["esm", "ts-node/register"]
|
||||||
|
}
|
||||||
5
.prettierrc.json
Normal file
5
.prettierrc.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "all"
|
||||||
|
}
|
||||||
@@ -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
@@ -4,16 +4,10 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
const readyCheck = setInterval(() => {
|
const readyCheck = setInterval(() => {
|
||||||
const Game = unsafeWindow.Game;
|
const Game = unsafeWindow.Game;
|
||||||
|
|
||||||
if (
|
if (typeof Game !== 'undefined' && typeof Game.ready !== 'undefined' && Game.ready) {
|
||||||
typeof Game !== "undefined" &&
|
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
||||||
typeof Game.ready !== "undefined" &&
|
clearInterval(readyCheck);
|
||||||
Game.ready
|
}
|
||||||
) {
|
|
||||||
Game.LoadMod(
|
|
||||||
"https://aktanusa.github.io/CookieMonster/CookieMonster.js"
|
|
||||||
);
|
|
||||||
clearInterval(readyCheck);
|
|
||||||
}
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014 Aktanusa
|
Copyright (c) 2021 CookieMonsterTeam
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
48
README.md
48
README.md
@@ -1,30 +1,36 @@
|
|||||||

|
[](https://github.com/CookieMonsterTeam/CookieMonster/actions/workflows/CI.yml)
|
||||||
## Cookie Monster
|
## Cookie Monster
|
||||||
|
|
||||||
**Cookie Monster** is an addon you can load into Cookie Clicker, that 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.
|
**Cookie Monster** is an addon you can load into Cookie Clicker, that 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.
|
||||||
The mod helps you to *whichever* degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
The mod helps you to *whichever* degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
||||||
|
|
||||||
### Current version
|
### Current version
|
||||||
The `gh-pages` branch hosts the latest version intended for general users. All development and pull requests should target the `dev` branch.
|
The `master` branch hosts the latest production version intended for general users.
|
||||||
|
All development and pull requests should target the `dev` branch.
|
||||||
|
Github Pages is hosted from the `gh-pages` branch
|
||||||
|
|
||||||
### What it does
|
### What it does
|
||||||
|
|
||||||
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. This indicates how much a building is worth by using the following formula:
|
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. CM will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, CM will know and highlight that building's value. CM uses the following formula to calculate the PP:
|
||||||
|
|
||||||
```
|
```
|
||||||
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
||||||
```
|
```
|
||||||
|
|
||||||
Cookie Monster also indicates the time left before being able to buy an upgrade or building, and takes it into consideration. It will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, it will know and highlight that building's value.
|
If the relevant option is enabled, CM will color-code each of them based on their value. CM compares the PP across all possible buy options: if a buy 10 option is better than any of the buy 1 options Cookie Monster will colour them accordingly. Note that sometimes it is better to buy 10 of a building than to buy only 1, CM will also indicate this!
|
||||||
|
|
||||||
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:
|
<details>
|
||||||
|
<summary>The following standard colours are used:</summary>
|
||||||
|
|
||||||
|
* 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
|
||||||
|
|
||||||
* Light Blue: (upgrades) This item has a better PP than any building
|
</details>
|
||||||
* 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.
|
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
@@ -36,7 +42,7 @@ Copy this code and save it as a bookmark. Paste it in the URL section. To activa
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
javascript: (function () {
|
javascript: (function () {
|
||||||
Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonster.js');
|
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
||||||
}());
|
}());
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -50,24 +56,30 @@ If you'd rather use the addon as a [userscript](https://en.wikipedia.org/wiki/Us
|
|||||||
|
|
||||||
## Bugs and suggestions
|
## Bugs and suggestions
|
||||||
|
|
||||||
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/Aktanusa/CookieMonster/issues) for easier tracking. This allows us to close issues once they're fixed.
|
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/CookieMonsterTeam/CookieMonster/issues) for easier tracking. This allows us to close issues once they're fixed.
|
||||||
|
|
||||||
Before submitting a bug, make sure to give a shot at the latest version of the addon on the `dev` branch. This version can be tested by copying the `CookieMonster.js` file of the dev branch into your console. If the bug is still here, you can submit an issue for it. Please do so by using the bug report template.
|
Before submitting a bug, make sure to give a shot at the latest version of the addon on the `dev` branch. This version can be tested by copying the `CookieMonsterDev.js` file of the dev branch into your console. You can also load the dev-version by using `https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonsterDev.js` to load the mod. If the bug is still here, you can submit an issue for it. Please do so by using the bug report template.
|
||||||
|
|
||||||
All suggestions are welcome, even the smallest ones.
|
All suggestions are welcome, even the smallest ones.
|
||||||
|
|
||||||
|
## For developers
|
||||||
|
|
||||||
|
Cookie Monster exposes some of the data it creates to the global scope. This data can be found in the `CookieMonsterData` object after loading Cookie Monster.
|
||||||
|
|
||||||
|
Currently we exposes relevant data for buildings and upgrades (PP, colour and bonus income). If you would like us to add any aditional data, please feel free to open an issue or create a PR doing so!
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
To contribute you can fork and clone the repository and run `npm install`.
|
To contribute you can fork and clone the repository and run `npm install`.
|
||||||
|
|
||||||
Please also remember to run `npm run build` after saving all your changes to build the final `CookieMonster.js` file.
|
Please also remember to run `npm run build` after saving all your changes to build the final `CookieMonsterDev.js` file.
|
||||||
|
|
||||||
|
Before pushing a new version to master and Github pages copy the `Dev` files into the normal files.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||||
* **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now)
|
|
||||||
* **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat
|
|
||||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||||
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||||
|
|||||||
5
dist/CookieMonster.js
vendored
5
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
3
dist/CookieMonsterDev.js
vendored
Normal file
3
dist/CookieMonsterDev.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
dist/CookieMonsterDev.js.LICENSE.txt
vendored
Normal file
10
dist/CookieMonsterDev.js.LICENSE.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* jscolor - JavaScript Color Picker
|
||||||
|
*
|
||||||
|
* @link http://jscolor.com
|
||||||
|
* @license For open source use: GPLv3
|
||||||
|
* For commercial use: JSColor Commercial License
|
||||||
|
* @author Jan Odvarko - East Desire
|
||||||
|
*
|
||||||
|
* See usage examples at http://jscolor.com/examples/
|
||||||
|
*/
|
||||||
1
dist/CookieMonsterDev.js.map
vendored
Normal file
1
dist/CookieMonsterDev.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
12016
package-lock.json
generated
12016
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
130
package.json
130
package.json
@@ -1,63 +1,75 @@
|
|||||||
{
|
{
|
||||||
"name": "cookiemonster-mod",
|
"name": "cookiemonster-mod",
|
||||||
"version": "2.031.5",
|
"version": "2.031.7",
|
||||||
"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.",
|
"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",
|
"main": "CookieMonster.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Cookie Clicker",
|
"Cookie Clicker",
|
||||||
"javascript",
|
"javascript",
|
||||||
"mod",
|
"mod",
|
||||||
"Dashnet",
|
"Dashnet",
|
||||||
"Orteil"
|
"Orteil"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"eslint_src": "eslint src",
|
"eslint-src": "eslint src test",
|
||||||
"build": "run-s eslint_src pack_prod remove_comment",
|
"build": "run-s eslint-src test pack-prod",
|
||||||
"build_test": "run-s pack_dev",
|
"build-test": "run-s pack-dev",
|
||||||
"pack_prod": "webpack --env production",
|
"pack-prod": "webpack --env production",
|
||||||
"pack_dev": "webpack",
|
"pack-dev": "webpack",
|
||||||
"remove_comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
"test": "mocha"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/CookieMonsterTeam/CookieMonster"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "Aktanusa",
|
||||||
|
"email": "chanam.geo@yahoo.com"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Daniël van Noord",
|
||||||
|
"email": "13665637+DanielNoord@users.noreply.github.com"
|
||||||
},
|
},
|
||||||
"repository": {
|
{
|
||||||
"type": "git",
|
"name": "Aran Leite",
|
||||||
"url": "git+https://github.com/Aktanusa/CookieMonster.git"
|
"email": "hyoretsu@gmail.com",
|
||||||
},
|
"url": "https://www.linkedin.com/in/aranleite"
|
||||||
"license": "MIT",
|
|
||||||
"author": {
|
|
||||||
"name": "Aktanusa",
|
|
||||||
"email": "chanam.geo@yahoo.com"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Daniël van Noord",
|
|
||||||
"email": "13665637+DanielNoord@users.noreply.github.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Aran Leite",
|
|
||||||
"email": "hyoretsu@gmail.com",
|
|
||||||
"url": "https://www.linkedin.com/in/aranleite"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/Aktanusa/CookieMonster/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/Aktanusa/CookieMonster#readme",
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "^7.19.0",
|
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
|
||||||
"eslint-plugin-import": "^2.22.1",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"webpack": "^5.24.4",
|
|
||||||
"webpack-cli": "^4.5.0"
|
|
||||||
},
|
|
||||||
"ccrepo": {
|
|
||||||
"icon": [
|
|
||||||
10,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"name": "Cookie Monster"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@eastdesire/jscolor": "^2.4.5"
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/CookieMonsterTeam/CookieMonster/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/CookieMonsterTeam/CookieMonster#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/chai": "^4.2.19",
|
||||||
|
"@types/mocha": "^8.2.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.27.0",
|
||||||
|
"@typescript-eslint/parser": "^4.27.0",
|
||||||
|
"chai": "^4.3.4",
|
||||||
|
"eslint": "^7.29.0",
|
||||||
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"eslint-plugin-import": "^2.23.4",
|
||||||
|
"esm": "^3.2.25",
|
||||||
|
"mocha": "^8.4.0",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
|
"prettier": "2.3.1",
|
||||||
|
"ts-loader": "^9.2.3",
|
||||||
|
"ts-node": "^10.0.0",
|
||||||
|
"typescript": "^4.3.4",
|
||||||
|
"webpack": "^5.39.1",
|
||||||
|
"webpack-cli": "^4.7.2"
|
||||||
|
},
|
||||||
|
"ccrepo": {
|
||||||
|
"icon": [
|
||||||
|
10,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"name": "Cookie Monster"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@eastdesire/jscolor": "^2.4.5"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
ChoEggDiff, ClicksDiff, CookiesDiff, WrinkDiff, WrinkFattestDiff,
|
ChoEggDiff, // eslint-disable-line no-unused-vars
|
||||||
|
ClicksDiff, // eslint-disable-line no-unused-vars
|
||||||
|
CookiesDiff, // eslint-disable-line no-unused-vars
|
||||||
|
WrinkDiff, // eslint-disable-line no-unused-vars
|
||||||
|
WrinkFattestDiff, // eslint-disable-line no-unused-vars
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,34 +16,43 @@ import {
|
|||||||
* @method calcAverage(timePeriod) Returns the average over the specified timeperiod
|
* @method calcAverage(timePeriod) Returns the average over the specified timeperiod
|
||||||
*/
|
*/
|
||||||
export class CMAvgQueue {
|
export class CMAvgQueue {
|
||||||
constructor(maxLength) {
|
constructor(maxLength) {
|
||||||
this.maxLength = maxLength;
|
this.maxLength = maxLength;
|
||||||
this.queue = [];
|
this.queue = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
addLatest(newValue) {
|
addLatest(newValue) {
|
||||||
if (this.queue.push(newValue) > this.maxLength) {
|
if (this.queue.push(newValue) > this.maxLength) {
|
||||||
this.queue.shift();
|
this.queue.shift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions returns the average of the values in the queue
|
* This functions returns the average of the values in the queue
|
||||||
* @param {number} timePeriod The period in seconds to computer average over
|
* @param {number} timePeriod The period in seconds to computer average over
|
||||||
* @returns {number} ret The average
|
* @returns {number} ret The average
|
||||||
*/
|
*/
|
||||||
calcAverage(timePeriod) {
|
calcAverage(timePeriod) {
|
||||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
let time = timePeriod;
|
||||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
if (time > this.maxLength) time = this.maxLength;
|
||||||
let ret = 0;
|
if (time > this.queue.length) time = this.queue.length;
|
||||||
for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) {
|
let ret = 0;
|
||||||
ret += this.queue[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;
|
if (ret === 0) {
|
||||||
}
|
return 0;
|
||||||
return ret / timePeriod;
|
}
|
||||||
}
|
return ret / time;
|
||||||
|
}
|
||||||
|
|
||||||
|
calcSum(timePeriod) {
|
||||||
|
let time = timePeriod;
|
||||||
|
if (time > this.maxLength) time = this.maxLength;
|
||||||
|
if (time > this.queue.length) time = this.queue.length;
|
||||||
|
if (time === 0) return 0;
|
||||||
|
return this.queue.slice(-time).reduce((a, b) => a + b, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,9 +60,9 @@ export class CMAvgQueue {
|
|||||||
* Called by CM.Cache.InitCache()
|
* Called by CM.Cache.InitCache()
|
||||||
*/
|
*/
|
||||||
export function InitCookiesDiff() {
|
export function InitCookiesDiff() {
|
||||||
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||||
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||||
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||||
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||||
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]);
|
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,28 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
|
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
CacheAverageClicks, CacheAverageCPS, CacheAverageGainBank, CacheAverageGainChoEgg, CacheAverageGainWrink, CacheAverageGainWrinkFattest, CacheAvgCPSWithChoEgg, CacheLastChoEgg, CacheLastClicks, CacheLastCookies, CacheLastCPSCheck, CacheLastWrinkCookies, CacheLastWrinkFattestCookies, CacheRealCookiesEarned, CacheSellForChoEgg, CacheWrinklersFattest, CacheWrinklersTotal, ChoEggDiff, ClicksDiff, CookiesDiff, WrinkDiff, WrinkFattestDiff,
|
CacheAverageClicks, // eslint-disable-line no-unused-vars
|
||||||
|
CacheAverageCPS,
|
||||||
|
CacheAverageGainBank,
|
||||||
|
CacheAverageGainChoEgg,
|
||||||
|
CacheAverageGainWrink,
|
||||||
|
CacheAverageGainWrinkFattest,
|
||||||
|
CacheAvgCPSWithChoEgg, // eslint-disable-line no-unused-vars
|
||||||
|
CacheLastChoEgg,
|
||||||
|
CacheLastClicks,
|
||||||
|
CacheLastCookies,
|
||||||
|
CacheLastCPSCheck,
|
||||||
|
CacheLastWrinkCookies,
|
||||||
|
CacheLastWrinkFattestCookies,
|
||||||
|
CacheRealCookiesEarned, // eslint-disable-line no-unused-vars
|
||||||
|
CacheSellForChoEgg,
|
||||||
|
CacheWrinklersFattest,
|
||||||
|
CacheWrinklersTotal,
|
||||||
|
ChoEggDiff,
|
||||||
|
ClicksDiff,
|
||||||
|
CookiesDiff,
|
||||||
|
WrinkDiff,
|
||||||
|
WrinkFattestDiff,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,53 +34,56 @@ import {
|
|||||||
* @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS
|
* @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS
|
||||||
*/
|
*/
|
||||||
export default function CacheAvgCPS() {
|
export default function CacheAvgCPS() {
|
||||||
const currDate = Math.floor(Date.now() / 1000);
|
const currDate = Math.floor(Date.now() / 1000);
|
||||||
// Only calculate every new second
|
// Only calculate every new second
|
||||||
if ((Game.T / Game.fps) % 1 === 0) {
|
if ((Game.T / Game.fps) % 1 === 0) {
|
||||||
let choEggTotal = Game.cookies + CacheSellForChoEgg;
|
let choEggTotal = Game.cookies + CacheSellForChoEgg;
|
||||||
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
|
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
|
||||||
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
||||||
choEggTotal *= 0.05;
|
choEggTotal *= 0.05;
|
||||||
|
|
||||||
// Add recent gains to AvgQueue's
|
// Add recent gains to AvgQueue's
|
||||||
const timeDiff = currDate - CacheLastCPSCheck;
|
const timeDiff = currDate - CacheLastCPSCheck;
|
||||||
const bankDiffAvg = Math.max(0, (Game.cookies - CacheLastCookies)) / timeDiff;
|
const bankDiffAvg = Math.max(0, Game.cookies - CacheLastCookies) / timeDiff;
|
||||||
const wrinkDiffAvg = Math.max(0, (CacheWrinklersTotal - CacheLastWrinkCookies)) / timeDiff;
|
const wrinkDiffAvg = Math.max(0, CacheWrinklersTotal - CacheLastWrinkCookies) / timeDiff;
|
||||||
const wrinkFattestDiffAvg = Math.max(0, (CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies)) / timeDiff;
|
const wrinkFattestDiffAvg =
|
||||||
const choEggDiffAvg = Math.max(0, (choEggTotal - CacheLastChoEgg)) / timeDiff;
|
Math.max(0, CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies) / timeDiff;
|
||||||
const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff;
|
const choEggDiffAvg = Math.max(0, choEggTotal - CacheLastChoEgg) / timeDiff;
|
||||||
for (let i = 0; i < timeDiff; i++) {
|
const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff;
|
||||||
CookiesDiff.addLatest(bankDiffAvg);
|
for (let i = 0; i < timeDiff; i++) {
|
||||||
WrinkDiff.addLatest(wrinkDiffAvg);
|
CookiesDiff.addLatest(bankDiffAvg);
|
||||||
WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
WrinkDiff.addLatest(wrinkDiffAvg);
|
||||||
ChoEggDiff.addLatest(choEggDiffAvg);
|
WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
||||||
ClicksDiff.addLatest(clicksDiffAvg);
|
ChoEggDiff.addLatest(choEggDiffAvg);
|
||||||
}
|
ClicksDiff.addLatest(clicksDiffAvg);
|
||||||
|
}
|
||||||
|
|
||||||
// Store current data for next loop
|
// Store current data for next loop
|
||||||
CacheLastCPSCheck = currDate;
|
CacheLastCPSCheck = currDate;
|
||||||
CacheLastCookies = Game.cookies;
|
CacheLastCookies = Game.cookies;
|
||||||
CacheLastWrinkCookies = CacheWrinklersTotal;
|
CacheLastWrinkCookies = CacheWrinklersTotal;
|
||||||
CacheLastWrinkFattestCookies = CacheWrinklersFattest[0];
|
CacheLastWrinkFattestCookies = CacheWrinklersFattest[0];
|
||||||
CacheLastChoEgg = choEggTotal;
|
CacheLastChoEgg = choEggTotal;
|
||||||
CacheLastClicks = Game.cookieClicks;
|
CacheLastClicks = Game.cookieClicks;
|
||||||
|
|
||||||
// Get average gain over period of cpsLength seconds
|
// Get average gain over period of cpsLength seconds
|
||||||
const cpsLength = CookieTimes[CMOptions.AvgCPSHist];
|
const cpsLength = CookieTimes[CMOptions.AvgCPSHist];
|
||||||
CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength);
|
CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength);
|
||||||
CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength);
|
CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength);
|
||||||
CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength);
|
CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength);
|
||||||
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
|
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
|
||||||
CacheAverageCPS = CacheAverageGainBank;
|
CacheAverageCPS = CacheAverageGainBank;
|
||||||
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink;
|
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) {
|
if (choEgg || CMOptions.CalcWrink === 0) {
|
||||||
CacheAvgCPSWithChoEgg = CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
CacheAvgCPSWithChoEgg =
|
||||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
||||||
|
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||||
|
|
||||||
CacheAverageClicks = ClicksDiff.calcAverage(ClickTimes[CMOptions.AvgClicksHist]);
|
// eslint-disable-next-line no-unused-vars
|
||||||
}
|
CacheAverageClicks = ClicksDiff.calcAverage(ClickTimes[CMOptions.AvgClicksHist]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||||
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData';
|
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the current Wrinkler CPS multiplier
|
* This functions caches the current Wrinkler CPS multiplier
|
||||||
@@ -8,18 +7,23 @@ import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAn
|
|||||||
* @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect)
|
* @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect)
|
||||||
*/
|
*/
|
||||||
export default function CacheCurrWrinklerCPS() {
|
export default function CacheCurrWrinklerCPS() {
|
||||||
CacheCurrWrinklerCPSMult = 0;
|
CacheCurrWrinklerCPSMult = 0;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for (const i in Game.wrinklers) {
|
Object.keys(Game.wrinklers).forEach((i) => {
|
||||||
if (Game.wrinklers[i].phase === 2) count++;
|
if (Game.wrinklers[i].phase === 2) count += 1;
|
||||||
}
|
});
|
||||||
let godMult = 1;
|
let godMult = 1;
|
||||||
if (SimObjects.Temple.minigameLoaded) {
|
if (SimObjects.Temple.minigameLoaded) {
|
||||||
const godLvl = Game.hasGod('scorn');
|
const godLvl = Game.hasGod('scorn');
|
||||||
if (godLvl === 1) godMult *= 1.15;
|
if (godLvl === 1) godMult *= 1.15;
|
||||||
else if (godLvl === 2) godMult *= 1.1;
|
else if (godLvl === 2) godMult *= 1.1;
|
||||||
else if (godLvl === 3) godMult *= 1.05;
|
else if (godLvl === 3) godMult *= 1.05;
|
||||||
}
|
}
|
||||||
CacheCurrWrinklerCount = count;
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* @returns {number} mult The multiplier
|
* @returns {number} mult The multiplier
|
||||||
*/
|
*/
|
||||||
export default function GetCPSBuffMult() {
|
export default function GetCPSBuffMult() {
|
||||||
let mult = 1;
|
let mult = 1;
|
||||||
for (const i of Object.keys(Game.buffs)) {
|
Object.keys(Game.buffs).forEach((i) => {
|
||||||
if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS;
|
if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS;
|
||||||
}
|
});
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
||||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
|
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function calculates CPS without the Golden Switch as it might be needed in other functions
|
* This function calculates CPS without the Golden Switch as it might be needed in other functions
|
||||||
@@ -8,7 +7,7 @@ import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
|
|||||||
* It is called at the end of any functions that simulates certain behaviour
|
* It is called at the end of any functions that simulates certain behaviour
|
||||||
*/
|
*/
|
||||||
export default function CacheNoGoldSwitchCPS() {
|
export default function CacheNoGoldSwitchCPS() {
|
||||||
if (Game.Has('Golden switch [off]')) {
|
if (Game.Has('Golden switch [off]')) {
|
||||||
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
||||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
||||||
import { CacheSellForChoEgg } from '../VariablesAndData';
|
import { CacheSellForChoEgg } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the reward for selling the Chocolate egg
|
* This functions caches the reward for selling the Chocolate egg
|
||||||
@@ -8,18 +7,18 @@ import { CacheSellForChoEgg } from '../VariablesAndData';
|
|||||||
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
|
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
|
||||||
*/
|
*/
|
||||||
export default function CacheSellAllForChoEgg() {
|
export default function CacheSellAllForChoEgg() {
|
||||||
let sellTotal = 0;
|
let sellTotal = 0;
|
||||||
// Compute cookies earned by selling stock market goods
|
// Compute cookies earned by selling stock market goods
|
||||||
if (Game.Objects.Bank.minigameLoaded) {
|
if (Game.Objects.Bank.minigameLoaded) {
|
||||||
const marketGoods = Game.Objects.Bank.minigame.goods;
|
const marketGoods = Game.Objects.Bank.minigame.goods;
|
||||||
let goodsVal = 0;
|
let goodsVal = 0;
|
||||||
for (const i of Object.keys(marketGoods)) {
|
Object.keys(marketGoods).forEach((i) => {
|
||||||
const marketGood = marketGoods[i];
|
const marketGood = marketGoods[i];
|
||||||
goodsVal += marketGood.stock * marketGood.val;
|
goodsVal += marketGood.stock * marketGood.val;
|
||||||
}
|
});
|
||||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||||
}
|
}
|
||||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||||
sellTotal += SellBuildingsForChoEgg();
|
sellTotal += SellBuildingsForChoEgg();
|
||||||
CacheSellForChoEgg = sellTotal;
|
CacheSellForChoEgg = sellTotal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import { ClickTimes } from '../Disp/VariablesAndData';
|
||||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
||||||
import CacheAvgCPS from './CPS/CPS';
|
import CacheAvgCPS from './CPS/CPS';
|
||||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
||||||
@@ -9,25 +9,29 @@ import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
|||||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
||||||
import CacheSeasonSpec from './Stats/Reindeer';
|
import CacheSeasonSpec from './Stats/Reindeer';
|
||||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
|
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
|
||||||
import { HeavenlyChipsDiff } from './VariablesAndData';
|
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
||||||
|
import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions runs all cache-functions to generate all "full" cache
|
* This functions runs all cache-functions to generate all "full" cache
|
||||||
*/
|
*/
|
||||||
export default function InitCache() {
|
export default function InitCache() {
|
||||||
CacheDragonAuras();
|
CacheDragonAuras();
|
||||||
CacheWrinklers();
|
CacheWrinklers();
|
||||||
CacheStatsCookies();
|
CacheStatsCookies();
|
||||||
CacheGoldenAndWrathCookiesMults();
|
CacheGoldenAndWrathCookiesMults();
|
||||||
CacheChain();
|
CacheChain();
|
||||||
CacheAllMissingUpgrades();
|
CacheAllMissingUpgrades();
|
||||||
CacheSeasonSpec();
|
CacheSeasonSpec();
|
||||||
InitCookiesDiff();
|
InitCookiesDiff();
|
||||||
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS()
|
/** Used by CM.Cache.CacheHeavenlyChipsPS() */
|
||||||
CacheHeavenlyChipsPS();
|
HeavenlyChipsDiff = new CMAvgQueue(5);
|
||||||
CacheAvgCPS();
|
CacheAverageCookiesFromClicks = new CMAvgQueue(ClickTimes[ClickTimes.length - 1] * 20);
|
||||||
CacheIncome();
|
CacheHeavenlyChipsPS();
|
||||||
CacheBuildingsPrices();
|
AllAmountTillNextAchievement();
|
||||||
CachePP();
|
CacheAvgCPS();
|
||||||
|
CacheIncome();
|
||||||
|
CacheBuildingsPrices();
|
||||||
|
CachePP();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import FormatTime from '../Disp/BeautifyAndFormatting/FormatTime';
|
||||||
import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
|
||||||
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
||||||
import CacheAvgCPS from './CPS/CPS';
|
import CacheAvgCPS from './CPS/CPS';
|
||||||
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS';
|
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS';
|
||||||
import CachePP from './PP/PP';
|
import CachePP from './PP/PP';
|
||||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||||
import { CacheTimeTillNextPrestige } from './VariablesAndData';
|
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
||||||
|
import { CacheTimeTillNextPrestige } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,14 +13,19 @@ import CacheWrinklers from './Wrinklers/Wrinklers';
|
|||||||
* @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level
|
* @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level
|
||||||
*/
|
*/
|
||||||
export default function LoopCache() {
|
export default function LoopCache() {
|
||||||
// Update Wrinkler Bank
|
// Update Wrinkler Bank
|
||||||
CacheWrinklers();
|
CacheWrinklers();
|
||||||
|
|
||||||
CachePP();
|
CachePP();
|
||||||
CacheCurrWrinklerCPS();
|
AllAmountTillNextAchievement(false);
|
||||||
CacheAvgCPS();
|
CacheCurrWrinklerCPS();
|
||||||
CacheHeavenlyChipsPS();
|
CacheAvgCPS();
|
||||||
|
CacheHeavenlyChipsPS();
|
||||||
|
|
||||||
const cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset);
|
const cookiesToNext =
|
||||||
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS());
|
Game.HowManyCookiesReset(
|
||||||
|
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1,
|
||||||
|
) -
|
||||||
|
(Game.cookiesEarned + Game.cookiesReset);
|
||||||
|
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the currently selected Dragon Auras
|
* This functions caches the currently selected Dragon Auras
|
||||||
*/
|
*/
|
||||||
export default function CacheDragonAuras() {
|
export default function CacheDragonAuras() {
|
||||||
CacheDragonAura = Game.dragonAura;
|
CacheDragonAura = Game.dragonAura;
|
||||||
CacheDragonAura2 = Game.dragonAura2;
|
CacheDragonAura2 = Game.dragonAura2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +1,65 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
/** Functions related to the Dragon */
|
/** Functions related to the Dragon */
|
||||||
|
|
||||||
import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify';
|
||||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
||||||
import {
|
import { CacheCostDragonUpgrade, CacheLastDragonLevel } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
CacheCostDragonUpgrade, CacheDragonAura, CacheDragonAura2, CacheLastDragonLevel,
|
|
||||||
} from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
|
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
|
||||||
*/
|
*/
|
||||||
export default function CacheDragonCost() {
|
export default function CacheDragonCost() {
|
||||||
if (CacheLastDragonLevel !== Game.dragonLevel || SimDoSims) {
|
if (CacheLastDragonLevel !== Game.dragonLevel || SimDoSims) {
|
||||||
if (Game.dragonLevel < 25 && Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')) {
|
if (
|
||||||
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
|
Game.dragonLevel < 25 &&
|
||||||
const amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
|
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
||||||
if (target !== 'i') {
|
) {
|
||||||
target = target.replaceAll("'", '');
|
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
|
||||||
if (Game.Objects[target].amount < amount) {
|
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||||
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
.toString()
|
||||||
} else {
|
.match(/sacrifice\((.*?)\)/)[1];
|
||||||
let cost = 0;
|
if (target !== 'i') {
|
||||||
CopyData();
|
target = target.replaceAll("'", '');
|
||||||
for (let i = 0; i < amount; i++) {
|
if (Game.Objects[target].amount < amount) {
|
||||||
let price = SimObjects[target].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
|
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
||||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
} else {
|
||||||
price = Math.ceil(price);
|
let cost = 0;
|
||||||
cost += price;
|
CopyData();
|
||||||
SimObjects[target].amount--;
|
for (let i = 0; i < amount; i++) {
|
||||||
}
|
let price =
|
||||||
CacheCostDragonUpgrade = `Cost to rebuy: ${(cost)}`;
|
SimObjects[target].basePrice *
|
||||||
}
|
Game.priceIncrease **
|
||||||
} else {
|
Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
|
||||||
let cost = 0;
|
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||||
CopyData();
|
price = Math.ceil(price);
|
||||||
for (const j of Object.keys(Game.Objects)) {
|
cost += price;
|
||||||
target = j;
|
SimObjects[target].amount -= 1;
|
||||||
if (Game.Objects[target].amount < amount) {
|
}
|
||||||
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||||
break;
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < amount; i++) {
|
let cost = 0;
|
||||||
let price = SimObjects[target].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
|
CopyData();
|
||||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
Object.keys(Game.Objects).forEach((j) => {
|
||||||
price = Math.ceil(price);
|
target = j;
|
||||||
cost += price;
|
if (Game.Objects[target].amount < amount) {
|
||||||
SimObjects[target].amount--;
|
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
for (let i = 0; i < amount; i++) {
|
||||||
}
|
let price =
|
||||||
}
|
SimObjects[target].basePrice *
|
||||||
}
|
Game.priceIncrease **
|
||||||
CacheLastDragonLevel = Game.dragonLevel;
|
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 -= 1;
|
||||||
|
}
|
||||||
|
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CacheLastDragonLevel = Game.dragonLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||||
import { ColorGray } from '../../Disp/VariablesAndData';
|
import { ColourGray } from '../../Disp/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
CacheArrayOfPPs,
|
CacheMinPP, // eslint-disable-line no-unused-vars
|
||||||
CacheMaxPP, CacheMidPP, CacheMinPP, CacheObjects1, CacheObjects10, CacheObjects100,
|
CacheMinPPBulk, // eslint-disable-line no-unused-vars
|
||||||
|
CacheObjects1,
|
||||||
|
CacheObjects10,
|
||||||
|
CacheObjects100,
|
||||||
|
CachePPArray,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
import ColourOfPP from './ColourOfPP';
|
import ColourOfPP from './ColourOfPP';
|
||||||
|
|
||||||
@@ -13,14 +16,32 @@ import ColourOfPP from './ColourOfPP';
|
|||||||
* It saves all date in CM.Cache.Objects...
|
* It saves all date in CM.Cache.Objects...
|
||||||
* It is called by CM.Cache.CacheBuildingsPP()
|
* It is called by CM.Cache.CacheBuildingsPP()
|
||||||
*/
|
*/
|
||||||
function CacheBuildingsBulkPP(target) {
|
function CacheColour(target, amount) {
|
||||||
for (const i of Object.keys(target)) {
|
Object.keys(target).forEach((i) => {
|
||||||
if (Game.cookiesPs) {
|
if (CMOptions.PPRigidelMode && amount === 1) {
|
||||||
target[i].pp = (Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (target[i].price / target[i].bonus);
|
target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
||||||
} else target[i].pp = (target[i].price / target[i].bonus);
|
return;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
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 = ColourGray; // eslint-disable-line no-param-reassign
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
target[i].color = ColourOfPP(target[i], target[i].price);
|
function CachePP(target, amount) {
|
||||||
}
|
Object.keys(target).forEach((i) => {
|
||||||
|
const price = Game.Objects[i].getSumPrice(amount);
|
||||||
|
if (Game.cookiesPs) {
|
||||||
|
target[i].pp = // eslint-disable-line no-param-reassign
|
||||||
|
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs +
|
||||||
|
price / target[i].bonus;
|
||||||
|
} else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
|
||||||
|
if (!(CMOptions.PPRigidelMode && amount === 1))
|
||||||
|
CachePPArray.push([target[i].pp, amount, price]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,74 +49,30 @@ function CacheBuildingsBulkPP(target) {
|
|||||||
* It is called by CM.Cache.CachePP()
|
* It is called by CM.Cache.CachePP()
|
||||||
*/
|
*/
|
||||||
export default function CacheBuildingsPP() {
|
export default function CacheBuildingsPP() {
|
||||||
CacheMinPP = Infinity;
|
CacheMinPP = Infinity;
|
||||||
CacheMaxPP = 1;
|
CachePPArray = [];
|
||||||
CacheArrayOfPPs = [];
|
if (typeof CMOptions.PPExcludeTop === 'undefined') CMOptions.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||||
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
|
// Calculate PP and colors
|
||||||
if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) {
|
CachePP(CacheObjects1, 1);
|
||||||
for (const i of Object.keys(CacheObjects1)) {
|
CachePP(CacheObjects10, 10);
|
||||||
if (Game.cookiesPs) {
|
CachePP(CacheObjects100, 100);
|
||||||
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;
|
|
||||||
|
|
||||||
for (const i of Object.keys(CacheObjects1)) {
|
// Set CM.Cache.min to best non-excluded buidliung
|
||||||
target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice);
|
CachePPArray.sort((a, b) => a[0] - b[0]);
|
||||||
// Colour based on excluding certain top-buildings
|
let indexOfMin = CMOptions.PPExcludeTop;
|
||||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||||
if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray;
|
while (CachePPArray[indexOfMin][2] > Game.cookies) {
|
||||||
}
|
indexOfMin += 1;
|
||||||
}
|
if (CachePPArray.length === indexOfMin + 1) {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CacheMinPP = CachePPArray[indexOfMin][0];
|
||||||
|
CacheMinPPBulk = CachePPArray[indexOfMin][1];
|
||||||
|
|
||||||
|
CacheColour(CacheObjects1, 1);
|
||||||
|
CacheColour(CacheObjects10, 10);
|
||||||
|
CacheColour(CacheObjects100, 100);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||||
import {
|
import {
|
||||||
ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorYellow,
|
ColourBlue,
|
||||||
|
ColourGray,
|
||||||
|
ColourGreen,
|
||||||
|
ColourOrange,
|
||||||
|
ColourPurple,
|
||||||
|
ColourRed,
|
||||||
|
ColourYellow,
|
||||||
} from '../../Disp/VariablesAndData';
|
} 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
|
* This functions return the colour assosciated with the given pp value
|
||||||
@@ -13,23 +19,23 @@ import { CacheMaxPP, CacheMidPP, CacheMinPP } from '../VariablesAndData';
|
|||||||
* @returns {string} color The colour assosciated with the pp value
|
* @returns {string} color The colour assosciated with the pp value
|
||||||
*/
|
*/
|
||||||
export default function ColourOfPP(me, price) {
|
export default function ColourOfPP(me, price) {
|
||||||
let color = '';
|
let color = '';
|
||||||
// Colour based on PP
|
// Colour based on PP
|
||||||
if (me.pp <= 0 || me.pp === Infinity) color = ColorGray;
|
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray;
|
||||||
else if (me.pp < CacheMinPP) color = ColorBlue;
|
else if (me.pp < CacheMinPP) color = ColourBlue;
|
||||||
else if (me.pp === CacheMinPP) color = ColorGreen;
|
else if (me.pp === CacheMinPP) color = ColourGreen;
|
||||||
else if (me.pp === CacheMaxPP) color = ColorRed;
|
else if (me.pp < CachePPArray[10][0]) color = ColourYellow;
|
||||||
else if (me.pp > CacheMaxPP) color = ColorPurple;
|
else if (me.pp < CachePPArray[20][0]) color = ColourOrange;
|
||||||
else if (me.pp > CacheMidPP) color = ColorOrange;
|
else if (me.pp < CachePPArray[30][0]) color = ColourRed;
|
||||||
else color = ColorYellow;
|
else color = ColourPurple;
|
||||||
|
|
||||||
// Colour based on price in terms of CPS
|
// Colour based on price in terms of CPS
|
||||||
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
||||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColorBlue;
|
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColourBlue;
|
||||||
}
|
}
|
||||||
// Colour based on being able to purchase
|
// Colour based on being able to purchase
|
||||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||||
if (price - Game.cookies > 0) color = ColorRed;
|
if (price - Game.cookies > 0) color = ColourRed;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Section: Functions related to caching PP */
|
* Section: Functions related to caching PP */
|
||||||
|
|
||||||
|
import { CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades } from '../VariablesAndData';
|
||||||
import CacheBuildingsPP from './Building';
|
import CacheBuildingsPP from './Building';
|
||||||
import CacheUpgradePP from './Upgrade';
|
import CacheUpgradePP from './Upgrade';
|
||||||
|
|
||||||
@@ -9,6 +10,13 @@ import CacheUpgradePP from './Upgrade';
|
|||||||
* It is called by CM.Cache.LoopCache() and CM.Cache.InitCache()
|
* It is called by CM.Cache.LoopCache() and CM.Cache.InitCache()
|
||||||
*/
|
*/
|
||||||
export default function CachePP() {
|
export default function CachePP() {
|
||||||
CacheBuildingsPP();
|
CacheBuildingsPP();
|
||||||
CacheUpgradePP();
|
CacheUpgradePP();
|
||||||
|
window.CookieMonsterData.Objects1 = JSON.parse(JSON.stringify(CacheObjects1));
|
||||||
|
window.CookieMonsterData.Objects10 = JSON.parse(JSON.stringify(CacheObjects10));
|
||||||
|
window.CookieMonsterData.Objects100 = JSON.parse(JSON.stringify(CacheObjects100));
|
||||||
|
window.CookieMonsterData.Upgrades = [];
|
||||||
|
Object.entries(CacheUpgrades).forEach((i) => {
|
||||||
|
window.CookieMonsterData.Upgrades[i[0]] = JSON.parse(JSON.stringify(i[1]));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ import ColourOfPP from './ColourOfPP';
|
|||||||
* It is called by CM.Cache.CachePP()
|
* It is called by CM.Cache.CachePP()
|
||||||
*/
|
*/
|
||||||
export default function CacheUpgradePP() {
|
export default function CacheUpgradePP() {
|
||||||
for (const i of Object.keys(CacheUpgrades)) {
|
Object.keys(CacheUpgrades).forEach((i) => {
|
||||||
if (Game.cookiesPs) {
|
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);
|
CacheUpgrades[i].pp =
|
||||||
} else CacheUpgrades[i].pp = (Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus);
|
Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||||
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
|
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,19 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
/** Section: Functions related to caching income */
|
/** Section: Functions related to caching income */
|
||||||
|
|
||||||
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
||||||
import {
|
import {
|
||||||
CacheDoRemakeBuildPrices, CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades,
|
CacheAverageGainBank,
|
||||||
|
CacheAverageGainWrink,
|
||||||
|
CacheAverageGainWrinkFattest,
|
||||||
|
CacheDoRemakeBuildPrices, // eslint-disable-line no-unused-vars
|
||||||
|
CacheObjects1,
|
||||||
|
CacheObjects10,
|
||||||
|
CacheObjects100,
|
||||||
|
CacheObjectsNextAchievement,
|
||||||
|
CacheUpgrades,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,16 +22,16 @@ import {
|
|||||||
* @param {amount} amount Amount to be bought
|
* @param {amount} amount Amount to be bought
|
||||||
* @parem {string} target The target Cache object ("Objects1", "Objects10" or "Objects100")
|
* @parem {string} target The target Cache object ("Objects1", "Objects10" or "Objects100")
|
||||||
*/
|
*/
|
||||||
function CacheBuildingIncome(amount, target) {
|
function CacheBuildingIncome(amount) {
|
||||||
const result = [];
|
const result = {};
|
||||||
for (const i of Object.keys(Game.Objects)) {
|
Object.keys(Game.Objects).forEach((i) => {
|
||||||
result[i] = {};
|
result[i] = {};
|
||||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||||
if (amount !== 1) {
|
if (amount !== 1) {
|
||||||
CacheDoRemakeBuildPrices = 1;
|
CacheDoRemakeBuildPrices = 1;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,24 +39,56 @@ function CacheBuildingIncome(amount, target) {
|
|||||||
* It is called by CM.Cache.CacheIncome()
|
* It is called by CM.Cache.CacheIncome()
|
||||||
*/
|
*/
|
||||||
function CacheUpgradeIncome() {
|
function CacheUpgradeIncome() {
|
||||||
CacheUpgrades = [];
|
CacheUpgrades = [];
|
||||||
for (const i of Object.keys(Game.Upgrades)) {
|
Object.keys(Game.Upgrades).forEach((i) => {
|
||||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||||
CacheUpgrades[i] = {};
|
if (i === 'Elder Pledge') {
|
||||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
|
||||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
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
|
* This functions caches the price of each building and stores it in the cache
|
||||||
*/
|
*/
|
||||||
export function CacheBuildingsPrices() {
|
export function CacheBuildingsPrices() {
|
||||||
for (const i of Object.keys(Game.Objects)) {
|
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);
|
CacheObjects1[i].price = BuildingGetPrice(
|
||||||
CacheObjects10[i].price = BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
|
Game.Objects[i],
|
||||||
CacheObjects100[i].price = BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100);
|
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,
|
||||||
|
);
|
||||||
|
CacheObjectsNextAchievement[i].price = BuildingGetPrice(
|
||||||
|
Game.Objects[i],
|
||||||
|
Game.Objects[i].basePrice,
|
||||||
|
Game.Objects[i].amount,
|
||||||
|
Game.Objects[i].free,
|
||||||
|
CacheObjectsNextAchievement[i].AmountNeeded,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,11 +96,11 @@ export function CacheBuildingsPrices() {
|
|||||||
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
||||||
*/
|
*/
|
||||||
export function CacheIncome() {
|
export function CacheIncome() {
|
||||||
// Simulate Building Buys for 1, 10 and 100 amount
|
// Simulate Building Buys for 1, 10 and 100 amount
|
||||||
CacheObjects1 = CacheBuildingIncome(1);
|
CacheObjects1 = CacheBuildingIncome(1);
|
||||||
CacheObjects10 = CacheBuildingIncome(10);
|
CacheObjects10 = CacheBuildingIncome(10);
|
||||||
CacheObjects100 = CacheBuildingIncome(100);
|
CacheObjects100 = CacheBuildingIncome(100);
|
||||||
|
|
||||||
// Simulate Upgrade Buys
|
// Simulate Upgrade Buys
|
||||||
CacheUpgradeIncome();
|
CacheUpgradeIncome();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||||
import {
|
import {
|
||||||
CacheChainFrenzyMaxReward, CacheChainFrenzyRequired, CacheChainFrenzyRequiredNext, CacheChainFrenzyWrathMaxReward, CacheChainFrenzyWrathRequired, CacheChainFrenzyWrathRequiredNext, CacheChainMaxReward, CacheChainRequired, CacheChainRequiredNext, CacheChainWrathMaxReward, CacheChainWrathRequired, CacheChainWrathRequiredNext, CacheDragonsFortuneMultAdjustment, CacheGoldenCookiesMult, CacheNoGoldSwitchCookiesPS, CacheWrathCookiesMult,
|
CacheChainFrenzyMaxReward,
|
||||||
|
CacheChainFrenzyRequired, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainFrenzyRequiredNext, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainFrenzyWrathMaxReward,
|
||||||
|
CacheChainFrenzyWrathRequired, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainFrenzyWrathRequiredNext, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainMaxReward,
|
||||||
|
CacheChainRequired, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainRequiredNext, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainWrathMaxReward,
|
||||||
|
CacheChainWrathRequired, // eslint-disable-line no-unused-vars
|
||||||
|
CacheChainWrathRequiredNext, // eslint-disable-line no-unused-vars
|
||||||
|
CacheDragonsFortuneMultAdjustment,
|
||||||
|
CacheGoldenCookiesMult,
|
||||||
|
CacheNoGoldSwitchCookiesPS,
|
||||||
|
CacheWrathCookiesMult,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,19 +27,25 @@ import {
|
|||||||
* @returns [{number, number, number}] Total cookies earned, cookie needed for this and next level
|
* @returns [{number, number, number}] Total cookies earned, cookie needed for this and next level
|
||||||
*/
|
*/
|
||||||
export function MaxChainCookieReward(digit, maxPayout, mult) {
|
export function MaxChainCookieReward(digit, maxPayout, mult) {
|
||||||
let totalFromChain = 0;
|
let totalFromChain = 0;
|
||||||
let moni = 0;
|
let moni = 0;
|
||||||
let nextMoni = 0;
|
let nextMoni = 0;
|
||||||
let nextRequired = 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) {
|
while (nextMoni < maxPayout * mult) {
|
||||||
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** chain * digit * mult), maxPayout * mult));
|
moni = Math.max(
|
||||||
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult), maxPayout * mult));
|
digit,
|
||||||
nextRequired = Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult);
|
Math.min(Math.floor((1 / 9) * 10 ** chain * digit * mult), maxPayout * mult),
|
||||||
totalFromChain += moni;
|
);
|
||||||
chain++;
|
nextMoni = Math.max(
|
||||||
}
|
digit,
|
||||||
return [totalFromChain, moni, nextRequired];
|
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 += 1;
|
||||||
|
}
|
||||||
|
return [totalFromChain, moni, nextRequired];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,25 +65,28 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
|
|||||||
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
|
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
|
||||||
*/
|
*/
|
||||||
export function CacheChain() {
|
export function CacheChain() {
|
||||||
let maxPayout = CacheNoGoldSwitchCookiesPS * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment;
|
let maxPayout = CacheNoGoldSwitchCookiesPS * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment;
|
||||||
// Removes effect of Frenzy etc.
|
// Removes effect of Frenzy etc.
|
||||||
const cpsBuffMult = GetCPSBuffMult();
|
const cpsBuffMult = GetCPSBuffMult();
|
||||||
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
||||||
else maxPayout = 0;
|
else maxPayout = 0;
|
||||||
|
|
||||||
CacheChainMaxReward = MaxChainCookieReward(7, maxPayout, CacheGoldenCookiesMult);
|
CacheChainMaxReward = MaxChainCookieReward(7, maxPayout, CacheGoldenCookiesMult);
|
||||||
CacheChainRequired = CacheChainMaxReward[1] * 2 / CacheGoldenCookiesMult;
|
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||||
CacheChainRequiredNext = CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
CacheChainRequiredNext = CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||||
|
|
||||||
CacheChainWrathMaxReward = MaxChainCookieReward(6, maxPayout, CacheWrathCookiesMult);
|
CacheChainWrathMaxReward = MaxChainCookieReward(6, maxPayout, CacheWrathCookiesMult);
|
||||||
CacheChainWrathRequired = CacheChainWrathMaxReward[1] * 2 / CacheWrathCookiesMult;
|
CacheChainWrathRequired = (CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||||
CacheChainWrathRequiredNext = CacheChainWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
CacheChainWrathRequiredNext =
|
||||||
|
CacheChainWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||||
|
|
||||||
CacheChainFrenzyMaxReward = MaxChainCookieReward(7, maxPayout * 7, CacheGoldenCookiesMult);
|
CacheChainFrenzyMaxReward = MaxChainCookieReward(7, maxPayout * 7, CacheGoldenCookiesMult);
|
||||||
CacheChainFrenzyRequired = CacheChainFrenzyMaxReward[1] * 2 / CacheGoldenCookiesMult;
|
CacheChainFrenzyRequired = (CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||||
CacheChainFrenzyRequiredNext = CacheChainFrenzyMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
CacheChainFrenzyRequiredNext =
|
||||||
|
CacheChainFrenzyMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||||
|
|
||||||
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(6, maxPayout * 7, CacheWrathCookiesMult);
|
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(6, maxPayout * 7, CacheWrathCookiesMult);
|
||||||
CacheChainFrenzyWrathRequired = CacheChainFrenzyWrathMaxReward[1] * 2 / CacheWrathCookiesMult;
|
CacheChainFrenzyWrathRequired = (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||||
CacheChainFrenzyWrathRequiredNext = CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
CacheChainFrenzyWrathRequiredNext =
|
||||||
|
CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import {
|
import {
|
||||||
CacheHCPerSecond, CacheLastHeavenlyCheck, CacheLastHeavenlyChips, HeavenlyChipsDiff,
|
CacheHCPerSecond, // eslint-disable-line no-unused-vars
|
||||||
|
CacheLastHeavenlyCheck,
|
||||||
|
CacheLastHeavenlyChips,
|
||||||
|
HeavenlyChipsDiff,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,25 +11,25 @@ import {
|
|||||||
* @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds
|
* @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds
|
||||||
*/
|
*/
|
||||||
export default function CacheHeavenlyChipsPS() {
|
export default function CacheHeavenlyChipsPS() {
|
||||||
const currDate = Math.floor(Date.now() / 1000);
|
const currDate = Math.floor(Date.now() / 1000);
|
||||||
// Only calculate every new second
|
// Only calculate every new second
|
||||||
if ((Game.T / Game.fps) % 1 === 0) {
|
if ((Game.T / Game.fps) % 1 === 0) {
|
||||||
const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset);
|
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);
|
const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned);
|
||||||
|
|
||||||
// Add recent gains to AvgQueue's
|
// Add recent gains to AvgQueue's
|
||||||
const timeDiff = currDate - CacheLastHeavenlyCheck;
|
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++) {
|
for (let i = 0; i < timeDiff; i++) {
|
||||||
HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
|
HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store current data for next loop
|
// Store current data for next loop
|
||||||
CacheLastHeavenlyCheck = currDate;
|
CacheLastHeavenlyCheck = currDate;
|
||||||
CacheLastHeavenlyChips = ascendNowToGet;
|
CacheLastHeavenlyChips = ascendNowToGet;
|
||||||
|
|
||||||
// Get average gain over period of 5 seconds
|
// Get average gain over period of 5 seconds
|
||||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades';
|
||||||
import { crateMissing } from '../../Disp/MenuSections/CreateMissingUpgrades';
|
import {
|
||||||
import { CacheMissingUpgrades, CacheMissingUpgradesCookies, CacheMissingUpgradesPrestige } from '../VariablesAndData';
|
CacheMissingUpgrades, // eslint-disable-line no-unused-vars
|
||||||
|
CacheMissingUpgradesCookies, // eslint-disable-line no-unused-vars
|
||||||
|
CacheMissingUpgradesPrestige, // eslint-disable-line no-unused-vars
|
||||||
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches variables related to missing upgrades
|
* This functions caches variables related to missing upgrades
|
||||||
@@ -10,31 +13,34 @@ import { CacheMissingUpgrades, CacheMissingUpgradesCookies, CacheMissingUpgrades
|
|||||||
* @global {string} CM.Cache.MissingUpgradesPrestige String containig the HTML to create the "crates" for missing prestige upgrades
|
* @global {string} CM.Cache.MissingUpgradesPrestige String containig the HTML to create the "crates" for missing prestige upgrades
|
||||||
*/
|
*/
|
||||||
export default function CacheAllMissingUpgrades() {
|
export default function CacheAllMissingUpgrades() {
|
||||||
CacheMissingUpgrades = '';
|
CacheMissingUpgrades = '';
|
||||||
CacheMissingUpgradesCookies = '';
|
CacheMissingUpgradesCookies = '';
|
||||||
CacheMissingUpgradesPrestige = '';
|
CacheMissingUpgradesPrestige = '';
|
||||||
const list = [];
|
const list = [];
|
||||||
// sort the upgrades
|
// sort the upgrades
|
||||||
for (const i of Object.keys(Game.Upgrades)) {
|
Object.keys(Game.Upgrades).forEach((i) => {
|
||||||
list.push(Game.Upgrades[i]);
|
list.push(Game.Upgrades[i]);
|
||||||
}
|
});
|
||||||
const sortMap = function (a, b) {
|
const sortMap = function (a, b) {
|
||||||
if (a.order > b.order) return 1;
|
if (a.order > b.order) return 1;
|
||||||
if (a.order < b.order) return -1;
|
if (a.order < b.order) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
list.sort(sortMap);
|
list.sort(sortMap);
|
||||||
|
|
||||||
for (const i of Object.keys(list)) {
|
Object.keys(list).forEach((i) => {
|
||||||
const me = list[i];
|
const me = list[i];
|
||||||
|
|
||||||
if (me.bought === 0) {
|
if (me.bought === 0) {
|
||||||
let str = '';
|
let str = '';
|
||||||
|
|
||||||
str += crateMissing(me);
|
str += crateMissing(me);
|
||||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
/* eslint-disable no-unused-vars */
|
||||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||||
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug') CacheMissingUpgrades += str;
|
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||||
}
|
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug')
|
||||||
}
|
CacheMissingUpgrades += str;
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import { CacheSeaSpec } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
import { CacheSeaSpec } from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the reward of popping a reindeer
|
* This functions caches the reward of popping a reindeer
|
||||||
@@ -7,11 +6,11 @@ import { CacheSeaSpec } from '../VariablesAndData';
|
|||||||
* @global {number} CM.Cache.SeaSpec The reward for popping a reindeer
|
* @global {number} CM.Cache.SeaSpec The reward for popping a reindeer
|
||||||
*/
|
*/
|
||||||
export default function CacheSeasonSpec() {
|
export default function CacheSeasonSpec() {
|
||||||
if (Game.season === 'christmas') {
|
if (Game.season === 'christmas') {
|
||||||
let val = Game.cookiesPs * 60;
|
let val = Game.cookiesPs * 60;
|
||||||
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
|
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
|
||||||
if (Game.hasBuff('Frenzy')) val *= 0.75;
|
if (Game.hasBuff('Frenzy')) val *= 0.75;
|
||||||
CacheSeaSpec = Math.max(25, val);
|
CacheSeaSpec = Math.max(25, val);
|
||||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,73 +1,87 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
/** Functions related to Caching stats */
|
/** Functions related to Caching stats */
|
||||||
|
|
||||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
||||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||||
import {
|
import {
|
||||||
CacheConjure, CacheConjureReward, CacheDragonsFortuneMultAdjustment, CacheEdifice, CacheEdificeBuilding, CacheGoldenCookiesMult, CacheLucky, CacheLuckyFrenzy, CacheLuckyReward, CacheLuckyRewardFrenzy, CacheLuckyWrathReward, CacheLuckyWrathRewardFrenzy, CacheNoGoldSwitchCookiesPS, CacheWrathCookiesMult,
|
CacheConjure,
|
||||||
|
CacheConjureReward, // eslint-disable-line no-unused-vars
|
||||||
|
CacheDragonsFortuneMultAdjustment,
|
||||||
|
CacheEdifice,
|
||||||
|
CacheEdificeBuilding, // eslint-disable-line no-unused-vars
|
||||||
|
CacheGoldenCookiesMult,
|
||||||
|
CacheLucky,
|
||||||
|
CacheLuckyFrenzy,
|
||||||
|
CacheLuckyReward, // eslint-disable-line no-unused-vars
|
||||||
|
CacheLuckyRewardFrenzy, // eslint-disable-line no-unused-vars
|
||||||
|
CacheLuckyWrathReward, // eslint-disable-line no-unused-vars
|
||||||
|
CacheLuckyWrathRewardFrenzy, // eslint-disable-line no-unused-vars
|
||||||
|
CacheNoGoldSwitchCookiesPS,
|
||||||
|
CacheWrathCookiesMult,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches variables related to the stats page
|
* This functions caches variables related to the stats page
|
||||||
*/
|
*/
|
||||||
export function CacheStatsCookies() {
|
export function CacheStatsCookies() {
|
||||||
CacheLucky = (CacheNoGoldSwitchCookiesPS * 900) / 0.15;
|
CacheLucky = (CacheNoGoldSwitchCookiesPS * 900) / 0.15;
|
||||||
CacheLucky *= CacheDragonsFortuneMultAdjustment;
|
CacheLucky *= CacheDragonsFortuneMultAdjustment;
|
||||||
const cpsBuffMult = GetCPSBuffMult();
|
const cpsBuffMult = GetCPSBuffMult();
|
||||||
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
|
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
|
||||||
else CacheLucky = 0;
|
else CacheLucky = 0;
|
||||||
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13;
|
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13;
|
||||||
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13;
|
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13;
|
||||||
CacheLuckyFrenzy = CacheLucky * 7;
|
CacheLuckyFrenzy = CacheLucky * 7;
|
||||||
CacheLuckyRewardFrenzy = CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
CacheLuckyRewardFrenzy = CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||||
CacheLuckyWrathRewardFrenzy = CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
CacheLuckyWrathRewardFrenzy = CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||||
CacheConjure = CacheLucky * 2;
|
CacheConjure = CacheLucky * 2;
|
||||||
CacheConjureReward = CacheConjure * 0.15;
|
CacheConjureReward = CacheConjure * 0.15;
|
||||||
|
|
||||||
CacheEdifice = 0;
|
CacheEdifice = 0;
|
||||||
let max = 0;
|
let max = 0;
|
||||||
let n = 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 > max) max = Game.Objects[i].amount;
|
||||||
if (Game.Objects[i].amount > 0) n++;
|
if (Game.Objects[i].amount > 0) n += 1;
|
||||||
}
|
});
|
||||||
for (const i of Object.keys(Game.Objects)) {
|
Object.keys(Game.Objects).forEach((i) => {
|
||||||
if ((Game.Objects[i].amount < max || n === 1)
|
if (
|
||||||
&& Game.Objects[i].amount < 400
|
(Game.Objects[i].amount < max || n === 1) &&
|
||||||
&& Game.Objects[i].price * 2 > CacheEdifice) {
|
Game.Objects[i].amount < 400 &&
|
||||||
CacheEdifice = Game.Objects[i].price * 2;
|
Game.Objects[i].price * 2 > CacheEdifice
|
||||||
CacheEdificeBuilding = i;
|
) {
|
||||||
}
|
CacheEdifice = Game.Objects[i].price * 2;
|
||||||
}
|
CacheEdificeBuilding = i;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
||||||
*/
|
*/
|
||||||
export function CacheGoldenAndWrathCookiesMults() {
|
export function CacheGoldenAndWrathCookiesMults() {
|
||||||
let goldenMult = 1;
|
let goldenMult = 1;
|
||||||
let wrathMult = 1;
|
let wrathMult = 1;
|
||||||
let mult = 1;
|
let mult = 1;
|
||||||
|
|
||||||
// Factor auras and upgrade in mults
|
// Factor auras and upgrade in mults
|
||||||
if (SimHas('Green yeast digestives')) mult *= 1.01;
|
if (SimHas('Green yeast digestives')) mult *= 1.01;
|
||||||
if (SimHas('Dragon fang')) mult *= 1.03;
|
if (SimHas('Dragon fang')) mult *= 1.03;
|
||||||
|
|
||||||
goldenMult *= 1 + Game.auraMult('Ancestral Metamorphosis') * 0.1;
|
goldenMult *= 1 + Game.auraMult('Ancestral Metamorphosis') * 0.1;
|
||||||
goldenMult *= Game.eff('goldenCookieGain');
|
goldenMult *= Game.eff('goldenCookieGain');
|
||||||
wrathMult *= 1 + Game.auraMult('Unholy Dominion') * 0.1;
|
wrathMult *= 1 + Game.auraMult('Unholy Dominion') * 0.1;
|
||||||
wrathMult *= Game.eff('wrathCookieGain');
|
wrathMult *= Game.eff('wrathCookieGain');
|
||||||
|
|
||||||
// Calculate final golden and wrath multipliers
|
// Calculate final golden and wrath multipliers
|
||||||
CacheGoldenCookiesMult = mult * goldenMult;
|
CacheGoldenCookiesMult = mult * goldenMult;
|
||||||
CacheWrathCookiesMult = mult * wrathMult;
|
CacheWrathCookiesMult = mult * wrathMult;
|
||||||
|
|
||||||
// Calculate Dragon's Fortune multiplier adjustment:
|
// Calculate Dragon's Fortune multiplier adjustment:
|
||||||
// If Dragon's Fortune (or Reality Bending) aura is active and there are currently no golden cookies,
|
// If Dragon's Fortune (or Reality Bending) aura is active and there are currently no golden cookies,
|
||||||
// compute a multiplier adjustment to apply on the current CPS to simulate 1 golden cookie on screen.
|
// compute a multiplier adjustment to apply on the current CPS to simulate 1 golden cookie on screen.
|
||||||
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
|
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
|
||||||
CacheDragonsFortuneMultAdjustment = 1;
|
CacheDragonsFortuneMultAdjustment = 1;
|
||||||
if (Game.shimmerTypes.golden.n === 0) {
|
if (Game.shimmerTypes.golden.n === 0) {
|
||||||
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult('Dragon\'s Fortune') * 1.23;
|
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { CacheObjectsNextAchievement } from '../VariablesAndData';
|
||||||
|
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions caches the amount of buildings needed till next achievement
|
||||||
|
* @param {boolean} forceRecalc Whether a recalcution should be forced (after CPS change)
|
||||||
|
*/
|
||||||
|
export default function AllAmountTillNextAchievement(forceRecalc) {
|
||||||
|
const result = {};
|
||||||
|
|
||||||
|
Object.keys(Game.Objects).forEach((i) => {
|
||||||
|
if (
|
||||||
|
Object.keys(CacheObjectsNextAchievement).length !== 0 &&
|
||||||
|
CacheObjectsNextAchievement[i].TotalNeeded > Game.Objects[i].amount &&
|
||||||
|
!forceRecalc
|
||||||
|
) {
|
||||||
|
result[i] = {
|
||||||
|
AmountNeeded: CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
|
||||||
|
TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded,
|
||||||
|
price: Game.Objects[i].getSumPrice(
|
||||||
|
CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const tillNext = IndividualAmountTillNextAchievement(i);
|
||||||
|
result[i] = {
|
||||||
|
AmountNeeded: tillNext,
|
||||||
|
TotalNeeded: Game.Objects[i].amount + tillNext,
|
||||||
|
price: Game.Objects[i].getSumPrice(tillNext),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CacheObjectsNextAchievement = result; // eslint-disable-line no-unused-vars
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||||
|
import { SimAchievementsOwned } from '../../Sim/VariablesAndData';
|
||||||
|
|
||||||
|
export default function IndividualAmountTillNextAchievement(building) {
|
||||||
|
const AchievementsAtStart = Game.AchievementsOwned;
|
||||||
|
let index = 100;
|
||||||
|
let lastIndexWithChange = 100;
|
||||||
|
while (index > -1) {
|
||||||
|
BuyBuildingsBonusIncome(building, index);
|
||||||
|
if (SimAchievementsOwned > AchievementsAtStart) {
|
||||||
|
lastIndexWithChange = index;
|
||||||
|
index -= 10;
|
||||||
|
} else if (index === 100) {
|
||||||
|
return 101;
|
||||||
|
} else {
|
||||||
|
index += 1;
|
||||||
|
while (index <= lastIndexWithChange) {
|
||||||
|
BuyBuildingsBonusIncome(building, index);
|
||||||
|
if (SimAchievementsOwned > AchievementsAtStart) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 101;
|
||||||
|
}
|
||||||
@@ -28,18 +28,19 @@ export let CacheLastChoEgg = 0;
|
|||||||
export let CacheObjects1 = {};
|
export let CacheObjects1 = {};
|
||||||
export let CacheObjects10 = {};
|
export let CacheObjects10 = {};
|
||||||
export let CacheObjects100 = {};
|
export let CacheObjects100 = {};
|
||||||
|
export let CacheObjectsNextAchievement = {};
|
||||||
|
|
||||||
export let CacheWrinklersTotal = 0;
|
export let CacheWrinklersTotal = 0;
|
||||||
export let CacheWrinklersNormal = 0;
|
export let CacheWrinklersNormal = 0;
|
||||||
export let CacheWrinklersFattest = [0, null];
|
export let CacheWrinklersFattest = [0, null];
|
||||||
|
|
||||||
export let CacheAvgCps = 0;
|
|
||||||
export let CacheCurrWrinklerCPSMult = 0;
|
export let CacheCurrWrinklerCPSMult = 0;
|
||||||
export let CacheCurrWrinklerCount = 0;
|
export let CacheCurrWrinklerCount = 0;
|
||||||
|
|
||||||
export let CacheUpgrades = {};
|
export let CacheUpgrades = {};
|
||||||
|
|
||||||
export let CacheAverageClicks = {};
|
export let CacheAverageClicks = {};
|
||||||
|
export let CacheAverageCookiesFromClicks;
|
||||||
|
|
||||||
export let CacheMissingUpgrades = {};
|
export let CacheMissingUpgrades = {};
|
||||||
export let CacheMissingUpgradesPrestige = {};
|
export let CacheMissingUpgradesPrestige = {};
|
||||||
@@ -66,10 +67,12 @@ export let CacheSeasonPopShimmer = {};
|
|||||||
|
|
||||||
export let CacheTimeTillNextPrestige = 0;
|
export let CacheTimeTillNextPrestige = 0;
|
||||||
|
|
||||||
|
/** Stores lowest PP value */
|
||||||
export let CacheMinPP = 0;
|
export let CacheMinPP = 0;
|
||||||
export let CacheMidPP = 0;
|
/** Stores lowest PP value category */
|
||||||
export let CacheMaxPP = 0;
|
export let CacheMinPPBulk = 0;
|
||||||
export let CacheArrayOfPPs = [];
|
/** Stores all PP values of all buildings for all buy settings (1, 10, 100) */
|
||||||
|
export let CachePPArray = [];
|
||||||
|
|
||||||
export let CacheGoldenShimmersByID = {};
|
export let CacheGoldenShimmersByID = {};
|
||||||
|
|
||||||
@@ -100,3 +103,18 @@ export let CacheLastHeavenlyChips;
|
|||||||
export let CacheDoRemakeBuildPrices;
|
export let CacheDoRemakeBuildPrices;
|
||||||
|
|
||||||
export let CacheHadBuildAura;
|
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],
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
/** Caches data related to Wrinklers */
|
/** Caches data related to Wrinklers */
|
||||||
|
|
||||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
CacheWrinklersFattest, CacheWrinklersNormal, CacheWrinklersTotal,
|
CacheWrinklersFattest,
|
||||||
|
CacheWrinklersNormal, // eslint-disable-line no-unused-vars
|
||||||
|
CacheWrinklersTotal, // eslint-disable-line no-unused-vars
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,23 +15,26 @@ import {
|
|||||||
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
|
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
|
||||||
*/
|
*/
|
||||||
export default function CacheWrinklers() {
|
export default function CacheWrinklers() {
|
||||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
CacheWrinklersTotal = 0;
|
||||||
let sucked = Game.wrinklers[i].sucked;
|
CacheWrinklersNormal = 0;
|
||||||
let toSuck = 1.1;
|
CacheWrinklersFattest = [0, null];
|
||||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||||
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
let { sucked } = Game.wrinklers[i];
|
||||||
sucked *= toSuck;
|
let toSuck = 1.1;
|
||||||
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
|
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||||
if (SimObjects.Temple.minigameLoaded) {
|
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||||
const godLvl = Game.hasGod('scorn');
|
sucked *= toSuck;
|
||||||
if (godLvl === 1) sucked *= 1.15;
|
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
|
||||||
else if (godLvl === 2) sucked *= 1.1;
|
if (SimObjects.Temple.minigameLoaded) {
|
||||||
else if (godLvl === 3) sucked *= 1.05;
|
const godLvl = Game.hasGod('scorn');
|
||||||
}
|
if (godLvl === 1) sucked *= 1.15;
|
||||||
CacheWrinklersTotal += sucked;
|
else if (godLvl === 2) sucked *= 1.1;
|
||||||
if (Game.wrinklers[i].type === 0) {
|
else if (godLvl === 3) sucked *= 1.05;
|
||||||
CacheWrinklersNormal += sucked;
|
}
|
||||||
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
CacheWrinklersTotal += sucked;
|
||||||
}
|
if (Game.wrinklers[i].type === 0) {
|
||||||
}
|
CacheWrinklersNormal += sucked;
|
||||||
|
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,26 +5,26 @@
|
|||||||
* @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1)
|
* @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1)
|
||||||
*/
|
*/
|
||||||
function CheckNotificationPermissions(ToggleOnOff) {
|
function CheckNotificationPermissions(ToggleOnOff) {
|
||||||
if (ToggleOnOff === 1) {
|
if (ToggleOnOff === 1) {
|
||||||
// Check if browser support Promise version of Notification Permissions
|
// Check if browser support Promise version of Notification Permissions
|
||||||
const checkNotificationPromise = function () {
|
const checkNotificationPromise = function () {
|
||||||
try {
|
try {
|
||||||
Notification.requestPermission().then();
|
Notification.requestPermission().then();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if the browser supports notifications and which type
|
// Check if the browser supports notifications and which type
|
||||||
if (!('Notification' in window)) {
|
if (!('Notification' in window)) {
|
||||||
console.log('This browser does not support notifications.');
|
console.log('This browser does not support notifications.'); // eslint-disable-line no-console
|
||||||
} else if (checkNotificationPromise()) {
|
} else if (checkNotificationPromise()) {
|
||||||
Notification.requestPermission().then();
|
Notification.requestPermission().then();
|
||||||
} else {
|
} else {
|
||||||
Notification.requestPermission();
|
Notification.requestPermission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CheckNotificationPermissions;
|
export default CheckNotificationPermissions;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { default as ConfigDefault } from '../../Data/SettingsDefault';
|
import ConfigDefault from '../../Data/SettingsDefault.ts';
|
||||||
import { default as ConfigData } from '../../Data/SettingsData';
|
import ConfigData from '../../Data/SettingsData';
|
||||||
import { CMOptions } from '../VariablesAndData';
|
import { CMOptions } from '../VariablesAndData';
|
||||||
import save from '../../InitSaveLoad/save';
|
import save from '../../InitSaveLoad/save';
|
||||||
import CMLoop from '../../Main/Loop';
|
import CMLoopHook from '../../Main/LoopHook';
|
||||||
|
import UpdateColours from '../../Disp/HelperFunctions/UpdateColours';
|
||||||
|
|
||||||
/** Functions related to saving, loading and restoring all settings */
|
/** Functions related to saving, loading and restoring all settings */
|
||||||
|
|
||||||
@@ -13,12 +14,14 @@ import CMLoop from '../../Main/Loop';
|
|||||||
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
||||||
*/
|
*/
|
||||||
export function SaveConfig() {
|
export function SaveConfig() {
|
||||||
const saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]);
|
const saveString = b64_to_utf8(
|
||||||
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0],
|
||||||
if (CookieMonsterSave !== null) {
|
);
|
||||||
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
|
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
||||||
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
|
if (CookieMonsterSave !== null) {
|
||||||
}
|
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
|
||||||
|
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,53 +29,49 @@ export function SaveConfig() {
|
|||||||
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
|
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
|
||||||
*/
|
*/
|
||||||
export function LoadConfig(settings) {
|
export function LoadConfig(settings) {
|
||||||
// This removes cookies left from earlier versions of CookieMonster
|
// This removes cookies left from earlier versions of CookieMonster
|
||||||
if (typeof localStorage.CMConfig !== 'undefined') {
|
if (typeof localStorage.CMConfig !== 'undefined') {
|
||||||
delete localStorage.CMConfig;
|
delete localStorage.CMConfig;
|
||||||
}
|
}
|
||||||
if (settings !== undefined) {
|
if (settings !== undefined) {
|
||||||
CMOptions = settings;
|
CMOptions = settings;
|
||||||
|
|
||||||
// Check values
|
if (typeof CMOptions.Colors !== 'undefined') {
|
||||||
let mod = false;
|
delete CMOptions.Colors;
|
||||||
for (const i in ConfigDefault) {
|
}
|
||||||
if (typeof CMOptions[i] === 'undefined') {
|
if (typeof CMOptions.Colours !== 'undefined') {
|
||||||
mod = true;
|
delete CMOptions.Colours;
|
||||||
CMOptions[i] = ConfigDefault[i];
|
}
|
||||||
} else if (i !== 'Header' && i !== 'Colors') {
|
|
||||||
if (i.indexOf('SoundURL') === -1) {
|
// Check values
|
||||||
if (!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)) {
|
let mod = false;
|
||||||
mod = true;
|
Object.keys(ConfigDefault).forEach((i) => {
|
||||||
CMOptions[i] = ConfigDefault[i];
|
if (typeof CMOptions[i] === 'undefined') {
|
||||||
}
|
mod = true;
|
||||||
} else if (typeof CMOptions[i] !== 'string') { // Sound URLs
|
CMOptions[i] = ConfigDefault[i];
|
||||||
mod = true;
|
} else if (i === 'Header') {
|
||||||
CMOptions[i] = ConfigDefault[i];
|
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||||
}
|
if (
|
||||||
} else if (i === 'Header') {
|
typeof CMOptions[i][j] === 'undefined' ||
|
||||||
for (const j in ConfigDefault.Header) {
|
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
|
||||||
if (typeof CMOptions[i][j] === 'undefined' || !(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)) {
|
) {
|
||||||
mod = true;
|
mod = true;
|
||||||
CMOptions[i][j] = ConfigDefault[i][j];
|
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') {
|
if (mod) SaveConfig();
|
||||||
mod = true;
|
CMLoopHook(); // Do loop once
|
||||||
CMOptions[i][j] = ConfigDefault[i][j];
|
Object.keys(ConfigDefault).forEach((i) => {
|
||||||
}
|
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||||
}
|
ConfigData[i].func();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
if (mod) SaveConfig();
|
} else {
|
||||||
CMLoop(); // Do loop once
|
// Default values
|
||||||
for (const i in ConfigDefault) {
|
LoadConfig(ConfigDefault);
|
||||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
}
|
||||||
ConfigData[i].func();
|
Game.UpdateMenu();
|
||||||
}
|
UpdateColours();
|
||||||
}
|
|
||||||
} else { // Default values
|
|
||||||
LoadConfig(ConfigDefault);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,48 +7,49 @@ import { CMOptions } from './VariablesAndData';
|
|||||||
* This function changes the position of both the bottom and timer bar
|
* This function changes the position of both the bottom and timer bar
|
||||||
*/
|
*/
|
||||||
export function UpdateBotTimerBarPosition() {
|
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('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) {
|
} else if (CMOptions.BotBar === 1) {
|
||||||
l('CMBotBar').style.bottom = '0px';
|
l('CMBotBar').style.bottom = '0px';
|
||||||
l('game').style.bottom = '70px';
|
l('game').style.bottom = '70px';
|
||||||
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||||
l('game').style.bottom = l('CMTimerBar').style.height;
|
l('game').style.bottom = l('CMTimerBar').style.height;
|
||||||
} else { // No bars
|
} else {
|
||||||
l('game').style.bottom = '0px';
|
// No bars
|
||||||
}
|
l('game').style.bottom = '0px';
|
||||||
|
}
|
||||||
|
|
||||||
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
||||||
l('sectionLeft').style.top = l('CMTimerBar').style.height;
|
l('sectionLeft').style.top = l('CMTimerBar').style.height;
|
||||||
} else {
|
} else {
|
||||||
l('sectionLeft').style.top = '';
|
l('sectionLeft').style.top = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateBackground();
|
UpdateBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function changes the visibility of the timer bar
|
* This function changes the visibility of the timer bar
|
||||||
*/
|
*/
|
||||||
export function ToggleTimerBar() {
|
export function ToggleTimerBar() {
|
||||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = '';
|
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = '';
|
||||||
else l('CMTimerBar').style.display = 'none';
|
else l('CMTimerBar').style.display = 'none';
|
||||||
UpdateBotTimerBarPosition();
|
UpdateBotTimerBarPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function changes the position of the timer bar
|
* This function changes the position of the timer bar
|
||||||
*/
|
*/
|
||||||
export function ToggleTimerBarPos() {
|
export function ToggleTimerBarPos() {
|
||||||
if (CMOptions.TimerBarPos === 0) {
|
if (CMOptions.TimerBarPos === 0) {
|
||||||
l('CMTimerBar').style.width = '30%';
|
l('CMTimerBar').style.width = '30%';
|
||||||
l('CMTimerBar').style.bottom = '';
|
l('CMTimerBar').style.bottom = '';
|
||||||
l('game').insertBefore(l('CMTimerBar'), l('sectionLeft'));
|
l('game').insertBefore(l('CMTimerBar'), l('sectionLeft'));
|
||||||
} else {
|
} else {
|
||||||
l('CMTimerBar').style.width = '100%';
|
l('CMTimerBar').style.width = '100%';
|
||||||
l('CMTimerBar').style.bottom = '0px';
|
l('CMTimerBar').style.bottom = '0px';
|
||||||
l('wrapper').appendChild(l('CMTimerBar'));
|
l('wrapper').appendChild(l('CMTimerBar'));
|
||||||
}
|
}
|
||||||
UpdateBotTimerBarPosition();
|
UpdateBotTimerBarPosition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { default as ConfigData } from '../Data/SettingsData';
|
import ConfigData from '../Data/SettingsData';
|
||||||
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
||||||
import { CMOptions } from './VariablesAndData';
|
import { CMOptions } from './VariablesAndData';
|
||||||
|
|
||||||
@@ -13,19 +13,18 @@ export const ConfigPrefix = 'CMConfig';
|
|||||||
* @param {string} config The name of the option
|
* @param {string} config The name of the option
|
||||||
*/
|
*/
|
||||||
export function ToggleConfig(config) {
|
export function ToggleConfig(config) {
|
||||||
CMOptions[config]++;
|
CMOptions[config] += 1;
|
||||||
|
|
||||||
if (CMOptions[config] === ConfigData[config].label.length) {
|
if (CMOptions[config] === ConfigData[config].label.length) {
|
||||||
CMOptions[config] = 0;
|
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';
|
} else l(ConfigPrefix + config).className = 'option';
|
||||||
|
|
||||||
if (typeof ConfigData[config].func !== 'undefined') {
|
if (typeof ConfigData[config].func !== 'undefined') {
|
||||||
ConfigData[config].func();
|
ConfigData[config].func();
|
||||||
}
|
}
|
||||||
|
|
||||||
l(ConfigPrefix + config).innerHTML = ConfigData[config].label[CMOptions[config]];
|
SaveConfig();
|
||||||
SaveConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,11 +33,11 @@ export function ToggleConfig(config) {
|
|||||||
* @param {string} config The name of the option
|
* @param {string} config The name of the option
|
||||||
*/
|
*/
|
||||||
export function ToggleConfigVolume(config) {
|
export function ToggleConfigVolume(config) {
|
||||||
if (l(`slider${config}`) !== null) {
|
if (l(`slider${config}`) !== null) {
|
||||||
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
|
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
|
||||||
CMOptions[config] = Math.round(l(`slider${config}`).value);
|
CMOptions[config] = Math.round(l(`slider${config}`).value);
|
||||||
}
|
}
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +46,7 @@ export function ToggleConfigVolume(config) {
|
|||||||
* @param {string} config The name of the header
|
* @param {string} config The name of the header
|
||||||
*/
|
*/
|
||||||
export function ToggleHeader(config) {
|
export function ToggleHeader(config) {
|
||||||
CMOptions.Header[config]++;
|
CMOptions.Header[config] += 1;
|
||||||
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* It is called by CM.Disp.UpdateAscendState() and a change in CMOptions.BotBar
|
* It is called by CM.Disp.UpdateAscendState() and a change in CMOptions.BotBar
|
||||||
*/
|
*/
|
||||||
export default function ToggleBotBar() {
|
export default function ToggleBotBar() {
|
||||||
if (CMOptions.BotBar === 1) {
|
if (CMOptions.BotBar === 1) {
|
||||||
l('CMBotBar').style.display = '';
|
l('CMBotBar').style.display = '';
|
||||||
UpdateBotBar();
|
UpdateBotBar();
|
||||||
} else {
|
} else {
|
||||||
l('CMBotBar').style.display = 'none';
|
l('CMBotBar').style.display = 'none';
|
||||||
}
|
}
|
||||||
UpdateBotTimerBarPosition();
|
UpdateBotTimerBarPosition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* It is called by a change in CM.Options.DetailedTime
|
* It is called by a change in CM.Options.DetailedTime
|
||||||
*/
|
*/
|
||||||
export default function ToggleDetailedTime() {
|
export default function ToggleDetailedTime() {
|
||||||
if (CMOptions.DetailedTime === 1) Game.sayTime = CMSayTime;
|
if (CMOptions.DetailedTime === 1) Game.sayTime = CMSayTime;
|
||||||
else Game.sayTime = BackupFunctions.sayTime;
|
else Game.sayTime = BackupFunctions.sayTime;
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/Config/Toggles/ToggleFavourites.js
Normal file
11
src/Config/Toggles/ToggleFavourites.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { FavouriteSettings } from '../../Disp/VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function toggles whether a setting is part of the favourites section in setting or not
|
||||||
|
* @param {string} config The name of the toggleable config option
|
||||||
|
*/
|
||||||
|
export default function ToggleFavouriteSetting(config) {
|
||||||
|
if (FavouriteSettings.includes(config))
|
||||||
|
FavouriteSettings = FavouriteSettings.filter((ele) => ele !== config);
|
||||||
|
else FavouriteSettings.push(config);
|
||||||
|
}
|
||||||
@@ -7,13 +7,14 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* It is called by a change in CM.Options.GCTimer
|
* It is called by a change in CM.Options.GCTimer
|
||||||
*/
|
*/
|
||||||
export default function ToggleGCTimer() {
|
export default function ToggleGCTimer() {
|
||||||
if (CMOptions.GCTimer === 1) {
|
if (CMOptions.GCTimer === 1) {
|
||||||
for (const i of Object.keys(GCTimers)) {
|
Object.keys(GCTimers).forEach((i) => {
|
||||||
GCTimers[i].style.display = 'block';
|
GCTimers[i].style.display = 'block';
|
||||||
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
||||||
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
for (const i of Object.keys(GCTimers)) GCTimers[i].style.display = 'none';
|
// eslint-disable-next-line no-return-assign
|
||||||
}
|
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,15 +6,15 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings()
|
* and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings()
|
||||||
*/
|
*/
|
||||||
export default function ToggleToolWarnPos() {
|
export default function ToggleToolWarnPos() {
|
||||||
if (l('CMDispTooltipWarningParent') !== null) {
|
if (l('CMDispTooltipWarningParent') !== null) {
|
||||||
if (CMOptions.ToolWarnPos === 0) {
|
if (CMOptions.ToolWarnPos === 0) {
|
||||||
l('CMDispTooltipWarningParent').style.top = 'auto';
|
l('CMDispTooltipWarningParent').style.top = 'auto';
|
||||||
l('CMDispTooltipWarningParent').style.margin = '4px -4px';
|
l('CMDispTooltipWarningParent').style.margin = '4px -4px';
|
||||||
l('CMDispTooltipWarningParent').style.padding = '3px 4px';
|
l('CMDispTooltipWarningParent').style.padding = '3px 4px';
|
||||||
} else {
|
} else {
|
||||||
l('CMDispTooltipWarningParent').style.right = 'auto';
|
l('CMDispTooltipWarningParent').style.right = 'auto';
|
||||||
l('CMDispTooltipWarningParent').style.margin = '4px';
|
l('CMDispTooltipWarningParent').style.margin = '4px';
|
||||||
l('CMDispTooltipWarningParent').style.padding = '4px 3px';
|
l('CMDispTooltipWarningParent').style.padding = '4px 3px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
|
||||||
import { CMOptions } from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Section: Functions related to the Upgrade Bar
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function toggles the upgrade bar and the colours of upgrades
|
|
||||||
* It is called by a change in CM.Options.UpBarColor
|
|
||||||
*/
|
|
||||||
export default function ToggleUpgradeBarAndColor() {
|
|
||||||
if (CMOptions.UpBarColor === 1) { // Colours and bar on
|
|
||||||
l('CMUpgradeBar').style.display = '';
|
|
||||||
UpdateUpgrades();
|
|
||||||
} else if (CMOptions.UpBarColor === 2) { // Colours on and bar off
|
|
||||||
l('CMUpgradeBar').style.display = 'none';
|
|
||||||
UpdateUpgrades();
|
|
||||||
} else { // Colours and bar off
|
|
||||||
l('CMUpgradeBar').style.display = 'none';
|
|
||||||
Game.RebuildUpgrades();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
22
src/Config/Toggles/ToggleUpgradeBarAndColour.js
Normal file
22
src/Config/Toggles/ToggleUpgradeBarAndColour.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
||||||
|
import { CMOptions } from '../VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function toggles the upgrade bar and the colours of upgrades
|
||||||
|
* It is called by a change in CM.Options.UpBarColor
|
||||||
|
*/
|
||||||
|
export default function ToggleUpgradeBarAndColor() {
|
||||||
|
if (CMOptions.UpBarColor === 1) {
|
||||||
|
// Colours and bar on
|
||||||
|
l('CMUpgradeBar').style.display = '';
|
||||||
|
UpdateUpgrades();
|
||||||
|
} else if (CMOptions.UpBarColor === 2) {
|
||||||
|
// Colours on and bar off
|
||||||
|
l('CMUpgradeBar').style.display = 'none';
|
||||||
|
UpdateUpgrades();
|
||||||
|
} else {
|
||||||
|
// Colours and bar off
|
||||||
|
l('CMUpgradeBar').style.display = 'none';
|
||||||
|
Game.RebuildUpgrades();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,11 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* It is called by a change in CM.Options.UpgradeBarFixedPos
|
* It is called by a change in CM.Options.UpgradeBarFixedPos
|
||||||
*/
|
*/
|
||||||
export default function ToggleUpgradeBarFixedPos() {
|
export default function ToggleUpgradeBarFixedPos() {
|
||||||
if (CMOptions.UpgradeBarFixedPos === 1) { // Fix to top of screen when scrolling
|
if (CMOptions.UpgradeBarFixedPos === 1) {
|
||||||
l('CMUpgradeBar').style.position = 'sticky';
|
// Fix to top of screen when scrolling
|
||||||
l('CMUpgradeBar').style.top = '0px';
|
l('CMUpgradeBar').style.position = 'sticky';
|
||||||
} else {
|
l('CMUpgradeBar').style.top = '0px';
|
||||||
l('CMUpgradeBar').style.position = ''; // Possible to scroll offscreen
|
} else {
|
||||||
}
|
l('CMUpgradeBar').style.position = ''; // Possible to scroll offscreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { CMOptions } from '../VariablesAndData';
|
|||||||
* It is called by changes in CM.Options.WrinklerButtons
|
* It is called by changes in CM.Options.WrinklerButtons
|
||||||
*/
|
*/
|
||||||
export default function ToggleWrinklerButtons() {
|
export default function ToggleWrinklerButtons() {
|
||||||
if (CMOptions.WrinklerButtons) {
|
if (CMOptions.WrinklerButtons && Game.elderWrath) {
|
||||||
l('PopAllNormalWrinklerButton').style.display = '';
|
l('PopAllNormalWrinklerButton').style.display = '';
|
||||||
l('PopFattestWrinklerButton').style.display = '';
|
l('PopFattestWrinklerButton').style.display = '';
|
||||||
} else {
|
} else {
|
||||||
l('PopAllNormalWrinklerButton').style.display = 'none';
|
l('PopAllNormalWrinklerButton').style.display = 'none';
|
||||||
l('PopFattestWrinklerButton').style.display = 'none';
|
l('PopFattestWrinklerButton').style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
/* eslint-disable prefer-const */
|
export let CMOptions = {}; // eslint-disable-line prefer-const
|
||||||
|
|
||||||
export let CMOptions = {};
|
|
||||||
export const ConfigPrefix = 'CMConfig';
|
export const ConfigPrefix = 'CMConfig';
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
import init from './InitSaveLoad/init';
|
import init from './InitSaveLoad/init';
|
||||||
import load from './InitSaveLoad/load';
|
import load from './InitSaveLoad/load';
|
||||||
import save from './InitSaveLoad/save';
|
import save from './InitSaveLoad/save';
|
||||||
|
|
||||||
const CM = {
|
const CM = {
|
||||||
init,
|
init,
|
||||||
load,
|
load,
|
||||||
save,
|
save,
|
||||||
};
|
};
|
||||||
|
|
||||||
Game.registerMod('CookieMonster', CM);
|
Game.registerMod('CookieMonster', CM);
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
/** Data copied directly from the game */
|
|
||||||
|
|
||||||
/** Array of the names of all fortune cookies obtainable from the ticker */
|
|
||||||
export const Fortunes = [
|
|
||||||
'Fortune #001',
|
|
||||||
'Fortune #002',
|
|
||||||
'Fortune #003',
|
|
||||||
'Fortune #004',
|
|
||||||
'Fortune #005',
|
|
||||||
'Fortune #006',
|
|
||||||
'Fortune #007',
|
|
||||||
'Fortune #008',
|
|
||||||
'Fortune #009',
|
|
||||||
'Fortune #010',
|
|
||||||
'Fortune #011',
|
|
||||||
'Fortune #012',
|
|
||||||
'Fortune #013',
|
|
||||||
'Fortune #014',
|
|
||||||
'Fortune #015',
|
|
||||||
'Fortune #016',
|
|
||||||
'Fortune #017',
|
|
||||||
'Fortune #018',
|
|
||||||
'Fortune #100',
|
|
||||||
'Fortune #101',
|
|
||||||
'Fortune #102',
|
|
||||||
'Fortune #103',
|
|
||||||
'Fortune #104',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of the names of all Halloween cookies */
|
|
||||||
export const HalloCookies = [
|
|
||||||
'Skull cookies',
|
|
||||||
'Ghost cookies',
|
|
||||||
'Bat cookies',
|
|
||||||
'Slime cookies',
|
|
||||||
'Pumpkin cookies',
|
|
||||||
'Eyeball cookies',
|
|
||||||
'Spider cookies',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of the names of all Christmas cookies */
|
|
||||||
export const ChristCookies = ['Christmas tree biscuits',
|
|
||||||
'Snowflake biscuits',
|
|
||||||
'Snowman biscuits',
|
|
||||||
'Holly biscuits',
|
|
||||||
'Candy cane biscuits',
|
|
||||||
'Bell biscuits',
|
|
||||||
'Present biscuits',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of the names of all Valentine cookies */
|
|
||||||
export const ValCookies = ['Pure heart biscuits',
|
|
||||||
'Ardent heart biscuits',
|
|
||||||
'Sour heart biscuits',
|
|
||||||
'Weeping heart biscuits',
|
|
||||||
'Golden heart biscuits',
|
|
||||||
'Eternal heart biscuits',
|
|
||||||
'Prism heart biscuits',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of the names of all plant drops */
|
|
||||||
export const PlantDrops = ['Elderwort biscuits',
|
|
||||||
'Bakeberry cookies',
|
|
||||||
'Duketater cookies',
|
|
||||||
'Green yeast digestives',
|
|
||||||
'Wheat slims',
|
|
||||||
'Fern tea',
|
|
||||||
'Ichor syrup',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** All possible effects plants and other items can have with a display-title */
|
|
||||||
export const Effects = {
|
|
||||||
buildingCost: 'Building prices',
|
|
||||||
click: 'Cookies per click',
|
|
||||||
cps: 'Total CPS',
|
|
||||||
cursorCps: 'Cursor CPS',
|
|
||||||
goldenCookieDur: 'Golden cookie duration',
|
|
||||||
goldenCookieEffDur: 'Golden cookie effect duration',
|
|
||||||
goldenCookieFreq: 'Golden cookie frequency',
|
|
||||||
goldenCookieGain: 'Golden cookie gains',
|
|
||||||
grandmaCps: 'Grandma CPS',
|
|
||||||
itemDrops: 'Random item drop chance',
|
|
||||||
milk: 'Effect from milk',
|
|
||||||
reindeerDur: 'Reindeer duration',
|
|
||||||
reindeerFreq: 'Reindeer frequency',
|
|
||||||
reindeerGain: 'Reindeer gains',
|
|
||||||
upgradeCost: 'Upgrade prices',
|
|
||||||
wrathCookieDur: 'Wrath cookie duration',
|
|
||||||
wrathCookieEffDur: 'Wrath cookie effect duration',
|
|
||||||
wrathCookieFreq: 'Wrath cookie frequency',
|
|
||||||
wrathCookieGain: 'Wrath cookie gains',
|
|
||||||
wrinklerEat: 'Wrinkler ',
|
|
||||||
wrinklerSpawn: 'Wrinkler spawn frequency',
|
|
||||||
};
|
|
||||||
97
src/Data/Gamedata.ts
Normal file
97
src/Data/Gamedata.ts
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/** Data copied directly from the game */
|
||||||
|
|
||||||
|
/** Array of the names of all fortune cookies obtainable from the ticker */
|
||||||
|
export const Fortunes: string[] = [
|
||||||
|
'Fortune #001',
|
||||||
|
'Fortune #002',
|
||||||
|
'Fortune #003',
|
||||||
|
'Fortune #004',
|
||||||
|
'Fortune #005',
|
||||||
|
'Fortune #006',
|
||||||
|
'Fortune #007',
|
||||||
|
'Fortune #008',
|
||||||
|
'Fortune #009',
|
||||||
|
'Fortune #010',
|
||||||
|
'Fortune #011',
|
||||||
|
'Fortune #012',
|
||||||
|
'Fortune #013',
|
||||||
|
'Fortune #014',
|
||||||
|
'Fortune #015',
|
||||||
|
'Fortune #016',
|
||||||
|
'Fortune #017',
|
||||||
|
'Fortune #018',
|
||||||
|
'Fortune #100',
|
||||||
|
'Fortune #101',
|
||||||
|
'Fortune #102',
|
||||||
|
'Fortune #103',
|
||||||
|
'Fortune #104',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Array of the names of all Halloween cookies */
|
||||||
|
export const HalloCookies: string[] = [
|
||||||
|
'Skull cookies',
|
||||||
|
'Ghost cookies',
|
||||||
|
'Bat cookies',
|
||||||
|
'Slime cookies',
|
||||||
|
'Pumpkin cookies',
|
||||||
|
'Eyeball cookies',
|
||||||
|
'Spider cookies',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Array of the names of all Christmas cookies */
|
||||||
|
export const ChristCookies: string[] = [
|
||||||
|
'Christmas tree biscuits',
|
||||||
|
'Snowflake biscuits',
|
||||||
|
'Snowman biscuits',
|
||||||
|
'Holly biscuits',
|
||||||
|
'Candy cane biscuits',
|
||||||
|
'Bell biscuits',
|
||||||
|
'Present biscuits',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Array of the names of all Valentine cookies */
|
||||||
|
export const ValCookies: string[] = [
|
||||||
|
'Pure heart biscuits',
|
||||||
|
'Ardent heart biscuits',
|
||||||
|
'Sour heart biscuits',
|
||||||
|
'Weeping heart biscuits',
|
||||||
|
'Golden heart biscuits',
|
||||||
|
'Eternal heart biscuits',
|
||||||
|
'Prism heart biscuits',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Array of the names of all plant drops */
|
||||||
|
export const PlantDrops: string[] = [
|
||||||
|
'Elderwort biscuits',
|
||||||
|
'Bakeberry cookies',
|
||||||
|
'Duketater cookies',
|
||||||
|
'Green yeast digestives',
|
||||||
|
'Wheat slims',
|
||||||
|
'Fern tea',
|
||||||
|
'Ichor syrup',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** All possible effects plants and other items can have with a display-title */
|
||||||
|
export const Effects: { [index: string]: string } = {
|
||||||
|
buildingCost: 'Building prices',
|
||||||
|
click: 'Cookies per click',
|
||||||
|
cps: 'Total CPS',
|
||||||
|
cursorCps: 'Cursor CPS',
|
||||||
|
goldenCookieDur: 'Golden cookie duration',
|
||||||
|
goldenCookieEffDur: 'Golden cookie effect duration',
|
||||||
|
goldenCookieFreq: 'Golden cookie frequency',
|
||||||
|
goldenCookieGain: 'Golden cookie gains',
|
||||||
|
grandmaCps: 'Grandma CPS',
|
||||||
|
itemDrops: 'Random item drop chance',
|
||||||
|
milk: 'Effect from milk',
|
||||||
|
reindeerDur: 'Reindeer duration',
|
||||||
|
reindeerFreq: 'Reindeer frequency',
|
||||||
|
reindeerGain: 'Reindeer gains',
|
||||||
|
upgradeCost: 'Upgrade prices',
|
||||||
|
wrathCookieDur: 'Wrath cookie duration',
|
||||||
|
wrathCookieEffDur: 'Wrath cookie effect duration',
|
||||||
|
wrathCookieFreq: 'Wrath cookie frequency',
|
||||||
|
wrathCookieGain: 'Wrath cookie gains',
|
||||||
|
wrinklerEat: 'Wrinkler ',
|
||||||
|
wrinklerSpawn: 'Wrinkler spawn frequency',
|
||||||
|
};
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/** Data related directly to Cookie Monster */
|
|
||||||
|
|
||||||
export const VersionMajor = '2.031';
|
|
||||||
export const VersionMinor = '5';
|
|
||||||
|
|
||||||
/** Information about Cookie Monster to be displayed in the info section */
|
|
||||||
export const ModDescription = `<div class="listing">
|
|
||||||
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
|
|
||||||
offers a wide range of tools and statistics to enhance your game experience.
|
|
||||||
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.</br>
|
|
||||||
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
|
|
||||||
Please also report any bugs you may find over there!</br>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
/** 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>
|
|
||||||
</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>
|
|
||||||
</br>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
32
src/Data/Moddata.ts
Normal file
32
src/Data/Moddata.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/** Data related directly to Cookie Monster */
|
||||||
|
|
||||||
|
export const VersionMajor = '2.031';
|
||||||
|
export const VersionMinor = '9';
|
||||||
|
|
||||||
|
/** Information about Cookie Monster to be displayed in the info section */
|
||||||
|
export const ModDescription = `<div class="listing">
|
||||||
|
<a href="https://github.com/CookieMonsterTeam/CookieMonster" target="blank">Cookie Monster</a>
|
||||||
|
offers a wide range of tools and statistics to enhance your game experience.
|
||||||
|
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.</br>
|
||||||
|
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
|
||||||
|
Please also report any bugs you may find over there!</br>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
|
||||||
|
export const LatestReleaseNotes = `<div class="listing">
|
||||||
|
This update implements the following functions:</br>
|
||||||
|
- For developers: we now expose some data calculated by Cookie Monster to the global scope. You can access it through the CookieMonsterData object</br>
|
||||||
|
- The column with the most optimal building now has a green coloured indicator whenever colour coding is turned on</br>
|
||||||
|
- The current season in the seasons statistics section is now displayed with green text for easier identification</br>
|
||||||
|
- New option to show a timer bar that counts down till next autosave</br>
|
||||||
|
- New option to sort buildings based on the "cost till next achievement"</br>
|
||||||
|
- Added extra information about achievements in statistics page</br>
|
||||||
|
</br>
|
||||||
|
This update fixes the following bugs:</br>
|
||||||
|
- Fixed a bug where ignoring certain buildings in rare cases did not create a "most optimal building"</br>
|
||||||
|
- Fixed some issues related to "left till achievement"</br>
|
||||||
|
- Fixed some cases where upgrades and buildings were not correctly sorted</br>
|
||||||
|
- Fixed the tooltip of "Pop all normal wrinklers" displaying an incorrect reward when Shiny's are present</br>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
/** 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',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of abbreviations used in the "Short" scale */
|
|
||||||
export const shortScale = ['',
|
|
||||||
'',
|
|
||||||
'M',
|
|
||||||
'B',
|
|
||||||
'Tr',
|
|
||||||
'Quadr',
|
|
||||||
'Quint',
|
|
||||||
'Sext',
|
|
||||||
'Sept',
|
|
||||||
'Oct',
|
|
||||||
'Non',
|
|
||||||
'Dec',
|
|
||||||
'Undec',
|
|
||||||
'Duodec',
|
|
||||||
'Tredec',
|
|
||||||
'Quattuordec',
|
|
||||||
'Quindec',
|
|
||||||
'Sexdec',
|
|
||||||
'Septendec',
|
|
||||||
'Octodec',
|
|
||||||
'Novemdec',
|
|
||||||
'Vigint',
|
|
||||||
'Unvigint',
|
|
||||||
'Duovigint',
|
|
||||||
'Trevigint',
|
|
||||||
'Quattuorvigint',
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
|
||||||
export const shortScaleAbbreviated = ['',
|
|
||||||
'K',
|
|
||||||
'M',
|
|
||||||
'B',
|
|
||||||
'T',
|
|
||||||
'Qa',
|
|
||||||
'Qi',
|
|
||||||
'Sx',
|
|
||||||
'Sp',
|
|
||||||
'Oc',
|
|
||||||
'No',
|
|
||||||
'De',
|
|
||||||
'UDe',
|
|
||||||
'DDe',
|
|
||||||
'TDe',
|
|
||||||
'QaDe',
|
|
||||||
'QiDe',
|
|
||||||
'SxDe',
|
|
||||||
'SpDe',
|
|
||||||
'ODe',
|
|
||||||
'NDe',
|
|
||||||
'Vi',
|
|
||||||
'UVi',
|
|
||||||
'DVi',
|
|
||||||
'TVi',
|
|
||||||
'QaVi',
|
|
||||||
'QiVi',
|
|
||||||
'SxVi',
|
|
||||||
'SpVi',
|
|
||||||
'OVi',
|
|
||||||
'NVi',
|
|
||||||
'Tr',
|
|
||||||
'UTr',
|
|
||||||
'DTr',
|
|
||||||
'TTr',
|
|
||||||
'QaTr',
|
|
||||||
'QiTr',
|
|
||||||
'SxTr',
|
|
||||||
'SpTr',
|
|
||||||
'OTr',
|
|
||||||
'NTr',
|
|
||||||
'Qaa',
|
|
||||||
'UQa',
|
|
||||||
'DQa',
|
|
||||||
'TQa',
|
|
||||||
'QaQa',
|
|
||||||
'QiQa',
|
|
||||||
'SxQa',
|
|
||||||
'SpQa',
|
|
||||||
'OQa',
|
|
||||||
'NQa',
|
|
||||||
'Qia',
|
|
||||||
'UQi',
|
|
||||||
'DQi',
|
|
||||||
'TQi',
|
|
||||||
'QaQi',
|
|
||||||
'QiQi',
|
|
||||||
'SxQi',
|
|
||||||
'SpQi',
|
|
||||||
'OQi',
|
|
||||||
'NQi',
|
|
||||||
'Sxa',
|
|
||||||
'USx',
|
|
||||||
'DSx',
|
|
||||||
'TSx',
|
|
||||||
'QaSx',
|
|
||||||
'QiSx',
|
|
||||||
'SxSx',
|
|
||||||
'SpSx',
|
|
||||||
'OSx',
|
|
||||||
'NSx',
|
|
||||||
'Spa',
|
|
||||||
'USp',
|
|
||||||
'DSp',
|
|
||||||
'TSp',
|
|
||||||
'QaSp',
|
|
||||||
'QiSp',
|
|
||||||
'SxSp',
|
|
||||||
'SpSp',
|
|
||||||
'OSp',
|
|
||||||
'NSp',
|
|
||||||
'Oco',
|
|
||||||
'UOc',
|
|
||||||
'DOc',
|
|
||||||
'TOc',
|
|
||||||
'QaOc',
|
|
||||||
'QiOc',
|
|
||||||
'SxOc',
|
|
||||||
'SpOc',
|
|
||||||
'OOc',
|
|
||||||
'NOc',
|
|
||||||
'Noa',
|
|
||||||
'UNo',
|
|
||||||
'DNo',
|
|
||||||
'TNo',
|
|
||||||
'QaNo',
|
|
||||||
'QiNo',
|
|
||||||
'SxNo',
|
|
||||||
'SpNo',
|
|
||||||
'ONo',
|
|
||||||
'NNo',
|
|
||||||
'Ct',
|
|
||||||
'UCt',
|
|
||||||
];
|
|
||||||
141
src/Data/Scales.ts
Normal file
141
src/Data/Scales.ts
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/** Data related directly to the scales used by Cookie Monster */
|
||||||
|
|
||||||
|
/** Array of abbreviations used in the "Metric" scale */
|
||||||
|
export const metric: string[] = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||||
|
|
||||||
|
/** Array of abbreviations used in the "Short" scale */
|
||||||
|
export const shortScale: string[] = [
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'M',
|
||||||
|
'B',
|
||||||
|
'Tr',
|
||||||
|
'Quadr',
|
||||||
|
'Quint',
|
||||||
|
'Sext',
|
||||||
|
'Sept',
|
||||||
|
'Oct',
|
||||||
|
'Non',
|
||||||
|
'Dec',
|
||||||
|
'Undec',
|
||||||
|
'Duodec',
|
||||||
|
'Tredec',
|
||||||
|
'Quattuordec',
|
||||||
|
'Quindec',
|
||||||
|
'Sexdec',
|
||||||
|
'Septendec',
|
||||||
|
'Octodec',
|
||||||
|
'Novemdec',
|
||||||
|
'Vigint',
|
||||||
|
'Unvigint',
|
||||||
|
'Duovigint',
|
||||||
|
'Trevigint',
|
||||||
|
'Quattuorvigint',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
||||||
|
export const shortScaleAbbreviated: string[] = [
|
||||||
|
'',
|
||||||
|
'K',
|
||||||
|
'M',
|
||||||
|
'B',
|
||||||
|
'T',
|
||||||
|
'Qa',
|
||||||
|
'Qi',
|
||||||
|
'Sx',
|
||||||
|
'Sp',
|
||||||
|
'Oc',
|
||||||
|
'No',
|
||||||
|
'De',
|
||||||
|
'UDe',
|
||||||
|
'DDe',
|
||||||
|
'TDe',
|
||||||
|
'QaDe',
|
||||||
|
'QiDe',
|
||||||
|
'SxDe',
|
||||||
|
'SpDe',
|
||||||
|
'ODe',
|
||||||
|
'NDe',
|
||||||
|
'Vi',
|
||||||
|
'UVi',
|
||||||
|
'DVi',
|
||||||
|
'TVi',
|
||||||
|
'QaVi',
|
||||||
|
'QiVi',
|
||||||
|
'SxVi',
|
||||||
|
'SpVi',
|
||||||
|
'OVi',
|
||||||
|
'NVi',
|
||||||
|
'Tr',
|
||||||
|
'UTr',
|
||||||
|
'DTr',
|
||||||
|
'TTr',
|
||||||
|
'QaTr',
|
||||||
|
'QiTr',
|
||||||
|
'SxTr',
|
||||||
|
'SpTr',
|
||||||
|
'OTr',
|
||||||
|
'NTr',
|
||||||
|
'Qaa',
|
||||||
|
'UQa',
|
||||||
|
'DQa',
|
||||||
|
'TQa',
|
||||||
|
'QaQa',
|
||||||
|
'QiQa',
|
||||||
|
'SxQa',
|
||||||
|
'SpQa',
|
||||||
|
'OQa',
|
||||||
|
'NQa',
|
||||||
|
'Qia',
|
||||||
|
'UQi',
|
||||||
|
'DQi',
|
||||||
|
'TQi',
|
||||||
|
'QaQi',
|
||||||
|
'QiQi',
|
||||||
|
'SxQi',
|
||||||
|
'SpQi',
|
||||||
|
'OQi',
|
||||||
|
'NQi',
|
||||||
|
'Sxa',
|
||||||
|
'USx',
|
||||||
|
'DSx',
|
||||||
|
'TSx',
|
||||||
|
'QaSx',
|
||||||
|
'QiSx',
|
||||||
|
'SxSx',
|
||||||
|
'SpSx',
|
||||||
|
'OSx',
|
||||||
|
'NSx',
|
||||||
|
'Spa',
|
||||||
|
'USp',
|
||||||
|
'DSp',
|
||||||
|
'TSp',
|
||||||
|
'QaSp',
|
||||||
|
'QiSp',
|
||||||
|
'SxSp',
|
||||||
|
'SpSp',
|
||||||
|
'OSp',
|
||||||
|
'NSp',
|
||||||
|
'Oco',
|
||||||
|
'UOc',
|
||||||
|
'DOc',
|
||||||
|
'TOc',
|
||||||
|
'QaOc',
|
||||||
|
'QiOc',
|
||||||
|
'SxOc',
|
||||||
|
'SpOc',
|
||||||
|
'OOc',
|
||||||
|
'NOc',
|
||||||
|
'Noa',
|
||||||
|
'UNo',
|
||||||
|
'DNo',
|
||||||
|
'TNo',
|
||||||
|
'QaNo',
|
||||||
|
'QiNo',
|
||||||
|
'SxNo',
|
||||||
|
'SpNo',
|
||||||
|
'ONo',
|
||||||
|
'NNo',
|
||||||
|
'Ct',
|
||||||
|
'UCt',
|
||||||
|
];
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/** Data related to the display titles of certain sections in menu screens */
|
|
||||||
|
|
||||||
/** Display titles of the headers of the Cookie Monster settings section */
|
|
||||||
export const ConfigGroups = {
|
|
||||||
BarsColors: 'Bars/Colors',
|
|
||||||
Calculation: 'Calculation',
|
|
||||||
Notification: 'Notification',
|
|
||||||
Tooltip: 'Tooltips and additional insights',
|
|
||||||
Statistics: 'Statistics',
|
|
||||||
Notation: 'Notation',
|
|
||||||
Miscellaneous: 'Miscellaneous',
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Display titles of the headers of the notification section of the Cookie Monster settings */
|
|
||||||
export const ConfigGroupsNotification = {
|
|
||||||
NotificationGeneral: 'General Notifications',
|
|
||||||
NotificationGC: 'Golden Cookie',
|
|
||||||
NotificationFC: 'Fortune Cookie',
|
|
||||||
NotificationSea: 'Season Special',
|
|
||||||
NotificationGard: 'Garden Tick',
|
|
||||||
NotificationMagi: 'Full Magic Bar',
|
|
||||||
NotificationWrink: 'Wrinkler',
|
|
||||||
NotificationWrinkMax: 'Maximum Wrinklers',
|
|
||||||
};
|
|
||||||
26
src/Data/Sectionheaders.ts
Normal file
26
src/Data/Sectionheaders.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/** Data related to the display titles of certain sections in menu screens */
|
||||||
|
|
||||||
|
/** Display titles of the headers of the Cookie Monster settings section */
|
||||||
|
export const ConfigGroups: { [index: string]: string } = {
|
||||||
|
Favourite: 'Favourite Settings',
|
||||||
|
Calculation: 'Calculation',
|
||||||
|
Notation: 'Notation',
|
||||||
|
Colours: 'Colours and colour coding',
|
||||||
|
BarsDisplay: 'Infobars and visual settings',
|
||||||
|
Tooltip: 'Tooltips',
|
||||||
|
Statistics: 'Statistics',
|
||||||
|
Notification: 'Notifications',
|
||||||
|
Miscellaneous: 'Miscellaneous',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Display titles of the headers of the notification section of the Cookie Monster settings */
|
||||||
|
export const ConfigGroupsNotification: { [index: string]: string } = {
|
||||||
|
NotificationGeneral: 'General Notifications',
|
||||||
|
NotificationGC: 'Golden Cookie',
|
||||||
|
NotificationFC: 'Fortune Cookie',
|
||||||
|
NotificationSea: 'Season Special',
|
||||||
|
NotificationGard: 'Garden Tick',
|
||||||
|
NotificationMagi: 'Full Magic Bar',
|
||||||
|
NotificationWrink: 'Wrinkler',
|
||||||
|
NotificationWrinkMax: 'Maximum Wrinklers',
|
||||||
|
};
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
|
||||||
/** This describes all forms of settings used by Cookie Monster */
|
|
||||||
|
|
||||||
/** The basic setting class */
|
|
||||||
export class Setting {
|
|
||||||
constructor(type, group) {
|
|
||||||
this.type = type;
|
|
||||||
this.group = group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The standard toggle setting class */
|
|
||||||
export class SettingStandard extends Setting {
|
|
||||||
constructor(type, group, label, desc, toggle, func = null) {
|
|
||||||
super(type, group);
|
|
||||||
this.label = label;
|
|
||||||
this.desc = desc;
|
|
||||||
this.toggle = toggle;
|
|
||||||
if (func) {
|
|
||||||
this.func = func;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** The colour picker setting class */
|
|
||||||
export class SettingColours extends Setting {
|
|
||||||
constructor(type, group, desc, func) {
|
|
||||||
super(type, group);
|
|
||||||
this.desc = desc;
|
|
||||||
this.func = func;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The volume level setting class */
|
|
||||||
export class SettingVolume extends Setting {
|
|
||||||
constructor(type, group, label, desc) {
|
|
||||||
super(type, group);
|
|
||||||
this.label = label;
|
|
||||||
this.desc = desc;
|
|
||||||
for (let i = 0; i < 101; i++) {
|
|
||||||
this.label[i] = `${i}%`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The number input setting class */
|
|
||||||
export class SettingInputNumber extends Setting {
|
|
||||||
constructor(type, group, label, desc, min, max) {
|
|
||||||
super(type, group);
|
|
||||||
this.label = label;
|
|
||||||
this.desc = desc;
|
|
||||||
this.min = min;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
src/Data/SettingClasses/BaseSetting.ts
Normal file
11
src/Data/SettingClasses/BaseSetting.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/** The basic setting class */
|
||||||
|
export default class Setting {
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
group: string;
|
||||||
|
|
||||||
|
constructor(type: string, group: string) {
|
||||||
|
this.type = type;
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/Data/SettingClasses/SettingColours.ts
Normal file
11
src/Data/SettingClasses/SettingColours.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import Setting from './BaseSetting';
|
||||||
|
|
||||||
|
/** The colour picker setting class */
|
||||||
|
export default class SettingColours extends Setting {
|
||||||
|
desc: string;
|
||||||
|
|
||||||
|
constructor(type: string, group: string, desc: string) {
|
||||||
|
super(type, group);
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
src/Data/SettingClasses/SettingInputNumber.ts
Normal file
27
src/Data/SettingClasses/SettingInputNumber.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import Setting from './BaseSetting';
|
||||||
|
|
||||||
|
/** The number input setting class */
|
||||||
|
export default class SettingInputNumber extends Setting {
|
||||||
|
label: string[];
|
||||||
|
|
||||||
|
desc: string;
|
||||||
|
|
||||||
|
min: number;
|
||||||
|
|
||||||
|
max: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type: string,
|
||||||
|
group: string,
|
||||||
|
label: string[],
|
||||||
|
desc: string,
|
||||||
|
min: number,
|
||||||
|
max: number,
|
||||||
|
) {
|
||||||
|
super(type, group);
|
||||||
|
this.label = label;
|
||||||
|
this.desc = desc;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/Data/SettingClasses/SettingStandard.ts
Normal file
29
src/Data/SettingClasses/SettingStandard.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import Setting from './BaseSetting';
|
||||||
|
|
||||||
|
/** The standard toggle setting class */
|
||||||
|
export default class SettingStandard extends Setting {
|
||||||
|
label: string[];
|
||||||
|
|
||||||
|
desc: string;
|
||||||
|
|
||||||
|
toggle: boolean;
|
||||||
|
|
||||||
|
func: () => void;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type: string,
|
||||||
|
group: string,
|
||||||
|
label: string[],
|
||||||
|
desc: string,
|
||||||
|
toggle: boolean,
|
||||||
|
func?: () => void,
|
||||||
|
) {
|
||||||
|
super(type, group);
|
||||||
|
this.label = label;
|
||||||
|
this.desc = desc;
|
||||||
|
this.toggle = toggle;
|
||||||
|
if (func !== undefined) {
|
||||||
|
this.func = func;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/Data/SettingClasses/SettingVolume.ts
Normal file
17
src/Data/SettingClasses/SettingVolume.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import Setting from './BaseSetting';
|
||||||
|
|
||||||
|
/** The volume level setting class */
|
||||||
|
export default class SettingVolume extends Setting {
|
||||||
|
label: string[];
|
||||||
|
|
||||||
|
desc: string;
|
||||||
|
|
||||||
|
constructor(type: string, group: string, label: string[], desc: string) {
|
||||||
|
super(type, group);
|
||||||
|
this.label = label;
|
||||||
|
this.desc = desc;
|
||||||
|
for (let i = 0; i < 101; i++) {
|
||||||
|
this.label[i] = `${i}%`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,97 +0,0 @@
|
|||||||
/** This array describes all default settings */
|
|
||||||
const ConfigDefault = {
|
|
||||||
BotBar: 1,
|
|
||||||
TimerBar: 1,
|
|
||||||
TimerBarPos: 0,
|
|
||||||
TimerBarOverlay: 2,
|
|
||||||
BuildColor: 1,
|
|
||||||
BulkBuildColor: 0,
|
|
||||||
UpBarColor: 1,
|
|
||||||
UpgradeBarFixedPos: 1,
|
|
||||||
CalcWrink: 0,
|
|
||||||
CPSMode: 1,
|
|
||||||
AvgCPSHist: 3,
|
|
||||||
AvgClicksHist: 0,
|
|
||||||
ColorPPBulkMode: 1,
|
|
||||||
PPExcludeTop: 0,
|
|
||||||
PPSecondsLowerLimit: 0,
|
|
||||||
PPOnlyConsiderBuyable: 0,
|
|
||||||
ToolWarnBon: 0,
|
|
||||||
Title: 1,
|
|
||||||
GeneralSound: 1,
|
|
||||||
GCNotification: 0,
|
|
||||||
GCFlash: 1,
|
|
||||||
GCSound: 1,
|
|
||||||
GCVolume: 100,
|
|
||||||
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
|
||||||
FortuneNotification: 0,
|
|
||||||
FortuneFlash: 1,
|
|
||||||
FortuneSound: 1,
|
|
||||||
FortuneVolume: 100,
|
|
||||||
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',
|
|
||||||
GardFlash: 1,
|
|
||||||
GardSound: 1,
|
|
||||||
GardVolume: 100,
|
|
||||||
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
|
||||||
MagicNotification: 0,
|
|
||||||
MagicFlash: 1,
|
|
||||||
MagicSound: 1,
|
|
||||||
MagicVolume: 100,
|
|
||||||
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',
|
|
||||||
WrinklerMaxNotification: 0,
|
|
||||||
WrinklerMaxFlash: 1,
|
|
||||||
WrinklerMaxSound: 1,
|
|
||||||
WrinklerMaxVolume: 100,
|
|
||||||
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
|
||||||
TooltipBuildUpgrade: 1,
|
|
||||||
TooltipAmor: 0,
|
|
||||||
ToolWarnLucky: 1,
|
|
||||||
ToolWarnLuckyFrenzy: 1,
|
|
||||||
ToolWarnConjure: 1,
|
|
||||||
ToolWarnConjureFrenzy: 1,
|
|
||||||
ToolWarnEdifice: 1,
|
|
||||||
ToolWarnUser: 0,
|
|
||||||
ToolWarnPos: 1,
|
|
||||||
TooltipGrim: 1,
|
|
||||||
TooltipWrink: 1,
|
|
||||||
TooltipLump: 1,
|
|
||||||
TooltipPlots: 1,
|
|
||||||
DragonAuraInfo: 1,
|
|
||||||
TooltipAscendButton: 1,
|
|
||||||
Stats: 1,
|
|
||||||
MissingUpgrades: 1,
|
|
||||||
UpStats: 1,
|
|
||||||
TimeFormat: 0,
|
|
||||||
DetailedTime: 1,
|
|
||||||
GrimoireBar: 1,
|
|
||||||
HeavenlyChipsTarget: 1,
|
|
||||||
ShowMissedGC: 1,
|
|
||||||
Scale: 2,
|
|
||||||
ScaleDecimals: 2,
|
|
||||||
ScaleSeparator: 0,
|
|
||||||
ScaleCutoff: 999999,
|
|
||||||
Colors: {
|
|
||||||
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,
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ConfigDefault;
|
|
||||||
144
src/Data/SettingsDefault.ts
Normal file
144
src/Data/SettingsDefault.ts
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
/** This array describes all default settings */
|
||||||
|
const ConfigDefault: {
|
||||||
|
[index: string]: string | number | { [index: string]: number };
|
||||||
|
} = {
|
||||||
|
CPSMode: 1,
|
||||||
|
AvgCPSHist: 3,
|
||||||
|
AvgClicksHist: 0,
|
||||||
|
CalcWrink: 0,
|
||||||
|
Scale: 2,
|
||||||
|
ScaleDecimals: 2,
|
||||||
|
ScaleSeparator: 0,
|
||||||
|
ScaleCutoff: 999999,
|
||||||
|
TimeFormat: 0,
|
||||||
|
DetailedTime: 1,
|
||||||
|
PPDisplayTime: 0,
|
||||||
|
BuildColour: 1,
|
||||||
|
PPOnlyConsiderBuyable: 0,
|
||||||
|
PPExcludeTop: 0,
|
||||||
|
PPRigidelMode: 0,
|
||||||
|
PPSecondsLowerLimit: 0,
|
||||||
|
ColourBlue: '#4bb8f0',
|
||||||
|
ColourGreen: '#00ff00',
|
||||||
|
ColourYellow: '#ffff00',
|
||||||
|
ColourOrange: '#ff7f00',
|
||||||
|
ColourRed: '#ff0000',
|
||||||
|
ColourPurple: '#ff00ff',
|
||||||
|
ColourGray: '#b3b3b3',
|
||||||
|
ColourPink: '#ff1493',
|
||||||
|
ColourBrown: '#8b4513',
|
||||||
|
BotBar: 1,
|
||||||
|
TimerBar: 1,
|
||||||
|
TimerBarPos: 0,
|
||||||
|
TimerBarOverlay: 2,
|
||||||
|
AutosaveTimerBar: 0,
|
||||||
|
UpBarColour: 1,
|
||||||
|
UpgradeBarFixedPos: 1,
|
||||||
|
SortBuildings: 0,
|
||||||
|
SortUpgrades: 0,
|
||||||
|
UpgradesNeverCollapse: 0,
|
||||||
|
DragonAuraInfo: 1,
|
||||||
|
GrimoireBar: 1,
|
||||||
|
GCTimer: 1,
|
||||||
|
Favicon: 1,
|
||||||
|
WrinklerButtons: 1,
|
||||||
|
HideSectionsButtons: 0,
|
||||||
|
TooltipBuildUpgrade: 1,
|
||||||
|
TooltipAmor: 0,
|
||||||
|
ToolWarnLucky: 1,
|
||||||
|
ToolWarnLuckyFrenzy: 1,
|
||||||
|
ToolWarnConjure: 1,
|
||||||
|
ToolWarnConjureFrenzy: 1,
|
||||||
|
ToolWarnEdifice: 1,
|
||||||
|
ToolWarnUser: 0,
|
||||||
|
ToolWarnBon: 1,
|
||||||
|
ToolWarnPos: 1,
|
||||||
|
TooltipGrim: 1,
|
||||||
|
TooltipWrink: 1,
|
||||||
|
TooltipLump: 1,
|
||||||
|
TooltipPlots: 1,
|
||||||
|
TooltipPantheon: 1,
|
||||||
|
TooltipAscendButton: 1,
|
||||||
|
Stats: 1,
|
||||||
|
MissingUpgrades: 1,
|
||||||
|
MissingAchievements: 0,
|
||||||
|
UpStats: 1,
|
||||||
|
HeavenlyChipsTarget: 1,
|
||||||
|
ShowMissedGC: 1,
|
||||||
|
Title: 1,
|
||||||
|
GeneralSound: 1,
|
||||||
|
GCNotification: 0,
|
||||||
|
GCFlash: 1,
|
||||||
|
ColourGCFlash: '#ffffff',
|
||||||
|
GCSound: 1,
|
||||||
|
GCVolume: 100,
|
||||||
|
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||||
|
FortuneNotification: 0,
|
||||||
|
FortuneFlash: 1,
|
||||||
|
ColourFortuneFlash: '#ffffff',
|
||||||
|
FortuneSound: 1,
|
||||||
|
FortuneVolume: 100,
|
||||||
|
FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||||
|
SeaNotification: 0,
|
||||||
|
SeaFlash: 1,
|
||||||
|
ColourSeaFlash: '#ffffff',
|
||||||
|
SeaSound: 1,
|
||||||
|
SeaVolume: 100,
|
||||||
|
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||||
|
GardFlash: 1,
|
||||||
|
ColourGardFlash: '#ffffff',
|
||||||
|
GardSound: 1,
|
||||||
|
GardVolume: 100,
|
||||||
|
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||||
|
MagicNotification: 0,
|
||||||
|
MagicFlash: 1,
|
||||||
|
ColourMagicFlash: '#ffffff',
|
||||||
|
MagicSound: 1,
|
||||||
|
MagicVolume: 100,
|
||||||
|
MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||||
|
WrinklerNotification: 0,
|
||||||
|
WrinklerFlash: 1,
|
||||||
|
ColourWrinklerFlash: '#ffffff',
|
||||||
|
WrinklerSound: 1,
|
||||||
|
WrinklerVolume: 100,
|
||||||
|
WrinklerSoundURL: 'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||||
|
WrinklerMaxNotification: 0,
|
||||||
|
WrinklerMaxFlash: 1,
|
||||||
|
ColourWrinklerMaxFlash: '#ffffff',
|
||||||
|
WrinklerMaxSound: 1,
|
||||||
|
WrinklerMaxVolume: 100,
|
||||||
|
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||||
|
BulkBuyBlock: 0,
|
||||||
|
FavouriteSettings: 1,
|
||||||
|
Header: {
|
||||||
|
Favourite: 1,
|
||||||
|
Calculation: 1,
|
||||||
|
Notation: 1,
|
||||||
|
Colours: 1,
|
||||||
|
BarsDisplay: 1,
|
||||||
|
Tooltip: 1,
|
||||||
|
Statistics: 1,
|
||||||
|
Notification: 1,
|
||||||
|
NotificationGeneral: 1,
|
||||||
|
NotificationGC: 1,
|
||||||
|
NotificationFC: 1,
|
||||||
|
NotificationSea: 1,
|
||||||
|
NotificationGard: 1,
|
||||||
|
NotificationMagi: 1,
|
||||||
|
NotificationWrink: 1,
|
||||||
|
NotificationWrinkMax: 1,
|
||||||
|
Miscellaneous: 1,
|
||||||
|
Lucky: 1,
|
||||||
|
Chain: 1,
|
||||||
|
Spells: 1,
|
||||||
|
Garden: 1,
|
||||||
|
Prestige: 1,
|
||||||
|
Wrink: 1,
|
||||||
|
Sea: 1,
|
||||||
|
Achievs: 1,
|
||||||
|
Misc: 1,
|
||||||
|
InfoTab: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConfigDefault;
|
||||||
76
src/Disp/BeautifyAndFormatting/Beautify.js
Normal file
76
src/Disp/BeautifyAndFormatting/Beautify.js
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/** General functions to format or beautify strings */
|
||||||
|
|
||||||
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
|
||||||
|
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns formats number based on the Scale setting
|
||||||
|
* @param {number} num Number to be beautified
|
||||||
|
* @param {any} floats Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
||||||
|
* @param {number} forced Used to force (type 3) in certains cases
|
||||||
|
* @returns {string} Formatted number
|
||||||
|
*/
|
||||||
|
export default function Beautify(num, floats, forced) {
|
||||||
|
const decimals = CMOptions.ScaleDecimals + 1;
|
||||||
|
if (num === Infinity) {
|
||||||
|
return 'Infinity';
|
||||||
|
}
|
||||||
|
if (typeof num === 'undefined') {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
if (CMOptions.Scale === 0) {
|
||||||
|
return BackupFunctions.Beautify(num, floats);
|
||||||
|
}
|
||||||
|
if (Number.isFinite(num)) {
|
||||||
|
if (num < 0) {
|
||||||
|
return `-${Beautify(Math.abs(num))}`;
|
||||||
|
}
|
||||||
|
let answer = '';
|
||||||
|
if (num === 0) {
|
||||||
|
return num.toString();
|
||||||
|
}
|
||||||
|
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
|
||||||
|
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);
|
||||||
|
// 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 (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
|
||||||
|
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}`)) {
|
||||||
|
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
|
||||||
|
answer += `E${AmountOfTenPowerThree * 3}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (answer === '') {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
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 Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
|
||||||
|
return BackupFunctions.Beautify(num, floats);
|
||||||
|
}
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
/** 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,
|
|
||||||
} from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns formats number based on the Scale setting
|
|
||||||
* @param {number} num Number to be beautified
|
|
||||||
* @param {any} floats Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
|
||||||
* @param {number} forced Used to force (type 3) in certains cases
|
|
||||||
* @returns {string} Formatted number
|
|
||||||
*/
|
|
||||||
export function Beautify(num, floats, forced) {
|
|
||||||
const decimals = CMOptions.ScaleDecimals + 1;
|
|
||||||
if (num === Infinity) {
|
|
||||||
return 'Infinity';
|
|
||||||
} if (typeof num === 'undefined') {
|
|
||||||
return '0';
|
|
||||||
} if (CMOptions.Scale === 0) {
|
|
||||||
return BackupFunctions.Beautify(num, floats);
|
|
||||||
} if (Number.isFinite(num)) {
|
|
||||||
let answer = '';
|
|
||||||
if (num === 0) {
|
|
||||||
return num.toString();
|
|
||||||
} 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
|
|
||||||
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);
|
|
||||||
// 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 (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
|
|
||||||
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}`)) {
|
|
||||||
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
|
|
||||||
answer += `E${AmountOfTenPowerThree * 3}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (answer === '') {
|
|
||||||
console.log(`Could not beautify number with CM.Disp.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}`);
|
|
||||||
return BackupFunctions.Beautify(num, floats);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns time as a string depending on TimeFormat setting
|
|
||||||
* @param {number} time Time to be formatted
|
|
||||||
* @param {number} longFormat 1 or 0
|
|
||||||
* @returns {string} Formatted time
|
|
||||||
*/
|
|
||||||
export function FormatTime(time, longFormat) {
|
|
||||||
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);
|
|
||||||
let str = '';
|
|
||||||
if (CMOptions.TimeFormat) {
|
|
||||||
if (time > 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')}, `;
|
|
||||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns the color to be used for time-strings
|
|
||||||
* @param {number} time Time to be coloured
|
|
||||||
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
|
|
||||||
*/
|
|
||||||
export function GetTimeColor(time) {
|
|
||||||
let color;
|
|
||||||
let text;
|
|
||||||
if (time <= 0) {
|
|
||||||
if (CMOptions.TimeFormat) text = '00:00:00:00:00';
|
|
||||||
else text = 'Done!';
|
|
||||||
color = ColorGreen;
|
|
||||||
} else {
|
|
||||||
text = FormatTime(time);
|
|
||||||
if (time > 300) color = ColorRed;
|
|
||||||
else if (time > 60) color = ColorOrange;
|
|
||||||
else color = ColorYellow;
|
|
||||||
}
|
|
||||||
return { text, color };
|
|
||||||
}
|
|
||||||
42
src/Disp/BeautifyAndFormatting/FormatTime.js
Normal file
42
src/Disp/BeautifyAndFormatting/FormatTime.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns time as a string depending on TimeFormat setting
|
||||||
|
* @param {number} time Time to be formatted
|
||||||
|
* @param {number} longFormat 1 or 0
|
||||||
|
* @returns {string} Formatted time
|
||||||
|
*/
|
||||||
|
export default function FormatTime(time, longFormat) {
|
||||||
|
let formattedTime = time;
|
||||||
|
if (time === Infinity) return time;
|
||||||
|
if (time < 0) return 'Negative time period';
|
||||||
|
formattedTime = Math.ceil(time);
|
||||||
|
const y = Math.floor(formattedTime / 31536000);
|
||||||
|
const d = Math.floor((formattedTime % 31536000) / 86400);
|
||||||
|
const h = Math.floor(((formattedTime % 31536000) % 86400) / 3600);
|
||||||
|
const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60);
|
||||||
|
const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
|
||||||
|
let str = '';
|
||||||
|
if (CMOptions.TimeFormat) {
|
||||||
|
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 (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||||
|
str +=
|
||||||
|
y > 0
|
||||||
|
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary
|
||||||
|
: '';
|
||||||
|
if (str.length > 0 || d > 0)
|
||||||
|
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `; // eslint-disable-line no-nested-ternary
|
||||||
|
if (str.length > 0 || h > 0)
|
||||||
|
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; // eslint-disable-line no-nested-ternary
|
||||||
|
if (str.length > 0 || m > 0)
|
||||||
|
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; // eslint-disable-line no-nested-ternary
|
||||||
|
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); // eslint-disable-line no-nested-ternary
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
24
src/Disp/BeautifyAndFormatting/GetTimeColour.js
Normal file
24
src/Disp/BeautifyAndFormatting/GetTimeColour.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
|
||||||
|
import FormatTime from './FormatTime';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns the color to be used for time-strings
|
||||||
|
* @param {number} time Time to be coloured
|
||||||
|
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
|
||||||
|
*/
|
||||||
|
export default function GetTimeColour(time) {
|
||||||
|
let color;
|
||||||
|
let text;
|
||||||
|
if (time <= 0) {
|
||||||
|
if (CMOptions.TimeFormat) text = '00:00:00:00:00';
|
||||||
|
else text = 'Done!';
|
||||||
|
color = ColourGreen;
|
||||||
|
} else {
|
||||||
|
text = FormatTime(time);
|
||||||
|
if (time > 300) color = ColourRed;
|
||||||
|
else if (time > 60) color = ColourOrange;
|
||||||
|
else color = ColourYellow;
|
||||||
|
}
|
||||||
|
return { text, color };
|
||||||
|
}
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
import {
|
||||||
|
CacheMinPPBulk,
|
||||||
|
CacheObjects1,
|
||||||
|
CacheObjects10,
|
||||||
|
CacheObjects100,
|
||||||
|
CacheObjectsNextAchievement,
|
||||||
|
} from '../../Cache/VariablesAndData';
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||||
import { Colors, LastTargetBuildings } from '../VariablesAndData';
|
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||||
@@ -10,72 +16,117 @@ import { Colors, LastTargetBuildings } from '../VariablesAndData';
|
|||||||
/**
|
/**
|
||||||
* This function adjusts some things in the column of buildings.
|
* This function adjusts some things in the column of buildings.
|
||||||
* It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set
|
* It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set
|
||||||
* The function is called by CM.Disp.Draw(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale()
|
* The function is called by CM.Disp.Draw(), CM.Disp.UpdateColours() & CM.Disp.RefreshScale()
|
||||||
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.Data.Config.BulkBuildColor
|
* And by changes in CM.Options.BuildColour, CM.Options.SortBuild & CM.Data.Config.BulkBuildColour
|
||||||
*/
|
*/
|
||||||
export default function UpdateBuildings() {
|
export default function UpdateBuildings() {
|
||||||
let target = Game.buyBulk;
|
let target = Game.buyBulk;
|
||||||
if (Game.buyMode === 1) {
|
if (Game.buyMode === 1) {
|
||||||
LastTargetBuildings = target;
|
LastTargetBuildings = target;
|
||||||
} else {
|
} else {
|
||||||
target = LastTargetBuildings;
|
target = LastTargetBuildings;
|
||||||
}
|
}
|
||||||
if (target === 1) target = CacheObjects1;
|
if (target === 1) target = CacheObjects1;
|
||||||
else if (target === 10) target = CacheObjects10;
|
else if (target === 10) target = CacheObjects10;
|
||||||
else if (target === 100) target = CacheObjects100;
|
else if (target === 100) target = CacheObjects100;
|
||||||
|
|
||||||
if (Game.buyMode === 1) {
|
// Remove colour if applied
|
||||||
if (CMOptions.BuildColor === 1) {
|
l(`storeBulk1`).style.removeProperty('color');
|
||||||
for (const i of Object.keys(target)) {
|
l(`storeBulk10`).style.removeProperty('color');
|
||||||
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions.Colors[target[i].color];
|
l(`storeBulk100`).style.removeProperty('color');
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (const i of Object.keys(Game.Objects)) {
|
|
||||||
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Game.buyMode === -1) {
|
|
||||||
for (const i of Object.keys(CacheObjects1)) {
|
|
||||||
const o = Game.Objects[i];
|
|
||||||
l(`productPrice${o.id}`).style.color = '';
|
|
||||||
/*
|
|
||||||
* Fix sell price displayed in the object in the store.
|
|
||||||
*
|
|
||||||
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
|
|
||||||
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
|
|
||||||
*
|
|
||||||
* 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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
if (Game.buyMode === 1) {
|
||||||
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
|
if (CMOptions.BuildColour === 1) {
|
||||||
// This regulates sorting of buildings
|
Object.keys(target).forEach((i) => {
|
||||||
if (Game.buyMode === 1 && CMOptions.SortBuildings) {
|
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
|
||||||
const arr = Object.keys(target).map((k) => {
|
});
|
||||||
const o = target[k];
|
l(`storeBulk${CacheMinPPBulk}`).style.color = CMOptions.ColourGreen;
|
||||||
o.name = k;
|
} else {
|
||||||
o.id = Game.Objects[k].id;
|
Object.keys(Game.Objects).forEach((i) => {
|
||||||
return o;
|
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} else if (Game.buyMode === -1) {
|
||||||
|
Object.keys(CacheObjects1).forEach((i) => {
|
||||||
|
const o = Game.Objects[i];
|
||||||
|
l(`productPrice${o.id}`).style.color = '';
|
||||||
|
/*
|
||||||
|
* Fix sell price displayed in the object in the store.
|
||||||
|
*
|
||||||
|
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
|
||||||
|
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
|
||||||
|
*
|
||||||
|
* 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),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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)); });
|
// Build array of pointers and sort according to the user's configured sort option.
|
||||||
|
// This regulates sorting of buildings.
|
||||||
|
let arr;
|
||||||
|
if (Game.buyMode !== 1 || !CMOptions.SortBuildings) {
|
||||||
|
arr = Object.keys(CacheObjects1).map(k => {
|
||||||
|
const o = {};
|
||||||
|
o.name = k;
|
||||||
|
o.id = Game.Objects[k].id;
|
||||||
|
return o;
|
||||||
|
});
|
||||||
|
// Sort using default order.
|
||||||
|
arr.sort((a, b) => a.id - b.id);
|
||||||
|
} else if (CMOptions.SortBuildings === 1) {
|
||||||
|
arr = Object.keys(CacheObjects1).map(k => {
|
||||||
|
const o = {};
|
||||||
|
o.name = k;
|
||||||
|
o.pp = CacheObjects1[k].pp;
|
||||||
|
o.color = CacheObjects1[k].color;
|
||||||
|
return o;
|
||||||
|
});
|
||||||
|
// Sort by pp colour group, then by pp.
|
||||||
|
arr.sort((a, b) =>
|
||||||
|
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||||
|
? a.pp - b.pp
|
||||||
|
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||||
|
);
|
||||||
|
} else if (CMOptions.SortBuildings === 2) {
|
||||||
|
arr = Object.keys(target).map(k => {
|
||||||
|
const o = {};
|
||||||
|
o.name = k;
|
||||||
|
o.pp = target[k].pp;
|
||||||
|
o.color = target[k].color;
|
||||||
|
return o;
|
||||||
|
});
|
||||||
|
// Sort by pp colour group, then by pp.
|
||||||
|
arr.sort((a, b) =>
|
||||||
|
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||||
|
? a.pp - b.pp
|
||||||
|
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||||
|
);
|
||||||
|
} else if (CMOptions.SortBuildings === 3) {
|
||||||
|
arr = Object.keys(CacheObjectsNextAchievement).map(k => {
|
||||||
|
const o = {};
|
||||||
|
o.name = k;
|
||||||
|
o.id = Game.Objects[k].id;
|
||||||
|
o.amountUntilNext = CacheObjectsNextAchievement[k].AmountNeeded;
|
||||||
|
o.priceUntilNext = CacheObjectsNextAchievement[k].price;
|
||||||
|
return o;
|
||||||
|
});
|
||||||
|
// First, sort using default order.
|
||||||
|
arr.sort((a, b) => a.id - b.id);
|
||||||
|
// Sort by price until next achievement.
|
||||||
|
// Buildings that aren't within 100 of an achievement are placed at the end, still in
|
||||||
|
// default order relative to each other because sort() is guaranteed stable.
|
||||||
|
arr.sort((a, b) =>
|
||||||
|
(a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) -
|
||||||
|
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for (let x = 0; x < arr.length; x++) {
|
// Use array index (+2) as the grid row number.
|
||||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
|
||||||
}
|
for (let x = 0; x < arr.length; x++) {
|
||||||
} else {
|
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
||||||
const arr = Object.keys(CacheObjects1).map((k) => {
|
}
|
||||||
const o = CacheObjects1[k];
|
|
||||||
o.name = k;
|
|
||||||
o.id = Game.Objects[k].id;
|
|
||||||
return o;
|
|
||||||
});
|
|
||||||
arr.sort((a, b) => a.id - b.id);
|
|
||||||
for (let x = 0; x < arr.length; x++) {
|
|
||||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
src/Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js
Normal file
27
src/Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function toggles the upgrade to be always expanded
|
||||||
|
* It is called by a change in CM.Options.ToolWarnPos
|
||||||
|
* and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings()
|
||||||
|
*/
|
||||||
|
export default function UpdateUpgradeSectionsHeight() {
|
||||||
|
Object.values(document.getElementsByClassName('storeSection')).forEach((section) => {
|
||||||
|
if (CMOptions.UpgradesNeverCollapse || section.id === 'products') {
|
||||||
|
section.style.height = 'auto'; // eslint-disable-line no-param-reassign
|
||||||
|
} else if (section.id === 'vaultUpgrades') {
|
||||||
|
section.style.height = ''; // eslint-disable-line no-param-reassign
|
||||||
|
section.style.minHeight = '0px'; // eslint-disable-line no-param-reassign
|
||||||
|
} else if (section.id === 'upgrades') {
|
||||||
|
section.style.height = ''; // eslint-disable-line no-param-reassign
|
||||||
|
if (section.className.includes('hasMenu')) {
|
||||||
|
section.style.minHeight = '82px'; // eslint-disable-line no-param-reassign
|
||||||
|
} else {
|
||||||
|
section.style.minHeight = '60px'; // eslint-disable-line no-param-reassign
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
section.style.height = ''; // eslint-disable-line no-param-reassign
|
||||||
|
section.style.minHeight = '60px'; // eslint-disable-line no-param-reassign
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
ColorBackPre, ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorTextPre, ColorYellow,
|
ColourBackPre,
|
||||||
|
ColourBlue,
|
||||||
|
ColourGray,
|
||||||
|
ColourGreen,
|
||||||
|
ColourOrange,
|
||||||
|
ColourPurple,
|
||||||
|
ColourRed,
|
||||||
|
ColourTextPre,
|
||||||
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,73 +15,77 @@ import {
|
|||||||
* @returns {object} legend The legend-object to be added
|
* @returns {object} legend The legend-object to be added
|
||||||
*/
|
*/
|
||||||
function CreateUpgradeBarLegend() {
|
function CreateUpgradeBarLegend() {
|
||||||
const legend = document.createElement('div');
|
const legend = document.createElement('div');
|
||||||
legend.style.minWidth = '330px';
|
legend.style.minWidth = '330px';
|
||||||
legend.style.marginBottom = '4px';
|
legend.style.marginBottom = '4px';
|
||||||
const title = document.createElement('div');
|
const title = document.createElement('div');
|
||||||
title.className = 'name';
|
title.className = 'name';
|
||||||
title.style.marginBottom = '4px';
|
title.style.marginBottom = '4px';
|
||||||
title.textContent = 'Legend';
|
title.textContent = 'Legend';
|
||||||
legend.appendChild(title);
|
legend.appendChild(title);
|
||||||
|
|
||||||
const legendLine = function (color, text) {
|
const legendLine = function (color, text) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.style.verticalAlign = 'middle';
|
div.style.verticalAlign = 'middle';
|
||||||
const span = document.createElement('span');
|
const span = document.createElement('span');
|
||||||
span.className = ColorBackPre + color;
|
span.className = ColourBackPre + color;
|
||||||
span.style.display = 'inline-block';
|
span.style.display = 'inline-block';
|
||||||
span.style.height = '10px';
|
span.style.height = '10px';
|
||||||
span.style.width = '10px';
|
span.style.width = '10px';
|
||||||
span.style.marginRight = '4px';
|
span.style.marginRight = '4px';
|
||||||
div.appendChild(span);
|
div.appendChild(span);
|
||||||
div.appendChild(document.createTextNode(text));
|
div.appendChild(document.createTextNode(text));
|
||||||
return div;
|
return div;
|
||||||
};
|
};
|
||||||
|
|
||||||
legend.appendChild(legendLine(ColorBlue, 'Better than best PP building'));
|
legend.appendChild(legendLine(ColourBlue, 'Better than the best PP of a building option'));
|
||||||
legend.appendChild(legendLine(ColorGreen, 'Same as best PP building'));
|
legend.appendChild(legendLine(ColourGreen, 'Same as the best PP building option'));
|
||||||
legend.appendChild(legendLine(ColorYellow, 'Between best and worst PP buildings closer to best'));
|
legend.appendChild(legendLine(ColourYellow, 'Within the top 10 of PP for buildings'));
|
||||||
legend.appendChild(legendLine(ColorOrange, 'Between best and worst PP buildings closer to worst'));
|
legend.appendChild(legendLine(ColourOrange, 'Within the top 20 of PP for buildings'));
|
||||||
legend.appendChild(legendLine(ColorRed, 'Same as worst PP building'));
|
legend.appendChild(legendLine(ColourRed, 'Within the top 30 of PP for buildings'));
|
||||||
legend.appendChild(legendLine(ColorPurple, 'Worse than worst PP building'));
|
legend.appendChild(legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'));
|
||||||
legend.appendChild(legendLine(ColorGray, 'Negative or infinity PP'));
|
legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP'));
|
||||||
return legend;
|
return legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the upgrade bar above the upgrade-section in the right section of the screen
|
* This function creates the upgrade bar above the upgrade-section in the right section of the screen
|
||||||
*/
|
*/
|
||||||
export default function CreateUpgradeBar() {
|
export default function CreateUpgradeBar() {
|
||||||
const UpgradeBar = document.createElement('div');
|
const UpgradeBar = document.createElement('div');
|
||||||
UpgradeBar.id = 'CMUpgradeBar';
|
UpgradeBar.id = 'CMUpgradeBar';
|
||||||
UpgradeBar.style.width = '100%';
|
UpgradeBar.style.width = '100%';
|
||||||
UpgradeBar.style.backgroundColor = 'black';
|
UpgradeBar.style.backgroundColor = 'black';
|
||||||
UpgradeBar.style.textAlign = 'center';
|
UpgradeBar.style.textAlign = 'center';
|
||||||
UpgradeBar.style.fontWeight = 'bold';
|
UpgradeBar.style.fontWeight = 'bold';
|
||||||
UpgradeBar.style.display = 'none';
|
UpgradeBar.style.display = 'none';
|
||||||
UpgradeBar.style.zIndex = '21';
|
UpgradeBar.style.zIndex = '21';
|
||||||
UpgradeBar.onmouseout = function () { Game.tooltip.hide(); };
|
UpgradeBar.onmouseout = function () {
|
||||||
|
Game.tooltip.hide();
|
||||||
|
};
|
||||||
|
|
||||||
const placeholder = document.createElement('div');
|
const placeholder = document.createElement('div');
|
||||||
placeholder.appendChild(CreateUpgradeBarLegend());
|
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 upgradeNumber = function (id, color) {
|
||||||
const span = document.createElement('span');
|
const span = document.createElement('span');
|
||||||
span.id = id;
|
span.id = id;
|
||||||
span.className = ColorTextPre + color;
|
span.className = ColourTextPre + color;
|
||||||
span.style.width = '14.28571428571429%';
|
span.style.width = '14.28571428571429%';
|
||||||
span.style.display = 'inline-block';
|
span.style.display = 'inline-block';
|
||||||
span.textContent = '0';
|
span.textContent = '0';
|
||||||
return span;
|
return span;
|
||||||
};
|
};
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarBlue', ColorBlue));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarBlue', ColourBlue));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGreen', ColorGreen));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGreen', ColourGreen));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarYellow', ColorYellow));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarYellow', ColourYellow));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarOrange', ColorOrange));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarOrange', ColourOrange));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarRed', ColorRed));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarRed', ColourRed));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColorPurple));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple));
|
||||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColorGray));
|
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray));
|
||||||
|
|
||||||
l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
|
l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +1,96 @@
|
|||||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
ColorBackPre, ColorBlue, ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, Colors, ColorYellow,
|
ColourBackPre,
|
||||||
|
ColourBlue,
|
||||||
|
ColourGray,
|
||||||
|
ColourGreen,
|
||||||
|
ColourOrange,
|
||||||
|
ColourPurple,
|
||||||
|
ColourRed,
|
||||||
|
ColoursOrdering,
|
||||||
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adjusts some things in the upgrades section
|
* This function adjusts some things in the upgrades section
|
||||||
* It colours them and shuffles the order when CM.Options.SortBuildings is set
|
* It colours them and shuffles the order when CM.Options.SortBuildings is set
|
||||||
* The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale()
|
* The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColour & CM.Disp.RefreshScale()
|
||||||
* And by changes in CM.Options.SortUpgrades
|
* And by changes in CM.Options.SortUpgrades
|
||||||
*/
|
*/
|
||||||
export default function UpdateUpgrades() {
|
export default function UpdateUpgrades() {
|
||||||
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar
|
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar
|
||||||
if (CMOptions.UpBarColor > 0) {
|
if (CMOptions.UpBarColour > 0) {
|
||||||
let blue = 0;
|
let blue = 0;
|
||||||
let green = 0;
|
let green = 0;
|
||||||
let yellow = 0;
|
let yellow = 0;
|
||||||
let orange = 0;
|
let orange = 0;
|
||||||
let red = 0;
|
let red = 0;
|
||||||
let purple = 0;
|
let purple = 0;
|
||||||
let gray = 0;
|
let gray = 0;
|
||||||
|
|
||||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||||
const me = Game.UpgradesInStore[i];
|
const me = Game.UpgradesInStore[i];
|
||||||
let addedColor = false;
|
let addedColour = false;
|
||||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j++) {
|
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||||
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1) {
|
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
|
||||||
l(`upgrade${i}`).childNodes[j].className = ColorBackPre + CacheUpgrades[me.name].color;
|
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
|
||||||
addedColor = true;
|
addedColour = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!addedColor) {
|
if (!addedColour) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.style.width = '10px';
|
div.style.width = '10px';
|
||||||
div.style.height = '10px';
|
div.style.height = '10px';
|
||||||
div.className = ColorBackPre + CacheUpgrades[me.name].color;
|
div.className = ColourBackPre + CacheUpgrades[me.name].color;
|
||||||
l(`upgrade${i}`).appendChild(div);
|
l(`upgrade${i}`).appendChild(div);
|
||||||
}
|
}
|
||||||
if (CacheUpgrades[me.name].color === ColorBlue) blue++;
|
if (CacheUpgrades[me.name].color === ColourBlue) blue += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorGreen) green++;
|
else if (CacheUpgrades[me.name].color === ColourGreen) green += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow++;
|
else if (CacheUpgrades[me.name].color === ColourYellow) yellow += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange++;
|
else if (CacheUpgrades[me.name].color === ColourOrange) orange += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorRed) red++;
|
else if (CacheUpgrades[me.name].color === ColourRed) red += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple++;
|
else if (CacheUpgrades[me.name].color === ColourPurple) purple += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColorGray) gray++;
|
else if (CacheUpgrades[me.name].color === ColourGray) gray += 1;
|
||||||
}
|
});
|
||||||
|
|
||||||
l('CMUpgradeBarBlue').textContent = blue;
|
l('CMUpgradeBarBlue').textContent = blue;
|
||||||
l('CMUpgradeBarGreen').textContent = green;
|
l('CMUpgradeBarGreen').textContent = green;
|
||||||
l('CMUpgradeBarYellow').textContent = yellow;
|
l('CMUpgradeBarYellow').textContent = yellow;
|
||||||
l('CMUpgradeBarOrange').textContent = orange;
|
l('CMUpgradeBarOrange').textContent = orange;
|
||||||
l('CMUpgradeBarRed').textContent = red;
|
l('CMUpgradeBarRed').textContent = red;
|
||||||
l('CMUpgradeBarPurple').textContent = purple;
|
l('CMUpgradeBarPurple').textContent = purple;
|
||||||
l('CMUpgradeBarGray').textContent = gray;
|
l('CMUpgradeBarGray').textContent = gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
// Build array of pointers, sort by pp, set flex positions
|
// Build array of pointers, sort by pp, set flex positions
|
||||||
// This regulates sorting of upgrades
|
// 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 = {};
|
const o = {};
|
||||||
o.name = Game.UpgradesInStore[x].name;
|
o.name = Game.UpgradesInStore[x].name;
|
||||||
o.price = Game.UpgradesInStore[x].basePrice;
|
o.price = Game.UpgradesInStore[x].basePrice;
|
||||||
o.pp = CacheUpgrades[o.name].pp;
|
o.pp = CacheUpgrades[o.name].pp;
|
||||||
arr.push(o);
|
o.color = CacheUpgrades[o.name].color;
|
||||||
}
|
arr.push(o);
|
||||||
|
}
|
||||||
|
|
||||||
if (CMOptions.SortUpgrades) {
|
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)); });
|
// Sort by pp colour group, then by pp.
|
||||||
} else {
|
arr.sort((a, b) =>
|
||||||
arr.sort((a, b) => a.price - b.price);
|
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||||
}
|
? a.pp - b.pp
|
||||||
|
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
arr.sort((a, b) => a.price - b.price);
|
||||||
|
}
|
||||||
|
|
||||||
const nameChecker = function (arr2, upgrade) {
|
const nameChecker = function (arr2, upgrade) {
|
||||||
return arr2.findIndex((e) => e.name === upgrade.name);
|
return arr2.findIndex((e) => e.name === upgrade.name);
|
||||||
};
|
};
|
||||||
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
|
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||||
l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,32 +4,37 @@ import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
|||||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
||||||
import { Beautify, FormatTime } from '../BeautifyAndFormatting/BeautifyFormatting';
|
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||||
|
import FormatTime from '../BeautifyAndFormatting/FormatTime';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||||
* @param {number} aura The number of the aura currently selected by the mouse/user
|
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||||
*/
|
*/
|
||||||
export function AddAuraInfo(aura) {
|
export function AddAuraInfo(aura) {
|
||||||
if (CMOptions.DragonAuraInfo === 1) {
|
if (CMOptions.DragonAuraInfo === 1) {
|
||||||
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
|
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);
|
let bonusCPSPercentage;
|
||||||
|
if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity);
|
||||||
|
else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
|
||||||
|
|
||||||
l('dragonAuraInfo').style.minHeight = '60px';
|
l('dragonAuraInfo').style.minHeight = '60px';
|
||||||
l('dragonAuraInfo').style.margin = '8px';
|
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');
|
const div = document.createElement('div');
|
||||||
div.style.minWidth = '200px';
|
div.style.minWidth = '200px';
|
||||||
div.style.textAlign = 'center';
|
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(
|
||||||
l('dragonAuraInfo').appendChild(div);
|
bonusCPS,
|
||||||
const div2 = document.createElement('div');
|
)} (${bonusCPSPercentage}% of current CPS).`;
|
||||||
div2.style.minWidth = '200px';
|
l('dragonAuraInfo').appendChild(div);
|
||||||
div2.style.textAlign = 'center';
|
const div2 = document.createElement('div');
|
||||||
div2.textContent = `It will take ${timeToRecover} to recover the cost.`;
|
div2.style.minWidth = '200px';
|
||||||
l('dragonAuraInfo').appendChild(div2);
|
div2.style.textAlign = 'center';
|
||||||
}
|
div2.textContent = `It will take ${timeToRecover} to recover the cost.`;
|
||||||
|
l('dragonAuraInfo').appendChild(div2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,18 +42,27 @@ export function AddAuraInfo(aura) {
|
|||||||
* It is called by Game.ToggleSpecialMenu() after CM.Main.ReplaceNative()
|
* It is called by Game.ToggleSpecialMenu() after CM.Main.ReplaceNative()
|
||||||
*/
|
*/
|
||||||
export function AddDragonLevelUpTooltip() {
|
export function AddDragonLevelUpTooltip() {
|
||||||
// Check if it is the dragon popup that is on screen
|
// 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 (
|
||||||
for (let i = 0; i < l('specialPopup').childNodes.length; i++) {
|
(l('specialPopup').className.match(/onScreen/) &&
|
||||||
if (l('specialPopup').childNodes[i].className === 'optionBox') {
|
l('specialPopup').children[0].style.background.match(/dragon/)) !== null
|
||||||
l('specialPopup').children[i].onmouseover = function () {
|
) {
|
||||||
CacheDragonCost();
|
for (let i = 0; i < l('specialPopup').childNodes.length; i++) {
|
||||||
Game.tooltip.dynamic = 1;
|
if (l('specialPopup').childNodes[i].className === 'optionBox') {
|
||||||
Game.tooltip.draw(l('specialPopup'), `<div style="min-width:200px;text-align:center;">${CacheCostDragonUpgrade}</div>`, 'this');
|
l('specialPopup').children[i].onmouseover = function () {
|
||||||
Game.tooltip.wobble();
|
CacheDragonCost();
|
||||||
};
|
Game.tooltip.dynamic = 1;
|
||||||
l('specialPopup').children[i].onmouseout = function () { Game.tooltip.shouldHide = 1; };
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
import { CMOptions } from '../Config/VariablesAndData';
|
|
||||||
import { Beautify } from './BeautifyAndFormatting/BeautifyFormatting';
|
|
||||||
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
|
||||||
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';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function handles all custom drawing for the Game.Draw() function.
|
|
||||||
* It is hooked on 'draw' by CM.RegisterHooks()
|
|
||||||
*/
|
|
||||||
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
|
|
||||||
) {
|
|
||||||
const timer = document.getElementById('CMStatsAutosaveTimer');
|
|
||||||
if (timer) {
|
|
||||||
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update colors
|
|
||||||
UpdateBuildings();
|
|
||||||
UpdateUpgrades();
|
|
||||||
|
|
||||||
// Redraw timers
|
|
||||||
UpdateTimerBar();
|
|
||||||
|
|
||||||
// Update Bottom Bar
|
|
||||||
UpdateBotBar();
|
|
||||||
|
|
||||||
// Update Tooltip
|
|
||||||
UpdateTooltips();
|
|
||||||
|
|
||||||
// Update Wrinkler Tooltip
|
|
||||||
CheckWrinklerTooltip();
|
|
||||||
UpdateWrinklerTooltip();
|
|
||||||
|
|
||||||
// Change menu refresh interval
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
61
src/Disp/DrawHook.js
Normal file
61
src/Disp/DrawHook.js
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
||||||
|
import { CMOptions } from '../Config/VariablesAndData';
|
||||||
|
import Beautify from './BeautifyAndFormatting/Beautify';
|
||||||
|
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
||||||
|
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight';
|
||||||
|
import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
|
||||||
|
import { UpdateBotBar } from './InfoBars/BottomBar';
|
||||||
|
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
||||||
|
import RefreshMenu from './MenuSections/Refreshmenu';
|
||||||
|
import UpdateTooltips from './Tooltips/UpdateTooltips';
|
||||||
|
import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/WrinklerTooltips';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function handles all custom drawing for the Game.Draw() function.
|
||||||
|
* It is hooked on 'draw' by CM.RegisterHooks()
|
||||||
|
*/
|
||||||
|
export default function CMDrawHook() {
|
||||||
|
// 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
|
||||||
|
) {
|
||||||
|
const timer = document.getElementById('CMStatsAutosaveTimer');
|
||||||
|
if (timer) {
|
||||||
|
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update colors
|
||||||
|
UpdateBuildings();
|
||||||
|
UpdateUpgrades();
|
||||||
|
UpdateUpgradeSectionsHeight();
|
||||||
|
|
||||||
|
// Redraw timers
|
||||||
|
UpdateTimerBar();
|
||||||
|
|
||||||
|
// Update Bottom Bar
|
||||||
|
UpdateBotBar();
|
||||||
|
|
||||||
|
// Update Tooltip
|
||||||
|
UpdateTooltips();
|
||||||
|
|
||||||
|
// Update Wrinkler Tooltip
|
||||||
|
CheckWrinklerTooltip();
|
||||||
|
UpdateWrinklerTooltip();
|
||||||
|
|
||||||
|
// Change menu refresh interval
|
||||||
|
RefreshMenu();
|
||||||
|
|
||||||
|
// Update display of wrinkler buttons, this checks if Elder Pledge has been bought and if they should be disabled
|
||||||
|
ToggleWrinklerButtons();
|
||||||
|
|
||||||
|
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
|
||||||
|
if (CMOptions.Scale) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,25 +8,33 @@ import { GCTimers } from '../VariablesAndData';
|
|||||||
* @param {object} cookie A Golden Cookie object
|
* @param {object} cookie A Golden Cookie object
|
||||||
*/
|
*/
|
||||||
export default function CreateGCTimer(cookie) {
|
export default function CreateGCTimer(cookie) {
|
||||||
const GCTimer = document.createElement('div');
|
const GCTimer = document.createElement('div');
|
||||||
GCTimer.id = `GCTimer${cookie.id}`;
|
GCTimer.id = `GCTimer${cookie.id}`;
|
||||||
GCTimer.style.width = '96px';
|
GCTimer.style.width = '96px';
|
||||||
GCTimer.style.height = '96px';
|
GCTimer.style.height = '96px';
|
||||||
GCTimer.style.position = 'absolute';
|
GCTimer.style.position = 'absolute';
|
||||||
GCTimer.style.zIndex = '10000000001';
|
GCTimer.style.zIndex = '10000000001';
|
||||||
GCTimer.style.textAlign = 'center';
|
GCTimer.style.textAlign = 'center';
|
||||||
GCTimer.style.lineHeight = '96px';
|
GCTimer.style.lineHeight = '96px';
|
||||||
GCTimer.style.fontFamily = '"Kavoon", Georgia, serif';
|
GCTimer.style.fontFamily = '"Kavoon", Georgia, serif';
|
||||||
GCTimer.style.fontSize = '35px';
|
GCTimer.style.fontSize = '35px';
|
||||||
GCTimer.style.cursor = 'pointer';
|
GCTimer.style.cursor = 'pointer';
|
||||||
GCTimer.style.display = 'block';
|
GCTimer.style.display = 'block';
|
||||||
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
||||||
GCTimer.style.left = cookie.l.style.left;
|
GCTimer.style.left = cookie.l.style.left;
|
||||||
GCTimer.style.top = cookie.l.style.top;
|
GCTimer.style.top = cookie.l.style.top;
|
||||||
GCTimer.onclick = function () { cookie.pop(); };
|
GCTimer.onclick = function () {
|
||||||
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))'; };
|
cookie.pop();
|
||||||
GCTimer.onmouseout = function () { cookie.l.style.filter = ''; cookie.l.style.webkitFilter = ''; };
|
};
|
||||||
|
GCTimer.onmouseover = function () {
|
||||||
|
cookie.l.style.filter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
|
||||||
|
cookie.l.style.webkitFilter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
|
||||||
|
};
|
||||||
|
GCTimer.onmouseout = function () {
|
||||||
|
cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign
|
||||||
|
cookie.l.style.webkitFilter = ''; // eslint-disable-line no-param-reassign
|
||||||
|
};
|
||||||
|
|
||||||
GCTimers[cookie.id] = GCTimer;
|
GCTimers[cookie.id] = GCTimer;
|
||||||
l('shimmers').appendChild(GCTimer);
|
l('shimmers').appendChild(GCTimer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,11 @@
|
|||||||
* @returns {number} count / Game.fps The time it takes to reach targetMagic
|
* @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 count = 0;
|
let magic = currentMagic;
|
||||||
while (currentMagic < targetMagic) {
|
let count = 0;
|
||||||
currentMagic += Math.max(0.002, (currentMagic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
while (magic < targetMagic) {
|
||||||
count++;
|
magic += Math.max(0.002, (magic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||||
}
|
count += 1;
|
||||||
return count / Game.fps;
|
}
|
||||||
|
return count / Game.fps;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
CacheAvgCps, CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult, CacheWrinklersFattest,
|
CacheAverageCPS,
|
||||||
|
CacheCurrWrinklerCount,
|
||||||
|
CacheCurrWrinklerCPSMult,
|
||||||
|
CacheWrinklersFattest,
|
||||||
} from '../../Cache/VariablesAndData';
|
} from '../../Cache/VariablesAndData';
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
|
||||||
@@ -8,14 +11,25 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
|||||||
* @returns {number} The average or current cps
|
* @returns {number} The average or current cps
|
||||||
*/
|
*/
|
||||||
export default function GetCPS() {
|
export default function GetCPS() {
|
||||||
if (CMOptions.CPSMode) {
|
if (CMOptions.CPSMode) {
|
||||||
return CacheAvgCps;
|
return CacheAverageCPS;
|
||||||
} if (CMOptions.CalcWrink === 0) {
|
}
|
||||||
return (Game.cookiesPs * (1 - Game.cpsSucked));
|
if (CMOptions.CalcWrink === 0) {
|
||||||
} if (CMOptions.CalcWrink === 1) {
|
return Game.cookiesPs * (1 - Game.cpsSucked);
|
||||||
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - (CacheCurrWrinklerCount * 0.05)));
|
}
|
||||||
} if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) {
|
if (CMOptions.CalcWrink === 1) {
|
||||||
return Game.cookiesPs * ((CacheCurrWrinklerCPSMult * 3 / CacheCurrWrinklerCount) + (1 - (CacheCurrWrinklerCount * 0.05)));
|
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05));
|
||||||
}
|
}
|
||||||
return Game.cookiesPs * ((CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount) + (1 - (CacheCurrWrinklerCount * 0.05)));
|
if (CacheWrinklersFattest[1] !== null)
|
||||||
|
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,24 +0,0 @@
|
|||||||
import {
|
|
||||||
ColorGray, ColorGreen, ColorOrange, ColorPurple, ColorRed, ColorYellow,
|
|
||||||
} from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns Name and Color as object for sugar lump type that is given as input param.
|
|
||||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
|
||||||
* @param {string} type Sugar Lump Type.
|
|
||||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
|
||||||
*/
|
|
||||||
export default function GetLumpColor(type) {
|
|
||||||
if (type === 0) {
|
|
||||||
return { text: 'Normal', color: ColorGray };
|
|
||||||
} if (type === 1) {
|
|
||||||
return { text: 'Bifurcated', color: ColorGreen };
|
|
||||||
} if (type === 2) {
|
|
||||||
return { text: 'Golden', color: ColorYellow };
|
|
||||||
} if (type === 3) {
|
|
||||||
return { text: 'Meaty', color: ColorOrange };
|
|
||||||
} if (type === 4) {
|
|
||||||
return { text: 'Caramelized', color: ColorPurple };
|
|
||||||
}
|
|
||||||
return { text: 'Unknown Sugar Lump', color: ColorRed };
|
|
||||||
}
|
|
||||||
33
src/Disp/HelperFunctions/GetLumpColour.js
Normal file
33
src/Disp/HelperFunctions/GetLumpColour.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import {
|
||||||
|
ColourGray,
|
||||||
|
ColourGreen,
|
||||||
|
ColourOrange,
|
||||||
|
ColourPurple,
|
||||||
|
ColourRed,
|
||||||
|
ColourYellow,
|
||||||
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
||||||
|
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||||
|
* @param {string} type Sugar Lump Type.
|
||||||
|
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
||||||
|
*/
|
||||||
|
export default function GetLumpColour(type) {
|
||||||
|
if (type === 0) {
|
||||||
|
return { text: 'Normal', color: ColourGray };
|
||||||
|
}
|
||||||
|
if (type === 1) {
|
||||||
|
return { text: 'Bifurcated', color: ColourGreen };
|
||||||
|
}
|
||||||
|
if (type === 2) {
|
||||||
|
return { text: 'Golden', color: ColourYellow };
|
||||||
|
}
|
||||||
|
if (type === 3) {
|
||||||
|
return { text: 'Meaty', color: ColourOrange };
|
||||||
|
}
|
||||||
|
if (type === 4) {
|
||||||
|
return { text: 'Caramelized', color: ColourPurple };
|
||||||
|
}
|
||||||
|
return { text: 'Unknown Sugar Lump', color: ColourRed };
|
||||||
|
}
|
||||||
@@ -7,10 +7,11 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
|||||||
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
|
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
|
||||||
*/
|
*/
|
||||||
export default function GetWrinkConfigBank() {
|
export default function GetWrinkConfigBank() {
|
||||||
if (CMOptions.CalcWrink === 1) {
|
if (CMOptions.CalcWrink === 1) {
|
||||||
return CacheWrinklersTotal;
|
return CacheWrinklersTotal;
|
||||||
} if (CMOptions.CalcWrink === 2) {
|
}
|
||||||
return CacheWrinklersFattest[0];
|
if (CMOptions.CalcWrink === 2) {
|
||||||
}
|
return CacheWrinklersFattest[0];
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
|
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
|
||||||
*/
|
*/
|
||||||
export default function PopAllNormalWrinklers() {
|
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) {
|
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
|
||||||
Game.wrinklers[i].hp = 0;
|
Game.wrinklers[i].hp = 0;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { UpdateBotBar } from '../InfoBars/BottomBar';
|
|||||||
* It is therefore called by a changes in CM.Options.Scale, CM.Options.ScaleDecimals, CM.Options.ScaleSeparator and CM.Options.ScaleCutoff
|
* It is therefore called by a changes in CM.Options.Scale, CM.Options.ScaleDecimals, CM.Options.ScaleSeparator and CM.Options.ScaleCutoff
|
||||||
*/
|
*/
|
||||||
export default function RefreshScale() {
|
export default function RefreshScale() {
|
||||||
BeautifyAll();
|
BeautifyAll();
|
||||||
Game.RefreshStore();
|
Game.RefreshStore();
|
||||||
Game.RebuildUpgrades();
|
Game.RebuildUpgrades();
|
||||||
|
|
||||||
UpdateBotBar();
|
UpdateBotBar();
|
||||||
UpdateBuildings();
|
UpdateBuildings();
|
||||||
UpdateUpgrades();
|
UpdateUpgrades();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import UpdateBackground from './UpdateBackground';
|
|||||||
* It is called by CM.Disp.Draw()
|
* It is called by CM.Disp.Draw()
|
||||||
*/
|
*/
|
||||||
export default function UpdateAscendState() {
|
export default function UpdateAscendState() {
|
||||||
if (Game.OnAscend) {
|
if (Game.OnAscend) {
|
||||||
l('game').style.bottom = '0px';
|
l('game').style.bottom = '0px';
|
||||||
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none';
|
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none';
|
||||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none';
|
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
ToggleBotBar();
|
ToggleBotBar();
|
||||||
ToggleTimerBar();
|
ToggleTimerBar();
|
||||||
}
|
}
|
||||||
UpdateBackground();
|
UpdateBackground();
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user