Compare commits
675 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3617d5fc2 | ||
|
|
71f16eb6e1 | ||
|
|
4cf847376f | ||
|
|
ab3a4b37bc | ||
|
|
fcd5588a03 | ||
|
|
08faf9f198 | ||
|
|
3ad492c23f | ||
|
|
081a8317f9 | ||
|
|
ab4012b5ad | ||
|
|
4a552352c8 | ||
|
|
19903378f2 | ||
|
|
ef05396841 | ||
|
|
9281ec7e8c | ||
|
|
2fcb7c0f66 | ||
|
|
e6596713b9 | ||
|
|
a1c1209386 | ||
|
|
e0c7643671 | ||
|
|
b854773766 | ||
|
|
e139f9d500 | ||
|
|
6d60ffb139 | ||
|
|
ad61e8cf09 | ||
|
|
5dffa1c2ac | ||
|
|
69f972fac2 | ||
|
|
9ead87dd16 | ||
|
|
e2d5c7e6e2 | ||
|
|
e4e364ade3 | ||
|
|
6ca617381a | ||
|
|
69a151a25a | ||
|
|
fdc94dd2db | ||
|
|
c02d2c10d1 | ||
|
|
963116ba2f | ||
|
|
f1183801a8 | ||
|
|
db19976e3e | ||
|
|
894f4359cd | ||
|
|
8cb3c43188 | ||
|
|
88d7b11b87 | ||
|
|
af5a44eb9a | ||
|
|
fd77e84a90 | ||
|
|
43fb9112a7 | ||
|
|
f3ceec3c91 | ||
|
|
b3c2eaeb3e | ||
|
|
717f106468 | ||
|
|
50911eb01a | ||
|
|
12657df5cf | ||
|
|
bef40336a5 | ||
|
|
d9c2f3f432 | ||
|
|
59f8808b61 | ||
|
|
d3aa2c30db | ||
|
|
1e92ff6b92 | ||
|
|
ebbb552100 | ||
|
|
67535eaa4c | ||
|
|
ca46c10c55 | ||
|
|
cfb7659c1f | ||
|
|
1ebc8cacc6 | ||
|
|
e9ced31639 | ||
|
|
c4c95eaa31 | ||
|
|
b7c47bbe6c | ||
|
|
f5ea276a63 | ||
|
|
9357e16dec | ||
|
|
1aecb8a8e1 | ||
|
|
eb99ba1b78 | ||
|
|
6f67c171f4 | ||
|
|
88b58f209f | ||
|
|
25250e8c46 | ||
|
|
cfa32ef295 | ||
|
|
1de5dd27dd | ||
|
|
1c4e988e90 | ||
|
|
e3f58e2e73 | ||
|
|
e85a775468 | ||
|
|
7af043bc55 | ||
|
|
2b28cd64b1 | ||
|
|
a24c666993 | ||
|
|
39b1ec6db4 | ||
|
|
11732b10aa | ||
|
|
346bf2b353 | ||
|
|
e2ad102bb4 | ||
|
|
975650fad6 | ||
|
|
e864dee788 | ||
|
|
76718f8c74 | ||
|
|
66e61614dd | ||
|
|
c061ed5b9e | ||
|
|
4c009df819 | ||
|
|
d1336efb90 | ||
|
|
fec72bbf91 | ||
|
|
1cd430f814 | ||
|
|
a025fe51d7 | ||
|
|
df8957338b | ||
|
|
4d0b5097fd | ||
|
|
8ceef4cf2d | ||
|
|
bc6e6eb110 | ||
|
|
f3e84d0920 | ||
|
|
e9d7fc800f | ||
|
|
f6461642e9 | ||
|
|
769f7f18dd | ||
|
|
9e21fc8586 | ||
|
|
5f9b990854 | ||
|
|
8724a2a334 | ||
|
|
a801e79790 | ||
|
|
0cd64198ed | ||
|
|
60859a774e | ||
|
|
cdff551384 | ||
|
|
a200763a6e | ||
|
|
e5d8aabb66 | ||
|
|
e2afebe1c8 | ||
|
|
3e4b9a0dd3 | ||
|
|
fd02f172dc | ||
|
|
59061a5af0 | ||
|
|
5f35ccc76b | ||
|
|
7e1597dae2 | ||
|
|
968353d3fa | ||
|
|
d29096bf72 | ||
|
|
9e696cafb1 | ||
|
|
545a1a3102 | ||
|
|
c602ea5f45 | ||
|
|
bbdbbfb667 | ||
|
|
d9e0e46e64 | ||
|
|
2608ff9149 | ||
|
|
0e7880816e | ||
|
|
4e238e800c | ||
|
|
8c6de64ac9 | ||
|
|
ca676c3b6a | ||
|
|
425d640592 | ||
|
|
9c61d62a8f | ||
|
|
f4becd6a91 | ||
|
|
d07964cfc5 | ||
|
|
6519497ffc | ||
|
|
4dd640ef4b | ||
|
|
2d9af222c1 | ||
|
|
416637bac3 | ||
|
|
f7de9831e5 | ||
|
|
e4113d21e1 | ||
|
|
f4711c74da | ||
|
|
33d0478ca9 | ||
|
|
ac457ed8dc | ||
|
|
efcaccfb26 | ||
|
|
63a38e564c | ||
|
|
2491f7a7cc | ||
|
|
8deb0c435d | ||
|
|
6ed19f23e6 | ||
|
|
13e1233e0f | ||
|
|
d3af77e2c8 | ||
|
|
b628d20363 | ||
|
|
63139933ce | ||
|
|
0547381845 | ||
|
|
455e99e2ab | ||
|
|
b2ae7c71cf | ||
|
|
eee663f414 | ||
|
|
3dd2e65092 | ||
|
|
16ad8f78dc | ||
|
|
ce5b7940e4 | ||
|
|
7b8e29e346 | ||
|
|
5e5e8f5e22 | ||
|
|
d228967fe7 | ||
|
|
b3757c452a | ||
|
|
6c852e2c50 | ||
|
|
5abdc77e30 | ||
|
|
5af7be93e3 | ||
|
|
0171732e70 | ||
|
|
00c513798a | ||
|
|
235900c826 | ||
|
|
abc7dce047 | ||
|
|
61fc4aaaef | ||
|
|
4649ab87c6 | ||
|
|
7186be028b | ||
|
|
e6728157b3 | ||
|
|
843bb00f34 | ||
|
|
1a73fb8a2d | ||
|
|
1aa6d3797b | ||
|
|
31ea583edb | ||
|
|
b4cb0fee52 | ||
|
|
6dd4022a80 | ||
|
|
d30a064c69 | ||
|
|
cb91c91321 | ||
|
|
93e50181fe | ||
|
|
3b137aa882 | ||
|
|
1d51a36ccd | ||
|
|
30f6ecf8f2 | ||
|
|
1d639a9721 | ||
|
|
19260f9361 | ||
|
|
94ba7487b1 | ||
|
|
cd3a9caab5 | ||
|
|
45c3df2d4b | ||
|
|
80e3ac746a | ||
|
|
52cfd9ddc2 | ||
|
|
ffa664c476 | ||
|
|
a9dfcaab75 | ||
|
|
91a2edf348 | ||
|
|
f450ae98ae | ||
|
|
cd90b15fa3 | ||
|
|
8a3eac78d4 | ||
|
|
cdfb35aa1b | ||
|
|
23f19b4d62 | ||
|
|
ab08bc60e7 | ||
|
|
b48834e416 | ||
|
|
2f12f9839a | ||
|
|
c62b514f0a | ||
|
|
125113133a | ||
|
|
e5bd08c0c4 | ||
|
|
abfeabf08f | ||
|
|
d958fc08bf | ||
|
|
1372942705 | ||
|
|
e64e41e523 | ||
|
|
fda6e65176 | ||
|
|
7795aa79a5 | ||
|
|
b6069e2358 | ||
|
|
a7af602aa3 | ||
|
|
f36dcf012a | ||
|
|
5a64ed45be | ||
|
|
e5b24b393e | ||
|
|
92c28b092b | ||
|
|
d5c5a5f62e | ||
|
|
867249e8cb | ||
|
|
28e28fd5a0 | ||
|
|
5f93186e7d | ||
|
|
0a57450815 | ||
|
|
c08cefd1a6 | ||
|
|
51ab15f2ec | ||
|
|
8505b1621d | ||
|
|
901bc7c61f | ||
|
|
192c5d105c | ||
|
|
519e67dce9 | ||
|
|
c184d8b7a7 | ||
|
|
55c6b5db8b | ||
|
|
6df4abf945 | ||
|
|
242c6ba754 | ||
|
|
00f79cb073 | ||
|
|
c64f42bcfa | ||
|
|
29ba1c66cf | ||
|
|
1875423a7b | ||
|
|
62f8e1fe82 | ||
|
|
f257243b38 | ||
|
|
d71c197ec9 | ||
|
|
0ccd16577f | ||
|
|
7c9d6f570d | ||
|
|
2648af3095 | ||
|
|
cb284ed22d | ||
|
|
5f5a1abac0 | ||
|
|
66429ff0d2 | ||
|
|
c997ace2cf | ||
|
|
9e0dac5413 | ||
|
|
4a3bb46f8b | ||
|
|
69fb8af639 | ||
|
|
ad7d35e1ee | ||
|
|
2bedae477d | ||
|
|
91ebbf39b9 | ||
|
|
a8b874f37d | ||
|
|
b58c3ea292 | ||
|
|
cafa12204e | ||
|
|
b4e2236fb7 | ||
|
|
5d126b6be3 | ||
|
|
b6cd262ff2 | ||
|
|
6edda5420f | ||
|
|
97014d273e | ||
|
|
319a3102de | ||
|
|
b9a1a5444f | ||
|
|
3f405da833 | ||
|
|
9a649f93d2 | ||
|
|
d89c8e3a0f | ||
|
|
6bb99ace11 | ||
|
|
68c30e7bdd | ||
|
|
3ca1018a51 | ||
|
|
aed9b75397 | ||
|
|
0c095e4d81 | ||
|
|
2f430e82e1 | ||
|
|
56d23aae22 | ||
|
|
c1501b47d6 | ||
|
|
63ddf7fa38 | ||
|
|
798f61cafe | ||
|
|
72aef84fcc | ||
|
|
203dc8137e | ||
|
|
e6118f14c2 | ||
|
|
1cffb822fb | ||
|
|
1a0f9ed1a2 | ||
|
|
ca0889790d | ||
|
|
5fc662980a | ||
|
|
5d5256bfc9 | ||
|
|
0f5f244fdc | ||
|
|
1715306374 | ||
|
|
a05c9290de | ||
|
|
51617c9777 | ||
|
|
f7bf34d7af | ||
|
|
07d73b10e3 | ||
|
|
0f865f3897 | ||
|
|
389dae4daa | ||
|
|
c6c54054ee | ||
|
|
2246e31bb5 | ||
|
|
7cfdcc7662 | ||
|
|
938e850e29 | ||
|
|
d3a4eb936a | ||
|
|
c4295a1ed0 | ||
|
|
30c4617bde | ||
|
|
37b378ad08 | ||
|
|
90a79dbc0c | ||
|
|
7164801156 | ||
|
|
c530bd1a4a | ||
|
|
7d7516bb21 | ||
|
|
28fbb1e094 | ||
|
|
ff30cc2818 | ||
|
|
9542093f1b | ||
|
|
208c99baf5 | ||
|
|
5e4471d929 | ||
|
|
2a5fb05a2f | ||
|
|
8aa8a7c878 | ||
|
|
0ae29ce2e8 | ||
|
|
367702dc00 | ||
|
|
73ca07a0e9 | ||
|
|
bd59f7b4a9 | ||
|
|
f6f2f99966 | ||
|
|
04714f22ac | ||
|
|
b65f31bee1 | ||
|
|
7a094a8990 | ||
|
|
e230a3c89e | ||
|
|
a8002f29e3 | ||
|
|
05e84d42d3 | ||
|
|
556e71434d | ||
|
|
101c309cec | ||
|
|
8037615659 | ||
|
|
fcadf1cc18 | ||
|
|
671ff61830 | ||
|
|
2fbbd39118 | ||
|
|
cff7377789 | ||
|
|
583501e01b | ||
|
|
10482dfd2d | ||
|
|
08b30e9c62 | ||
|
|
6098a398f0 | ||
|
|
b80d2b63e8 | ||
|
|
a867d3d896 | ||
|
|
f398aa9564 | ||
|
|
6a6a27680f | ||
|
|
15b859e8b9 | ||
|
|
f13c9fb02d | ||
|
|
f72e95301c | ||
|
|
8ffc0a2664 | ||
|
|
f9c4f68bb8 | ||
|
|
6bf81085ca | ||
|
|
ea4776ae4b | ||
|
|
efd4e9319d | ||
|
|
f30ebd081e | ||
|
|
2f761dfce8 | ||
|
|
88792454c2 | ||
|
|
8805eacb0e | ||
|
|
62d05ea074 | ||
|
|
759d665019 | ||
|
|
b462ed2ced | ||
|
|
eb7a710464 | ||
|
|
7c08431271 | ||
|
|
534e744532 | ||
|
|
0d9f45a537 | ||
|
|
e066c8c43b | ||
|
|
bbc2fdf29f | ||
|
|
b6370c1873 | ||
|
|
bf8e1922cb | ||
|
|
87a85bfc59 | ||
|
|
7e101edf82 | ||
|
|
36e64d3d90 | ||
|
|
6c5821593f | ||
|
|
1b88b70c72 | ||
|
|
15d467992d | ||
|
|
15e4291489 | ||
|
|
7cd62e1735 | ||
|
|
d0ad7c418d | ||
|
|
77447cfca3 | ||
|
|
28b144ee70 | ||
|
|
b6cdc77064 | ||
|
|
e0915bc307 | ||
|
|
7e935aab1a | ||
|
|
9dc95d760a | ||
|
|
f3ea56f34d | ||
|
|
9ce42f2f3c | ||
|
|
4baae5c9f7 | ||
|
|
02b31c8932 | ||
|
|
343327a1b5 | ||
|
|
3bca426eb1 | ||
|
|
5c736b7790 | ||
|
|
a22ab829ec | ||
|
|
f65749db50 | ||
|
|
a3f2fe5dab | ||
|
|
ed814ef39a | ||
|
|
74b353d530 | ||
|
|
d6aca47698 | ||
|
|
106331af85 | ||
|
|
8a303c2d27 | ||
|
|
cbaf06a76b | ||
|
|
e6f2c4c966 | ||
|
|
08e005b9db | ||
|
|
4067410397 | ||
|
|
e3861f1ffe | ||
|
|
e6d0774734 | ||
|
|
95f19fbfd7 | ||
|
|
63c3a493fa | ||
|
|
17efc10568 | ||
|
|
9cad31da3e | ||
|
|
5b9d171bf4 | ||
|
|
44f75247cd | ||
|
|
06c7f59cd6 | ||
|
|
28ab2eab22 | ||
|
|
854bec1519 | ||
|
|
243e43188f | ||
|
|
391b70017a | ||
|
|
cd6f1ddaf4 | ||
|
|
7efbd59062 | ||
|
|
e256d39101 | ||
|
|
0f5291b41c | ||
|
|
8bbec4c8a4 | ||
|
|
e518f25f24 | ||
|
|
e644fcb49f | ||
|
|
b9c7a0f154 | ||
|
|
94745fb013 | ||
|
|
a8e3691507 | ||
|
|
cb8114ecfb | ||
|
|
f864e60e87 | ||
|
|
53117009e7 | ||
|
|
5f4dda4adb | ||
|
|
63e5ddf1ca | ||
|
|
8c5ea875bf | ||
|
|
af0f210c54 | ||
|
|
31e701505e | ||
|
|
cb6b97a269 | ||
|
|
0bebb12808 | ||
|
|
8a3609092d | ||
|
|
8dc5d4b849 | ||
|
|
63a00a2ae1 | ||
|
|
71a4407da8 | ||
|
|
7cf021ac5d | ||
|
|
810c5adfba | ||
|
|
26549a148a | ||
|
|
f810c42b73 | ||
|
|
e3c3c1b1fe | ||
|
|
9b87b1d5ad | ||
|
|
baf21e888f | ||
|
|
8a26fc3178 | ||
|
|
a30f07be77 | ||
|
|
428c000a5a | ||
|
|
42960d9780 | ||
|
|
27567b3cff | ||
|
|
17f13239ca | ||
|
|
d257830de8 | ||
|
|
c87a9d47d0 | ||
|
|
a11f82fce4 | ||
|
|
786ece6667 | ||
|
|
0ac966a905 | ||
|
|
0a29e2f4a0 | ||
|
|
292a80b807 | ||
|
|
32b87738ee | ||
|
|
b91d0e1195 | ||
|
|
5cc08170bc | ||
|
|
f7192d1e90 | ||
|
|
7128df5d50 | ||
|
|
1398b3fbaf | ||
|
|
78888e784c | ||
|
|
a6863bc8e6 | ||
|
|
b6f19737cb | ||
|
|
57cfdad215 | ||
|
|
8e46a55ee5 | ||
|
|
d7883e7238 | ||
|
|
c458d46d33 | ||
|
|
9de7591531 | ||
|
|
564d136df3 | ||
|
|
9714e00938 | ||
|
|
44d532146b | ||
|
|
8f809cc093 | ||
|
|
291ff1ae6a | ||
|
|
744ee0dc5e | ||
|
|
66ac922ae2 | ||
|
|
3d965943c0 | ||
|
|
e05db88a72 | ||
|
|
8a98c6f4db | ||
|
|
272f17be71 | ||
|
|
6922dd0465 | ||
|
|
d40f90d233 | ||
|
|
8ea9400a07 | ||
|
|
eda7514001 | ||
|
|
935ce42305 | ||
|
|
c68febd794 | ||
|
|
3c28df38c8 | ||
|
|
f8c1dd9308 | ||
|
|
3721052cc3 | ||
|
|
94fe8878fd | ||
|
|
2e2631fca8 | ||
|
|
65b335b853 | ||
|
|
fc20c8490c | ||
|
|
bd98741ffe | ||
|
|
deb309c08f | ||
|
|
011698a3c9 | ||
|
|
d25af61007 | ||
|
|
981dc2d1c0 | ||
|
|
bcef69a344 | ||
|
|
cd52377639 | ||
|
|
7660e6dff3 | ||
|
|
a061bbb564 | ||
|
|
e2ec8a34f2 | ||
|
|
356b1fec57 | ||
|
|
f69fe11921 | ||
|
|
c05071ab6e | ||
|
|
dc6d643f7d | ||
|
|
706fb7231e | ||
|
|
2ff37d561c | ||
|
|
a13efd0c5b | ||
|
|
a920e9e5fb | ||
|
|
fa6b998f67 | ||
|
|
244d0342ec | ||
|
|
9f649d8806 | ||
|
|
2e751e966d | ||
|
|
06ba2ad000 | ||
|
|
cb4b85a594 | ||
|
|
b5eac1ce22 | ||
|
|
431b1e6cd0 | ||
|
|
836804b3f9 | ||
|
|
8af54cfe8c | ||
|
|
8e2777df0e | ||
|
|
3ff3b970a0 | ||
|
|
108a0d836d | ||
|
|
9937efddb6 | ||
|
|
d0f5a5594b | ||
|
|
9b0f416a02 | ||
|
|
276160bf7b | ||
|
|
cecbeca1fe | ||
|
|
f359999f9b | ||
|
|
398db2caf6 | ||
|
|
4b90c8a3f0 | ||
|
|
9a8f1bdb86 | ||
|
|
18e747c3b3 | ||
|
|
1bb6ae7e9f | ||
|
|
1f366430cf | ||
|
|
77421c11c0 | ||
|
|
7d5e3ee437 | ||
|
|
ab7f35e6d9 | ||
|
|
9f2a7cda78 | ||
|
|
963f950039 | ||
|
|
0255afd75d | ||
|
|
254d1ad34b | ||
|
|
4a8c59a3e6 | ||
|
|
cd3061f2c4 | ||
|
|
937cb34920 | ||
|
|
ac015ab5a8 | ||
|
|
ea817e3eed | ||
|
|
5b9d3636db | ||
|
|
7cfba6f80a | ||
|
|
2f862ac687 | ||
|
|
6895719759 | ||
|
|
1a1877e15c | ||
|
|
3af0dd81e5 | ||
|
|
909806b0f9 | ||
|
|
a393c73eec | ||
|
|
1c8a9d6bb3 | ||
|
|
62dae65606 | ||
|
|
7310905ae2 | ||
|
|
cd1ea8269b | ||
|
|
22ae4ebc4c | ||
|
|
b5f6fef9ae | ||
|
|
9becf9b9ac | ||
|
|
eb62576e5f | ||
|
|
78ec726f4a | ||
|
|
e4de9c124e | ||
|
|
5ef7486646 | ||
|
|
902c866f18 | ||
|
|
f6164a9b85 | ||
|
|
07253531ef | ||
|
|
5689ffb36e | ||
|
|
3ec7b67c24 | ||
|
|
23abe72564 | ||
|
|
5266d8e4dc | ||
|
|
ebd0e929e2 | ||
|
|
fcd4d9e0fc | ||
|
|
41cd7688ea | ||
|
|
00e0b179a3 | ||
|
|
2600ec040b | ||
|
|
3190d18d23 | ||
|
|
38b3c503fc | ||
|
|
71388411b5 | ||
|
|
67eac9fde2 | ||
|
|
bd0cd9900d | ||
|
|
4ad6cc9fe0 | ||
|
|
e59b69e3f2 | ||
|
|
78df5491a0 | ||
|
|
de0d148dd0 | ||
|
|
f9b4dd4ada | ||
|
|
0f8b5b7da7 | ||
|
|
7295e0ea76 | ||
|
|
010e065dd7 | ||
|
|
816c566442 | ||
|
|
f32b1d5685 | ||
|
|
9df807a4ae | ||
|
|
bd2b59efde | ||
|
|
04549b5e21 | ||
|
|
e5039b588b | ||
|
|
5a9dc8b9fe | ||
|
|
f773a9595a | ||
|
|
362e87610e | ||
|
|
b16510c6ed | ||
|
|
92ff50d3a3 | ||
|
|
1633dfb283 | ||
|
|
80bb731f17 | ||
|
|
ba387bddc6 | ||
|
|
197fceaddc | ||
|
|
cad42578a9 | ||
|
|
446f1e767c | ||
|
|
6ac602a067 | ||
|
|
37107ae621 | ||
|
|
687cb9a4c9 | ||
|
|
2176b9b436 | ||
|
|
e061caa2e4 | ||
|
|
b4157cdbc5 | ||
|
|
c0cd967cc7 | ||
|
|
c32a364d82 | ||
|
|
d82f782f4b | ||
|
|
22a00ceef0 | ||
|
|
b4c0c8de2b | ||
|
|
991c80d040 | ||
|
|
6c0ab25894 | ||
|
|
92575ccd64 | ||
|
|
b4da2c69f1 | ||
|
|
8802a834d5 | ||
|
|
5a42ae532e | ||
|
|
e1c4826605 | ||
|
|
23232c536a | ||
|
|
e5f310393f | ||
|
|
9fc5b3dbaf | ||
|
|
adef849df9 | ||
|
|
d435e215e8 | ||
|
|
76cc63e510 | ||
|
|
eea4656094 | ||
|
|
5a9d378585 | ||
|
|
4a20c76885 | ||
|
|
520f72fe77 | ||
|
|
37f4252509 | ||
|
|
ae29132175 | ||
|
|
5fb084bd12 | ||
|
|
c3e85afb85 | ||
|
|
3ce5164abb | ||
|
|
6107be18a9 | ||
|
|
ae11e1db73 | ||
|
|
ba726ec435 | ||
|
|
4d2287a7ae | ||
|
|
9555e73475 | ||
|
|
e62b7bfe04 | ||
|
|
91d2ea8df7 | ||
|
|
05278149c5 | ||
|
|
881f5233e9 | ||
|
|
2a67bc1b61 | ||
|
|
eb3c403fbd | ||
|
|
5d0958b63a | ||
|
|
57ab55a2c1 | ||
|
|
3adf65f766 | ||
|
|
2ed563c995 | ||
|
|
00a9ea2cd4 | ||
|
|
f0d492ea4a | ||
|
|
dd25067271 | ||
|
|
6c1f08a6c0 | ||
|
|
1dcc814fa4 | ||
|
|
a09602fecd | ||
|
|
306c7c24a4 | ||
|
|
58e4b7d328 | ||
|
|
be4587a905 | ||
|
|
ddd52c9583 | ||
|
|
bb776eb477 | ||
|
|
c5ddda54c5 | ||
|
|
cd09bd55fc | ||
|
|
c12fcf7344 | ||
|
|
8bddb28d1d | ||
|
|
3ed7a64344 | ||
|
|
44447d71c3 | ||
|
|
c03c1c44d7 | ||
|
|
67ca329306 | ||
|
|
ca43950c0c | ||
|
|
ab721fef7c | ||
|
|
e034ee1f44 | ||
|
|
9070a50355 | ||
|
|
440512ddc7 | ||
|
|
4dd498cc4d | ||
|
|
348c47e1dc | ||
|
|
6e09c8dafb | ||
|
|
f1a79cbaa3 | ||
|
|
5640cbb9c8 | ||
|
|
6917e3139a |
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
CookieMonster.js
|
||||
CookieMonster.user.js
|
||||
50
.eslintrc.js
Normal file
50
.eslintrc.js
Normal file
@@ -0,0 +1,50 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
},
|
||||
globals: {
|
||||
module: 'readonly',
|
||||
Game: 'writable',
|
||||
l: 'readonly',
|
||||
b64_to_utf8: 'readonly',
|
||||
utf8_to_b64: 'readonly',
|
||||
Beautify: 'writable',
|
||||
realAudio: 'readonly',
|
||||
JSColor: 'readonly',
|
||||
jscolor: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
CM: 'writable',
|
||||
unsafeWindow: 'readonly',
|
||||
},
|
||||
extends: 'airbnb-base',
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
rules: {
|
||||
indent: ['error', 'tab'],
|
||||
'no-tabs': 'off',
|
||||
'max-len': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-new-func': 'off',
|
||||
'no-eval': 'off',
|
||||
'no-restricted-properties': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'prefer-destructuring': 'off',
|
||||
'func-names': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'no-console': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
'object-shorthand': 'off',
|
||||
'no-else-return': 'off',
|
||||
'prefer-arrow-callback': 'off',
|
||||
'no-new': 'off',
|
||||
'no-alert': 'off',
|
||||
'new-cap': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'no-template-curly-in-string': 'off',
|
||||
radix: 'off',
|
||||
},
|
||||
};
|
||||
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
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**
|
||||
```
|
||||
If applicable please copy your save file here
|
||||
```
|
||||
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
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.
|
||||
25
.github/workflows/CI.yml
vendored
Normal file
25
.github/workflows/CI.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
Check_ESLint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run ESLint
|
||||
run: |
|
||||
npm install
|
||||
npx eslint src
|
||||
Check_main_file:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check if CookieMonster.js is built correctly
|
||||
run: |
|
||||
npm install
|
||||
npx terser ./src/Header.js ./src/Cache.js ./src/Config.js ./src/Data.js ./src/Disp.js ./src/Main.js ./src/Sim.js ./src/Footer.js -o CookieMonsterTest.js
|
||||
if cmp CookieMonster.js CookieMonsterTest.js; then
|
||||
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
||||
else
|
||||
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to run "npm run build" after saving all your changes! ###'
|
||||
exit 1
|
||||
fi
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
22
CONTRIBUTING.md
Normal file
22
CONTRIBUTING.md
Normal file
@@ -0,0 +1,22 @@
|
||||
The following is a description of the our approach to the project.
|
||||
|
||||
Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data.
|
||||
|
||||
Here is a description of what should be stored in each of the source JS. Make edits to the source file first and then use the combine file to compile the final file:
|
||||
|
||||
JS | Description
|
||||
-- | -
|
||||
Cache | Functions related to creating and storing data cache
|
||||
Config | Functions related to manipulating CM configuration
|
||||
Data | Hard coded values
|
||||
Disp | Functions related to displaying CM's UI
|
||||
Footer | The footer of CM's JS (not modified often or ever)
|
||||
Header | The header of CM's JS (not modified often or ever)
|
||||
Main | Functions related to the main loop and initializing CM
|
||||
Sim | Functions related to simulate something
|
||||
|
||||
These are some additional guidelines:
|
||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
||||
- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message.
|
||||
- Try to follow the formatting and annotation as specified by JSCode
|
||||
- PR's should target the `dev` branch
|
||||
@@ -1,2 +0,0 @@
|
||||
@ECHO OFF
|
||||
COPY /B /Y .\src\Header.js + .\src\Cache.js + .\src\Config.js + .\src\Data.js + .\src\Disp.js + .\src\Main.js + .\src\Sim.js + .\src\Footer.js CookieMonster.js
|
||||
2546
CookieMonster.js
2546
CookieMonster.js
File diff suppressed because one or more lines are too long
19
CookieMonster.user.js
Normal file
19
CookieMonster.user.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// ==UserScript==
|
||||
// @name Cookie Monster
|
||||
// @include /https?://orteil.dashnet.org/cookieclicker/
|
||||
// ==/UserScript==
|
||||
|
||||
const readyCheck = setInterval(() => {
|
||||
const Game = unsafeWindow.Game;
|
||||
|
||||
if (
|
||||
typeof Game !== "undefined" &&
|
||||
typeof Game.ready !== "undefined" &&
|
||||
Game.ready
|
||||
) {
|
||||
Game.LoadMod(
|
||||
"https://aktanusa.github.io/CookieMonster/CookieMonster.js"
|
||||
);
|
||||
clearInterval(readyCheck);
|
||||
}
|
||||
}, 1000);
|
||||
129
README.md
129
README.md
@@ -1,135 +1,82 @@
|
||||
# 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.
|
||||
|
||||
This is a helper, and it is here to help you at *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
|
||||
You can see the current version, and a full history of all versions and what they changed by consulting the [releases page](https://github.com/Aktanusa/CookieMonster/releases).
|
||||
|
||||
## What it does
|
||||
### What it does
|
||||
|
||||
At its core, Cookie Monster computes an index on both buildings and upgrades:
|
||||
|
||||
* **Base Cost per Income (BCI)**: Indicates how much a building is worth by comparing how much it costs to how much income gained
|
||||
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. This indicates how much a building is worth by using the following formula:
|
||||
```
|
||||
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
||||
```
|
||||
|
||||
Cookie Monster also indicates the time left before being able to buy an upgrade or building, and takes it into consideration. It will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, it will know and highlight that building's value.
|
||||
|
||||
This index is computed for buildings and upgrades. If the relevant option is enabled, it will color-code each of them based on their value:
|
||||
|
||||
* Light Blue: (upgrades) This item has a better BCI than any building
|
||||
* Green: This item has the best BCI
|
||||
* Light Blue: (upgrades) This item has a better PP than any building
|
||||
* Green: This item has the best PP
|
||||
* Yellow: This item is not the best, but it is closer to best than it is to worst
|
||||
* Orange: This item is not the worst, but it is closer to worst than it is to best
|
||||
* Red: This item has the worst BCI
|
||||
* Purple: (upgrades) This item has a worse BCI than any building
|
||||
* Red: This item has the worst PP
|
||||
* Purple: (upgrades) This item has a worse PP than any building
|
||||
* Gray: (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth.
|
||||
|
||||
Note: For this index, **lower is better**, meaning a building with a BCI of 1 is more interesting than one with a BCI of 3.
|
||||
Note: For this index, **lower is better**, meaning a building with a PP of 1 is more interesting than one with a PP of 3.
|
||||
|
||||
## What it doesn't do
|
||||
### What it doesn't do
|
||||
|
||||
Most likely you'll find items in gray like Golden Cookie upgrades, clicking upgrades – everything that doesn't earn you a direct bonus to your income will display as gray. This means the following upgrades are **not** taken into account by Cookie Monster:
|
||||
|
||||
* Plastic mouse
|
||||
* Iron mouse
|
||||
* Titanium mouse
|
||||
* Adamantium mouse
|
||||
* Unobtainium mouse
|
||||
* Lucky day
|
||||
* Serendipity
|
||||
* Get lucky
|
||||
* Elder Pledge
|
||||
* Sacrificial rolling pins
|
||||
* **etc.**
|
||||
Some upgrades do not give a direct bonus to your income and will display as gray. These are mainly Golden Cookie upgrades and season upgrades.
|
||||
|
||||
Do note though that, although these upgrades have no direct value, if buying them earns you an achievement of some sort which in return gives you milk and income, Cookie Monster **will** display that value.
|
||||
|
||||
# Using
|
||||
## Using
|
||||
|
||||
## Bookmarklet
|
||||
### Bookmarklet
|
||||
|
||||
Copy this code and save it as a bookmark. Paste it in the URL section. To activate, click the bookmark when the game's open.
|
||||
|
||||
```javascript
|
||||
javascript: (function () {
|
||||
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js');
|
||||
Game.LoadMod('https://aktanusa.github.io/CookieMonster/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.
|
||||
|
||||
For beta, use the following instead:
|
||||
### Userscript
|
||||
|
||||
```javascript
|
||||
javascript: (function () {
|
||||
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonsterBeta.js');
|
||||
}());
|
||||
```
|
||||
If you'd rather use the addon as a [userscript](https://en.wikipedia.org/wiki/Userscript) to automatically load _Cookie Monster_ every time the original game loads, install the `CookieMonster.user.js` file. You can do this by clicking on the file in the file-list and clicking "raw".
|
||||
|
||||
## Userscript
|
||||
## Bugs and suggestions
|
||||
|
||||
If you'd rather use the addon as a script via per example *Greasemonkey* or *Tampermonkey*, you can use the following script, which will automatically load *Cookie Monster* every time the original game loads. You may need to specify <code>http://orteil.dashnet.org/cookieclicker/</code> when asked for a *namespace* or *includes*. For how to add an userscript to your browser, refer to your browser/plugin's documentation as the method changes for each one.
|
||||
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/Aktanusa/CookieMonster/issues) for easier tracking. This allows us to close issues once they're fixed.
|
||||
|
||||
```javascript
|
||||
// ==UserScript==
|
||||
// @name Cookie Monster
|
||||
// @namespace Cookie
|
||||
// @include http://orteil.dashnet.org/cookieclicker/
|
||||
// @version 1
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
Before submitting a bug, make sure to give a shot at the latest version of the addon on the <code>dev</code> branch. This version can be tested by copying the `CookieMonster.js` file of the dev branch into your console.
|
||||
|
||||
javascript:(function() {
|
||||
var checkReady = setInterval(function() {
|
||||
if (typeof Game.ready !== 'undefined' && Game.ready) {
|
||||
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js');
|
||||
clearInterval(checkReady);
|
||||
}
|
||||
}, 1000);
|
||||
}());
|
||||
```
|
||||
If you are using the beta, use this instead:
|
||||
|
||||
```javascript
|
||||
// ==UserScript==
|
||||
// @name Cookie Monster Beta
|
||||
// @namespace Cookie
|
||||
// @include http://orteil.dashnet.org/cookieclicker/beta/
|
||||
// @version 1
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
javascript:(function() {
|
||||
var checkReady = setInterval(function() {
|
||||
if (typeof Game.ready !== 'undefined' && Game.ready) {
|
||||
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonsterBeta.js');
|
||||
clearInterval(checkReady);
|
||||
}
|
||||
}, 1000);
|
||||
}());
|
||||
```
|
||||
|
||||
# Bugs and suggestions
|
||||
|
||||
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/Aktanusa/CookieMonster/issues) for easier tracking. This allows me to close issues once they're fixed.
|
||||
|
||||
Before submitting a bug, make sure to give a shot at the latest version of the addon on the <code>dev</code> branch. For this, use the following bookmarklet:
|
||||
|
||||
```javascript
|
||||
javascript: (function () {
|
||||
Game.LoadMod('https://raw.githubusercontent.com/Aktanusa/CookieMonster/dev/CookieMonster.js');
|
||||
}());
|
||||
```
|
||||
|
||||
If the bug is still here, you can submit an issue for it.
|
||||
If the bug is still here, you can submit an issue for it. Please do so by using the bug report template.
|
||||
|
||||
All suggestions are welcome, even the smallest ones.
|
||||
|
||||
#Contributors
|
||||
## Contributing
|
||||
|
||||
* **[Raving_Kumquat](http://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||
To contribute you can fork and clone the repository and run `npm install`.
|
||||
|
||||
Please also remember to run `npm run build` after saving all your changes to build the final `CookieMonster.js` file.
|
||||
|
||||
## Contributors
|
||||
|
||||
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||
* **Alderi Tokori**: ROI calculations (unused now)
|
||||
* **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now)
|
||||
* **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat
|
||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||
* **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
||||
* **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
||||
|
||||
BIN
favicon/goldenCookie.ico
Normal file
BIN
favicon/goldenCookie.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
BIN
favicon/wrathCookie.ico
Normal file
BIN
favicon/wrathCookie.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
4213
jscolor/jscolor.js
4213
jscolor/jscolor.js
File diff suppressed because it is too large
Load Diff
3616
package-lock.json
generated
Normal file
3616
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
53
package.json
Normal file
53
package.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "cookiemonster-mod",
|
||||
"version": "2.031.4",
|
||||
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||
"main": "CookieMonster.js",
|
||||
"keywords": [
|
||||
"Cookie Clicker",
|
||||
"javascript",
|
||||
"mod",
|
||||
"Dashnet",
|
||||
"Orteil"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npx eslint src && terser ./src/Header.js ./src/Cache.js ./src/Config.js ./src/Data.js ./src/Disp.js ./src/Main.js ./src/Sim.js ./src/Footer.js -o CookieMonster.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Aktanusa/CookieMonster.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Aktanusa",
|
||||
"email": "chanam.geo@yahoo.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Daniël van Noord",
|
||||
"email": "13665637+DanielNoord@users.noreply.github.com"
|
||||
},
|
||||
{
|
||||
"name": "Aran Leite",
|
||||
"email": "hyoretsu@gmail.com",
|
||||
"url": "https://www.linkedin.com/in/aranleite"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Aktanusa/CookieMonster/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Aktanusa/CookieMonster#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.19.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"terser": "^5.6.0-beta"
|
||||
},
|
||||
"ccrepo": {
|
||||
"icon": [
|
||||
10,
|
||||
0
|
||||
],
|
||||
"name": "Cookie Monster"
|
||||
}
|
||||
}
|
||||
915
src/Cache.js
915
src/Cache.js
@@ -1,179 +1,796 @@
|
||||
/*********
|
||||
/**
|
||||
* Cache *
|
||||
*********/
|
||||
*/
|
||||
|
||||
CM.Cache.NextNumber = function(base) {
|
||||
var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1;
|
||||
while (base == base + count) {
|
||||
count = CM.Cache.NextNumber(count);
|
||||
/**
|
||||
* Section: General Cache related functions */
|
||||
|
||||
/**
|
||||
* This functions runs all cache-functions to generate all "full" cache
|
||||
* The declaration follows the structure of the CM.Cache.js file
|
||||
* It is called by CM.Main.DelayInit
|
||||
*/
|
||||
CM.Cache.InitCache = function () {
|
||||
CM.Cache.CacheDragonAuras();
|
||||
CM.Cache.CacheWrinklers();
|
||||
CM.Cache.CacheStats();
|
||||
CM.Cache.CacheGoldenAndWrathCookiesMults();
|
||||
CM.Cache.CacheChain();
|
||||
CM.Cache.CacheMissingUpgrades();
|
||||
CM.Cache.CacheSeaSpec();
|
||||
CM.Cache.InitCookiesDiff();
|
||||
CM.Cache.HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS()
|
||||
CM.Cache.CacheHeavenlyChipsPS();
|
||||
CM.Cache.CacheAvgCPS();
|
||||
CM.Cache.CacheIncome();
|
||||
CM.Cache.CacheBuildingsPrices();
|
||||
CM.Cache.CachePP();
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches variables that are needed every loop
|
||||
* It is called by CM.Main.Loop()
|
||||
* @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level
|
||||
*/
|
||||
CM.Cache.LoopCache = function () {
|
||||
// Update Wrinkler Bank
|
||||
CM.Cache.CacheWrinklers();
|
||||
|
||||
CM.Cache.CachePP();
|
||||
CM.Cache.CacheCurrWrinklerCPS();
|
||||
CM.Cache.CacheAvgCPS();
|
||||
CM.Cache.CacheHeavenlyChipsPS();
|
||||
|
||||
const cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset);
|
||||
CM.Cache.TimeTillNextPrestige = CM.Disp.FormatTime(cookiesToNext / CM.Disp.GetCPS());
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Helper functions */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @classdesc This is a class used to store values used to calculate average over time (mostly cps)
|
||||
* @var {number} maxLength The maximum length of the value-storage
|
||||
* @var {[]} queue The values stored
|
||||
* @method addLatest(newValue) Appends newValue to the value storage
|
||||
* @method calcAverage(timePeriod) Returns the average over the specified timeperiod
|
||||
*/
|
||||
class CMAvgQueue {
|
||||
constructor(maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
this.queue = [];
|
||||
}
|
||||
return (base + count);
|
||||
}
|
||||
|
||||
CM.Cache.RemakeIncome = function() {
|
||||
// Simulate Building Buys for 1 amount
|
||||
CM.Sim.BuyBuildings(1, 'Objects');
|
||||
|
||||
// Simulate Upgrade Buys
|
||||
CM.Sim.BuyUpgrades();
|
||||
|
||||
// Simulate Building Buys for 10 amount
|
||||
CM.Sim.BuyBuildings(10, 'Objects10');
|
||||
}
|
||||
|
||||
CM.Cache.RemakeBuildingsBCI = function() {
|
||||
CM.Disp.min = -1;
|
||||
CM.Disp.max = -1;
|
||||
CM.Disp.mid = -1;
|
||||
for (var i in CM.Cache.Objects) {
|
||||
CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
||||
if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci;
|
||||
if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci;
|
||||
addLatest(newValue) {
|
||||
if (this.queue.push(newValue) > this.maxLength) {
|
||||
this.queue.shift();
|
||||
}
|
||||
}
|
||||
CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min;
|
||||
for (var i in CM.Cache.Objects) {
|
||||
var color = '';
|
||||
if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
||||
else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
||||
else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
CM.Cache.Objects[i].color = color;
|
||||
|
||||
/**
|
||||
* This functions returns the average of the values in the queue
|
||||
* @param {number} timePeriod The period in seconds to computer average over
|
||||
* @returns {number} ret The average
|
||||
*/
|
||||
calcAverage(timePeriod) {
|
||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
||||
let ret = 0;
|
||||
for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) {
|
||||
ret += this.queue[i];
|
||||
}
|
||||
return ret / timePeriod;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Cache.RemakeUpgradeBCI = function() {
|
||||
for (var i in CM.Cache.Upgrades) {
|
||||
CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
||||
if (isNaN(CM.Cache.Upgrades[i].bci)) CM.Cache.Upgrades[i].bci = 'Infinity';
|
||||
var color = '';
|
||||
if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray;
|
||||
else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
CM.Cache.Upgrades[i].color = color;
|
||||
/**
|
||||
* Section: Functions related to Dragon Auras */
|
||||
|
||||
/**
|
||||
* This functions caches the currently selected Dragon Auras
|
||||
* It is called by CM.Sim.CopyData() and CM.Cache.InitCache()
|
||||
* Uncapitalized dragon follows Game-naming
|
||||
* @global {number} CM.Cache.dragonAura The number of the first (right) Aura
|
||||
* @global {number} CM.Cache.dragonAura2 The number of the second (left) Aura
|
||||
*/
|
||||
CM.Cache.CacheDragonAuras = function () {
|
||||
CM.Cache.dragonAura = Game.dragonAura;
|
||||
CM.Cache.dragonAura2 = Game.dragonAura2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to Wrinklers */
|
||||
|
||||
/**
|
||||
* This functions caches data related to Wrinklers
|
||||
* It is called by CM.Cache.LoopCache() and CM.Cache.InitCache()
|
||||
* @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers
|
||||
* @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers
|
||||
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
|
||||
*/
|
||||
CM.Cache.CacheWrinklers = function () {
|
||||
CM.Cache.WrinklersTotal = 0;
|
||||
CM.Cache.WrinklersNormal = 0;
|
||||
CM.Cache.WrinklersFattest = [0, null];
|
||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||
let sucked = Game.wrinklers[i].sucked;
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
sucked *= toSuck;
|
||||
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
|
||||
if (CM.Sim.Objects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
if (godLvl === 1) sucked *= 1.15;
|
||||
else if (godLvl === 2) sucked *= 1.1;
|
||||
else if (godLvl === 3) sucked *= 1.05;
|
||||
}
|
||||
CM.Cache.WrinklersTotal += sucked;
|
||||
if (Game.wrinklers[i].type === 0) {
|
||||
CM.Cache.WrinklersNormal += sucked;
|
||||
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CM.Cache.RemakeBuildings10BCI = function() {
|
||||
for (var i in CM.Cache.Objects10) {
|
||||
CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, 10);
|
||||
CM.Cache.Objects10[i].bci = CM.Cache.Objects10[i].price / CM.Cache.Objects10[i].bonus;
|
||||
var color = '';
|
||||
if (CM.Cache.Objects10[i].bci <= 0 || CM.Cache.Objects10[i].bci == 'Infinity') color = CM.Disp.colorGray;
|
||||
else if (CM.Cache.Objects10[i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
||||
else if (CM.Cache.Objects10[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
||||
else if (CM.Cache.Objects10[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
||||
else if (CM.Cache.Objects10[i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
||||
else if (CM.Cache.Objects10[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
CM.Cache.Objects10[i].color = color;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Section: Functions related to Caching stats */
|
||||
|
||||
CM.Cache.RemakeBCI = function() {
|
||||
// Buildings for 1 amount
|
||||
CM.Cache.RemakeBuildingsBCI();
|
||||
|
||||
// Upgrades
|
||||
CM.Cache.RemakeUpgradeBCI();
|
||||
|
||||
// Buildings for 10 amount
|
||||
CM.Cache.RemakeBuildings10BCI();
|
||||
}
|
||||
|
||||
CM.Cache.RemakeLucky = function() {
|
||||
CM.Cache.Lucky = (Game.cookiesPs * 60 * 15) / 0.15;
|
||||
if (Game.frenzy > 0) {
|
||||
CM.Cache.Lucky /= Game.frenzyPower;
|
||||
}
|
||||
CM.Cache.LuckyReward = (CM.Cache.Lucky * 0.15) + 13;
|
||||
/**
|
||||
* This functions caches variables related to the stats page
|
||||
* It is called by CM.Main.Loop() upon changes to cps and CM.Cache.InitCache()
|
||||
* @global {number} CM.Cache.Lucky Cookies required for max Lucky
|
||||
* @global {number} CM.Cache.LuckyReward Reward for max normal Lucky
|
||||
* @global {number} CM.Cache.LuckyWrathReward Reward for max normal Lucky from Wrath cookie
|
||||
* @global {number} CM.Cache.LuckyFrenzy Cookies required for max Lucky Frenzy
|
||||
* @global {number} CM.Cache.LuckyRewardFrenzy Reward for max Lucky Frenzy
|
||||
* @global {number} CM.Cache.LuckyWrathRewardFrenzy Reward for max Lucky Frenzy from Wrath cookie
|
||||
* @global {number} CM.Cache.Conjure Cookies required for max Conjure Baked Goods
|
||||
* @global {number} CM.Cache.ConjureReward Reward for max Conjure Baked Goods
|
||||
* @global {number} CM.Cache.Edifice Cookies required for most expensive building through Spontaneous Edifice
|
||||
* @global {string} CM.Cache.EdificeBuilding Name of most expensive building possible with Spontaneous Edifice
|
||||
*/
|
||||
CM.Cache.CacheStats = function () {
|
||||
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15;
|
||||
CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment;
|
||||
const cpsBuffMult = CM.Cache.getCPSBuffMult();
|
||||
if (cpsBuffMult > 0) CM.Cache.Lucky /= cpsBuffMult;
|
||||
else CM.Cache.Lucky = 0;
|
||||
CM.Cache.LuckyReward = CM.Cache.GoldenCookiesMult * (CM.Cache.Lucky * 0.15) + 13;
|
||||
CM.Cache.LuckyWrathReward = CM.Cache.WrathCookiesMult * (CM.Cache.Lucky * 0.15) + 13;
|
||||
CM.Cache.LuckyFrenzy = CM.Cache.Lucky * 7;
|
||||
CM.Cache.LuckyRewardFrenzy = (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
||||
}
|
||||
CM.Cache.LuckyRewardFrenzy = CM.Cache.GoldenCookiesMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
||||
CM.Cache.LuckyWrathRewardFrenzy = CM.Cache.WrathCookiesMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
||||
CM.Cache.Conjure = CM.Cache.Lucky * 2;
|
||||
CM.Cache.ConjureReward = CM.Cache.Conjure * 0.15;
|
||||
|
||||
CM.Cache.MaxChainMoni = function(digit, maxPayout) {
|
||||
var chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
|
||||
var moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit), maxPayout));
|
||||
var nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit), maxPayout));
|
||||
CM.Cache.Edifice = 0;
|
||||
let max = 0;
|
||||
let n = 0;
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||
if (Game.Objects[i].amount > 0) n++;
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
if ((Game.Objects[i].amount < max || n === 1)
|
||||
&& Game.Objects[i].amount < 400
|
||||
&& Game.Objects[i].price * 2 > CM.Cache.Edifice) {
|
||||
CM.Cache.Edifice = Game.Objects[i].price * 2;
|
||||
CM.Cache.EdificeBuilding = i;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
||||
* It is mostly used by CM.Cache.MaxChainCookieReward() and CM.Cache.CacheChain()
|
||||
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
||||
* @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies
|
||||
* @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies
|
||||
* @param {number} CM.Cache.DragonsFortuneMultAdjustment Multiplier for dragon fortune + active golden cookie
|
||||
*/
|
||||
CM.Cache.CacheGoldenAndWrathCookiesMults = function () {
|
||||
if (CM.Footer.isInitzializing) {
|
||||
CM.Cache.GoldenCookiesMult = 1;
|
||||
CM.Cache.WrathCookiesMult = 1;
|
||||
CM.Cache.DragonsFortuneMultAdjustment = 1;
|
||||
} else {
|
||||
let goldenMult = 1;
|
||||
let wrathMult = 1;
|
||||
let mult = 1;
|
||||
|
||||
// Factor auras and upgrade in mults
|
||||
if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01;
|
||||
if (CM.Sim.Has('Dragon fang')) mult *= 1.03;
|
||||
|
||||
goldenMult *= 1 + Game.auraMult('Ancestral Metamorphosis') * 0.1;
|
||||
goldenMult *= Game.eff('goldenCookieGain');
|
||||
wrathMult *= 1 + Game.auraMult('Unholy Dominion') * 0.1;
|
||||
wrathMult *= Game.eff('wrathCookieGain');
|
||||
|
||||
// Calculate final golden and wrath multipliers
|
||||
CM.Cache.GoldenCookiesMult = mult * goldenMult;
|
||||
CM.Cache.WrathCookiesMult = mult * wrathMult;
|
||||
|
||||
// Calculate Dragon's Fortune multiplier adjustment:
|
||||
// If Dragon's Fortune (or Reality Bending) aura is active and there are currently no golden cookies,
|
||||
// compute a multiplier adjustment to apply on the current CPS to simulate 1 golden cookie on screen.
|
||||
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
|
||||
CM.Cache.DragonsFortuneMultAdjustment = 1;
|
||||
if (Game.shimmerTypes.golden.n === 0) {
|
||||
CM.Cache.DragonsFortuneMultAdjustment *= 1 + Game.auraMult('Dragon\'s Fortune') * 1.23;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions calculates the max possible payout given a set of variables
|
||||
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
||||
* @param {number} digit Number of Golden Cookies in chain
|
||||
* @param {number} maxPayout Maximum payout
|
||||
* @param {number} mult Multiplier
|
||||
* @returns [{number, number, number}] Total cookies earned, cookie needed for this and next level
|
||||
*/
|
||||
CM.Cache.MaxChainCookieReward = function (digit, maxPayout, mult) {
|
||||
let totalFromChain = 0;
|
||||
let moni = 0;
|
||||
let nextMoni = 0;
|
||||
let nextRequired = 0;
|
||||
let chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
|
||||
while (nextMoni < maxPayout) {
|
||||
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** chain * digit * mult), maxPayout * mult));
|
||||
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult), maxPayout * mult));
|
||||
nextRequired = Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult);
|
||||
totalFromChain += moni;
|
||||
chain++;
|
||||
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit), maxPayout));
|
||||
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit), maxPayout));
|
||||
}
|
||||
return moni;
|
||||
}
|
||||
return [totalFromChain, moni, nextRequired];
|
||||
};
|
||||
|
||||
CM.Cache.RemakeChain = function() {
|
||||
var maxPayout = Game.cookiesPs * 60 * 60 * 6;
|
||||
if (Game.frenzy > 0) {
|
||||
maxPayout /= Game.frenzyPower;
|
||||
}
|
||||
/**
|
||||
* This functions caches data related to Chain Cookies reward from Golden Cookioes
|
||||
* It is called by CM.Main.Loop() upon changes to cps and CM.Cache.InitCache()
|
||||
* @global [{number, number}] CM.Cache.ChainMaxReward Total cookies earned, and cookies needed for next level for normal chain
|
||||
* @global {number} CM.Cache.ChainRequired Cookies needed for maximum reward for normal chain
|
||||
* @global {number} CM.Cache.ChainRequiredNext Total cookies needed for next level for normal chain
|
||||
* @global [{number, number}] CM.Cache.ChainMaxWrathReward Total cookies earned, and cookies needed for next level for wrath chain
|
||||
* @global {number} CM.Cache.ChainWrathRequired Cookies needed for maximum reward for wrath chain
|
||||
* @global {number} CM.Cache.ChainWrathRequiredNext Total cookies needed for next level for wrath chain
|
||||
* @global [{number, number}] CM.Cache.ChainFrenzyMaxReward Total cookies earned, and cookies needed for next level for normal frenzy chain
|
||||
* @global {number} CM.Cache.ChainFrenzyRequired Cookies needed for maximum reward for normal frenzy chain
|
||||
* @global {number} CM.Cache.ChainFrenzyRequiredNext Total cookies needed for next level for normal frenzy chain
|
||||
* @global [{number, number}] CM.Cache.ChainFrenzyWrathMaxReward Total cookies earned, and cookies needed for next level for wrath frenzy chain
|
||||
* @global {number} CM.Cache.ChainFrenzyWrathRequired Cookies needed for maximum reward for wrath frenzy chain
|
||||
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
|
||||
*/
|
||||
CM.Cache.CacheChain = function () {
|
||||
let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment;
|
||||
// Removes effect of Frenzy etc.
|
||||
const cpsBuffMult = CM.Cache.getCPSBuffMult();
|
||||
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
||||
else maxPayout = 0;
|
||||
|
||||
CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout);
|
||||
CM.Cache.ChainMaxReward = CM.Cache.MaxChainCookieReward(7, maxPayout, CM.Cache.GoldenCookiesMult);
|
||||
CM.Cache.ChainRequired = CM.Cache.ChainMaxReward[1] * 2 / CM.Cache.GoldenCookiesMult;
|
||||
CM.Cache.ChainRequiredNext = CM.Cache.ChainMaxReward[2] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
|
||||
|
||||
CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout);
|
||||
CM.Cache.ChainMaxWrathReward = CM.Cache.MaxChainCookieReward(6, maxPayout, CM.Cache.WrathCookiesMult);
|
||||
CM.Cache.ChainWrathRequired = CM.Cache.ChainMaxWrathReward[1] * 2 / CM.Cache.WrathCookiesMult;
|
||||
CM.Cache.ChainWrathRequiredNext = CM.Cache.ChainMaxWrathReward[2] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
|
||||
|
||||
var base = 0;
|
||||
if (CM.Cache.ChainReward > CM.Cache.ChainWrathReward) {
|
||||
base = CM.Cache.ChainReward;
|
||||
}
|
||||
else {
|
||||
base = CM.Cache.ChainWrathReward;
|
||||
}
|
||||
if (maxPayout < base) {
|
||||
CM.Cache.Chain = 0;
|
||||
}
|
||||
else {
|
||||
CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25;
|
||||
}
|
||||
CM.Cache.ChainFrenzyMaxReward = CM.Cache.MaxChainCookieReward(7, maxPayout * 7, CM.Cache.GoldenCookiesMult);
|
||||
CM.Cache.ChainFrenzyRequired = CM.Cache.ChainFrenzyMaxReward[1] * 2 / CM.Cache.GoldenCookiesMult;
|
||||
CM.Cache.ChainFrenzyRequiredNext = CM.Cache.ChainFrenzyMaxReward[2] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
|
||||
|
||||
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7);
|
||||
CM.Cache.ChainFrenzyMaxWrathReward = CM.Cache.MaxChainCookieReward(6, maxPayout * 7, CM.Cache.WrathCookiesMult);
|
||||
CM.Cache.ChainFrenzyWrathRequired = CM.Cache.ChainFrenzyMaxWrathReward[1] * 2 / CM.Cache.WrathCookiesMult;
|
||||
CM.Cache.ChainFrenzyWrathRequiredNext = CM.Cache.ChainFrenzyMaxWrathReward[2] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
|
||||
};
|
||||
|
||||
CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7);
|
||||
/**
|
||||
* This functions caches variables related to missing upgrades
|
||||
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
||||
* @global {string} CM.Cache.MissingUpgrades String containig the HTML to create the "crates" for missing normal upgrades
|
||||
* @global {string} CM.Cache.MissingUpgradesCookies String containig the HTML to create the "crates" for missing cookie upgrades
|
||||
* @global {string} CM.Cache.MissingUpgradesPrestige String containig the HTML to create the "crates" for missing prestige upgrades
|
||||
*/
|
||||
CM.Cache.CacheMissingUpgrades = function () {
|
||||
CM.Cache.MissingUpgrades = '';
|
||||
CM.Cache.MissingUpgradesCookies = '';
|
||||
CM.Cache.MissingUpgradesPrestige = '';
|
||||
const list = [];
|
||||
// sort the upgrades
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
list.push(Game.Upgrades[i]);
|
||||
}
|
||||
const sortMap = function (a, b) {
|
||||
if (a.order > b.order) return 1;
|
||||
else if (a.order < b.order) return -1;
|
||||
return 0;
|
||||
};
|
||||
list.sort(sortMap);
|
||||
|
||||
if (CM.Cache.ChainFrenzyReward > CM.Cache.ChainFrenzyWrathReward) {
|
||||
base = CM.Cache.ChainFrenzyReward;
|
||||
}
|
||||
else {
|
||||
base = CM.Cache.ChainFrenzyWrathReward;
|
||||
}
|
||||
if ((maxPayout * 7) < base) {
|
||||
CM.Cache.ChainFrenzy = 0;
|
||||
}
|
||||
else {
|
||||
CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25;
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(list)) {
|
||||
const me = list[i];
|
||||
|
||||
CM.Cache.RemakeSeaSpec = function() {
|
||||
if (Game.season == 'christmas') {
|
||||
CM.Cache.SeaSpec = Math.max(25, Game.cookiesPs * 60 * 1);
|
||||
if (me.bought === 0) {
|
||||
let str = '';
|
||||
|
||||
str += CM.Disp.crateMissing(me);
|
||||
if (me.pool === 'prestige') CM.Cache.MissingUpgradesPrestige += str;
|
||||
else if (me.pool === 'cookie') CM.Cache.MissingUpgradesCookies += str;
|
||||
else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug') CM.Cache.MissingUpgrades += str;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the reward of popping a reindeer
|
||||
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
||||
* @global {number} CM.Cache.SeaSpec The reward for popping a reindeer
|
||||
*/
|
||||
CM.Cache.CacheSeaSpec = function () {
|
||||
if (Game.season === 'christmas') {
|
||||
let val = Game.cookiesPs * 60;
|
||||
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
|
||||
if (Game.hasBuff('Frenzy')) val *= 0.75;
|
||||
CM.Cache.SeaSpec = Math.max(25, val);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CM.Cache.SeaSpec *= 2;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CM.Cache.RemakeSellAllTotal = function() {
|
||||
var sellTotal = 0;
|
||||
for (var i in Game.Objects) {
|
||||
var me = Game.Objects[i];
|
||||
sellTotal += CM.Sim.BuildingSell(me.basePrice, me.amount, me.amount);
|
||||
/**
|
||||
* This functions caches the heavenly chips per second in the last five seconds
|
||||
* It is called by CM.Cache.LoopCache()
|
||||
* @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds
|
||||
*/
|
||||
CM.Cache.CacheHeavenlyChipsPS = function () {
|
||||
CM.Cache.HCPerSecond = 0; // Mainly there to not throw errors during initialization
|
||||
const currDate = Math.floor(Date.now() / 1000);
|
||||
// Only calculate every new second
|
||||
if ((Game.T / Game.fps) % 1 === 0) {
|
||||
const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset);
|
||||
const ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned);
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
const timeDiff = currDate - CM.Cache.lastHeavenlyCheck;
|
||||
const heavenlyChipsDiffAvg = Math.max(0, (ascendNowToGet - CM.Cache.lastHeavenlyChips)) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
CM.Cache.HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
|
||||
}
|
||||
|
||||
// Store current data for next loop
|
||||
CM.Cache.lastHeavenlyCheck = currDate;
|
||||
CM.Cache.lastHeavenlyChips = ascendNowToGet;
|
||||
|
||||
// Get average gain over period of 5 seconds
|
||||
CM.Cache.HCPerSecond = CM.Cache.HeavenlyChipsDiff.calcAverage(5);
|
||||
}
|
||||
CM.Cache.SellAllTotal = sellTotal;
|
||||
}
|
||||
};
|
||||
|
||||
CM.Cache.Lucky = 0;
|
||||
CM.Cache.LuckyReward = 0;
|
||||
CM.Cache.LuckyFrenzy = 0;
|
||||
CM.Cache.LuckyRewardFrenzy = 0;
|
||||
CM.Cache.SeaSpec = 0;
|
||||
CM.Cache.Chain = 0;
|
||||
CM.Cache.ChainReward = 0;
|
||||
CM.Cache.ChainWrathReward = 0;
|
||||
CM.Cache.ChainFrenzy = 0;
|
||||
CM.Cache.ChainFrenzyReward = 0;
|
||||
CM.Cache.ChainFrenzyWrathReward = 0;
|
||||
CM.Cache.SellAllTotal = 0;
|
||||
/**
|
||||
* Section: Functions related to caching CPS */
|
||||
|
||||
/**
|
||||
* This functions caches creates the CMAvgQueue used by CM.Cache.CacheAvgCPS() to calculate CPS
|
||||
* Called by CM.Cache.InitCache()
|
||||
*/
|
||||
CM.Cache.InitCookiesDiff = function () {
|
||||
CM.Cache.CookiesDiff = new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length - 1]);
|
||||
CM.Cache.WrinkDiff = new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length - 1]);
|
||||
CM.Cache.WrinkFattestDiff = new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length - 1]);
|
||||
CM.Cache.ChoEggDiff = new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length - 1]);
|
||||
CM.Cache.ClicksDiff = new CMAvgQueue(CM.Disp.clickTimes[CM.Disp.clickTimes.length - 1]);
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches two variables related average CPS and Clicks
|
||||
* It is called by CM.Cache.LoopCache()
|
||||
* @global {number} CM.Cache.RealCookiesEarned Cookies earned including the Chocolate Egg
|
||||
* @global {number} CM.Cache.AvgCPS Average cookies over time-period as defined by AvgCPSHist
|
||||
* @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist
|
||||
* @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS
|
||||
*/
|
||||
CM.Cache.CacheAvgCPS = function () {
|
||||
const currDate = Math.floor(Date.now() / 1000);
|
||||
// Only calculate every new second
|
||||
if ((Game.T / Game.fps) % 1 === 0) {
|
||||
let choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
|
||||
if (Game.cpsSucked > 0) choEggTotal += CM.Cache.WrinklersTotal;
|
||||
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
||||
choEggTotal *= 0.05;
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
const timeDiff = currDate - CM.Cache.lastCPSCheck;
|
||||
const bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff;
|
||||
const wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff;
|
||||
const wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff;
|
||||
const choEggDiffAvg = Math.max(0, (choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
|
||||
const clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
CM.Cache.CookiesDiff.addLatest(bankDiffAvg);
|
||||
CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg);
|
||||
CM.Cache.WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
||||
CM.Cache.ChoEggDiff.addLatest(choEggDiffAvg);
|
||||
CM.Cache.ClicksDiff.addLatest(clicksDiffAvg);
|
||||
}
|
||||
|
||||
// Store current data for next loop
|
||||
CM.Cache.lastCPSCheck = currDate;
|
||||
CM.Cache.lastCookies = Game.cookies;
|
||||
CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
|
||||
CM.Cache.lastWrinkFattestCookies = CM.Cache.WrinklersFattest[0];
|
||||
CM.Cache.lastChoEgg = choEggTotal;
|
||||
CM.Cache.lastClicks = Game.cookieClicks;
|
||||
|
||||
// Get average gain over period of cpsLength seconds
|
||||
const cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist];
|
||||
CM.Cache.AverageGainBank = CM.Cache.CookiesDiff.calcAverage(cpsLength);
|
||||
CM.Cache.AverageGainWrink = CM.Cache.WrinkDiff.calcAverage(cpsLength);
|
||||
CM.Cache.AverageGainWrinkFattest = CM.Cache.WrinkFattestDiff.calcAverage(cpsLength);
|
||||
CM.Cache.AverageGainChoEgg = CM.Cache.ChoEggDiff.calcAverage(cpsLength);
|
||||
CM.Cache.AvgCPS = CM.Cache.AverageGainBank;
|
||||
if (CM.Options.CalcWrink === 1) CM.Cache.AvgCPS += CM.Cache.AverageGainWrink;
|
||||
if (CM.Options.CalcWrink === 2) CM.Cache.AvgCPS += CM.Cache.AverageGainWrinkFattest;
|
||||
|
||||
const choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
|
||||
|
||||
if (choEgg || CM.Options.CalcWrink === 0) {
|
||||
CM.Cache.AvgCPSWithChoEgg = CM.Cache.AverageGainBank + CM.Cache.AverageGainWrink + (choEgg ? CM.Cache.AverageGainChoEgg : 0);
|
||||
} else CM.Cache.AvgCPSWithChoEgg = CM.Cache.AvgCPS;
|
||||
|
||||
CM.Cache.AverageClicks = CM.Cache.ClicksDiff.calcAverage(CM.Disp.clickTimes[CM.Options.AvgClicksHist]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the reward for selling the Chocolate egg
|
||||
* It is called by CM.Main.Loop()
|
||||
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
|
||||
*/
|
||||
CM.Cache.CacheSellForChoEgg = function () {
|
||||
let sellTotal = 0;
|
||||
// Compute cookies earned by selling stock market goods
|
||||
if (Game.Objects.Bank.minigameLoaded) {
|
||||
const marketGoods = Game.Objects.Bank.minigame.goods;
|
||||
let goodsVal = 0;
|
||||
for (const i of Object.keys(marketGoods)) {
|
||||
const marketGood = marketGoods[i];
|
||||
goodsVal += marketGood.stock * marketGood.val;
|
||||
}
|
||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
sellTotal += CM.Sim.SellBuildingsForChoEgg();
|
||||
CM.Cache.SellForChoEgg = sellTotal;
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the current Wrinkler CPS multiplier
|
||||
* It is called by CM.Cache.LoopCache(). Variables are mostly used by CM.Disp.GetCPS().
|
||||
* @global {number} CM.Cache.CurrWrinklerCount Current number of wrinklers
|
||||
* @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect)
|
||||
*/
|
||||
CM.Cache.CacheCurrWrinklerCPS = function () {
|
||||
CM.Cache.CurrWrinklerCPSMult = 0;
|
||||
let count = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) count++;
|
||||
}
|
||||
let godMult = 1;
|
||||
if (CM.Sim.Objects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
if (godLvl === 1) godMult *= 1.15;
|
||||
else if (godLvl === 2) godMult *= 1.1;
|
||||
else if (godLvl === 3) godMult *= 1.05;
|
||||
}
|
||||
CM.Cache.CurrWrinklerCount = count;
|
||||
CM.Cache.CurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function returns the current CPS buff
|
||||
* It is called by CM.Sim.CalculateGains(), CM.Disp.UpdateTooltipWarnings(), CM.Cache.CacheStats() and CM.Cache.CacheChain()
|
||||
* @returns {number} mult The multiplier
|
||||
*/
|
||||
CM.Cache.getCPSBuffMult = function () {
|
||||
let mult = 1;
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS;
|
||||
}
|
||||
return mult;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function calculates CPS without the Golden Switch as it might be needed in other functions
|
||||
* If so it CM.Sim.Win()'s them and the caller function will know to recall CM.Sim.CalculateGains()
|
||||
* It is called at the end of any functions that simulates certain behaviour
|
||||
*/
|
||||
CM.Cache.NoGoldSwitchCPS = function () {
|
||||
if (Game.Has('Golden switch [off]')) {
|
||||
CM.Cache.NoGoldSwitchCookiesPS = CM.Sim.NoGoldSwitchCPS();
|
||||
} else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to "Specials" (Dragon and Santa) */
|
||||
|
||||
/**
|
||||
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
|
||||
* It is called by the relevan tooltip-code as a result of CM.Disp.AddDragonLevelUpTooltip() and by CM.Main.Loop()
|
||||
* @global {number} CM.Cache.lastDragonLevel The last cached dragon level
|
||||
* @global {string} CM.Cache.CostDragonUpgrade The Beautified cost of the next upgrade
|
||||
*/
|
||||
CM.Cache.CacheDragonCost = function () {
|
||||
if (CM.Cache.lastDragonLevel !== Game.dragonLevel || CM.Sim.DoSims) {
|
||||
if (Game.dragonLevel < 25 && Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')) {
|
||||
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
|
||||
const amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
|
||||
if (target !== 'i') {
|
||||
target = target.replaceAll("'", '');
|
||||
if (Game.Objects[target].amount < amount) {
|
||||
CM.Cache.CostDragonUpgrade = 'Not enough buildings to sell';
|
||||
} else {
|
||||
let cost = 0;
|
||||
CM.Sim.CopyData();
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price = CM.Sim.Objects[target].basePrice * Game.priceIncrease ** Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free);
|
||||
price = Game.modifyBuildingPrice(CM.Sim.Objects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
CM.Sim.Objects[target].amount--;
|
||||
}
|
||||
CM.Cache.CostDragonUpgrade = `Cost to rebuy: ${CM.Disp.Beautify(cost)}`;
|
||||
}
|
||||
} else {
|
||||
let cost = 0;
|
||||
CM.Sim.CopyData();
|
||||
for (const j of Object.keys(Game.Objects)) {
|
||||
target = j;
|
||||
if (Game.Objects[target].amount < amount) {
|
||||
CM.Cache.CostDragonUpgrade = 'Not enough buildings to sell';
|
||||
break;
|
||||
} else {
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price = CM.Sim.Objects[target].basePrice * Game.priceIncrease ** Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free);
|
||||
price = Game.modifyBuildingPrice(CM.Sim.Objects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
CM.Sim.Objects[target].amount--;
|
||||
}
|
||||
}
|
||||
CM.Cache.CostDragonUpgrade = `Cost to rebuy: ${CM.Disp.Beautify(cost)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
CM.Cache.lastDragonLevel = Game.dragonLevel;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to caching income */
|
||||
|
||||
/**
|
||||
* This functions caches the income gain of each building and upgrade and stores it in the cache
|
||||
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
||||
*/
|
||||
CM.Cache.CacheIncome = function () {
|
||||
// Simulate Building Buys for 1, 10 and 100 amount
|
||||
CM.Cache.CacheBuildingIncome(1, 'Objects1');
|
||||
CM.Cache.CacheBuildingIncome(10, 'Objects10');
|
||||
CM.Cache.CacheBuildingIncome(100, 'Objects100');
|
||||
|
||||
// Simulate Upgrade Buys
|
||||
CM.Cache.CacheUpgradeIncome();
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions starts the calculation/simulation of the bonus income of buildings
|
||||
* It is called by CM.Cache.CacheIncome()
|
||||
* @param {amount} amount Amount to be bought
|
||||
* @parem {string} target The target Cache object ("Objects1", "Objects10" or "Objects100")
|
||||
*/
|
||||
CM.Cache.CacheBuildingIncome = function (amount, target) {
|
||||
CM.Cache[target] = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
CM.Cache[target][i] = {};
|
||||
CM.Cache[target][i].bonus = CM.Sim.BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CM.Cache.DoRemakeBuildPrices = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions starts the calculation/simulation of the bonus income of upgrades
|
||||
* It is called by CM.Cache.CacheIncome()
|
||||
*/
|
||||
CM.Cache.CacheUpgradeIncome = function () {
|
||||
CM.Cache.Upgrades = [];
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
const bonusIncome = CM.Sim.BuyUpgradesBonusIncome(i);
|
||||
CM.Cache.Upgrades[i] = {};
|
||||
if (bonusIncome[0]) CM.Cache.Upgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CM.Cache.Upgrades[i].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to caching prices */
|
||||
|
||||
/**
|
||||
* This functions caches the price of each building and stores it in the cache
|
||||
* It is called by CM.Main.Loop() and CM.Cache.InitCache()
|
||||
*/
|
||||
CM.Cache.CacheBuildingsPrices = function () {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1);
|
||||
CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
|
||||
CM.Cache.Objects100[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to caching PP */
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building and upgrade and stores it in the cache
|
||||
* It is called by CM.Cache.LoopCache() and CM.Cache.InitCache()
|
||||
*/
|
||||
CM.Cache.CachePP = function () {
|
||||
CM.Cache.CacheBuildingsPP();
|
||||
CM.Cache.CacheUpgradePP();
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions return the colour assosciated with the given pp value
|
||||
* It is called by CM.Cache.CacheBuildingsPP(), CM.Cache.CacheBuildingsBulkPP() and CM.Cache.CacheUpgradePP()
|
||||
* @params {object} obj The obj of which the pp value should be checked
|
||||
* @params {number} price The price of the object
|
||||
* @returns {string} color The colour assosciated with the pp value
|
||||
*/
|
||||
CM.Cache.ColourOfPP = function (me, price) {
|
||||
let color = '';
|
||||
// Colour based on PP
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = CM.Disp.colorGray;
|
||||
else if (me.pp < CM.Cache.min) color = CM.Disp.colorBlue;
|
||||
else if (me.pp === CM.Cache.min) color = CM.Disp.colorGreen;
|
||||
else if (me.pp === CM.Cache.max) color = CM.Disp.colorRed;
|
||||
else if (me.pp > CM.Cache.max) color = CM.Disp.colorPurple;
|
||||
else if (me.pp > CM.Cache.mid) color = CM.Disp.colorOrange;
|
||||
else color = CM.Disp.colorYellow;
|
||||
|
||||
// Colour based on price in terms of CPS
|
||||
if (Number(CM.Options.PPSecondsLowerLimit) !== 0) {
|
||||
if (price / CM.Disp.GetCPS() < Number(CM.Options.PPSecondsLowerLimit)) color = CM.Disp.colorBlue;
|
||||
}
|
||||
// Colour based on being able to purchase
|
||||
if (CM.Options.PPOnlyConsiderBuyable) {
|
||||
if (price - Game.cookies > 0) color = CM.Disp.colorRed;
|
||||
}
|
||||
return color;
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building it saves all date in CM.Cache.Objects...
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
CM.Cache.CacheBuildingsPP = function () {
|
||||
CM.Cache.min = Infinity;
|
||||
CM.Cache.max = 1;
|
||||
CM.Cache.ArrayOfPPs = [];
|
||||
if (typeof CM.Options.PPExcludeTop === 'undefined') CM.Options.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||
|
||||
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
||||
if (CM.Options.ColorPPBulkMode === 0) {
|
||||
for (const i of Object.keys(CM.Cache.Objects1)) {
|
||||
if (Game.cookiesPs) {
|
||||
CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||
} else CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||
CM.Cache.ArrayOfPPs.push([CM.Cache.Objects1[i].pp, Game.Objects[i].getPrice()]);
|
||||
}
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CM.Cache.ArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CM.Options.PPOnlyConsiderBuyable) {
|
||||
while (CM.Cache.ArrayOfPPs[0][1] > Game.cookies) {
|
||||
if (CM.Cache.ArrayOfPPs.length === 1) {
|
||||
break;
|
||||
}
|
||||
CM.Cache.ArrayOfPPs.shift();
|
||||
}
|
||||
}
|
||||
CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];
|
||||
CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1][0];
|
||||
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||
for (const i of Object.keys(CM.Cache.Objects1)) {
|
||||
CM.Cache.Objects1[i].color = CM.Cache.ColourOfPP(CM.Cache.Objects1[i], Game.Objects[i].getPrice());
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CM.Options.PPExcludeTop; j++) {
|
||||
if (CM.Cache.Objects1[i].pp === CM.Cache.ArrayOfPPs[j][0]) CM.Cache.Objects1[i].color = CM.Disp.colorGray;
|
||||
}
|
||||
}
|
||||
// Calculate PP of bulk-buy modes
|
||||
CM.Cache.CacheBuildingsBulkPP('Objects10');
|
||||
CM.Cache.CacheBuildingsBulkPP('Objects100');
|
||||
} else {
|
||||
// Calculate PP and colors when compared to purchase of selected bulk mode
|
||||
const target = `Objects${Game.buyBulk}`;
|
||||
for (const i of Object.keys(CM.Cache[target])) {
|
||||
if (Game.cookiesPs) {
|
||||
CM.Cache[target][i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
||||
} else CM.Cache[target][i].pp = (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
||||
CM.Cache.ArrayOfPPs.push([CM.Cache[target][i].pp, Game.Objects[i].bulkPrice]);
|
||||
}
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CM.Cache.ArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CM.Options.PPOnlyConsiderBuyable) {
|
||||
while (CM.Cache.ArrayOfPPs[0][1] > Game.cookies) {
|
||||
if (CM.Cache.ArrayOfPPs.length === 1) {
|
||||
break;
|
||||
}
|
||||
CM.Cache.ArrayOfPPs.shift();
|
||||
}
|
||||
}
|
||||
CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];
|
||||
CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1][0];
|
||||
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||
|
||||
for (const i of Object.keys(CM.Cache.Objects1)) {
|
||||
CM.Cache[target][i].color = CM.Cache.ColourOfPP(CM.Cache[target][i], Game.Objects[i].bulkPrice);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CM.Options.PPExcludeTop; j++) {
|
||||
if (CM.Cache[target][i].pp === CM.Cache.ArrayOfPPs[j][0]) CM.Cache[target][i].color = CM.Disp.colorGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
|
||||
* It saves all date in CM.Cache.Objects...
|
||||
* It is called by CM.Cache.CacheBuildingsPP()
|
||||
*/
|
||||
CM.Cache.CacheBuildingsBulkPP = function (target) {
|
||||
for (const i of Object.keys(CM.Cache[target])) {
|
||||
if (Game.cookiesPs) {
|
||||
CM.Cache[target][i].pp = (Math.max(CM.Cache[target][i].price - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
|
||||
} else CM.Cache[target][i].pp = (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
|
||||
|
||||
CM.Cache[target][i].color = CM.Cache.ColourOfPP(CM.Cache[target][i], CM.Cache[target][i].price);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
CM.Cache.CacheUpgradePP = function () {
|
||||
for (const i of Object.keys(CM.Cache.Upgrades)) {
|
||||
if (Game.cookiesPs) {
|
||||
CM.Cache.Upgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
|
||||
} else CM.Cache.Upgrades[i].pp = (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
|
||||
if (Number.isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = Infinity;
|
||||
|
||||
CM.Cache.Upgrades[i].color = CM.Cache.ColourOfPP(CM.Cache.Upgrades[i], Game.Upgrades[i].getPrice());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Cached variables */
|
||||
|
||||
/**
|
||||
* Used to store the multiplier of the Century Egg
|
||||
*/
|
||||
CM.Cache.CentEgg = 0;
|
||||
|
||||
/**
|
||||
* Used to store if there was a Build Aura (used in CM.Main)
|
||||
*/
|
||||
CM.Cache.HadBuildAura = false;
|
||||
|
||||
/**
|
||||
* Used to store CPS without Golden Cookie Switch
|
||||
*/
|
||||
CM.Cache.NoGoldSwitchCookiesPS = 0;
|
||||
|
||||
258
src/Config.js
258
src/Config.js
@@ -1,131 +1,175 @@
|
||||
/**********
|
||||
/**
|
||||
* Config *
|
||||
**********/
|
||||
*/
|
||||
|
||||
CM.SaveConfig = function(config) {
|
||||
localStorage.setItem(CM.ConfigPrefix, JSON.stringify(config));
|
||||
}
|
||||
/**
|
||||
* Section: Functions related to saving, loading and restoring configs */
|
||||
|
||||
CM.LoadConfig = function() {
|
||||
if (localStorage.getItem(CM.ConfigPrefix) != null) {
|
||||
CM.Config = JSON.parse(localStorage.getItem(CM.ConfigPrefix));
|
||||
/**
|
||||
* This function saves the config of CookieMonster without saving any of the other save-data
|
||||
* This allows saving in between the autosave intervals
|
||||
* It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(),
|
||||
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
||||
*/
|
||||
CM.Config.SaveConfig = function () {
|
||||
const saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]);
|
||||
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
||||
if (CookieMonsterSave !== null) {
|
||||
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${CM.save()}`);
|
||||
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function loads the config of CookieMonster saved in localStorage and loads it into CM.Options
|
||||
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
|
||||
*/
|
||||
CM.Config.LoadConfig = function (settings) {
|
||||
// This removes cookies left from earlier versions of CookieMonster
|
||||
if (typeof localStorage.CMConfig !== 'undefined') {
|
||||
delete localStorage.CMConfig;
|
||||
}
|
||||
if (settings !== undefined) {
|
||||
CM.Options = settings;
|
||||
|
||||
// Check values
|
||||
var mod = false;
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (typeof CM.Config[i] === 'undefined') {
|
||||
let mod = false;
|
||||
for (const i in CM.Data.ConfigDefault) {
|
||||
if (typeof CM.Options[i] === 'undefined') {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
else if (i != 'StatsPref' && i != 'Colors') {
|
||||
if (i.indexOf('SoundURL') == -1) {
|
||||
if (!(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) {
|
||||
CM.Options[i] = CM.Data.ConfigDefault[i];
|
||||
} else if (i !== 'Header' && i !== 'Colors') {
|
||||
if (i.indexOf('SoundURL') === -1) {
|
||||
if (!(CM.Options[i] > -1 && CM.Options[i] < CM.Data.Config[i].label.length)) {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
CM.Options[i] = CM.Data.ConfigDefault[i];
|
||||
}
|
||||
} else if (typeof CM.Options[i] !== 'string') { // Sound URLs
|
||||
mod = true;
|
||||
CM.Options[i] = CM.Data.ConfigDefault[i];
|
||||
}
|
||||
} else if (i === 'Header') {
|
||||
for (const j in CM.Data.ConfigDefault.Header) {
|
||||
if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) {
|
||||
mod = true;
|
||||
CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
|
||||
}
|
||||
}
|
||||
else { // Sound URLs
|
||||
if (typeof CM.Config[i] != 'string') {
|
||||
} else { // Colors
|
||||
for (const j in CM.Data.ConfigDefault.Colors) {
|
||||
if (typeof CM.Options[i][j] === 'undefined' || typeof CM.Options[i][j] !== 'string') {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (i == 'StatsPref') {
|
||||
for (var j in CM.ConfigDefault.StatsPref) {
|
||||
if (typeof CM.Config[i][j] === 'undefined' || !(CM.Config[i][j] > -1 && CM.Config[i][j] < 2)) {
|
||||
mod = true;
|
||||
CM.Config[i][j] = CM.ConfigDefault[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Colors
|
||||
for (var j in CM.ConfigDefault.StatsPref) {
|
||||
if (typeof CM.Config[i][j] === 'undefined' || typeof CM.Config[i][j] != 'string') {
|
||||
mod = true;
|
||||
CM.Config[i][j] = CM.ConfigDefault[i][j];
|
||||
CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mod) CM.SaveConfig(CM.Config);
|
||||
CM.Loop(); // Do loop once
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (i != 'StatsPref' && typeof CM.ConfigData[i].func !== 'undefined') {
|
||||
CM.ConfigData[i].func();
|
||||
if (mod) CM.Config.SaveConfig();
|
||||
CM.Main.Loop(); // Do loop once
|
||||
for (const i in CM.Data.ConfigDefault) {
|
||||
if (i !== 'Header' && typeof CM.Data.Config[i].func !== 'undefined') {
|
||||
CM.Data.Config[i].func();
|
||||
}
|
||||
}
|
||||
} else { // Default values
|
||||
CM.Config.RestoreDefault();
|
||||
}
|
||||
else { // Default values
|
||||
CM.RestoreDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CM.RestoreDefault = function() {
|
||||
CM.Config = {};
|
||||
CM.SaveConfig(CM.ConfigDefault);
|
||||
CM.LoadConfig();
|
||||
/**
|
||||
* This function reloads and resaves the default config as stored in CM.Data.ConfigDefault
|
||||
* It is called by resDefBut.onclick loaded in the options page or by CM.Config.LoadConfig if no localStorage is found
|
||||
*/
|
||||
CM.Config.RestoreDefault = function () {
|
||||
CM.Config.LoadConfig(CM.Data.ConfigDefault);
|
||||
CM.Config.SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
}
|
||||
};
|
||||
|
||||
CM.ToggleConfigUp = function(config) {
|
||||
CM.Config[config]++;
|
||||
if (CM.Config[config] == CM.ConfigData[config].label.length) {
|
||||
CM.Config[config] = 0;
|
||||
}
|
||||
if (typeof CM.ConfigData[config].func !== 'undefined') {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
/**
|
||||
* Section: Functions related to toggling or changing configs */
|
||||
|
||||
CM.ToggleConfigDown = function(config) {
|
||||
CM.Config[config]--;
|
||||
if (CM.Config[config] < 0) {
|
||||
CM.Config[config] = CM.ConfigData[config].label.length - 1;
|
||||
}
|
||||
if (typeof CM.ConfigData[config].func !== 'undefined') {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
/**
|
||||
* This function toggles options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of options of the "bool" type
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
CM.Config.ToggleConfig = function (config) {
|
||||
CM.Options[config]++;
|
||||
|
||||
CM.ToggleStatsConfig = function(config) {
|
||||
if (CM.Config.StatsPref[config] == 0) {
|
||||
CM.Config.StatsPref[config]++;
|
||||
}
|
||||
else {
|
||||
CM.Config.StatsPref[config]--;
|
||||
}
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
if (CM.Options[config] === CM.Data.Config[config].label.length) {
|
||||
CM.Options[config] = 0;
|
||||
if (CM.Data.Config[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
|
||||
} else l(CM.Config.ConfigPrefix + config).className = 'option';
|
||||
|
||||
CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}};
|
||||
CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}};
|
||||
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', func: function() {CM.Disp.ToggleTimerBarPos();}};
|
||||
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}};
|
||||
CM.ConfigData.Colors = {desc: {Blue: 'Color for better than best BCI building', Green: 'Color for best BCI building', Yellow: 'Color for between best and worst BCI buildings closer to best', Orange: 'Color for between best and worst BCI buildings closer to worst', Red: 'Color for worst BCI building', Purple: 'Color for worse than worst BCI building', Gray: 'Color for negative or infinity BCI'}, func: function() {CM.Disp.UpdateColors();}};
|
||||
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'};
|
||||
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup'};
|
||||
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.Volume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
|
||||
CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'};
|
||||
CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', func: function() {CM.Disp.ToggleGCTimer();}};
|
||||
CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'};
|
||||
CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'};
|
||||
CM.ConfigData.TooltipAmor = {label: ['Tooltip Amortization Information OFF', 'Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip'};
|
||||
CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}};
|
||||
CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}};
|
||||
CM.ConfigData.ToolWarnCautBon = {label: ['Calculate Tooltip Warning/Caution With Bonus CPS OFF', 'Calculate Tooltip Warning/Caution With Bonus CPS ON'], desc: 'Calculate the warning/caution with or without the bonus CPS you get from buying'};
|
||||
CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it'};
|
||||
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'};
|
||||
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds'};
|
||||
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}};
|
||||
CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation'], desc: 'Change how long numbers are handled', func: function() {CM.Disp.RefreshScale();}};
|
||||
if (typeof CM.Data.Config[config].func !== 'undefined') {
|
||||
CM.Data.Config[config].func();
|
||||
}
|
||||
|
||||
l(CM.Config.ConfigPrefix + config).innerHTML = CM.Data.Config[config].label[CM.Options[config]];
|
||||
CM.Config.SaveConfig();
|
||||
};
|
||||
|
||||
/**
|
||||
* This function sets the value of the specified volume-option and updates the display in the options menu
|
||||
* It is called by the oninput and onchange event of "vol" type options
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
CM.Config.ToggleConfigVolume = function (config) {
|
||||
if (l(`slider${config}`) !== null) {
|
||||
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
|
||||
CM.Options[config] = Math.round(l(`slider${config}`).value);
|
||||
}
|
||||
CM.Config.SaveConfig();
|
||||
};
|
||||
|
||||
/**
|
||||
* This function toggles header options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of the +/- next to headers
|
||||
* @param {string} config The name of the header
|
||||
*/
|
||||
CM.Config.ToggleHeader = function (config) {
|
||||
CM.Options.Header[config]++;
|
||||
if (CM.Options.Header[config] > 1) CM.Options.Header[config] = 0;
|
||||
CM.Config.SaveConfig();
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to notifications */
|
||||
|
||||
/**
|
||||
* This function checks if the user has given permissions for notifications
|
||||
* It is called by a change in any of the notification options
|
||||
* Note that most browsers will stop asking if the user has ignored the prompt around 6 times
|
||||
* @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1)
|
||||
*/
|
||||
CM.Config.CheckNotificationPermissions = function (ToggleOnOff) {
|
||||
if (ToggleOnOff === 1) {
|
||||
// Check if browser support Promise version of Notification Permissions
|
||||
const checkNotificationPromise = function () {
|
||||
try {
|
||||
Notification.requestPermission().then();
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// Check if the browser supports notifications and which type
|
||||
if (!('Notification' in window)) {
|
||||
console.log('This browser does not support notifications.');
|
||||
} else if (checkNotificationPromise()) {
|
||||
Notification.requestPermission().then();
|
||||
} else {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Variables used in Config functions */
|
||||
|
||||
/**
|
||||
* Used to name certain DOM elements and refer to them
|
||||
*/
|
||||
CM.Config.ConfigPrefix = 'CMConfig';
|
||||
|
||||
570
src/Data.js
570
src/Data.js
@@ -1,8 +1,572 @@
|
||||
/********
|
||||
/**
|
||||
* Data *
|
||||
********/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Section: Data used in the stats page to show not yet purchased updates. See CM.Disp.CreateStatsMissDisp() */
|
||||
|
||||
CM.Data.Fortunes = [
|
||||
'Fortune #001',
|
||||
'Fortune #002',
|
||||
'Fortune #003',
|
||||
'Fortune #004',
|
||||
'Fortune #005',
|
||||
'Fortune #006',
|
||||
'Fortune #007',
|
||||
'Fortune #008',
|
||||
'Fortune #009',
|
||||
'Fortune #010',
|
||||
'Fortune #011',
|
||||
'Fortune #012',
|
||||
'Fortune #013',
|
||||
'Fortune #014',
|
||||
'Fortune #015',
|
||||
'Fortune #016',
|
||||
'Fortune #017',
|
||||
'Fortune #018',
|
||||
'Fortune #100',
|
||||
'Fortune #101',
|
||||
'Fortune #102',
|
||||
'Fortune #103',
|
||||
'Fortune #104',
|
||||
];
|
||||
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
|
||||
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
|
||||
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits'];
|
||||
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits'];
|
||||
CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup'];
|
||||
|
||||
/**
|
||||
* Section: All possible effects plants and other items can have with an explanation */
|
||||
|
||||
CM.Data.Effects = {
|
||||
buildingCost: 'Building prices',
|
||||
click: 'Cookies per click',
|
||||
cps: 'Total CPS',
|
||||
cursorCps: 'Cursor CPS',
|
||||
goldenCookieDur: 'Golden cookie duration',
|
||||
goldenCookieEffDur: 'Golden cookie effect duration',
|
||||
goldenCookieFreq: 'Golden cookie frequency',
|
||||
goldenCookieGain: 'Golden cookie gains',
|
||||
grandmaCps: 'Grandma CPS',
|
||||
itemDrops: 'Random item drop chance',
|
||||
milk: 'Effect from milk',
|
||||
reindeerDur: 'Reindeer duration',
|
||||
reindeerFreq: 'Reindeer frequency',
|
||||
reindeerGain: 'Reindeer gains',
|
||||
upgradeCost: 'Upgrade prices',
|
||||
wrathCookieDur: 'Wrath cookie duration',
|
||||
wrathCookieEffDur: 'Wrath cookie effect duration',
|
||||
wrathCookieFreq: 'Wrath cookie frequency',
|
||||
wrathCookieGain: 'Wrath cookie gains',
|
||||
wrinklerEat: 'Wrinkler ',
|
||||
wrinklerSpawn: 'Wrinkler spawn frequency',
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Data for the various scales used by CookieMonster */
|
||||
|
||||
CM.Data.metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
CM.Data.shortScale = ['', '', 'M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec', 'Quattuordec', 'Quindec', 'Sexdec', 'Septendec', 'Octodec', 'Novemdec', 'Vigint', 'Unvigint', 'Duovigint', 'Trevigint', 'Quattuorvigint'];
|
||||
CM.Data.shortScaleAbbreviated = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'De',
|
||||
'UDe', 'DDe', 'TDe', 'QaDe', 'QiDe', 'SxDe', 'SpDe', 'ODe', 'NDe', 'Vi',
|
||||
'UVi', 'DVi', 'TVi', 'QaVi', 'QiVi', 'SxVi', 'SpVi', 'OVi', 'NVi', 'Tr',
|
||||
'UTr', 'DTr', 'TTr', 'QaTr', 'QiTr', 'SxTr', 'SpTr', 'OTr', 'NTr', 'Qaa',
|
||||
'UQa', 'DQa', 'TQa', 'QaQa', 'QiQa', 'SxQa', 'SpQa', 'OQa', 'NQa', 'Qia',
|
||||
'UQi', 'DQi', 'TQi', 'QaQi', 'QiQi', 'SxQi', 'SpQi', 'OQi', 'NQi', 'Sxa',
|
||||
'USx', 'DSx', 'TSx', 'QaSx', 'QiSx', 'SxSx', 'SpSx', 'OSx', 'NSx', 'Spa',
|
||||
'USp', 'DSp', 'TSp', 'QaSp', 'QiSp', 'SxSp', 'SpSp', 'OSp', 'NSp', 'Oco',
|
||||
'UOc', 'DOc', 'TOc', 'QaOc', 'QiOc', 'SxOc', 'SpOc', 'OOc', 'NOc', 'Noa',
|
||||
'UNo', 'DNo', 'TNo', 'QaNo', 'QiNo', 'SxNo', 'SpNo', 'ONo', 'NNo', 'Ct',
|
||||
'UCt'];
|
||||
|
||||
/**
|
||||
* Section: Two array's containing all Config groups and their to-be displayed title */
|
||||
|
||||
CM.Data.ConfigGroups = {
|
||||
BarsColors: 'Bars/Colors',
|
||||
Calculation: 'Calculation',
|
||||
Notification: 'Notification',
|
||||
Tooltip: 'Tooltips and additional insights',
|
||||
Statistics: 'Statistics',
|
||||
Notation: 'Notation',
|
||||
Miscellaneous: 'Miscellaneous',
|
||||
};
|
||||
|
||||
CM.Data.ConfigGroupsNotification = {
|
||||
NotificationGeneral: 'General Notifications',
|
||||
NotificationGC: 'Golden Cookie',
|
||||
NotificationFC: 'Fortune Cookie',
|
||||
NotificationSea: 'Season Special',
|
||||
NotificationGard: 'Garden Tick',
|
||||
NotificationMagi: 'Full Magic Bar',
|
||||
NotificationWrink: 'Wrinkler',
|
||||
NotificationWrinkMax: 'Maximum Wrinklers',
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: An array (CM.Data.Config) containing all Config options and an array of default settings */
|
||||
|
||||
/**
|
||||
* This includes all options of CookieMonster and relevant data
|
||||
* Each individual option-array in the has the following items
|
||||
* @item {string} type The type of option (bool(ean), vol(ume), url or color)
|
||||
* @item {string} group The options-group the option belongs to
|
||||
* @item {[string, ...]} label A list of the various configurations of the option
|
||||
* @item {string} desc Description to be used in options menu
|
||||
* @item {boolean} toggle Whether it should be displayed as a grey/white toggle in the options menu
|
||||
* @item {function} func A function to be called when the option is toggled
|
||||
*/
|
||||
// Barscolors
|
||||
CM.Data.Config.BotBar = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function () { CM.Disp.ToggleBotBar(); },
|
||||
};
|
||||
CM.Data.Config.TimerBar = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function () { CM.Disp.ToggleTimerBar(); },
|
||||
};
|
||||
CM.Data.Config.TimerBarPos = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function () { CM.Disp.ToggleTimerBarPos(); },
|
||||
};
|
||||
CM.Data.Config.TimerBarOverlay = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Timer Bar Overlay OFF', 'Timer Bar Overlay Only Seconds', 'Timer Bar Overlay Full'], desc: 'Overlay on timers displaying seconds and/or percentage left', toggle: true,
|
||||
};
|
||||
CM.Data.Config.SortBuildings = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings(); },
|
||||
};
|
||||
CM.Data.Config.SortUpgrades = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades(); },
|
||||
};
|
||||
CM.Data.Config.BuildColor = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function () { CM.Disp.UpdateBuildings(); },
|
||||
};
|
||||
CM.Data.Config.BulkBuildColor = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function () { CM.Disp.UpdateBuildings(); },
|
||||
};
|
||||
CM.Data.Config.UpBarColor = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function () { CM.Disp.ToggleUpgradeBarAndColor(); },
|
||||
};
|
||||
CM.Data.Config.Colors = {
|
||||
type: 'color',
|
||||
group: 'BarsColors',
|
||||
desc: {
|
||||
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels',
|
||||
Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels',
|
||||
Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels',
|
||||
Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels',
|
||||
Gray: 'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Pink: 'Color Pink. Used for Dragonflight bar',
|
||||
Brown: 'Color Brown. Used for Dragon Harvest bar',
|
||||
},
|
||||
func: function () { CM.Disp.UpdateColors(); },
|
||||
};
|
||||
CM.Data.Config.UpgradeBarFixedPos = {
|
||||
type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function () { CM.Disp.ToggleUpgradeBarFixedPos(); },
|
||||
};
|
||||
|
||||
// Calculation
|
||||
CM.Data.Config.CalcWrink = {
|
||||
type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true,
|
||||
};
|
||||
CM.Data.Config.CPSMode = {
|
||||
type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false,
|
||||
};
|
||||
CM.Data.Config.AvgCPSHist = {
|
||||
type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false,
|
||||
};
|
||||
CM.Data.Config.AvgClicksHist = {
|
||||
type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false,
|
||||
};
|
||||
CM.Data.Config.ColorPPBulkMode = {
|
||||
type: 'bool', group: 'Calculation', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false, func: function () { CM.Cache.CachePP(); },
|
||||
};
|
||||
CM.Data.Config.PPExcludeTop = {
|
||||
type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true,
|
||||
};
|
||||
CM.Data.Config.PPSecondsLowerLimit = {
|
||||
type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity,
|
||||
};
|
||||
CM.Data.Config.PPOnlyConsiderBuyable = {
|
||||
type: 'bool', group: 'Calculation', label: ["Don't Ignore Non-Buyable", 'Ignore Non-Buyable'], desc: "Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'", toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnBon = {
|
||||
type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true,
|
||||
};
|
||||
|
||||
// Notification
|
||||
CM.Data.Config.Title = {
|
||||
type: 'bool', group: 'NotificationGeneral', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns; "!" means that Golden Cookie/Reindeer can spawn', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GeneralSound = {
|
||||
type: 'bool', group: 'NotificationGeneral', label: ['Consider Game Volume Setting OFF', 'Consider Game Volume Setting ON'], desc: 'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GCNotification = {
|
||||
type: 'bool', group: 'NotificationGC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.GCNotification); },
|
||||
};
|
||||
CM.Data.Config.GCFlash = {
|
||||
type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GCSound = {
|
||||
type: 'bool', group: 'NotificationGC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GCVolume = {
|
||||
type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.GCVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.GCSoundURL = {
|
||||
type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns',
|
||||
};
|
||||
CM.Data.Config.FortuneNotification = {
|
||||
type: 'bool', group: 'NotificationFC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification); },
|
||||
};
|
||||
CM.Data.Config.FortuneFlash = {
|
||||
type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true,
|
||||
};
|
||||
CM.Data.Config.FortuneSound = {
|
||||
type: 'bool', group: 'NotificationFC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true,
|
||||
};
|
||||
CM.Data.Config.FortuneVolume = {
|
||||
type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.FortuneVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.FortuneSoundURL = {
|
||||
type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie',
|
||||
};
|
||||
CM.Data.Config.SeaNotification = {
|
||||
type: 'bool', group: 'NotificationSea', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification); },
|
||||
};
|
||||
CM.Data.Config.SeaFlash = {
|
||||
type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true,
|
||||
};
|
||||
CM.Data.Config.SeaSound = {
|
||||
type: 'bool', group: 'NotificationSea', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Season Popup', toggle: true,
|
||||
};
|
||||
CM.Data.Config.SeaVolume = {
|
||||
type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.SeaVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.SeaSoundURL = {
|
||||
type: 'url', group: 'NotificationSea', label: 'Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns',
|
||||
};
|
||||
CM.Data.Config.GardFlash = {
|
||||
type: 'bool', group: 'NotificationGard', label: ['Garden Tick Flash OFF', 'Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GardSound = {
|
||||
type: 'bool', group: 'NotificationGard', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true,
|
||||
};
|
||||
CM.Data.Config.GardVolume = {
|
||||
type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.GardVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.GardSoundURL = {
|
||||
type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks',
|
||||
};
|
||||
CM.Data.Config.MagicNotification = {
|
||||
type: 'bool', group: 'NotificationMagi', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification); },
|
||||
};
|
||||
CM.Data.Config.MagicFlash = {
|
||||
type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true,
|
||||
};
|
||||
CM.Data.Config.MagicSound = {
|
||||
type: 'bool', group: 'NotificationMagi', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true,
|
||||
};
|
||||
CM.Data.Config.MagicVolume = {
|
||||
type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.MagicVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.MagicSoundURL = {
|
||||
type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium',
|
||||
};
|
||||
CM.Data.Config.WrinklerNotification = {
|
||||
type: 'bool', group: 'NotificationWrink', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification); },
|
||||
};
|
||||
CM.Data.Config.WrinklerFlash = {
|
||||
type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true,
|
||||
};
|
||||
CM.Data.Config.WrinklerSound = {
|
||||
type: 'bool', group: 'NotificationWrink', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true,
|
||||
};
|
||||
CM.Data.Config.WrinklerVolume = {
|
||||
type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.WrinklerVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.WrinklerSoundURL = {
|
||||
type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears',
|
||||
};
|
||||
CM.Data.Config.WrinklerMaxNotification = {
|
||||
type: 'bool', group: 'NotificationWrinkMax', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification); },
|
||||
};
|
||||
CM.Data.Config.WrinklerMaxFlash = {
|
||||
type: 'bool', group: 'NotificationWrinkMax', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true,
|
||||
};
|
||||
CM.Data.Config.WrinklerMaxSound = {
|
||||
type: 'bool', group: 'NotificationWrinkMax', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true,
|
||||
};
|
||||
CM.Data.Config.WrinklerMaxVolume = {
|
||||
type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume',
|
||||
};
|
||||
for (let i = 0; i < 101; i++) {
|
||||
CM.Data.Config.WrinklerMaxVolume.label[i] = `${i}%`;
|
||||
}
|
||||
CM.Data.Config.WrinklerMaxSoundURL = {
|
||||
type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared',
|
||||
};
|
||||
|
||||
// Tooltip
|
||||
CM.Data.Config.TooltipBuildUpgrade = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Building/Upgrade Tooltip Information OFF', 'Building/Upgrade Tooltip Information ON'], desc: 'Extra information in Building/Upgrade tooltips', toggle: true,
|
||||
};
|
||||
CM.Data.Config.TooltipAmor = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnLucky = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnLuckyFrenzy = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnConjure = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnConjureFrenzy = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnEdifice = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true,
|
||||
};
|
||||
CM.Data.Config.ToolWarnUser = {
|
||||
type: 'numscale', group: 'Tooltip', label: 'Tooltip Warning At x times CPS: ', desc: 'Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether', min: 0, max: Infinity,
|
||||
};
|
||||
CM.Data.Config.ToolWarnPos = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function () { CM.Disp.ToggleToolWarnPos(); },
|
||||
};
|
||||
CM.Data.Config.TooltipGrim = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true,
|
||||
};
|
||||
CM.Data.Config.TooltipWrink = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true,
|
||||
};
|
||||
CM.Data.Config.TooltipLump = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true,
|
||||
};
|
||||
CM.Data.Config.TooltipPlots = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'], desc: 'Shows a tooltip for plants that have a cookie reward.', toggle: true,
|
||||
};
|
||||
CM.Data.Config.DragonAuraInfo = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true,
|
||||
};
|
||||
CM.Data.Config.TooltipAscendButton = {
|
||||
type: 'bool', group: 'Tooltip', label: ['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'], desc: 'Shows additional info in the ascend tooltip', toggle: true,
|
||||
};
|
||||
|
||||
// Statistics
|
||||
CM.Data.Config.Stats = {
|
||||
type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true,
|
||||
};
|
||||
CM.Data.Config.MissingUpgrades = {
|
||||
type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true,
|
||||
};
|
||||
CM.Data.Config.UpStats = {
|
||||
type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false,
|
||||
};
|
||||
CM.Data.Config.TimeFormat = {
|
||||
type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false,
|
||||
};
|
||||
CM.Data.Config.DetailedTime = {
|
||||
type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function () { CM.Disp.ToggleDetailedTime(); },
|
||||
};
|
||||
CM.Data.Config.GrimoireBar = {
|
||||
type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true,
|
||||
};
|
||||
CM.Data.Config.HeavenlyChipsTarget = {
|
||||
type: 'numscale', group: 'Statistics', label: 'Heavenly Chips Target: ', desc: 'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections', min: 1, max: Infinity,
|
||||
};
|
||||
CM.Data.Config.ShowMissedGC = {
|
||||
type: 'bool', group: 'Statistics', label: ['Missed GC OFF', 'Missed GC ON'], desc: 'Show a stat in the statistics screen that counts how many Golden Cookies you have missed', toggle: true,
|
||||
};
|
||||
|
||||
// Notation
|
||||
CM.Data.Config.Scale = {
|
||||
type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function () { CM.Disp.RefreshScale(); },
|
||||
};
|
||||
CM.Data.Config.ScaleDecimals = {
|
||||
type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function () { CM.Disp.RefreshScale(); },
|
||||
};
|
||||
CM.Data.Config.ScaleSeparator = {
|
||||
type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function () { CM.Disp.RefreshScale(); },
|
||||
};
|
||||
CM.Data.Config.ScaleCutoff = {
|
||||
type: 'numscale', group: 'Notation', label: 'Notation Cut-off Point: ', desc: 'The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations', min: 1, max: 999999999,
|
||||
};
|
||||
|
||||
// Miscellaneous
|
||||
CM.Data.Config.GCTimer = {
|
||||
type: 'bool', group: 'Miscellaneous', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function () { CM.Disp.ToggleGCTimer(); },
|
||||
};
|
||||
CM.Data.Config.Favicon = {
|
||||
type: 'bool', group: 'Miscellaneous', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function () { CM.Disp.UpdateFavicon(); },
|
||||
};
|
||||
CM.Data.Config.WrinklerButtons = {
|
||||
type: 'bool', group: 'Miscellaneous', label: ['Extra Buttons OFF', 'Extra Buttons ON'], desc: 'Show buttons for popping wrinklers at bottom of cookie section', toggle: true, func: function () { CM.Disp.UpdateWrinklerButtons(); },
|
||||
};
|
||||
CM.Data.Config.BulkBuyBlock = {
|
||||
type: 'bool', group: 'Miscellaneous', label: ['Block Bulk Buying OFF', 'Block Bulk Buying ON'], desc: "Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.", toggle: true,
|
||||
};
|
||||
|
||||
/**
|
||||
* This array describes all default settings
|
||||
* It is used by CM.LoadConfig() and CM.Config.RestoreDefault()
|
||||
*/
|
||||
CM.Data.ConfigDefault = {
|
||||
BotBar: 1,
|
||||
TimerBar: 1,
|
||||
TimerBarPos: 0,
|
||||
TimerBarOverlay: 2,
|
||||
BuildColor: 1,
|
||||
BulkBuildColor: 0,
|
||||
UpBarColor: 1,
|
||||
UpgradeBarFixedPos: 1,
|
||||
CalcWrink: 0,
|
||||
CPSMode: 1,
|
||||
AvgCPSHist: 3,
|
||||
AvgClicksHist: 0,
|
||||
ColorPPBulkMode: 1,
|
||||
PPExcludeTop: 0,
|
||||
PPSecondsLowerLimit: 0,
|
||||
PPOnlyConsiderBuyable: 0,
|
||||
ToolWarnBon: 0,
|
||||
Title: 1,
|
||||
GeneralSound: 1,
|
||||
GCNotification: 0,
|
||||
GCFlash: 1,
|
||||
GCSound: 1,
|
||||
GCVolume: 100,
|
||||
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||
FortuneNotification: 0,
|
||||
FortuneFlash: 1,
|
||||
FortuneSound: 1,
|
||||
FortuneVolume: 100,
|
||||
FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
SeaNotification: 0,
|
||||
SeaFlash: 1,
|
||||
SeaSound: 1,
|
||||
SeaVolume: 100,
|
||||
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
GardFlash: 1,
|
||||
GardSound: 1,
|
||||
GardVolume: 100,
|
||||
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||
MagicNotification: 0,
|
||||
MagicFlash: 1,
|
||||
MagicSound: 1,
|
||||
MagicVolume: 100,
|
||||
MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
WrinklerNotification: 0,
|
||||
WrinklerFlash: 1,
|
||||
WrinklerSound: 1,
|
||||
WrinklerVolume: 100,
|
||||
WrinklerSoundURL: 'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
WrinklerMaxNotification: 0,
|
||||
WrinklerMaxFlash: 1,
|
||||
WrinklerMaxSound: 1,
|
||||
WrinklerMaxVolume: 100,
|
||||
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
TooltipBuildUpgrade: 1,
|
||||
TooltipAmor: 0,
|
||||
ToolWarnLucky: 1,
|
||||
ToolWarnLuckyFrenzy: 1,
|
||||
ToolWarnConjure: 1,
|
||||
ToolWarnConjureFrenzy: 1,
|
||||
ToolWarnEdifice: 1,
|
||||
ToolWarnUser: 0,
|
||||
ToolWarnPos: 1,
|
||||
TooltipGrim: 1,
|
||||
TooltipWrink: 1,
|
||||
TooltipLump: 1,
|
||||
TooltipPlots: 1,
|
||||
DragonAuraInfo: 1,
|
||||
TooltipAscendButton: 1,
|
||||
Stats: 1,
|
||||
MissingUpgrades: 1,
|
||||
UpStats: 1,
|
||||
TimeFormat: 0,
|
||||
DetailedTime: 1,
|
||||
GrimoireBar: 1,
|
||||
HeavenlyChipsTarget: 1,
|
||||
ShowMissedGC: 1,
|
||||
Scale: 2,
|
||||
ScaleDecimals: 2,
|
||||
ScaleSeparator: 0,
|
||||
ScaleCutoff: 999999,
|
||||
Colors: {
|
||||
Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513',
|
||||
},
|
||||
SortBuildings: 0,
|
||||
SortUpgrades: 0,
|
||||
GCTimer: 1,
|
||||
Favicon: 1,
|
||||
WrinklerButtons: 1,
|
||||
BulkBuyBlock: 0,
|
||||
Header: {
|
||||
BarsColors: 1, Calculation: 1, Notification: 1, NotificationGeneral: 1, NotificationGC: 1, NotificationFC: 1, NotificationSea: 1, NotificationGard: 1, NotificationMagi: 1, NotificationWrink: 1, NotificationWrinkMax: 1, Tooltip: 1, Statistics: 1, Notation: 1, Miscellaneous: 1, Lucky: 1, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* These variables are used to describe Cookie Monster in the info tab
|
||||
* It is used by CM.Disp.AddMenuInfo()
|
||||
*/
|
||||
CM.Data.ModDescription = `<div class="listing">
|
||||
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
|
||||
offers a wide range of tools and statistics to enhance your game experience.
|
||||
It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>
|
||||
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
|
||||
Please also report any bugs you may find over there!</br>
|
||||
</div>
|
||||
`;
|
||||
CM.Data.LatestReleaseNotes = `<div class="listing">
|
||||
<b>The latest update (v 2.031.4) has introduced the following features:</b></br>
|
||||
- Added a changelog to the info tab and notification indicating a new version</br>
|
||||
- Warnings in tooltips are now based on the income after buying the upgrade</br>
|
||||
- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added</br>
|
||||
- User can now set a custom tooltip warning ("x times cps") in the settings</br>
|
||||
- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward</br>
|
||||
- The Harvest All button in the Garden now has a tooltip displaying the current reward </br>
|
||||
- The Ascend button can now display additional info (this can be turned off in the settings) </br>
|
||||
- The statistics page now displays the Heavenly Chips per second</br>
|
||||
- The statistics page now displays the CPS needed for the next level in Chain Cookies</br>
|
||||
- The statistics page now displays the cookies needed for optimal rewards for garden plants</br>
|
||||
- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page</br>
|
||||
- The color picker in the settings has been updated to its latest version</br>
|
||||
- The overlay of seconds/percentage of timers is now toggle able and more readable</br>
|
||||
- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)</br>
|
||||
- CookieMonster now uses the Modding API provided by the base game</br>
|
||||
- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod</br>
|
||||
- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn</br>
|
||||
- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment</br>
|
||||
</br>
|
||||
<b>This update fixes the following bugs:</b></br>
|
||||
- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded</br>
|
||||
- Sound, Flashes and Notifications will no longer play when the mod is initializing</br>
|
||||
- The color picker should now update its display consistently</br>
|
||||
- Fixed some typo's</br>
|
||||
- Fixed a game breaking bug when the player had not purchased any upgrades</br>
|
||||
- Fixed a number of console errors thrown by CM</br>
|
||||
- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster</br>
|
||||
- The Timer bar will now disappear correctly when the Golden Switch has been activated</br>
|
||||
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats</br>
|
||||
- Fixed buy warnings showing incorrectly</br>
|
||||
</div>
|
||||
`;
|
||||
|
||||
4127
src/Disp.js
4127
src/Disp.js
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,81 @@
|
||||
/**********
|
||||
/**
|
||||
* Footer *
|
||||
**********/
|
||||
*/
|
||||
|
||||
CM.Init();
|
||||
/**
|
||||
* Section: Functions related to base game modding API */
|
||||
|
||||
/**
|
||||
* This register a init function to the CM object. Per Game code/comments:
|
||||
* "this function is called as soon as the mod is registered
|
||||
* declare hooks here"
|
||||
* It starts the further initialization of CookieMonster and registers hooks
|
||||
*/
|
||||
CM.init = function () {
|
||||
CM.Footer.isInitzializing = true;
|
||||
let proceed = true;
|
||||
if (Game.version !== Number(CM.VersionMajor)) {
|
||||
proceed = confirm(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} is meant for Game version ${CM.VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`);
|
||||
}
|
||||
if (proceed) {
|
||||
CM.Main.DelayInit();
|
||||
Game.registerHook('draw', CM.Disp.Draw);
|
||||
Game.registerHook('logic', CM.Main.Loop);
|
||||
CM.Footer.isInitzializing = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This registers a save function to the CM object. Per Game code/comments:
|
||||
* "use this to store persistent data associated with your mod
|
||||
* return 'a string to be saved';"
|
||||
*/
|
||||
CM.save = function () {
|
||||
return JSON.stringify({
|
||||
settings: CM.Options,
|
||||
version: `${CM.VersionMajor}.${CM.VersionMinor}`,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* This registers a load function to the CM object. Per Game code/comments:
|
||||
* "do stuff with the string data you saved previously"
|
||||
*/
|
||||
CM.load = function (str) {
|
||||
const save = JSON.parse(str);
|
||||
CM.Config.LoadConfig(save.settings);
|
||||
if (save.version !== `${CM.VersionMajor}.${CM.VersionMinor}`) {
|
||||
if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!');
|
||||
else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to the initialization of CookieMonster */
|
||||
|
||||
/**
|
||||
* This functions loads an external script (on the same repository) that creates the
|
||||
* functionality needed to dynamiccaly change colours
|
||||
* It is called by the last function in the footer
|
||||
*/
|
||||
CM.Footer.AddJscolor = function () {
|
||||
CM.Footer.Jscolor = document.createElement('script');
|
||||
CM.Footer.Jscolor.type = 'text/javascript';
|
||||
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
|
||||
document.head.appendChild(CM.Footer.Jscolor);
|
||||
};
|
||||
|
||||
/**
|
||||
* This functions starts the initizialization and register CookieMonster
|
||||
* It is called as the last function in this script's execution
|
||||
*/
|
||||
if (typeof CM.Footer.isInitzializing === 'undefined') {
|
||||
CM.Footer.AddJscolor();
|
||||
const delay = setInterval(function () {
|
||||
if (typeof jscolor !== 'undefined') {
|
||||
jscolor.init();
|
||||
Game.registerMod('CookieMonster', CM);
|
||||
clearInterval(delay);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
/**********
|
||||
/* eslint-disable no-unused-vars */
|
||||
/**
|
||||
* Header *
|
||||
**********/
|
||||
|
||||
CM = {};
|
||||
|
||||
CM.Backup = {};
|
||||
|
||||
CM.Cache = {};
|
||||
|
||||
CM.Config = {};
|
||||
|
||||
CM.ConfigData = {};
|
||||
|
||||
CM.Data = {};
|
||||
|
||||
CM.Disp = {};
|
||||
|
||||
CM.Sim = {};
|
||||
*/
|
||||
|
||||
const CM = {
|
||||
Backup: {},
|
||||
Cache: {},
|
||||
Config: {},
|
||||
Data: { Config: {} },
|
||||
Disp: {},
|
||||
Footer: {},
|
||||
Main: {},
|
||||
Options: {},
|
||||
Sim: {},
|
||||
VersionMajor: '2.031',
|
||||
VersionMinor: '4',
|
||||
};
|
||||
|
||||
659
src/Main.js
659
src/Main.js
@@ -1,171 +1,550 @@
|
||||
/********
|
||||
/**
|
||||
* Main *
|
||||
********/
|
||||
*/
|
||||
|
||||
CM.ReplaceNative = function() {
|
||||
CM.Backup.Beautify = Beautify;
|
||||
Beautify = CM.Disp.Beautify;
|
||||
/**
|
||||
* Section: Functions related to the main and initialization loop */
|
||||
|
||||
CM.Backup.CalculateGains = Game.CalculateGains;
|
||||
Game.CalculateGains = function() {
|
||||
CM.Backup.CalculateGains();
|
||||
CM.Sim.DoSims = 1;
|
||||
CM.Sim.Date = new Date().getTime();
|
||||
}
|
||||
|
||||
CM.Backup.seasonPopup = {};
|
||||
CM.Backup.seasonPopup.spawn = Game.seasonPopup.spawn;
|
||||
eval('CM.Backup.seasonPopup.spawnMod = ' + Game.seasonPopup.spawn.toString().split('this').join('Game.seasonPopup'));
|
||||
Game.seasonPopup.spawn = function() {
|
||||
CM.Backup.seasonPopup.spawnMod();
|
||||
CM.Disp.EmphSeasonPopup();
|
||||
}
|
||||
|
||||
CM.Backup.tooltip = {};
|
||||
CM.Backup.tooltip.draw = Game.tooltip.draw;
|
||||
eval('CM.Backup.tooltip.drawMod = ' + Game.tooltip.draw.toString().split('this').join('Game.tooltip'));
|
||||
Game.tooltip.draw = function(from, text, origin) {
|
||||
CM.Backup.tooltip.drawMod(from, text, origin);
|
||||
CM.Disp.DrawTooltipWarnCaut();
|
||||
}
|
||||
|
||||
CM.Backup.tooltip.update = Game.tooltip.update;
|
||||
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip'));
|
||||
Game.tooltip.update = function() {
|
||||
CM.Backup.tooltip.updateMod();
|
||||
CM.Disp.UpdateTooltipWarnCaut();
|
||||
CM.Disp.UpdateTooltipLocation();
|
||||
}
|
||||
|
||||
CM.Backup.UpdateSpecial = Game.UpdateSpecial;
|
||||
Game.UpdateSpecial = function() {
|
||||
if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) {
|
||||
var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
|
||||
Game.mouseY -= timerBarHeight;
|
||||
CM.Backup.UpdateSpecial();
|
||||
Game.mouseY += timerBarHeight;
|
||||
}
|
||||
else {
|
||||
CM.Backup.UpdateSpecial();
|
||||
}
|
||||
}
|
||||
|
||||
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function() {
|
||||
CM.Backup.RebuildUpgrades();
|
||||
CM.Disp.AddTooltipUpgrade();
|
||||
Game.recalculateGains = 1;
|
||||
}
|
||||
|
||||
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
||||
Game.UpdateMenu = function() {
|
||||
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
||||
CM.Backup.UpdateMenu();
|
||||
CM.Disp.AddMenu();
|
||||
}
|
||||
}
|
||||
|
||||
CM.Backup.sayTime = Game.sayTime;
|
||||
CM.Disp.sayTime = function(time, detail) {
|
||||
if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
|
||||
else return CM.Disp.FormatTime(time / Game.fps, 1);
|
||||
}
|
||||
|
||||
CM.Backup.Loop = Game.Loop;
|
||||
Game.Loop = function() {
|
||||
CM.Backup.Loop();
|
||||
CM.Loop();
|
||||
}
|
||||
}
|
||||
|
||||
CM.Loop = function() {
|
||||
if (CM.Disp.lastAscendState != Game.OnAscend) {
|
||||
/**
|
||||
* Main loop of Cookie Monster
|
||||
* CM.init registers it to the "logic" hook provided by the modding api
|
||||
*/
|
||||
CM.Main.Loop = function () {
|
||||
if (CM.Disp.lastAscendState !== Game.OnAscend) {
|
||||
CM.Disp.lastAscendState = Game.OnAscend;
|
||||
CM.Disp.UpdateAscendState();
|
||||
}
|
||||
if (!Game.OnAscend && Game.AscendTimer == 0) {
|
||||
if (CM.Sim.DoSims) {
|
||||
CM.Cache.RemakeIncome();
|
||||
CM.Cache.RemakeBCI();
|
||||
CM.Cache.RemakeLucky();
|
||||
CM.Cache.RemakeChain();
|
||||
CM.Cache.RemakeSeaSpec();
|
||||
CM.Cache.RemakeSellAllTotal();
|
||||
if (!Game.OnAscend && Game.AscendTimer === 0) {
|
||||
// Check if any other mods have been loaded
|
||||
if (CM.Main.LastModCount !== Object.keys(Game.mods).length) {
|
||||
CM.Sim.CreateSimFunctions();
|
||||
CM.Sim.InitData();
|
||||
CM.Cache.InitCache();
|
||||
CM.Main.LastModCount = Object.keys(Game.mods).length;
|
||||
}
|
||||
|
||||
CM.Disp.UpdateBotBarOther();
|
||||
CM.Disp.UpdateBuildings();
|
||||
CM.Disp.UpdateUpgrades();
|
||||
// CM.Sim.DoSims is set whenever CPS has changed
|
||||
if (CM.Sim.DoSims) {
|
||||
CM.Cache.CacheIncome();
|
||||
|
||||
CM.Cache.NoGoldSwitchCPS(); // Needed first
|
||||
CM.Cache.CacheGoldenAndWrathCookiesMults();
|
||||
CM.Cache.CacheStats();
|
||||
CM.Cache.CacheMissingUpgrades();
|
||||
CM.Cache.CacheChain();
|
||||
CM.Cache.CacheDragonCost();
|
||||
|
||||
CM.Cache.CacheSeaSpec();
|
||||
CM.Cache.CacheSellForChoEgg();
|
||||
|
||||
CM.Sim.DoSims = 0;
|
||||
}
|
||||
|
||||
// Redraw timers
|
||||
CM.Disp.UpdateBotBarTime();
|
||||
CM.Disp.UpdateTimerBar();
|
||||
// Check for aura change to recalculate buildings prices
|
||||
const hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
|
||||
if (!CM.Cache.HadBuildAura && hasBuildAura) {
|
||||
CM.Cache.HadBuildAura = true;
|
||||
CM.Cache.DoRemakeBuildPrices = 1;
|
||||
} else if (CM.Cache.HadBuildAura && !hasBuildAura) {
|
||||
CM.Cache.HadBuildAura = false;
|
||||
CM.Cache.DoRemakeBuildPrices = 1;
|
||||
}
|
||||
|
||||
// Update Tooltip
|
||||
CM.Disp.UpdateTooltip();
|
||||
if (CM.Cache.DoRemakeBuildPrices) {
|
||||
CM.Cache.CacheBuildingsPrices();
|
||||
CM.Cache.DoRemakeBuildPrices = 0;
|
||||
}
|
||||
|
||||
// Update Wrinkler Tooltip
|
||||
CM.Disp.CheckWrinklerTooltip();
|
||||
CM.Disp.UpdateWrinklerTooltip();
|
||||
CM.Cache.LoopCache();
|
||||
|
||||
// Update Title
|
||||
CM.Disp.UpdateTitle();
|
||||
|
||||
// Change menu refresh interval
|
||||
CM.Disp.RefreshMenu();
|
||||
// Check all changing minigames and game-states
|
||||
CM.Main.CheckGoldenCookie();
|
||||
CM.Main.CheckTickerFortune();
|
||||
CM.Main.CheckSeasonPopup();
|
||||
CM.Main.CheckGardenTick();
|
||||
CM.Main.CheckMagicMeter();
|
||||
CM.Main.CheckWrinklerCount();
|
||||
}
|
||||
};
|
||||
|
||||
// Check Golden Cookies
|
||||
CM.Disp.CheckGoldenCookie();
|
||||
}
|
||||
/**
|
||||
* Initialization loop of Cookie Monster
|
||||
* Called by CM.init()
|
||||
*/
|
||||
CM.Main.DelayInit = function () {
|
||||
// Create CM.Sim functions
|
||||
CM.Sim.CreateSimFunctions();
|
||||
|
||||
CM.Init = function() {
|
||||
var proceed = true;
|
||||
if (Game.version != CM.VersionMajor) {
|
||||
proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?');
|
||||
}
|
||||
if (proceed) {
|
||||
CM.Disp.AddJscolor();
|
||||
|
||||
var delay = setInterval(function() {
|
||||
if (typeof jscolor !== 'undefined') {
|
||||
CM.DelayInit();
|
||||
clearInterval(delay);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
CM.DelayInit = function() {
|
||||
CM.Sim.InitData();
|
||||
CM.Cache.InitCache();
|
||||
|
||||
// Stored to check if we need to re-initiliaze data
|
||||
CM.Main.LastModCount = Object.keys(Game.mods).length;
|
||||
|
||||
// Creating visual elements
|
||||
CM.Disp.CreateCssArea();
|
||||
CM.Disp.CreateBotBar();
|
||||
CM.Disp.CreateTimerBar();
|
||||
CM.Disp.CreateUpgradeBar();
|
||||
CM.Disp.CreateWhiteScreen();
|
||||
CM.Disp.CreateGCTimer();
|
||||
CM.Disp.CreateResetTooltip();
|
||||
CM.Disp.CreateChoEggTooltip();
|
||||
CM.Disp.CreateTooltipWarnCaut();
|
||||
CM.Disp.AddTooltipBuild();
|
||||
//CM.Disp.AddTooltipBuildExtra(); // The extra per building was removed
|
||||
CM.Disp.AddWrinklerAreaDetect();
|
||||
CM.ReplaceNative();
|
||||
CM.Disp.CreateFavicon();
|
||||
for (const i of Object.keys(CM.Disp.TooltipText)) {
|
||||
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
|
||||
}
|
||||
CM.Disp.CreateWrinklerButtons();
|
||||
CM.Disp.UpdateBuildingUpgradeStyle();
|
||||
CM.Main.ReplaceTooltips();
|
||||
CM.Main.AddWrinklerAreaDetect();
|
||||
|
||||
// Replace native functions
|
||||
CM.Main.ReplaceNative();
|
||||
CM.Main.ReplaceNativeGrimoire();
|
||||
Game.CalculateGains();
|
||||
CM.LoadConfig(); // Must be after all things are created!
|
||||
|
||||
CM.Config.LoadConfig(); // Must be after all things are created!
|
||||
CM.Disp.lastAscendState = Game.OnAscend;
|
||||
|
||||
if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!');
|
||||
else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!','','',1, 1);
|
||||
if (Game.prefs.popups) Game.Popup(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} loaded!`);
|
||||
else Game.Notify(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} loaded!`, '', '', 1, 1);
|
||||
|
||||
Game.Win('Third-party');
|
||||
}
|
||||
};
|
||||
|
||||
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}};
|
||||
CM.ConfigPrefix = 'CMConfig';
|
||||
/**
|
||||
* Section: Functions related to replacing stuff */
|
||||
|
||||
CM.VersionMajor = '2';
|
||||
CM.VersionMinor = '1';
|
||||
/**
|
||||
* This function replaces certain native (from the base-game) functions
|
||||
* It is called by CM.Main.DelayInit()
|
||||
*/
|
||||
CM.Main.ReplaceNative = function () {
|
||||
CM.Backup.Beautify = Beautify;
|
||||
Beautify = CM.Disp.Beautify;
|
||||
|
||||
CM.Backup.CalculateGains = Game.CalculateGains;
|
||||
eval(`CM.Backup.CalculateGainsMod = ${Game.CalculateGains.toString().split('ages\');').join('ages\');CM.Sim.DateAges = Date.now();').split('if (Game.Has(\'Century')
|
||||
.join('CM.Sim.DateCentury = Date.now();if (Game.Has(\'Century')}`);
|
||||
Game.CalculateGains = function () {
|
||||
CM.Backup.CalculateGainsMod();
|
||||
CM.Sim.DoSims = 1;
|
||||
};
|
||||
|
||||
CM.Backup.tooltip = {};
|
||||
CM.Backup.tooltip.draw = Game.tooltip.draw;
|
||||
eval(`CM.Backup.tooltip.drawMod = ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`);
|
||||
Game.tooltip.draw = function (from, text, origin) {
|
||||
CM.Backup.tooltip.drawMod(from, text, origin);
|
||||
};
|
||||
|
||||
CM.Backup.tooltip.update = Game.tooltip.update;
|
||||
eval(`CM.Backup.tooltip.updateMod = ${Game.tooltip.update.toString().split('this.').join('Game.tooltip.')}`);
|
||||
Game.tooltip.update = function () {
|
||||
CM.Backup.tooltip.updateMod();
|
||||
CM.Disp.UpdateTooltipLocation();
|
||||
};
|
||||
|
||||
CM.Backup.UpdateWrinklers = Game.UpdateWrinklers;
|
||||
Game.UpdateWrinklers = function () {
|
||||
CM.Main.FixMouseY(CM.Backup.UpdateWrinklers);
|
||||
};
|
||||
|
||||
CM.Backup.UpdateSpecial = Game.UpdateSpecial;
|
||||
Game.UpdateSpecial = function () {
|
||||
CM.Main.FixMouseY(CM.Backup.UpdateSpecial);
|
||||
};
|
||||
|
||||
// Assumes newer browsers
|
||||
l('bigCookie').removeEventListener('click', Game.ClickCookie, false);
|
||||
l('bigCookie').addEventListener('click', function () { CM.Main.FixMouseY(Game.ClickCookie); }, false);
|
||||
|
||||
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function () {
|
||||
CM.Backup.RebuildUpgrades();
|
||||
CM.Disp.ReplaceTooltipUpgrade();
|
||||
Game.CalculateGains();
|
||||
};
|
||||
|
||||
CM.Backup.ClickProduct = Game.ClickProduct;
|
||||
/**
|
||||
* This function adds a check to the purchase of a building to allow BulkBuyBlock to work.
|
||||
* If the options is 1 (on) bulkPrice is under cookies you can't buy the building.
|
||||
*/
|
||||
Game.ClickProduct = function (what) {
|
||||
if (!CM.Options.BulkBuyBlock || Game.ObjectsById[what].bulkPrice < Game.cookies) {
|
||||
CM.Backup.ClickProduct(what);
|
||||
}
|
||||
};
|
||||
|
||||
CM.Backup.DescribeDragonAura = Game.DescribeDragonAura;
|
||||
/**
|
||||
* This function adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
|
||||
* This adds information about CPS differences and costs to the aura choosing interface
|
||||
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||
*/
|
||||
Game.DescribeDragonAura = function (aura) {
|
||||
CM.Backup.DescribeDragonAura(aura);
|
||||
CM.Disp.AddAuraInfo(aura);
|
||||
};
|
||||
|
||||
CM.Backup.ToggleSpecialMenu = Game.ToggleSpecialMenu;
|
||||
/**
|
||||
* This function adds the code to display the tooltips for the levelUp button of the dragon
|
||||
*/
|
||||
Game.ToggleSpecialMenu = function (on) {
|
||||
CM.Backup.ToggleSpecialMenu(on);
|
||||
CM.Disp.AddDragonLevelUpTooltip();
|
||||
};
|
||||
|
||||
CM.Backup.UpdateMenu = Game.UpdateMenu;
|
||||
Game.UpdateMenu = function () {
|
||||
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
||||
CM.Backup.UpdateMenu();
|
||||
CM.Disp.AddMenu();
|
||||
}
|
||||
};
|
||||
|
||||
CM.Backup.sayTime = Game.sayTime;
|
||||
CM.Disp.sayTime = function (time, detail) {
|
||||
if (Number.isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
|
||||
else return CM.Disp.FormatTime(time / Game.fps, 1);
|
||||
};
|
||||
|
||||
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
|
||||
CM.Backup.Logic = Game.Logic;
|
||||
CM.Backup.LogicMod = new Function(
|
||||
`return ${Game.Logic.toString()
|
||||
.split('document.title')
|
||||
.join('CM.Disp.Title')
|
||||
.split("' more cookies</b> for the next level.<br>';")
|
||||
.join("` more cookies</b> for the next level.<br>${CM.Options.TooltipAscendButton ? `<div class='line'></div>It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.<br>` : ``}`;")}`,
|
||||
)();
|
||||
Game.Logic = function () {
|
||||
CM.Backup.LogicMod();
|
||||
// Update Title
|
||||
CM.Disp.UpdateTitle();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* This function fixes replaces the Launch and Draw functions of the Grimoire
|
||||
* It is called by CM.Main.DelayInit() and Game.LoadMinigames()
|
||||
*/
|
||||
CM.Main.ReplaceNativeGrimoire = function () {
|
||||
CM.Main.ReplaceNativeGrimoireLaunch();
|
||||
CM.Main.ReplaceNativeGrimoireDraw();
|
||||
};
|
||||
|
||||
/**
|
||||
* This function fixes replaces the .launch function of the Grimoire
|
||||
* It is called by CM.Main.ReplaceNativeGrimoire()
|
||||
*/
|
||||
CM.Main.ReplaceNativeGrimoireLaunch = function () {
|
||||
if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
CM.Backup.GrimoireLaunch = minigame.launch;
|
||||
eval(`CM.Backup.GrimoireLaunchMod = ${minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')}`);
|
||||
Game.Objects['Wizard tower'].minigame.launch = function () {
|
||||
CM.Backup.GrimoireLaunchMod();
|
||||
CM.Main.ReplaceTooltipGrimoire();
|
||||
CM.HasReplaceNativeGrimoireDraw = false;
|
||||
CM.Main.ReplaceNativeGrimoireDraw();
|
||||
};
|
||||
CM.Main.HasReplaceNativeGrimoireLaunch = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function fixes replaces the .draw function of the Grimoire
|
||||
* It is called by CM.Main.ReplaceNativeGrimoire()
|
||||
*/
|
||||
CM.Main.ReplaceNativeGrimoireDraw = function () {
|
||||
if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
CM.Backup.GrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
CM.Backup.GrimoireDraw();
|
||||
if (CM.Options.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
|
||||
minigame.magicBarTextL.innerHTML += ` (${CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM))})`;
|
||||
}
|
||||
};
|
||||
CM.Main.HasReplaceNativeGrimoireDraw = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to first initizalition of CM */
|
||||
|
||||
/**
|
||||
* This function call all functions that replace Game-tooltips with CM-enhanced tooltips
|
||||
* It is called by CM.Main.DelayInit()
|
||||
*/
|
||||
CM.Main.ReplaceTooltips = function () {
|
||||
CM.Main.ReplaceTooltipBuild();
|
||||
CM.Main.ReplaceTooltipLump();
|
||||
|
||||
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
|
||||
// they were not loaded initially
|
||||
CM.Backup.LoadMinigames = Game.LoadMinigames;
|
||||
Game.LoadMinigames = function () {
|
||||
CM.Backup.LoadMinigames();
|
||||
CM.Main.ReplaceTooltipGarden();
|
||||
CM.Main.ReplaceTooltipGrimoire();
|
||||
CM.Main.ReplaceNativeGrimoire();
|
||||
};
|
||||
Game.LoadMinigames();
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to replacing tooltips */
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of buildings so that it calls CM.Disp.Tooltip()
|
||||
* CM.Disp.Tooltip() sets the tooltip type to 'b'
|
||||
* It is called by CM.Main.ReplaceTooltips()
|
||||
*/
|
||||
CM.Main.ReplaceTooltipBuild = function () {
|
||||
CM.Main.TooltipBuildBackup = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
const me = Game.Objects[i];
|
||||
if (l(`product${me.id}`).onmouseover !== null) {
|
||||
CM.Main.TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
|
||||
eval(`l('product' + me.id).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('b', '${i}');}, 'store'); Game.tooltip.wobble();}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
|
||||
* CM.Disp.Tooltip() sets the tooltip type to 's'
|
||||
* It is called by CM.Main.ReplaceTooltips()
|
||||
*/
|
||||
CM.Main.ReplaceTooltipLump = function () {
|
||||
if (Game.canLumps()) {
|
||||
CM.Main.TooltipLumpBackup = l('lumps').onmouseover;
|
||||
eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of the Grimoire minigame so that it calls CM.Disp.Tooltip()
|
||||
* CM.Disp.Tooltip() sets the tooltip type to 'g'
|
||||
* It is called by CM.Main.ReplaceTooltips()
|
||||
*/
|
||||
CM.Main.ReplaceTooltipGrimoire = function () {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
CM.Main.TooltipGrimoireBackup = [];
|
||||
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
|
||||
if (l(`grimoireSpell${i}`).onmouseover !== null) {
|
||||
CM.Main.TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
|
||||
eval(`l('grimoireSpell' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('g', '${i}');}, 'this'); Game.tooltip.wobble();}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip()
|
||||
* CM.Disp.Tooltip() sets the tooltip type to 'p'
|
||||
* It is called by CM.Main.ReplaceTooltips()
|
||||
*/
|
||||
CM.Main.ReplaceTooltipGarden = function () {
|
||||
if (Game.Objects.Farm.minigameLoaded) {
|
||||
l('gardenTool-1').onmouseover = function () { Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function () { return CM.Disp.Tooltip('ha', 'HarvestAllButton'); }, 'this'); Game.tooltip.wobble(); };
|
||||
Array.from(l('gardenPlot').children).forEach((child) => {
|
||||
const coords = child.id.slice(-3);
|
||||
child.onmouseover = function () { Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function () { return CM.Disp.Tooltip('p', [`${coords[0]}`, `${coords[2]}`]); }, 'this'); Game.tooltip.wobble(); };
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to checking for changes in Minigames/GC's/Ticker */
|
||||
|
||||
/**
|
||||
* Auxilirary function that finds all currently spawned shimmers.
|
||||
* CM.Cache.spawnedGoldenShimmer stores the non-user spawned cookie to later determine data for the favicon and tab-title
|
||||
* It is called by CM.CM.Main.CheckGoldenCookie
|
||||
*/
|
||||
CM.Main.FindShimmer = function () {
|
||||
CM.Main.currSpawnedGoldenCookieState = 0;
|
||||
CM.Cache.goldenShimmersByID = {};
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
|
||||
CM.Cache.spawnedGoldenShimmer = Game.shimmers[i];
|
||||
CM.Main.currSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks for changes in the amount of Golden Cookies
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckGoldenCookie = function () {
|
||||
CM.Main.FindShimmer();
|
||||
for (const i of Object.keys(CM.Disp.GCTimers)) {
|
||||
if (typeof CM.Cache.goldenShimmersByID[i] === 'undefined') {
|
||||
CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);
|
||||
delete CM.Disp.GCTimers[i];
|
||||
}
|
||||
}
|
||||
if (CM.Main.lastGoldenCookieState !== Game.shimmerTypes.golden.n) {
|
||||
CM.Main.lastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (CM.Main.lastGoldenCookieState) {
|
||||
if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) {
|
||||
CM.Disp.Flash(3, 'GCFlash');
|
||||
CM.Disp.PlaySound(CM.Options.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
CM.Disp.Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!');
|
||||
}
|
||||
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] === 'undefined') {
|
||||
CM.Disp.CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CM.Disp.UpdateFavicon();
|
||||
CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState;
|
||||
if (CM.Main.currSpawnedGoldenCookieState === 0) CM.Cache.spawnedGoldenShimmer = 0;
|
||||
} else if (CM.Options.GCTimer === 1 && CM.Main.lastGoldenCookieState) {
|
||||
for (const i of Object.keys(CM.Disp.GCTimers)) {
|
||||
CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity;
|
||||
CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform;
|
||||
CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if there is reindeer that has spawned
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckSeasonPopup = function () {
|
||||
if (CM.Main.lastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
|
||||
CM.Main.lastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CM.Cache.seasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
CM.Disp.Flash(3, 'SeaFlash');
|
||||
CM.Disp.PlaySound(CM.Options.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
CM.Disp.Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if there is a fortune cookie on the ticker
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckTickerFortune = function () {
|
||||
if (CM.Main.lastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
|
||||
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
|
||||
if (CM.Main.lastTickerFortuneState) {
|
||||
CM.Disp.Flash(3, 'FortuneFlash');
|
||||
CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
CM.Disp.Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if a garden tick has happened
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckGardenTick = function () {
|
||||
if (Game.Objects.Farm.minigameLoaded && CM.Main.lastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) {
|
||||
if (CM.Main.lastGardenNextStep !== 0 && CM.Main.lastGardenNextStep < Date.now()) {
|
||||
CM.Disp.Flash(3, 'GardFlash');
|
||||
CM.Disp.PlaySound(CM.Options.GardSoundURL, 'GardSound', 'GardVolume');
|
||||
}
|
||||
CM.Main.lastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if the magic meter is full
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckMagicMeter = function () {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
|
||||
else if (!CM.Main.lastMagicBarFull) {
|
||||
CM.Main.lastMagicBarFull = true;
|
||||
CM.Disp.Flash(3, 'MagicFlash');
|
||||
CM.Disp.PlaySound(CM.Options.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
CM.Disp.Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if any new Wrinklers have popped up
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
CM.Main.CheckWrinklerCount = function () {
|
||||
if (Game.elderWrath > 0) {
|
||||
let CurrentWrinklers = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
|
||||
}
|
||||
if (CurrentWrinklers > CM.Main.lastWrinklerCount) {
|
||||
CM.Main.lastWrinklerCount = CurrentWrinklers;
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) {
|
||||
CM.Disp.Flash(3, 'WrinklerMaxFlash');
|
||||
} else {
|
||||
CM.Disp.Flash(3, 'WrinklerFlash');
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) {
|
||||
CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
|
||||
} else {
|
||||
CM.Disp.PlaySound(CM.Options.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) {
|
||||
CM.Disp.Notification('WrinklerMaxNotification', 'Maximum Wrinklers Reached', 'You have reached your maximum ammount of wrinklers');
|
||||
} else {
|
||||
CM.Disp.Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared');
|
||||
}
|
||||
} else {
|
||||
CM.Main.lastWrinklerCount = CurrentWrinklers;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
|
||||
* It is called by CM.Main.DelayInit
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
CM.Main.AddWrinklerAreaDetect = function () {
|
||||
l('backgroundLeftCanvas').onmouseover = function () { CM.Disp.TooltipWrinklerArea = 1; };
|
||||
l('backgroundLeftCanvas').onmouseout = function () {
|
||||
CM.Disp.TooltipWrinklerArea = 0;
|
||||
Game.tooltip.hide();
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
CM.Disp.TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Section: Functions related to the mouse */
|
||||
|
||||
/**
|
||||
* This function fixes Game.mouseY as a result of bars that are added by CookieMonster
|
||||
* It is called by Game.UpdateWrinklers(), Game.UpdateSpecial() and the .onmousover of the BigCookie
|
||||
* before execution of their actual function
|
||||
*/
|
||||
CM.Main.FixMouseY = function (target) {
|
||||
if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
|
||||
const timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
|
||||
Game.mouseY -= timerBarHeight;
|
||||
target();
|
||||
Game.mouseY += timerBarHeight;
|
||||
} else {
|
||||
target();
|
||||
}
|
||||
};
|
||||
|
||||
1027
src/Sim.js
1027
src/Sim.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user