Compare commits
225 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
affd704443 | ||
|
|
7f06fd383a | ||
|
|
0f5aa41305 | ||
|
|
acd0fbbaf5 | ||
|
|
63e06d7133 | ||
|
|
38636f6323 | ||
|
|
5a37e21d10 | ||
|
|
082bc89a4a | ||
|
|
8675bd041a | ||
|
|
bd772e3712 | ||
|
|
570c0b760e | ||
|
|
69b923de89 | ||
|
|
fcd39a3860 | ||
|
|
4e6c828f8b | ||
|
|
270190feae | ||
|
|
859045b475 | ||
|
|
13dd628623 | ||
|
|
60e9ced10e | ||
|
|
5604a63652 | ||
|
|
9f9a28b008 | ||
|
|
3f867b9023 | ||
|
|
5f26d36cc2 | ||
|
|
d4e243f2b7 | ||
|
|
5403aa8bac | ||
|
|
989e984eb5 | ||
|
|
65add868f1 | ||
|
|
6e4644c3cc | ||
|
|
888b175f25 | ||
|
|
379593f7fc | ||
|
|
16ec2ff06a | ||
|
|
933a017335 | ||
|
|
492abb66dc | ||
|
|
a1aaa3de8f | ||
|
|
b17a8625bc | ||
|
|
9e98208c19 | ||
|
|
df31286af0 | ||
|
|
ca1c28d1fc | ||
|
|
9291403f58 | ||
|
|
ce14fa6190 | ||
|
|
5718e621f7 | ||
|
|
ec2c498b71 | ||
|
|
370940000b | ||
|
|
657ca1a963 | ||
|
|
ee3e44cbba | ||
|
|
f6ebfef6cd | ||
|
|
f5769ed74b | ||
|
|
133ed74877 | ||
|
|
dc96341087 | ||
|
|
8e975c2b20 | ||
|
|
7a7419a2f6 | ||
|
|
d8b9d2f20c | ||
|
|
33b968cab8 | ||
|
|
9f78e14bec | ||
|
|
096f18deef | ||
|
|
7269577009 | ||
|
|
a241ea51e7 | ||
|
|
8d89f23c35 | ||
|
|
86523a4a6c | ||
|
|
78f62affc5 | ||
|
|
bbc8ed6ec2 | ||
|
|
4b8c35f271 | ||
|
|
1d19545a43 | ||
|
|
6c939d0591 | ||
|
|
76d531a5b0 | ||
|
|
78bb328d5d | ||
|
|
54bb9f793b | ||
|
|
b8f8c3ef0c | ||
|
|
70cc97b0e0 | ||
|
|
0c64005603 | ||
|
|
adf6544e21 | ||
|
|
f24e07465b | ||
|
|
93702eefbe | ||
|
|
bed1647332 | ||
|
|
88eb28c5dd | ||
|
|
a02423f25b | ||
|
|
049d0153fb | ||
|
|
b409ddd2ed | ||
|
|
131547ec00 | ||
|
|
7c78299ade | ||
|
|
5e92bb5fa5 | ||
|
|
1ac83d901a | ||
|
|
5ebfdfd48e | ||
|
|
1f685f823a | ||
|
|
197b744f56 | ||
|
|
ab73a78a01 | ||
|
|
7b75ddddea | ||
|
|
8cfc980546 | ||
|
|
9f55f279e7 | ||
|
|
3fddc1d249 | ||
|
|
1c14ee0267 | ||
|
|
2555828eb9 | ||
|
|
8bae0fdb85 | ||
|
|
66b2c567c2 | ||
|
|
362d403601 | ||
|
|
dd66674169 | ||
|
|
4b16c896f1 | ||
|
|
cfca658703 | ||
|
|
33c463b15a | ||
|
|
a607842fdd | ||
|
|
5b982cf9cf | ||
|
|
501b2df220 | ||
|
|
e0ef8d7b11 | ||
|
|
1027d48b51 | ||
|
|
38f33e2478 | ||
|
|
fdcbbd7ab2 | ||
|
|
9bc392a0c5 | ||
|
|
9bfb8a44f9 | ||
|
|
50d4e3e215 | ||
|
|
fec312df1c | ||
|
|
17ac30177c | ||
|
|
1f23e58984 | ||
|
|
b1812afa2f | ||
|
|
ef6585b9af | ||
|
|
22b8c8a61c | ||
|
|
a89f440809 | ||
|
|
25838daede | ||
|
|
21c0042c24 | ||
|
|
e928c0227e | ||
|
|
b12fd5db72 | ||
|
|
c20abff9f4 | ||
|
|
ef7d46b6dc | ||
|
|
26672fe57b | ||
|
|
ff8fe0644a | ||
|
|
6779133dd8 | ||
|
|
f59b041e96 | ||
|
|
097ccd2048 | ||
|
|
89c94ea934 | ||
|
|
c45a630286 | ||
|
|
3e525da15c | ||
|
|
30809c7b45 | ||
|
|
db8d722479 | ||
|
|
c498574a77 | ||
|
|
79f8079228 | ||
|
|
0a6113cf72 | ||
|
|
9d101ddfd4 | ||
|
|
0e69ac39dc | ||
|
|
248be6d9ce | ||
|
|
f0757d2490 | ||
|
|
a0b4d5eecb | ||
|
|
65754bc29d | ||
|
|
aa2e866cc5 | ||
|
|
1d26217f80 | ||
|
|
c0751438b6 | ||
|
|
53ed8fe167 | ||
|
|
74e7c64ca2 | ||
|
|
46202be466 | ||
|
|
809bd4d35d | ||
|
|
b2fcbcdb81 | ||
|
|
348ba4b9fd | ||
|
|
386dae3830 | ||
|
|
9e783cc3d7 | ||
|
|
5ac33725b7 | ||
|
|
6766c05091 | ||
|
|
96fa090f0d | ||
|
|
e4143126a0 | ||
|
|
c8a5a3c34f | ||
|
|
0616887d28 | ||
|
|
196a911e2d | ||
|
|
2695fdb140 | ||
|
|
11b1be5c71 | ||
|
|
bf4f910cee | ||
|
|
b0ad9b9786 | ||
|
|
eb0861c5d7 | ||
|
|
4ebc2d597e | ||
|
|
4a76fa9f95 | ||
|
|
3b8adb7b9f | ||
|
|
9c28ef5411 | ||
|
|
b1ba7f02f7 | ||
|
|
c78b06b16a | ||
|
|
ea1d288c39 | ||
|
|
d69e249d58 | ||
|
|
a2db049b71 | ||
|
|
beb894557b | ||
|
|
6d9f6d61f4 | ||
|
|
0dd3f2594b | ||
|
|
75b59fdaa8 | ||
|
|
627fcb7b52 | ||
|
|
1f6ca9ebe6 | ||
|
|
bbf31fe96f | ||
|
|
4be3942af3 | ||
|
|
1cde6308fa | ||
|
|
488233c8dd | ||
|
|
a89f1eed1a | ||
|
|
790cf411c3 | ||
|
|
46853f711a | ||
|
|
fa49f84262 | ||
|
|
60121c0be5 | ||
|
|
c7d9144dd2 | ||
|
|
aa5cad663b | ||
|
|
2b174fe323 | ||
|
|
b191d9a434 | ||
|
|
1842c40c01 | ||
|
|
9c005b2f2f | ||
|
|
e6d89fa0c7 | ||
|
|
aaeb8a62eb | ||
|
|
b74ae3eee0 | ||
|
|
1c0a0a9851 | ||
|
|
e4267f4c41 | ||
|
|
62dc882e5a | ||
|
|
f7e7d171e8 | ||
|
|
b1ec82b4b8 | ||
|
|
669b5c1dd9 | ||
|
|
f67b561990 | ||
|
|
5def4ee13b | ||
|
|
c4812ef8fc | ||
|
|
9b9bf962b7 | ||
|
|
0cf30e5cea | ||
|
|
6fb8470432 | ||
|
|
513780efc4 | ||
|
|
66d6be8039 | ||
|
|
fd3276a9a7 | ||
|
|
765f2637f9 | ||
|
|
667b91142f | ||
|
|
7e42c62f6b | ||
|
|
dddf786567 | ||
|
|
c080876fc0 | ||
|
|
fb8f6dbb49 | ||
|
|
27fd8626c8 | ||
|
|
4c63f6d9e2 | ||
|
|
8e27b5980b | ||
|
|
ccc5f83491 | ||
|
|
2489eb16ac | ||
|
|
89f895f01e | ||
|
|
7d40e12472 | ||
|
|
ce768cb135 |
@@ -14,18 +14,6 @@
|
|||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 12
|
"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/*"],
|
"ignorePatterns": ["*CookieMonster*.js", "dist/*", "node_modules/*"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"import/no-mutable-exports": "off", // We need to this throughout Cookie Monster
|
"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:
|
The following is a short description of the various `src` directories and their contents:
|
||||||
|
|
||||||
JS | Description
|
| JS | Description |
|
||||||
-- | -
|
| ------------ | -------------------------------------------------------------------------- |
|
||||||
Cache | Functions related to creating and storing data cache
|
| Cache | Functions related to creating and storing data cache |
|
||||||
Config | Functions related to manipulating CM configuration
|
| Config | Functions related to manipulating CM configuration |
|
||||||
Data | Hard coded values
|
| Data | Hard coded values |
|
||||||
Disp | Functions related to displaying CM's UI
|
| Disp | Functions related to displaying CM's UI |
|
||||||
InitSaveLoad | Functions related to registering the CM object with the Game's Modding API
|
| InitSaveLoad | Functions related to registering the CM object with the Game's Modding API |
|
||||||
Main | Functions related to the main loop and initializing CM
|
| Main | Functions related to the main loop and initializing CM |
|
||||||
Sim | Functions related to simulate something
|
| Sim | Functions related to simulate something |
|
||||||
|
|
||||||
These are some additional guidelines:
|
These are some additional guidelines:
|
||||||
|
|
||||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
- 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.
|
- 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
|
- 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
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
directory: "/" # Location of package manifests
|
directory: '/' # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: 'weekly'
|
||||||
|
|||||||
60
.github/workflows/CI.yml
vendored
60
.github/workflows/CI.yml
vendored
@@ -10,34 +10,34 @@ jobs:
|
|||||||
Check_linting_test_and_build:
|
Check_linting_test_and_build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GITHUB_REGISTERY_PAT: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_REGISTRY_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 12
|
node-version: 22
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Run ESLint
|
- name: Run ESLint
|
||||||
run: npx eslint src
|
run: npx eslint
|
||||||
- name: Run Mocha tests
|
- name: Run Mocha tests
|
||||||
run: npx mocha
|
run: npx mocha
|
||||||
- name: Check if CookieMonsterDev.js is built correctly
|
- name: Check if CookieMonsterDev.js is built correctly
|
||||||
run: |
|
run: |
|
||||||
npx webpack -o ./tmp --env minimize
|
npx webpack -o ./tmp --env minimize
|
||||||
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 tmp/CookieMonsterDev.js); then
|
if cmp <(head -n 2 dist/CookieMonsterDev.js) <(head -n 2 tmp/CookieMonsterDev.js); then
|
||||||
echo '### SUCCESS: CookieMonsterDev is built correctly! ###'
|
echo '### SUCCESS: CookieMonsterDev is built correctly! ###'
|
||||||
else
|
else
|
||||||
echo '### WARNING: CookieMonsterDev.js does not seem to be correct. Make sure to run "npm run build-dev" after saving all your changes! ###'
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Check if CookieMonster.js is built correctly
|
- name: Check if CookieMonster.js is built correctly
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
npx webpack -o ./tmp --env minimize --env finalfile
|
npx webpack -o ./tmp --env minimize --env finalfile
|
||||||
if cmp <(head -n 2 dist/CookieMonster.js) <(head -n 2 tmp/CookieMonster.js); then
|
if cmp <(head -n 2 dist/CookieMonster.js) <(head -n 2 tmp/CookieMonster.js); then
|
||||||
echo '### SUCCESS: CookieMonster is built correctly! ###'
|
echo '### SUCCESS: CookieMonster is built correctly! ###'
|
||||||
else
|
else
|
||||||
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to run "npm run build-final" after saving all your changes! ###'
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
2
.github/workflows/publish-dev.yml
vendored
2
.github/workflows/publish-dev.yml
vendored
@@ -2,7 +2,7 @@ name: Publish
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "dev"
|
- 'dev'
|
||||||
jobs:
|
jobs:
|
||||||
publish-dev:
|
publish-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"recursive": true,
|
"recursive": true
|
||||||
"require": ["esm", "ts-node/register"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
.npmrc
2
.npmrc
@@ -1,4 +1,4 @@
|
|||||||
always-auth=true
|
always-auth=true
|
||||||
registry=https://registry.npmjs.org/
|
registry=https://registry.npmjs.org/
|
||||||
@cookiemonsterteam:registry=https://npm.pkg.github.com
|
@cookiemonsterteam:registry=https://npm.pkg.github.com
|
||||||
//npm.pkg.github.com/:_authToken=${GITHUB_REGISTERY_PAT}
|
//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==
|
// ==UserScript==
|
||||||
// @name Cookie Monster
|
// @name Cookie Monster
|
||||||
// @include /https?://orteil.dashnet.org/cookieclicker/
|
// @include /https?://orteil.dashnet.org/cookieclicker/
|
||||||
|
// @include /https?://cookieclicker.ee/
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
const readyCheck = setInterval(() => {
|
const readyCheck = setInterval(() => {
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -3,7 +3,7 @@
|
|||||||
## Cookie Monster
|
## Cookie Monster
|
||||||
|
|
||||||
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. **It is not a cheat interface** – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. **It is not a cheat interface** – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
||||||
The mod helps you to *whichever* degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
The mod helps you to _whichever_ degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
||||||
|
|
||||||
### Current version
|
### Current version
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Github Pages is hosted from the `gh-pages` branch
|
|||||||
|
|
||||||
### What it does
|
### What it does
|
||||||
|
|
||||||
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. 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
|
```javascript
|
||||||
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
||||||
@@ -24,13 +24,13 @@ If the relevant option is enabled, CM will color-code each of them based on thei
|
|||||||
<details>
|
<details>
|
||||||
<summary>The following standard colours are used:</summary>
|
<summary>The following standard colours are used:</summary>
|
||||||
|
|
||||||
* Light Blue: (upgrades) This item has a better PP than the best building to buy
|
- Light Blue: (upgrades) This item has a better PP than the best building to buy
|
||||||
* Green: This building has the best PP
|
- Green: This building has the best PP
|
||||||
* Yellow: This building is within the top 10 of best PP's
|
- Yellow: This building is within the top 10 of best PP's
|
||||||
* Orange: This building is within the top 20 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
|
- 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
|
- 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
|
- Gray: This item does not have a PP, often this means that there is no change to CPS
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Copy this code and save it as a bookmark. Paste it in the URL section. To activa
|
|||||||
```javascript
|
```javascript
|
||||||
javascript: (function () {
|
javascript: (function () {
|
||||||
Game.LoadMod('https://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.
|
If (for some reason) the above doesn't work, trying pasting everything after the <code>javascript:</code> bit into your browser's console.
|
||||||
@@ -68,11 +68,11 @@ 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.
|
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
|
## Contributing
|
||||||
|
|
||||||
To contribute you can fork and clone the repository and run `npm install`. Note that you will need to authenticate to the GitHub Package Registery (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_REGISTERY_PAT as defined in `.npmrc`.
|
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-dev` 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.
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ Before pushing a new version to `main` and Github pages use the `build-final` co
|
|||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
- **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
- **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
- **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||||
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
- **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
- **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||||
* **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
- **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
||||||
* **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
- **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
||||||
|
|||||||
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
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,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
9469
package-lock.json
generated
9469
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cookiemonsterteam/cookiemonster-mod",
|
"name": "@cookiemonsterteam/cookiemonster-mod",
|
||||||
"version": "2.031.10",
|
"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.",
|
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||||
"main": "CookieMonster.js",
|
"main": "CookieMonster.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"build-dev": "run-s eslint test pack-prod",
|
"build-dev": "run-s eslint test pack-prod",
|
||||||
"build-final": "run-s eslint test pack-final",
|
"build-final": "run-s eslint test pack-final",
|
||||||
"build-test": "webpack",
|
"build-test": "webpack",
|
||||||
"eslint": "eslint src test",
|
"eslint": "eslint",
|
||||||
"pack-prod": "webpack --env minimize",
|
"pack-prod": "webpack --env minimize",
|
||||||
"pack-final": "webpack --env minimize --env finalfile",
|
"pack-final": "webpack --env minimize --env finalfile",
|
||||||
"test": "mocha"
|
"test": "mocha"
|
||||||
@@ -43,26 +43,6 @@
|
|||||||
"url": "https://github.com/CookieMonsterTeam/CookieMonster/issues"
|
"url": "https://github.com/CookieMonsterTeam/CookieMonster/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/CookieMonsterTeam/CookieMonster#readme",
|
"homepage": "https://github.com/CookieMonsterTeam/CookieMonster#readme",
|
||||||
"devDependencies": {
|
|
||||||
"@types/chai": "^4.2.19",
|
|
||||||
"@types/mocha": "^9.0.0",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
|
||||||
"@typescript-eslint/parser": "^4.30.0",
|
|
||||||
"chai": "^4.3.4",
|
|
||||||
"eslint": "^7.32.0",
|
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
|
||||||
"eslint-config-prettier": "^8.3.0",
|
|
||||||
"eslint-plugin-import": "^2.24.2",
|
|
||||||
"esm": "^3.2.25",
|
|
||||||
"mocha": "^8.4.0",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"prettier": "2.3.2",
|
|
||||||
"ts-loader": "^9.2.5",
|
|
||||||
"ts-node": "^10.2.1",
|
|
||||||
"typescript": "^4.4.2",
|
|
||||||
"webpack": "^5.51.2",
|
|
||||||
"webpack-cli": "^4.8.0"
|
|
||||||
},
|
|
||||||
"ccrepo": {
|
"ccrepo": {
|
||||||
"icon": [
|
"icon": [
|
||||||
10,
|
10,
|
||||||
@@ -70,8 +50,30 @@
|
|||||||
],
|
],
|
||||||
"name": "Cookie Monster"
|
"name": "Cookie Monster"
|
||||||
},
|
},
|
||||||
|
"type": "module",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eastdesire/jscolor": "^2.4.5",
|
"@cookiemonsterteam/cookiemonsterframework": "0.2.3",
|
||||||
"@cookiemonsterteam/cookiemonsterframework": "^0.2.1"
|
"@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 {
|
import {
|
||||||
ChoEggDiff, // eslint-disable-line no-unused-vars
|
ChoEggDiff, // eslint-disable-line no-unused-vars
|
||||||
ClicksDiff, // eslint-disable-line no-unused-vars
|
ClicksDiff, // eslint-disable-line no-unused-vars
|
||||||
CookiesDiff, // eslint-disable-line no-unused-vars
|
CookiesDiff, // eslint-disable-line no-unused-vars
|
||||||
WrinkDiff, // eslint-disable-line no-unused-vars
|
WrinkDiff, // eslint-disable-line no-unused-vars
|
||||||
WrinkFattestDiff, // eslint-disable-line no-unused-vars
|
WrinkFattestDiff, // eslint-disable-line no-unused-vars
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData.js';
|
||||||
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import {
|
import {
|
||||||
CacheAverageClicks, // eslint-disable-line no-unused-vars
|
CacheAverageClicks,
|
||||||
CacheAverageCPS,
|
CacheAverageCPS,
|
||||||
CacheAverageGainBank,
|
CacheAverageGainBank,
|
||||||
CacheAverageGainChoEgg,
|
CacheAverageGainChoEgg,
|
||||||
CacheAverageGainWrink,
|
CacheAverageGainWrink,
|
||||||
CacheAverageGainWrinkFattest,
|
CacheAverageGainWrinkFattest,
|
||||||
CacheAvgCPSWithChoEgg, // eslint-disable-line no-unused-vars
|
CacheAvgCPSWithChoEgg,
|
||||||
CacheLastChoEgg,
|
CacheLastChoEgg,
|
||||||
CacheLastClicks,
|
CacheLastClicks,
|
||||||
CacheLastCookies,
|
CacheLastCookies,
|
||||||
CacheLastCPSCheck,
|
CacheLastCPSCheck,
|
||||||
CacheLastWrinkCookies,
|
CacheLastWrinkCookies,
|
||||||
CacheLastWrinkFattestCookies,
|
CacheLastWrinkFattestCookies,
|
||||||
CacheRealCookiesEarned, // eslint-disable-line no-unused-vars
|
CacheRealCookiesEarned,
|
||||||
CacheSellForChoEgg,
|
CacheSellForChoEgg,
|
||||||
CacheWrinklersFattest,
|
CacheWrinklersFattest,
|
||||||
CacheWrinklersTotal,
|
CacheWrinklersTotal,
|
||||||
@@ -22,7 +23,7 @@ import {
|
|||||||
CookiesDiff,
|
CookiesDiff,
|
||||||
WrinkDiff,
|
WrinkDiff,
|
||||||
WrinkFattestDiff,
|
WrinkFattestDiff,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches two variables related average CPS and Clicks
|
* This functions caches two variables related average CPS and Clicks
|
||||||
@@ -88,9 +89,25 @@ export default function CacheAvgCPS() {
|
|||||||
CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
|
||||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
CacheAverageClicks = ClicksDiff.calcAverage(
|
CacheAverageClicks = ClicksDiff.calcAverage(
|
||||||
ClickTimes[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist],
|
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 { SimObjects } from '../../Sim/VariablesAndData.js';
|
||||||
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
|
import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the current Wrinkler CPS multiplier
|
* 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('Sacrilegious corruption') * 0.05 + 1) *
|
||||||
(Game.Has('Wrinklerspawn') * 0.05 + 1) *
|
(Game.Has('Wrinklerspawn') * 0.05 + 1) *
|
||||||
godMult;
|
godMult;
|
||||||
|
|
||||||
|
FillCMDCache({ CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc.js';
|
||||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
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
|
* 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]')) {
|
if (Game.Has('Golden switch [off]')) {
|
||||||
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
||||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||||
|
|
||||||
|
FillCMDCache({ CacheNoGoldSwitchCookiesPS });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg.js';
|
||||||
import { CacheSellForChoEgg } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
|
import { CacheSellForChoEgg } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the reward for selling the Chocolate egg
|
* 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)
|
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||||
sellTotal += SellBuildingsForChoEgg();
|
sellTotal += SellBuildingsForChoEgg();
|
||||||
CacheSellForChoEgg = sellTotal;
|
CacheSellForChoEgg = sellTotal;
|
||||||
|
|
||||||
|
FillCMDCache({ CacheSellForChoEgg });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { ClickTimes } from '../Disp/VariablesAndData';
|
import { ClickTimes } from '../Disp/VariablesAndData.js';
|
||||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue.js';
|
||||||
import CacheAvgCPS from './CPS/CPS';
|
import CacheAvgCPS from './CPS/CPS.js';
|
||||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
import CacheDragonAuras from './Dragon/CacheDragonAuras.js';
|
||||||
import CachePP from './PP/PP';
|
import CachePP from './PP/PP.js';
|
||||||
import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome';
|
import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome.js';
|
||||||
import { CacheChain } from './Stats/ChainCookies';
|
import { CacheChain } from './Stats/ChainCookies.js';
|
||||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips.js';
|
||||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
import CacheAllMissingUpgrades from './Stats/MissingUpgrades.js';
|
||||||
import CacheSeasonSpec from './Stats/Reindeer';
|
import CacheSeasonSpec from './Stats/Reindeer.js';
|
||||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
|
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats.js';
|
||||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement.js';
|
||||||
import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
import CacheWrinklers from './Wrinklers/Wrinklers.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions runs all cache-functions to generate all "full" cache
|
* This functions runs all cache-functions to generate all "full" cache
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import FormatTime from '../Disp/BeautifyAndFormatting/FormatTime';
|
import FormatTime from '../Disp/BeautifyAndFormatting/FormatTime.js';
|
||||||
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
import GetCPS from '../Disp/HelperFunctions/GetCPS.js';
|
||||||
import CacheAvgCPS from './CPS/CPS';
|
import CacheAvgCPS from './CPS/CPS.js';
|
||||||
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS';
|
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS.js';
|
||||||
import CachePP from './PP/PP';
|
import CachePP from './PP/PP.js';
|
||||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips.js';
|
||||||
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement.js';
|
||||||
import { CacheTimeTillNextPrestige } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
import { CacheTimeTillNextPrestige } from './VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
import CacheWrinklers from './Wrinklers/Wrinklers.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches variables that are needed every loop
|
* 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
|
* This functions caches the currently selected Dragon Auras
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/** Functions related to the Dragon */
|
/** Functions related to the Dragon */
|
||||||
|
|
||||||
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify';
|
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify.js';
|
||||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
import CopyData from '../../Sim/SimulationData/CopyData.js';
|
||||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData.js';
|
||||||
import { CacheCostDragonUpgrade, CacheLastDragonLevel } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
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
|
* 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.dragonLevel < 25 &&
|
||||||
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
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
|
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||||
.toString()
|
.toString()
|
||||||
.match(/sacrifice\((.*?)\)/)[1];
|
.match(/sacrifice\((.*?)\)/)[1];
|
||||||
@@ -62,4 +67,6 @@ export default function CacheDragonCost() {
|
|||||||
}
|
}
|
||||||
CacheLastDragonLevel = Game.dragonLevel;
|
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 GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank.js';
|
||||||
import { ColourGray } from '../../Disp/VariablesAndData';
|
import { ColourGray } from '../../Disp/VariablesAndData.js';
|
||||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||||
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import {
|
import {
|
||||||
CacheMinPP, // eslint-disable-line no-unused-vars
|
CacheMinPP,
|
||||||
CacheMinPPBulk, // eslint-disable-line no-unused-vars
|
CacheMinPPBulk,
|
||||||
CacheObjects1,
|
CacheObjects1,
|
||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
CachePPArray,
|
CachePPArray,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
import ColourOfPP from './ColourOfPP';
|
import ColourOfPP from './ColourOfPP.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
|
* This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
|
||||||
@@ -106,4 +107,6 @@ export default function CacheBuildingsPP() {
|
|||||||
CacheColour(CacheObjects1, 1);
|
CacheColour(CacheObjects1, 1);
|
||||||
CacheColour(CacheObjects10, 10);
|
CacheColour(CacheObjects10, 10);
|
||||||
CacheColour(CacheObjects100, 100);
|
CacheColour(CacheObjects100, 100);
|
||||||
|
|
||||||
|
FillCMDCache({ CacheMinPP, CacheMinPPBulk, CachePPArray });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
import GetCPS from '../../Disp/HelperFunctions/GetCPS.js';
|
||||||
import {
|
import {
|
||||||
ColourBlue,
|
ColourBlue,
|
||||||
ColourGray,
|
ColourGray,
|
||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
ColourPurple,
|
ColourPurple,
|
||||||
ColourRed,
|
ColourRed,
|
||||||
ColourYellow,
|
ColourYellow,
|
||||||
} from '../../Disp/VariablesAndData';
|
} from '../../Disp/VariablesAndData.js';
|
||||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
import { CacheMinPP, CachePPArray } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions return the colour assosciated with the given pp value
|
* This functions return the colour assosciated with the given pp value
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* Section: Functions related to caching PP */
|
* Section: Functions related to caching PP */
|
||||||
|
|
||||||
import { CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades } from '../VariablesAndData';
|
import {
|
||||||
import CacheBuildingsPP from './Building';
|
CacheObjects1,
|
||||||
import CacheUpgradePP from './Upgrade';
|
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
|
* 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 GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank.js';
|
||||||
import { CacheUpgrades } from '../VariablesAndData';
|
import { CacheUpgrades } from '../VariablesAndData.js';
|
||||||
import ColourOfPP from './ColourOfPP';
|
import ColourOfPP from './ColourOfPP.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
|
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange';
|
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange.js';
|
||||||
import { CacheGods } from '../VariablesAndData';
|
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
|
* 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);
|
CacheGods[god][slot] = CalculateChangeGod(god, slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillCMDCache({ CacheGods });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
/** Section: Functions related to caching income */
|
/** Section: Functions related to caching income */
|
||||||
|
|
||||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome.js';
|
||||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades.js';
|
||||||
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import {
|
import {
|
||||||
CacheAverageGainBank,
|
CacheAverageGainBank,
|
||||||
CacheAverageGainWrink,
|
CacheAverageGainWrink,
|
||||||
@@ -13,7 +14,7 @@ import {
|
|||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
CacheObjectsNextAchievement,
|
CacheObjectsNextAchievement,
|
||||||
CacheUpgrades,
|
CacheUpgrades,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions starts the calculation/simulation of the bonus income of buildings
|
* This functions starts the calculation/simulation of the bonus income of buildings
|
||||||
@@ -93,6 +94,8 @@ export function CacheBuildingsPrices() {
|
|||||||
CacheObjectsNextAchievement[i].AmountNeeded,
|
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 {
|
import {
|
||||||
CacheChainFrenzyMaxReward,
|
CacheChainFrenzyMaxReward,
|
||||||
CacheChainFrenzyRequired, // eslint-disable-line no-unused-vars
|
CacheChainFrenzyRequired,
|
||||||
CacheChainFrenzyRequiredNext, // eslint-disable-line no-unused-vars
|
CacheChainFrenzyRequiredNext,
|
||||||
CacheChainFrenzyWrathMaxReward,
|
CacheChainFrenzyWrathMaxReward,
|
||||||
CacheChainFrenzyWrathRequired, // eslint-disable-line no-unused-vars
|
CacheChainFrenzyWrathRequired,
|
||||||
CacheChainFrenzyWrathRequiredNext, // eslint-disable-line no-unused-vars
|
CacheChainFrenzyWrathRequiredNext,
|
||||||
CacheChainMaxReward,
|
CacheChainMaxReward,
|
||||||
CacheChainRequired, // eslint-disable-line no-unused-vars
|
CacheChainRequired,
|
||||||
CacheChainRequiredNext, // eslint-disable-line no-unused-vars
|
CacheChainRequiredNext,
|
||||||
CacheChainWrathMaxReward,
|
CacheChainWrathMaxReward,
|
||||||
CacheChainWrathRequired, // eslint-disable-line no-unused-vars
|
CacheChainWrathRequired,
|
||||||
CacheChainWrathRequiredNext, // eslint-disable-line no-unused-vars
|
CacheChainWrathRequiredNext,
|
||||||
CacheDragonsFortuneMultAdjustment,
|
CacheDragonsFortuneMultAdjustment,
|
||||||
CacheGoldenCookiesMult,
|
CacheGoldenCookiesMult,
|
||||||
CacheNoGoldSwitchCookiesPS,
|
CacheNoGoldSwitchCookiesPS,
|
||||||
CacheWrathCookiesMult,
|
CacheWrathCookiesMult,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions calculates the max possible payout given a set of variables
|
* This functions calculates the max possible payout given a set of variables
|
||||||
@@ -89,4 +90,19 @@ export function CacheChain() {
|
|||||||
CacheChainFrenzyWrathRequired = (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
CacheChainFrenzyWrathRequired = (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||||
CacheChainFrenzyWrathRequiredNext =
|
CacheChainFrenzyWrathRequiredNext =
|
||||||
CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
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 {
|
import {
|
||||||
CacheHCPerSecond, // eslint-disable-line no-unused-vars
|
CacheHCPerSecond,
|
||||||
CacheLastHeavenlyCheck,
|
CacheLastHeavenlyCheck,
|
||||||
CacheLastHeavenlyChips,
|
CacheLastHeavenlyChips,
|
||||||
HeavenlyChipsDiff,
|
HeavenlyChipsDiff,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the heavenly chips per second in the last five seconds
|
* 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
|
// Get average gain over period of 5 seconds
|
||||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
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 {
|
import {
|
||||||
CacheMissingUpgrades, // eslint-disable-line no-unused-vars
|
CacheMissingUpgrades, // eslint-disable-line no-unused-vars
|
||||||
CacheMissingUpgradesCookies, // eslint-disable-line no-unused-vars
|
CacheMissingUpgradesCookies, // eslint-disable-line no-unused-vars
|
||||||
CacheMissingUpgradesPrestige, // 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
|
* This functions caches variables related to missing upgrades
|
||||||
@@ -35,12 +35,10 @@ export default function CacheAllMissingUpgrades() {
|
|||||||
let str = '';
|
let str = '';
|
||||||
|
|
||||||
str += crateMissing(me);
|
str += crateMissing(me);
|
||||||
/* eslint-disable no-unused-vars */
|
|
||||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||||
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug')
|
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug')
|
||||||
CacheMissingUpgrades += str;
|
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
|
* This functions caches the reward of popping a reindeer
|
||||||
@@ -13,4 +14,6 @@ export default function CacheSeasonSpec() {
|
|||||||
CacheSeaSpec = Math.max(25, val);
|
CacheSeaSpec = Math.max(25, val);
|
||||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillCMDCache({ CacheSeaSpec });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
/** Functions related to Caching stats */
|
/** Functions related to Caching stats */
|
||||||
|
|
||||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas.js';
|
||||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
import GetCPSBuffMult from '../CPS/GetCPSBuffMult.js';
|
||||||
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import {
|
import {
|
||||||
CacheConjure,
|
CacheConjure,
|
||||||
CacheConjureReward, // eslint-disable-line no-unused-vars
|
CacheConjureReward,
|
||||||
CacheDragonsFortuneMultAdjustment,
|
CacheDragonsFortuneMultAdjustment,
|
||||||
CacheEdifice,
|
CacheEdifice,
|
||||||
CacheEdificeBuilding, // eslint-disable-line no-unused-vars
|
CacheEdificeBuilding,
|
||||||
CacheGoldenCookiesMult,
|
CacheGoldenCookiesMult,
|
||||||
CacheLucky,
|
CacheLucky,
|
||||||
CacheLuckyFrenzy,
|
CacheLuckyFrenzy,
|
||||||
CacheLuckyReward, // eslint-disable-line no-unused-vars
|
CacheLuckyReward,
|
||||||
CacheLuckyRewardFrenzy, // eslint-disable-line no-unused-vars
|
CacheLuckyRewardFrenzy,
|
||||||
CacheLuckyWrathReward, // eslint-disable-line no-unused-vars
|
CacheLuckyWrathReward,
|
||||||
CacheLuckyWrathRewardFrenzy, // eslint-disable-line no-unused-vars
|
CacheLuckyWrathRewardFrenzy,
|
||||||
CacheNoGoldSwitchCookiesPS,
|
CacheNoGoldSwitchCookiesPS,
|
||||||
CacheWrathCookiesMult,
|
CacheWrathCookiesMult,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches variables related to the stats page
|
* This functions caches variables related to the stats page
|
||||||
@@ -53,6 +54,19 @@ export function CacheStatsCookies() {
|
|||||||
CacheEdificeBuilding = i;
|
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) {
|
if (Game.shimmerTypes.golden.n === 0) {
|
||||||
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillCMDCache({
|
||||||
|
CacheGoldenCookiesMult,
|
||||||
|
CacheWrathCookiesMult,
|
||||||
|
CacheDragonsFortuneMultAdjustment,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||||
import { CacheObjectsNextAchievement } from '../VariablesAndData';
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement';
|
import { CacheObjectsNextAchievement } from '../VariablesAndData.js';
|
||||||
|
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches the amount of buildings needed till next achievement
|
* This functions caches the amount of buildings needed till next achievement
|
||||||
@@ -41,5 +42,7 @@ export default function AllAmountTillNextAchievement(forceRecalc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
CacheObjectsNextAchievement = result; // eslint-disable-line no-unused-vars
|
CacheObjectsNextAchievement = result;
|
||||||
|
|
||||||
|
FillCMDCache({ CacheObjectsNextAchievement });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome.js';
|
||||||
import { SimAchievementsOwned } from '../../Sim/VariablesAndData';
|
import { SimAchievementsOwned } from '../../Sim/VariablesAndData.js';
|
||||||
|
|
||||||
export default function IndividualAmountTillNextAchievement(building) {
|
export default function IndividualAmountTillNextAchievement(building) {
|
||||||
const AchievementsAtStart = Game.AchievementsOwned;
|
const AchievementsAtStart = Game.AchievementsOwned;
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ export let CacheDoRemakeBuildPrices;
|
|||||||
|
|
||||||
export let CacheHadBuildAura;
|
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 */
|
/** Store the CPS effect of each god if it was put into each slot */
|
||||||
export let CacheGods = {
|
export let CacheGods = {
|
||||||
0: [0, 0, 0],
|
0: [0, 0, 0],
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
/** Caches data related to Wrinklers */
|
/** Caches data related to Wrinklers */
|
||||||
|
|
||||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
import { SimObjects } from '../../Sim/VariablesAndData.js';
|
||||||
|
import FillCMDCache from '../FillCMDCache.js';
|
||||||
import {
|
import {
|
||||||
CacheWrinklersFattest,
|
CacheWrinklersFattest,
|
||||||
CacheWrinklersNormal, // eslint-disable-line no-unused-vars
|
CacheWrinklersNormal,
|
||||||
CacheWrinklersTotal, // eslint-disable-line no-unused-vars
|
CacheWrinklersTotal,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches data related to Wrinklers
|
* This functions caches data related to Wrinklers
|
||||||
@@ -37,4 +38,6 @@ export default function CacheWrinklers() {
|
|||||||
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillCMDCache({ CacheWrinklersTotal, CacheWrinklersNormal, CacheWrinklersFattest });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ function CheckNotificationPermissions(ToggleOnOff) {
|
|||||||
const checkNotificationPromise = function () {
|
const checkNotificationPromise = function () {
|
||||||
try {
|
try {
|
||||||
Notification.requestPermission().then();
|
Notification.requestPermission().then();
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** Called by the "func" of individual settings */
|
/** Called by the "func" of individual settings */
|
||||||
|
|
||||||
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground';
|
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function changes the position of both the bottom and timer bar
|
* This function changes the position of both the bottom and timer bar
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { saveAndLoadingFunctions } from '@cookiemonsterteam/cookiemonsterframework/src/index';
|
import { saveAndLoadingFunctions } from '@cookiemonsterteam/cookiemonsterframework/src/index.js';
|
||||||
|
|
||||||
/** Functions related to toggling or changing an individual setting */
|
/** Functions related to toggling or changing an individual setting */
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar';
|
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar.js';
|
||||||
import { UpdateBotTimerBarPosition } from '../SpecificToggles';
|
import { UpdateBotTimerBarPosition } from '../SpecificToggles.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function toggle the bottom bar
|
* This function toggle the bottom bar
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CMSayTime } from '../../Disp/VariablesAndData';
|
import { CMSayTime } from '../../Disp/VariablesAndData.js';
|
||||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
import { BackupFunctions } from '../../Main/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function changes some of the time-displays in the game to be more detailed
|
* This function changes some of the time-displays in the game to be more detailed
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData.js';
|
||||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
import { GCTimers } from '../../Disp/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function toggles GC Timers are visible
|
* This function toggles GC Timers are visible
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function toggles the upgrade bar and the colours of upgrades
|
* This function toggles the upgrade bar and the colours of upgrades
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import init from './InitSaveLoad/init';
|
import init from './InitSaveLoad/init.js';
|
||||||
import load from './InitSaveLoad/load';
|
import load from './InitSaveLoad/load.js';
|
||||||
import save from './InitSaveLoad/save';
|
import save from './InitSaveLoad/save.js';
|
||||||
|
|
||||||
const CM = {
|
const CM = {
|
||||||
init,
|
init,
|
||||||
@@ -8,8 +8,16 @@ const CM = {
|
|||||||
save,
|
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
|
// 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
|
// Thus sounds normally play at start up as Season and Garden states are checked
|
||||||
window.cookieMonsterFrameworkData.isInitializing = false;
|
window.cookieMonsterFrameworkData.isInitializing = false;
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
Game.registerMod('CookieMonster', CM);
|
||||||
|
window.cookieMonsterFrameworkData.isInitializing = false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** Data copied directly from the game */
|
/** Data copied directly from the game */
|
||||||
|
|
||||||
/** Array of the names of all fortune cookies obtainable from the ticker */
|
/** Array of the names of all fortune cookies obtainable from the ticker */
|
||||||
export const Fortunes: string[] = [
|
export const Fortunes = [
|
||||||
'Fortune #001',
|
'Fortune #001',
|
||||||
'Fortune #002',
|
'Fortune #002',
|
||||||
'Fortune #003',
|
'Fortune #003',
|
||||||
@@ -20,6 +20,8 @@ export const Fortunes: string[] = [
|
|||||||
'Fortune #016',
|
'Fortune #016',
|
||||||
'Fortune #017',
|
'Fortune #017',
|
||||||
'Fortune #018',
|
'Fortune #018',
|
||||||
|
'Fortune #019',
|
||||||
|
'Fortune #020',
|
||||||
'Fortune #100',
|
'Fortune #100',
|
||||||
'Fortune #101',
|
'Fortune #101',
|
||||||
'Fortune #102',
|
'Fortune #102',
|
||||||
@@ -28,7 +30,7 @@ export const Fortunes: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** Array of the names of all Halloween cookies */
|
/** Array of the names of all Halloween cookies */
|
||||||
export const HalloCookies: string[] = [
|
export const HalloCookies = [
|
||||||
'Skull cookies',
|
'Skull cookies',
|
||||||
'Ghost cookies',
|
'Ghost cookies',
|
||||||
'Bat cookies',
|
'Bat cookies',
|
||||||
@@ -39,7 +41,7 @@ export const HalloCookies: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** Array of the names of all Christmas cookies */
|
/** Array of the names of all Christmas cookies */
|
||||||
export const ChristCookies: string[] = [
|
export const ChristCookies = [
|
||||||
'Christmas tree biscuits',
|
'Christmas tree biscuits',
|
||||||
'Snowflake biscuits',
|
'Snowflake biscuits',
|
||||||
'Snowman biscuits',
|
'Snowman biscuits',
|
||||||
@@ -50,7 +52,7 @@ export const ChristCookies: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** Array of the names of all Valentine cookies */
|
/** Array of the names of all Valentine cookies */
|
||||||
export const ValCookies: string[] = [
|
export const ValCookies = [
|
||||||
'Pure heart biscuits',
|
'Pure heart biscuits',
|
||||||
'Ardent heart biscuits',
|
'Ardent heart biscuits',
|
||||||
'Sour heart biscuits',
|
'Sour heart biscuits',
|
||||||
@@ -61,7 +63,7 @@ export const ValCookies: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** Array of the names of all plant drops */
|
/** Array of the names of all plant drops */
|
||||||
export const PlantDrops: string[] = [
|
export const PlantDrops = [
|
||||||
'Elderwort biscuits',
|
'Elderwort biscuits',
|
||||||
'Bakeberry cookies',
|
'Bakeberry cookies',
|
||||||
'Duketater cookies',
|
'Duketater cookies',
|
||||||
@@ -72,7 +74,7 @@ export const PlantDrops: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** All possible effects plants and other items can have with a display-title */
|
/** 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',
|
buildingCost: 'Building prices',
|
||||||
click: 'Cookies per click',
|
click: 'Cookies per click',
|
||||||
cps: 'Total CPS',
|
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,25 +0,0 @@
|
|||||||
/** Data related directly to Cookie Monster */
|
|
||||||
|
|
||||||
export const VersionMajor = '2.031';
|
|
||||||
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 implements the following functions:</br>
|
|
||||||
- This updates adds a number of performance improvements which make CookieMonster about 33% more efficient</br>
|
|
||||||
- Added a button to all buildings in the middle section that can "lock" the building. This makes the building unclickable, which might be useful for frantic clicking during cookie storms</br>
|
|
||||||
- Added a percentage to the Golden Cookie timer bar</br>
|
|
||||||
</br>
|
|
||||||
This update fixes the following bugs:
|
|
||||||
- Fix considerable lag on the Ascension screen when using the monospace font</br>
|
|
||||||
- Fix sound playing at start-up</br>
|
|
||||||
- Fix building tooltips and warnings not updating correctly</br>
|
|
||||||
- Fix upgrade bar not displaying</br>
|
|
||||||
- Fix loading of mod when no save was found</br>`;
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
/** Data related directly to the scales used by Cookie Monster */
|
/** Data related directly to the scales used by Cookie Monster */
|
||||||
|
|
||||||
/** Array of abbreviations used in the "Metric" scale */
|
/** 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 */
|
/** Array of abbreviations used in the "Short" scale */
|
||||||
export const shortScale: string[] = [
|
export const shortScale = [
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'M',
|
'M',
|
||||||
@@ -34,7 +34,7 @@ export const shortScale: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
||||||
export const shortScaleAbbreviated: string[] = [
|
export const shortScaleAbbreviated = [
|
||||||
'',
|
'',
|
||||||
'K',
|
'K',
|
||||||
'M',
|
'M',
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/** Data related to the display titles of certain sections in menu screens */
|
/** Data related to the display titles of certain sections in menu screens */
|
||||||
|
|
||||||
/** Display titles of the headers of the Cookie Monster settings section */
|
/** Display titles of the headers of the Cookie Monster settings section */
|
||||||
export const ConfigGroups: { [index: string]: string } = {
|
export const ConfigGroups = {
|
||||||
Favourite: 'Favourite Settings',
|
Favourite: 'Favourite Settings',
|
||||||
Calculation: 'Calculation',
|
Calculation: 'Calculation',
|
||||||
Notation: 'Notation',
|
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 */
|
/** 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',
|
NotificationGeneral: 'General Notifications',
|
||||||
NotificationGC: 'Golden Cookie',
|
NotificationGC: 'Golden Cookie',
|
||||||
NotificationFC: 'Fortune Cookie',
|
NotificationFC: 'Fortune Cookie',
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { settingClasses } from '@cookiemonsterteam/cookiemonsterframework/src/index';
|
import { settingClasses } from '@cookiemonsterteam/cookiemonsterframework/src/index.js';
|
||||||
|
|
||||||
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
|
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions.js';
|
||||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
import RefreshScale from '../Disp/HelperFunctions/RefreshScale.js';
|
||||||
import { SimDoSims } from '../Sim/VariablesAndData'; // eslint-disable-line no-unused-vars
|
import { SimDoSims } from '../Sim/VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
|
import ToggleBotBar from '../Config/Toggles/ToggleBotBar.js';
|
||||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime';
|
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime.js';
|
||||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer';
|
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer.js';
|
||||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons';
|
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons.js';
|
||||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
|
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos.js';
|
||||||
import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour';
|
import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour.js';
|
||||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
|
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos.js';
|
||||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons.js';
|
||||||
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
|
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings.js';
|
||||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon.js';
|
||||||
import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight';
|
import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js';
|
||||||
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades.js';
|
||||||
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
|
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles.js';
|
||||||
|
|
||||||
/** This includes all options of CookieMonster and their relevant data */
|
/** This includes all options of CookieMonster and their relevant data */
|
||||||
const settings = {
|
const settings = {
|
||||||
@@ -129,7 +129,7 @@ const settings = {
|
|||||||
0,
|
0,
|
||||||
'bool',
|
'bool',
|
||||||
'Notation',
|
'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',
|
'Change the time format',
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
@@ -549,6 +549,14 @@ const settings = {
|
|||||||
'Shows a tooltip for plants that have a cookie reward.',
|
'Shows a tooltip for plants that have a cookie reward.',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
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(
|
TooltipPantheon: new settingClasses.SettingStandard(
|
||||||
1,
|
1,
|
||||||
'bool',
|
'bool',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** General functions to format or beautify strings */
|
/** General functions to format or beautify strings */
|
||||||
|
|
||||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
|
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.js';
|
||||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
import { BackupFunctions } from '../../Main/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns formats number based on the Scale setting
|
* This function returns formats number based on the Scale setting
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* @returns {string} Formatted time
|
* @returns {string} Formatted time
|
||||||
*/
|
*/
|
||||||
export default function FormatTime(time, longFormat) {
|
export default function FormatTime(time, longFormat) {
|
||||||
|
/* eslint-disable no-nested-ternary */
|
||||||
let formattedTime = time;
|
let formattedTime = time;
|
||||||
if (time === Infinity) return time;
|
if (time === Infinity) return time;
|
||||||
if (time < 0) return 'Negative time period';
|
if (time < 0) return 'Negative time period';
|
||||||
@@ -15,7 +16,18 @@ export default function FormatTime(time, longFormat) {
|
|||||||
const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60);
|
const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60);
|
||||||
const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
|
const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
|
||||||
let str = '';
|
let str = '';
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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';
|
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||||
@@ -23,18 +35,23 @@ export default function FormatTime(time, longFormat) {
|
|||||||
str += `${(m < 10 ? '0' : '') + m}:`;
|
str += `${(m < 10 ? '0' : '') + m}:`;
|
||||||
str += (s < 10 ? '0' : '') + s;
|
str += (s < 10 ? '0' : '') + s;
|
||||||
} else {
|
} else {
|
||||||
|
// Similar to TimeFormat === 0, but only two most significant components are included.
|
||||||
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||||
str +=
|
if (y > 0) {
|
||||||
y > 0
|
str += `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `;
|
||||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary
|
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}`;
|
||||||
: '';
|
} else if (d > 0) {
|
||||||
if (str.length > 0 || d > 0)
|
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `;
|
||||||
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `; // eslint-disable-line no-nested-ternary
|
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}`;
|
||||||
if (str.length > 0 || h > 0)
|
} else if (h > 0) {
|
||||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; // eslint-disable-line no-nested-ternary
|
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||||
if (str.length > 0 || m > 0)
|
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}`;
|
||||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; // eslint-disable-line no-nested-ternary
|
} else if (m > 0) {
|
||||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); // eslint-disable-line no-nested-ternary
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
|
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData.js';
|
||||||
import FormatTime from './FormatTime';
|
import FormatTime from './FormatTime.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the colour to be used for time-strings
|
* This function returns the colour to be used for time-strings
|
||||||
@@ -10,7 +10,7 @@ export default function GetTimeColour(time) {
|
|||||||
let colour;
|
let colour;
|
||||||
let text;
|
let text;
|
||||||
if (time <= 0) {
|
if (time <= 0) {
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 1)
|
||||||
text = '00:00:00:00:00';
|
text = '00:00:00:00:00';
|
||||||
else text = 'Done!';
|
else text = 'Done!';
|
||||||
colour = ColourGreen;
|
colour = ColourGreen;
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import {
|
|||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
CacheObjectsNextAchievement,
|
CacheObjectsNextAchievement,
|
||||||
} from '../../Cache/VariablesAndData';
|
} from '../../Cache/VariablesAndData.js';
|
||||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding.js';
|
||||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||||
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ColourRed,
|
ColourRed,
|
||||||
ColourTextPre,
|
ColourTextPre,
|
||||||
ColourYellow,
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the legend for the upgrade bar
|
* This function creates the legend for the upgrade bar
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
import { CacheUpgrades } from '../../Cache/VariablesAndData.js';
|
||||||
import {
|
import {
|
||||||
ColourBackPre,
|
ColourBackPre,
|
||||||
ColourBlue,
|
ColourBlue,
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ColourRed,
|
ColourRed,
|
||||||
ColoursOrdering,
|
ColoursOrdering,
|
||||||
ColourYellow,
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adjusts some things in the upgrades section
|
* This function adjusts some things in the upgrades section
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
/** Functions related to the Dragon */
|
/** Functions related to the Dragon */
|
||||||
|
|
||||||
import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
import CacheDragonCost from '../../Cache/Dragon/Dragon.js';
|
||||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData.js';
|
||||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange.js';
|
||||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||||
import FormatTime from '../BeautifyAndFormatting/FormatTime';
|
import FormatTime from '../BeautifyAndFormatting/FormatTime.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||||
@@ -18,7 +18,7 @@ export function AddAuraInfo(aura) {
|
|||||||
if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity);
|
if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity);
|
||||||
else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
|
else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
|
||||||
|
|
||||||
l('dragonAuraInfo').style.minHeight = '60px';
|
l('dragonAuraInfo').style.minHeight = '120px';
|
||||||
l('dragonAuraInfo').style.margin = '8px';
|
l('dragonAuraInfo').style.margin = '8px';
|
||||||
l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
|
l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons.js';
|
||||||
import Beautify from './BeautifyAndFormatting/Beautify';
|
import UpdateBuildings from './BuildingsUpgrades/Buildings.js';
|
||||||
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight.js';
|
||||||
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight';
|
import UpdateUpgrades from './BuildingsUpgrades/Upgrades.js';
|
||||||
import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
|
import { UpdateBotBar } from './InfoBars/BottomBar.js';
|
||||||
import { UpdateBotBar } from './InfoBars/BottomBar';
|
import { UpdateTimerBar } from './InfoBars/TimerBar.js';
|
||||||
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
import RefreshMenu from './MenuSections/Refreshmenu.js';
|
||||||
import RefreshMenu from './MenuSections/Refreshmenu';
|
import UpdateTooltips from './Tooltips/UpdateTooltips.js';
|
||||||
import UpdateTooltips from './Tooltips/UpdateTooltips';
|
import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/WrinklerTooltips.js';
|
||||||
import { CheckWrinklerTooltip, UpdateWrinklerTooltip } from './Tooltips/WrinklerTooltips';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function handles all custom drawing for the Game.Draw() function.
|
* This function handles all custom drawing for the Game.Draw() function.
|
||||||
@@ -50,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
|
// Update display of wrinkler buttons, this checks if Elder Pledge has been bought and if they should be disabled
|
||||||
ToggleWrinklerButtons();
|
ToggleWrinklerButtons();
|
||||||
|
|
||||||
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
|
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale && !Game.OnAscend) {
|
|
||||||
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,6 +1,6 @@
|
|||||||
/** Section: Functions related to the Golden Cookie Timers */
|
/** Section: Functions related to the Golden Cookie Timers */
|
||||||
|
|
||||||
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
|
* This function creates a new Golden Cookie Timer and appends it CM.Disp.GCTimers based on the id of the cookie
|
||||||
|
|||||||
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,7 +3,7 @@ import {
|
|||||||
CacheCurrWrinklerCount,
|
CacheCurrWrinklerCount,
|
||||||
CacheCurrWrinklerCPSMult,
|
CacheCurrWrinklerCPSMult,
|
||||||
CacheWrinklersFattest,
|
CacheWrinklersFattest,
|
||||||
} from '../../Cache/VariablesAndData';
|
} from '../../Cache/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
|
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
ColourPurple,
|
ColourPurple,
|
||||||
ColourRed,
|
ColourRed,
|
||||||
ColourYellow,
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
|
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the total amount stored in the Wrinkler Bank
|
* This function returns the total amount stored in the Wrinkler Bank
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
import UpdateBuildings from '../BuildingsUpgrades/Buildings.js';
|
||||||
import UpdateUpgrades from '../BuildingsUpgrades/Upgrades';
|
import UpdateUpgrades from '../BuildingsUpgrades/Upgrades.js';
|
||||||
import { UpdateBotBar } from '../InfoBars/BottomBar';
|
import { UpdateBotBar } from '../InfoBars/BottomBar.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function refreshes all numbers after a change in scale-setting
|
* This function refreshes all numbers after a change in scale-setting
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ToggleTimerBar } from '../../Config/SpecificToggles';
|
import { ToggleTimerBar } from '../../Config/SpecificToggles.js';
|
||||||
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar';
|
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar.js';
|
||||||
|
|
||||||
import UpdateBackground from './UpdateBackground';
|
import UpdateBackground from './UpdateBackground.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function disables and shows the bars created by CookieMonster when the game is "ascending"
|
* This function disables and shows the bars created by CookieMonster when the game is "ascending"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
import UpdateBuildings from '../BuildingsUpgrades/Buildings.js';
|
||||||
import {
|
import {
|
||||||
ColourBackPre,
|
ColourBackPre,
|
||||||
ColourBorderPre,
|
ColourBorderPre,
|
||||||
ColoursOrdering,
|
ColoursOrdering,
|
||||||
ColourTextPre,
|
ColourTextPre,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function changes/refreshes colours if the user has set new standard colours
|
* This function changes/refreshes colours if the user has set new standard colours
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
/** Functions related to the Bottom Bar */
|
/** Functions related to the Bottom Bar */
|
||||||
|
|
||||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData.js';
|
||||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
|
import { VersionMajor, VersionMinor } from '../../Data/Moddata.js';
|
||||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||||
import FormatTime from '../BeautifyAndFormatting/FormatTime';
|
import FormatTime from '../BeautifyAndFormatting/FormatTime.js';
|
||||||
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
|
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour.js';
|
||||||
|
|
||||||
import GetCPS from '../HelperFunctions/GetCPS';
|
import GetCPS from '../HelperFunctions/GetCPS.js';
|
||||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank.js';
|
||||||
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData';
|
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData.js';
|
||||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
import { CreateBotBarBuildingColumn } from './CreateDOMElements.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the bottom bar and appends it to l('wrapper')
|
* This function creates the bottom bar and appends it to l('wrapper')
|
||||||
@@ -98,9 +98,8 @@ export function UpdateBotBar() {
|
|||||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
|
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
|
||||||
ColourTextPre + timeColour.colour;
|
ColourTextPre + timeColour.colour;
|
||||||
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
||||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
|
||||||
count
|
`${timeColour.text} (with Wrink)`;
|
||||||
].textContent = `${timeColour.text} (with Wrink)`;
|
|
||||||
} else
|
} else
|
||||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
|
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
|
||||||
timeColour.text;
|
timeColour.text;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** Functions to create various DOM elements used by the Bars */
|
/** 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
|
* This function creates an indivudual timer for the timer bar
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** Functions related to the Timer Bar */
|
/** Functions related to the Timer Bar */
|
||||||
|
|
||||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles.js';
|
||||||
import {
|
import {
|
||||||
BuffColours,
|
BuffColours,
|
||||||
ColourBackPre,
|
ColourBackPre,
|
||||||
@@ -8,8 +8,9 @@ import {
|
|||||||
ColourOrange,
|
ColourOrange,
|
||||||
ColourPurple,
|
ColourPurple,
|
||||||
LastNumberOfTimers,
|
LastNumberOfTimers,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
import { CreateTimer } from './CreateDOMElements';
|
import { CreateTimer } from './CreateDOMElements.js';
|
||||||
|
import { updateChanceTotal, updateChanceTotalDeer } from '../../Main/CheckStates/Probability.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the TimerBar and appends it to l('wrapper')
|
* This function creates the TimerBar and appends it to l('wrapper')
|
||||||
@@ -124,11 +125,18 @@ export function UpdateTimerBar() {
|
|||||||
(Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) /
|
(Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) /
|
||||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime),
|
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime),
|
||||||
) ** 5;
|
) ** 5;
|
||||||
|
const finalChance = updateChanceTotal(chanceToSpawn);
|
||||||
l('CMTimerBarGCTime').textContent = `${Math.ceil(
|
l('CMTimerBarGCTime').textContent = `${Math.ceil(
|
||||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
|
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
|
||||||
)} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', {
|
)} `;
|
||||||
style: 'percent',
|
if (finalChance < 0.01) {
|
||||||
})}`;
|
l('CMTimerBarGCTime').textContent +=
|
||||||
|
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
|
||||||
|
} else {
|
||||||
|
l('CMTimerBarGCTime').textContent += finalChance.toLocaleString('en', {
|
||||||
|
style: 'percent',
|
||||||
|
});
|
||||||
|
}
|
||||||
numberOfTimers += 1;
|
numberOfTimers += 1;
|
||||||
} else l('CMTimerBarGC').style.display = 'none';
|
} else l('CMTimerBarGC').style.display = 'none';
|
||||||
|
|
||||||
@@ -167,11 +175,18 @@ export function UpdateTimerBar() {
|
|||||||
(Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) /
|
(Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) /
|
||||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime),
|
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime),
|
||||||
) ** 5;
|
) ** 5;
|
||||||
|
const deerFinalChance = updateChanceTotalDeer(chanceToSpawn);
|
||||||
l('CMTimerBarRenTime').textContent = `${Math.ceil(
|
l('CMTimerBarRenTime').textContent = `${Math.ceil(
|
||||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
||||||
)} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', {
|
)} `;
|
||||||
style: 'percent',
|
if (deerFinalChance < 0.01) {
|
||||||
})}`;
|
l('CMTimerBarRenTime').textContent +=
|
||||||
|
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
|
||||||
|
} else {
|
||||||
|
l('CMTimerBarRenTime').textContent += deerFinalChance.toLocaleString('en', {
|
||||||
|
style: 'percent',
|
||||||
|
});
|
||||||
|
}
|
||||||
numberOfTimers += 1;
|
numberOfTimers += 1;
|
||||||
} else {
|
} else {
|
||||||
l('CMTimerBarRen').style.display = 'none';
|
l('CMTimerBarRen').style.display = 'none';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData.js';
|
||||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers.js';
|
||||||
import { CreateTooltip } from '../Tooltips/Tooltip';
|
import { CreateTooltip } from '../Tooltips/Tooltip.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DispCSS } from '../VariablesAndData';
|
import { DispCSS } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a CSS style that stores certain standard CSS classes used by CookieMonster
|
* This function creates a CSS style that stores certain standard CSS classes used by CookieMonster
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import AddMenuStats from './Statistics/AddStatsPage';
|
import createMenuOptions from './createMenuOptions.js';
|
||||||
|
import AddMenuStats from './Statistics/AddStatsPage.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds the calll the functions to add extra info to the stats and options pages
|
* This function adds the calll the functions to add extra info to the stats and options pages
|
||||||
@@ -12,5 +13,11 @@ export default function AddMenu() {
|
|||||||
title.textContent = 'Cookie Monster Statistics';
|
title.textContent = 'Cookie Monster Statistics';
|
||||||
AddMenuStats(title);
|
AddMenuStats(title);
|
||||||
}
|
}
|
||||||
|
} else if (Game.onMenu === 'prefs') {
|
||||||
|
// Added because Framework is broken
|
||||||
|
l('menu').childNodes[2].insertBefore(
|
||||||
|
createMenuOptions(),
|
||||||
|
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/** Main function to create the sections of Cookie Monster on the Statistics page */
|
/** Main function to create the sections of Cookie Monster on the Statistics page */
|
||||||
|
|
||||||
import { AddMissingUpgrades } from './CreateMissingUpgrades';
|
import { AddMissingUpgrades } from './CreateMissingUpgrades.js';
|
||||||
import * as CreateSections from './CreateStatsSections';
|
import * as CreateSections from './CreateStatsSections.js';
|
||||||
import * as CreateElements from './CreateDOMElements';
|
import * as CreateElements from './CreateDOMElements.js';
|
||||||
import * as GameData from '../../../Data/Gamedata.ts';
|
import * as GameData from '../../../Data/Gamedata.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CacheAverageClicks,
|
CacheAverageClicks,
|
||||||
@@ -12,12 +12,12 @@ import {
|
|||||||
CacheWrinklersFattest,
|
CacheWrinklersFattest,
|
||||||
CacheWrinklersNormal,
|
CacheWrinklersNormal,
|
||||||
CacheWrinklersTotal,
|
CacheWrinklersTotal,
|
||||||
} from '../../../Cache/VariablesAndData';
|
} from '../../../Cache/VariablesAndData.js';
|
||||||
import PopAllNormalWrinklers from '../../HelperFunctions/PopWrinklers';
|
import PopAllNormalWrinklers from '../../HelperFunctions/PopWrinklers.js';
|
||||||
import { ClickTimes, CookieTimes } from '../../VariablesAndData';
|
import { ClickTimes, CookieTimes } from '../../VariablesAndData.js';
|
||||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
import GetCPS from '../../HelperFunctions/GetCPS.js';
|
||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
import Beautify from '../../BeautifyAndFormatting/Beautify.js';
|
||||||
import AddMissingAchievements from './CreateMissingAchievements';
|
import AddMissingAchievements from './CreateMissingAchievements.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds stats created by CookieMonster to the stats page
|
* This function adds stats created by CookieMonster to the stats page
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/** Section: Functions related to the creation of basic DOM elements page */
|
/** Section: Functions related to the creation of basic DOM elements page */
|
||||||
|
|
||||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
import { ToggleHeader } from '../../../Config/ToggleSetting.js';
|
||||||
|
|
||||||
import { SimpleTooltipElements } from '../../VariablesAndData';
|
import { SimpleTooltipElements } from '../../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a header-object for the stats page
|
* This function creates a header-object for the stats page
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
CacheMissingUpgrades,
|
CacheMissingUpgrades,
|
||||||
CacheMissingUpgradesCookies,
|
CacheMissingUpgradesCookies,
|
||||||
CacheMissingUpgradesPrestige,
|
CacheMissingUpgradesPrestige,
|
||||||
} from '../../../Cache/VariablesAndData';
|
} from '../../../Cache/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
||||||
@@ -13,8 +13,7 @@ export function AddMissingUpgrades() {
|
|||||||
l('menu').childNodes.forEach((menuSection) => {
|
l('menu').childNodes.forEach((menuSection) => {
|
||||||
if (menuSection.children[0]) {
|
if (menuSection.children[0]) {
|
||||||
if (menuSection.children[0].innerHTML === 'Prestige' && CacheMissingUpgradesPrestige) {
|
if (menuSection.children[0].innerHTML === 'Prestige' && CacheMissingUpgradesPrestige) {
|
||||||
const prestigeUpgradesMissing =
|
const prestigeUpgradesMissing = CacheMissingUpgradesPrestige.match(/div/g || []).length / 2;
|
||||||
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || []).length / 2;
|
|
||||||
const title = document.createElement('div');
|
const title = document.createElement('div');
|
||||||
title.id = 'CMMissingUpgradesPrestigeTitle';
|
title.id = 'CMMissingUpgradesPrestigeTitle';
|
||||||
title.className = 'listing';
|
title.className = 'listing';
|
||||||
@@ -30,8 +29,7 @@ export function AddMissingUpgrades() {
|
|||||||
menuSection.appendChild(upgrades);
|
menuSection.appendChild(upgrades);
|
||||||
} else if (menuSection.children[0].innerHTML === 'Upgrades') {
|
} else if (menuSection.children[0].innerHTML === 'Upgrades') {
|
||||||
if (CacheMissingUpgrades) {
|
if (CacheMissingUpgrades) {
|
||||||
const normalUpgradesMissing =
|
const normalUpgradesMissing = CacheMissingUpgrades.match(/div/g || []).length / 2;
|
||||||
CacheMissingUpgrades.match(new RegExp('div', 'g') || []).length / 2;
|
|
||||||
const title = document.createElement('div');
|
const title = document.createElement('div');
|
||||||
title.id = 'CMMissingUpgradesTitle';
|
title.id = 'CMMissingUpgradesTitle';
|
||||||
title.className = 'listing';
|
title.className = 'listing';
|
||||||
@@ -54,8 +52,7 @@ export function AddMissingUpgrades() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (CacheMissingUpgradesCookies) {
|
if (CacheMissingUpgradesCookies) {
|
||||||
const cookieUpgradesMissing =
|
const cookieUpgradesMissing = CacheMissingUpgradesCookies.match(/div/g || []).length / 2;
|
||||||
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || []).length / 2;
|
|
||||||
const title = document.createElement('div');
|
const title = document.createElement('div');
|
||||||
title.id = 'CMMissingUpgradesCookiesTitle';
|
title.id = 'CMMissingUpgradesCookiesTitle';
|
||||||
title.className = 'listing';
|
title.className = 'listing';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** Functions to create the individual sections of the Statistics page */
|
/** Functions to create the individual sections of the Statistics page */
|
||||||
|
|
||||||
import * as GameData from '../../../Data/Gamedata.ts';
|
import * as GameData from '../../../Data/Gamedata.js';
|
||||||
import { MaxChainCookieReward } from '../../../Cache/Stats/ChainCookies';
|
import { MaxChainCookieReward } from '../../../Cache/Stats/ChainCookies.js';
|
||||||
import {
|
import {
|
||||||
CacheAvgCPSWithChoEgg,
|
CacheAvgCPSWithChoEgg,
|
||||||
CacheCentEgg,
|
CacheCentEgg,
|
||||||
@@ -35,19 +35,20 @@ import {
|
|||||||
CacheSeaSpec,
|
CacheSeaSpec,
|
||||||
CacheWrathCookiesMult,
|
CacheWrathCookiesMult,
|
||||||
CacheWrinklersTotal,
|
CacheWrinklersTotal,
|
||||||
} from '../../../Cache/VariablesAndData';
|
} from '../../../Cache/VariablesAndData.js';
|
||||||
import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension';
|
import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension.js';
|
||||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
import CalculateLuckyLevels from '../../HelperFunctions/CalculateLuckyLevels.js';
|
||||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
import GetCPS from '../../HelperFunctions/GetCPS.js';
|
||||||
import { ColourGreen, ColourRed, ColourTextPre } from '../../VariablesAndData';
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank.js';
|
||||||
|
import { ColourGreen, ColourRed, ColourTextPre } from '../../VariablesAndData.js';
|
||||||
import {
|
import {
|
||||||
StatsListing,
|
StatsListing,
|
||||||
StatsHeader,
|
StatsHeader,
|
||||||
StatsMissDisp,
|
StatsMissDisp,
|
||||||
StatsMissDispListing,
|
StatsMissDispListing,
|
||||||
} from './CreateDOMElements';
|
} from './CreateDOMElements.js';
|
||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
import Beautify from '../../BeautifyAndFormatting/Beautify.js';
|
||||||
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
|
import FormatTime from '../../BeautifyAndFormatting/FormatTime.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the "Lucky" section of the stats page
|
* This function creates the "Lucky" section of the stats page
|
||||||
@@ -436,6 +437,33 @@ export function SpellsSection() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { minigame } = Game.Objects['Wizard tower'];
|
||||||
|
const spellsCast = minigame.spellsCastTotal;
|
||||||
|
const spellsNeeded = (function (val) {
|
||||||
|
switch (true) {
|
||||||
|
case val < 9:
|
||||||
|
return 9 - val;
|
||||||
|
case val < 99:
|
||||||
|
return 99 - val;
|
||||||
|
case val < 999:
|
||||||
|
return 999 - val;
|
||||||
|
default:
|
||||||
|
return 'NA';
|
||||||
|
}
|
||||||
|
})(spellsCast);
|
||||||
|
section.appendChild(
|
||||||
|
StatsListing(
|
||||||
|
'basic',
|
||||||
|
'Spells cast',
|
||||||
|
spellsCast < 999
|
||||||
|
? document.createTextNode(
|
||||||
|
`Next achievement in ${spellsNeeded}, current total: ${Beautify(spellsCast)}`,
|
||||||
|
)
|
||||||
|
: document.createTextNode(`No new achievement, current total: ${Beautify(spellsCast)}`),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,46 +634,47 @@ export function PrestigeSection() {
|
|||||||
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
||||||
const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||||
const willGet = willHave - currentPrestige;
|
const willGet = willHave - currentPrestige;
|
||||||
|
const { luckyDigit, luckyNumber, luckyPayout } = CalculateLuckyLevels(willHave);
|
||||||
if (!Game.Has('Lucky digit')) {
|
if (!Game.Has('Lucky digit')) {
|
||||||
let delta7 = 7 - (willHave % 10);
|
const luckyDigitDelta = luckyDigit - willHave;
|
||||||
if (delta7 < 0) delta7 += 10;
|
const luckyDigitReset = willGet + luckyDigitDelta;
|
||||||
const next7Reset = willGet + delta7;
|
const fragLuckyDigit = document.createDocumentFragment();
|
||||||
const next7Total = willHave + delta7;
|
fragLuckyDigit.appendChild(
|
||||||
const frag7 = document.createDocumentFragment();
|
|
||||||
frag7.appendChild(
|
|
||||||
document.createTextNode(
|
document.createTextNode(
|
||||||
`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`,
|
`${luckyDigit.toLocaleString()} / ${luckyDigitReset.toLocaleString()} (+${luckyDigitDelta})`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
section.appendChild(StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7));
|
section.appendChild(
|
||||||
|
StatsListing('basic', 'Next "Lucky Digit" (total / reset)', fragLuckyDigit),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Game.Has('Lucky number')) {
|
if (!Game.Has('Lucky number')) {
|
||||||
let delta777 = 777 - (willHave % 1000);
|
const luckyNumberDelta = luckyNumber - willHave;
|
||||||
if (delta777 < 0) delta777 += 1000;
|
const luckyNumberReset = willGet + luckyNumberDelta;
|
||||||
const next777Reset = willGet + delta777;
|
const fragLuckyNumber = document.createDocumentFragment();
|
||||||
const next777Total = willHave + delta777;
|
fragLuckyNumber.appendChild(
|
||||||
const frag777 = document.createDocumentFragment();
|
|
||||||
frag777.appendChild(
|
|
||||||
document.createTextNode(
|
document.createTextNode(
|
||||||
`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`,
|
`${luckyNumber.toLocaleString()} / ${luckyNumberReset.toLocaleString()} (+${luckyNumberDelta})`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
section.appendChild(StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777));
|
section.appendChild(
|
||||||
|
StatsListing('basic', 'Next "Lucky Number" (total / reset)', fragLuckyNumber),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Game.Has('Lucky payout')) {
|
if (!Game.Has('Lucky payout')) {
|
||||||
let delta777777 = 777777 - (willHave % 1000000);
|
const luckyPayoutDelta = luckyPayout - willHave;
|
||||||
if (delta777777 < 0) delta777777 += 1000000;
|
const luckyPayoutReset = willGet + luckyPayoutDelta;
|
||||||
const next777777Reset = willGet + delta777777;
|
const fragLuckyPayout = document.createDocumentFragment();
|
||||||
const next777777Total = willHave + delta777777;
|
fragLuckyPayout.appendChild(
|
||||||
const frag777777 = document.createDocumentFragment();
|
|
||||||
frag777777.appendChild(
|
|
||||||
document.createTextNode(
|
document.createTextNode(
|
||||||
`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`,
|
`${luckyPayout.toLocaleString()} / ${luckyPayoutReset.toLocaleString()} (+${luckyPayoutDelta})`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
section.appendChild(StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777));
|
section.appendChild(
|
||||||
|
StatsListing('basic', 'Next "Lucky Payout" (total / reset)', fragLuckyPayout),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { menuFunctions } from '@cookiemonsterteam/cookiemonsterframework';
|
import { menuFunctions } from '@cookiemonsterteam/cookiemonsterframework';
|
||||||
import { LatestReleaseNotes, ModDescription } from '../../Data/Moddata.ts';
|
import { LatestReleaseNotes, ModDescription } from '../../Data/Moddata.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the <div> to be added to the Info section
|
* Creates the <div> to be added to the Info section
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { menuFunctions as mF } from '@cookiemonsterteam/cookiemonsterframework';
|
import { menuFunctions as mF } from '@cookiemonsterteam/cookiemonsterframework';
|
||||||
import { ConfigGroups, ConfigGroupsNotification } from '../../Data/Sectionheaders.ts';
|
import { ConfigGroups, ConfigGroupsNotification } from '../../Data/Sectionheaders.js';
|
||||||
import settings from '../../Data/settings';
|
import settings from '../../Data/settings.js';
|
||||||
import UpdateColours from '../HelperFunctions/UpdateColours';
|
import UpdateColours from '../HelperFunctions/UpdateColours.js';
|
||||||
import RefreshScale from '../HelperFunctions/RefreshScale';
|
import RefreshScale from '../HelperFunctions/RefreshScale.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the <div> to be added to the Options section
|
* Creates the <div> to be added to the Options section
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
|
import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData.js';
|
||||||
import { LastGoldenCookieState } from '../../Main/VariablesAndData';
|
import { LastGoldenCookieState } from '../../Main/VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates the Favicon, it is called by CM.Main.DelayInit()
|
* This function creates the Favicon, it is called by CM.Main.DelayInit()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/** Functions related to updating the tab in the browser's tab-bar */
|
/** Functions related to updating the tab in the browser's tab-bar */
|
||||||
|
|
||||||
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
|
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData.js';
|
||||||
|
|
||||||
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData';
|
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData.js';
|
||||||
import { Title } from '../VariablesAndData';
|
import { Title } from '../VariablesAndData.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function updates the tab title
|
* This function updates the tab title
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import {
|
|||||||
CacheHCPerSecond,
|
CacheHCPerSecond,
|
||||||
CacheLastHeavenlyChips,
|
CacheLastHeavenlyChips,
|
||||||
CacheTimeTillNextPrestige,
|
CacheTimeTillNextPrestige,
|
||||||
} from '../../Cache/VariablesAndData';
|
} from '../../Cache/VariablesAndData.js';
|
||||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a header object for tooltips.
|
* This function creates a header object for tooltips.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
ColourYellow,
|
ColourYellow,
|
||||||
ColourPurple,
|
ColourPurple,
|
||||||
TooltipType,
|
TooltipType,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData.js';
|
||||||
|
|
||||||
/** Creates various sections of tooltips */
|
/** Creates various sections of tooltips */
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import UpdateTooltips from './UpdateTooltips';
|
import UpdateTooltips from './UpdateTooltips.js';
|
||||||
import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData.js'; // eslint-disable-line no-unused-vars
|
||||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding.js';
|
||||||
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
|
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour.js';
|
||||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
import Beautify from '../BeautifyAndFormatting/Beautify.js';
|
||||||
|
|
||||||
/** All general functions related to creating and updating tooltips */
|
/** All general functions related to creating and updating tooltips */
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@ export function CreateTooltip(type, name) {
|
|||||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])();
|
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])();
|
||||||
// Harvest all button in garden
|
// Harvest all button in garden
|
||||||
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
|
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
|
||||||
|
// Stock market
|
||||||
|
else if (type === 'sm') l('tooltip').innerHTML = Game.Objects.Bank.minigame.goodTooltip(name)();
|
||||||
else if (type === 'wb') l('tooltip').innerHTML = '';
|
else if (type === 'wb') l('tooltip').innerHTML = '';
|
||||||
else if (type === 'pag') l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
|
else if (type === 'pag') l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
|
||||||
else if (type === 'pas')
|
else if (type === 'pas')
|
||||||
@@ -111,6 +113,7 @@ export function CreateTooltip(type, name) {
|
|||||||
type === 'g' ||
|
type === 'g' ||
|
||||||
(type === 'p' && !Game.keys[16]) ||
|
(type === 'p' && !Game.keys[16]) ||
|
||||||
type === 'ha' ||
|
type === 'ha' ||
|
||||||
|
type === 'sm' ||
|
||||||
type === 'wb' ||
|
type === 'wb' ||
|
||||||
type === 'pag' ||
|
type === 'pag' ||
|
||||||
(type === 'pas' && name[1] !== -1)
|
(type === 'pas' && name[1] !== -1)
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import ColourOfPP from '../../../Cache/PP/ColourOfPP';
|
import ColourOfPP from '../../../Cache/PP/ColourOfPP.js';
|
||||||
import {
|
import {
|
||||||
CacheObjects1,
|
CacheObjects1,
|
||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
CacheObjectsNextAchievement,
|
CacheObjectsNextAchievement,
|
||||||
} from '../../../Cache/VariablesAndData';
|
} from '../../../Cache/VariablesAndData.js';
|
||||||
|
|
||||||
import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome.js';
|
||||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
import { SimObjects } from '../../../Sim/VariablesAndData.js';
|
||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
import Beautify from '../../BeautifyAndFormatting/Beautify.js';
|
||||||
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
|
import FormatTime from '../../BeautifyAndFormatting/FormatTime.js';
|
||||||
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour.js';
|
||||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
import GetCPS from '../../HelperFunctions/GetCPS.js';
|
||||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank.js';
|
||||||
import {
|
import {
|
||||||
ColourTextPre,
|
ColourTextPre,
|
||||||
LastTargetTooltipBuilding,
|
LastTargetTooltipBuilding,
|
||||||
TooltipBonusIncome,
|
TooltipBonusIncome,
|
||||||
TooltipName,
|
TooltipName,
|
||||||
TooltipPrice,
|
TooltipPrice,
|
||||||
} from '../../VariablesAndData';
|
} from '../../VariablesAndData.js';
|
||||||
import * as Create from '../CreateTooltip';
|
import * as Create from '../CreateTooltip.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds extra info to the Building tooltips
|
* This function adds extra info to the Building tooltips
|
||||||
|
|||||||
@@ -1,42 +1,154 @@
|
|||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
/* eslint-disable guard-for-in */
|
||||||
import { TooltipName } from '../../VariablesAndData';
|
/* eslint-disable no-restricted-syntax */
|
||||||
import * as Create from '../CreateTooltip';
|
|
||||||
|
import Beautify from '../../BeautifyAndFormatting/Beautify.js';
|
||||||
|
import { TooltipName } from '../../VariablesAndData.js';
|
||||||
|
import * as Create from '../CreateTooltip.js';
|
||||||
|
import {
|
||||||
|
CacheFarmLevel,
|
||||||
|
CacheGardenSoil,
|
||||||
|
CachePlotChances,
|
||||||
|
CacheSupremeIntellect,
|
||||||
|
} from '../../../Cache/VariablesAndData.js';
|
||||||
|
import CalculateAllPlotChances from '../../HelperFunctions/CalculateAllPlotChances.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds extra info to the Garden plots tooltips
|
* This function adds extra info to the garden plot tooltips
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export default function GardenPlots() {
|
export default function GardenPlots() {
|
||||||
const { minigame } = Game.Objects.Farm;
|
const { minigame } = Game.Objects.Farm;
|
||||||
if (
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPlots) {
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPlots &&
|
const tooltipBorder = l('CMTooltipBorder');
|
||||||
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
|
|
||||||
) {
|
if (minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0) {
|
||||||
const mature =
|
const rewardTooltip = document.createElement('div');
|
||||||
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
|
rewardTooltip.appendChild(Create.TooltipCreateHeader('Reward (Current / Maximum)'));
|
||||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;
|
const mature =
|
||||||
const plantName =
|
minigame.plot[TooltipName[1]][TooltipName[0]][1] >=
|
||||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].name;
|
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;
|
||||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Reward (Current / Maximum)'));
|
const plantName =
|
||||||
const reward = document.createElement('div');
|
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].name;
|
||||||
reward.id = 'CMTooltipPlantReward';
|
const reward = document.createElement('div');
|
||||||
l('CMTooltipBorder').appendChild(reward);
|
reward.id = 'CMTooltipPlantReward';
|
||||||
if (plantName === 'Bakeberry') {
|
rewardTooltip.appendChild(reward);
|
||||||
l('CMTooltipPlantReward').textContent = `${
|
if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
|
||||||
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : '0'
|
reward.textContent = `${
|
||||||
} / ${Beautify(Game.cookiesPs * 60 * 30)}`;
|
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : '0'
|
||||||
} else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
|
} / ${Beautify(Game.cookiesPs * 60 * 3)}`;
|
||||||
l('CMTooltipPlantReward').textContent = `${
|
} else if (plantName === 'Bakeberry') {
|
||||||
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : '0'
|
reward.textContent = `${
|
||||||
} / ${Beautify(Game.cookiesPs * 60 * 3)}`;
|
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : '0'
|
||||||
} else if (plantName === 'Queenbeet') {
|
} / ${Beautify(Game.cookiesPs * 60 * 30)}`;
|
||||||
l('CMTooltipPlantReward').textContent = `${
|
} else if (plantName === 'Queenbeet') {
|
||||||
mature ? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : '0'
|
reward.textContent = `${
|
||||||
} / ${Beautify(Game.cookiesPs * 60 * 60)}`;
|
mature ? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : '0'
|
||||||
} else if (plantName === 'Duketater') {
|
} / ${Beautify(Game.cookiesPs * 60 * 60)}`;
|
||||||
l('CMTooltipPlantReward').textContent = `${
|
} else if (plantName === 'Duketater') {
|
||||||
mature ? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : '0'
|
reward.textContent = `${
|
||||||
} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
mature ? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : '0'
|
||||||
} else l('CMTooltipArea').style.display = 'none';
|
} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
||||||
|
} else rewardTooltip.style.display = 'none';
|
||||||
|
|
||||||
|
if (rewardTooltip.style.display !== 'none') tooltipBorder.appendChild(rewardTooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
minigame.parent.level !== CacheFarmLevel ||
|
||||||
|
minigame.soil !== CacheGardenSoil ||
|
||||||
|
Game.auraMult('Supreme Intellect') !== CacheSupremeIntellect
|
||||||
|
) {
|
||||||
|
CacheFarmLevel = minigame.parent.level;
|
||||||
|
CacheGardenSoil = minigame.soil;
|
||||||
|
CacheSupremeIntellect = Game.auraMult('Supreme Intellect');
|
||||||
|
CalculateAllPlotChances(minigame, CacheSupremeIntellect);
|
||||||
|
}
|
||||||
|
const plotChances = CachePlotChances[TooltipName[1]][TooltipName[0]];
|
||||||
|
|
||||||
|
const plotTooltip = document.createElement('div');
|
||||||
|
if (l('CMTooltipPlantReward')) plotTooltip.style.marginTop = '5px';
|
||||||
|
plotTooltip.appendChild(Create.TooltipCreateHeader('After Next Tick:'));
|
||||||
|
|
||||||
|
const showIcon = [];
|
||||||
|
for (const id in minigame.plantsById) {
|
||||||
|
showIcon[id] = minigame.plantsById[id].unlocked !== 0;
|
||||||
|
for (let y = 0; y < 6 && !showIcon[id]; y++) {
|
||||||
|
for (let x = 0; x < 6; x++) {
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (minigame.plot[y][x][0] - 1 == id) {
|
||||||
|
showIcon[id] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tooltipOutcomes = document.createElement('div');
|
||||||
|
const ConvertToPercentage = function (x) {
|
||||||
|
if (x <= 0) return '0%';
|
||||||
|
if (x >= 1) return '100%';
|
||||||
|
|
||||||
|
const decimals =
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals + 1;
|
||||||
|
const delta = 10 ** -decimals;
|
||||||
|
|
||||||
|
const xH = x * 100;
|
||||||
|
if (xH < delta) return `<${Beautify(delta)}%`;
|
||||||
|
if (xH > 100 - delta) return `>${Beautify(100 - delta)}%`;
|
||||||
|
|
||||||
|
return `${Beautify(xH)}%`;
|
||||||
|
};
|
||||||
|
for (const outcome of plotChances) {
|
||||||
|
const outcomeInfo = document.createElement('div');
|
||||||
|
outcomeInfo.style.height = '48px';
|
||||||
|
outcomeInfo.style.display = 'flex';
|
||||||
|
outcomeInfo.style.alignItems = 'center';
|
||||||
|
|
||||||
|
const outcomeIcon = document.createElement('img');
|
||||||
|
outcomeIcon.style.float = 'left';
|
||||||
|
outcomeIcon.style.objectFit = 'none';
|
||||||
|
if (outcome.plantId === -1) {
|
||||||
|
outcomeIcon.style.width = '40px';
|
||||||
|
outcomeIcon.style.height = '40px';
|
||||||
|
outcomeIcon.style.margin = '4px';
|
||||||
|
outcomeIcon.src = `${Game.resPath}img/gardenPlots.png`;
|
||||||
|
outcomeIcon.style.objectPosition = `${0 * -40}px ${0 * -40}px`;
|
||||||
|
|
||||||
|
// add brown colour
|
||||||
|
outcomeIcon.style.background = 'saddlebrown';
|
||||||
|
outcomeIcon.style.maskImage = `url(${Game.resPath}img/gardenPlots.png)`;
|
||||||
|
} else {
|
||||||
|
outcomeIcon.style.width = '48px';
|
||||||
|
outcomeIcon.style.height = '48px';
|
||||||
|
outcomeIcon.style.margin = '0px';
|
||||||
|
|
||||||
|
if (!showIcon[outcome.plantId]) {
|
||||||
|
outcomeIcon.src = `${Game.resPath}img/icons.png?v=${Game.version}`;
|
||||||
|
outcomeIcon.style.objectPosition = `${0 * -48}px ${7 * -48}px`; // question mark
|
||||||
|
} else {
|
||||||
|
outcomeIcon.src = `${Game.resPath}img/gardenPlants.png?v=${Game.version}`;
|
||||||
|
outcomeIcon.style.objectPosition = `${4 * -48}px ${minigame.plantsById[outcome.plantId].icon * -48}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outcomeInfo.appendChild(outcomeIcon);
|
||||||
|
|
||||||
|
const outcomeInfoText = document.createElement('div');
|
||||||
|
outcomeInfoText.style.marginLeft = '5px';
|
||||||
|
|
||||||
|
const outcomeProbability = document.createElement('div');
|
||||||
|
outcomeProbability.textContent = ConvertToPercentage(outcome.p);
|
||||||
|
outcomeInfoText.appendChild(outcomeProbability);
|
||||||
|
|
||||||
|
if (outcome.plantId !== -1) {
|
||||||
|
const outcomeMaturityChance = document.createElement('small');
|
||||||
|
outcomeMaturityChance.innerHTML = `<small>${ConvertToPercentage(outcome.maturityP)} chance of being mature</small>`;
|
||||||
|
outcomeInfoText.appendChild(outcomeMaturityChance);
|
||||||
|
}
|
||||||
|
|
||||||
|
outcomeInfo.appendChild(outcomeInfoText);
|
||||||
|
tooltipOutcomes.appendChild(outcomeInfo);
|
||||||
|
}
|
||||||
|
plotTooltip.appendChild(tooltipOutcomes);
|
||||||
|
tooltipBorder.appendChild(plotTooltip);
|
||||||
} else l('CMTooltipArea').style.display = 'none';
|
} else l('CMTooltipArea').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
|
import Beautify from '../../BeautifyAndFormatting/Beautify.js';
|
||||||
|
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour.js';
|
||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime.js';
|
||||||
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
import { ColourTextPre, TooltipName } from '../../VariablesAndData.js';
|
||||||
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
import * as Create from '../CreateTooltip.js';
|
||||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
|
||||||
import { ColourTextPre, TooltipName } from '../../VariablesAndData';
|
|
||||||
import * as Create from '../CreateTooltip';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds extra info to the Grimoire tooltips
|
* This function adds extra info to the Grimoire tooltips
|
||||||
@@ -58,10 +55,7 @@ export default function Grimoire() {
|
|||||||
const reward = document.createElement('span');
|
const reward = document.createElement('span');
|
||||||
reward.style.color = '#33FF00';
|
reward.style.color = '#33FF00';
|
||||||
reward.textContent = Beautify(
|
reward.textContent = Beautify(
|
||||||
Math.min(
|
Math.max(Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 30), 7),
|
||||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
|
||||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
|
||||||
),
|
|
||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
conjure.appendChild(reward);
|
conjure.appendChild(reward);
|
||||||
@@ -70,7 +64,10 @@ export default function Grimoire() {
|
|||||||
conjure.appendChild(seperator);
|
conjure.appendChild(seperator);
|
||||||
const loss = document.createElement('span');
|
const loss = document.createElement('span');
|
||||||
loss.style.color = 'red';
|
loss.style.color = 'red';
|
||||||
loss.textContent = Beautify(CacheNoGoldSwitchCookiesPS * 60 * 15, 2);
|
loss.textContent = Beautify(
|
||||||
|
Math.min(Game.cookies, Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 15) + 13),
|
||||||
|
2,
|
||||||
|
);
|
||||||
conjure.appendChild(loss);
|
conjure.appendChild(loss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user