Compare commits
277 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f06fd383a | ||
|
|
acd0fbbaf5 | ||
|
|
38636f6323 | ||
|
|
082bc89a4a | ||
|
|
bd772e3712 | ||
|
|
69b923de89 | ||
|
|
4e6c828f8b | ||
|
|
270190feae | ||
|
|
13dd628623 | ||
|
|
5604a63652 | ||
|
|
3f867b9023 | ||
|
|
d4e243f2b7 | ||
|
|
989e984eb5 | ||
|
|
6e4644c3cc | ||
|
|
379593f7fc | ||
|
|
16ec2ff06a | ||
|
|
933a017335 | ||
|
|
492abb66dc | ||
|
|
a1aaa3de8f | ||
|
|
9e98208c19 | ||
|
|
ca1c28d1fc | ||
|
|
ce14fa6190 | ||
|
|
ec2c498b71 | ||
|
|
657ca1a963 | ||
|
|
f6ebfef6cd | ||
|
|
133ed74877 | ||
|
|
8e975c2b20 | ||
|
|
d8b9d2f20c | ||
|
|
9f78e14bec | ||
|
|
7269577009 | ||
|
|
8d89f23c35 | ||
|
|
78f62affc5 | ||
|
|
4b8c35f271 | ||
|
|
1d19545a43 | ||
|
|
76d531a5b0 | ||
|
|
54bb9f793b | ||
|
|
70cc97b0e0 | ||
|
|
adf6544e21 | ||
|
|
93702eefbe | ||
|
|
88eb28c5dd | ||
|
|
049d0153fb | ||
|
|
131547ec00 | ||
|
|
5e92bb5fa5 | ||
|
|
5ebfdfd48e | ||
|
|
1f685f823a | ||
|
|
197b744f56 | ||
|
|
ab73a78a01 | ||
|
|
8cfc980546 | ||
|
|
3fddc1d249 | ||
|
|
2555828eb9 | ||
|
|
66b2c567c2 | ||
|
|
dd66674169 | ||
|
|
cfca658703 | ||
|
|
a607842fdd | ||
|
|
501b2df220 | ||
|
|
1027d48b51 | ||
|
|
fdcbbd7ab2 | ||
|
|
9bfb8a44f9 | ||
|
|
fec312df1c | ||
|
|
1f23e58984 | ||
|
|
b1812afa2f | ||
|
|
22b8c8a61c | ||
|
|
25838daede | ||
|
|
21c0042c24 | ||
|
|
b12fd5db72 | ||
|
|
ef7d46b6dc | ||
|
|
ff8fe0644a | ||
|
|
6779133dd8 | ||
|
|
097ccd2048 | ||
|
|
c45a630286 | ||
|
|
30809c7b45 | ||
|
|
db8d722479 | ||
|
|
79f8079228 | ||
|
|
9d101ddfd4 | ||
|
|
0e69ac39dc | ||
|
|
f0757d2490 | ||
|
|
65754bc29d | ||
|
|
1d26217f80 | ||
|
|
c0751438b6 | ||
|
|
53ed8fe167 | ||
|
|
74e7c64ca2 | ||
|
|
809bd4d35d | ||
|
|
348ba4b9fd | ||
|
|
9e783cc3d7 | ||
|
|
6766c05091 | ||
|
|
1f6ca9ebe6 | ||
|
|
bbf31fe96f | ||
|
|
4be3942af3 | ||
|
|
488233c8dd | ||
|
|
a89f1eed1a | ||
|
|
790cf411c3 | ||
|
|
46853f711a | ||
|
|
60121c0be5 | ||
|
|
c7d9144dd2 | ||
|
|
aa5cad663b | ||
|
|
b191d9a434 | ||
|
|
1842c40c01 | ||
|
|
9c005b2f2f | ||
|
|
e6d89fa0c7 | ||
|
|
b74ae3eee0 | ||
|
|
e4267f4c41 | ||
|
|
62dc882e5a | ||
|
|
f7e7d171e8 | ||
|
|
669b5c1dd9 | ||
|
|
f67b561990 | ||
|
|
5def4ee13b | ||
|
|
c4812ef8fc | ||
|
|
9b9bf962b7 | ||
|
|
2940d1c631 | ||
|
|
0cf30e5cea | ||
|
|
700a5987a8 | ||
|
|
029c25f48e | ||
|
|
6fb8470432 | ||
|
|
518aff7ca7 | ||
|
|
f82b0fbc3a | ||
|
|
c0c3414dea | ||
|
|
513780efc4 | ||
|
|
295771bcec | ||
|
|
0184fde289 | ||
|
|
66d6be8039 | ||
|
|
612ab6a6f5 | ||
|
|
fd3276a9a7 | ||
|
|
b9fe2aa3fb | ||
|
|
765f2637f9 | ||
|
|
4b454cc123 | ||
|
|
725e053df6 | ||
|
|
4008c2a8ee | ||
|
|
248c36c357 | ||
|
|
5679f4ab01 | ||
|
|
40dc0b89cc | ||
|
|
c6b38aa501 | ||
|
|
667b91142f | ||
|
|
f4445f7b0a | ||
|
|
7e42c62f6b | ||
|
|
3d99f818ab | ||
|
|
5f40b2a45e | ||
|
|
1fbe7c4b51 | ||
|
|
fbaa2cc8de | ||
|
|
91dd817212 | ||
|
|
dddf786567 | ||
|
|
df392029ce | ||
|
|
5ae4ed761f | ||
|
|
c080876fc0 | ||
|
|
001efa24bd | ||
|
|
0963a2b63a | ||
|
|
fb8f6dbb49 | ||
|
|
88952e9986 | ||
|
|
946d0ff00e | ||
|
|
27fd8626c8 | ||
|
|
cb23000caa | ||
|
|
2be1716c05 | ||
|
|
b363e3a06a | ||
|
|
c909c99cb5 | ||
|
|
4c63f6d9e2 | ||
|
|
97f8e974de | ||
|
|
8e27b5980b | ||
|
|
42543370b7 | ||
|
|
ccc5f83491 | ||
|
|
b736015b1c | ||
|
|
60f19e5084 | ||
|
|
525ea72174 | ||
|
|
2489eb16ac | ||
|
|
c455f940c6 | ||
|
|
36780486a1 | ||
|
|
89f895f01e | ||
|
|
55e3fe536c | ||
|
|
f60ac4889e | ||
|
|
51713afaea | ||
|
|
d0ddc93f7c | ||
|
|
65eff470cf | ||
|
|
9996e59024 | ||
|
|
f59972892b | ||
|
|
4fe07ba1d3 | ||
|
|
7d40e12472 | ||
|
|
bedda0093d | ||
|
|
7c26b8015a | ||
|
|
ce768cb135 | ||
|
|
1f219df674 | ||
|
|
8280d3ae7a | ||
|
|
3144e776b7 | ||
|
|
be0edd090d | ||
|
|
038a8b33b0 | ||
|
|
6395ad318a | ||
|
|
ed0049e367 | ||
|
|
bbd523ac3f | ||
|
|
cb1f9d7ca5 | ||
|
|
fb0f42deed | ||
|
|
74bb5d924d | ||
|
|
065f8b4c23 | ||
|
|
e685489543 | ||
|
|
6a4772d8e2 | ||
|
|
bd0a55609d | ||
|
|
6fcece6fc8 | ||
|
|
3e3659e2a4 | ||
|
|
10c1e9eefb | ||
|
|
4c4ef57ce4 | ||
|
|
02bf0d6455 | ||
|
|
f89a685c49 | ||
|
|
d776b9b799 | ||
|
|
2a82fc2b1f | ||
|
|
80b373ff6c | ||
|
|
8c118b6aef | ||
|
|
82c872ef18 | ||
|
|
e9dc2ffa51 | ||
|
|
9294a5bc87 | ||
|
|
248fd32e91 | ||
|
|
436c1d7239 | ||
|
|
055ba22ee2 | ||
|
|
b84e511e52 | ||
|
|
ec35013be7 | ||
|
|
52edc5696a | ||
|
|
eefecb7829 | ||
|
|
bb0ba7f116 | ||
|
|
075bd89669 | ||
|
|
43a651ea4a | ||
|
|
fde93b5639 | ||
|
|
80dab239b6 | ||
|
|
22faf1edc2 | ||
|
|
522443c30f | ||
|
|
d8eea6939e | ||
|
|
ab7a092ab9 | ||
|
|
c661cba533 | ||
|
|
451ed9ee7a | ||
|
|
6ac737d3af | ||
|
|
4572d0e5c5 | ||
|
|
b7c7739a25 | ||
|
|
85b6d96be6 | ||
|
|
68e42e2744 | ||
|
|
984c11e2ac | ||
|
|
e3eccf25e8 | ||
|
|
85b161fe14 | ||
|
|
a497dec741 | ||
|
|
5a7187aa3c | ||
|
|
db07ab6c3e | ||
|
|
c0e788b143 | ||
|
|
b959b3c024 | ||
|
|
c8eeab45af | ||
|
|
28bc2b5620 | ||
|
|
ecf73d815f | ||
|
|
094b153f7e | ||
|
|
3ac2c75b6f | ||
|
|
3b444c2b69 | ||
|
|
a5c052b46e | ||
|
|
531adb2a16 | ||
|
|
e3fddd4450 | ||
|
|
07bb28cf46 | ||
|
|
a9eb56de0c | ||
|
|
dcf00b82b8 | ||
|
|
27a621d9b0 | ||
|
|
14ba9105ca | ||
|
|
6f36d1dcf1 | ||
|
|
69afafd0fb | ||
|
|
c9b6a06908 | ||
|
|
a877dc5ad3 | ||
|
|
68e6afa410 | ||
|
|
3401a6165f | ||
|
|
59217317b3 | ||
|
|
a147065fd6 | ||
|
|
27ad606380 | ||
|
|
6a30843c7d | ||
|
|
ca5acc1d37 | ||
|
|
a8c9fea127 | ||
|
|
d549bbdf9b | ||
|
|
e6b5bddda6 | ||
|
|
712a3dd5c3 | ||
|
|
e0756c4943 | ||
|
|
96b55fb77c | ||
|
|
b06ff269a1 | ||
|
|
17a3ef0d83 | ||
|
|
8cc7bb7f99 | ||
|
|
0bff74bddd | ||
|
|
ad146f9a43 | ||
|
|
aba1b88eac | ||
|
|
af547ee2c4 | ||
|
|
6344c454a6 | ||
|
|
65cec9da50 | ||
|
|
7df6e5fa54 |
@@ -8,25 +8,12 @@
|
||||
"l": "readonly",
|
||||
"b64_to_utf8": "readonly",
|
||||
"utf8_to_b64": "readonly",
|
||||
"BeautifyAll": "readonly",
|
||||
"PlaySound": "readonly"
|
||||
"BeautifyAll": "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
|
||||
|
||||
19
.github/CONTRIBUTING.md
vendored
19
.github/CONTRIBUTING.md
vendored
@@ -2,17 +2,18 @@ Cookie Monster is written to modify Cookie Clicker as little as possible. This m
|
||||
|
||||
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
|
||||
| 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
|
||||
|
||||
53
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
53
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: 🐛 Bug report
|
||||
description: Report a bug in Cookie Monster
|
||||
labels: [Bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Thank you for wanting to report a bug in Cookie Monster!**
|
||||
|
||||
⚠ Please make sure that this [issue wasn't already requested][issue search], or already implemented in the ``dev`` branch.
|
||||
|
||||
|
||||
[issue search]: https://github.com/CookieMonsterTeam/CookieMonster/issues?q=is%3Aissue+is%3Aopen+
|
||||
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: What is the bug about?
|
||||
placeholder: |
|
||||
# Please describe the bug and what you would have expected the mod to do
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: To reproduce
|
||||
description: How can you reproduce the bug?
|
||||
placeholder: |
|
||||
The steps needed to reproduce the behavior:
|
||||
1.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshot
|
||||
description: Please provide any relevant screenshots
|
||||
- type: textarea
|
||||
id: savefile
|
||||
attributes:
|
||||
label: Save file
|
||||
description: Please provide a save file and paste it in between the "```"
|
||||
placeholder: |
|
||||
```SAVE FILE HERE```
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Browser / Steam / Version
|
||||
description: Are you playing on browser (if so, which?) or Steam? And which version?
|
||||
placeholder: Steam, version 2.04
|
||||
validations:
|
||||
required: true
|
||||
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,26 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Please use this template to report bugs you might have found
|
||||
title: ''
|
||||
labels: Bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
Please describe the bug and what you would have expected the mod to do
|
||||
|
||||
**To Reproduce**
|
||||
The steps needed to reproduce the behavior:
|
||||
1. ...
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Save file**
|
||||
```
|
||||
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!
|
||||
28
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
28
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: ✨ Feature request
|
||||
description: Request a new feature for Cookie Monster
|
||||
labels: [Enhancement]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Thank you for wanting to suggest a new function for Cookie Monster!**
|
||||
|
||||
⚠ Please make sure that this [feature wasn't already requested][issue search], or already implemented in the ``dev`` branch.
|
||||
|
||||
|
||||
[issue search]: https://github.com/CookieMonsterTeam/CookieMonster/issues?q=is%3Aissue+is%3Aopen+
|
||||
|
||||
- type: textarea
|
||||
id: what-is-wanted
|
||||
attributes:
|
||||
label: Feature description
|
||||
description: Describe the function you'd like to see added to CookieMonster
|
||||
placeholder: |
|
||||
# A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-info
|
||||
attributes:
|
||||
label: Additional files
|
||||
description: Add any other files such as save files or screenshots about the feature request here.
|
||||
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,14 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for CookieMonster
|
||||
title: ''
|
||||
labels: Enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the function you'd like to see added to CookieMonster**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Additional files**
|
||||
Add any other files such as save files or screenshots about the feature request here.
|
||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -5,7 +5,7 @@
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/" # Location of package manifests
|
||||
- package-ecosystem: 'npm'
|
||||
directory: '/' # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
interval: 'weekly'
|
||||
|
||||
65
.github/workflows/CI.yml
vendored
65
.github/workflows/CI.yml
vendored
@@ -1,32 +1,43 @@
|
||||
name: CI
|
||||
on: pull_request
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
- gh-pages
|
||||
pull_request:
|
||||
jobs:
|
||||
Check_linting_test_and_build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_REGISTRY_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npx eslint src
|
||||
- name: Run Mocha tests
|
||||
run: npx mocha
|
||||
- name: Check if CookieMonsterDev.js is built correctly
|
||||
run: |
|
||||
npx webpack -o ./tmp --env production
|
||||
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 tmp/CookieMonsterDev.js); then
|
||||
echo '### SUCCESS: CookieMonsterDev is correctly built! ###'
|
||||
else
|
||||
echo '### WARNING: CookieMonsterDev.js does not seem to be correct. Make sure to run "npm run build" after saving all your changes! ###'
|
||||
exit 1
|
||||
fi
|
||||
- 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! ###'
|
||||
else
|
||||
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
|
||||
fi
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npx eslint
|
||||
- name: Run Mocha tests
|
||||
run: npx mocha
|
||||
- name: Check if CookieMonsterDev.js is built correctly
|
||||
run: |
|
||||
npx webpack -o ./tmp --env minimize
|
||||
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 tmp/CookieMonsterDev.js); then
|
||||
echo '### SUCCESS: CookieMonsterDev is built correctly! ###'
|
||||
else
|
||||
echo '### WARNING: CookieMonsterDev.js does not seem to be correct. Make sure to run "npm run build-dev" after saving all your changes! ###'
|
||||
exit 1
|
||||
fi
|
||||
- name: Check if CookieMonster.js is built correctly
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
npx webpack -o ./tmp --env minimize --env finalfile
|
||||
if cmp <(head -n 2 dist/CookieMonster.js) <(head -n 2 tmp/CookieMonster.js); then
|
||||
echo '### SUCCESS: CookieMonster is built correctly! ###'
|
||||
else
|
||||
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to run "npm run build-final" after saving all your changes! ###'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
2
.github/workflows/publish-dev.yml
vendored
2
.github/workflows/publish-dev.yml
vendored
@@ -2,7 +2,7 @@ name: Publish
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
- 'dev'
|
||||
jobs:
|
||||
publish-dev:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{
|
||||
"recursive": true,
|
||||
"require": ["esm", "ts-node/register"]
|
||||
"recursive": true
|
||||
}
|
||||
|
||||
4
.npmrc
Normal file
4
.npmrc
Normal file
@@ -0,0 +1,4 @@
|
||||
always-auth=true
|
||||
registry=https://registry.npmjs.org/
|
||||
@cookiemonsterteam:registry=https://npm.pkg.github.com
|
||||
//npm.pkg.github.com/:_authToken=${GITHUB_REGISTRY_PAT}
|
||||
12
.pre-commit-config.yaml
Normal file
12
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v4.0.0-alpha.8
|
||||
hooks:
|
||||
- id: prettier
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude: dist
|
||||
- id: end-of-file-fixer
|
||||
exclude: dist
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
@@ -1,6 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Cookie Monster
|
||||
// @include /https?://orteil.dashnet.org/cookieclicker/
|
||||
// @include /https?://cookieclicker.ee/
|
||||
// ==/UserScript==
|
||||
|
||||
const readyCheck = setInterval(() => {
|
||||
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
||||
52
README.md
52
README.md
@@ -1,19 +1,21 @@
|
||||
[](https://github.com/CookieMonsterTeam/CookieMonster/actions/workflows/CI.yml)
|
||||
|
||||
## 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.
|
||||
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
|
||||
The `master` branch hosts the latest production version intended for general users.
|
||||
|
||||
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
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```
|
||||
```javascript
|
||||
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
||||
```
|
||||
|
||||
@@ -21,14 +23,14 @@ If the relevant option is enabled, CM will color-code each of them based on thei
|
||||
|
||||
<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 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
|
||||
|
||||
</details>
|
||||
|
||||
@@ -42,8 +44,8 @@ Copy this code and save it as a bookmark. Paste it in the URL section. To activa
|
||||
|
||||
```javascript
|
||||
javascript: (function () {
|
||||
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
||||
}());
|
||||
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
||||
})();
|
||||
```
|
||||
|
||||
If (for some reason) the above doesn't work, trying pasting everything after the <code>javascript:</code> bit into your browser's console.
|
||||
@@ -66,22 +68,22 @@ All suggestions are welcome, even the smallest ones.
|
||||
|
||||
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!
|
||||
Currently we expose relevant data for buildings and upgrades (PP, colour and bonus income). If you would like us to add any additional data, please feel free to open an issue or create a PR doing so!
|
||||
|
||||
## 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`. Note that you will need to authenticate to the GitHub Package Registry (see [this documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages)). After creating a Public Access Token you should export this variable to $GITHUB_REGISTRY_PAT as defined in `.npmrc`.
|
||||
|
||||
Please also remember to run `npm run build` after saving all your changes to build the final `CookieMonsterDev.js` file.
|
||||
Please also remember to run `npm run build-dev` 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.
|
||||
Before pushing a new version to `main` and Github pages use the `build-final` command to build the final file.
|
||||
|
||||
## Contributors
|
||||
|
||||
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||
* **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
||||
* **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
||||
- **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||
- **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||
- **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||
- **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||
- **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||
- **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
||||
- **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
||||
|
||||
4
dist/CookieMonster.js
vendored
4
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
2
dist/CookieMonsterDev.js
vendored
2
dist/CookieMonsterDev.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonsterDev.js.map
vendored
2
dist/CookieMonsterDev.js.map
vendored
File diff suppressed because one or more lines are too long
59
eslint.config.mjs
Normal file
59
eslint.config.mjs
Normal file
@@ -0,0 +1,59 @@
|
||||
import globals from 'globals';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import js from '@eslint/js';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
'eslint.config.mjs',
|
||||
'webpack.config.cjs',
|
||||
'**/CookieMonster.user.js',
|
||||
'dist/*',
|
||||
'node_modules/*',
|
||||
],
|
||||
},
|
||||
...compat.extends('airbnb-base', 'prettier'),
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
Game: 'writable',
|
||||
l: 'readonly',
|
||||
b64_to_utf8: 'readonly',
|
||||
utf8_to_b64: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
},
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'import/extensions': ['error', 'ignorePackages'],
|
||||
'import/no-mutable-exports': 'off',
|
||||
'no-import-assign': 'off',
|
||||
'no-plusplus': [
|
||||
'error',
|
||||
{
|
||||
allowForLoopAfterthoughts: true,
|
||||
},
|
||||
],
|
||||
'func-names': 'off',
|
||||
'prefer-destructuring': [
|
||||
'error',
|
||||
{
|
||||
object: true,
|
||||
array: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
8551
package-lock.json
generated
8551
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
60
package.json
60
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cookiemonster-mod",
|
||||
"version": "2.031.7",
|
||||
"name": "@cookiemonsterteam/cookiemonster-mod",
|
||||
"version": "2.058.0",
|
||||
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||
"main": "CookieMonster.js",
|
||||
"keywords": [
|
||||
@@ -11,11 +11,12 @@
|
||||
"Orteil"
|
||||
],
|
||||
"scripts": {
|
||||
"eslint-src": "eslint src test",
|
||||
"build": "run-s eslint-src test pack-prod",
|
||||
"build-test": "run-s pack-dev",
|
||||
"pack-prod": "webpack --env production",
|
||||
"pack-dev": "webpack",
|
||||
"build-dev": "run-s eslint test pack-prod",
|
||||
"build-final": "run-s eslint test pack-final",
|
||||
"build-test": "webpack",
|
||||
"eslint": "eslint",
|
||||
"pack-prod": "webpack --env minimize",
|
||||
"pack-final": "webpack --env minimize --env finalfile",
|
||||
"test": "mocha"
|
||||
},
|
||||
"repository": {
|
||||
@@ -42,26 +43,6 @@
|
||||
"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,
|
||||
@@ -69,7 +50,30 @@
|
||||
],
|
||||
"name": "Cookie Monster"
|
||||
},
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eastdesire/jscolor": "^2.4.5"
|
||||
"@cookiemonsterteam/cookiemonsterframework": "0.2.3",
|
||||
"@eastdesire/jscolor": "^2.5.1",
|
||||
"@eslint/compat": "^1.2.7",
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
"@eslint/js": "^9.20.0",
|
||||
"chai": "^5.2.0",
|
||||
"eslint": "^9.21.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"globals": "^16.0.0",
|
||||
"mocha": "^11.1.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.5.2",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^6.0.1"
|
||||
},
|
||||
"overrides": {
|
||||
"eslint-config-airbnb-base": {
|
||||
"eslint": "^9.20.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData.js';
|
||||
import {
|
||||
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.js';
|
||||
|
||||
/**
|
||||
* @class
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheAverageClicks, // eslint-disable-line no-unused-vars
|
||||
CacheAverageClicks,
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainChoEgg,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheAvgCPSWithChoEgg, // eslint-disable-line no-unused-vars
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheLastChoEgg,
|
||||
CacheLastClicks,
|
||||
CacheLastCookies,
|
||||
CacheLastCPSCheck,
|
||||
CacheLastWrinkCookies,
|
||||
CacheLastWrinkFattestCookies,
|
||||
CacheRealCookiesEarned, // eslint-disable-line no-unused-vars
|
||||
CacheRealCookiesEarned,
|
||||
CacheSellForChoEgg,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
CookiesDiff,
|
||||
WrinkDiff,
|
||||
WrinkFattestDiff,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches two variables related average CPS and Clicks
|
||||
@@ -67,23 +67,47 @@ export default function CacheAvgCPS() {
|
||||
CacheLastClicks = Game.cookieClicks;
|
||||
|
||||
// Get average gain over period of cpsLength seconds
|
||||
const cpsLength = CookieTimes[CMOptions.AvgCPSHist];
|
||||
const cpsLength =
|
||||
CookieTimes[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist];
|
||||
CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
|
||||
CacheAverageCPS = CacheAverageGainBank;
|
||||
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink;
|
||||
if (CMOptions.CalcWrink === 2) CacheAverageCPS += CacheAverageGainWrinkFattest;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
|
||||
CacheAverageCPS += CacheAverageGainWrink;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
|
||||
CacheAverageCPS += CacheAverageGainWrinkFattest;
|
||||
|
||||
const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
|
||||
if (choEgg || CMOptions.CalcWrink === 0) {
|
||||
if (
|
||||
choEgg ||
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 0
|
||||
) {
|
||||
CacheAvgCPSWithChoEgg =
|
||||
CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(ClickTimes[CMOptions.AvgClicksHist]);
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(
|
||||
ClickTimes[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist],
|
||||
);
|
||||
}
|
||||
|
||||
FillCMDCache({
|
||||
CacheRealCookiesEarned,
|
||||
CacheLastCPSCheck,
|
||||
CacheLastCookies,
|
||||
CacheLastWrinkCookies,
|
||||
CacheLastWrinkFattestCookies,
|
||||
CacheLastChoEgg,
|
||||
CacheLastClicks,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheAverageGainChoEgg,
|
||||
CacheAverageCPS,
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheAverageClicks,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import { SimObjects } from '../../Sim/VariablesAndData.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches the current Wrinkler CPS multiplier
|
||||
@@ -26,4 +27,6 @@ export default function CacheCurrWrinklerCPS() {
|
||||
(Game.Has('Sacrilegious corruption') * 0.05 + 1) *
|
||||
(Game.Has('Wrinklerspawn') * 0.05 + 1) *
|
||||
godMult;
|
||||
|
||||
FillCMDCache({ CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function calculates CPS without the Golden Switch as it might be needed in other functions
|
||||
@@ -10,4 +11,6 @@ export default function CacheNoGoldSwitchCPS() {
|
||||
if (Game.Has('Golden switch [off]')) {
|
||||
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||
|
||||
FillCMDCache({ CacheNoGoldSwitchCookiesPS });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
||||
import { CacheSellForChoEgg } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheSellForChoEgg } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches the reward for selling the Chocolate egg
|
||||
@@ -21,4 +22,6 @@ export default function CacheSellAllForChoEgg() {
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
sellTotal += SellBuildingsForChoEgg();
|
||||
CacheSellForChoEgg = sellTotal;
|
||||
|
||||
FillCMDCache({ CacheSellForChoEgg });
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { ClickTimes } from '../Disp/VariablesAndData';
|
||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
||||
import CachePP from './PP/PP';
|
||||
import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome';
|
||||
import { CacheChain } from './Stats/ChainCookies';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
||||
import CacheSeasonSpec from './Stats/Reindeer';
|
||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
|
||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
||||
import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
import { ClickTimes } from '../Disp/VariablesAndData.js';
|
||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue.js';
|
||||
import CacheAvgCPS from './CPS/CPS.js';
|
||||
import CacheDragonAuras from './Dragon/CacheDragonAuras.js';
|
||||
import CachePP from './PP/PP.js';
|
||||
import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome.js';
|
||||
import { CacheChain } from './Stats/ChainCookies.js';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips.js';
|
||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades.js';
|
||||
import CacheSeasonSpec from './Stats/Reindeer.js';
|
||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats.js';
|
||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement.js';
|
||||
import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers.js';
|
||||
|
||||
/**
|
||||
* This functions runs all cache-functions to generate all "full" cache
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import FormatTime from '../Disp/BeautifyAndFormatting/FormatTime';
|
||||
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS';
|
||||
import CachePP from './PP/PP';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
||||
import { CacheTimeTillNextPrestige } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
import FormatTime from '../Disp/BeautifyAndFormatting/FormatTime.js';
|
||||
import GetCPS from '../Disp/HelperFunctions/GetCPS.js';
|
||||
import CacheAvgCPS from './CPS/CPS.js';
|
||||
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS.js';
|
||||
import CachePP from './PP/PP.js';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips.js';
|
||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement.js';
|
||||
import { CacheTimeTillNextPrestige } from './VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers.js';
|
||||
|
||||
/**
|
||||
* This functions caches variables that are needed every loop
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||
|
||||
/**
|
||||
* This functions caches the currently selected Dragon Auras
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { CacheCostDragonUpgrade, CacheLastDragonLevel } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify.js';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData.js';
|
||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheCostDragonUpgrade, CacheLastDragonLevel } from '../VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||
|
||||
/**
|
||||
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
|
||||
@@ -14,7 +15,11 @@ export default function CacheDragonCost() {
|
||||
Game.dragonLevel < 25 &&
|
||||
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
||||
) {
|
||||
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
|
||||
const objectMatch = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/Objects\[(.*)\]/);
|
||||
let target =
|
||||
objectMatch !== null ? objectMatch[1] : Game.ObjectsById[Game.dragonLevel - 5].name;
|
||||
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/sacrifice\((.*?)\)/)[1];
|
||||
@@ -62,4 +67,6 @@ export default function CacheDragonCost() {
|
||||
}
|
||||
CacheLastDragonLevel = Game.dragonLevel;
|
||||
}
|
||||
|
||||
FillCMDCache({ CacheLastDragonLevel });
|
||||
}
|
||||
|
||||
22
src/Cache/FillCMDCache.js
Normal file
22
src/Cache/FillCMDCache.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Insert the provided values into `window.CookieMonsterData.Cache`.
|
||||
*
|
||||
* The initial 'Cache' is dropped from the name, so e.g. `CacheWrinklersTotal`
|
||||
* becomes `window.CookieMonsterData.Cache.WrinklersTotal`.
|
||||
*/
|
||||
export default function FillCMDCache(caches) {
|
||||
if (!('Cache' in window.CookieMonsterData)) {
|
||||
window.CookieMonsterData.Cache = {};
|
||||
}
|
||||
|
||||
Object.keys(caches).forEach((name) => {
|
||||
const exportName = name.replace(/^Cache/, '');
|
||||
|
||||
if (typeof caches[name] === 'undefined') {
|
||||
window.CookieMonsterData.Cache[exportName] = undefined;
|
||||
} else {
|
||||
// Passing through JSON ensures that no references are retained.
|
||||
window.CookieMonsterData.Cache[exportName] = JSON.parse(JSON.stringify(caches[name]));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColourGray } from '../../Disp/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank.js';
|
||||
import { ColourGray } from '../../Disp/VariablesAndData.js';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheMinPP, // eslint-disable-line no-unused-vars
|
||||
CacheMinPPBulk, // eslint-disable-line no-unused-vars
|
||||
CacheMinPP,
|
||||
CacheMinPPBulk,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CachePPArray,
|
||||
} from '../VariablesAndData';
|
||||
import ColourOfPP from './ColourOfPP';
|
||||
} from '../VariablesAndData.js';
|
||||
import ColourOfPP from './ColourOfPP.js';
|
||||
|
||||
/**
|
||||
* This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
|
||||
@@ -18,28 +19,55 @@ import ColourOfPP from './ColourOfPP';
|
||||
*/
|
||||
function CacheColour(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (CMOptions.PPRigidelMode && amount === 1) {
|
||||
target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
|
||||
amount === 1
|
||||
) {
|
||||
target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
target[i].color = ColourOfPP(target[i], Game.Objects[i].getSumPrice(amount));
|
||||
target[i].colour = ColourOfPP(
|
||||
target[i],
|
||||
BuildingGetPrice(
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
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
|
||||
for (
|
||||
let j = 0;
|
||||
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
|
||||
j++
|
||||
) {
|
||||
if (target[i].pp === CachePPArray[j][0]) target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function CachePP(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
const price = Game.Objects[i].getSumPrice(amount);
|
||||
const price = BuildingGetPrice(
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
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))
|
||||
if (
|
||||
!(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
|
||||
amount === 1
|
||||
)
|
||||
)
|
||||
CachePPArray.push([target[i].pp, amount, price]);
|
||||
});
|
||||
}
|
||||
@@ -51,17 +79,21 @@ function CachePP(target, amount) {
|
||||
export default function CacheBuildingsPP() {
|
||||
CacheMinPP = Infinity;
|
||||
CachePPArray = [];
|
||||
if (typeof CMOptions.PPExcludeTop === 'undefined') CMOptions.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||
if (
|
||||
typeof Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop ===
|
||||
'undefined'
|
||||
)
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||
|
||||
// Calculate PP and colors
|
||||
// Calculate PP and colours
|
||||
CachePP(CacheObjects1, 1);
|
||||
CachePP(CacheObjects10, 10);
|
||||
CachePP(CacheObjects100, 100);
|
||||
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CachePPArray.sort((a, b) => a[0] - b[0]);
|
||||
let indexOfMin = CMOptions.PPExcludeTop;
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
let indexOfMin = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
|
||||
while (CachePPArray[indexOfMin][2] > Game.cookies) {
|
||||
indexOfMin += 1;
|
||||
if (CachePPArray.length === indexOfMin + 1) {
|
||||
@@ -75,4 +107,6 @@ export default function CacheBuildingsPP() {
|
||||
CacheColour(CacheObjects1, 1);
|
||||
CacheColour(CacheObjects10, 10);
|
||||
CacheColour(CacheObjects100, 100);
|
||||
|
||||
FillCMDCache({ CacheMinPP, CacheMinPPBulk, CachePPArray });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS.js';
|
||||
import {
|
||||
ColourBlue,
|
||||
ColourGray,
|
||||
@@ -8,34 +7,44 @@ import {
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
} from '../../Disp/VariablesAndData';
|
||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
||||
} from '../../Disp/VariablesAndData.js';
|
||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions return the colour assosciated with the given pp value
|
||||
* It is called by CM.Cache.CacheBuildingsPP(), CM.Cache.CacheBuildingsBulkPP() and CM.Cache.CacheUpgradePP()
|
||||
* @params {object} obj The obj of which the pp value should be checked
|
||||
* @params {number} price The price of the object
|
||||
* @returns {string} color The colour assosciated with the pp value
|
||||
* @returns {string} colour The colour assosciated with the pp value
|
||||
*/
|
||||
export default function ColourOfPP(me, price) {
|
||||
let color = '';
|
||||
let colour = '';
|
||||
// Colour based on PP
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray;
|
||||
else if (me.pp < CacheMinPP) color = ColourBlue;
|
||||
else if (me.pp === CacheMinPP) color = ColourGreen;
|
||||
else if (me.pp < CachePPArray[10][0]) color = ColourYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) color = ColourOrange;
|
||||
else if (me.pp < CachePPArray[30][0]) color = ColourRed;
|
||||
else color = ColourPurple;
|
||||
if (me.pp <= 0 || me.pp === Infinity) colour = ColourGray;
|
||||
else if (me.pp < CacheMinPP) colour = ColourBlue;
|
||||
else if (me.pp === CacheMinPP) colour = ColourGreen;
|
||||
else if (me.pp < CachePPArray[10][0]) colour = ColourYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) colour = ColourOrange;
|
||||
else if (me.pp < CachePPArray[30][0]) colour = ColourRed;
|
||||
else colour = ColourPurple;
|
||||
|
||||
// Colour based on price in terms of CPS
|
||||
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColourBlue;
|
||||
if (
|
||||
Number(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
|
||||
) !== 0
|
||||
) {
|
||||
if (
|
||||
price / GetCPS() <
|
||||
Number(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
|
||||
)
|
||||
)
|
||||
colour = ColourBlue;
|
||||
}
|
||||
// Colour based on being able to purchase
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
if (price - Game.cookies > 0) color = ColourRed;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
|
||||
if (price - Game.cookies > 0) colour = ColourRed;
|
||||
}
|
||||
return color;
|
||||
return colour;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
/**
|
||||
* Section: Functions related to caching PP */
|
||||
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades } from '../VariablesAndData';
|
||||
import CacheBuildingsPP from './Building';
|
||||
import CacheUpgradePP from './Upgrade';
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheUpgrades,
|
||||
} from '../VariablesAndData.js';
|
||||
import CacheBuildingsPP from './Building.js';
|
||||
import CacheUpgradePP from './Upgrade.js';
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building and upgrade and stores it in the cache
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { CacheUpgrades } from '../VariablesAndData';
|
||||
import ColourOfPP from './ColourOfPP';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank.js';
|
||||
import { CacheUpgrades } from '../VariablesAndData.js';
|
||||
import ColourOfPP from './ColourOfPP.js';
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
|
||||
@@ -16,6 +16,6 @@ export default function CacheUpgradePP() {
|
||||
} 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].colour = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange';
|
||||
import { CacheGods } from '../VariablesAndData';
|
||||
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheGods } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches the cps effect of each God in slot 1, 2 or 3
|
||||
@@ -10,4 +11,6 @@ export default function CachePantheonGods() {
|
||||
CacheGods[god][slot] = CalculateChangeGod(god, slot);
|
||||
}
|
||||
}
|
||||
|
||||
FillCMDCache({ CacheGods });
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** Section: Functions related to caching income */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome.js';
|
||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainWrink,
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
CacheObjects100,
|
||||
CacheObjectsNextAchievement,
|
||||
CacheUpgrades,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions starts the calculation/simulation of the bonus income of buildings
|
||||
@@ -39,20 +39,25 @@ function CacheBuildingIncome(amount) {
|
||||
* It is called by CM.Cache.CacheIncome()
|
||||
*/
|
||||
function CacheUpgradeIncome() {
|
||||
CacheUpgrades = [];
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||
if (i === 'Elder Pledge') {
|
||||
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
|
||||
if (CMOptions.CalcWrink === 1) CacheUpgrades[i].bonus -= CacheAverageGainWrink;
|
||||
else if (CMOptions.CalcWrink === 2) CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
|
||||
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
|
||||
CacheUpgrades = {};
|
||||
for (let i = 0; i < Game.UpgradesInStore.length; i++) {
|
||||
const upgradeName = Game.UpgradesInStore[i].name;
|
||||
const bonusIncome = BuyUpgradesBonusIncome(upgradeName);
|
||||
if (upgradeName === 'Elder Pledge') {
|
||||
CacheUpgrades[upgradeName] = {
|
||||
bonus: Game.cookiesPs - CacheAverageGainBank,
|
||||
};
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
|
||||
CacheUpgrades[upgradeName].bonus -= CacheAverageGainWrink;
|
||||
else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
|
||||
CacheUpgrades[upgradeName].bonus -= CacheAverageGainWrinkFattest;
|
||||
if (!Number.isFinite(CacheUpgrades[upgradeName].bonus)) CacheUpgrades[upgradeName].bonus = 0;
|
||||
} else {
|
||||
CacheUpgrades[i] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
||||
CacheUpgrades[upgradeName] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[upgradeName].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[upgradeName].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,34 +66,36 @@ function CacheUpgradeIncome() {
|
||||
export function CacheBuildingsPrices() {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CacheObjects1[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
1,
|
||||
);
|
||||
CacheObjects10[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
10,
|
||||
);
|
||||
CacheObjects100[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
100,
|
||||
);
|
||||
CacheObjectsNextAchievement[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
CacheObjectsNextAchievement[i].AmountNeeded,
|
||||
);
|
||||
});
|
||||
|
||||
FillCMDCache({ CacheObjectsNextAchievement });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired, // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyRequiredNext, // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
CacheChainFrenzyWrathMaxReward,
|
||||
CacheChainFrenzyWrathRequired, // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyWrathRequiredNext, // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyWrathRequired,
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
CacheChainMaxReward,
|
||||
CacheChainRequired, // eslint-disable-line no-unused-vars
|
||||
CacheChainRequiredNext, // eslint-disable-line no-unused-vars
|
||||
CacheChainRequired,
|
||||
CacheChainRequiredNext,
|
||||
CacheChainWrathMaxReward,
|
||||
CacheChainWrathRequired, // eslint-disable-line no-unused-vars
|
||||
CacheChainWrathRequiredNext, // eslint-disable-line no-unused-vars
|
||||
CacheChainWrathRequired,
|
||||
CacheChainWrathRequiredNext,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions calculates the max possible payout given a set of variables
|
||||
@@ -89,4 +90,19 @@ export function CacheChain() {
|
||||
CacheChainFrenzyWrathRequired = (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainFrenzyWrathRequiredNext =
|
||||
CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
FillCMDCache({
|
||||
CacheChainMaxReward,
|
||||
CacheChainRequired,
|
||||
CacheChainRequiredNext,
|
||||
CacheChainWrathMaxReward,
|
||||
CacheChainWrathRequired,
|
||||
CacheChainWrathRequiredNext,
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
CacheChainFrenzyWrathMaxReward,
|
||||
CacheChainFrenzyWrathRequired,
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheHCPerSecond, // eslint-disable-line no-unused-vars
|
||||
CacheHCPerSecond,
|
||||
CacheLastHeavenlyCheck,
|
||||
CacheLastHeavenlyChips,
|
||||
HeavenlyChipsDiff,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches the heavenly chips per second in the last five seconds
|
||||
@@ -32,4 +33,6 @@ export default function CacheHeavenlyChipsPS() {
|
||||
// Get average gain over period of 5 seconds
|
||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
||||
}
|
||||
|
||||
FillCMDCache({ CacheLastHeavenlyCheck, CacheLastHeavenlyChips, CacheHCPerSecond });
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades';
|
||||
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades.js';
|
||||
import {
|
||||
CacheMissingUpgrades, // eslint-disable-line no-unused-vars
|
||||
CacheMissingUpgradesCookies, // eslint-disable-line no-unused-vars
|
||||
CacheMissingUpgradesPrestige, // eslint-disable-line no-unused-vars
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches variables related to missing upgrades
|
||||
@@ -35,12 +35,10 @@ export default function CacheAllMissingUpgrades() {
|
||||
let str = '';
|
||||
|
||||
str += crateMissing(me);
|
||||
/* eslint-disable no-unused-vars */
|
||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug')
|
||||
CacheMissingUpgrades += str;
|
||||
/* eslint-enable no-unused-vars */
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CacheSeaSpec } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheSeaSpec } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches the reward of popping a reindeer
|
||||
@@ -13,4 +14,6 @@ export default function CacheSeasonSpec() {
|
||||
CacheSeaSpec = Math.max(25, val);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
||||
}
|
||||
|
||||
FillCMDCache({ CacheSeaSpec });
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
/** Functions related to Caching stats */
|
||||
|
||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas.js';
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheConjure,
|
||||
CacheConjureReward, // eslint-disable-line no-unused-vars
|
||||
CacheConjureReward,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding, // eslint-disable-line no-unused-vars
|
||||
CacheEdificeBuilding,
|
||||
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
|
||||
CacheLuckyReward,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches variables related to the stats page
|
||||
@@ -53,6 +54,19 @@ export function CacheStatsCookies() {
|
||||
CacheEdificeBuilding = i;
|
||||
}
|
||||
});
|
||||
|
||||
FillCMDCache({
|
||||
CacheLucky,
|
||||
CacheLuckyReward,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyFrenzy,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheConjure,
|
||||
CacheConjureReward,
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,4 +98,10 @@ export function CacheGoldenAndWrathCookiesMults() {
|
||||
if (Game.shimmerTypes.golden.n === 0) {
|
||||
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
||||
}
|
||||
|
||||
FillCMDCache({
|
||||
CacheGoldenCookiesMult,
|
||||
CacheWrathCookiesMult,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { CacheObjectsNextAchievement } from '../VariablesAndData';
|
||||
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import { CacheObjectsNextAchievement } from '../VariablesAndData.js';
|
||||
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement.js';
|
||||
|
||||
/**
|
||||
* This functions caches the amount of buildings needed till next achievement
|
||||
@@ -17,7 +19,11 @@ export default function AllAmountTillNextAchievement(forceRecalc) {
|
||||
result[i] = {
|
||||
AmountNeeded: CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
|
||||
TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded,
|
||||
price: Game.Objects[i].getSumPrice(
|
||||
price: BuildingGetPrice(
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
|
||||
),
|
||||
};
|
||||
@@ -26,9 +32,17 @@ export default function AllAmountTillNextAchievement(forceRecalc) {
|
||||
result[i] = {
|
||||
AmountNeeded: tillNext,
|
||||
TotalNeeded: Game.Objects[i].amount + tillNext,
|
||||
price: Game.Objects[i].getSumPrice(tillNext),
|
||||
price: BuildingGetPrice(
|
||||
i,
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
tillNext,
|
||||
),
|
||||
};
|
||||
}
|
||||
});
|
||||
CacheObjectsNextAchievement = result; // eslint-disable-line no-unused-vars
|
||||
CacheObjectsNextAchievement = result;
|
||||
|
||||
FillCMDCache({ CacheObjectsNextAchievement });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import { SimAchievementsOwned } from '../../Sim/VariablesAndData';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome.js';
|
||||
import { SimAchievementsOwned } from '../../Sim/VariablesAndData.js';
|
||||
|
||||
export default function IndividualAmountTillNextAchievement(building) {
|
||||
const AchievementsAtStart = Game.AchievementsOwned;
|
||||
|
||||
@@ -104,6 +104,11 @@ export let CacheDoRemakeBuildPrices;
|
||||
|
||||
export let CacheHadBuildAura;
|
||||
|
||||
export let CacheFarmLevel = -1;
|
||||
export let CacheGardenSoil = -1;
|
||||
export let CacheSupremeIntellect = -1;
|
||||
export let CachePlotChances = [[], [], [], [], [], []];
|
||||
|
||||
/** Store the CPS effect of each god if it was put into each slot */
|
||||
export let CacheGods = {
|
||||
0: [0, 0, 0],
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/** Caches data related to Wrinklers */
|
||||
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData.js';
|
||||
import FillCMDCache from '../FillCMDCache.js';
|
||||
import {
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal, // eslint-disable-line no-unused-vars
|
||||
CacheWrinklersTotal, // eslint-disable-line no-unused-vars
|
||||
} from '../VariablesAndData';
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This functions caches data related to Wrinklers
|
||||
@@ -37,4 +38,6 @@ export default function CacheWrinklers() {
|
||||
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
||||
}
|
||||
}
|
||||
|
||||
FillCMDCache({ CacheWrinklersTotal, CacheWrinklersNormal, CacheWrinklersFattest });
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ function CheckNotificationPermissions(ToggleOnOff) {
|
||||
const checkNotificationPromise = function () {
|
||||
try {
|
||||
Notification.requestPermission().then();
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import ConfigDefault from '../../Data/SettingsDefault.ts';
|
||||
import ConfigData from '../../Data/SettingsData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import save from '../../InitSaveLoad/save';
|
||||
import CMLoopHook from '../../Main/LoopHook';
|
||||
import UpdateColours from '../../Disp/HelperFunctions/UpdateColours';
|
||||
|
||||
/** Functions related to saving, loading and restoring all settings */
|
||||
|
||||
/**
|
||||
* This function saves the config of CookieMonster without saving any of the other save-data
|
||||
* This allows saving in between the autosave intervals
|
||||
* It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(),
|
||||
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
||||
*/
|
||||
export function SaveConfig() {
|
||||
const saveString = b64_to_utf8(
|
||||
unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0],
|
||||
);
|
||||
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
||||
if (CookieMonsterSave !== null) {
|
||||
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
|
||||
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function loads the config of CookieMonster saved in localStorage and loads it into CMOptions
|
||||
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
|
||||
*/
|
||||
export function LoadConfig(settings) {
|
||||
// This removes cookies left from earlier versions of CookieMonster
|
||||
if (typeof localStorage.CMConfig !== 'undefined') {
|
||||
delete localStorage.CMConfig;
|
||||
}
|
||||
if (settings !== undefined) {
|
||||
CMOptions = settings;
|
||||
|
||||
if (typeof CMOptions.Colors !== 'undefined') {
|
||||
delete CMOptions.Colors;
|
||||
}
|
||||
if (typeof CMOptions.Colours !== 'undefined') {
|
||||
delete CMOptions.Colours;
|
||||
}
|
||||
|
||||
// Check values
|
||||
let mod = false;
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (typeof CMOptions[i] === 'undefined') {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
} else if (i === 'Header') {
|
||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (mod) SaveConfig();
|
||||
CMLoopHook(); // Do loop once
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||
ConfigData[i].func();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Default values
|
||||
LoadConfig(ConfigDefault);
|
||||
}
|
||||
Game.UpdateMenu();
|
||||
UpdateColours();
|
||||
}
|
||||
@@ -1,26 +1,35 @@
|
||||
/** Called by the "func" of individual settings */
|
||||
|
||||
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground.js';
|
||||
|
||||
/**
|
||||
* This function changes the position of both the bottom and timer bar
|
||||
*/
|
||||
export function UpdateBotTimerBarPosition() {
|
||||
if (CMOptions.BotBar === 1 && CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 1
|
||||
) {
|
||||
l('CMBotBar').style.bottom = l('CMTimerBar').style.height;
|
||||
l('game').style.bottom = `${Number(l('CMTimerBar').style.height.replace('px', '')) + 70}px`;
|
||||
} else if (CMOptions.BotBar === 1) {
|
||||
} else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1) {
|
||||
l('CMBotBar').style.bottom = '0px';
|
||||
l('game').style.bottom = '70px';
|
||||
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 1
|
||||
) {
|
||||
l('game').style.bottom = l('CMTimerBar').style.height;
|
||||
} else {
|
||||
// No bars
|
||||
l('game').style.bottom = '0px';
|
||||
}
|
||||
|
||||
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 0
|
||||
) {
|
||||
l('sectionLeft').style.top = l('CMTimerBar').style.height;
|
||||
} else {
|
||||
l('sectionLeft').style.top = '';
|
||||
@@ -33,7 +42,8 @@ export function UpdateBotTimerBarPosition() {
|
||||
* This function changes the visibility of the timer bar
|
||||
*/
|
||||
export function ToggleTimerBar() {
|
||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = '';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1)
|
||||
l('CMTimerBar').style.display = '';
|
||||
else l('CMTimerBar').style.display = 'none';
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
@@ -42,7 +52,7 @@ export function ToggleTimerBar() {
|
||||
* This function changes the position of the timer bar
|
||||
*/
|
||||
export function ToggleTimerBarPos() {
|
||||
if (CMOptions.TimerBarPos === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 0) {
|
||||
l('CMTimerBar').style.width = '30%';
|
||||
l('CMTimerBar').style.bottom = '';
|
||||
l('game').insertBefore(l('CMTimerBar'), l('sectionLeft'));
|
||||
|
||||
@@ -1,52 +1,18 @@
|
||||
import ConfigData from '../Data/SettingsData';
|
||||
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
import { saveAndLoadingFunctions } from '@cookiemonsterteam/cookiemonsterframework/src/index.js';
|
||||
|
||||
/** Functions related to toggling or changing an individual setting */
|
||||
|
||||
/** Used to name certain DOM or outside facing elements and refer to them */
|
||||
export const ConfigPrefix = 'CMConfig';
|
||||
|
||||
/**
|
||||
* This function toggles options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of options of the "bool" type
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
export function ToggleConfig(config) {
|
||||
CMOptions[config] += 1;
|
||||
|
||||
if (CMOptions[config] === ConfigData[config].label.length) {
|
||||
CMOptions[config] = 0;
|
||||
if (ConfigData[config].toggle) l(ConfigPrefix + config).className = 'option off';
|
||||
} else l(ConfigPrefix + config).className = 'option';
|
||||
|
||||
if (typeof ConfigData[config].func !== 'undefined') {
|
||||
ConfigData[config].func();
|
||||
}
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sets the value of the specified volume-option and updates the display in the options menu
|
||||
* It is called by the oninput and onchange event of "vol" type options
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
export function ToggleConfigVolume(config) {
|
||||
if (l(`slider${config}`) !== null) {
|
||||
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
|
||||
CMOptions[config] = Math.round(l(`slider${config}`).value);
|
||||
}
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function toggles header options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of the +/- next to headers
|
||||
* @param {string} config The name of the header
|
||||
*/
|
||||
export function ToggleHeader(config) {
|
||||
CMOptions.Header[config] += 1;
|
||||
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
||||
SaveConfig();
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] += 1;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] > 1)
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] = 0;
|
||||
saveAndLoadingFunctions.saveFramework();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar';
|
||||
import { UpdateBotTimerBarPosition } from '../SpecificToggles';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar.js';
|
||||
import { UpdateBotTimerBarPosition } from '../SpecificToggles.js';
|
||||
|
||||
/**
|
||||
* This function toggle the bottom bar
|
||||
* It is called by CM.Disp.UpdateAscendState() and a change in CMOptions.BotBar
|
||||
* It is called by CM.Disp.UpdateAscendState() and a change in Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar
|
||||
*/
|
||||
export default function ToggleBotBar() {
|
||||
if (CMOptions.BotBar === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1) {
|
||||
l('CMBotBar').style.display = '';
|
||||
UpdateBotBar();
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { CMSayTime } from '../../Disp/VariablesAndData';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import { CMSayTime } from '../../Disp/VariablesAndData.js';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function changes some of the time-displays in the game to be more detailed
|
||||
* It is called by a change in CM.Options.DetailedTime
|
||||
*/
|
||||
export default function ToggleDetailedTime() {
|
||||
if (CMOptions.DetailedTime === 1) Game.sayTime = CMSayTime;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime === 1)
|
||||
Game.sayTime = CMSayTime;
|
||||
else Game.sayTime = BackupFunctions.sayTime;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData.js';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function toggles GC Timers are visible
|
||||
* It is called by a change in CM.Options.GCTimer
|
||||
*/
|
||||
export default function ToggleGCTimer() {
|
||||
if (CMOptions.GCTimer === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer === 1) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.display = 'block';
|
||||
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
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) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons) {
|
||||
l('CMSectionHidButtons').style.display = '';
|
||||
} else {
|
||||
l('CMSectionHidButtons').style.display = 'none';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection()
|
||||
* It is called by a change in CM.Options.ToolWarnPos
|
||||
@@ -7,7 +5,7 @@ import { CMOptions } from '../VariablesAndData';
|
||||
*/
|
||||
export default function ToggleToolWarnPos() {
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
if (CMOptions.ToolWarnPos === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos === 0) {
|
||||
l('CMDispTooltipWarningParent').style.top = 'auto';
|
||||
l('CMDispTooltipWarningParent').style.margin = '4px -4px';
|
||||
l('CMDispTooltipWarningParent').style.padding = '3px 4px';
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades.js';
|
||||
|
||||
/**
|
||||
* This function toggles the upgrade bar and the colours of upgrades
|
||||
* It is called by a change in CM.Options.UpBarColor
|
||||
* It is called by a change in CM.Options.UpBarColour
|
||||
*/
|
||||
export default function ToggleUpgradeBarAndColor() {
|
||||
if (CMOptions.UpBarColor === 1) {
|
||||
export default function ToggleUpgradeBarAndColour() {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour === 1) {
|
||||
// Colours and bar on
|
||||
l('CMUpgradeBar').style.display = '';
|
||||
UpdateUpgrades();
|
||||
} else if (CMOptions.UpBarColor === 2) {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour === 2
|
||||
) {
|
||||
// Colours on and bar off
|
||||
l('CMUpgradeBar').style.display = 'none';
|
||||
UpdateUpgrades();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the position of the upgrade bar from fixed or non-fixed mode
|
||||
* It is called by a change in CM.Options.UpgradeBarFixedPos
|
||||
*/
|
||||
export default function ToggleUpgradeBarFixedPos() {
|
||||
if (CMOptions.UpgradeBarFixedPos === 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos === 1
|
||||
) {
|
||||
// Fix to top of screen when scrolling
|
||||
l('CMUpgradeBar').style.position = 'sticky';
|
||||
l('CMUpgradeBar').style.top = '0px';
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
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 ToggleWrinklerButtons() {
|
||||
if (CMOptions.WrinklerButtons && Game.elderWrath) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons &&
|
||||
Game.elderWrath
|
||||
) {
|
||||
l('PopAllNormalWrinklerButton').style.display = '';
|
||||
l('PopFattestWrinklerButton').style.display = '';
|
||||
} else {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export let CMOptions = {}; // eslint-disable-line prefer-const
|
||||
export const ConfigPrefix = 'CMConfig';
|
||||
@@ -1,6 +1,6 @@
|
||||
import init from './InitSaveLoad/init';
|
||||
import load from './InitSaveLoad/load';
|
||||
import save from './InitSaveLoad/save';
|
||||
import init from './InitSaveLoad/init.js';
|
||||
import load from './InitSaveLoad/load.js';
|
||||
import save from './InitSaveLoad/save.js';
|
||||
|
||||
const CM = {
|
||||
init,
|
||||
@@ -8,4 +8,16 @@ const CM = {
|
||||
save,
|
||||
};
|
||||
|
||||
Game.registerMod('CookieMonster', CM);
|
||||
if (typeof Steam !== 'undefined') {
|
||||
// Need to add a delay for steam
|
||||
setTimeout(() => {
|
||||
Game.registerMod('CookieMonster', CM);
|
||||
|
||||
// Game.registerMod also calls CM.load() which calls the loop hook
|
||||
// Thus sounds normally play at start up as Season and Garden states are checked
|
||||
window.cookieMonsterFrameworkData.isInitializing = false;
|
||||
}, 2000);
|
||||
} else {
|
||||
Game.registerMod('CookieMonster', CM);
|
||||
window.cookieMonsterFrameworkData.isInitializing = false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Data copied directly from the game */
|
||||
|
||||
/** Array of the names of all fortune cookies obtainable from the ticker */
|
||||
export const Fortunes: string[] = [
|
||||
export const Fortunes = [
|
||||
'Fortune #001',
|
||||
'Fortune #002',
|
||||
'Fortune #003',
|
||||
@@ -20,6 +20,8 @@ export const Fortunes: string[] = [
|
||||
'Fortune #016',
|
||||
'Fortune #017',
|
||||
'Fortune #018',
|
||||
'Fortune #019',
|
||||
'Fortune #020',
|
||||
'Fortune #100',
|
||||
'Fortune #101',
|
||||
'Fortune #102',
|
||||
@@ -28,7 +30,7 @@ export const Fortunes: string[] = [
|
||||
];
|
||||
|
||||
/** Array of the names of all Halloween cookies */
|
||||
export const HalloCookies: string[] = [
|
||||
export const HalloCookies = [
|
||||
'Skull cookies',
|
||||
'Ghost cookies',
|
||||
'Bat cookies',
|
||||
@@ -39,7 +41,7 @@ export const HalloCookies: string[] = [
|
||||
];
|
||||
|
||||
/** Array of the names of all Christmas cookies */
|
||||
export const ChristCookies: string[] = [
|
||||
export const ChristCookies = [
|
||||
'Christmas tree biscuits',
|
||||
'Snowflake biscuits',
|
||||
'Snowman biscuits',
|
||||
@@ -50,7 +52,7 @@ export const ChristCookies: string[] = [
|
||||
];
|
||||
|
||||
/** Array of the names of all Valentine cookies */
|
||||
export const ValCookies: string[] = [
|
||||
export const ValCookies = [
|
||||
'Pure heart biscuits',
|
||||
'Ardent heart biscuits',
|
||||
'Sour heart biscuits',
|
||||
@@ -61,7 +63,7 @@ export const ValCookies: string[] = [
|
||||
];
|
||||
|
||||
/** Array of the names of all plant drops */
|
||||
export const PlantDrops: string[] = [
|
||||
export const PlantDrops = [
|
||||
'Elderwort biscuits',
|
||||
'Bakeberry cookies',
|
||||
'Duketater cookies',
|
||||
@@ -72,7 +74,7 @@ export const PlantDrops: string[] = [
|
||||
];
|
||||
|
||||
/** All possible effects plants and other items can have with a display-title */
|
||||
export const Effects: { [index: string]: string } = {
|
||||
export const Effects = {
|
||||
buildingCost: 'Building prices',
|
||||
click: 'Cookies per click',
|
||||
cps: 'Total CPS',
|
||||
21
src/Data/Moddata.js
Normal file
21
src/Data/Moddata.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/** Data related directly to Cookie Monster */
|
||||
|
||||
export const VersionMajor = '2.053';
|
||||
export const VersionMinor = '10';
|
||||
|
||||
/** Information about Cookie Monster to be displayed in the info section */
|
||||
export const ModDescription = `<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>
|
||||
`;
|
||||
|
||||
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
|
||||
export const LatestReleaseNotes = `This update adds support for some parts of cookie clicker 2.048</br>
|
||||
- added support for Dragon Aura 'Supreme Intellect' in the pantheon calculations</br>
|
||||
- added support for new tiers of Shimmering veil</br>
|
||||
- added support for unshackled upgrades</br>
|
||||
- updated some simulator logic to more cloesly match updated cookie clicker logic</br>
|
||||
- Bugfix: conjure backed goods tooltip used cached no gold switch raw cps instead of live cps</br>
|
||||
- Bugfix: negative calculations due to glucosimium upgrades, kittens, unshackled, and achievements</br>`;
|
||||
@@ -1,32 +0,0 @@
|
||||
/** 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,10 +1,10 @@
|
||||
/** 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'];
|
||||
export const metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
|
||||
/** Array of abbreviations used in the "Short" scale */
|
||||
export const shortScale: string[] = [
|
||||
export const shortScale = [
|
||||
'',
|
||||
'',
|
||||
'M',
|
||||
@@ -34,7 +34,7 @@ export const shortScale: string[] = [
|
||||
];
|
||||
|
||||
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
||||
export const shortScaleAbbreviated: string[] = [
|
||||
export const shortScaleAbbreviated = [
|
||||
'',
|
||||
'K',
|
||||
'M',
|
||||
@@ -1,7 +1,7 @@
|
||||
/** 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 } = {
|
||||
export const ConfigGroups = {
|
||||
Favourite: 'Favourite Settings',
|
||||
Calculation: 'Calculation',
|
||||
Notation: 'Notation',
|
||||
@@ -14,7 +14,7 @@ export const ConfigGroups: { [index: string]: string } = {
|
||||
};
|
||||
|
||||
/** Display titles of the headers of the notification section of the Cookie Monster settings */
|
||||
export const ConfigGroupsNotification: { [index: string]: string } = {
|
||||
export const ConfigGroupsNotification = {
|
||||
NotificationGeneral: 'General Notifications',
|
||||
NotificationGC: 'Golden Cookie',
|
||||
NotificationFC: 'Fortune Cookie',
|
||||
@@ -1,11 +0,0 @@
|
||||
/** The basic setting class */
|
||||
export default class Setting {
|
||||
type: string;
|
||||
|
||||
group: string;
|
||||
|
||||
constructor(type: string, group: string) {
|
||||
this.type = type;
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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}%`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
/** 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;
|
||||
33
src/Data/headers.js
Normal file
33
src/Data/headers.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/** This includes all headers of Cookie Monster and their relevant data */
|
||||
const headers = {
|
||||
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,
|
||||
infoMenu: 1,
|
||||
optionsMenu: 1,
|
||||
};
|
||||
|
||||
export default headers;
|
||||
@@ -1,36 +1,35 @@
|
||||
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
|
||||
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
|
||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime';
|
||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer';
|
||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons';
|
||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
|
||||
import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour';
|
||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight';
|
||||
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||
import { SimDoSims } from '../Sim/VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import SettingColours from './SettingClasses/SettingColours.ts';
|
||||
import SettingInputNumber from './SettingClasses/SettingInputNumber.ts';
|
||||
import SettingStandard from './SettingClasses/SettingStandard.ts';
|
||||
import SettingVolume from './SettingClasses/SettingVolume.ts';
|
||||
import { settingClasses } from '@cookiemonsterteam/cookiemonsterframework/src/index.js';
|
||||
|
||||
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions.js';
|
||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale.js';
|
||||
import { SimDoSims } from '../Sim/VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar.js';
|
||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime.js';
|
||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer.js';
|
||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons.js';
|
||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos.js';
|
||||
import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour.js';
|
||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos.js';
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons.js';
|
||||
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings.js';
|
||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon.js';
|
||||
import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js';
|
||||
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades.js';
|
||||
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles.js';
|
||||
|
||||
/** This includes all options of CookieMonster and their relevant data */
|
||||
const Config = {
|
||||
const settings = {
|
||||
// Calculation
|
||||
CPSMode: new SettingStandard(
|
||||
CPSMode: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Current cookies per second', 'Average cookies per second'],
|
||||
'Calculate times using current cookies per second or average cookies per second',
|
||||
false,
|
||||
),
|
||||
AvgCPSHist: new SettingStandard(
|
||||
AvgCPSHist: new settingClasses.SettingStandard(
|
||||
3,
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
@@ -46,7 +45,8 @@ const Config = {
|
||||
'How much time average Cookies Per Second should consider',
|
||||
false,
|
||||
),
|
||||
AvgClicksHist: new SettingStandard(
|
||||
AvgClicksHist: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
@@ -59,7 +59,8 @@ const Config = {
|
||||
'How much time average Cookie Clicks should consider',
|
||||
false,
|
||||
),
|
||||
CalcWrink: new SettingStandard(
|
||||
CalcWrink: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
@@ -75,7 +76,8 @@ const Config = {
|
||||
),
|
||||
|
||||
// Notation
|
||||
Scale: new SettingStandard(
|
||||
Scale: new settingClasses.SettingStandardWithFunc(
|
||||
2,
|
||||
'bool',
|
||||
'Notation',
|
||||
[
|
||||
@@ -92,7 +94,8 @@ const Config = {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleDecimals: new SettingStandard(
|
||||
ScaleDecimals: new settingClasses.SettingStandardWithFunc(
|
||||
2,
|
||||
'bool',
|
||||
'Notation',
|
||||
['1 decimals', '2 decimals', '3 decimals'],
|
||||
@@ -102,7 +105,8 @@ const Config = {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleSeparator: new SettingStandard(
|
||||
ScaleSeparator: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'Notation',
|
||||
['. for decimals (standard)', '. for thousands'],
|
||||
@@ -112,7 +116,8 @@ const Config = {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleCutoff: new SettingInputNumber(
|
||||
ScaleCutoff: new settingClasses.SettingInputNumber(
|
||||
999999,
|
||||
'numscale',
|
||||
'Notation',
|
||||
'Notation cut-off point: ',
|
||||
@@ -120,14 +125,16 @@ const Config = {
|
||||
1,
|
||||
999999999,
|
||||
),
|
||||
TimeFormat: new SettingStandard(
|
||||
TimeFormat: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Notation',
|
||||
['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'],
|
||||
['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX', 'Time XXx, XXx'],
|
||||
'Change the time format',
|
||||
false,
|
||||
),
|
||||
DetailedTime: new SettingStandard(
|
||||
DetailedTime: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'Notation',
|
||||
['Detailed time OFF', 'Detailed time ON'],
|
||||
@@ -137,7 +144,8 @@ const Config = {
|
||||
ToggleDetailedTime();
|
||||
},
|
||||
),
|
||||
PPDisplayTime: new SettingStandard(
|
||||
PPDisplayTime: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Notation',
|
||||
['PP as value (standard)', 'PP as time unit'],
|
||||
@@ -146,7 +154,8 @@ const Config = {
|
||||
),
|
||||
|
||||
// Colours
|
||||
BuildColour: new SettingStandard(
|
||||
BuildColour: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'Colours',
|
||||
['Building colours OFF', 'Building colours ON'],
|
||||
@@ -156,14 +165,16 @@ const Config = {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
PPOnlyConsiderBuyable: new SettingStandard(
|
||||
PPOnlyConsiderBuyable: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Colours',
|
||||
["Don't ignore non-buyable", 'Ignore non-buyable'],
|
||||
"Makes Cookie Monster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",
|
||||
true,
|
||||
),
|
||||
PPExcludeTop: new SettingStandard(
|
||||
PPExcludeTop: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Colours',
|
||||
[
|
||||
@@ -175,14 +186,16 @@ const Config = {
|
||||
'Makes Cookie Monster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values',
|
||||
true,
|
||||
),
|
||||
PPRigidelMode: new SettingStandard(
|
||||
PPRigidelMode: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Colours',
|
||||
['Rigidel mode OFF', 'Rigidel mode ON'],
|
||||
'Makes Cookie Monster ignore all "buy 1" options when colouring PP in order to stay at a total building count ending in 10 for pantheon god Rigidel',
|
||||
true,
|
||||
),
|
||||
PPSecondsLowerLimit: new SettingInputNumber(
|
||||
PPSecondsLowerLimit: new settingClasses.SettingInputNumber(
|
||||
0,
|
||||
'numscale',
|
||||
'Colours',
|
||||
'Lower limit for PP (in seconds): ',
|
||||
@@ -190,54 +203,64 @@ const Config = {
|
||||
0,
|
||||
Infinity,
|
||||
),
|
||||
ColourBlue: new SettingColours(
|
||||
ColourBlue: new settingClasses.SettingColours(
|
||||
'#4bb8f0',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
),
|
||||
ColourGreen: new SettingColours(
|
||||
ColourGreen: new settingClasses.SettingColours(
|
||||
'#00ff00',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
),
|
||||
ColourYellow: new SettingColours(
|
||||
ColourYellow: new settingClasses.SettingColours(
|
||||
'#ffff00',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
|
||||
),
|
||||
ColourOrange: new SettingColours(
|
||||
ColourOrange: new settingClasses.SettingColours(
|
||||
'#ff7f00',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
|
||||
),
|
||||
ColourRed: new SettingColours(
|
||||
ColourRed: new settingClasses.SettingColours(
|
||||
'#ff0000',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
|
||||
),
|
||||
ColourPurple: new SettingColours(
|
||||
ColourPurple: new settingClasses.SettingColours(
|
||||
'#ff00ff',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
|
||||
),
|
||||
ColourGray: new SettingColours(
|
||||
ColourGray: new settingClasses.SettingColours(
|
||||
'#b3b3b3',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
),
|
||||
ColourPink: new SettingColours(
|
||||
ColourPink: new settingClasses.SettingColours(
|
||||
'#ff1493',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is pink. Used for Dragonflight bar',
|
||||
),
|
||||
ColourBrown: new SettingColours(
|
||||
ColourBrown: new settingClasses.SettingColours(
|
||||
'#8b4513',
|
||||
'colour',
|
||||
'Colours',
|
||||
'Standard colour is brown. Used for Dragon Harvest bar',
|
||||
),
|
||||
|
||||
// BarsDisplay
|
||||
BotBar: new SettingStandard(
|
||||
BotBar: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Bottom bar OFF', 'Bottom bar ON'],
|
||||
@@ -247,7 +270,8 @@ const Config = {
|
||||
ToggleBotBar();
|
||||
},
|
||||
),
|
||||
TimerBar: new SettingStandard(
|
||||
TimerBar: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Timer bar OFF', 'Timer bar ON'],
|
||||
@@ -257,7 +281,8 @@ const Config = {
|
||||
ToggleTimerBar();
|
||||
},
|
||||
),
|
||||
TimerBarPos: new SettingStandard(
|
||||
TimerBarPos: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Timer bar position (top left)', 'Timer bar position (bottom)'],
|
||||
@@ -267,21 +292,24 @@ const Config = {
|
||||
ToggleTimerBarPos();
|
||||
},
|
||||
),
|
||||
TimerBarOverlay: new SettingStandard(
|
||||
TimerBarOverlay: new settingClasses.SettingStandard(
|
||||
2,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Timer bar overlay OFF', 'Timer bar overlay only seconds', 'Timer bar overlay full'],
|
||||
'Overlay on timers displaying seconds and/or percentage left',
|
||||
true,
|
||||
),
|
||||
AutosaveTimerBar: new SettingStandard(
|
||||
AutosaveTimerBar: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Autosave timer bar OFF', 'Autosave timer bar ON'],
|
||||
'Show a timer counting down till next autosave in the timer bar',
|
||||
true,
|
||||
),
|
||||
UpBarColour: new SettingStandard(
|
||||
UpBarColour: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Upgrade colours/bar OFF', 'Upgrade colours with bar ON', 'Upgrade colours without bar ON'],
|
||||
@@ -291,7 +319,8 @@ const Config = {
|
||||
ToggleUpgradeBarAndColour();
|
||||
},
|
||||
),
|
||||
UpgradeBarFixedPos: new SettingStandard(
|
||||
UpgradeBarFixedPos: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Upgrade bar fixed position OFF', 'Upgrade bar fixed position ON'],
|
||||
@@ -301,7 +330,8 @@ const Config = {
|
||||
ToggleUpgradeBarFixedPos();
|
||||
},
|
||||
),
|
||||
SortBuildings: new SettingStandard(
|
||||
SortBuildings: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
[
|
||||
@@ -316,7 +346,8 @@ const Config = {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
SortUpgrades: new SettingStandard(
|
||||
SortUpgrades: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Sort upgrades: default', 'Sort upgrades: PP'],
|
||||
@@ -326,7 +357,8 @@ const Config = {
|
||||
UpdateUpgrades();
|
||||
},
|
||||
),
|
||||
UpgradesNeverCollapse: new SettingStandard(
|
||||
UpgradesNeverCollapse: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Upgrades always expanded OFF', 'Upgrades always expanded ON'],
|
||||
@@ -336,21 +368,24 @@ const Config = {
|
||||
UpdateUpgradeSectionsHeight();
|
||||
},
|
||||
),
|
||||
DragonAuraInfo: new SettingStandard(
|
||||
DragonAuraInfo: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Extra dragon aura info OFF', 'Extra dragon aura info ON'],
|
||||
'Shows information about changes in CPS and costs in the dragon aura interface.',
|
||||
true,
|
||||
),
|
||||
GrimoireBar: new SettingStandard(
|
||||
GrimoireBar: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Grimoire magic meter timer OFF', 'Grimoire magic meter timer ON'],
|
||||
'A timer overlay showing how long till the Grimoire magic meter is full',
|
||||
true,
|
||||
),
|
||||
GCTimer: new SettingStandard(
|
||||
GCTimer: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Golden cookie timer OFF', 'Golden cookie timer ON'],
|
||||
@@ -360,7 +395,8 @@ const Config = {
|
||||
ToggleGCTimer();
|
||||
},
|
||||
),
|
||||
Favicon: new SettingStandard(
|
||||
Favicon: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Favicon OFF', 'Favicon ON'],
|
||||
@@ -370,7 +406,8 @@ const Config = {
|
||||
UpdateFavicon();
|
||||
},
|
||||
),
|
||||
WrinklerButtons: new SettingStandard(
|
||||
WrinklerButtons: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Extra wrinkler buttons OFF', 'Extra wrinkler buttons ON'],
|
||||
@@ -380,7 +417,8 @@ const Config = {
|
||||
ToggleWrinklerButtons();
|
||||
},
|
||||
),
|
||||
HideSectionsButtons: new SettingStandard(
|
||||
HideSectionsButtons: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'BarsDisplay',
|
||||
['Hide buildings/upgrades button OFF', 'Hide buildings/upgrades button ON'],
|
||||
@@ -392,14 +430,16 @@ const Config = {
|
||||
),
|
||||
|
||||
// Tooltip
|
||||
TooltipBuildUpgrade: new SettingStandard(
|
||||
TooltipBuildUpgrade: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Building/upgrade tooltip information OFF', 'Building/upgrade tooltip information ON'],
|
||||
'Extra information in building/upgrade tooltips',
|
||||
true,
|
||||
),
|
||||
TooltipAmor: new SettingStandard(
|
||||
TooltipAmor: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
[
|
||||
@@ -409,42 +449,48 @@ const Config = {
|
||||
'Add amortization information to buildings tooltip',
|
||||
true,
|
||||
),
|
||||
ToolWarnLucky: new SettingStandard(
|
||||
ToolWarnLucky: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip lucky warning OFF', 'Tooltip lucky warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnLuckyFrenzy: new SettingStandard(
|
||||
ToolWarnLuckyFrenzy: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip lucky frenzy warning OFF', 'Tooltip lucky frenzy warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnConjure: new SettingStandard(
|
||||
ToolWarnConjure: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip conjure warning OFF', 'Tooltip conjure warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnConjureFrenzy: new SettingStandard(
|
||||
ToolWarnConjureFrenzy: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip conjure frenzy warning OFF', 'Tooltip conjure frenzy warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',
|
||||
true,
|
||||
),
|
||||
ToolWarnEdifice: new SettingStandard(
|
||||
ToolWarnEdifice: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip edifice warning OFF', 'Tooltip edifice warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',
|
||||
true,
|
||||
),
|
||||
ToolWarnUser: new SettingInputNumber(
|
||||
ToolWarnUser: new settingClasses.SettingInputNumber(
|
||||
0,
|
||||
'numscale',
|
||||
'Tooltip',
|
||||
'Tooltip warning at x times CPS: ',
|
||||
@@ -452,14 +498,16 @@ const Config = {
|
||||
0,
|
||||
Infinity,
|
||||
),
|
||||
ToolWarnBon: new SettingStandard(
|
||||
ToolWarnBon: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Calculate tooltip warning with bonus CPS OFF', 'Calculate tooltip warning with bonus CPS ON'],
|
||||
'Calculate the warning with or without the bonus CPS you get from buying',
|
||||
true,
|
||||
),
|
||||
ToolWarnPos: new SettingStandard(
|
||||
ToolWarnPos: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip warning position (left)', 'Tooltip warning position (bottom)'],
|
||||
@@ -469,42 +517,56 @@ const Config = {
|
||||
ToggleToolWarnPos();
|
||||
},
|
||||
),
|
||||
TooltipGrim: new SettingStandard(
|
||||
TooltipGrim: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Grimoire tooltip information OFF', 'Grimoire tooltip information ON'],
|
||||
'Extra information in tooltip for grimoire',
|
||||
true,
|
||||
),
|
||||
TooltipWrink: new SettingStandard(
|
||||
TooltipWrink: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Wrinkler tooltip OFF', 'Wrinkler tooltip ON'],
|
||||
'Shows the amount of cookies a wrinkler will give when popping it',
|
||||
true,
|
||||
),
|
||||
TooltipLump: new SettingStandard(
|
||||
TooltipLump: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Sugar lump tooltip OFF', 'Sugar lump tooltip ON'],
|
||||
'Shows the current Sugar Lump type in Sugar lump tooltip.',
|
||||
true,
|
||||
),
|
||||
TooltipPlots: new SettingStandard(
|
||||
TooltipPlots: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Garden plots tooltip OFF', 'Garden plots tooltip ON'],
|
||||
'Shows a tooltip for plants that have a cookie reward.',
|
||||
true,
|
||||
),
|
||||
TooltipPantheon: new SettingStandard(
|
||||
TooltipStocks: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Stock market tooltips OFF', 'Stock market tooltips ON'],
|
||||
'Shows additional info in the stock market tooltips.',
|
||||
true,
|
||||
),
|
||||
TooltipPantheon: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Pantheon tooltip OFF', 'Pantheon tooltip ON'],
|
||||
'Shows additional info in the pantheon tooltip',
|
||||
true,
|
||||
),
|
||||
TooltipAscendButton: new SettingStandard(
|
||||
TooltipAscendButton: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'],
|
||||
@@ -513,35 +575,40 @@ const Config = {
|
||||
),
|
||||
|
||||
// Statistics
|
||||
Stats: new SettingStandard(
|
||||
Stats: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Statistics OFF', 'Statistics ON'],
|
||||
'Extra Cookie Monster statistics!',
|
||||
true,
|
||||
),
|
||||
MissingUpgrades: new SettingStandard(
|
||||
MissingUpgrades: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Missing upgrades OFF', 'Missing upgrades ON'],
|
||||
'Shows missing upgrades in statistics menu',
|
||||
true,
|
||||
),
|
||||
MissingAchievements: new SettingStandard(
|
||||
MissingAchievements: new settingClasses.SettingStandard(
|
||||
0,
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Missing Achievements OFF', 'Missing Normal Achievements ON'],
|
||||
'Shows missing normal achievements in statistics menu.',
|
||||
true,
|
||||
),
|
||||
UpStats: new SettingStandard(
|
||||
UpStats: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Statistics update rate (default)', 'Statistics update rate (1s)'],
|
||||
'Default rate is once every 5 seconds',
|
||||
false,
|
||||
),
|
||||
HeavenlyChipsTarget: new SettingInputNumber(
|
||||
HeavenlyChipsTarget: new settingClasses.SettingInputNumber(
|
||||
1,
|
||||
'numscale',
|
||||
'Statistics',
|
||||
'Heavenly chips target: ',
|
||||
@@ -549,7 +616,8 @@ const Config = {
|
||||
1,
|
||||
Infinity,
|
||||
),
|
||||
ShowMissedGC: new SettingStandard(
|
||||
ShowMissedGC: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Missed GC OFF', 'Missed GC ON'],
|
||||
@@ -558,257 +626,311 @@ const Config = {
|
||||
),
|
||||
|
||||
// Notification
|
||||
Title: new SettingStandard(
|
||||
Title: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGeneral',
|
||||
['Title OFF', 'Title ON', 'Title pinned tab highlight'],
|
||||
'Update title with colden cookie/season popup timers; pinned tab highlight only changes the title when a golden cookie/season popup spawns; "!" means that golden cookie/reindeer can spawn',
|
||||
true,
|
||||
),
|
||||
GeneralSound: new SettingStandard(
|
||||
GeneralSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGeneral',
|
||||
['Consider game volume setting OFF', 'Consider game volume setting ON'],
|
||||
'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',
|
||||
true,
|
||||
),
|
||||
GCNotification: new SettingStandard(
|
||||
GCNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when golden cookie spawns',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.GCNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
GCFlash: new SettingStandard(
|
||||
GCFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on golden cookie',
|
||||
true,
|
||||
),
|
||||
ColourGCFlash: new SettingColours(
|
||||
ColourGCFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationGC',
|
||||
'The colour of the GC flash, standard colour is white',
|
||||
),
|
||||
GCSound: new SettingStandard(
|
||||
GCSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on golden cookie',
|
||||
true,
|
||||
),
|
||||
GCVolume: new SettingVolume('vol', 'NotificationGC', [], 'Volume'),
|
||||
GCSoundURL: new SettingStandard(
|
||||
GCVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationGC', [], 'Volume'),
|
||||
GCSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||
'url',
|
||||
'NotificationGC',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when a golden cookie spawns',
|
||||
),
|
||||
FortuneNotification: new SettingStandard(
|
||||
FortuneNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when fortune cookie is on the ticker',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.FortuneNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
FortuneFlash: new SettingStandard(
|
||||
FortuneFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on fortune cookie spawn',
|
||||
true,
|
||||
),
|
||||
ColourFortuneFlash: new SettingColours(
|
||||
ColourFortuneFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationFC',
|
||||
'The colour of the fortune flash, standard colour is white',
|
||||
),
|
||||
FortuneSound: new SettingStandard(
|
||||
FortuneSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on fortune cookie spawn',
|
||||
true,
|
||||
),
|
||||
FortuneVolume: new SettingVolume('vol', 'NotificationFC', [], 'Volume'),
|
||||
FortuneSoundURL: new SettingStandard(
|
||||
FortuneVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationFC', [], 'Volume'),
|
||||
FortuneSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
'url',
|
||||
'NotificationFC',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when the ticker has a fortune cookie',
|
||||
),
|
||||
SeaNotification: new SettingStandard(
|
||||
SeaNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification on season popup',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.SeaNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
SeaFlash: new SettingStandard(
|
||||
SeaFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on season popup',
|
||||
true,
|
||||
),
|
||||
ColourSeaFlash: new SettingColours(
|
||||
ColourSeaFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationSea',
|
||||
'The colour of the season popup flash, standard colour is white',
|
||||
),
|
||||
SeaSound: new SettingStandard(
|
||||
SeaSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on season popup',
|
||||
true,
|
||||
),
|
||||
SeaVolume: new SettingVolume('vol', 'NotificationSea', [], 'Volume'),
|
||||
SeaSoundURL: new SettingStandard(
|
||||
SeaVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationSea', [], 'Volume'),
|
||||
SeaSoundURL: new settingClasses.SettingStandard(
|
||||
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
'url',
|
||||
'NotificationSea',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when on season popup spawns',
|
||||
),
|
||||
GardFlash: new SettingStandard(
|
||||
GardFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGard',
|
||||
['Garden Tick Flash OFF', 'Flash ON'],
|
||||
'Flash screen on garden tick',
|
||||
true,
|
||||
),
|
||||
ColourGardFlash: new SettingColours(
|
||||
ColourGardFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationGard',
|
||||
'The colour of the garden flash, standard colour is white',
|
||||
),
|
||||
GardSound: new SettingStandard(
|
||||
GardSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationGard',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on garden tick',
|
||||
true,
|
||||
),
|
||||
GardVolume: new SettingVolume('vol', 'NotificationGard', [], 'Volume'),
|
||||
GardSoundURL: new SettingStandard(
|
||||
GardVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationGard', [], 'Volume'),
|
||||
GardSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||
'url',
|
||||
'NotificationGard',
|
||||
'Garden Tick Sound URL:',
|
||||
'URL of the sound to be played when the garden ticks',
|
||||
),
|
||||
MagicNotification: new SettingStandard(
|
||||
MagicNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when magic reaches maximum',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.MagicNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
MagicFlash: new SettingStandard(
|
||||
MagicFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when magic reaches maximum',
|
||||
true,
|
||||
),
|
||||
ColourMagicFlash: new SettingColours(
|
||||
ColourMagicFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationMagi',
|
||||
'The colour of the magic flash, standard colour is white',
|
||||
),
|
||||
MagicSound: new SettingStandard(
|
||||
MagicSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when magic reaches maximum',
|
||||
true,
|
||||
),
|
||||
MagicVolume: new SettingVolume('vol', 'NotificationMagi', [], 'Volume'),
|
||||
MagicSoundURL: new SettingStandard(
|
||||
MagicVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationMagi', [], 'Volume'),
|
||||
MagicSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
'url',
|
||||
'NotificationMagi',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when magic reaches maxium',
|
||||
),
|
||||
WrinklerNotification: new SettingStandard(
|
||||
WrinklerNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when a wrinkler appears',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
WrinklerFlash: new SettingStandard(
|
||||
WrinklerFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when a wrinkler appears',
|
||||
true,
|
||||
),
|
||||
ColourWrinklerFlash: new SettingColours(
|
||||
ColourWrinklerFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationWrink',
|
||||
'The colour of the wrinkler flash, standard colour is white',
|
||||
),
|
||||
WrinklerSound: new SettingStandard(
|
||||
WrinklerSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when a wrinkler appears',
|
||||
true,
|
||||
),
|
||||
WrinklerVolume: new SettingVolume('vol', 'NotificationWrink', [], 'Volume'),
|
||||
WrinklerSoundURL: new SettingStandard(
|
||||
WrinklerVolume: new settingClasses.SettingVolume(100, 'vol', 'NotificationWrink', [], 'Volume'),
|
||||
WrinklerSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
'url',
|
||||
'NotificationWrink',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when a wrinkler appears',
|
||||
),
|
||||
WrinklerMaxNotification: new SettingStandard(
|
||||
WrinklerMaxNotification: new settingClasses.SettingStandardWithFunc(
|
||||
0,
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when the maximum amount of wrinklers has appeared',
|
||||
true,
|
||||
() => {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerMaxNotification);
|
||||
CheckNotificationPermissions(
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification,
|
||||
);
|
||||
},
|
||||
),
|
||||
WrinklerMaxFlash: new SettingStandard(
|
||||
WrinklerMaxFlash: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when the maximum amount of Wrinklers has appeared',
|
||||
true,
|
||||
),
|
||||
ColourWrinklerMaxFlash: new SettingColours(
|
||||
ColourWrinklerMaxFlash: new settingClasses.SettingColours(
|
||||
'#ffffff',
|
||||
'colour',
|
||||
'NotificationWrinkMax',
|
||||
'The colour of the maximum wrinkler flash, standard colour is white',
|
||||
),
|
||||
WrinklerMaxSound: new SettingStandard(
|
||||
WrinklerMaxSound: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when the maximum amount of wrinklers has appeared',
|
||||
true,
|
||||
),
|
||||
WrinklerMaxVolume: new SettingVolume('vol', 'NotificationWrinkMax', [], 'Volume'),
|
||||
WrinklerMaxSoundURL: new SettingStandard(
|
||||
WrinklerMaxVolume: new settingClasses.SettingVolume(
|
||||
100,
|
||||
'vol',
|
||||
'NotificationWrinkMax',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
WrinklerMaxSoundURL: new settingClasses.SettingStandard(
|
||||
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
'url',
|
||||
'NotificationWrinkMax',
|
||||
'Sound URL:',
|
||||
@@ -816,14 +938,16 @@ const Config = {
|
||||
),
|
||||
|
||||
// Miscellaneous
|
||||
BulkBuyBlock: new SettingStandard(
|
||||
BulkBuyBlock: new settingClasses.SettingStandard(
|
||||
1,
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Block bulk buying OFF', 'Block bulk buying ON'],
|
||||
"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",
|
||||
true,
|
||||
),
|
||||
FavouriteSettings: new SettingStandard(
|
||||
FavouriteSettings: new settingClasses.SettingStandardWithFunc(
|
||||
1,
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
[
|
||||
@@ -839,4 +963,4 @@ const Config = {
|
||||
),
|
||||
};
|
||||
|
||||
export default Config;
|
||||
export default settings;
|
||||
@@ -1,8 +1,7 @@
|
||||
/** 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';
|
||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.js';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function returns formats number based on the Scale setting
|
||||
@@ -12,14 +11,15 @@ import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
* @returns {string} Formatted number
|
||||
*/
|
||||
export default function Beautify(num, floats, forced) {
|
||||
const decimals = CMOptions.ScaleDecimals + 1;
|
||||
const decimals =
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals + 1;
|
||||
if (num === Infinity) {
|
||||
return 'Infinity';
|
||||
}
|
||||
if (typeof num === 'undefined') {
|
||||
return '0';
|
||||
}
|
||||
if (CMOptions.Scale === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 0) {
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (Number.isFinite(num)) {
|
||||
@@ -30,12 +30,20 @@ export default function Beautify(num, floats, forced) {
|
||||
if (num === 0) {
|
||||
return num.toString();
|
||||
}
|
||||
if (num > 0.001 && num < CMOptions.ScaleCutoff) {
|
||||
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
|
||||
if (
|
||||
num > 0.001 &&
|
||||
num < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleCutoff
|
||||
) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator)
|
||||
answer = num.toLocaleString('nl');
|
||||
else answer = num.toLocaleString('en');
|
||||
return answer;
|
||||
}
|
||||
if ((CMOptions.Scale === 4 && !forced) || forced === 4) {
|
||||
if (
|
||||
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 4 &&
|
||||
!forced) ||
|
||||
forced === 4
|
||||
) {
|
||||
// Scientific notation, 123456789 => 1.235E+8
|
||||
answer = num.toExponential(decimals).toString().replace('e', 'E');
|
||||
} else {
|
||||
@@ -43,22 +51,38 @@ export default function Beautify(num, floats, forced) {
|
||||
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) {
|
||||
if (
|
||||
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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) {
|
||||
} else if (
|
||||
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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) {
|
||||
} else if (
|
||||
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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) {
|
||||
} else if (
|
||||
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 5 &&
|
||||
!forced) ||
|
||||
forced === 5
|
||||
) {
|
||||
// Engineering notation, 123456789 => 123.457E+6
|
||||
answer += `E${AmountOfTenPowerThree * 3}`;
|
||||
}
|
||||
@@ -68,7 +92,8 @@ export default function Beautify(num, floats, forced) {
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
|
||||
answer = BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator)
|
||||
answer = answer.replace('.', ',');
|
||||
return answer;
|
||||
}
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns time as a string depending on TimeFormat setting
|
||||
* @param {number} time Time to be formatted
|
||||
@@ -7,6 +5,7 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
* @returns {string} Formatted time
|
||||
*/
|
||||
export default function FormatTime(time, longFormat) {
|
||||
/* eslint-disable no-nested-ternary */
|
||||
let formattedTime = time;
|
||||
if (time === Infinity) return time;
|
||||
if (time < 0) return 'Negative time period';
|
||||
@@ -17,7 +16,18 @@ export default function FormatTime(time, longFormat) {
|
||||
const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60);
|
||||
const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
|
||||
let str = '';
|
||||
if (CMOptions.TimeFormat) {
|
||||
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 0) {
|
||||
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str += y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '';
|
||||
if (str.length > 0 || d > 0)
|
||||
str += `${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');
|
||||
} else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 1) {
|
||||
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||
@@ -25,18 +35,23 @@ export default function FormatTime(time, longFormat) {
|
||||
str += `${(m < 10 ? '0' : '') + m}:`;
|
||||
str += (s < 10 ? '0' : '') + s;
|
||||
} else {
|
||||
// Similar to TimeFormat === 0, but only two most significant components are included.
|
||||
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
|
||||
if (y > 0) {
|
||||
str += `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `;
|
||||
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}`;
|
||||
} else if (d > 0) {
|
||||
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `;
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}`;
|
||||
} else if (h > 0) {
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}`;
|
||||
} else if (m > 0) {
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
||||
} else {
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
|
||||
import FormatTime from './FormatTime';
|
||||
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData.js';
|
||||
import FormatTime from './FormatTime.js';
|
||||
|
||||
/**
|
||||
* This function returns the color to be used for time-strings
|
||||
* This function returns the colour 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
|
||||
* @returns {{string, string}} {text, colour} Both the formatted time and colour as strings in an array
|
||||
*/
|
||||
export default function GetTimeColour(time) {
|
||||
let color;
|
||||
let colour;
|
||||
let text;
|
||||
if (time <= 0) {
|
||||
if (CMOptions.TimeFormat) text = '00:00:00:00:00';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 1)
|
||||
text = '00:00:00:00:00';
|
||||
else text = 'Done!';
|
||||
color = ColourGreen;
|
||||
colour = ColourGreen;
|
||||
} else {
|
||||
text = FormatTime(time);
|
||||
if (time > 300) color = ColourRed;
|
||||
else if (time > 60) color = ColourOrange;
|
||||
else color = ColourYellow;
|
||||
if (time > 300) colour = ColourRed;
|
||||
else if (time > 60) colour = ColourOrange;
|
||||
else colour = ColourYellow;
|
||||
}
|
||||
return { text, color };
|
||||
return { text, colour };
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@ import {
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheObjectsNextAchievement,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
||||
} from '../../Cache/VariablesAndData.js';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding.js';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||
@@ -36,11 +35,15 @@ export default function UpdateBuildings() {
|
||||
l(`storeBulk100`).style.removeProperty('color');
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColour === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour === 1) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${target[i].colour}`
|
||||
];
|
||||
});
|
||||
l(`storeBulk${CacheMinPPBulk}`).style.color = CMOptions.ColourGreen;
|
||||
l(`storeBulk${CacheMinPPBulk}`).style.color =
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen;
|
||||
} else {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
||||
@@ -67,8 +70,11 @@ export default function UpdateBuildings() {
|
||||
// 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 => {
|
||||
if (
|
||||
Game.buyMode !== 1 ||
|
||||
!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings
|
||||
) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
@@ -76,36 +82,42 @@ export default function UpdateBuildings() {
|
||||
});
|
||||
// Sort using default order.
|
||||
arr.sort((a, b) => a.id - b.id);
|
||||
} else if (CMOptions.SortBuildings === 1) {
|
||||
arr = Object.keys(CacheObjects1).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 1
|
||||
) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.pp = CacheObjects1[k].pp;
|
||||
o.color = CacheObjects1[k].color;
|
||||
o.colour = CacheObjects1[k].colour;
|
||||
return o;
|
||||
});
|
||||
// Sort by pp colour group, then by pp.
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||
? a.pp - b.pp
|
||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||
);
|
||||
} else if (CMOptions.SortBuildings === 2) {
|
||||
arr = Object.keys(target).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
|
||||
) {
|
||||
arr = Object.keys(target).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.pp = target[k].pp;
|
||||
o.color = target[k].color;
|
||||
o.colour = target[k].colour;
|
||||
return o;
|
||||
});
|
||||
// Sort by pp colour group, then by pp.
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||
? a.pp - b.pp
|
||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||
);
|
||||
} else if (CMOptions.SortBuildings === 3) {
|
||||
arr = Object.keys(CacheObjectsNextAchievement).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3
|
||||
) {
|
||||
arr = Object.keys(CacheObjectsNextAchievement).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
@@ -118,9 +130,10 @@ export default function UpdateBuildings() {
|
||||
// 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)
|
||||
arr.sort(
|
||||
(a, b) =>
|
||||
(a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) -
|
||||
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the upgrade to be always expanded
|
||||
* It is called by a change in CM.Options.ToolWarnPos
|
||||
@@ -7,7 +5,10 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
*/
|
||||
export default function UpdateUpgradeSectionsHeight() {
|
||||
Object.values(document.getElementsByClassName('storeSection')).forEach((section) => {
|
||||
if (CMOptions.UpgradesNeverCollapse || section.id === 'products') {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
ColourRed,
|
||||
ColourTextPre,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function creates the legend for the upgrade bar
|
||||
@@ -24,11 +24,11 @@ function CreateUpgradeBarLegend() {
|
||||
title.textContent = 'Legend';
|
||||
legend.appendChild(title);
|
||||
|
||||
const legendLine = function (color, text) {
|
||||
const legendLine = function (colour, text) {
|
||||
const div = document.createElement('div');
|
||||
div.style.verticalAlign = 'middle';
|
||||
const span = document.createElement('span');
|
||||
span.className = ColourBackPre + color;
|
||||
span.className = ColourBackPre + colour;
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '10px';
|
||||
span.style.width = '10px';
|
||||
@@ -70,10 +70,10 @@ export default function CreateUpgradeBar() {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
|
||||
};
|
||||
|
||||
const upgradeNumber = function (id, color) {
|
||||
const upgradeNumber = function (id, colour) {
|
||||
const span = document.createElement('span');
|
||||
span.id = id;
|
||||
span.className = ColourTextPre + color;
|
||||
span.className = ColourTextPre + colour;
|
||||
span.style.width = '14.28571428571429%';
|
||||
span.style.display = 'inline-block';
|
||||
span.textContent = '0';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData.js';
|
||||
import {
|
||||
ColourBackPre,
|
||||
ColourBlue,
|
||||
@@ -10,7 +9,7 @@ import {
|
||||
ColourRed,
|
||||
ColoursOrdering,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function adjusts some things in the upgrades section
|
||||
@@ -20,7 +19,7 @@ import {
|
||||
*/
|
||||
export default function UpdateUpgrades() {
|
||||
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar
|
||||
if (CMOptions.UpBarColour > 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour > 0) {
|
||||
let blue = 0;
|
||||
let green = 0;
|
||||
let yellow = 0;
|
||||
@@ -34,7 +33,7 @@ export default function UpdateUpgrades() {
|
||||
let addedColour = false;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
|
||||
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
|
||||
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].colour;
|
||||
addedColour = true;
|
||||
break;
|
||||
}
|
||||
@@ -43,16 +42,16 @@ export default function UpdateUpgrades() {
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '10px';
|
||||
div.style.height = '10px';
|
||||
div.className = ColourBackPre + CacheUpgrades[me.name].color;
|
||||
div.className = ColourBackPre + CacheUpgrades[me.name].colour;
|
||||
l(`upgrade${i}`).appendChild(div);
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColourBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourGray) gray += 1;
|
||||
if (CacheUpgrades[me.name].colour === ColourBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].colour === ColourGray) gray += 1;
|
||||
});
|
||||
|
||||
l('CMUpgradeBarBlue').textContent = blue;
|
||||
@@ -72,16 +71,16 @@ export default function UpdateUpgrades() {
|
||||
o.name = Game.UpgradesInStore[x].name;
|
||||
o.price = Game.UpgradesInStore[x].basePrice;
|
||||
o.pp = CacheUpgrades[o.name].pp;
|
||||
o.color = CacheUpgrades[o.name].color;
|
||||
o.colour = CacheUpgrades[o.name].colour;
|
||||
arr.push(o);
|
||||
}
|
||||
|
||||
if (CMOptions.SortUpgrades) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
|
||||
// Sort by pp colour group, then by pp.
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||
? a.pp - b.pp
|
||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||
);
|
||||
} else {
|
||||
arr.sort((a, b) => a.price - b.price);
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
import FormatTime from '../BeautifyAndFormatting/FormatTime';
|
||||
import CacheDragonCost from '../../Cache/Dragon/Dragon.js';
|
||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData.js';
|
||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange.js';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||
import FormatTime from '../BeautifyAndFormatting/FormatTime.js';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export function AddAuraInfo(aura) {
|
||||
if (CMOptions.DragonAuraInfo === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DragonAuraInfo === 1) {
|
||||
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
|
||||
const timeToRecover = FormatTime(priceOfChange / (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 = '120px';
|
||||
l('dragonAuraInfo').style.margin = '8px';
|
||||
l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
|
||||
const div = document.createElement('div');
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
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';
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons.js';
|
||||
import UpdateBuildings from './BuildingsUpgrades/Buildings.js';
|
||||
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight.js';
|
||||
import UpdateUpgrades from './BuildingsUpgrades/Upgrades.js';
|
||||
import { UpdateBotBar } from './InfoBars/BottomBar.js';
|
||||
import { UpdateTimerBar } from './InfoBars/TimerBar.js';
|
||||
import RefreshMenu from './MenuSections/Refreshmenu.js';
|
||||
import UpdateTooltips from './Tooltips/UpdateTooltips.js';
|
||||
import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/WrinklerTooltips.js';
|
||||
|
||||
/**
|
||||
* This function handles all custom drawing for the Game.Draw() function.
|
||||
@@ -20,7 +18,7 @@ export default function CMDrawHook() {
|
||||
Game.prefs.autosave &&
|
||||
Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks
|
||||
Game.onMenu === 'stats' &&
|
||||
CMOptions.Stats // while being on the stats menu only
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats // while being on the stats menu only
|
||||
) {
|
||||
const timer = document.getElementById('CMStatsAutosaveTimer');
|
||||
if (timer) {
|
||||
@@ -28,7 +26,7 @@ export default function CMDrawHook() {
|
||||
}
|
||||
}
|
||||
|
||||
// Update colors
|
||||
// Update colours
|
||||
UpdateBuildings();
|
||||
UpdateUpgrades();
|
||||
UpdateUpgradeSectionsHeight();
|
||||
@@ -51,11 +49,4 @@ export default function CMDrawHook() {
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { GCTimers } from '../VariablesAndData';
|
||||
import { GCTimers } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function creates a new Golden Cookie Timer and appends it CM.Disp.GCTimers based on the id of the cookie
|
||||
@@ -20,7 +19,9 @@ export default function CreateGCTimer(cookie) {
|
||||
GCTimer.style.fontSize = '35px';
|
||||
GCTimer.style.cursor = 'pointer';
|
||||
GCTimer.style.display = 'block';
|
||||
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
||||
GCTimer.style.pointerEvents = 'none';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer === 0)
|
||||
GCTimer.style.display = 'none';
|
||||
GCTimer.style.left = cookie.l.style.left;
|
||||
GCTimer.style.top = cookie.l.style.top;
|
||||
GCTimer.onclick = function () {
|
||||
|
||||
162
src/Disp/HelperFunctions/CalculateAllPlotChances.js
Normal file
162
src/Disp/HelperFunctions/CalculateAllPlotChances.js
Normal file
@@ -0,0 +1,162 @@
|
||||
/* eslint-disable no-continue */
|
||||
|
||||
import { CachePlotChances } from '../../Cache/VariablesAndData.js';
|
||||
import CalculateSingleTileChances from './CalculateSingleTileChances.js';
|
||||
|
||||
/**
|
||||
* Calculates the possible plants for the next garden tick and updates **`CachePlotChances`** accordingly (expensive.)
|
||||
*
|
||||
* @param {Object} minigame a reference to the garden minigame
|
||||
* @param {number} auraMult the current value of the "Supreme Intellect" dragon aura multiplier
|
||||
*/
|
||||
export default function CalculateAllPlotChances(minigame, auraMult) {
|
||||
const { plantsById, soilsById, soil, isTileUnlocked, getTile } = minigame;
|
||||
const dragonBoost = 1 + 0.05 * auraMult;
|
||||
|
||||
// calculate boosts from neighbors for next tick
|
||||
const boosts = [];
|
||||
for (let y = 0; y < 6; y++) {
|
||||
boosts[y] = [];
|
||||
for (let x = 0; x < 6; x++) boosts[y].push([1, 1]); // [aging, weed]
|
||||
}
|
||||
|
||||
const ApplyMultsToNearbyTiles = function (x, y, range, mults) {
|
||||
for (let dy = -range; dy <= range; dy++) {
|
||||
for (let dx = -range; dx <= range; dx++) {
|
||||
if ((dx !== 0 || dy !== 0) && isTileUnlocked(x + dx, y + dy)) {
|
||||
boosts[y + dy][x + dx][0] *= mults[0];
|
||||
boosts[y + dy][x + dx][1] *= mults[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
const tile = getTile(x, y);
|
||||
if (tile[0] === 0) continue;
|
||||
|
||||
let ageMult;
|
||||
let weedMult;
|
||||
let range;
|
||||
const id = tile[0] - 1;
|
||||
switch (id) {
|
||||
case 7:
|
||||
ageMult = 1.03;
|
||||
weedMult = 1;
|
||||
range = 1;
|
||||
break;
|
||||
case 31:
|
||||
ageMult = 1;
|
||||
weedMult = 0;
|
||||
range = 2;
|
||||
break;
|
||||
case 32:
|
||||
ageMult = 1;
|
||||
weedMult = 0;
|
||||
range = 1;
|
||||
break;
|
||||
case 33:
|
||||
ageMult = 0.5;
|
||||
weedMult = 1;
|
||||
range = 1;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
let mult = soilsById[soil].effMult;
|
||||
const matureAge = plantsById[id].mature;
|
||||
const stage = 1 + (tile[1] >= matureAge ? 3 : Math.floor(tile[1] / (matureAge * 0.333)));
|
||||
|
||||
// eslint-disable-next-line default-case
|
||||
switch (stage) {
|
||||
case 1:
|
||||
mult *= 0.1;
|
||||
break;
|
||||
case 2:
|
||||
mult *= 0.25;
|
||||
break;
|
||||
case 3:
|
||||
mult *= 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ageMult > 1 || mult < 1) ageMult = (ageMult - 1) * mult + 1;
|
||||
else ageMult /= mult;
|
||||
|
||||
ApplyMultsToNearbyTiles(x, y, range, [ageMult, weedMult]);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize all probabilities to current state
|
||||
const plotOutcomes = [[], [], [], [], [], []];
|
||||
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (!isTileUnlocked(x, y)) continue;
|
||||
|
||||
const tile = getTile(x, y);
|
||||
if (tile[0] === 0) plotOutcomes[y][x] = [{ plantId: -1, isMature: false, p: 1 }];
|
||||
else {
|
||||
const plantId = tile[0] - 1;
|
||||
plotOutcomes[y][x] = [{ plantId, isMature: tile[1] >= plantsById[plantId].mature, p: 1 }];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update each tile's chances
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (!isTileUnlocked(x, y)) continue;
|
||||
|
||||
// collect neighbor probabilities
|
||||
const neighResults = [];
|
||||
const cardinals = [];
|
||||
for (let dy = -1; dy <= 1; dy++)
|
||||
for (let dx = -1; dx <= 1; dx++) {
|
||||
if ((dx !== 0 || dy !== 0) && isTileUnlocked(x + dx, y + dy)) {
|
||||
neighResults.push(plotOutcomes[y + dy][x + dx]);
|
||||
if (dx === 0 || dy === 0) cardinals.push(neighResults.length - 1); // save indices of cardinal neighbors
|
||||
}
|
||||
}
|
||||
|
||||
const tile = getTile(x, y);
|
||||
|
||||
plotOutcomes[y][x] = CalculateSingleTileChances(
|
||||
minigame,
|
||||
tile[0] - 1,
|
||||
tile[1],
|
||||
neighResults,
|
||||
cardinals,
|
||||
boosts[y][x],
|
||||
dragonBoost,
|
||||
);
|
||||
|
||||
// save results
|
||||
CachePlotChances[y][x] = [];
|
||||
|
||||
const emptyP = plotOutcomes[y][x]
|
||||
.filter((o) => o.plantId === -1)
|
||||
.reduce((s, o) => s + o.p, 0);
|
||||
if (emptyP > 0) CachePlotChances[y][x].push({ plantId: -1, maturityP: 0, p: emptyP });
|
||||
|
||||
for (let id = 0; id < plantsById.length; id++) {
|
||||
const matches = plotOutcomes[y][x].filter((o) => o.plantId === id);
|
||||
if (matches.length > 1) {
|
||||
const plantP = matches.reduce((s, o) => s + o.p, 0);
|
||||
const maturityP =
|
||||
matches.filter((o) => o.isMature === true).reduce((s, o) => s + o.p, 0) / plantP;
|
||||
CachePlotChances[y][x].push({ plantId: id, maturityP, p: plantP });
|
||||
} else if (matches.length === 1)
|
||||
CachePlotChances[y][x].push({
|
||||
plantId: id,
|
||||
maturityP: matches[0].isMature ? 1 : 0,
|
||||
p: matches[0].p,
|
||||
});
|
||||
}
|
||||
|
||||
CachePlotChances[y][x].sort((a, b) => a.plantId - b.plantId);
|
||||
}
|
||||
}
|
||||
}
|
||||
104
src/Disp/HelperFunctions/CalculateLuckyLevels.js
Normal file
104
src/Disp/HelperFunctions/CalculateLuckyLevels.js
Normal file
@@ -0,0 +1,104 @@
|
||||
const SPECIAL_DIGIT = 7;
|
||||
|
||||
/**
|
||||
* Count the number of 7s in any number
|
||||
* @param {number} number The number to count sevens for
|
||||
* @returns {number} The number of 7s in the provided number
|
||||
*/
|
||||
export function CountSevens(number) {
|
||||
return String(number).split(String(SPECIAL_DIGIT)).length - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the delta for the next number where the given digit is a 7
|
||||
* @param {number} number The starting number to calculate the delta for
|
||||
* @param {number} digitPlace 1 for ones place, 10 for tens place, 100 for hundreds place, etc
|
||||
* @returns {number} The calculated delta
|
||||
*/
|
||||
export function CalculateSevenDelta(number, digitPlace) {
|
||||
const target = SPECIAL_DIGIT * digitPlace;
|
||||
const modulus = digitPlace * 10;
|
||||
|
||||
let delta = target - (number % modulus) + (number % digitPlace);
|
||||
if (delta < 0) delta += modulus;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function calculates each of the next "lucky" prestige levels
|
||||
* @param {number} currentLevel The user's prestige level, including levels earned since the last ascension
|
||||
* @returns {{number}, {number}, {number}} luckyDigit, luckyNumber, luckyPayout The next eligible level for each upgrade
|
||||
*/
|
||||
export default function CalculateLuckyLevels(currentLevel) {
|
||||
const result = {};
|
||||
let sevenCount = CountSevens(currentLevel);
|
||||
const numberOfDigits = Math.max(Math.floor(Math.log10(Math.abs(currentLevel))), 0) + 1;
|
||||
|
||||
if (sevenCount >= 1) {
|
||||
result.luckyDigit = currentLevel;
|
||||
if (sevenCount >= 2) {
|
||||
result.luckyNumber = currentLevel;
|
||||
if (sevenCount >= 4) {
|
||||
result.luckyPayout = currentLevel;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Consider only top 15 digits if it is big number
|
||||
let localLevel;
|
||||
if (numberOfDigits >= 16) {
|
||||
localLevel = Math.ceil(currentLevel / 10 ** (numberOfDigits - 15));
|
||||
} else {
|
||||
localLevel = currentLevel;
|
||||
}
|
||||
sevenCount = CountSevens(localLevel);
|
||||
|
||||
if (result.luckyDigit === undefined) {
|
||||
if (sevenCount < 1) {
|
||||
const delta = CalculateSevenDelta(localLevel, 1);
|
||||
|
||||
localLevel += delta;
|
||||
sevenCount = CountSevens(localLevel);
|
||||
}
|
||||
|
||||
result.luckyDigit = localLevel;
|
||||
if (numberOfDigits >= 16) {
|
||||
result.luckyDigit *= 10 ** Number(numberOfDigits - 15);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.luckyNumber === undefined) {
|
||||
while (sevenCount < 2) {
|
||||
let delta = CalculateSevenDelta(localLevel, 1);
|
||||
if (delta === 0) delta = CalculateSevenDelta(localLevel, 10);
|
||||
|
||||
localLevel += delta;
|
||||
sevenCount = CountSevens(localLevel);
|
||||
}
|
||||
|
||||
result.luckyNumber = localLevel;
|
||||
if (numberOfDigits >= 16) {
|
||||
result.luckyNumber *= 10 ** Number(numberOfDigits - 15);
|
||||
}
|
||||
}
|
||||
|
||||
let digitPlace = 1;
|
||||
while (sevenCount < 4) {
|
||||
const delta = CalculateSevenDelta(localLevel, digitPlace);
|
||||
if (delta === 0) {
|
||||
digitPlace *= 10;
|
||||
} else {
|
||||
localLevel += delta;
|
||||
sevenCount = CountSevens(localLevel);
|
||||
}
|
||||
}
|
||||
|
||||
result.luckyPayout = localLevel;
|
||||
if (numberOfDigits >= 16) {
|
||||
result.luckyPayout *= 10 ** Number(numberOfDigits - 15);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
240
src/Disp/HelperFunctions/CalculateSingleTileChances.js
Normal file
240
src/Disp/HelperFunctions/CalculateSingleTileChances.js
Normal file
@@ -0,0 +1,240 @@
|
||||
/* eslint-disable guard-for-in */
|
||||
/* eslint-disable no-continue */
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable no-param-reassign */
|
||||
|
||||
/**
|
||||
* Calculates the possible plants for a tile after the next garden tick.
|
||||
*
|
||||
* @param {Object} minigame A reference to the garden minigame
|
||||
* @param {number} plantId The ID of the tile's current plant (-1 if empty)
|
||||
* @param {number} age The age of the tile's current plant (ignored if empty)
|
||||
* @param {Object[][]} neighResults The calculated results of each neighboring tile
|
||||
* @param {number[]} cardinals The indices of orthogonally adjacent tiles in `neighResults`
|
||||
* @param {number[]} tileBoosts The boosts to aging and weed spawning this tile is recieving from nearby tiles in the format `[ageMult, weedMult]`
|
||||
* @param {number} dragonBoost The current calculated value of the boost from the "Supreme Intellect" dragon aura
|
||||
* @returns {{plantId: number, isMature: boolean, p: number}[]} The possible resulting tile states and their probabilities
|
||||
*/
|
||||
export default function CalculateSingleTileChances(
|
||||
minigame,
|
||||
plantId,
|
||||
age,
|
||||
neighResults,
|
||||
cardinals,
|
||||
tileBoosts,
|
||||
dragonBoost,
|
||||
) {
|
||||
const { getMuts, plants, plantsById, plantContam, soilsById, soil } = minigame;
|
||||
const soilWeedMult = soilsById[soil].weedMult;
|
||||
|
||||
const epsilon = 1e-12;
|
||||
const futureStates = [];
|
||||
const AddOutcome = function (outcome) {
|
||||
if (outcome.p < epsilon) return;
|
||||
|
||||
const existing = futureStates.find(
|
||||
(o) =>
|
||||
o.plantId === outcome.plantId &&
|
||||
(outcome.plantId === -1 || o.isMature === outcome.isMature),
|
||||
);
|
||||
if (existing) existing.p += outcome.p;
|
||||
else futureStates.push(outcome);
|
||||
};
|
||||
let runningP = 1;
|
||||
|
||||
if (plantId !== -1) {
|
||||
// tile has plant
|
||||
const currentPlant = plantsById[plantId];
|
||||
|
||||
const AgeThresholdP = function (multiplier, threshold) {
|
||||
// probability that plant's age increases by at least threshold
|
||||
const minAge = currentPlant.ageTick * multiplier;
|
||||
const maxAge = minAge + currentPlant.ageTickR * multiplier;
|
||||
|
||||
if (Math.abs(maxAge - minAge) < epsilon) {
|
||||
if (minAge >= threshold) return 1;
|
||||
if (minAge < threshold - 1) return 0;
|
||||
return minAge - (threshold - 1);
|
||||
}
|
||||
|
||||
if (threshold <= minAge) return 1;
|
||||
if (threshold - 1 >= maxAge) return 0;
|
||||
|
||||
const lower = Math.max(minAge, threshold - 1);
|
||||
const upper = Math.min(maxAge, threshold);
|
||||
|
||||
const a = 0.5 * (upper - (threshold - 1)) ** 2 - 0.5 * (lower - (threshold - 1)) ** 2;
|
||||
const b = Math.max(0, maxAge - Math.max(minAge, threshold));
|
||||
|
||||
return (a + b) / (maxAge - minAge);
|
||||
};
|
||||
|
||||
// death
|
||||
if (!currentPlant.immortal) {
|
||||
const deathP = AgeThresholdP(tileBoosts[0] * dragonBoost, 100 - age);
|
||||
AddOutcome({ plantId: -1, isMature: false, p: deathP * runningP });
|
||||
runningP -= deathP * runningP;
|
||||
}
|
||||
|
||||
// contamination
|
||||
if (!currentPlant.noContam) {
|
||||
const contamChances = [];
|
||||
|
||||
for (const key in plantContam) {
|
||||
let inclusionP = plantContam[key];
|
||||
if (plants[key].weed) inclusionP *= soilWeedMult;
|
||||
contamChances.push([key, inclusionP]);
|
||||
}
|
||||
|
||||
let totalContamP = 0;
|
||||
for (const [key1, inclusionP1] of contamChances) {
|
||||
if (plants[key1].id === plantId || inclusionP1 === 0) continue;
|
||||
|
||||
let hasNeighborP = 0;
|
||||
for (const i of cardinals) {
|
||||
let isNeighborP = 0;
|
||||
for (const o of neighResults[i]) {
|
||||
if (o.plantId === key1 && o.isMature) isNeighborP += o.p;
|
||||
}
|
||||
hasNeighborP += isNeighborP * (1 - hasNeighborP);
|
||||
}
|
||||
if (hasNeighborP < epsilon) continue;
|
||||
|
||||
let q = [1];
|
||||
for (const [key2, inclusionP2] of contamChances) {
|
||||
if (key1 !== key2) {
|
||||
const newQ = Array(q.length + 1).fill(0);
|
||||
for (let k = 0; k < q.length; k++) {
|
||||
newQ[k] += q[k] * (1 - inclusionP2);
|
||||
newQ[k + 1] += q[k] * inclusionP2;
|
||||
}
|
||||
q = newQ;
|
||||
}
|
||||
}
|
||||
|
||||
const E = q.reduce((acc, probXk, k) => acc + probXk / (1 + k), 0);
|
||||
const contamP = inclusionP1 * E * hasNeighborP * runningP;
|
||||
AddOutcome({ plantId: plants[key1].id, isMature: false, p: contamP });
|
||||
totalContamP += contamP;
|
||||
}
|
||||
runningP -= totalContamP;
|
||||
}
|
||||
|
||||
// survival (remaining probability)
|
||||
const maturityP = AgeThresholdP(tileBoosts[0] * dragonBoost, currentPlant.mature - age);
|
||||
AddOutcome({ plantId, isMature: true, p: maturityP * runningP });
|
||||
AddOutcome({ plantId, isMature: false, p: (1 - maturityP) * runningP });
|
||||
} else {
|
||||
// tile is empty
|
||||
let noNeighborsChance = 1;
|
||||
neighResults.forEach((neighbor) => {
|
||||
let emptyChance = 0;
|
||||
const emptyOutcome = neighbor.find((outcome) => outcome.plantId === -1);
|
||||
if (emptyOutcome) emptyChance = emptyOutcome.p;
|
||||
noNeighborsChance *= emptyChance;
|
||||
});
|
||||
|
||||
// weeds
|
||||
const weedChance = 0.002 * soilWeedMult * tileBoosts[1];
|
||||
AddOutcome({ plantId: 13, isMature: false, p: weedChance * noNeighborsChance });
|
||||
AddOutcome({ plantId: -1, isMature: false, p: (1 - weedChance) * noNeighborsChance });
|
||||
|
||||
runningP -= noNeighborsChance;
|
||||
|
||||
// mutation
|
||||
if (noNeighborsChance < 1) {
|
||||
let totalMutationP = 0;
|
||||
|
||||
const CombineNeighbors = function (i = 0, current = [], comboP = 1, results = []) {
|
||||
if (i >= neighResults.length) {
|
||||
results.push({ tiles: current.slice(), comboP });
|
||||
return results;
|
||||
}
|
||||
|
||||
for (const state of neighResults[i])
|
||||
CombineNeighbors(i + 1, [...current, state], comboP * state.p, results);
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
const loopsBase = (soilsById[soil].key === 'woodchips' ? 3 : 1) * dragonBoost;
|
||||
for (const combo of CombineNeighbors()) {
|
||||
// possible combinations of neighboring tiles
|
||||
const neighs = {};
|
||||
const neighsM = {};
|
||||
|
||||
for (const tile of combo.tiles) {
|
||||
if (tile.plantId === -1) continue;
|
||||
const { key } = plantsById[tile.plantId];
|
||||
neighs[key] = (neighs[key] || 0) + 1;
|
||||
if (tile.isMature) neighsM[key] = (neighsM[key] || 0) + 1;
|
||||
}
|
||||
|
||||
const muts = getMuts(neighs, neighsM);
|
||||
|
||||
let perLoopMutationP = 0; // probability that any mutation occurs on a single loop with this combo
|
||||
const mutationChances = [];
|
||||
for (const [key, mutValue] of muts) {
|
||||
let inclusionP = mutValue;
|
||||
if (plants[key].weed) inclusionP *= soilWeedMult;
|
||||
if (plants[key].weed || plants[key].fungus) inclusionP *= tileBoosts[1];
|
||||
if (inclusionP > 0) mutationChances.push([key, inclusionP]);
|
||||
}
|
||||
|
||||
const perLoopMutations = [];
|
||||
for (const [key1, inclusionP1] of mutationChances) {
|
||||
let q = [1];
|
||||
for (const [key2, inclusionP2] of mutationChances) {
|
||||
if (key1 !== key2) {
|
||||
const newQ = Array(q.length + 1).fill(0);
|
||||
for (let k = 0; k < q.length; k++) {
|
||||
newQ[k] += q[k] * (1 - inclusionP2);
|
||||
newQ[k + 1] += q[k] * inclusionP2;
|
||||
}
|
||||
q = newQ;
|
||||
}
|
||||
}
|
||||
|
||||
const E = q.reduce((acc, probXk, k) => acc + probXk / (1 + k), 0);
|
||||
const mutationP = inclusionP1 * E;
|
||||
perLoopMutationP += mutationP;
|
||||
perLoopMutations.push([key1, mutationP * combo.comboP * runningP]);
|
||||
}
|
||||
|
||||
if (perLoopMutationP === 0) continue;
|
||||
|
||||
let loopsBoost = 1;
|
||||
if (loopsBase > 1) {
|
||||
if (Number.isInteger(loopsBase)) {
|
||||
loopsBoost = (1 - (1 - perLoopMutationP) ** loopsBase) / perLoopMutationP;
|
||||
} else {
|
||||
const loopsFloor = Math.floor(loopsBase);
|
||||
const loopsFrac = loopsBase % 1;
|
||||
const boostN = (1 - (1 - perLoopMutationP) ** loopsFloor) / perLoopMutationP;
|
||||
const boostNp1 = (1 - (1 - perLoopMutationP) ** (loopsFloor + 1)) / perLoopMutationP;
|
||||
loopsBoost = (1 - loopsFrac) * boostN + loopsFrac * boostNp1;
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, mutationP] of perLoopMutations) {
|
||||
AddOutcome({ plantId: plants[key].id, maturityP: 0, p: mutationP * loopsBoost });
|
||||
totalMutationP += mutationP * loopsBoost;
|
||||
}
|
||||
}
|
||||
|
||||
runningP -= totalMutationP;
|
||||
}
|
||||
|
||||
// nothing (remaining probability)
|
||||
AddOutcome({ plantId: -1, isMature: false, p: runningP });
|
||||
}
|
||||
|
||||
const total = futureStates.reduce((sum, o) => sum + o.p, 0);
|
||||
if (Math.abs(total - 1) > 1e-9) {
|
||||
futureStates.forEach((o) => {
|
||||
o.p /= total;
|
||||
});
|
||||
}
|
||||
|
||||
return futureStates;
|
||||
}
|
||||
52
src/Disp/HelperFunctions/CalculateStockNextExpectedValue.js
Normal file
52
src/Disp/HelperFunctions/CalculateStockNextExpectedValue.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* This function calculates a stock's next expected value
|
||||
* @param {number} value The stock's current value
|
||||
* @param {number} delta The stock's current delta
|
||||
* @param {number} restingValue The stock's resting value
|
||||
* @param {number} mode The stock's current mode
|
||||
* @param {number} bankLevel The bank building level
|
||||
* @param {number} dragonBoost The current aura multiplier from Supreme Intellect and Reality Bending
|
||||
* @returns {number} value + delta The stock's next expected value
|
||||
*/
|
||||
export default function CalculateStockNextExpectedValue(
|
||||
pValue,
|
||||
pDelta,
|
||||
restingValue,
|
||||
mode,
|
||||
bankLevel,
|
||||
dragonBoost,
|
||||
) {
|
||||
let value = pValue;
|
||||
let delta = pDelta;
|
||||
delta *= 0.97 + 0.01 * dragonBoost;
|
||||
switch (mode) {
|
||||
case 0:
|
||||
delta *= 0.95;
|
||||
break;
|
||||
case 1:
|
||||
delta *= 0.99;
|
||||
delta += 0.02;
|
||||
break;
|
||||
case 2:
|
||||
delta *= 0.99;
|
||||
delta -= 0.02;
|
||||
break;
|
||||
case 3:
|
||||
delta += 0.06;
|
||||
value += 2.5;
|
||||
break;
|
||||
case 4:
|
||||
delta -= 0.06;
|
||||
value -= 2.5;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
value += (restingValue - value) * 0.01;
|
||||
if (mode === 3) value -= 0.582;
|
||||
if (mode === 4) value += 0.6;
|
||||
if (value > 100 + (bankLevel - 1) * 3 && delta > 0) delta *= 0.9;
|
||||
if (value < 5) value += (5 - value) * 0.5;
|
||||
if (value < 5 && delta < 0) delta *= 0.95;
|
||||
return Math.max(value + delta, 1);
|
||||
}
|
||||
@@ -3,25 +3,27 @@ import {
|
||||
CacheCurrWrinklerCount,
|
||||
CacheCurrWrinklerCPSMult,
|
||||
CacheWrinklersFattest,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
} from '../../Cache/VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
|
||||
* @returns {number} The average or current cps
|
||||
*/
|
||||
export default function GetCPS() {
|
||||
if (CMOptions.CPSMode) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode) {
|
||||
return CacheAverageCPS;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 0) {
|
||||
return Game.cookiesPs * (1 - Game.cpsSucked);
|
||||
}
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1) {
|
||||
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05));
|
||||
}
|
||||
if (CacheWrinklersFattest[1] !== null)
|
||||
if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2 &&
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
|
||||
) {
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
|
||||
|
||||
@@ -5,29 +5,29 @@ import {
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @returns {{string}, {string}} text, colour An array containing the text and display-colour of the sugar lump
|
||||
*/
|
||||
export default function GetLumpColour(type) {
|
||||
if (type === 0) {
|
||||
return { text: 'Normal', color: ColourGray };
|
||||
return { text: 'Normal', colour: ColourGray };
|
||||
}
|
||||
if (type === 1) {
|
||||
return { text: 'Bifurcated', color: ColourGreen };
|
||||
return { text: 'Bifurcated', colour: ColourGreen };
|
||||
}
|
||||
if (type === 2) {
|
||||
return { text: 'Golden', color: ColourYellow };
|
||||
return { text: 'Golden', colour: ColourYellow };
|
||||
}
|
||||
if (type === 3) {
|
||||
return { text: 'Meaty', color: ColourOrange };
|
||||
return { text: 'Meaty', colour: ColourOrange };
|
||||
}
|
||||
if (type === 4) {
|
||||
return { text: 'Caramelized', color: ColourPurple };
|
||||
return { text: 'Caramelized', colour: ColourPurple };
|
||||
}
|
||||
return { text: 'Unknown Sugar Lump', color: ColourRed };
|
||||
return { text: 'Unknown Sugar Lump', colour: ColourRed };
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function returns the total amount stored in the Wrinkler Bank
|
||||
@@ -7,10 +6,10 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
|
||||
*/
|
||||
export default function GetWrinkConfigBank() {
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1) {
|
||||
return CacheWrinklersTotal;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 2) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2) {
|
||||
return CacheWrinklersFattest[0];
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgrades from '../BuildingsUpgrades/Upgrades';
|
||||
import { UpdateBotBar } from '../InfoBars/BottomBar';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings.js';
|
||||
import UpdateUpgrades from '../BuildingsUpgrades/Upgrades.js';
|
||||
import { UpdateBotBar } from '../InfoBars/BottomBar.js';
|
||||
|
||||
/**
|
||||
* This function refreshes all numbers after a change in scale-setting
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ToggleTimerBar } from '../../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBackground from './UpdateBackground';
|
||||
import { ToggleTimerBar } from '../../Config/SpecificToggles.js';
|
||||
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar.js';
|
||||
|
||||
import UpdateBackground from './UpdateBackground.js';
|
||||
|
||||
/**
|
||||
* This function disables and shows the bars created by CookieMonster when the game is "ascending"
|
||||
@@ -10,8 +10,10 @@ import UpdateBackground from './UpdateBackground';
|
||||
export default function UpdateAscendState() {
|
||||
if (Game.OnAscend) {
|
||||
l('game').style.bottom = '0px';
|
||||
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none';
|
||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1)
|
||||
l('CMBotBar').style.display = 'none';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1)
|
||||
l('CMTimerBar').style.display = 'none';
|
||||
} else {
|
||||
ToggleBotBar();
|
||||
ToggleTimerBar();
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings.js';
|
||||
import {
|
||||
ColourBackPre,
|
||||
ColourBorderPre,
|
||||
ColoursOrdering,
|
||||
ColourTextPre,
|
||||
} from '../VariablesAndData';
|
||||
} from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function changes/refreshes colours if the user has set new standard colours
|
||||
@@ -15,17 +14,23 @@ export default function UpdateColours() {
|
||||
let str = '';
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/** Functions related to the Bottom Bar */
|
||||
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
import FormatTime from '../BeautifyAndFormatting/FormatTime';
|
||||
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData.js';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata.js';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||
import FormatTime from '../BeautifyAndFormatting/FormatTime.js';
|
||||
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour.js';
|
||||
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
import GetCPS from '../HelperFunctions/GetCPS.js';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank.js';
|
||||
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData.js';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements.js';
|
||||
|
||||
/**
|
||||
* This function creates the bottom bar and appends it to l('wrapper')
|
||||
@@ -34,10 +33,10 @@ export function CreateBotBar() {
|
||||
table.style.whiteSpace = 'nowrap';
|
||||
const tbody = table.appendChild(document.createElement('tbody'));
|
||||
|
||||
const firstCol = function (text, color) {
|
||||
const firstCol = function (text, colour) {
|
||||
const td = document.createElement('td');
|
||||
td.style.textAlign = 'right';
|
||||
td.className = ColourTextPre + color;
|
||||
td.className = ColourTextPre + colour;
|
||||
td.textContent = text;
|
||||
return td;
|
||||
};
|
||||
@@ -62,7 +61,11 @@ export function CreateBotBar() {
|
||||
* This function updates the bonus-, pp-, and time-rows in the the bottom bar
|
||||
*/
|
||||
export function UpdateBotBar() {
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1 &&
|
||||
CacheObjects1 &&
|
||||
Game.buyMode === 1
|
||||
) {
|
||||
let count = 0;
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
let target = Game.buyBulk;
|
||||
@@ -83,20 +86,20 @@ export function UpdateBotBar() {
|
||||
2,
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
|
||||
ColourTextPre + target[i].color;
|
||||
ColourTextPre + target[i].colour;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime) PPString = FormatTime(Math.round(target[i].pp));
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
else PPString = Beautify(Math.round(target[i].pp), 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString;
|
||||
const timeColour = GetTimeColour(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
|
||||
ColourTextPre + timeColour.color;
|
||||
ColourTextPre + timeColour.colour;
|
||||
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = `${timeColour.text} (with Wrink)`;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
|
||||
`${timeColour.text} (with Wrink)`;
|
||||
} else
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
|
||||
timeColour.text;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/** Functions to create various DOM elements used by the Bars */
|
||||
|
||||
import { ColourBackPre, ColourBlue, ColourTextPre } from '../VariablesAndData';
|
||||
import { ColourBackPre, ColourBlue, ColourTextPre } from '../VariablesAndData.js';
|
||||
|
||||
/**
|
||||
* This function creates an indivudual timer for the timer bar
|
||||
* @param {string} id An id to identify the timer
|
||||
* @param {string} name The title of the timer
|
||||
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
|
||||
* @param [{{string}, {string}}, ...] bars ([id, colour]) The id and colours of individual parts of the timer
|
||||
*/
|
||||
export function CreateTimer(id, name, bars) {
|
||||
const timerBar = document.createElement('div');
|
||||
@@ -36,20 +36,20 @@ export function CreateTimer(id, name, bars) {
|
||||
div.appendChild(type);
|
||||
|
||||
for (let i = 0; i < bars.length; i++) {
|
||||
const colorBar = document.createElement('span');
|
||||
colorBar.id = bars[i].id;
|
||||
colorBar.style.display = 'inline-block';
|
||||
colorBar.style.height = '10px';
|
||||
colorBar.style.verticalAlign = 'text-top';
|
||||
colorBar.style.textAlign = 'center';
|
||||
const colourBar = document.createElement('span');
|
||||
colourBar.id = bars[i].id;
|
||||
colourBar.style.display = 'inline-block';
|
||||
colourBar.style.height = '10px';
|
||||
colourBar.style.verticalAlign = 'text-top';
|
||||
colourBar.style.textAlign = 'center';
|
||||
if (bars.length - 1 === i) {
|
||||
colorBar.style.borderTopRightRadius = '10px';
|
||||
colorBar.style.borderBottomRightRadius = '10px';
|
||||
colourBar.style.borderTopRightRadius = '10px';
|
||||
colourBar.style.borderBottomRightRadius = '10px';
|
||||
}
|
||||
if (typeof bars[i].color !== 'undefined') {
|
||||
colorBar.className = ColourBackPre + bars[i].color;
|
||||
if (typeof bars[i].colour !== 'undefined') {
|
||||
colourBar.className = ColourBackPre + bars[i].colour;
|
||||
}
|
||||
div.appendChild(colorBar);
|
||||
div.appendChild(colourBar);
|
||||
}
|
||||
|
||||
const timer = document.createElement('span');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Functions related to the Timer Bar */
|
||||
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles.js';
|
||||
import {
|
||||
BuffColours,
|
||||
ColourBackPre,
|
||||
@@ -9,8 +8,9 @@ import {
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
LastNumberOfTimers,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateTimer } from './CreateDOMElements';
|
||||
} from '../VariablesAndData.js';
|
||||
import { CreateTimer } from './CreateDOMElements.js';
|
||||
import { updateChanceTotal, updateChanceTotalDeer } from '../../Main/CheckStates/Probability.js';
|
||||
|
||||
/**
|
||||
* This function creates the TimerBar and appends it to l('wrapper')
|
||||
@@ -27,21 +27,21 @@ export function CreateTimerBar() {
|
||||
|
||||
// Create standard Autosave bar
|
||||
const CMTimerBarAutosave = CreateTimer('CMTimerBarAutosave', 'Autosave', [
|
||||
{ id: 'CMTimerBarAutosaveBar', color: ColourPurple },
|
||||
{ id: 'CMTimerBarAutosaveBar', colour: ColourPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarAutosave);
|
||||
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColourGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColourPurple },
|
||||
{ id: 'CMTimerBarGCMinBar', colour: ColourGray },
|
||||
{ id: 'CMTimerBarGCBar', colour: ColourPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColourGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColourOrange },
|
||||
{ id: 'CMTimerBarRenMinBar', colour: ColourGray },
|
||||
{ id: 'CMTimerBarRenBar', colour: ColourOrange },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
@@ -55,14 +55,17 @@ export function CreateTimerBar() {
|
||||
* This function updates indivudual timers in the timer bar
|
||||
*/
|
||||
export function UpdateTimerBar() {
|
||||
if (CMOptions.TimerBar === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1) {
|
||||
// label width: 113, timer width: 30, div margin: 20
|
||||
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
|
||||
// label width: 113, div margin: 20, calculate timer width at runtime
|
||||
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
|
||||
let numberOfTimers = 0;
|
||||
|
||||
if (CMOptions.AutosaveTimerBar && Game.prefs.autosave) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AutosaveTimerBar &&
|
||||
Game.prefs.autosave
|
||||
) {
|
||||
const timeTillNextAutosave =
|
||||
(Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60))) / Game.fps;
|
||||
l('CMTimerBarAutosave').style.display = '';
|
||||
@@ -71,7 +74,9 @@ export function UpdateTimerBar() {
|
||||
(maxWidthOneBar - Math.ceil(timeTillNextAutosave).toString().length * 8)) /
|
||||
60,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1
|
||||
) {
|
||||
l('CMTimerBarAutosaveBar').textContent = Math.ceil(timeTillNextAutosave);
|
||||
} else l('CMTimerBarAutosaveBar').textContent = '';
|
||||
l('CMTimerBarAutosaveTime').textContent = Math.ceil(timeTillNextAutosave);
|
||||
@@ -86,7 +91,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps,
|
||||
);
|
||||
@@ -106,7 +111,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
@@ -114,9 +119,24 @@ export function UpdateTimerBar() {
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCBar').textContent = '';
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil(
|
||||
const chanceToSpawn =
|
||||
Math.max(
|
||||
0,
|
||||
(Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) /
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime),
|
||||
) ** 5;
|
||||
const finalChance = updateChanceTotal(chanceToSpawn);
|
||||
l('CMTimerBarGCTime').textContent = `${Math.ceil(
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
|
||||
);
|
||||
)} `;
|
||||
if (finalChance < 0.01) {
|
||||
l('CMTimerBarGCTime').textContent +=
|
||||
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
|
||||
} else {
|
||||
l('CMTimerBarGCTime').textContent += finalChance.toLocaleString('en', {
|
||||
style: 'percent',
|
||||
});
|
||||
}
|
||||
numberOfTimers += 1;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
|
||||
@@ -128,7 +148,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
||||
);
|
||||
@@ -141,7 +161,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
|
||||
@@ -149,9 +169,24 @@ export function UpdateTimerBar() {
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenBar').textContent = '';
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil(
|
||||
const chanceToSpawn =
|
||||
Math.max(
|
||||
0,
|
||||
(Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) /
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime),
|
||||
) ** 5;
|
||||
const deerFinalChance = updateChanceTotalDeer(chanceToSpawn);
|
||||
l('CMTimerBarRenTime').textContent = `${Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
||||
);
|
||||
)} `;
|
||||
if (deerFinalChance < 0.01) {
|
||||
l('CMTimerBarRenTime').textContent +=
|
||||
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
|
||||
} else {
|
||||
l('CMTimerBarRenTime').textContent += deerFinalChance.toLocaleString('en', {
|
||||
style: 'percent',
|
||||
});
|
||||
}
|
||||
numberOfTimers += 1;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
@@ -167,13 +202,15 @@ export function UpdateTimerBar() {
|
||||
]);
|
||||
timer.style.display = '';
|
||||
let classColour = '';
|
||||
// Gives specific timers specific colors
|
||||
// Gives specific timers specific colours
|
||||
if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') {
|
||||
classColour = BuffColours[Game.buffs[i].name];
|
||||
} else classColour = ColourPurple;
|
||||
timer.lastChild.children[1].className = ColourBackPre + classColour;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2)
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay === 2
|
||||
)
|
||||
timer.lastChild.children[1].textContent = `${Math.round(
|
||||
100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
|
||||
)}%`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { CreateTooltip } from '../Tooltips/Tooltip';
|
||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData.js';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers.js';
|
||||
import { CreateTooltip } from '../Tooltips/Tooltip.js';
|
||||
|
||||
/**
|
||||
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user