Compare commits
819 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
641471b5bc | ||
|
|
b470d13316 | ||
|
|
36534be654 | ||
|
|
1c3a27bc9a | ||
|
|
8f5e40d3be | ||
|
|
2c309c04c2 | ||
|
|
6b2425fa19 | ||
|
|
104159e4ac | ||
|
|
00edec127c | ||
|
|
4d716e77e4 | ||
|
|
1a0750e8d7 | ||
|
|
ff81b4ff02 | ||
|
|
f3b0bfa16d | ||
|
|
9c2350a8e3 | ||
|
|
b66caab11e | ||
|
|
5390c1af58 | ||
|
|
af508ceee5 | ||
|
|
f6b2e70f9b | ||
|
|
6caee4d8fb | ||
|
|
e3d3f649c3 | ||
|
|
f138745a0f | ||
|
|
0253e9b80d | ||
|
|
d35217b6d5 | ||
|
|
b201e15c8e | ||
|
|
0a30d8e3e8 | ||
|
|
a65af049b6 | ||
|
|
26d8e75935 | ||
|
|
87eac02185 | ||
|
|
8ff50fbbb9 | ||
|
|
c3b1637d08 | ||
|
|
c72e01687f | ||
|
|
022b3860eb | ||
|
|
b09dcd6f47 | ||
|
|
eee72bceb6 | ||
|
|
7b3a7816f1 | ||
|
|
403eb59cfd | ||
|
|
220b67b440 | ||
|
|
b6d9ca8dbb | ||
|
|
1c955e5da3 | ||
|
|
9e9158ce81 | ||
|
|
71479a05e7 | ||
|
|
7ec13d80bd | ||
|
|
fd2aa16c60 | ||
|
|
7831521bc5 | ||
|
|
6193fc8d3e | ||
|
|
f85cde5fea | ||
|
|
2f34b26602 | ||
|
|
189ccbce49 | ||
|
|
3e07541fd5 | ||
|
|
932509a877 | ||
|
|
f3e7964262 | ||
|
|
9b0429c141 | ||
|
|
5dda8cac55 | ||
|
|
d6675fe86d | ||
|
|
80b8a0b834 | ||
|
|
817c5b0e3c | ||
|
|
49b8414edf | ||
|
|
99ae657c45 | ||
|
|
409a8e2911 | ||
|
|
08c2f99b21 | ||
|
|
3247057394 | ||
|
|
d1fe5c013c | ||
|
|
0cd5732e65 | ||
|
|
2b3b9a6f34 | ||
|
|
458dd873b4 | ||
|
|
5a3627b6d3 | ||
|
|
8099a5794b | ||
|
|
a983ec23b0 | ||
|
|
9a5e2d2e66 | ||
|
|
5f864d9055 | ||
|
|
1bffb58782 | ||
|
|
bb34bce9a5 | ||
|
|
1604b4697e | ||
|
|
d429719a57 | ||
|
|
3902589306 | ||
|
|
1d01caef98 | ||
|
|
b388e2eb9c | ||
|
|
e60d514ad6 | ||
|
|
2835438e8e | ||
|
|
771180776e | ||
|
|
5cd266b91f | ||
|
|
6ca414ed17 | ||
|
|
61a30c704f | ||
|
|
75bf3f5c17 | ||
|
|
db22e07d8e | ||
|
|
0bd8cc898e | ||
|
|
c96a2f4f89 | ||
|
|
31088ca686 | ||
|
|
c95711d8b9 | ||
|
|
3ce7822854 | ||
|
|
57fb8430a0 | ||
|
|
3975032f4b | ||
|
|
2ccb4ad550 | ||
|
|
2cf5ba6820 | ||
|
|
a985c3ba89 | ||
|
|
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 | ||
|
|
f120f047dc | ||
|
|
13a49e3e39 | ||
|
|
762a6919e7 | ||
|
|
77ba8c4e84 | ||
|
|
914a5e2ff3 | ||
|
|
6bced494f8 | ||
|
|
ee35136130 | ||
|
|
85ed508010 | ||
|
|
0ea31f6e94 | ||
|
|
5ceffa9d63 | ||
|
|
07b67be07e | ||
|
|
5aa21209b9 | ||
|
|
14c1afa30d | ||
|
|
f36869d528 | ||
|
|
da3200612b | ||
|
|
d870823c07 | ||
|
|
b134e3b45c | ||
|
|
07944e366a | ||
|
|
dbcec54b3d | ||
|
|
f1ccbf8937 | ||
|
|
56903744d8 | ||
|
|
2ff6ea0746 | ||
|
|
a251c5a906 | ||
|
|
35ddafdca7 | ||
|
|
2063fa9db7 | ||
|
|
b9486e9895 | ||
|
|
cd18b1a402 | ||
|
|
4118343606 | ||
|
|
0941e33c11 | ||
|
|
971f08b125 | ||
|
|
cd7376eaf6 | ||
|
|
89e8ec86db | ||
|
|
47b6d4d83f | ||
|
|
e5ce8e5ebd | ||
|
|
fb83f6679a | ||
|
|
6957513960 | ||
|
|
c54ecefe4b | ||
|
|
450db504be | ||
|
|
da917ebc6b | ||
|
|
d997ff7652 | ||
|
|
c34bcbfc3a | ||
|
|
3ddd1b3d23 | ||
|
|
af05f9907c | ||
|
|
9a2d96d043 | ||
|
|
28c5909e1f | ||
|
|
1418c17ec9 | ||
|
|
a8d404aca7 | ||
|
|
989ef30f4a | ||
|
|
e877f05a06 |
6
.eslintignore
Normal file
6
.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
CookieMonster.js
|
||||
CookieMonster.user.js
|
||||
src/*.js
|
||||
!src/CookieMonster.js
|
||||
!src/*/*
|
||||
dist/*
|
||||
27
.eslintrc.js
Normal file
27
.eslintrc.js
Normal file
@@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
},
|
||||
globals: {
|
||||
Game: 'writable',
|
||||
l: 'readonly',
|
||||
b64_to_utf8: 'readonly',
|
||||
utf8_to_b64: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
},
|
||||
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
rules: {
|
||||
'import/no-mutable-exports': 'off',
|
||||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-new-func': 'off',
|
||||
'func-names': 'off',
|
||||
'no-console': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'prefer-destructuring': ['error', { object: true, array: false }],
|
||||
},
|
||||
};
|
||||
18
.github/CONTRIBUTING.md
vendored
Normal file
18
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data.
|
||||
|
||||
The following is a short description of the various `src` directories and their contents:
|
||||
|
||||
JS | Description
|
||||
-- | -
|
||||
Cache | Functions related to creating and storing data cache
|
||||
Config | Functions related to manipulating CM configuration
|
||||
Data | Hard coded values
|
||||
Disp | Functions related to displaying CM's UI
|
||||
InitSaveLoad | Functions related to registering the CM object with the Game's Modding API
|
||||
Main | Functions related to the main loop and initializing CM
|
||||
Sim | Functions related to simulate something
|
||||
|
||||
These are some additional guidelines:
|
||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
||||
- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message.
|
||||
- PR's should target the `dev` branch
|
||||
24
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
24
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Please use this template to report bugs you might have found
|
||||
title: ''
|
||||
labels: Bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
Please describe the bug and what you would have expected the mod to do
|
||||
|
||||
**To Reproduce**
|
||||
The steps needed to reproduce the behavior:
|
||||
1. ...
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Save file**
|
||||
```
|
||||
Please add a save file here.
|
||||
This makes debugging much easier as we do not always have a good test save to debug the issue
|
||||
```
|
||||
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.
|
||||
0
LICENSE → .github/LICENSE.md
vendored
0
LICENSE → .github/LICENSE.md
vendored
31
.github/workflows/CI.yml
vendored
Normal file
31
.github/workflows/CI.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: CI
|
||||
on: 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 webpack -o ./test --env production
|
||||
if cmp <(head -n 2 dist/CookieMonster.js) <(head -n 2 test/CookieMonster.js); then
|
||||
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
||||
else
|
||||
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
|
||||
if cmp <(head -n 2 CookieMonster.js) <(head -n 2 test/CookieMonster.js); then
|
||||
echo '### SUCCESS: CookieMonster is correctly built! ###'
|
||||
else
|
||||
echo '### WARNING: Make sure to move the file from the /dist folder to the main folder. Otherwise Github Pages won't notice it ###'
|
||||
exit 1
|
||||
fi
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
5
.prettierrc.json
Normal file
5
.prettierrc.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 80
|
||||
}
|
||||
@@ -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
|
||||
2316
CookieMonster.js
2316
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);
|
||||
116
README.md
116
README.md
@@ -1,107 +1,75 @@
|
||||
# Cookie Monster
|
||||

|
||||
## Cookie Monster
|
||||
|
||||
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. It is **not** a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
||||
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. **It is not a cheat interface** – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
||||
The mod helps you to *whichever* degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
||||
|
||||
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
|
||||
The `gh-pages` branch hosts the latest version intended for general users. All development and pull requests should target the `dev` branch.
|
||||
|
||||
## Current version
|
||||
### What it does
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
* 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
|
||||
* Gray : (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth.
|
||||
* Light Blue: (upgrades) This item has a better PP than the best building to buy
|
||||
* Green: This building has the best PP
|
||||
* Yellow: This building is within the top 10 of best PP's
|
||||
* Orange: This building is within the top 20 of best PP's
|
||||
* Red: This building is within the top 30 of best PP's
|
||||
* Purple: This building is worse than the top 10 of best PP's
|
||||
* Gray: This item does not have a PP, often this means that there is no change to CPS
|
||||
|
||||
Note : For this index, **lower is better**, meaning a building with a 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
|
||||
## Using
|
||||
|
||||
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.**
|
||||
|
||||
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
|
||||
|
||||
## 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.
|
||||
|
||||
## Userscript
|
||||
### Userscript
|
||||
|
||||
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.
|
||||
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".
|
||||
|
||||
```javascript
|
||||
// ==UserScript==
|
||||
// @name Cookie Monster
|
||||
// @namespace Cookie
|
||||
// @include http://orteil.dashnet.org/cookieclicker/
|
||||
// @version 1
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
**Note that to avoid conflicts Cookie Monster should ideally be loaded after any other content mods have been loaded**
|
||||
|
||||
javascript:(function() {
|
||||
var checkReady = setInterval(function() {
|
||||
if (Game.ready != undefined && Game.ready) {
|
||||
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js');
|
||||
clearInterval(checkReady);
|
||||
}
|
||||
}, 1000);
|
||||
}());
|
||||
```
|
||||
## Bugs and suggestions
|
||||
|
||||
# Bugs and suggestions
|
||||
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/Aktanusa/CookieMonster/issues) for easier tracking. This allows us to close issues once they're fixed.
|
||||
|
||||
Any bug or suggestion should be **opened as an issue** [in the repository](https://github.com/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.
|
||||
Before submitting a bug, make sure to give a shot at the latest version of the addon on the `dev` branch. This version can be tested by copying the `CookieMonster.js` file of the dev branch into your console. If the bug is still here, you can submit an issue for it. Please do so by using the bug report template.
|
||||
|
||||
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
|
||||
|
||||
2
dist/CookieMonster.js
vendored
Normal file
2
dist/CookieMonster.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
dist/CookieMonster.js.LICENSE.txt
vendored
Normal file
10
dist/CookieMonster.js.LICENSE.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* jscolor - JavaScript Color Picker
|
||||
*
|
||||
* @link http://jscolor.com
|
||||
* @license For open source use: GPLv3
|
||||
* For commercial use: JSColor Commercial License
|
||||
* @author Jan Odvarko - East Desire
|
||||
*
|
||||
* See usage examples at http://jscolor.com/examples/
|
||||
*/
|
||||
1
dist/CookieMonster.js.map
vendored
Normal file
1
dist/CookieMonster.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
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 |
6172
package-lock.json
generated
Normal file
6172
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
67
package.json
Normal file
67
package.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "cookiemonster-mod",
|
||||
"version": "2.031.6",
|
||||
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||
"main": "CookieMonster.js",
|
||||
"keywords": [
|
||||
"Cookie Clicker",
|
||||
"javascript",
|
||||
"mod",
|
||||
"Dashnet",
|
||||
"Orteil"
|
||||
],
|
||||
"scripts": {
|
||||
"copy-file": "cp dist/CookieMonster.js CookieMonster.js",
|
||||
"eslint-src": "eslint src",
|
||||
"build": "run-s eslint-src pack-prod remove-comment copy-file",
|
||||
"build-test": "run-s pack-dev",
|
||||
"pack-prod": "webpack --env production",
|
||||
"pack-dev": "webpack",
|
||||
"remove-comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"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-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "2.2.1",
|
||||
"webpack": "^5.24.4",
|
||||
"webpack-cli": "^4.5.0"
|
||||
},
|
||||
"ccrepo": {
|
||||
"icon": [
|
||||
10,
|
||||
0
|
||||
],
|
||||
"name": "Cookie Monster"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eastdesire/jscolor": "^2.4.5"
|
||||
}
|
||||
}
|
||||
169
src/Cache.js
169
src/Cache.js
@@ -1,169 +0,0 @@
|
||||
/*********
|
||||
* Cache *
|
||||
*********/
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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 * 20) / 0.1;
|
||||
if (Game.frenzy > 0) {
|
||||
CM.Cache.Lucky /= Game.frenzyPower;
|
||||
}
|
||||
CM.Cache.LuckyReward = (CM.Cache.Lucky * 0.1) + 13;
|
||||
CM.Cache.LuckyFrenzy = CM.Cache.Lucky * 7;
|
||||
CM.Cache.LuckyRewardFrenzy = (CM.Cache.LuckyFrenzy * 0.1) + 13;
|
||||
}
|
||||
|
||||
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));
|
||||
while (nextMoni < maxPayout) {
|
||||
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;
|
||||
}
|
||||
|
||||
CM.Cache.RemakeChain = function() {
|
||||
var maxPayout = Game.cookiesPs * 60 * 60 * 3;
|
||||
if (Game.frenzy > 0) {
|
||||
maxPayout /= Game.frenzyPower;
|
||||
}
|
||||
|
||||
CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout);
|
||||
|
||||
CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout);
|
||||
|
||||
var base = 0;
|
||||
if (CM.Cache.ChainReward > CM.Cache.ChainWrathReward) {
|
||||
base = CM.Cache.ChainReward;
|
||||
}
|
||||
else {
|
||||
base = CM.Cache.ChainWrathReward;
|
||||
}
|
||||
var count = 1;
|
||||
if (maxPayout < base) {
|
||||
CM.Cache.Chain = 0;
|
||||
}
|
||||
else {
|
||||
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.Chain = (base + count) / 0.25;
|
||||
}
|
||||
|
||||
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7);
|
||||
|
||||
CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7);
|
||||
|
||||
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 {
|
||||
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.ChainFrenzy = (base + count) / 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
CM.Cache.RemakeSeaSpec = function() {
|
||||
if (Game.season == 'christmas') {
|
||||
CM.Cache.SeaSpec = Math.max(25, Game.cookiesPs * 60 * 1);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CM.Cache.SeaSpec *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
65
src/Cache/CPS/AverageQueue.js
Normal file
65
src/Cache/CPS/AverageQueue.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
ChoEggDiff,
|
||||
ClicksDiff,
|
||||
CookiesDiff,
|
||||
WrinkDiff,
|
||||
WrinkFattestDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
export class CMAvgQueue {
|
||||
constructor(maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
this.queue = [];
|
||||
}
|
||||
|
||||
addLatest(newValue) {
|
||||
if (this.queue.push(newValue) > this.maxLength) {
|
||||
this.queue.shift();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
let time = timePeriod;
|
||||
if (time > this.maxLength) time = this.maxLength;
|
||||
if (time > this.queue.length) time = this.queue.length;
|
||||
let ret = 0;
|
||||
for (
|
||||
let i = this.queue.length - 1;
|
||||
i >= 0 && i > this.queue.length - 1 - time;
|
||||
i--
|
||||
) {
|
||||
ret += this.queue[i];
|
||||
}
|
||||
if (ret === 0) {
|
||||
return 0;
|
||||
}
|
||||
return ret / time;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches creates the CMAvgQueue used by CM.Cache.CacheAvgCPS() to calculate CPS
|
||||
* Called by CM.Cache.InitCache()
|
||||
*/
|
||||
export function InitCookiesDiff() {
|
||||
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]);
|
||||
}
|
||||
98
src/Cache/CPS/CPS.js
Normal file
98
src/Cache/CPS/CPS.js
Normal file
@@ -0,0 +1,98 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
CacheAverageClicks,
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainChoEgg,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheLastChoEgg,
|
||||
CacheLastClicks,
|
||||
CacheLastCookies,
|
||||
CacheLastCPSCheck,
|
||||
CacheLastWrinkCookies,
|
||||
CacheLastWrinkFattestCookies,
|
||||
CacheRealCookiesEarned,
|
||||
CacheSellForChoEgg,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
ChoEggDiff,
|
||||
ClicksDiff,
|
||||
CookiesDiff,
|
||||
WrinkDiff,
|
||||
WrinkFattestDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheAvgCPS() {
|
||||
const currDate = Math.floor(Date.now() / 1000);
|
||||
// Only calculate every new second
|
||||
if ((Game.T / Game.fps) % 1 === 0) {
|
||||
let choEggTotal = Game.cookies + CacheSellForChoEgg;
|
||||
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
|
||||
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
||||
choEggTotal *= 0.05;
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
const timeDiff = currDate - CacheLastCPSCheck;
|
||||
const bankDiffAvg = Math.max(0, Game.cookies - CacheLastCookies) / timeDiff;
|
||||
const wrinkDiffAvg =
|
||||
Math.max(0, CacheWrinklersTotal - CacheLastWrinkCookies) / timeDiff;
|
||||
const wrinkFattestDiffAvg =
|
||||
Math.max(0, CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies) /
|
||||
timeDiff;
|
||||
const choEggDiffAvg = Math.max(0, choEggTotal - CacheLastChoEgg) / timeDiff;
|
||||
const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
CookiesDiff.addLatest(bankDiffAvg);
|
||||
WrinkDiff.addLatest(wrinkDiffAvg);
|
||||
WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
||||
ChoEggDiff.addLatest(choEggDiffAvg);
|
||||
ClicksDiff.addLatest(clicksDiffAvg);
|
||||
}
|
||||
|
||||
// Store current data for next loop
|
||||
CacheLastCPSCheck = currDate;
|
||||
CacheLastCookies = Game.cookies;
|
||||
CacheLastWrinkCookies = CacheWrinklersTotal;
|
||||
CacheLastWrinkFattestCookies = CacheWrinklersFattest[0];
|
||||
CacheLastChoEgg = choEggTotal;
|
||||
CacheLastClicks = Game.cookieClicks;
|
||||
|
||||
// Get average gain over period of cpsLength seconds
|
||||
const cpsLength = CookieTimes[CMOptions.AvgCPSHist];
|
||||
CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength);
|
||||
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
|
||||
CacheAverageCPS = CacheAverageGainBank;
|
||||
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink;
|
||||
if (CMOptions.CalcWrink === 2)
|
||||
CacheAverageCPS += CacheAverageGainWrinkFattest;
|
||||
|
||||
const choEgg =
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
|
||||
if (choEgg || CMOptions.CalcWrink === 0) {
|
||||
CacheAvgCPSWithChoEgg =
|
||||
CacheAverageGainBank +
|
||||
CacheAverageGainWrink +
|
||||
(choEgg ? CacheAverageGainChoEgg : 0);
|
||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(
|
||||
ClickTimes[CMOptions.AvgClicksHist],
|
||||
);
|
||||
}
|
||||
}
|
||||
33
src/Cache/CPS/CurrWrinklerCPS.js
Normal file
33
src/Cache/CPS/CurrWrinklerCPS.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheCurrWrinklerCount,
|
||||
CacheCurrWrinklerCPSMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the current Wrinkler CPS multiplier
|
||||
* @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)
|
||||
*/
|
||||
export default function CacheCurrWrinklerCPS() {
|
||||
CacheCurrWrinklerCPSMult = 0;
|
||||
let count = 0;
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) count += 1;
|
||||
});
|
||||
let godMult = 1;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
if (godLvl === 1) godMult *= 1.15;
|
||||
else if (godLvl === 2) godMult *= 1.1;
|
||||
else if (godLvl === 3) godMult *= 1.05;
|
||||
}
|
||||
CacheCurrWrinklerCount = count;
|
||||
CacheCurrWrinklerCPSMult =
|
||||
count *
|
||||
(count * 0.05 * 1.1) *
|
||||
(Game.Has('Sacrilegious corruption') * 0.05 + 1) *
|
||||
(Game.Has('Wrinklerspawn') * 0.05 + 1) *
|
||||
godMult;
|
||||
}
|
||||
12
src/Cache/CPS/GetCPSBuffMult.js
Normal file
12
src/Cache/CPS/GetCPSBuffMult.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* This function returns the current CPS buff
|
||||
* @returns {number} mult The multiplier
|
||||
*/
|
||||
export default function GetCPSBuffMult() {
|
||||
let mult = 1;
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined')
|
||||
mult *= Game.buffs[i].multCpS;
|
||||
});
|
||||
return mult;
|
||||
}
|
||||
14
src/Cache/CPS/NoGoldSwitchCPS.js
Normal file
14
src/Cache/CPS/NoGoldSwitchCPS.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheNoGoldSwitchCPS() {
|
||||
if (Game.Has('Golden switch [off]')) {
|
||||
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||
}
|
||||
25
src/Cache/CPS/SellChoEgg.js
Normal file
25
src/Cache/CPS/SellChoEgg.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
||||
import { CacheSellForChoEgg } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheSellAllForChoEgg() {
|
||||
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;
|
||||
Object.keys(marketGoods).forEach((i) => {
|
||||
const marketGood = marketGoods[i];
|
||||
goodsVal += marketGood.stock * marketGood.val;
|
||||
});
|
||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
sellTotal += SellBuildingsForChoEgg();
|
||||
CacheSellForChoEgg = sellTotal;
|
||||
}
|
||||
39
src/Cache/CacheInit.js
Normal file
39
src/Cache/CacheInit.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
||||
import CachePP from './PP/PP';
|
||||
import {
|
||||
CacheBuildingsPrices,
|
||||
CacheIncome,
|
||||
} from './PriceAndIncome/PriceAndIncome';
|
||||
import { CacheChain } from './Stats/ChainCookies';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||
import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
|
||||
import CacheSeasonSpec from './Stats/Reindeer';
|
||||
import {
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from './Stats/Stats';
|
||||
import { HeavenlyChipsDiff } from './VariablesAndData';
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
|
||||
/**
|
||||
* This functions runs all cache-functions to generate all "full" cache
|
||||
*/
|
||||
export default function InitCache() {
|
||||
CacheDragonAuras();
|
||||
CacheWrinklers();
|
||||
CacheStatsCookies();
|
||||
CacheGoldenAndWrathCookiesMults();
|
||||
CacheChain();
|
||||
CacheAllMissingUpgrades();
|
||||
CacheSeasonSpec();
|
||||
InitCookiesDiff();
|
||||
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS()
|
||||
CacheHeavenlyChipsPS();
|
||||
CacheAvgCPS();
|
||||
CacheIncome();
|
||||
CacheBuildingsPrices();
|
||||
CachePP();
|
||||
}
|
||||
31
src/Cache/CacheLoop.js
Normal file
31
src/Cache/CacheLoop.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheCurrWrinklerCPS from './CPS/CurrWrinklerCPS';
|
||||
import CachePP from './PP/PP';
|
||||
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
|
||||
import { CacheTimeTillNextPrestige } from './VariablesAndData';
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
|
||||
/**
|
||||
* This functions caches variables that are needed every loop
|
||||
* @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level
|
||||
*/
|
||||
export default function LoopCache() {
|
||||
// Update Wrinkler Bank
|
||||
CacheWrinklers();
|
||||
|
||||
CachePP();
|
||||
CacheCurrWrinklerCPS();
|
||||
CacheAvgCPS();
|
||||
CacheHeavenlyChipsPS();
|
||||
|
||||
const cookiesToNext =
|
||||
Game.HowManyCookiesReset(
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) +
|
||||
1,
|
||||
) -
|
||||
(Game.cookiesEarned + Game.cookiesReset);
|
||||
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS());
|
||||
}
|
||||
10
src/Cache/Dragon/CacheDragonAuras.js
Normal file
10
src/Cache/Dragon/CacheDragonAuras.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the currently selected Dragon Auras
|
||||
*/
|
||||
export default function CacheDragonAuras() {
|
||||
CacheDragonAura = Game.dragonAura;
|
||||
CacheDragonAura2 = Game.dragonAura2;
|
||||
}
|
||||
81
src/Cache/Dragon/Dragon.js
Normal file
81
src/Cache/Dragon/Dragon.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheCostDragonUpgrade,
|
||||
CacheDragonAura,
|
||||
CacheDragonAura2,
|
||||
CacheLastDragonLevel,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
|
||||
*/
|
||||
export default function CacheDragonCost() {
|
||||
if (CacheLastDragonLevel !== Game.dragonLevel || SimDoSims) {
|
||||
if (
|
||||
Game.dragonLevel < 25 &&
|
||||
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
||||
) {
|
||||
let target = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/Objects\[(.*)\]/)[1];
|
||||
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||
.toString()
|
||||
.match(/sacrifice\((.*?)\)/)[1];
|
||||
if (target !== 'i') {
|
||||
target = target.replaceAll("'", '');
|
||||
if (Game.Objects[target].amount < amount) {
|
||||
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
||||
} else {
|
||||
let cost = 0;
|
||||
CopyData();
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price =
|
||||
SimObjects[target].basePrice *
|
||||
Game.priceIncrease **
|
||||
Math.max(
|
||||
0,
|
||||
SimObjects[target].amount - 1 - SimObjects[target].free,
|
||||
);
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
|
||||
}
|
||||
} else {
|
||||
let cost = 0;
|
||||
CopyData();
|
||||
for (const j of Object.keys(Game.Objects)) {
|
||||
target = j;
|
||||
if (Game.Objects[target].amount < amount) {
|
||||
CacheCostDragonUpgrade = 'Not enough buildings to sell';
|
||||
break;
|
||||
} else {
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price =
|
||||
SimObjects[target].basePrice *
|
||||
Game.priceIncrease **
|
||||
Math.max(
|
||||
0,
|
||||
SimObjects[target].amount - 1 - SimObjects[target].free,
|
||||
);
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
CacheLastDragonLevel = Game.dragonLevel;
|
||||
}
|
||||
}
|
||||
76
src/Cache/PP/Building.js
Normal file
76
src/Cache/PP/Building.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGray } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
CacheMinPP,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CachePPArray,
|
||||
} from '../VariablesAndData';
|
||||
import ColourOfPP from './ColourOfPP';
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*/
|
||||
function CacheColor(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
target[i].color = ColourOfPP(
|
||||
target[i],
|
||||
Game.Objects[i].getSumPrice(amount),
|
||||
);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColorGray;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function CachePP(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
const price = Game.Objects[i].getSumPrice(amount);
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||
Game.cookiesPs +
|
||||
price / target[i].bonus;
|
||||
} else target[i].pp = price / target[i].bonus;
|
||||
CachePPArray.push([target[i].pp, amount]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building it saves all date in CM.Cache.Objects...
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
export default function CacheBuildingsPP() {
|
||||
CacheMinPP = Infinity;
|
||||
CachePPArray = [];
|
||||
if (typeof CMOptions.PPExcludeTop === 'undefined') CMOptions.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||
|
||||
// Calculate PP and colors
|
||||
CachePP(CacheObjects1, 1);
|
||||
CachePP(CacheObjects10, 10);
|
||||
CachePP(CacheObjects100, 100);
|
||||
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CachePPArray.sort((a, b) => a[0] - b[0]);
|
||||
let indexOfMin = 0;
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
while (CachePPArray[indexOfMin][1] > Game.cookies) {
|
||||
indexOfMin += 1;
|
||||
if (CachePPArray.length === indexOfMin + 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin];
|
||||
|
||||
CacheColor(CacheObjects1, 1);
|
||||
CacheColor(CacheObjects10, 10);
|
||||
CacheColor(CacheObjects100, 100);
|
||||
}
|
||||
42
src/Cache/PP/ColourOfPP.js
Normal file
42
src/Cache/PP/ColourOfPP.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import {
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../../Disp/VariablesAndData';
|
||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function ColourOfPP(me, price) {
|
||||
let color = '';
|
||||
// Colour based on PP
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = ColorGray;
|
||||
else if (me.pp < CacheMinPP) color = ColorBlue;
|
||||
else if (me.pp === CacheMinPP) color = ColorGreen;
|
||||
else if (me.pp < CachePPArray[10][0]) color = ColorYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) color = ColorOrange;
|
||||
else if (me.pp > CachePPArray[30][0]) color = ColorRed;
|
||||
else color = ColorPurple;
|
||||
|
||||
// Colour based on price in terms of CPS
|
||||
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit))
|
||||
color = ColorBlue;
|
||||
}
|
||||
// Colour based on being able to purchase
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
if (price - Game.cookies > 0) color = ColorRed;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
14
src/Cache/PP/PP.js
Normal file
14
src/Cache/PP/PP.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Section: Functions related to caching PP */
|
||||
|
||||
import CacheBuildingsPP from './Building';
|
||||
import CacheUpgradePP from './Upgrade';
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*/
|
||||
export default function CachePP() {
|
||||
CacheBuildingsPP();
|
||||
CacheUpgradePP();
|
||||
}
|
||||
29
src/Cache/PP/Upgrade.js
Normal file
29
src/Cache/PP/Upgrade.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { CacheUpgrades } from '../VariablesAndData';
|
||||
import ColourOfPP from './ColourOfPP';
|
||||
|
||||
/**
|
||||
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
export default function CacheUpgradePP() {
|
||||
Object.keys(CacheUpgrades).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheUpgrades[i].pp =
|
||||
Math.max(
|
||||
Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()),
|
||||
0,
|
||||
) /
|
||||
Game.cookiesPs +
|
||||
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
||||
} else
|
||||
CacheUpgrades[i].pp =
|
||||
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
||||
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
|
||||
|
||||
CacheUpgrades[i].color = ColourOfPP(
|
||||
CacheUpgrades[i],
|
||||
Game.Upgrades[i].getPrice(),
|
||||
);
|
||||
});
|
||||
}
|
||||
13
src/Cache/PantheonGods/CacheGods.js
Normal file
13
src/Cache/PantheonGods/CacheGods.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange';
|
||||
import { CacheGods } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the cps effect of each God in slot 1, 2 or 3
|
||||
*/
|
||||
export default function CachePantheonGods() {
|
||||
for (let god = 0; god < 11; god += 1) {
|
||||
for (let slot = 0; slot < 3; slot += 1) {
|
||||
CacheGods[god][slot] = CalculateChangeGod(god, slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
103
src/Cache/PriceAndIncome/PriceAndIncome.js
Normal file
103
src/Cache/PriceAndIncome/PriceAndIncome.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Section: Functions related to caching income */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
||||
import {
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
CacheDoRemakeBuildPrices,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheUpgrades,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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")
|
||||
*/
|
||||
function CacheBuildingIncome(amount, target) {
|
||||
const result = [];
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
result[i] = {};
|
||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions starts the calculation/simulation of the bonus income of upgrades
|
||||
* It is called by CM.Cache.CacheIncome()
|
||||
*/
|
||||
function CacheUpgradeIncome() {
|
||||
CacheUpgrades = [];
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||
if (i === 'Elder Pledge') {
|
||||
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
|
||||
if (CMOptions.CalcWrink === 1)
|
||||
CacheUpgrades[i].bonus -= CacheAverageGainWrink;
|
||||
else if (CMOptions.CalcWrink === 2)
|
||||
CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
|
||||
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
|
||||
} else {
|
||||
CacheUpgrades[i] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches the price of each building and stores it in the cache
|
||||
*/
|
||||
export function CacheBuildingsPrices() {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CacheObjects1[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
1,
|
||||
);
|
||||
CacheObjects10[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
10,
|
||||
);
|
||||
CacheObjects100[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
Game.Objects[i].amount,
|
||||
Game.Objects[i].free,
|
||||
100,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*/
|
||||
export function CacheIncome() {
|
||||
// Simulate Building Buys for 1, 10 and 100 amount
|
||||
CacheObjects1 = CacheBuildingIncome(1);
|
||||
CacheObjects10 = CacheBuildingIncome(10);
|
||||
CacheObjects100 = CacheBuildingIncome(100);
|
||||
|
||||
// Simulate Upgrade Buys
|
||||
CacheUpgradeIncome();
|
||||
}
|
||||
137
src/Cache/Stats/ChainCookies.js
Normal file
137
src/Cache/Stats/ChainCookies.js
Normal file
@@ -0,0 +1,137 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
CacheChainFrenzyWrathMaxReward,
|
||||
CacheChainFrenzyWrathRequired,
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
CacheChainMaxReward,
|
||||
CacheChainRequired,
|
||||
CacheChainRequiredNext,
|
||||
CacheChainWrathMaxReward,
|
||||
CacheChainWrathRequired,
|
||||
CacheChainWrathRequiredNext,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export function MaxChainCookieReward(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 += 1;
|
||||
}
|
||||
return [totalFromChain, moni, nextRequired];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export function CacheChain() {
|
||||
let maxPayout =
|
||||
CacheNoGoldSwitchCookiesPS *
|
||||
60 *
|
||||
60 *
|
||||
6 *
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
// Removes effect of Frenzy etc.
|
||||
const cpsBuffMult = GetCPSBuffMult();
|
||||
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
||||
else maxPayout = 0;
|
||||
|
||||
CacheChainMaxReward = MaxChainCookieReward(
|
||||
7,
|
||||
maxPayout,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainRequiredNext =
|
||||
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainWrathMaxReward = MaxChainCookieReward(
|
||||
6,
|
||||
maxPayout,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainWrathRequired =
|
||||
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainWrathRequiredNext =
|
||||
CacheChainWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainFrenzyMaxReward = MaxChainCookieReward(
|
||||
7,
|
||||
maxPayout * 7,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyRequired =
|
||||
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainFrenzyRequiredNext =
|
||||
CacheChainFrenzyMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(
|
||||
6,
|
||||
maxPayout * 7,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyWrathRequired =
|
||||
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainFrenzyWrathRequiredNext =
|
||||
CacheChainFrenzyWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
6 /
|
||||
CacheDragonsFortuneMultAdjustment;
|
||||
}
|
||||
39
src/Cache/Stats/HeavenlyChips.js
Normal file
39
src/Cache/Stats/HeavenlyChips.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
CacheHCPerSecond,
|
||||
CacheLastHeavenlyCheck,
|
||||
CacheLastHeavenlyChips,
|
||||
HeavenlyChipsDiff,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheHeavenlyChipsPS() {
|
||||
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 - CacheLastHeavenlyCheck;
|
||||
const heavenlyChipsDiffAvg =
|
||||
Math.max(0, ascendNowToGet - CacheLastHeavenlyChips) / timeDiff;
|
||||
for (let i = 0; i < timeDiff; i++) {
|
||||
HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
|
||||
}
|
||||
|
||||
// Store current data for next loop
|
||||
CacheLastHeavenlyCheck = currDate;
|
||||
CacheLastHeavenlyChips = ascendNowToGet;
|
||||
|
||||
// Get average gain over period of 5 seconds
|
||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
||||
}
|
||||
}
|
||||
49
src/Cache/Stats/MissingUpgrades.js
Normal file
49
src/Cache/Stats/MissingUpgrades.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { crateMissing } from '../../Disp/MenuSections/CreateMissingUpgrades';
|
||||
import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
CacheMissingUpgradesPrestige,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheAllMissingUpgrades() {
|
||||
CacheMissingUpgrades = '';
|
||||
CacheMissingUpgradesCookies = '';
|
||||
CacheMissingUpgradesPrestige = '';
|
||||
const list = [];
|
||||
// sort the upgrades
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
list.push(Game.Upgrades[i]);
|
||||
});
|
||||
const sortMap = function (a, b) {
|
||||
if (a.order > b.order) return 1;
|
||||
if (a.order < b.order) return -1;
|
||||
return 0;
|
||||
};
|
||||
list.sort(sortMap);
|
||||
|
||||
Object.keys(list).forEach((i) => {
|
||||
const me = list[i];
|
||||
|
||||
if (me.bought === 0) {
|
||||
let str = '';
|
||||
|
||||
str += crateMissing(me);
|
||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||
else if (
|
||||
me.pool !== 'toggle' &&
|
||||
me.pool !== 'unused' &&
|
||||
me.pool !== 'debug'
|
||||
)
|
||||
CacheMissingUpgrades += str;
|
||||
}
|
||||
});
|
||||
}
|
||||
17
src/Cache/Stats/Reindeer.js
Normal file
17
src/Cache/Stats/Reindeer.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheSeaSpec } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheSeasonSpec() {
|
||||
if (Game.season === 'christmas') {
|
||||
let val = Game.cookiesPs * 60;
|
||||
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
|
||||
if (Game.hasBuff('Frenzy')) val *= 0.75;
|
||||
CacheSeaSpec = Math.max(25, val);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
||||
}
|
||||
}
|
||||
91
src/Cache/Stats/Stats.js
Normal file
91
src/Cache/Stats/Stats.js
Normal file
@@ -0,0 +1,91 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to Caching stats */
|
||||
|
||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheConjure,
|
||||
CacheConjureReward,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheLucky,
|
||||
CacheLuckyFrenzy,
|
||||
CacheLuckyReward,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheWrathCookiesMult,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches variables related to the stats page
|
||||
*/
|
||||
export function CacheStatsCookies() {
|
||||
CacheLucky = (CacheNoGoldSwitchCookiesPS * 900) / 0.15;
|
||||
CacheLucky *= CacheDragonsFortuneMultAdjustment;
|
||||
const cpsBuffMult = GetCPSBuffMult();
|
||||
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
|
||||
else CacheLucky = 0;
|
||||
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyFrenzy = CacheLucky * 7;
|
||||
CacheLuckyRewardFrenzy =
|
||||
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheLuckyWrathRewardFrenzy =
|
||||
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheConjure = CacheLucky * 2;
|
||||
CacheConjureReward = CacheConjure * 0.15;
|
||||
|
||||
CacheEdifice = 0;
|
||||
let max = 0;
|
||||
let n = 0;
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||
if (Game.Objects[i].amount > 0) n += 1;
|
||||
});
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (
|
||||
(Game.Objects[i].amount < max || n === 1) &&
|
||||
Game.Objects[i].amount < 400 &&
|
||||
Game.Objects[i].price * 2 > CacheEdifice
|
||||
) {
|
||||
CacheEdifice = Game.Objects[i].price * 2;
|
||||
CacheEdificeBuilding = i;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
||||
*/
|
||||
export function CacheGoldenAndWrathCookiesMults() {
|
||||
let goldenMult = 1;
|
||||
let wrathMult = 1;
|
||||
let mult = 1;
|
||||
|
||||
// Factor auras and upgrade in mults
|
||||
if (SimHas('Green yeast digestives')) mult *= 1.01;
|
||||
if (SimHas('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
|
||||
CacheGoldenCookiesMult = mult * goldenMult;
|
||||
CacheWrathCookiesMult = 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.
|
||||
CacheDragonsFortuneMultAdjustment = 1;
|
||||
if (Game.shimmerTypes.golden.n === 0) {
|
||||
CacheDragonsFortuneMultAdjustment *=
|
||||
1 + Game.auraMult("Dragon's Fortune") * 1.23;
|
||||
}
|
||||
}
|
||||
116
src/Cache/VariablesAndData.js
Normal file
116
src/Cache/VariablesAndData.js
Normal file
@@ -0,0 +1,116 @@
|
||||
/* eslint-disable prefer-const */
|
||||
|
||||
export let CacheDragonAura = 0;
|
||||
export let CacheDragonAura2 = 0;
|
||||
export let CacheLastDragonLevel = 0;
|
||||
export let CacheCostDragonUpgrade = 0;
|
||||
export let CacheLucky = 0;
|
||||
export let CacheLuckyReward = 0;
|
||||
export let CacheLuckyWrathReward = 0;
|
||||
export let CacheLuckyFrenzy = 0;
|
||||
export let CacheLuckyRewardFrenzy = 0;
|
||||
export let CacheLuckyWrathRewardFrenzy = 0;
|
||||
export let CacheConjure = 0;
|
||||
export let CacheConjureReward = 0;
|
||||
export let CacheEdifice = 0;
|
||||
export let CacheEdificeBuilding = 0;
|
||||
export let CacheNoGoldSwitchCookiesPS = 0;
|
||||
export let CacheDragonsFortuneMultAdjustment = 1;
|
||||
export let CacheGoldenCookiesMult = 1;
|
||||
export let CacheWrathCookiesMult = 1;
|
||||
|
||||
export let CacheHCPerSecond = 0;
|
||||
|
||||
export let CacheCentEgg = 0;
|
||||
export let CacheSeaSpec = 0;
|
||||
export let CacheLastChoEgg = 0;
|
||||
|
||||
export let CacheObjects1 = {};
|
||||
export let CacheObjects10 = {};
|
||||
export let CacheObjects100 = {};
|
||||
|
||||
export let CacheWrinklersTotal = 0;
|
||||
export let CacheWrinklersNormal = 0;
|
||||
export let CacheWrinklersFattest = [0, null];
|
||||
|
||||
export let CacheCurrWrinklerCPSMult = 0;
|
||||
export let CacheCurrWrinklerCount = 0;
|
||||
|
||||
export let CacheUpgrades = {};
|
||||
|
||||
export let CacheAverageClicks = {};
|
||||
|
||||
export let CacheMissingUpgrades = {};
|
||||
export let CacheMissingUpgradesPrestige = {};
|
||||
export let CacheMissingUpgradesCookies = {};
|
||||
|
||||
export let CacheChainRequired = 0;
|
||||
export let CacheChainRequiredNext = 0;
|
||||
export let CacheChainMaxReward = [];
|
||||
export let CacheChainWrathRequired = 0;
|
||||
export let CacheChainWrathRequiredNext = 0;
|
||||
export let CacheChainWrathMaxReward = [];
|
||||
export let CacheChainFrenzyRequired = 0;
|
||||
export let CacheChainFrenzyRequiredNext = 0;
|
||||
export let CacheChainFrenzyMaxReward = [];
|
||||
export let CacheChainFrenzyWrathRequired = 0;
|
||||
export let CacheChainFrenzyWrathRequiredNext = 0;
|
||||
export let CacheChainFrenzyWrathMaxReward = [];
|
||||
|
||||
export let CacheRealCookiesEarned = 0;
|
||||
export let CacheAvgCPSWithChoEgg = 0;
|
||||
|
||||
export let CacheSpawnedGoldenShimmer = {};
|
||||
export let CacheSeasonPopShimmer = {};
|
||||
|
||||
export let CacheTimeTillNextPrestige = 0;
|
||||
|
||||
/** Stores lowest PP value */
|
||||
export let CacheMinPP = 0;
|
||||
/** Stores all PP values of all buildings for all buy settings (1, 10, 100) */
|
||||
export let CachePPArray = [];
|
||||
|
||||
export let CacheGoldenShimmersByID = {};
|
||||
|
||||
export let CacheSellForChoEgg = 0;
|
||||
|
||||
export let CookiesDiff;
|
||||
export let WrinkDiff;
|
||||
export let WrinkFattestDiff;
|
||||
export let ChoEggDiff;
|
||||
export let ClicksDiff;
|
||||
export let HeavenlyChipsDiff;
|
||||
|
||||
export let CacheLastCPSCheck;
|
||||
export let CacheLastCookies;
|
||||
export let CacheLastWrinkCookies;
|
||||
export let CacheLastWrinkFattestCookies;
|
||||
export let CacheLastClicks;
|
||||
|
||||
export let CacheAverageGainBank;
|
||||
export let CacheAverageGainWrink;
|
||||
export let CacheAverageGainWrinkFattest;
|
||||
export let CacheAverageGainChoEgg;
|
||||
export let CacheAverageCPS;
|
||||
|
||||
export let CacheLastHeavenlyCheck;
|
||||
export let CacheLastHeavenlyChips;
|
||||
|
||||
export let CacheDoRemakeBuildPrices;
|
||||
|
||||
export let CacheHadBuildAura;
|
||||
|
||||
/** Store the CPS effect of each god if it was put into each slot */
|
||||
export let CacheGods = {
|
||||
0: [0, 0, 0],
|
||||
1: [0, 0, 0],
|
||||
2: [0, 0, 0],
|
||||
3: [0, 0, 0],
|
||||
4: [0, 0, 0],
|
||||
5: [0, 0, 0],
|
||||
6: [0, 0, 0],
|
||||
7: [0, 0, 0],
|
||||
8: [0, 0, 0],
|
||||
9: [0, 0, 0],
|
||||
10: [0, 0, 0],
|
||||
};
|
||||
42
src/Cache/Wrinklers/Wrinklers.js
Normal file
42
src/Cache/Wrinklers/Wrinklers.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Caches data related to Wrinklers */
|
||||
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export default function CacheWrinklers() {
|
||||
CacheWrinklersTotal = 0;
|
||||
CacheWrinklersNormal = 0;
|
||||
CacheWrinklersFattest = [0, null];
|
||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||
let { sucked } = Game.wrinklers[i];
|
||||
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 (SimObjects.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;
|
||||
}
|
||||
CacheWrinklersTotal += sucked;
|
||||
if (Game.wrinklers[i].type === 0) {
|
||||
CacheWrinklersNormal += sucked;
|
||||
if (sucked > CacheWrinklersFattest[0])
|
||||
CacheWrinklersFattest = [sucked, i];
|
||||
}
|
||||
}
|
||||
}
|
||||
122
src/Config.js
122
src/Config.js
@@ -1,122 +0,0 @@
|
||||
/**********
|
||||
* Config *
|
||||
**********/
|
||||
|
||||
CM.SaveConfig = function(config) {
|
||||
localStorage.setItem(CM.ConfigPrefix, JSON.stringify(config));
|
||||
}
|
||||
|
||||
CM.LoadConfig = function() {
|
||||
if (localStorage.getItem(CM.ConfigPrefix) != null) {
|
||||
CM.Config = JSON.parse(localStorage.getItem(CM.ConfigPrefix));
|
||||
|
||||
// Check values
|
||||
var mod = false;
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (i != 'StatsPref') {
|
||||
if (i.indexOf('SoundURL') == -1) {
|
||||
if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
}
|
||||
else { // Sound URLs
|
||||
if (CM.Config[i] == undefined || typeof CM.Config[i] != 'string') {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Statistics Preferences
|
||||
if (CM.Config[i] == undefined) {
|
||||
mod = true;
|
||||
CM.Config[i] = CM.ConfigDefault[i];
|
||||
}
|
||||
else {
|
||||
for (var j in CM.ConfigDefault.StatsPref) {
|
||||
if (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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mod) CM.SaveConfig(CM.Config);
|
||||
CM.Loop(); // Do loop once
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (i != 'StatsPref' && CM.ConfigData[i].func != undefined) {
|
||||
CM.ConfigData[i].func();
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Default values
|
||||
CM.RestoreDefault();
|
||||
}
|
||||
}
|
||||
|
||||
CM.RestoreDefault = function() {
|
||||
CM.Config = {};
|
||||
CM.SaveConfig(CM.ConfigDefault);
|
||||
CM.LoadConfig();
|
||||
Game.UpdateMenu();
|
||||
}
|
||||
|
||||
CM.ToggleConfigUp = function(config) {
|
||||
CM.Config[config]++;
|
||||
if (CM.Config[config] == CM.ConfigData[config].label.length) {
|
||||
CM.Config[config] = 0;
|
||||
}
|
||||
if (CM.ConfigData[config].func != undefined) {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
CM.ToggleConfigDown = function(config) {
|
||||
CM.Config[config]--;
|
||||
if (CM.Config[config] < 0) {
|
||||
CM.Config[config] = CM.ConfigData[config].label.length - 1;
|
||||
}
|
||||
if (CM.ConfigData[config].func != undefined) {
|
||||
CM.ConfigData[config].func();
|
||||
}
|
||||
l(CM.ConfigPrefix + config).innerHTML = CM.Disp.GetConfigDisplay(config);
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
CM.ToggleStatsConfig = function(config) {
|
||||
if (CM.Config.StatsPref[config] == 0) {
|
||||
CM.Config.StatsPref[config]++;
|
||||
}
|
||||
else {
|
||||
CM.Config.StatsPref[config]--;
|
||||
}
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
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.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.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.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 3 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();}};
|
||||
|
||||
30
src/Config/CheckNotificationPermissions.js
Normal file
30
src/Config/CheckNotificationPermissions.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
function CheckNotificationPermissions(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default CheckNotificationPermissions;
|
||||
97
src/Config/SaveLoadReload/SaveLoadReloadSettings.js
Normal file
97
src/Config/SaveLoadReload/SaveLoadReloadSettings.js
Normal file
@@ -0,0 +1,97 @@
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import ConfigData from '../../Data/SettingsData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import save from '../../InitSaveLoad/save';
|
||||
import CMLoop from '../../Main/Loop';
|
||||
|
||||
/** Functions related to saving, loading and restoring all settings */
|
||||
|
||||
/**
|
||||
* This function saves the config of CookieMonster without saving any of the other save-data
|
||||
* This allows saving in between the autosave intervals
|
||||
* It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(),
|
||||
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
|
||||
*/
|
||||
export function SaveConfig() {
|
||||
const saveString = b64_to_utf8(
|
||||
unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0],
|
||||
);
|
||||
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
|
||||
if (CookieMonsterSave !== null) {
|
||||
const newSaveString = saveString.replace(
|
||||
CookieMonsterSave[0],
|
||||
`CookieMonster:${save()}`,
|
||||
);
|
||||
localStorage.setItem(
|
||||
'CookieClickerGame',
|
||||
escape(`${utf8_to_b64(newSaveString)}!END!`),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function loads the config of CookieMonster saved in localStorage and loads it into CMOptions
|
||||
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
|
||||
*/
|
||||
export function LoadConfig(settings) {
|
||||
// This removes cookies left from earlier versions of CookieMonster
|
||||
if (typeof localStorage.CMConfig !== 'undefined') {
|
||||
delete localStorage.CMConfig;
|
||||
}
|
||||
if (settings !== undefined) {
|
||||
CMOptions = settings;
|
||||
|
||||
// Check values
|
||||
let mod = false;
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (typeof CMOptions[i] === 'undefined') {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
} else if (i !== 'Header' && i !== 'Colors') {
|
||||
if (i.indexOf('SoundURL') === -1) {
|
||||
if (
|
||||
!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (typeof CMOptions[i] !== 'string') {
|
||||
// Sound URLs
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (i === 'Header') {
|
||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Colors
|
||||
Object.keys(ConfigDefault.Colors).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
typeof CMOptions[i][j] !== 'string'
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (mod) SaveConfig();
|
||||
CMLoop(); // Do loop once
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||
ConfigData[i].func();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Default values
|
||||
LoadConfig(ConfigDefault);
|
||||
}
|
||||
}
|
||||
61
src/Config/SpecificToggles.js
Normal file
61
src/Config/SpecificToggles.js
Normal file
@@ -0,0 +1,61 @@
|
||||
/** Called by the "func" of individual settings */
|
||||
|
||||
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function changes the position of both the bottom and timer bar
|
||||
*/
|
||||
export function UpdateBotTimerBarPosition() {
|
||||
if (
|
||||
CMOptions.BotBar === 1 &&
|
||||
CMOptions.TimerBar === 1 &&
|
||||
CMOptions.TimerBarPos === 1
|
||||
) {
|
||||
l('CMBotBar').style.bottom = l('CMTimerBar').style.height;
|
||||
l('game').style.bottom = `${
|
||||
Number(l('CMTimerBar').style.height.replace('px', '')) + 70
|
||||
}px`;
|
||||
} else if (CMOptions.BotBar === 1) {
|
||||
l('CMBotBar').style.bottom = '0px';
|
||||
l('game').style.bottom = '70px';
|
||||
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
|
||||
l('game').style.bottom = l('CMTimerBar').style.height;
|
||||
} else {
|
||||
// No bars
|
||||
l('game').style.bottom = '0px';
|
||||
}
|
||||
|
||||
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
||||
l('sectionLeft').style.top = l('CMTimerBar').style.height;
|
||||
} else {
|
||||
l('sectionLeft').style.top = '';
|
||||
}
|
||||
|
||||
UpdateBackground();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function changes the visibility of the timer bar
|
||||
*/
|
||||
export function ToggleTimerBar() {
|
||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = '';
|
||||
else l('CMTimerBar').style.display = 'none';
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function changes the position of the timer bar
|
||||
*/
|
||||
export function ToggleTimerBarPos() {
|
||||
if (CMOptions.TimerBarPos === 0) {
|
||||
l('CMTimerBar').style.width = '30%';
|
||||
l('CMTimerBar').style.bottom = '';
|
||||
l('game').insertBefore(l('CMTimerBar'), l('sectionLeft'));
|
||||
} else {
|
||||
l('CMTimerBar').style.width = '100%';
|
||||
l('CMTimerBar').style.bottom = '0px';
|
||||
l('wrapper').appendChild(l('CMTimerBar'));
|
||||
}
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
55
src/Config/ToggleSetting.js
Normal file
55
src/Config/ToggleSetting.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import ConfigData from '../Data/SettingsData';
|
||||
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
|
||||
/** Functions related to toggling or changing an individual setting */
|
||||
|
||||
/** Used to name certain DOM or outside facing elements and refer to them */
|
||||
export const ConfigPrefix = 'CMConfig';
|
||||
|
||||
/**
|
||||
* This function toggles options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of options of the "bool" type
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
export function ToggleConfig(config) {
|
||||
CMOptions[config] += 1;
|
||||
|
||||
if (CMOptions[config] === ConfigData[config].label.length) {
|
||||
CMOptions[config] = 0;
|
||||
if (ConfigData[config].toggle)
|
||||
l(ConfigPrefix + config).className = 'option off';
|
||||
} else l(ConfigPrefix + config).className = 'option';
|
||||
|
||||
if (typeof ConfigData[config].func !== 'undefined') {
|
||||
ConfigData[config].func();
|
||||
}
|
||||
|
||||
l(ConfigPrefix + config).innerHTML =
|
||||
ConfigData[config].label[CMOptions[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
|
||||
*/
|
||||
export function ToggleConfigVolume(config) {
|
||||
if (l(`slider${config}`) !== null) {
|
||||
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
|
||||
CMOptions[config] = Math.round(l(`slider${config}`).value);
|
||||
}
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function toggles header options by incrementing them with 1 and handling changes
|
||||
* It is called by the onclick event of the +/- next to headers
|
||||
* @param {string} config The name of the header
|
||||
*/
|
||||
export function ToggleHeader(config) {
|
||||
CMOptions.Header[config] += 1;
|
||||
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
||||
SaveConfig();
|
||||
}
|
||||
17
src/Config/Toggles/ToggleBotBar.js
Normal file
17
src/Config/Toggles/ToggleBotBar.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar';
|
||||
import { UpdateBotTimerBarPosition } from '../SpecificToggles';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggle the bottom bar
|
||||
* It is called by CM.Disp.UpdateAscendState() and a change in CMOptions.BotBar
|
||||
*/
|
||||
export default function ToggleBotBar() {
|
||||
if (CMOptions.BotBar === 1) {
|
||||
l('CMBotBar').style.display = '';
|
||||
UpdateBotBar();
|
||||
} else {
|
||||
l('CMBotBar').style.display = 'none';
|
||||
}
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
12
src/Config/Toggles/ToggleDetailedTime.js
Normal file
12
src/Config/Toggles/ToggleDetailedTime.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CMSayTime } from '../../Disp/VariablesAndData';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function changes some of the time-displays in the game to be more detailed
|
||||
* It is called by a change in CM.Options.DetailedTime
|
||||
*/
|
||||
export default function ToggleDetailedTime() {
|
||||
if (CMOptions.DetailedTime === 1) Game.sayTime = CMSayTime;
|
||||
else Game.sayTime = BackupFunctions.sayTime;
|
||||
}
|
||||
20
src/Config/Toggles/ToggleGCTimer.js
Normal file
20
src/Config/Toggles/ToggleGCTimer.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/* eslint-disable no-return-assign */
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles GC Timers are visible
|
||||
* It is called by a change in CM.Options.GCTimer
|
||||
*/
|
||||
export default function ToggleGCTimer() {
|
||||
if (CMOptions.GCTimer === 1) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.display = 'block';
|
||||
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
||||
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
||||
});
|
||||
} else {
|
||||
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
|
||||
}
|
||||
}
|
||||
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
|
||||
* It is called by changes in CM.Options.WrinklerButtons
|
||||
*/
|
||||
export default function ToggleSectionHideButtons() {
|
||||
if (CMOptions.HideSectionsButtons) {
|
||||
l('CMSectionHidButtons').style.display = '';
|
||||
} else {
|
||||
l('CMSectionHidButtons').style.display = 'none';
|
||||
}
|
||||
}
|
||||
20
src/Config/Toggles/ToggleToolWarnPos.js
Normal file
20
src/Config/Toggles/ToggleToolWarnPos.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection()
|
||||
* It is called by a change in CM.Options.ToolWarnPos
|
||||
* and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings()
|
||||
*/
|
||||
export default function ToggleToolWarnPos() {
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
if (CMOptions.ToolWarnPos === 0) {
|
||||
l('CMDispTooltipWarningParent').style.top = 'auto';
|
||||
l('CMDispTooltipWarningParent').style.margin = '4px -4px';
|
||||
l('CMDispTooltipWarningParent').style.padding = '3px 4px';
|
||||
} else {
|
||||
l('CMDispTooltipWarningParent').style.right = 'auto';
|
||||
l('CMDispTooltipWarningParent').style.margin = '4px';
|
||||
l('CMDispTooltipWarningParent').style.padding = '4px 3px';
|
||||
}
|
||||
}
|
||||
}
|
||||
25
src/Config/Toggles/ToggleUpgradeBarAndColor.js
Normal file
25
src/Config/Toggles/ToggleUpgradeBarAndColor.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Section: Functions related to the Upgrade Bar
|
||||
|
||||
/**
|
||||
* This function toggles the upgrade bar and the colours of upgrades
|
||||
* It is called by a change in CM.Options.UpBarColor
|
||||
*/
|
||||
export default function ToggleUpgradeBarAndColor() {
|
||||
if (CMOptions.UpBarColor === 1) {
|
||||
// Colours and bar on
|
||||
l('CMUpgradeBar').style.display = '';
|
||||
UpdateUpgrades();
|
||||
} else if (CMOptions.UpBarColor === 2) {
|
||||
// Colours on and bar off
|
||||
l('CMUpgradeBar').style.display = 'none';
|
||||
UpdateUpgrades();
|
||||
} else {
|
||||
// Colours and bar off
|
||||
l('CMUpgradeBar').style.display = 'none';
|
||||
Game.RebuildUpgrades();
|
||||
}
|
||||
}
|
||||
15
src/Config/Toggles/ToggleUpgradeBarFixedPos.js
Normal file
15
src/Config/Toggles/ToggleUpgradeBarFixedPos.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the position of the upgrade bar from fixed or non-fixed mode
|
||||
* It is called by a change in CM.Options.UpgradeBarFixedPos
|
||||
*/
|
||||
export default function ToggleUpgradeBarFixedPos() {
|
||||
if (CMOptions.UpgradeBarFixedPos === 1) {
|
||||
// Fix to top of screen when scrolling
|
||||
l('CMUpgradeBar').style.position = 'sticky';
|
||||
l('CMUpgradeBar').style.top = '0px';
|
||||
} else {
|
||||
l('CMUpgradeBar').style.position = ''; // Possible to scroll offscreen
|
||||
}
|
||||
}
|
||||
15
src/Config/Toggles/ToggleWrinklerButtons.js
Normal file
15
src/Config/Toggles/ToggleWrinklerButtons.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
|
||||
* It is called by changes in CM.Options.WrinklerButtons
|
||||
*/
|
||||
export default function ToggleWrinklerButtons() {
|
||||
if (CMOptions.WrinklerButtons) {
|
||||
l('PopAllNormalWrinklerButton').style.display = '';
|
||||
l('PopFattestWrinklerButton').style.display = '';
|
||||
} else {
|
||||
l('PopAllNormalWrinklerButton').style.display = 'none';
|
||||
l('PopFattestWrinklerButton').style.display = 'none';
|
||||
}
|
||||
}
|
||||
4
src/Config/VariablesAndData.js
Normal file
4
src/Config/VariablesAndData.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/* eslint-disable prefer-const */
|
||||
|
||||
export let CMOptions = {};
|
||||
export const ConfigPrefix = 'CMConfig';
|
||||
12
src/CookieMonster.js
Normal file
12
src/CookieMonster.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import init from './InitSaveLoad/init';
|
||||
import load from './InitSaveLoad/load';
|
||||
import save from './InitSaveLoad/save';
|
||||
|
||||
const CM = {
|
||||
init,
|
||||
load,
|
||||
save,
|
||||
};
|
||||
|
||||
Game.registerMod('CookieMonster', CM);
|
||||
@@ -1,8 +0,0 @@
|
||||
/********
|
||||
* Data *
|
||||
********/
|
||||
|
||||
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'];
|
||||
|
||||
97
src/Data/Gamedata.js
Normal file
97
src/Data/Gamedata.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/** Data copied directly from the game */
|
||||
|
||||
/** Array of the names of all fortune cookies obtainable from the ticker */
|
||||
export const Fortunes = [
|
||||
'Fortune #001',
|
||||
'Fortune #002',
|
||||
'Fortune #003',
|
||||
'Fortune #004',
|
||||
'Fortune #005',
|
||||
'Fortune #006',
|
||||
'Fortune #007',
|
||||
'Fortune #008',
|
||||
'Fortune #009',
|
||||
'Fortune #010',
|
||||
'Fortune #011',
|
||||
'Fortune #012',
|
||||
'Fortune #013',
|
||||
'Fortune #014',
|
||||
'Fortune #015',
|
||||
'Fortune #016',
|
||||
'Fortune #017',
|
||||
'Fortune #018',
|
||||
'Fortune #100',
|
||||
'Fortune #101',
|
||||
'Fortune #102',
|
||||
'Fortune #103',
|
||||
'Fortune #104',
|
||||
];
|
||||
|
||||
/** Array of the names of all Halloween cookies */
|
||||
export const HalloCookies = [
|
||||
'Skull cookies',
|
||||
'Ghost cookies',
|
||||
'Bat cookies',
|
||||
'Slime cookies',
|
||||
'Pumpkin cookies',
|
||||
'Eyeball cookies',
|
||||
'Spider cookies',
|
||||
];
|
||||
|
||||
/** Array of the names of all Christmas cookies */
|
||||
export const ChristCookies = [
|
||||
'Christmas tree biscuits',
|
||||
'Snowflake biscuits',
|
||||
'Snowman biscuits',
|
||||
'Holly biscuits',
|
||||
'Candy cane biscuits',
|
||||
'Bell biscuits',
|
||||
'Present biscuits',
|
||||
];
|
||||
|
||||
/** Array of the names of all Valentine cookies */
|
||||
export const ValCookies = [
|
||||
'Pure heart biscuits',
|
||||
'Ardent heart biscuits',
|
||||
'Sour heart biscuits',
|
||||
'Weeping heart biscuits',
|
||||
'Golden heart biscuits',
|
||||
'Eternal heart biscuits',
|
||||
'Prism heart biscuits',
|
||||
];
|
||||
|
||||
/** Array of the names of all plant drops */
|
||||
export const PlantDrops = [
|
||||
'Elderwort biscuits',
|
||||
'Bakeberry cookies',
|
||||
'Duketater cookies',
|
||||
'Green yeast digestives',
|
||||
'Wheat slims',
|
||||
'Fern tea',
|
||||
'Ichor syrup',
|
||||
];
|
||||
|
||||
/** All possible effects plants and other items can have with a display-title */
|
||||
export const Effects = {
|
||||
buildingCost: 'Building prices',
|
||||
click: 'Cookies per click',
|
||||
cps: 'Total CPS',
|
||||
cursorCps: 'Cursor CPS',
|
||||
goldenCookieDur: 'Golden cookie duration',
|
||||
goldenCookieEffDur: 'Golden cookie effect duration',
|
||||
goldenCookieFreq: 'Golden cookie frequency',
|
||||
goldenCookieGain: 'Golden cookie gains',
|
||||
grandmaCps: 'Grandma CPS',
|
||||
itemDrops: 'Random item drop chance',
|
||||
milk: 'Effect from milk',
|
||||
reindeerDur: 'Reindeer duration',
|
||||
reindeerFreq: 'Reindeer frequency',
|
||||
reindeerGain: 'Reindeer gains',
|
||||
upgradeCost: 'Upgrade prices',
|
||||
wrathCookieDur: 'Wrath cookie duration',
|
||||
wrathCookieEffDur: 'Wrath cookie effect duration',
|
||||
wrathCookieFreq: 'Wrath cookie frequency',
|
||||
wrathCookieGain: 'Wrath cookie gains',
|
||||
wrinklerEat: 'Wrinkler ',
|
||||
wrinklerSpawn: 'Wrinkler spawn frequency',
|
||||
};
|
||||
41
src/Data/Moddata.js
Normal file
41
src/Data/Moddata.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/** Data related directly to Cookie Monster */
|
||||
|
||||
export const VersionMajor = '2.031';
|
||||
export const VersionMinor = '6';
|
||||
|
||||
/** Information about Cookie Monster to be displayed in the info section */
|
||||
export const ModDescription = `<div class="listing">
|
||||
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
|
||||
offers a wide range of tools and statistics to enhance your game experience.
|
||||
It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>
|
||||
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
|
||||
Please also report any bugs you may find over there!</br>
|
||||
</div>
|
||||
`;
|
||||
|
||||
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
|
||||
export const LatestReleaseNotes = `<div class="listing">
|
||||
The latest update (v 2.031.6) has revamped the way PP is colourcoded. In the previous versions this was not always correct and we had some settings that made it even more incorrect. With this update Cookie Monster compares the PP of a building to all other possibilities (also buying 10 or 100) of a building and colors the PP accordingly.</br>
|
||||
This means that if it is better to buy 10 of a building immediately rather than to buy in increments of 1 Cookie Monster will now show this! In this case the buy 1 option will be yellow, while the buy 10 option will be green.</br>
|
||||
This also means that you will see some more diverse colors. Rather than coloring according to arbitrary "middle values" Cookie Monster now uses a top 10, 20 and 30. While this might take some getting used to we believe the new system is much better in conveying useful information to the user while also being more correct!</br>
|
||||
</br>
|
||||
This update also implements the following functions:</br>
|
||||
- Added a tooltip displaying the reward to the extra pop wrinkler buttons</br>
|
||||
- Added tooltips to the Gods in the Pantheon</br>
|
||||
- The tooltip for Elder Pledge now displays correctly, although it takes some time to load after Cookie Monster has been loaded</br>
|
||||
- You can now test the volume and sound of notifications in the settings screen</br>
|
||||
- The bottom bar will now flicker less and each column has received a bit of padding</br>
|
||||
- Introduced new colour scheme for PP, see the explanation of colors in the Readme or the settings</br>
|
||||
- Added option to show buttons that can hide the upgrade and building section</br>
|
||||
- Added option to display PP as a time unit, note that these are only approximations. PP does not translate directly into time (the name is deceptive, we know...)</br>
|
||||
- Statistics page now shows chance for random drops when they have not been achieved</br>
|
||||
</br>
|
||||
This update fixes the following bugs:</br>
|
||||
- Incorrect amount for "required for max plant reward" in statistics page</br>
|
||||
- Fixed the tooltips of the '?' buttons in the statistics page not showing</br>
|
||||
- Fixed some unclear settings descriptions </br>
|
||||
</br>
|
||||
Please submit any bug reports or feature requests to the <a href="https://github.com/Aktanusa/CookieMonster">GitHub page!</a>
|
||||
</br>
|
||||
</div>
|
||||
`;
|
||||
141
src/Data/Scales.js
Normal file
141
src/Data/Scales.js
Normal file
@@ -0,0 +1,141 @@
|
||||
/** Data related directly to the scales used by Cookie Monster */
|
||||
|
||||
/** Array of abbreviations used in the "Metric" scale */
|
||||
export const metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
|
||||
/** Array of abbreviations used in the "Short" scale */
|
||||
export const shortScale = [
|
||||
'',
|
||||
'',
|
||||
'M',
|
||||
'B',
|
||||
'Tr',
|
||||
'Quadr',
|
||||
'Quint',
|
||||
'Sext',
|
||||
'Sept',
|
||||
'Oct',
|
||||
'Non',
|
||||
'Dec',
|
||||
'Undec',
|
||||
'Duodec',
|
||||
'Tredec',
|
||||
'Quattuordec',
|
||||
'Quindec',
|
||||
'Sexdec',
|
||||
'Septendec',
|
||||
'Octodec',
|
||||
'Novemdec',
|
||||
'Vigint',
|
||||
'Unvigint',
|
||||
'Duovigint',
|
||||
'Trevigint',
|
||||
'Quattuorvigint',
|
||||
];
|
||||
|
||||
/** Array of abbreviations used in the "Abbreviated Short" scale */
|
||||
export const shortScaleAbbreviated = [
|
||||
'',
|
||||
'K',
|
||||
'M',
|
||||
'B',
|
||||
'T',
|
||||
'Qa',
|
||||
'Qi',
|
||||
'Sx',
|
||||
'Sp',
|
||||
'Oc',
|
||||
'No',
|
||||
'De',
|
||||
'UDe',
|
||||
'DDe',
|
||||
'TDe',
|
||||
'QaDe',
|
||||
'QiDe',
|
||||
'SxDe',
|
||||
'SpDe',
|
||||
'ODe',
|
||||
'NDe',
|
||||
'Vi',
|
||||
'UVi',
|
||||
'DVi',
|
||||
'TVi',
|
||||
'QaVi',
|
||||
'QiVi',
|
||||
'SxVi',
|
||||
'SpVi',
|
||||
'OVi',
|
||||
'NVi',
|
||||
'Tr',
|
||||
'UTr',
|
||||
'DTr',
|
||||
'TTr',
|
||||
'QaTr',
|
||||
'QiTr',
|
||||
'SxTr',
|
||||
'SpTr',
|
||||
'OTr',
|
||||
'NTr',
|
||||
'Qaa',
|
||||
'UQa',
|
||||
'DQa',
|
||||
'TQa',
|
||||
'QaQa',
|
||||
'QiQa',
|
||||
'SxQa',
|
||||
'SpQa',
|
||||
'OQa',
|
||||
'NQa',
|
||||
'Qia',
|
||||
'UQi',
|
||||
'DQi',
|
||||
'TQi',
|
||||
'QaQi',
|
||||
'QiQi',
|
||||
'SxQi',
|
||||
'SpQi',
|
||||
'OQi',
|
||||
'NQi',
|
||||
'Sxa',
|
||||
'USx',
|
||||
'DSx',
|
||||
'TSx',
|
||||
'QaSx',
|
||||
'QiSx',
|
||||
'SxSx',
|
||||
'SpSx',
|
||||
'OSx',
|
||||
'NSx',
|
||||
'Spa',
|
||||
'USp',
|
||||
'DSp',
|
||||
'TSp',
|
||||
'QaSp',
|
||||
'QiSp',
|
||||
'SxSp',
|
||||
'SpSp',
|
||||
'OSp',
|
||||
'NSp',
|
||||
'Oco',
|
||||
'UOc',
|
||||
'DOc',
|
||||
'TOc',
|
||||
'QaOc',
|
||||
'QiOc',
|
||||
'SxOc',
|
||||
'SpOc',
|
||||
'OOc',
|
||||
'NOc',
|
||||
'Noa',
|
||||
'UNo',
|
||||
'DNo',
|
||||
'TNo',
|
||||
'QaNo',
|
||||
'QiNo',
|
||||
'SxNo',
|
||||
'SpNo',
|
||||
'ONo',
|
||||
'NNo',
|
||||
'Ct',
|
||||
'UCt',
|
||||
];
|
||||
24
src/Data/Sectionheaders.js
Normal file
24
src/Data/Sectionheaders.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/** Data related to the display titles of certain sections in menu screens */
|
||||
|
||||
/** Display titles of the headers of the Cookie Monster settings section */
|
||||
export const ConfigGroups = {
|
||||
BarsColors: 'Bars/Colors',
|
||||
Calculation: 'Calculation',
|
||||
Notification: 'Notification',
|
||||
Tooltip: 'Tooltips and additional insights',
|
||||
Statistics: 'Statistics',
|
||||
Notation: 'Notation',
|
||||
Miscellaneous: 'Miscellaneous',
|
||||
};
|
||||
|
||||
/** Display titles of the headers of the notification section of the Cookie Monster settings */
|
||||
export const ConfigGroupsNotification = {
|
||||
NotificationGeneral: 'General Notifications',
|
||||
NotificationGC: 'Golden Cookie',
|
||||
NotificationFC: 'Fortune Cookie',
|
||||
NotificationSea: 'Season Special',
|
||||
NotificationGard: 'Garden Tick',
|
||||
NotificationMagi: 'Full Magic Bar',
|
||||
NotificationWrink: 'Wrinkler',
|
||||
NotificationWrinkMax: 'Maximum Wrinklers',
|
||||
};
|
||||
54
src/Data/SettingClasses.js
Normal file
54
src/Data/SettingClasses.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
/** This describes all forms of settings used by Cookie Monster */
|
||||
|
||||
/** The basic setting class */
|
||||
export class Setting {
|
||||
constructor(type, group) {
|
||||
this.type = type;
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
|
||||
/** The standard toggle setting class */
|
||||
export class SettingStandard extends Setting {
|
||||
constructor(type, group, label, desc, toggle, func = null) {
|
||||
super(type, group);
|
||||
this.label = label;
|
||||
this.desc = desc;
|
||||
this.toggle = toggle;
|
||||
if (func) {
|
||||
this.func = func;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** The colour picker setting class */
|
||||
export class SettingColours extends Setting {
|
||||
constructor(type, group, desc, func) {
|
||||
super(type, group);
|
||||
this.desc = desc;
|
||||
this.func = func;
|
||||
}
|
||||
}
|
||||
|
||||
/** The volume level setting class */
|
||||
export class SettingVolume extends Setting {
|
||||
constructor(type, group, label, desc) {
|
||||
super(type, group);
|
||||
this.label = label;
|
||||
this.desc = desc;
|
||||
for (let i = 0; i < 101; i++) {
|
||||
this.label[i] = `${i}%`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The number input setting class */
|
||||
export class SettingInputNumber extends Setting {
|
||||
constructor(type, group, label, desc, min, max) {
|
||||
super(type, group);
|
||||
this.label = label;
|
||||
this.desc = desc;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
765
src/Data/SettingsData.js
Normal file
765
src/Data/SettingsData.js
Normal file
@@ -0,0 +1,765 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
|
||||
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
|
||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime';
|
||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer';
|
||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons';
|
||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
|
||||
import ToggleUpgradeBarAndColor from '../Config/Toggles/ToggleUpgradeBarAndColor';
|
||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
||||
import UpdateColors from '../Disp/HelperFunctions/UpdateColors';
|
||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||
import { SimDoSims } from '../Sim/VariablesAndData';
|
||||
import {
|
||||
SettingStandard,
|
||||
SettingColours,
|
||||
SettingVolume,
|
||||
SettingInputNumber,
|
||||
} from './SettingClasses';
|
||||
|
||||
/** This includes all options of CookieMonster and their relevant data */
|
||||
const Config = {
|
||||
// Barscolors
|
||||
BotBar: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Bottom Bar OFF', 'Bottom Bar ON'],
|
||||
'Building Information',
|
||||
true,
|
||||
function () {
|
||||
ToggleBotBar();
|
||||
},
|
||||
),
|
||||
TimerBar: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Timer Bar OFF', 'Timer Bar ON'],
|
||||
'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy',
|
||||
true,
|
||||
function () {
|
||||
ToggleTimerBar();
|
||||
},
|
||||
),
|
||||
TimerBarPos: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'],
|
||||
'Placement of the Timer Bar',
|
||||
false,
|
||||
function () {
|
||||
ToggleTimerBarPos();
|
||||
},
|
||||
),
|
||||
TimerBarOverlay: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
[
|
||||
'Timer Bar Overlay OFF',
|
||||
'Timer Bar Overlay Only Seconds',
|
||||
'Timer Bar Overlay Full',
|
||||
],
|
||||
'Overlay on timers displaying seconds and/or percentage left',
|
||||
true,
|
||||
),
|
||||
SortBuildings: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
[
|
||||
'Sort Buildings: Default',
|
||||
'Sort Buildings: PP of x1 purchase',
|
||||
'Sort Buildings: PP of selected bulk mode',
|
||||
],
|
||||
'Sort the display of buildings in either default order or by PP',
|
||||
false,
|
||||
function () {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
SortUpgrades: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Sort Upgrades: Default', 'Sort Upgrades: PP'],
|
||||
'Sort the display of upgrades in either default order or by PP',
|
||||
false,
|
||||
function () {
|
||||
UpdateUpgrades();
|
||||
},
|
||||
),
|
||||
BuildColor: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Building Colors OFF', 'Building Colors ON'],
|
||||
'Color code buildings',
|
||||
true,
|
||||
function () {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
PPDisplayTime: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['PP As Value (Standard)', 'PP As Time Unit'],
|
||||
'Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.',
|
||||
false,
|
||||
),
|
||||
UpBarColor: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
[
|
||||
'Upgrade Colors/Bar OFF',
|
||||
'Upgrade Colors with Bar ON',
|
||||
'Upgrade Colors without Bar ON',
|
||||
],
|
||||
'Color code upgrades and optionally add a counter bar',
|
||||
false,
|
||||
function () {
|
||||
ToggleUpgradeBarAndColor();
|
||||
},
|
||||
),
|
||||
Colors: new SettingColours(
|
||||
'color',
|
||||
'BarsColors',
|
||||
{
|
||||
Blue:
|
||||
'Color Blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green:
|
||||
'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow:
|
||||
'Color Yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
|
||||
Orange:
|
||||
'Color Orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
|
||||
Red:
|
||||
'Color Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
|
||||
Purple:
|
||||
'Color Purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
|
||||
Gray:
|
||||
'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Pink: 'Color Pink. Used for Dragonflight bar',
|
||||
Brown: 'Color Brown. Used for Dragon Harvest bar',
|
||||
},
|
||||
function () {
|
||||
UpdateColors();
|
||||
},
|
||||
),
|
||||
UpgradeBarFixedPos: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'],
|
||||
'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling',
|
||||
true,
|
||||
function () {
|
||||
ToggleUpgradeBarFixedPos();
|
||||
},
|
||||
),
|
||||
|
||||
// Calculation
|
||||
CalcWrink: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
'Calculate with Wrinklers OFF',
|
||||
'Calculate with Wrinklers ON',
|
||||
'Calculate with Single Fattest Wrinkler ON',
|
||||
],
|
||||
'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers',
|
||||
true,
|
||||
function () {
|
||||
SimDoSims = true;
|
||||
},
|
||||
),
|
||||
CPSMode: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
['Current Cookies Per Second', 'Average Cookies Per Second'],
|
||||
'Calculate times using current Cookies Per Second or average Cookies Per Second',
|
||||
false,
|
||||
),
|
||||
AvgCPSHist: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
'Average CPS for past 10s',
|
||||
'Average CPS for past 15s',
|
||||
'Average CPS for past 30s',
|
||||
'Average CPS for past 1m',
|
||||
'Average CPS for past 5m',
|
||||
'Average CPS for past 10m',
|
||||
'Average CPS for past 15m',
|
||||
'Average CPS for past 30m',
|
||||
],
|
||||
'How much time average Cookies Per Second should consider',
|
||||
false,
|
||||
),
|
||||
AvgClicksHist: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
'Average Cookie Clicks for past 1s',
|
||||
'Average Cookie Clicks for past 5s',
|
||||
'Average Cookie Clicks for past 10s',
|
||||
'Average Cookie Clicks for past 15s',
|
||||
'Average Cookie Clicks for past 30s',
|
||||
],
|
||||
'How much time average Cookie Clicks should consider',
|
||||
false,
|
||||
),
|
||||
PPExcludeTop: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
"Don't Ignore Any",
|
||||
'Ignore 1st Best',
|
||||
'Ignore 1st and 2nd Best',
|
||||
'Ignore 1st, 2nd and 3rd Best',
|
||||
],
|
||||
'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values',
|
||||
true,
|
||||
),
|
||||
PPSecondsLowerLimit: new SettingInputNumber(
|
||||
'numscale',
|
||||
'Calculation',
|
||||
'Lower limit for PP (in seconds): ',
|
||||
'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',
|
||||
0,
|
||||
Infinity,
|
||||
),
|
||||
PPOnlyConsiderBuyable: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
["Don't Ignore Non-Buyable", 'Ignore Non-Buyable'],
|
||||
"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'",
|
||||
true,
|
||||
),
|
||||
ToolWarnBon: new SettingStandard(
|
||||
'bool',
|
||||
'Calculation',
|
||||
[
|
||||
'Calculate Tooltip Warning With Bonus CPS OFF',
|
||||
'Calculate Tooltip Warning With Bonus CPS ON',
|
||||
],
|
||||
'Calculate the warning with or without the bonus CPS you get from buying',
|
||||
true,
|
||||
),
|
||||
|
||||
// Notification
|
||||
Title: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGeneral',
|
||||
['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'],
|
||||
'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',
|
||||
true,
|
||||
),
|
||||
GeneralSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGeneral',
|
||||
['Consider Game Volume Setting OFF', 'Consider Game Volume Setting ON'],
|
||||
'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',
|
||||
true,
|
||||
),
|
||||
GCNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when Golden Cookie spawns',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.GCNotification);
|
||||
},
|
||||
),
|
||||
GCFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on Golden Cookie',
|
||||
true,
|
||||
),
|
||||
GCSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGC',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on Golden Cookie',
|
||||
true,
|
||||
),
|
||||
GCVolume: new SettingVolume('vol', 'NotificationGC', [], 'Volume'),
|
||||
GCSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationGC',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when a Golden Cookie spawns',
|
||||
),
|
||||
FortuneNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when Fortune Cookie is on the Ticker',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.FortuneNotification);
|
||||
},
|
||||
),
|
||||
FortuneFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on Fortune Cookie',
|
||||
true,
|
||||
),
|
||||
FortuneSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationFC',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on Fortune Cookie',
|
||||
true,
|
||||
),
|
||||
FortuneVolume: new SettingVolume('vol', 'NotificationFC', [], 'Volume'),
|
||||
|
||||
FortuneSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationFC',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when the Ticker has a Fortune Cookie',
|
||||
),
|
||||
SeaNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification on Season Popup',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.SeaNotification);
|
||||
},
|
||||
),
|
||||
SeaFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen on Season Popup',
|
||||
true,
|
||||
),
|
||||
SeaSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationSea',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on Season Popup',
|
||||
true,
|
||||
),
|
||||
SeaVolume: new SettingVolume('vol', 'NotificationSea', [], 'Volume'),
|
||||
SeaSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationSea',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when a Season Special spawns',
|
||||
),
|
||||
GardFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGard',
|
||||
['Garden Tick Flash OFF', 'Flash ON'],
|
||||
'Flash screen on Garden Tick',
|
||||
true,
|
||||
),
|
||||
GardSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationGard',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound on Garden Tick',
|
||||
true,
|
||||
),
|
||||
GardVolume: new SettingVolume('vol', 'NotificationGard', [], 'Volume'),
|
||||
GardSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationGard',
|
||||
'Garden Tick Sound URL:',
|
||||
'URL of the sound to be played when the garden ticks',
|
||||
),
|
||||
MagicNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when magic reaches maximum',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.MagicNotification);
|
||||
},
|
||||
),
|
||||
MagicFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when magic reaches maximum',
|
||||
true,
|
||||
),
|
||||
MagicSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationMagi',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when magic reaches maximum',
|
||||
true,
|
||||
),
|
||||
MagicVolume: new SettingVolume('vol', 'NotificationMagi', [], 'Volume'),
|
||||
MagicSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationMagi',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when magic reaches maxium',
|
||||
),
|
||||
WrinklerNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when a Wrinkler appears',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerNotification);
|
||||
},
|
||||
),
|
||||
WrinklerFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when a Wrinkler appears',
|
||||
true,
|
||||
),
|
||||
WrinklerSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrink',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when a Wrinkler appears',
|
||||
true,
|
||||
),
|
||||
WrinklerVolume: new SettingVolume('vol', 'NotificationWrink', [], 'Volume'),
|
||||
WrinklerSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationWrink',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when a Wrinkler appears',
|
||||
),
|
||||
WrinklerMaxNotification: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Notification OFF', 'Notification ON'],
|
||||
'Create a notification when the maximum amount of Wrinklers has appeared',
|
||||
true,
|
||||
function () {
|
||||
CheckNotificationPermissions(CMOptions.WrinklerMaxNotification);
|
||||
},
|
||||
),
|
||||
WrinklerMaxFlash: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Flash OFF', 'Flash ON'],
|
||||
'Flash screen when the maximum amount of Wrinklers has appeared',
|
||||
true,
|
||||
),
|
||||
WrinklerMaxSound: new SettingStandard(
|
||||
'bool',
|
||||
'NotificationWrinkMax',
|
||||
['Sound OFF', 'Sound ON'],
|
||||
'Play a sound when the maximum amount of Wrinklers has appeared',
|
||||
true,
|
||||
),
|
||||
WrinklerMaxVolume: new SettingVolume(
|
||||
'vol',
|
||||
'NotificationWrinkMax',
|
||||
[],
|
||||
'Volume',
|
||||
),
|
||||
WrinklerMaxSoundURL: new SettingStandard(
|
||||
'url',
|
||||
'NotificationWrinkMax',
|
||||
'Sound URL:',
|
||||
'URL of the sound to be played when the maximum amount of Wrinklers has appeared',
|
||||
),
|
||||
|
||||
// Tooltip
|
||||
TooltipBuildUpgrade: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
[
|
||||
'Building/Upgrade Tooltip Information OFF',
|
||||
'Building/Upgrade Tooltip Information ON',
|
||||
],
|
||||
'Extra information in Building/Upgrade tooltips',
|
||||
true,
|
||||
),
|
||||
TooltipAmor: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
[
|
||||
'Buildings Tooltip Amortization Information OFF',
|
||||
'Buildings Tooltip Amortization Information ON',
|
||||
],
|
||||
'Add amortization information to buildings tooltip',
|
||||
true,
|
||||
),
|
||||
ToolWarnLucky: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnLuckyFrenzy: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnConjure: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',
|
||||
true,
|
||||
),
|
||||
ToolWarnConjureFrenzy: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',
|
||||
true,
|
||||
),
|
||||
ToolWarnEdifice: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'],
|
||||
'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',
|
||||
true,
|
||||
),
|
||||
ToolWarnUser: new SettingInputNumber(
|
||||
'numscale',
|
||||
'Tooltip',
|
||||
'Tooltip Warning At x times CPS: ',
|
||||
'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',
|
||||
0,
|
||||
Infinity,
|
||||
),
|
||||
ToolWarnPos: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'],
|
||||
'Placement of the warning boxes',
|
||||
false,
|
||||
function () {
|
||||
ToggleToolWarnPos();
|
||||
},
|
||||
),
|
||||
TooltipGrim: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'],
|
||||
'Extra information in tooltip for grimoire',
|
||||
true,
|
||||
),
|
||||
TooltipWrink: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'],
|
||||
'Shows the amount of cookies a wrinkler will give when popping it',
|
||||
true,
|
||||
),
|
||||
TooltipLump: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'],
|
||||
'Shows the current Sugar Lump type in Sugar lump tooltip.',
|
||||
true,
|
||||
),
|
||||
TooltipPlots: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'],
|
||||
'Shows a tooltip for plants that have a cookie reward.',
|
||||
true,
|
||||
),
|
||||
TooltipPantheon: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
[
|
||||
'Show Extra Info Pantheon Tooltip OFF',
|
||||
'Show Extra Info Pantheon Tooltip ON',
|
||||
],
|
||||
'Shows additional info in the pantheon tooltip',
|
||||
true,
|
||||
),
|
||||
DragonAuraInfo: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'],
|
||||
'Shows information about changes in CPS and costs in the dragon aura interface.',
|
||||
true,
|
||||
),
|
||||
TooltipAscendButton: new SettingStandard(
|
||||
'bool',
|
||||
'Tooltip',
|
||||
['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'],
|
||||
'Shows additional info in the ascend tooltip',
|
||||
true,
|
||||
),
|
||||
|
||||
// Statistics
|
||||
Stats: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Statistics OFF', 'Statistics ON'],
|
||||
'Extra Cookie Monster statistics!',
|
||||
true,
|
||||
),
|
||||
MissingUpgrades: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Missing Upgrades OFF', 'Missing Upgrades ON'],
|
||||
'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.',
|
||||
true,
|
||||
),
|
||||
UpStats: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'],
|
||||
'Default Game rate is once every 5 seconds',
|
||||
false,
|
||||
),
|
||||
TimeFormat: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'],
|
||||
'Change the time format',
|
||||
false,
|
||||
),
|
||||
DetailedTime: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Detailed Time OFF', 'Detailed Time ON'],
|
||||
'Change how time is displayed in certain statistics and tooltips',
|
||||
true,
|
||||
function () {
|
||||
ToggleDetailedTime();
|
||||
},
|
||||
),
|
||||
GrimoireBar: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'],
|
||||
'A timer on how long before the Grimoire magic meter is full',
|
||||
true,
|
||||
),
|
||||
HeavenlyChipsTarget: new SettingInputNumber(
|
||||
'numscale',
|
||||
'Statistics',
|
||||
'Heavenly Chips Target: ',
|
||||
'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',
|
||||
1,
|
||||
Infinity,
|
||||
),
|
||||
ShowMissedGC: new SettingStandard(
|
||||
'bool',
|
||||
'Statistics',
|
||||
['Missed GC OFF', 'Missed GC ON'],
|
||||
'Show a stat in the statistics screen that counts how many Golden Cookies you have missed',
|
||||
true,
|
||||
),
|
||||
|
||||
// Notation
|
||||
Scale: new SettingStandard(
|
||||
'bool',
|
||||
'Notation',
|
||||
[
|
||||
"Game's Setting Scale",
|
||||
'Metric',
|
||||
'Short Scale',
|
||||
'Short Scale (Abbreviated)',
|
||||
'Scientific Notation',
|
||||
'Engineering Notation',
|
||||
],
|
||||
'Change how long numbers are handled',
|
||||
false,
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleDecimals: new SettingStandard(
|
||||
'bool',
|
||||
'Notation',
|
||||
['1 decimals', '2 decimals', '3 decimals'],
|
||||
`Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game's Setting Scale"`,
|
||||
false,
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleSeparator: new SettingStandard(
|
||||
'bool',
|
||||
'Notation',
|
||||
['. for decimals (Standard)', '. for thousands'],
|
||||
'Set the separator used for decimals and thousands',
|
||||
false,
|
||||
function () {
|
||||
RefreshScale();
|
||||
},
|
||||
),
|
||||
ScaleCutoff: new SettingInputNumber(
|
||||
'numscale',
|
||||
'Notation',
|
||||
'Notation Cut-off Point: ',
|
||||
'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',
|
||||
1,
|
||||
999999999,
|
||||
),
|
||||
|
||||
// Miscellaneous
|
||||
GCTimer: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'],
|
||||
'A timer on the Golden Cookie when it has been spawned',
|
||||
true,
|
||||
function () {
|
||||
ToggleGCTimer();
|
||||
},
|
||||
),
|
||||
Favicon: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Favicon OFF', 'Favicon ON'],
|
||||
'Update favicon with Golden/Wrath Cookie',
|
||||
true,
|
||||
function () {
|
||||
UpdateFavicon();
|
||||
},
|
||||
),
|
||||
WrinklerButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Extra Wrinkler Buttons OFF', 'Extra Wrinkler Buttons ON'],
|
||||
'Show buttons for popping wrinklers at bottom of cookie section',
|
||||
true,
|
||||
function () {
|
||||
ToggleWrinklerButtons();
|
||||
},
|
||||
),
|
||||
HideSectionsButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Hide Upgrades/Buildings Button OFF', 'Hide Upgrades/Buildings Button ON'],
|
||||
'Show buttons for hiding and showing the upgrades and buildings section in the right column',
|
||||
true,
|
||||
function () {
|
||||
ToggleSectionHideButtons();
|
||||
},
|
||||
),
|
||||
BulkBuyBlock: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Block Bulk Buying OFF', 'Block Bulk Buying ON'],
|
||||
"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",
|
||||
true,
|
||||
),
|
||||
};
|
||||
|
||||
export default Config;
|
||||
134
src/Data/SettingsDefault.js
Normal file
134
src/Data/SettingsDefault.js
Normal file
@@ -0,0 +1,134 @@
|
||||
/** This array describes all default settings */
|
||||
const ConfigDefault = {
|
||||
BotBar: 1,
|
||||
TimerBar: 1,
|
||||
TimerBarPos: 0,
|
||||
TimerBarOverlay: 2,
|
||||
BuildColor: 1,
|
||||
PPDisplayTime: 0,
|
||||
UpBarColor: 1,
|
||||
UpgradeBarFixedPos: 1,
|
||||
CalcWrink: 0,
|
||||
CPSMode: 1,
|
||||
AvgCPSHist: 3,
|
||||
AvgClicksHist: 0,
|
||||
PPExcludeTop: 0,
|
||||
PPSecondsLowerLimit: 0,
|
||||
PPOnlyConsiderBuyable: 0,
|
||||
ToolWarnBon: 1,
|
||||
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,
|
||||
TooltipPantheon: 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,
|
||||
HideSectionsButtons: 0,
|
||||
BulkBuyBlock: 0,
|
||||
Header: {
|
||||
BarsColors: 1,
|
||||
Calculation: 1,
|
||||
Notification: 1,
|
||||
NotificationGeneral: 1,
|
||||
NotificationGC: 1,
|
||||
NotificationFC: 1,
|
||||
NotificationSea: 1,
|
||||
NotificationGard: 1,
|
||||
NotificationMagi: 1,
|
||||
NotificationWrink: 1,
|
||||
NotificationWrinkMax: 1,
|
||||
Tooltip: 1,
|
||||
Statistics: 1,
|
||||
Notation: 1,
|
||||
Miscellaneous: 1,
|
||||
Lucky: 1,
|
||||
Chain: 1,
|
||||
Spells: 1,
|
||||
Garden: 1,
|
||||
Prestige: 1,
|
||||
Wrink: 1,
|
||||
Sea: 1,
|
||||
Misc: 1,
|
||||
InfoTab: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export default ConfigDefault;
|
||||
1465
src/Disp.js
1465
src/Disp.js
File diff suppressed because it is too large
Load Diff
151
src/Disp/BeautifyAndFormatting/BeautifyFormatting.js
Normal file
151
src/Disp/BeautifyAndFormatting/BeautifyFormatting.js
Normal file
@@ -0,0 +1,151 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
/** General functions to format or beautify strings */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
import {
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns formats number based on the Scale setting
|
||||
* @param {number} num Number to be beautified
|
||||
* @param {any} floats Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
||||
* @param {number} forced Used to force (type 3) in certains cases
|
||||
* @returns {string} Formatted number
|
||||
*/
|
||||
export function Beautify(num, floats, forced) {
|
||||
const decimals = CMOptions.ScaleDecimals + 1;
|
||||
if (num === Infinity) {
|
||||
return 'Infinity';
|
||||
}
|
||||
if (typeof num === 'undefined') {
|
||||
return '0';
|
||||
}
|
||||
if (CMOptions.Scale === 0) {
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (Number.isFinite(num)) {
|
||||
let answer = '';
|
||||
if (num === 0) {
|
||||
return num.toString();
|
||||
}
|
||||
if (num > 0.001 && num < CMOptions.ScaleCutoff) {
|
||||
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
|
||||
else answer = num.toLocaleString('en');
|
||||
return answer;
|
||||
}
|
||||
if ((CMOptions.Scale === 4 && !forced) || forced === 4) {
|
||||
// Scientific notation, 123456789 => 1.235E+8
|
||||
answer = num.toExponential(decimals).toString().replace('e', 'E');
|
||||
} else {
|
||||
const exponential = num.toExponential().toString();
|
||||
const AmountOfTenPowerThree = Math.floor(
|
||||
exponential.slice(exponential.indexOf('e') + 1) / 3,
|
||||
);
|
||||
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(
|
||||
decimals,
|
||||
);
|
||||
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
|
||||
if ((CMOptions.Scale === 1 && !forced) || forced === 1) {
|
||||
// Metric scale, 123456789 => 123.457 M
|
||||
if (num >= 0.01 && num < Number(`1e${metric.length * 3}`)) {
|
||||
answer += ` ${metric[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if ((CMOptions.Scale === 2 && !forced) || forced === 2) {
|
||||
// Short scale, 123456789 => 123.457 M
|
||||
if (num >= 0.01 && num < Number(`1e${shortScale.length * 3}`)) {
|
||||
answer += ` ${shortScale[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if ((CMOptions.Scale === 3 && !forced) || forced === 3) {
|
||||
// Short scale, 123456789 => 123.457 M
|
||||
if (
|
||||
num >= 0.01 &&
|
||||
num < Number(`1e${shortScaleAbbreviated.length * 3}`)
|
||||
) {
|
||||
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
|
||||
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
|
||||
} else if ((CMOptions.Scale === 5 && !forced) || forced === 5) {
|
||||
// Engineering notation, 123456789 => 123.457E+6
|
||||
answer += `E${AmountOfTenPowerThree * 3}`;
|
||||
}
|
||||
}
|
||||
if (answer === '') {
|
||||
console.log(
|
||||
`Could not beautify number with Cookie Monster Beautify: ${num}`,
|
||||
);
|
||||
answer = BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
|
||||
return answer;
|
||||
}
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns time as a string depending on TimeFormat setting
|
||||
* @param {number} time Time to be formatted
|
||||
* @param {number} longFormat 1 or 0
|
||||
* @returns {string} Formatted time
|
||||
*/
|
||||
export function FormatTime(time, longFormat) {
|
||||
let formattedTime = time;
|
||||
if (time === Infinity) return time;
|
||||
if (time < 0) return 'Negative time period';
|
||||
formattedTime = Math.ceil(time);
|
||||
const y = Math.floor(formattedTime / 31557600);
|
||||
const d = Math.floor((formattedTime % 31557600) / 86400);
|
||||
const h = Math.floor((formattedTime % 86400) / 3600);
|
||||
const m = Math.floor((formattedTime % 3600) / 60);
|
||||
const s = Math.floor(formattedTime % 60);
|
||||
let str = '';
|
||||
if (CMOptions.TimeFormat) {
|
||||
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||
str += `${(h < 10 ? '0' : '') + h}:`;
|
||||
str += `${(m < 10 ? '0' : '') + m}:`;
|
||||
str += (s < 10 ? '0' : '') + s;
|
||||
} else {
|
||||
if (formattedTime > 777600000)
|
||||
return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str +=
|
||||
y > 0
|
||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
|
||||
: '';
|
||||
str +=
|
||||
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '';
|
||||
if (str.length > 0 || h > 0)
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||
if (str.length > 0 || m > 0)
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns the color to be used for time-strings
|
||||
* @param {number} time Time to be coloured
|
||||
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
|
||||
*/
|
||||
export function GetTimeColor(time) {
|
||||
let color;
|
||||
let text;
|
||||
if (time <= 0) {
|
||||
if (CMOptions.TimeFormat) text = '00:00:00:00:00';
|
||||
else text = 'Done!';
|
||||
color = ColorGreen;
|
||||
} else {
|
||||
text = FormatTime(time);
|
||||
if (time > 300) color = ColorRed;
|
||||
else if (time > 60) color = ColorOrange;
|
||||
else color = ColorYellow;
|
||||
}
|
||||
return { text, color };
|
||||
}
|
||||
117
src/Disp/BuildingsUpgrades/Buildings.js
Normal file
117
src/Disp/BuildingsUpgrades/Buildings.js
Normal file
@@ -0,0 +1,117 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { Colors, LastTargetBuildings } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||
|
||||
/**
|
||||
* This function adjusts some things in the column of buildings.
|
||||
* It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale()
|
||||
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.Data.Config.BulkBuildColor
|
||||
*/
|
||||
export default function UpdateBuildings() {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBuildings = target;
|
||||
} else {
|
||||
target = LastTargetBuildings;
|
||||
}
|
||||
if (target === 1) target = CacheObjects1;
|
||||
else if (target === 10) target = CacheObjects10;
|
||||
else if (target === 100) target = CacheObjects100;
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColor === 1) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||
CMOptions.Colors[target[i].color];
|
||||
});
|
||||
} else {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
||||
});
|
||||
}
|
||||
} else if (Game.buyMode === -1) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
const o = Game.Objects[i];
|
||||
l(`productPrice${o.id}`).style.color = '';
|
||||
/*
|
||||
* Fix sell price displayed in the object in the store.
|
||||
*
|
||||
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
|
||||
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
|
||||
*
|
||||
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
|
||||
*/
|
||||
l(`productPrice${o.id}`).innerHTML = Beautify(
|
||||
BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
||||
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
|
||||
// This regulates sorting of buildings
|
||||
if (Game.buyMode === 1 && CMOptions.SortBuildings) {
|
||||
let arr;
|
||||
if (CMOptions.SortBuildings === 1) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = CacheObjects1[k];
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
return o;
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
} else if (CMOptions.SortBuildings === 2) {
|
||||
arr = Object.keys(target).map((k) => {
|
||||
const o = target[k];
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
return o;
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
}
|
||||
|
||||
for (let x = 0; x < arr.length; x++) {
|
||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
||||
}
|
||||
} else {
|
||||
const arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = CacheObjects1[k];
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
return o;
|
||||
});
|
||||
arr.sort((a, b) => a.id - b.id);
|
||||
for (let x = 0; x < arr.length; x++) {
|
||||
Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
104
src/Disp/BuildingsUpgrades/UpgradeBar.js
Normal file
104
src/Disp/BuildingsUpgrades/UpgradeBar.js
Normal file
@@ -0,0 +1,104 @@
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates the legend for the upgrade bar
|
||||
* @returns {object} legend The legend-object to be added
|
||||
*/
|
||||
function CreateUpgradeBarLegend() {
|
||||
const legend = document.createElement('div');
|
||||
legend.style.minWidth = '330px';
|
||||
legend.style.marginBottom = '4px';
|
||||
const title = document.createElement('div');
|
||||
title.className = 'name';
|
||||
title.style.marginBottom = '4px';
|
||||
title.textContent = 'Legend';
|
||||
legend.appendChild(title);
|
||||
|
||||
const legendLine = function (color, text) {
|
||||
const div = document.createElement('div');
|
||||
div.style.verticalAlign = 'middle';
|
||||
const span = document.createElement('span');
|
||||
span.className = ColorBackPre + color;
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '10px';
|
||||
span.style.width = '10px';
|
||||
span.style.marginRight = '4px';
|
||||
div.appendChild(span);
|
||||
div.appendChild(document.createTextNode(text));
|
||||
return div;
|
||||
};
|
||||
|
||||
legend.appendChild(legendLine(ColorBlue, 'Better than best PP building'));
|
||||
legend.appendChild(legendLine(ColorGreen, 'Same as best PP building'));
|
||||
legend.appendChild(
|
||||
legendLine(
|
||||
ColorYellow,
|
||||
'Between best and worst PP buildings closer to best',
|
||||
),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(
|
||||
ColorOrange,
|
||||
'Between best and worst PP buildings closer to worst',
|
||||
),
|
||||
);
|
||||
legend.appendChild(legendLine(ColorRed, 'Same as worst PP building'));
|
||||
legend.appendChild(legendLine(ColorPurple, 'Worse than worst PP building'));
|
||||
legend.appendChild(legendLine(ColorGray, 'Negative or infinity PP'));
|
||||
return legend;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the upgrade bar above the upgrade-section in the right section of the screen
|
||||
*/
|
||||
export default function CreateUpgradeBar() {
|
||||
const UpgradeBar = document.createElement('div');
|
||||
UpgradeBar.id = 'CMUpgradeBar';
|
||||
UpgradeBar.style.width = '100%';
|
||||
UpgradeBar.style.backgroundColor = 'black';
|
||||
UpgradeBar.style.textAlign = 'center';
|
||||
UpgradeBar.style.fontWeight = 'bold';
|
||||
UpgradeBar.style.display = 'none';
|
||||
UpgradeBar.style.zIndex = '21';
|
||||
UpgradeBar.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
|
||||
const placeholder = document.createElement('div');
|
||||
placeholder.appendChild(CreateUpgradeBarLegend());
|
||||
UpgradeBar.onmouseover = function () {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
|
||||
};
|
||||
|
||||
const upgradeNumber = function (id, color) {
|
||||
const span = document.createElement('span');
|
||||
span.id = id;
|
||||
span.className = ColorTextPre + color;
|
||||
span.style.width = '14.28571428571429%';
|
||||
span.style.display = 'inline-block';
|
||||
span.textContent = '0';
|
||||
return span;
|
||||
};
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarBlue', ColorBlue));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGreen', ColorGreen));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarYellow', ColorYellow));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarOrange', ColorOrange));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarRed', ColorRed));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColorPurple));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColorGray));
|
||||
|
||||
l('upgrades').parentNode.insertBefore(
|
||||
UpgradeBar,
|
||||
l('upgrades').parentNode.childNodes[3],
|
||||
);
|
||||
}
|
||||
103
src/Disp/BuildingsUpgrades/Upgrades.js
Normal file
103
src/Disp/BuildingsUpgrades/Upgrades.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
Colors,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function adjusts some things in the upgrades section
|
||||
* It colours them and shuffles the order when CM.Options.SortBuildings is set
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale()
|
||||
* And by changes in CM.Options.SortUpgrades
|
||||
*/
|
||||
export default function UpdateUpgrades() {
|
||||
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar
|
||||
if (CMOptions.UpBarColor > 0) {
|
||||
let blue = 0;
|
||||
let green = 0;
|
||||
let yellow = 0;
|
||||
let orange = 0;
|
||||
let red = 0;
|
||||
let purple = 0;
|
||||
let gray = 0;
|
||||
|
||||
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||
const me = Game.UpgradesInStore[i];
|
||||
let addedColor = false;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||
if (
|
||||
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
|
||||
) {
|
||||
l(`upgrade${i}`).childNodes[j].className =
|
||||
ColorBackPre + CacheUpgrades[me.name].color;
|
||||
addedColor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!addedColor) {
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '10px';
|
||||
div.style.height = '10px';
|
||||
div.className = ColorBackPre + CacheUpgrades[me.name].color;
|
||||
l(`upgrade${i}`).appendChild(div);
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColorBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGray) gray += 1;
|
||||
});
|
||||
|
||||
l('CMUpgradeBarBlue').textContent = blue;
|
||||
l('CMUpgradeBarGreen').textContent = green;
|
||||
l('CMUpgradeBarYellow').textContent = yellow;
|
||||
l('CMUpgradeBarOrange').textContent = orange;
|
||||
l('CMUpgradeBarRed').textContent = red;
|
||||
l('CMUpgradeBarPurple').textContent = purple;
|
||||
l('CMUpgradeBarGray').textContent = gray;
|
||||
}
|
||||
|
||||
const arr = [];
|
||||
// Build array of pointers, sort by pp, set flex positions
|
||||
// This regulates sorting of upgrades
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
const o = {};
|
||||
o.name = Game.UpgradesInStore[x].name;
|
||||
o.price = Game.UpgradesInStore[x].basePrice;
|
||||
o.pp = CacheUpgrades[o.name].pp;
|
||||
arr.push(o);
|
||||
}
|
||||
|
||||
if (CMOptions.SortUpgrades) {
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
: 0;
|
||||
});
|
||||
} else {
|
||||
arr.sort((a, b) => a.price - b.price);
|
||||
}
|
||||
|
||||
const nameChecker = function (arr2, upgrade) {
|
||||
return arr2.findIndex((e) => e.name === upgrade.name);
|
||||
};
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
l(`upgrade${x}`).style.order =
|
||||
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
||||
}
|
||||
}
|
||||
71
src/Disp/Dragon/Dragon.js
Normal file
71
src/Disp/Dragon/Dragon.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
/**
|
||||
* This functions adds the two extra lines about CPS and time to recover to the aura picker infoscreen
|
||||
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||
*/
|
||||
export function AddAuraInfo(aura) {
|
||||
if (CMOptions.DragonAuraInfo === 1) {
|
||||
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
|
||||
const timeToRecover = FormatTime(
|
||||
priceOfChange / (bonusCPS + Game.cookiesPs),
|
||||
);
|
||||
const bonusCPSPercentage = Beautify(bonusCPS / Game.cookiesPs);
|
||||
|
||||
l('dragonAuraInfo').style.minHeight = '60px';
|
||||
l('dragonAuraInfo').style.margin = '8px';
|
||||
l('dragonAuraInfo').appendChild(document.createElement('div')).className =
|
||||
'line';
|
||||
const div = document.createElement('div');
|
||||
div.style.minWidth = '200px';
|
||||
div.style.textAlign = 'center';
|
||||
div.textContent = `Picking this aura will change CPS by ${Beautify(
|
||||
bonusCPS,
|
||||
)} (${bonusCPSPercentage}% of current CPS).`;
|
||||
l('dragonAuraInfo').appendChild(div);
|
||||
const div2 = document.createElement('div');
|
||||
div2.style.minWidth = '200px';
|
||||
div2.style.textAlign = 'center';
|
||||
div2.textContent = `It will take ${timeToRecover} to recover the cost.`;
|
||||
l('dragonAuraInfo').appendChild(div2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions adds a tooltip to the level up button displaying the cost of rebuying all
|
||||
* It is called by Game.ToggleSpecialMenu() after CM.Main.ReplaceNative()
|
||||
*/
|
||||
export function AddDragonLevelUpTooltip() {
|
||||
// Check if it is the dragon popup that is on screen
|
||||
if (
|
||||
(l('specialPopup').className.match(/onScreen/) &&
|
||||
l('specialPopup').children[0].style.background.match(/dragon/)) !== null
|
||||
) {
|
||||
for (let i = 0; i < l('specialPopup').childNodes.length; i++) {
|
||||
if (l('specialPopup').childNodes[i].className === 'optionBox') {
|
||||
l('specialPopup').children[i].onmouseover = function () {
|
||||
CacheDragonCost();
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
l('specialPopup'),
|
||||
`<div style="min-width:200px;text-align:center;">${CacheCostDragonUpgrade}</div>`,
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('specialPopup').children[i].onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
src/Disp/Draw.js
Normal file
62
src/Disp/Draw.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import { Beautify } from './BeautifyAndFormatting/BeautifyFormatting';
|
||||
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
|
||||
import { UpdateBotBar } from './InfoBars/BottomBar';
|
||||
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
||||
import RefreshMenu from './MenuSections/Refreshmenu';
|
||||
import UpdateTooltips from './Tooltips/UpdateTooltips';
|
||||
import {
|
||||
CheckWrinklerTooltip,
|
||||
UpdateWrinklerTooltip,
|
||||
} from './Tooltips/WrinklerTooltips';
|
||||
|
||||
/**
|
||||
* This function handles all custom drawing for the Game.Draw() function.
|
||||
* It is hooked on 'draw' by CM.RegisterHooks()
|
||||
*/
|
||||
export default function Draw() {
|
||||
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
|
||||
if (
|
||||
Game.prefs.autosave &&
|
||||
Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks
|
||||
Game.onMenu === 'stats' &&
|
||||
CMOptions.Stats // while being on the stats menu only
|
||||
) {
|
||||
const timer = document.getElementById('CMStatsAutosaveTimer');
|
||||
if (timer) {
|
||||
timer.innerText = Game.sayTime(
|
||||
Game.fps * 60 - (Game.T % (Game.fps * 60)),
|
||||
4,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Update colors
|
||||
UpdateBuildings();
|
||||
UpdateUpgrades();
|
||||
|
||||
// Redraw timers
|
||||
UpdateTimerBar();
|
||||
|
||||
// Update Bottom Bar
|
||||
UpdateBotBar();
|
||||
|
||||
// Update Tooltip
|
||||
UpdateTooltips();
|
||||
|
||||
// Update Wrinkler Tooltip
|
||||
CheckWrinklerTooltip();
|
||||
UpdateWrinklerTooltip();
|
||||
|
||||
// Change menu refresh interval
|
||||
RefreshMenu();
|
||||
|
||||
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
|
||||
let str = l('cookies').innerHTML.replace(
|
||||
/.*(?=<br>)/i,
|
||||
Beautify(Game.cookies),
|
||||
);
|
||||
if (Game.prefs.monospace) str = `<span class="monospace">${str}</span>`;
|
||||
l('cookies').innerHTML = str;
|
||||
}
|
||||
43
src/Disp/GoldenCookieTimers/GoldenCookieTimers.js
Normal file
43
src/Disp/GoldenCookieTimers/GoldenCookieTimers.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { GCTimers } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a new Golden Cookie Timer and appends it CM.Disp.GCTimers based on the id of the cookie
|
||||
* @param {object} cookie A Golden Cookie object
|
||||
*/
|
||||
export default function CreateGCTimer(cookie) {
|
||||
const GCTimer = document.createElement('div');
|
||||
GCTimer.id = `GCTimer${cookie.id}`;
|
||||
GCTimer.style.width = '96px';
|
||||
GCTimer.style.height = '96px';
|
||||
GCTimer.style.position = 'absolute';
|
||||
GCTimer.style.zIndex = '10000000001';
|
||||
GCTimer.style.textAlign = 'center';
|
||||
GCTimer.style.lineHeight = '96px';
|
||||
GCTimer.style.fontFamily = '"Kavoon", Georgia, serif';
|
||||
GCTimer.style.fontSize = '35px';
|
||||
GCTimer.style.cursor = 'pointer';
|
||||
GCTimer.style.display = 'block';
|
||||
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
||||
GCTimer.style.left = cookie.l.style.left;
|
||||
GCTimer.style.top = cookie.l.style.top;
|
||||
GCTimer.onclick = function () {
|
||||
cookie.pop();
|
||||
};
|
||||
GCTimer.onmouseover = function () {
|
||||
cookie.l.style.filter =
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
cookie.l.style.webkitFilter =
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
};
|
||||
GCTimer.onmouseout = function () {
|
||||
cookie.l.style.filter = '';
|
||||
cookie.l.style.webkitFilter = '';
|
||||
};
|
||||
|
||||
GCTimers[cookie.id] = GCTimer;
|
||||
l('shimmers').appendChild(GCTimer);
|
||||
}
|
||||
20
src/Disp/HelperFunctions/CalculateGrimoireRefillTime.js
Normal file
20
src/Disp/HelperFunctions/CalculateGrimoireRefillTime.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This function calculates the time it takes to reach a certain magic level
|
||||
* @param {number} currentMagic The current magic level
|
||||
* @param {number} maxMagic The user's max magic level
|
||||
* @param {number} targetMagic The target magic level
|
||||
* @returns {number} count / Game.fps The time it takes to reach targetMagic
|
||||
*/
|
||||
export default function CalculateGrimoireRefillTime(
|
||||
currentMagic,
|
||||
maxMagic,
|
||||
targetMagic,
|
||||
) {
|
||||
let magic = currentMagic;
|
||||
let count = 0;
|
||||
while (magic < targetMagic) {
|
||||
magic += Math.max(0.002, (magic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||
count += 1;
|
||||
}
|
||||
return count / Game.fps;
|
||||
}
|
||||
41
src/Disp/HelperFunctions/GetCPS.js
Normal file
41
src/Disp/HelperFunctions/GetCPS.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
CacheAverageCPS,
|
||||
CacheCurrWrinklerCount,
|
||||
CacheCurrWrinklerCPSMult,
|
||||
CacheWrinklersFattest,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
|
||||
* @returns {number} The average or current cps
|
||||
*/
|
||||
export default function GetCPS() {
|
||||
if (CMOptions.CPSMode) {
|
||||
return CacheAverageCPS;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 0) {
|
||||
return Game.cookiesPs * (1 - Game.cpsSucked);
|
||||
}
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
(CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
if (
|
||||
CMOptions.CalcWrink === 2 &&
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
|
||||
) {
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
|
||||
(1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
return (
|
||||
Game.cookiesPs *
|
||||
(CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount +
|
||||
(1 - CacheCurrWrinklerCount * 0.05))
|
||||
);
|
||||
}
|
||||
33
src/Disp/HelperFunctions/GetLumpColor.js
Normal file
33
src/Disp/HelperFunctions/GetLumpColor.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns Name and Color as object for sugar lump type that is given as input param.
|
||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||
* @param {string} type Sugar Lump Type.
|
||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
||||
*/
|
||||
export default function GetLumpColor(type) {
|
||||
if (type === 0) {
|
||||
return { text: 'Normal', color: ColorGray };
|
||||
}
|
||||
if (type === 1) {
|
||||
return { text: 'Bifurcated', color: ColorGreen };
|
||||
}
|
||||
if (type === 2) {
|
||||
return { text: 'Golden', color: ColorYellow };
|
||||
}
|
||||
if (type === 3) {
|
||||
return { text: 'Meaty', color: ColorOrange };
|
||||
}
|
||||
if (type === 4) {
|
||||
return { text: 'Caramelized', color: ColorPurple };
|
||||
}
|
||||
return { text: 'Unknown Sugar Lump', color: ColorRed };
|
||||
}
|
||||
20
src/Disp/HelperFunctions/GetWrinkConfigBank.js
Normal file
20
src/Disp/HelperFunctions/GetWrinkConfigBank.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import {
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns the total amount stored in the Wrinkler Bank
|
||||
* as calculated by CM.Cache.CacheWrinklers() if CM.Options.CalcWrink is set
|
||||
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
|
||||
*/
|
||||
export default function GetWrinkConfigBank() {
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
return CacheWrinklersTotal;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 2) {
|
||||
return CacheWrinklersFattest[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
11
src/Disp/HelperFunctions/PopWrinklers.js
Normal file
11
src/Disp/HelperFunctions/PopWrinklers.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* This function pops all normal wrinklers
|
||||
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
|
||||
*/
|
||||
export default function PopAllNormalWrinklers() {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
|
||||
Game.wrinklers[i].hp = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
17
src/Disp/HelperFunctions/RefreshScale.js
Normal file
17
src/Disp/HelperFunctions/RefreshScale.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgrades from '../BuildingsUpgrades/Upgrades';
|
||||
import { UpdateBotBar } from '../InfoBars/BottomBar';
|
||||
|
||||
/**
|
||||
* This function refreshes all numbers after a change in scale-setting
|
||||
* It is therefore called by a changes in CM.Options.Scale, CM.Options.ScaleDecimals, CM.Options.ScaleSeparator and CM.Options.ScaleCutoff
|
||||
*/
|
||||
export default function RefreshScale() {
|
||||
BeautifyAll();
|
||||
Game.RefreshStore();
|
||||
Game.RebuildUpgrades();
|
||||
|
||||
UpdateBotBar();
|
||||
UpdateBuildings();
|
||||
UpdateUpgrades();
|
||||
}
|
||||
20
src/Disp/HelperFunctions/UpdateAscendState.js
Normal file
20
src/Disp/HelperFunctions/UpdateAscendState.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ToggleTimerBar } from '../../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBackground from './UpdateBackground';
|
||||
|
||||
/**
|
||||
* This function disables and shows the bars created by CookieMonster when the game is "ascending"
|
||||
* It is called by CM.Disp.Draw()
|
||||
*/
|
||||
export default function UpdateAscendState() {
|
||||
if (Game.OnAscend) {
|
||||
l('game').style.bottom = '0px';
|
||||
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none';
|
||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none';
|
||||
} else {
|
||||
ToggleBotBar();
|
||||
ToggleTimerBar();
|
||||
}
|
||||
UpdateBackground();
|
||||
}
|
||||
14
src/Disp/HelperFunctions/UpdateBackground.js
Normal file
14
src/Disp/HelperFunctions/UpdateBackground.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* This function sets the size of the background of the full game and the left column
|
||||
* depending on whether certain abrs are activated
|
||||
* It is called by CM.Disp.UpdateAscendState() and CM.Disp.UpdateBotTimerBarPosition()
|
||||
*/
|
||||
export default function UpdateBackground() {
|
||||
Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth;
|
||||
Game.Background.canvas.height =
|
||||
Game.Background.canvas.parentNode.offsetHeight;
|
||||
Game.LeftBackground.canvas.width =
|
||||
Game.LeftBackground.canvas.parentNode.offsetWidth;
|
||||
Game.LeftBackground.canvas.height =
|
||||
Game.LeftBackground.canvas.parentNode.offsetHeight;
|
||||
}
|
||||
33
src/Disp/HelperFunctions/UpdateColors.js
Normal file
33
src/Disp/HelperFunctions/UpdateColors.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBorderPre,
|
||||
Colors,
|
||||
ColorTextPre,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function changes/refreshes colours if the user has set new standard colours
|
||||
* The function is therefore called by a change in CM.Options.Colors
|
||||
*/
|
||||
export default function UpdateColors() {
|
||||
let str = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorTextPre}${Colors[i]} { color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBackPre}${Colors[i]} { background-color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBorderPre}${Colors[i]} { border: 1px solid ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
UpdateBuildings(); // Class has been already set
|
||||
}
|
||||
125
src/Disp/InfoBars/BottomBar.js
Normal file
125
src/Disp/InfoBars/BottomBar.js
Normal file
@@ -0,0 +1,125 @@
|
||||
/** Functions related to the Bottom Bar */
|
||||
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorBlue,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
LastTargetBotBar,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
|
||||
/**
|
||||
* This function creates the bottom bar and appends it to l('wrapper')
|
||||
*/
|
||||
export function CreateBotBar() {
|
||||
const BotBar = document.createElement('div');
|
||||
BotBar.id = 'CMBotBar';
|
||||
BotBar.style.height = '69px';
|
||||
BotBar.style.width = '100%';
|
||||
BotBar.style.position = 'absolute';
|
||||
BotBar.style.display = 'none';
|
||||
BotBar.style.backgroundColor = '#262224';
|
||||
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
|
||||
BotBar.style.borderTop = '1px solid black';
|
||||
BotBar.style.overflow = 'auto';
|
||||
BotBar.style.textShadow =
|
||||
'-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
|
||||
|
||||
const table = BotBar.appendChild(document.createElement('table'));
|
||||
table.style.width = '100%';
|
||||
table.style.textAlign = 'center';
|
||||
table.style.whiteSpace = 'nowrap';
|
||||
const tbody = table.appendChild(document.createElement('tbody'));
|
||||
|
||||
const firstCol = function (text, color) {
|
||||
const td = document.createElement('td');
|
||||
td.style.textAlign = 'right';
|
||||
td.className = ColorTextPre + color;
|
||||
td.textContent = text;
|
||||
return td;
|
||||
};
|
||||
const type = tbody.appendChild(document.createElement('tr'));
|
||||
type.style.fontWeight = 'bold';
|
||||
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColorYellow));
|
||||
const bonus = tbody.appendChild(document.createElement('tr'));
|
||||
bonus.appendChild(firstCol('Bonus Income', ColorBlue));
|
||||
const pp = tbody.appendChild(document.createElement('tr'));
|
||||
pp.appendChild(firstCol('Payback Period', ColorBlue));
|
||||
const time = tbody.appendChild(document.createElement('tr'));
|
||||
time.appendChild(firstCol('Time Left', ColorBlue));
|
||||
|
||||
l('wrapper').appendChild(BotBar);
|
||||
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CreateBotBarBuildingColumn(i);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates the bonus-, pp-, and time-rows in the the bottom bar
|
||||
*/
|
||||
export function UpdateBotBar() {
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
let count = 0;
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBotBar = target;
|
||||
} else {
|
||||
target = LastTargetBotBar;
|
||||
}
|
||||
if (target === 1) target = CacheObjects1;
|
||||
if (target === 10) target = CacheObjects10;
|
||||
if (target === 100) target = CacheObjects100;
|
||||
count += 1;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
|
||||
count
|
||||
].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[
|
||||
count
|
||||
].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + target[i].color;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
else PPString = Beautify(Math.round(target[i].pp), 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].textContent = PPString;
|
||||
const timeColor = GetTimeColor(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + timeColor.color;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < Game.Objects[i].bulkPrice
|
||||
) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = timeColor.text;
|
||||
});
|
||||
}
|
||||
}
|
||||
97
src/Disp/InfoBars/CreateDOMElements.js
Normal file
97
src/Disp/InfoBars/CreateDOMElements.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/** Functions to create various DOM elements used by the Bars */
|
||||
|
||||
import { ColorBackPre, ColorBlue, ColorTextPre } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates an indivudual timer for the timer bar
|
||||
* @param {string} id An id to identify the timer
|
||||
* @param {string} name The title of the timer
|
||||
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
|
||||
*/
|
||||
export function CreateTimer(id, name, bars) {
|
||||
const timerBar = document.createElement('div');
|
||||
timerBar.id = id;
|
||||
timerBar.style.height = '12px';
|
||||
timerBar.style.margin = '0px 10px';
|
||||
timerBar.style.position = 'relative';
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '100%';
|
||||
div.style.height = '10px';
|
||||
div.style.margin = 'auto';
|
||||
div.style.position = 'absolute';
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
div.style.right = '0px';
|
||||
div.style.bottom = '0px';
|
||||
|
||||
const type = document.createElement('span');
|
||||
type.style.display = 'inline-block';
|
||||
type.style.textAlign = 'right';
|
||||
type.style.fontSize = '10px';
|
||||
type.style.width = '108px';
|
||||
type.style.marginRight = '5px';
|
||||
type.style.verticalAlign = 'text-top';
|
||||
type.textContent = name;
|
||||
div.appendChild(type);
|
||||
|
||||
for (let i = 0; i < bars.length; i++) {
|
||||
const colorBar = document.createElement('span');
|
||||
colorBar.id = bars[i].id;
|
||||
colorBar.style.display = 'inline-block';
|
||||
colorBar.style.height = '10px';
|
||||
colorBar.style.verticalAlign = 'text-top';
|
||||
colorBar.style.textAlign = 'center';
|
||||
if (bars.length - 1 === i) {
|
||||
colorBar.style.borderTopRightRadius = '10px';
|
||||
colorBar.style.borderBottomRightRadius = '10px';
|
||||
}
|
||||
if (typeof bars[i].color !== 'undefined') {
|
||||
colorBar.className = ColorBackPre + bars[i].color;
|
||||
}
|
||||
div.appendChild(colorBar);
|
||||
}
|
||||
|
||||
const timer = document.createElement('span');
|
||||
timer.id = `${id}Time`;
|
||||
timer.style.marginLeft = '5px';
|
||||
timer.style.verticalAlign = 'text-top';
|
||||
div.appendChild(timer);
|
||||
|
||||
timerBar.appendChild(div);
|
||||
|
||||
return timerBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function extends the bottom bar (created by CM.Disp.CreateBotBar) with a column for the given building.
|
||||
* @param {string} buildingName Objectname to be added (e.g., "Cursor")
|
||||
*/
|
||||
export function CreateBotBarBuildingColumn(buildingName) {
|
||||
if (l('CMBotBar') !== null) {
|
||||
const type = l('CMBotBar').firstChild.firstChild.childNodes[0];
|
||||
const bonus = l('CMBotBar').firstChild.firstChild.childNodes[1];
|
||||
const pp = l('CMBotBar').firstChild.firstChild.childNodes[2];
|
||||
const time = l('CMBotBar').firstChild.firstChild.childNodes[3];
|
||||
|
||||
const i = buildingName;
|
||||
const header = type.appendChild(document.createElement('td'));
|
||||
header.appendChild(
|
||||
document.createTextNode(
|
||||
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
|
||||
),
|
||||
);
|
||||
|
||||
const span = header.appendChild(document.createElement('span'));
|
||||
span.className = ColorTextPre + ColorBlue;
|
||||
|
||||
header.appendChild(document.createTextNode(')'));
|
||||
type.lastChild.style.paddingLeft = '8px';
|
||||
bonus.appendChild(document.createElement('td'));
|
||||
bonus.lastChild.style.paddingLeft = '8px';
|
||||
pp.appendChild(document.createElement('td'));
|
||||
pp.lastChild.style.paddingLeft = '8px';
|
||||
time.appendChild(document.createElement('td'));
|
||||
time.lastChild.style.paddingLeft = '2px';
|
||||
}
|
||||
}
|
||||
206
src/Disp/InfoBars/TimerBar.js
Normal file
206
src/Disp/InfoBars/TimerBar.js
Normal file
@@ -0,0 +1,206 @@
|
||||
/** Functions related to the Timer Bar */
|
||||
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
BuffColors,
|
||||
ColorBackPre,
|
||||
ColorGray,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
LastNumberOfTimers,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateTimer } from './CreateDOMElements';
|
||||
|
||||
/**
|
||||
* This function creates the TimerBar and appends it to l('wrapper')
|
||||
*/
|
||||
export function CreateTimerBar() {
|
||||
const TimerBar = document.createElement('div');
|
||||
TimerBar.id = 'CMTimerBar';
|
||||
TimerBar.style.position = 'absolute';
|
||||
TimerBar.style.display = 'none';
|
||||
TimerBar.style.height = '0px';
|
||||
TimerBar.style.fontSize = '10px';
|
||||
TimerBar.style.fontWeight = 'bold';
|
||||
TimerBar.style.backgroundColor = 'black';
|
||||
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColorPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColorOrange },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
TimerBarBuffTimers.id = 'CMTimerBarBuffTimers';
|
||||
TimerBar.appendChild(TimerBarBuffTimers);
|
||||
|
||||
l('wrapper').appendChild(TimerBar);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates indivudual timers in the timer bar
|
||||
*/
|
||||
export function UpdateTimerBar() {
|
||||
if (CMOptions.TimerBar === 1) {
|
||||
// label width: 113, timer width: 30, div margin: 20
|
||||
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
|
||||
// label width: 113, div margin: 20, calculate timer width at runtime
|
||||
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
|
||||
let numberOfTimers = 0;
|
||||
|
||||
// Regulates visibility of Golden Cookie timer
|
||||
if (
|
||||
Game.shimmerTypes.golden.spawned === 0 &&
|
||||
!Game.Has('Golden switch [off]')
|
||||
) {
|
||||
l('CMTimerBarGC').style.display = '';
|
||||
l('CMTimerBarGCMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCMinBar').textContent = '';
|
||||
if (
|
||||
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
|
||||
) {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
|
||||
} else {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
|
||||
}
|
||||
l('CMTimerBarGCBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCBar').textContent = '';
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
|
||||
// Regulates visibility of Reindeer timer
|
||||
if (
|
||||
Game.season === 'christmas' &&
|
||||
Game.shimmerTypes.reindeer.spawned === 0
|
||||
) {
|
||||
l('CMTimerBarRen').style.display = '';
|
||||
l('CMTimerBarRenMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.minTime -
|
||||
Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenMinBar').textContent = '';
|
||||
l('CMTimerBarRenBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenBar').textContent = '';
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
}
|
||||
|
||||
// On every frame all buff-timers are deleted and re-created
|
||||
const BuffTimerBars = {};
|
||||
l('CMTimerBarBuffTimers').innerHTML = '';
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (Game.buffs[i]) {
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [
|
||||
{ id: `${Game.buffs[i].name}Bar` },
|
||||
]);
|
||||
timer.style.display = '';
|
||||
let classColor = '';
|
||||
// Gives specific timers specific colors
|
||||
if (typeof BuffColors[Game.buffs[i].name] !== 'undefined') {
|
||||
classColor = BuffColors[Game.buffs[i].name];
|
||||
} else classColor = ColorPurple;
|
||||
timer.lastChild.children[1].className = ColorBackPre + classColor;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2)
|
||||
timer.lastChild.children[1].textContent = `${Math.round(
|
||||
100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
|
||||
)}%`;
|
||||
else timer.lastChild.children[1].textContent = '';
|
||||
timer.lastChild.children[1].style.width = `${Math.round(
|
||||
(Game.buffs[i].time *
|
||||
(maxWidthOneBar -
|
||||
Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
|
||||
Game.buffs[i].maxTime,
|
||||
)}px`;
|
||||
timer.lastChild.children[2].textContent = Math.ceil(
|
||||
Game.buffs[i].time / Game.fps,
|
||||
);
|
||||
numberOfTimers += 1;
|
||||
BuffTimerBars[Game.buffs[i].name] = timer;
|
||||
}
|
||||
});
|
||||
Object.keys(BuffTimerBars).forEach((i) => {
|
||||
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
|
||||
});
|
||||
|
||||
if (numberOfTimers !== 0) {
|
||||
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
|
||||
}
|
||||
if (LastNumberOfTimers !== numberOfTimers) {
|
||||
LastNumberOfTimers = numberOfTimers;
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This function creates two objects at the top of the right column that allowing hiding the upgrade and building section
|
||||
*/
|
||||
export default function CreateSectionHideButtons() {
|
||||
const div = document.createElement('div');
|
||||
div.id = 'CMSectionHidButtons';
|
||||
div.style.textAlign = 'center';
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
if (l('upgrades').style.display === 'flex') {
|
||||
l('upgrades').style.display = 'none';
|
||||
l('toggleUpgrades').style.display = 'none';
|
||||
l('techUpgrades').style.display = 'none';
|
||||
l('vaultUpgrades').style.display = 'none';
|
||||
} else {
|
||||
l('upgrades').style.display = 'flex';
|
||||
if (l('toggleUpgrades').children.length !== 0)
|
||||
l('toggleUpgrades').style.display = 'block';
|
||||
if (l('techUpgrades').children.length !== 0)
|
||||
l('techUpgrades').style.display = 'block';
|
||||
if (l('vaultUpgrades').children.length !== 0)
|
||||
l('vaultUpgrades').style.display = 'block';
|
||||
}
|
||||
};
|
||||
a.textContent = 'Hide/Show Upgrades';
|
||||
div.appendChild(a);
|
||||
const b = document.createElement('a');
|
||||
b.className = 'option';
|
||||
b.onclick = function () {
|
||||
if (l('products').style.display === 'grid')
|
||||
l('products').style.display = 'none';
|
||||
else l('products').style.display = 'grid';
|
||||
};
|
||||
b.textContent = 'Hide/Show Buildings';
|
||||
div.appendChild(b);
|
||||
l('store').insertBefore(div, l('store').childNodes[2]);
|
||||
}
|
||||
54
src/Disp/Initialization/CreateWrinklerButton.js
Normal file
54
src/Disp/Initialization/CreateWrinklerButton.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { CreateTooltip } from '../Tooltips/Tooltip';
|
||||
|
||||
/**
|
||||
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
||||
*/
|
||||
export default function CreateWrinklerButtons() {
|
||||
const popAllA = document.createElement('a');
|
||||
popAllA.id = 'PopAllNormalWrinklerButton';
|
||||
popAllA.textContent = 'Pop All Normal';
|
||||
popAllA.className = 'option';
|
||||
popAllA.onclick = function () {
|
||||
PopAllNormalWrinklers();
|
||||
};
|
||||
popAllA.onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
popAllA.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('wb', 'PopAll');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('sectionLeftExtra').children[0].append(popAllA);
|
||||
const popFattestA = document.createElement('a');
|
||||
popFattestA.id = 'PopFattestWrinklerButton';
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function () {
|
||||
if (CacheWrinklersFattest[1] !== null)
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
||||
};
|
||||
popFattestA.onmouseout = function () {
|
||||
Game.tooltip.shouldHide = 1;
|
||||
};
|
||||
popFattestA.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('wb', 'PopFattest');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
l('sectionLeftExtra').children[0].append(popFattestA);
|
||||
}
|
||||
13
src/Disp/Initialization/CssArea.js
Normal file
13
src/Disp/Initialization/CssArea.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { DispCSS } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a CSS style that stores certain standard CSS classes used by CookieMonster
|
||||
|
||||
*/
|
||||
export default function CreateCssArea() {
|
||||
DispCSS = document.createElement('style');
|
||||
DispCSS.type = 'text/css';
|
||||
DispCSS.id = 'CMCSS';
|
||||
|
||||
document.head.appendChild(DispCSS);
|
||||
}
|
||||
10
src/Disp/Initialization/UpdateBuildingUpgradeStyle.js
Normal file
10
src/Disp/Initialization/UpdateBuildingUpgradeStyle.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* This function updates the style of the building and upgrade sections to make these sortable
|
||||
*/
|
||||
export default function UpdateBuildingUpgradeStyle() {
|
||||
l('products').style.display = 'grid';
|
||||
l('storeBulk').style.gridRow = '1/1';
|
||||
|
||||
l('upgrades').style.display = 'flex';
|
||||
l('upgrades').style['flex-wrap'] = 'wrap';
|
||||
}
|
||||
14
src/Disp/Initialization/WhiteScreen.js
Normal file
14
src/Disp/Initialization/WhiteScreen.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* This function creates a white square over the full screen and appends it to l('wrapper')
|
||||
*/
|
||||
export default function CreateWhiteScreen() {
|
||||
const WhiteScreen = document.createElement('div');
|
||||
WhiteScreen.id = 'CMWhiteScreen';
|
||||
WhiteScreen.style.width = '100%';
|
||||
WhiteScreen.style.height = '100%';
|
||||
WhiteScreen.style.backgroundColor = 'white';
|
||||
WhiteScreen.style.display = 'none';
|
||||
WhiteScreen.style.zIndex = '9999999999';
|
||||
WhiteScreen.style.position = 'absolute';
|
||||
l('wrapper').appendChild(WhiteScreen);
|
||||
}
|
||||
25
src/Disp/MenuSections/AddMenus.js
Normal file
25
src/Disp/MenuSections/AddMenus.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import AddMenuStats from './AddStatsPage';
|
||||
import AddMenuInfo from './InfoPage';
|
||||
import AddMenuPref from './SettingsPage';
|
||||
|
||||
/**
|
||||
* This function adds the calll the functions to add extra info to the stats and options pages
|
||||
*/
|
||||
export default function AddMenu() {
|
||||
const title = document.createElement('div');
|
||||
title.className = 'title';
|
||||
|
||||
if (Game.onMenu === 'prefs') {
|
||||
title.textContent = 'Cookie Monster Settings';
|
||||
AddMenuPref(title);
|
||||
} else if (Game.onMenu === 'stats') {
|
||||
if (CMOptions.Stats) {
|
||||
title.textContent = 'Cookie Monster Statistics';
|
||||
AddMenuStats(title);
|
||||
}
|
||||
} else if (Game.onMenu === 'log') {
|
||||
title.textContent = 'Cookie Monster '; // To create space between name and button
|
||||
AddMenuInfo(title);
|
||||
}
|
||||
}
|
||||
178
src/Disp/MenuSections/AddStatsPage.js
Normal file
178
src/Disp/MenuSections/AddStatsPage.js
Normal file
@@ -0,0 +1,178 @@
|
||||
/** Main function to create the sections of Cookie Monster on the Statistics page */
|
||||
|
||||
import { AddMissingUpgrades } from './CreateMissingUpgrades';
|
||||
import * as CreateSections from './CreateStatsSections';
|
||||
import * as CreateElements from './CreateDOMElements';
|
||||
import * as GameData from '../../Data/Gamedata';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
import {
|
||||
CacheAverageClicks,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { ClickTimes, CookieTimes } from '../VariablesAndData';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
/**
|
||||
* This function adds stats created by CookieMonster to the stats page
|
||||
* It is called by CM.Disp.AddMenu
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuStats(title) {
|
||||
const stats = document.createElement('div');
|
||||
stats.className = 'subsection';
|
||||
stats.appendChild(title);
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Lucky Cookies', 'Lucky'));
|
||||
if (CMOptions.Header.Lucky) {
|
||||
stats.appendChild(CreateSections.LuckySection());
|
||||
}
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Chain Cookies', 'Chain'));
|
||||
if (CMOptions.Header.Chain) {
|
||||
stats.appendChild(CreateSections.ChainSection());
|
||||
}
|
||||
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Spells', 'Spells'));
|
||||
if (CMOptions.Header.Spells) {
|
||||
stats.appendChild(CreateSections.SpellsSection());
|
||||
}
|
||||
}
|
||||
|
||||
if (Game.Objects.Farm.minigameLoaded) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Garden', 'Garden'));
|
||||
if (CMOptions.Header.Garden) {
|
||||
stats.appendChild(CreateSections.GardenSection());
|
||||
}
|
||||
}
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Prestige', 'Prestige'));
|
||||
if (CMOptions.Header.Prestige) {
|
||||
stats.appendChild(CreateSections.PrestigeSection());
|
||||
}
|
||||
|
||||
if (Game.cpsSucked > 0) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Wrinklers', 'Wrink'));
|
||||
if (CMOptions.Header.Wrink) {
|
||||
const popAllFrag = document.createDocumentFragment();
|
||||
popAllFrag.appendChild(
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheWrinklersTotal)} / ${Beautify(
|
||||
CacheWrinklersNormal,
|
||||
)} `,
|
||||
),
|
||||
);
|
||||
const popAllA = document.createElement('a');
|
||||
popAllA.textContent = 'Pop All Normal';
|
||||
popAllA.className = 'option';
|
||||
popAllA.onclick = function () {
|
||||
PopAllNormalWrinklers();
|
||||
};
|
||||
popAllFrag.appendChild(popAllA);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Rewards of Popping (All/Normal)',
|
||||
popAllFrag,
|
||||
),
|
||||
);
|
||||
const popFattestFrag = document.createDocumentFragment();
|
||||
popFattestFrag.appendChild(
|
||||
document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `),
|
||||
);
|
||||
const popFattestA = document.createElement('a');
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function () {
|
||||
if (CacheWrinklersFattest[1] !== null)
|
||||
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
||||
};
|
||||
popFattestFrag.appendChild(popFattestA);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${
|
||||
CacheWrinklersFattest[1] !== null
|
||||
? CacheWrinklersFattest[1]
|
||||
: 'None'
|
||||
})`,
|
||||
popFattestFrag,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
stats.appendChild(CreateSections.SeasonSection());
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc'));
|
||||
if (CMOptions.Header.Misc) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookies Per Second (Past ${
|
||||
CookieTimes[CMOptions.AvgCPSHist] < 60
|
||||
? `${CookieTimes[CMOptions.AvgCPSHist]} seconds`
|
||||
: CookieTimes[CMOptions.AvgCPSHist] / 60 +
|
||||
(CMOptions.AvgCPSHist === 3 ? ' minute' : ' minutes')
|
||||
})`,
|
||||
document.createTextNode(Beautify(GetCPS(), 3)),
|
||||
),
|
||||
);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookie Clicks Per Second (Past ${
|
||||
ClickTimes[CMOptions.AvgClicksHist]
|
||||
}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`,
|
||||
document.createTextNode(Beautify(CacheAverageClicks, 1)),
|
||||
),
|
||||
);
|
||||
if (Game.Has('Fortune cookies')) {
|
||||
const fortunes = [];
|
||||
Object.keys(GameData.Fortunes).forEach((i) => {
|
||||
if (!Game.Has(GameData.Fortunes[i])) {
|
||||
fortunes.push(GameData.Fortunes[i]);
|
||||
}
|
||||
});
|
||||
if (fortunes.length !== 0)
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Fortune Upgrades Left to Buy',
|
||||
CreateElements.StatsMissDisp(fortunes),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (CMOptions.ShowMissedGC) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Missed Golden Cookies',
|
||||
document.createTextNode(Beautify(Game.missedGoldenClicks)),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (Game.prefs.autosave) {
|
||||
const timer = document.createElement('span');
|
||||
timer.id = 'CMStatsAutosaveTimer';
|
||||
timer.innerText = Game.sayTime(
|
||||
Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60)),
|
||||
4,
|
||||
);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing('basic', 'Time till autosave', timer),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
l('menu').insertBefore(stats, l('menu').childNodes[2]);
|
||||
|
||||
if (CMOptions.MissingUpgrades) {
|
||||
AddMissingUpgrades();
|
||||
}
|
||||
}
|
||||
135
src/Disp/MenuSections/CreateDOMElements.js
Normal file
135
src/Disp/MenuSections/CreateDOMElements.js
Normal file
@@ -0,0 +1,135 @@
|
||||
/** Section: Functions related to the creation of basic DOM elements page */
|
||||
|
||||
import { ToggleHeader } from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimpleTooltipElements } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the stats page
|
||||
* It is called by CM.Disp.AddMenuStats()
|
||||
* @param {string} config The name of the Config-group
|
||||
* @param {string} text The to-be displayed name of the header
|
||||
* @returns {object} div The header object
|
||||
*/
|
||||
export function StatsHeader(text, config) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'title';
|
||||
div.style.padding = '0px 16px';
|
||||
div.style.opacity = '0.7';
|
||||
div.style.fontSize = '17px';
|
||||
div.style.fontFamily = '"Kavoon", Georgia, serif';
|
||||
div.appendChild(document.createTextNode(`${text} `));
|
||||
const span = document.createElement('span');
|
||||
span.style.cursor = 'pointer';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '14px';
|
||||
span.style.width = '14px';
|
||||
span.style.borderRadius = '7px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates an stats-listing-object for the stats page
|
||||
* It is called by CM.Disp.AddMenuStats()
|
||||
* @param {string} type The type fo the listing
|
||||
* @param {string} name The name of the option
|
||||
* @param {object} text The text-object of the option
|
||||
* @param {string} placeholder The id of the to-be displayed tooltip if applicable
|
||||
* @returns {object} div The option object
|
||||
*/
|
||||
export function StatsListing(type, name, text, placeholder) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
|
||||
const listingName = document.createElement('b');
|
||||
listingName.textContent = name;
|
||||
div.appendChild(listingName);
|
||||
if (type === 'withTooltip') {
|
||||
div.className = 'listing';
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
|
||||
const tooltip = document.createElement('span');
|
||||
tooltip.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
tooltip.onmouseover = function () {
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
escape(SimpleTooltipElements[placeholder].innerHTML),
|
||||
);
|
||||
};
|
||||
tooltip.style.cursor = 'default';
|
||||
tooltip.style.display = 'inline-block';
|
||||
tooltip.style.height = '10px';
|
||||
tooltip.style.width = '10px';
|
||||
tooltip.style.borderRadius = '5px';
|
||||
tooltip.style.textAlign = 'center';
|
||||
tooltip.style.backgroundColor = '#C0C0C0';
|
||||
tooltip.style.color = 'black';
|
||||
tooltip.style.fontSize = '9px';
|
||||
tooltip.style.verticalAlign = 'bottom';
|
||||
tooltip.textContent = '?';
|
||||
div.appendChild(tooltip);
|
||||
}
|
||||
div.appendChild(document.createTextNode(': '));
|
||||
div.appendChild(text);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates a tooltip containing all missing holiday items contained in the list theMissDisp
|
||||
* @param {list} theMissDisp A list of the missing holiday items
|
||||
* @returns {object} frag The tooltip object
|
||||
*/
|
||||
export function StatsMissDisp(theMissDisp) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(document.createTextNode(`${theMissDisp.length} `));
|
||||
const span = document.createElement('span');
|
||||
span.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
const placeholder = document.createElement('div');
|
||||
const missing = document.createElement('div');
|
||||
missing.style.minWidth = '140px';
|
||||
missing.style.marginBottom = '4px';
|
||||
const title = document.createElement('div');
|
||||
title.className = 'name';
|
||||
title.style.marginBottom = '4px';
|
||||
title.style.textAlign = 'center';
|
||||
title.textContent = 'Missing';
|
||||
missing.appendChild(title);
|
||||
Object.keys(theMissDisp).forEach((i) => {
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'center';
|
||||
div.appendChild(document.createTextNode(theMissDisp[i]));
|
||||
missing.appendChild(div);
|
||||
});
|
||||
placeholder.appendChild(missing);
|
||||
span.onmouseover = function () {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
};
|
||||
span.style.cursor = 'default';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '10px';
|
||||
span.style.width = '10px';
|
||||
span.style.borderRadius = '5px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '9px';
|
||||
span.style.verticalAlign = 'bottom';
|
||||
span.textContent = '?';
|
||||
frag.appendChild(span);
|
||||
return frag;
|
||||
}
|
||||
111
src/Disp/MenuSections/CreateMissingUpgrades.js
Normal file
111
src/Disp/MenuSections/CreateMissingUpgrades.js
Normal file
@@ -0,0 +1,111 @@
|
||||
/** Functions related to displaying the missing upgrades in the Statistics page */
|
||||
|
||||
import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
CacheMissingUpgradesPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
||||
*/
|
||||
export function AddMissingUpgrades() {
|
||||
l('menu').childNodes.forEach((menuSection) => {
|
||||
if (menuSection.children[0]) {
|
||||
if (
|
||||
menuSection.children[0].innerHTML === 'Prestige' &&
|
||||
CacheMissingUpgradesPrestige
|
||||
) {
|
||||
const prestigeUpgradesMissing =
|
||||
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || [])
|
||||
.length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesPrestigeTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${
|
||||
Game.PrestigeUpgrades.length
|
||||
} (${Math.floor(
|
||||
(prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.appendChild(title);
|
||||
const upgrades = document.createElement('div');
|
||||
upgrades.className = 'listing crateBox';
|
||||
upgrades.innerHTML = CacheMissingUpgradesPrestige;
|
||||
menuSection.appendChild(upgrades);
|
||||
} else if (menuSection.children[0].innerHTML === 'Upgrades') {
|
||||
if (CacheMissingUpgrades) {
|
||||
const normalUpgradesMissing =
|
||||
CacheMissingUpgrades.match(new RegExp('div', 'g') || []).length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing normal upgrades:</b> ${normalUpgradesMissing}/${
|
||||
Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length
|
||||
} (${Math.floor(
|
||||
(normalUpgradesMissing /
|
||||
(Game.UpgradesByPool[''].length +
|
||||
Game.UpgradesByPool.tech.length)) *
|
||||
100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.insertBefore(title, menuSection.childNodes[3]);
|
||||
const upgrades = document.createElement('div');
|
||||
upgrades.className = 'listing crateBox';
|
||||
upgrades.innerHTML = CacheMissingUpgrades;
|
||||
menuSection.insertBefore(
|
||||
upgrades,
|
||||
document.getElementById('CMMissingUpgradesTitle').nextSibling,
|
||||
);
|
||||
}
|
||||
if (CacheMissingUpgradesCookies) {
|
||||
const cookieUpgradesMissing =
|
||||
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || [])
|
||||
.length / 2;
|
||||
const title = document.createElement('div');
|
||||
title.id = 'CMMissingUpgradesCookiesTitle';
|
||||
title.className = 'listing';
|
||||
const titlefrag = document.createElement('div');
|
||||
titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${
|
||||
Game.UpgradesByPool.cookie.length
|
||||
} (${Math.floor(
|
||||
(cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100,
|
||||
)}%)`;
|
||||
title.appendChild(titlefrag);
|
||||
menuSection.appendChild(title);
|
||||
const upgrades = document.createElement('div');
|
||||
upgrades.className = 'listing crateBox';
|
||||
upgrades.innerHTML = CacheMissingUpgradesCookies;
|
||||
menuSection.appendChild(upgrades);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns the "crates" (icons) for missing upgrades in the stats sections
|
||||
* It returns a html string that gets appended to the respective CM.Cache.MissingUpgrades-variable by CM.Cache.CacheMissingUpgrades()
|
||||
* @param {object} me The upgrade object
|
||||
* @returns {string} ? The HTML string that creates the icon.
|
||||
*/
|
||||
export function crateMissing(me) {
|
||||
let classes = 'crate upgrade missing';
|
||||
if (me.pool === 'prestige') classes += ' heavenly';
|
||||
|
||||
let noFrame = 0;
|
||||
if (!Game.prefs.crates) noFrame = 1;
|
||||
if (noFrame) classes += ' noFrame';
|
||||
|
||||
let { icon } = me;
|
||||
if (me.iconFunction) icon = me.iconFunction();
|
||||
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
|
||||
return `<div class="${classes}"
|
||||
${Game.getDynamicTooltip(tooltip, 'top', true)}
|
||||
style = "${`${
|
||||
icon[2] ? `background-image: url(${icon[2]});` : ''
|
||||
}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`};">
|
||||
</div>`;
|
||||
}
|
||||
988
src/Disp/MenuSections/CreateStatsSections.js
Normal file
988
src/Disp/MenuSections/CreateStatsSections.js
Normal file
@@ -0,0 +1,988 @@
|
||||
/** Functions to create the individual sections of the Statistics page */
|
||||
|
||||
import * as GameData from '../../Data/Gamedata';
|
||||
import { MaxChainCookieReward } from '../../Cache/Stats/ChainCookies';
|
||||
import {
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheCentEgg,
|
||||
CacheChainFrenzyMaxReward,
|
||||
CacheChainFrenzyRequired,
|
||||
CacheChainFrenzyRequiredNext,
|
||||
CacheChainFrenzyWrathRequired,
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
CacheChainMaxReward,
|
||||
CacheChainRequired,
|
||||
CacheChainRequiredNext,
|
||||
CacheChainWrathMaxReward,
|
||||
CacheChainWrathRequired,
|
||||
CacheChainWrathRequiredNext,
|
||||
CacheConjure,
|
||||
CacheConjureReward,
|
||||
CacheDragonsFortuneMultAdjustment,
|
||||
CacheEdifice,
|
||||
CacheEdificeBuilding,
|
||||
CacheGoldenCookiesMult,
|
||||
CacheHCPerSecond,
|
||||
CacheLastChoEgg,
|
||||
CacheLucky,
|
||||
CacheLuckyFrenzy,
|
||||
CacheLuckyReward,
|
||||
CacheLuckyRewardFrenzy,
|
||||
CacheLuckyWrathReward,
|
||||
CacheLuckyWrathRewardFrenzy,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheRealCookiesEarned,
|
||||
CacheSeaSpec,
|
||||
CacheWrathCookiesMult,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import ResetBonus from '../../Sim/SimulationEvents/ResetAscension';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGreen, ColorRed, ColorTextPre } from '../VariablesAndData';
|
||||
import { StatsListing, StatsHeader, StatsMissDisp } from './CreateDOMElements';
|
||||
|
||||
/**
|
||||
* This function creates the "Lucky" section of the stats page
|
||||
* @returns {object} section The object contating the Lucky section
|
||||
*/
|
||||
export function LuckySection() {
|
||||
// This sets which tooltip to display for certain stats
|
||||
const goldCookTooltip = Game.auraMult("Dragon's Fortune")
|
||||
? 'GoldCookDragonsFortuneTooltipPlaceholder'
|
||||
: 'GoldCookTooltipPlaceholder';
|
||||
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsLuckySection';
|
||||
|
||||
const luckyColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColorRed : ColorGreen;
|
||||
const luckyTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky
|
||||
? FormatTime(
|
||||
(CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const luckyReqFrag = document.createDocumentFragment();
|
||||
const luckyReqSpan = document.createElement('span');
|
||||
luckyReqSpan.style.fontWeight = 'bold';
|
||||
luckyReqSpan.className = ColorTextPre + luckyColor;
|
||||
luckyReqSpan.textContent = Beautify(CacheLucky);
|
||||
luckyReqFrag.appendChild(luckyReqSpan);
|
||||
if (luckyTime !== '') {
|
||||
const luckyReqSmall = document.createElement('small');
|
||||
luckyReqSmall.textContent = ` (${luckyTime})`;
|
||||
luckyReqFrag.appendChild(luckyReqSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required',
|
||||
luckyReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const luckyTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? FormatTime(
|
||||
(CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const luckyReqFrenFrag = document.createDocumentFragment();
|
||||
const luckyReqFrenSpan = document.createElement('span');
|
||||
luckyReqFrenSpan.style.fontWeight = 'bold';
|
||||
luckyReqFrenSpan.className = ColorTextPre + luckyColorFrenzy;
|
||||
luckyReqFrenSpan.textContent = Beautify(CacheLuckyFrenzy);
|
||||
luckyReqFrenFrag.appendChild(luckyReqFrenSpan);
|
||||
if (luckyTimeFrenzy !== '') {
|
||||
const luckyReqFrenSmall = document.createElement('small');
|
||||
luckyReqFrenSmall.textContent = ` (${luckyTimeFrenzy})`;
|
||||
luckyReqFrenFrag.appendChild(luckyReqFrenSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required (Frenzy)',
|
||||
luckyReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckySplit = CacheLuckyReward !== CacheLuckyWrathReward;
|
||||
|
||||
const luckyRewardMaxSpan = document.createElement('span');
|
||||
luckyRewardMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardMaxSpan.className = ColorTextPre + CacheLuckyReward;
|
||||
luckyRewardMaxSpan.textContent =
|
||||
Beautify(CacheLuckyReward) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyRewardMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyRewardFrenzyMaxSpan = document.createElement('span');
|
||||
luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardFrenzyMaxSpan.className = ColorTextPre + luckyRewardFrenzyMaxSpan;
|
||||
luckyRewardFrenzyMaxSpan.textContent =
|
||||
Beautify(CacheLuckyRewardFrenzy) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathRewardFrenzy)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX) (Frenzy)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyRewardFrenzyMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyCurBase =
|
||||
Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * CacheDragonsFortuneMultAdjustment * 60 * 15,
|
||||
) + 13;
|
||||
const luckyCurSpan = document.createElement('span');
|
||||
luckyCurSpan.style.fontWeight = 'bold';
|
||||
luckyCurSpan.className = ColorTextPre + luckyCurSpan;
|
||||
luckyCurSpan.textContent =
|
||||
Beautify(CacheGoldenCookiesMult * luckyCurBase) +
|
||||
(luckySplit ? ` / ${Beautify(CacheWrathCookiesMult * luckyCurBase)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (CUR)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
luckyCurSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Chain" section of the stats page
|
||||
* @returns {object} section The object contating the Chain section
|
||||
*/
|
||||
export function ChainSection() {
|
||||
// This sets which tooltip to display for certain stats
|
||||
const goldCookTooltip = Game.auraMult("Dragon's Fortune")
|
||||
? 'GoldCookDragonsFortuneTooltipPlaceholder'
|
||||
: 'GoldCookTooltipPlaceholder';
|
||||
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsChainSection';
|
||||
|
||||
const chainColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? FormatTime(
|
||||
(CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainReqFrag = document.createDocumentFragment();
|
||||
const chainReqSpan = document.createElement('span');
|
||||
chainReqSpan.style.fontWeight = 'bold';
|
||||
chainReqSpan.className = ColorTextPre + chainColor;
|
||||
chainReqSpan.textContent = Beautify(CacheChainRequired);
|
||||
chainReqFrag.appendChild(chainReqSpan);
|
||||
if (chainTime !== '') {
|
||||
const chainReqSmall = document.createElement('small');
|
||||
chainReqSmall.textContent = ` (${chainTime})`;
|
||||
chainReqFrag.appendChild(chainReqSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required',
|
||||
chainReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainWrathTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? FormatTime(
|
||||
(CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainWrathReqFrag = document.createDocumentFragment();
|
||||
const chainWrathReqSpan = document.createElement('span');
|
||||
chainWrathReqSpan.style.fontWeight = 'bold';
|
||||
chainWrathReqSpan.className = ColorTextPre + chainWrathColor;
|
||||
chainWrathReqSpan.textContent = Beautify(CacheChainWrathRequired);
|
||||
chainWrathReqFrag.appendChild(chainWrathReqSpan);
|
||||
if (chainWrathTime !== '') {
|
||||
const chainWrathReqSmall = document.createElement('small');
|
||||
chainWrathReqSmall.textContent = ` (${chainWrathTime})`;
|
||||
chainWrathReqFrag.appendChild(chainWrathReqSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Wrath)',
|
||||
chainWrathReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? FormatTime(
|
||||
(CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainReqFrenFrag = document.createDocumentFragment();
|
||||
const chainReqFrenSpan = document.createElement('span');
|
||||
chainReqFrenSpan.style.fontWeight = 'bold';
|
||||
chainReqFrenSpan.className = ColorTextPre + chainColorFrenzy;
|
||||
chainReqFrenSpan.textContent = Beautify(CacheChainFrenzyRequired);
|
||||
chainReqFrenFrag.appendChild(chainReqFrenSpan);
|
||||
if (chainTimeFrenzy !== '') {
|
||||
const chainReqFrenSmall = document.createElement('small');
|
||||
chainReqFrenSmall.textContent = ` (${chainTimeFrenzy})`;
|
||||
chainReqFrenFrag.appendChild(chainReqFrenSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy)',
|
||||
chainReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColorFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const chainWrathTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? FormatTime(
|
||||
(CacheChainFrenzyWrathRequired -
|
||||
(Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
)
|
||||
: '';
|
||||
const chainWrathReqFrenFrag = document.createDocumentFragment();
|
||||
const chainWrathReqFrenSpan = document.createElement('span');
|
||||
chainWrathReqFrenSpan.style.fontWeight = 'bold';
|
||||
chainWrathReqFrenSpan.className = ColorTextPre + chainWrathColorFrenzy;
|
||||
chainWrathReqFrenSpan.textContent = Beautify(CacheChainFrenzyWrathRequired);
|
||||
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSpan);
|
||||
if (chainWrathTimeFrenzy !== '') {
|
||||
const chainWrathReqFrenSmall = document.createElement('small');
|
||||
chainWrathReqFrenSmall.textContent = ` (${chainWrathTimeFrenzy})`;
|
||||
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy) (Wrath)',
|
||||
chainWrathReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainMaxReward[0])} / ${Beautify(
|
||||
CacheChainWrathMaxReward[0],
|
||||
)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(
|
||||
CacheChainFrenzyMaxReward[0],
|
||||
)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainCurMax = Math.min(
|
||||
Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment,
|
||||
Game.cookies * 0.5,
|
||||
);
|
||||
const chainCur = MaxChainCookieReward(
|
||||
7,
|
||||
chainCurMax,
|
||||
CacheGoldenCookiesMult,
|
||||
)[0];
|
||||
const chainCurWrath = MaxChainCookieReward(
|
||||
6,
|
||||
chainCurMax,
|
||||
CacheWrathCookiesMult,
|
||||
)[0];
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (CUR) (Golden / Wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`,
|
||||
),
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (G / W)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainRequiredNext)} / ${Beautify(
|
||||
CacheChainWrathRequiredNext,
|
||||
)}`,
|
||||
),
|
||||
'ChainNextLevelPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (Frenzy) (G / W)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyRequiredNext)} / ${Beautify(
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
)}`,
|
||||
),
|
||||
'ChainNextLevelPlaceholder',
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Spells" section of the stats page
|
||||
* @returns {object} section The object contating the Spells section
|
||||
*/
|
||||
export function SpellsSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsSpellsSection';
|
||||
|
||||
const conjureColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure ? ColorRed : ColorGreen;
|
||||
const conjureTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure
|
||||
? FormatTime(
|
||||
(CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
|
||||
const conjureReqFrag = document.createDocumentFragment();
|
||||
const conjureReqSpan = document.createElement('span');
|
||||
conjureReqSpan.style.fontWeight = 'bold';
|
||||
conjureReqSpan.className = ColorTextPre + conjureColor;
|
||||
conjureReqSpan.textContent = Beautify(CacheConjure);
|
||||
conjureReqFrag.appendChild(conjureReqSpan);
|
||||
if (conjureTime !== '') {
|
||||
const conjureReqSmall = document.createElement('small');
|
||||
conjureReqSmall.textContent = ` (${conjureTime})`;
|
||||
conjureReqFrag.appendChild(conjureReqSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required',
|
||||
conjureReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX)',
|
||||
document.createTextNode(Beautify(CacheConjureReward)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const conjureFrenzyColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
const conjureFrenzyCur = Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
||||
);
|
||||
const conjureFrenzyTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
|
||||
? FormatTime(
|
||||
(CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
)
|
||||
: '';
|
||||
|
||||
const conjureFrenzyReqFrag = document.createDocumentFragment();
|
||||
const conjureFrenzyReqSpan = document.createElement('span');
|
||||
conjureFrenzyReqSpan.style.fontWeight = 'bold';
|
||||
conjureFrenzyReqSpan.className = ColorTextPre + conjureFrenzyColor;
|
||||
conjureFrenzyReqSpan.textContent = Beautify(CacheConjure * 7);
|
||||
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan);
|
||||
if (conjureFrenzyTime !== '') {
|
||||
const conjureFrenzyReqSmall = document.createElement('small');
|
||||
conjureFrenzyReqSmall.textContent = ` (${conjureFrenzyTime})`;
|
||||
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required (Frenzy)',
|
||||
conjureFrenzyReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX) (Frenzy)',
|
||||
document.createTextNode(Beautify(CacheConjureReward * 7)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (CUR)',
|
||||
document.createTextNode(Beautify(conjureFrenzyCur)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
if (CacheEdifice) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Spontaneous Edifice" Cookies Required (most expensive building)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`,
|
||||
),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Garden" section of the stats page
|
||||
* @returns {object} section The object contating the Spells section
|
||||
*/
|
||||
export function GardenSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsGardenSection';
|
||||
|
||||
const bakeberryColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColorRed : ColorGreen;
|
||||
const bakeberryFrag = document.createElement('span');
|
||||
bakeberryFrag.style.fontWeight = 'bold';
|
||||
bakeberryFrag.className = ColorTextPre + bakeberryColor;
|
||||
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Bakeberry: ',
|
||||
bakeberryFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const chocorootColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 100 ? ColorRed : ColorGreen;
|
||||
const chocorootFrag = document.createElement('span');
|
||||
chocorootFrag.style.fontWeight = 'bold';
|
||||
chocorootFrag.className = ColorTextPre + chocorootColor;
|
||||
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Chocoroot: ',
|
||||
chocorootFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const queenbeetColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColorRed : ColorGreen;
|
||||
const queenbeetFrag = document.createElement('span');
|
||||
queenbeetFrag.style.fontWeight = 'bold';
|
||||
queenbeetFrag.className = ColorTextPre + queenbeetColor;
|
||||
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Queenbeet: ',
|
||||
queenbeetFrag,
|
||||
),
|
||||
);
|
||||
|
||||
const duketaterColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColorRed : ColorGreen;
|
||||
const duketaterFrag = document.createElement('span');
|
||||
duketaterFrag.style.fontWeight = 'bold';
|
||||
duketaterFrag.className = ColorTextPre + duketaterColor;
|
||||
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Cookies required for max reward of Duketater: ',
|
||||
duketaterFrag,
|
||||
),
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Prestige" section of the stats page
|
||||
* @returns {object} section The object contating the Prestige section
|
||||
*/
|
||||
export function PrestigeSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsPrestigeSection';
|
||||
|
||||
const possiblePresMax = Math.floor(
|
||||
Game.HowMuchPrestige(
|
||||
CacheRealCookiesEarned +
|
||||
Game.cookiesReset +
|
||||
CacheWrinklersTotal +
|
||||
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
|
||||
? CacheLastChoEgg
|
||||
: 0),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Prestige Level (CUR / MAX)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`,
|
||||
),
|
||||
'PrestMaxTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const neededCook = Math.max(
|
||||
0,
|
||||
Game.HowManyCookiesReset(possiblePresMax + 1) -
|
||||
(CacheRealCookiesEarned +
|
||||
Game.cookiesReset +
|
||||
CacheWrinklersTotal +
|
||||
((
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
|
||||
? CacheLastChoEgg
|
||||
: 0
|
||||
)
|
||||
? CacheLastChoEgg
|
||||
: 0)),
|
||||
);
|
||||
const cookiesNextFrag = document.createDocumentFragment();
|
||||
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
|
||||
const cookiesNextSmall = document.createElement('small');
|
||||
cookiesNextSmall.textContent = ` (${FormatTime(
|
||||
neededCook / CacheAvgCPSWithChoEgg,
|
||||
1,
|
||||
)})`;
|
||||
cookiesNextFrag.appendChild(cookiesNextSmall);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Cookies To Next Level',
|
||||
cookiesNextFrag,
|
||||
'NextPrestTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Heavenly Chips (CUR / MAX)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.heavenlyChips)} / ${Beautify(
|
||||
possiblePresMax - Game.prestige + Game.heavenlyChips,
|
||||
)}`,
|
||||
),
|
||||
'HeavenChipMaxTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips Per Second (last 5 seconds)',
|
||||
document.createTextNode(Beautify(CacheHCPerSecond, 2)),
|
||||
),
|
||||
);
|
||||
|
||||
const HCTarget = Number(CMOptions.HeavenlyChipsTarget);
|
||||
if (!Number.isNaN(HCTarget)) {
|
||||
const CookiesTillTarget =
|
||||
HCTarget -
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
if (CookiesTillTarget > 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips To Target Set In Settings (CUR)',
|
||||
document.createTextNode(Beautify(CookiesTillTarget)),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Time To Target (CUR, Current 5 Second Average)',
|
||||
document.createTextNode(
|
||||
FormatTime(CookiesTillTarget / CacheHCPerSecond),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const resetBonus = ResetBonus(possiblePresMax);
|
||||
const resetFrag = document.createDocumentFragment();
|
||||
resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));
|
||||
const increase = Math.round((resetBonus / Game.cookiesPs) * 10000);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
const resetSmall = document.createElement('small');
|
||||
resetSmall.textContent = ` (${increase / 100}% of income)`;
|
||||
resetFrag.appendChild(resetSmall);
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Reset Bonus Income',
|
||||
resetFrag,
|
||||
'ResetTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
||||
const willHave = Math.floor(
|
||||
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
|
||||
);
|
||||
const willGet = willHave - currentPrestige;
|
||||
if (!Game.Has('Lucky digit')) {
|
||||
let delta7 = 7 - (willHave % 10);
|
||||
if (delta7 < 0) delta7 += 10;
|
||||
const next7Reset = willGet + delta7;
|
||||
const next7Total = willHave + delta7;
|
||||
const frag7 = document.createDocumentFragment();
|
||||
frag7.appendChild(
|
||||
document.createTextNode(
|
||||
`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7),
|
||||
);
|
||||
}
|
||||
|
||||
if (!Game.Has('Lucky number')) {
|
||||
let delta777 = 777 - (willHave % 1000);
|
||||
if (delta777 < 0) delta777 += 1000;
|
||||
const next777Reset = willGet + delta777;
|
||||
const next777Total = willHave + delta777;
|
||||
const frag777 = document.createDocumentFragment();
|
||||
frag777.appendChild(
|
||||
document.createTextNode(
|
||||
`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777),
|
||||
);
|
||||
}
|
||||
|
||||
if (!Game.Has('Lucky payout')) {
|
||||
let delta777777 = 777777 - (willHave % 1000000);
|
||||
if (delta777777 < 0) delta777777 += 1000000;
|
||||
const next777777Reset = willGet + delta777777;
|
||||
const next777777Total = willHave + delta777777;
|
||||
const frag777777 = document.createDocumentFragment();
|
||||
frag777777.appendChild(
|
||||
document.createTextNode(
|
||||
`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`,
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777),
|
||||
);
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the "Season Specials" section of the stats page
|
||||
* @returns {object} section The object contating the Season Specials section
|
||||
*/
|
||||
export function SeasonSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsSeasonSection';
|
||||
|
||||
let specDisp = false;
|
||||
const missingHalloweenCookies = [];
|
||||
Object.keys(GameData.HalloCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.HalloCookies[i])) {
|
||||
missingHalloweenCookies.push(GameData.HalloCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingChristmasCookies = [];
|
||||
Object.keys(GameData.ChristCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ChristCookies[i])) {
|
||||
missingChristmasCookies.push(GameData.ChristCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingValentineCookies = [];
|
||||
Object.keys(GameData.ValCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ValCookies[i])) {
|
||||
missingValentineCookies.push(GameData.ValCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingNormalEggs = [];
|
||||
Object.keys(Game.eggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.eggDrops[i])) {
|
||||
missingNormalEggs.push(Game.eggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingRareEggs = [];
|
||||
Object.keys(Game.rareEggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
|
||||
missingRareEggs.push(Game.rareEggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingPlantDrops = [];
|
||||
Object.keys(GameData.PlantDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
|
||||
missingPlantDrops.push(GameData.PlantDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const choEgg =
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
const centEgg = Game.Has('Century egg');
|
||||
|
||||
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
|
||||
section.appendChild(StatsHeader('Season Specials', 'Sea'));
|
||||
if (CMOptions.Header.Sea) {
|
||||
if (missingHalloweenCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Halloween cookies left to buy',
|
||||
StatsMissDisp(missingHalloweenCookies),
|
||||
),
|
||||
);
|
||||
let failRateHalloween = 0.95;
|
||||
if (Game.HasAchiev('Spooky cookies')) failRateHalloween = 0.8;
|
||||
if (Game.Has('Starterror')) failRateHalloween *= 0.9;
|
||||
failRateHalloween *= 1 / Game.dropRateMult();
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateHalloween *= 0.9;
|
||||
else if (godLvl === 2) failRateHalloween *= 0.95;
|
||||
else if (godLvl === 3) failRateHalloween *= 0.97;
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from wrinkler/shiny wrinkler',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateHalloween) * 100)}% / ${Beautify(
|
||||
(1 - failRateHalloween * 0.9) * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingChristmasCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Christmas cookies left to buy',
|
||||
StatsMissDisp(missingChristmasCookies),
|
||||
),
|
||||
);
|
||||
let failRateChristmas = 0.8;
|
||||
if (Game.HasAchiev('Let it snow')) failRateChristmas = 0.6;
|
||||
failRateChristmas *= 1 / Game.dropRateMult();
|
||||
if (Game.Has('Starsnow')) failRateChristmas *= 0.95;
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateChristmas *= 0.9;
|
||||
else if (godLvl === 2) failRateChristmas *= 0.95;
|
||||
else if (godLvl === 3) failRateChristmas *= 0.97;
|
||||
}
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from reindeer',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateChristmas) * 100)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingValentineCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Valentine cookies left to buy',
|
||||
StatsMissDisp(missingValentineCookies),
|
||||
),
|
||||
);
|
||||
}
|
||||
const dropRateEgg = function (StartingFailRate) {
|
||||
let failRateEgg = StartingFailRate * (1 / Game.dropRateMult());
|
||||
if (Game.HasAchiev('Hide & seek champion')) failRateEgg *= 0.7;
|
||||
if (Game.Has('Omelette')) failRateEgg *= 0.9;
|
||||
if (Game.Has('Starspawn')) failRateEgg *= 0.9;
|
||||
if (Game.hasGod) {
|
||||
const godLvl = Game.hasGod('seasons');
|
||||
if (godLvl === 1) failRateEgg *= 0.9;
|
||||
else if (godLvl === 2) failRateEgg *= 0.95;
|
||||
else if (godLvl === 3) failRateEgg *= 0.97;
|
||||
}
|
||||
// Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25
|
||||
const succesRateEgg = 1 - failRateEgg;
|
||||
const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length;
|
||||
const obtainedRareEggs =
|
||||
Game.rareEggDrops.length - missingRareEggs.length;
|
||||
const pNormal1 =
|
||||
succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
|
||||
const pRare1 =
|
||||
succesRateEgg *
|
||||
0.1 *
|
||||
(1 - obtainedRareEggs / Game.rareEggDrops.length);
|
||||
const pRedropNormal =
|
||||
succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
|
||||
const pRedropRare =
|
||||
succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
|
||||
const pRedrop = pRedropNormal + pRedropRare;
|
||||
const pNormal2 =
|
||||
pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
|
||||
const pRare2 =
|
||||
pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
|
||||
return [pNormal1 + pNormal2, pRare1 + pRare2];
|
||||
};
|
||||
if (missingNormalEggs.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Normal easter eggs left to unlock',
|
||||
StatsMissDisp(missingNormalEggs),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving an egg from wrinkler/golden cookie',
|
||||
document.createTextNode(
|
||||
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(
|
||||
dropRateEgg(0.9)[0] * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingRareEggs.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare easter eggs left to unlock',
|
||||
StatsMissDisp(missingRareEggs),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a rare egg from wrinkler/golden cookie',
|
||||
document.createTextNode(
|
||||
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(
|
||||
dropRateEgg(0.9)[1] * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingPlantDrops.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare plant drops left to unlock',
|
||||
StatsMissDisp(missingPlantDrops),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (Game.season === 'christmas')
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Reindeer reward',
|
||||
document.createTextNode(Beautify(CacheSeaSpec)),
|
||||
),
|
||||
);
|
||||
if (choEgg) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Chocolate egg cookies',
|
||||
document.createTextNode(Beautify(CacheLastChoEgg)),
|
||||
'ChoEggTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
}
|
||||
if (centEgg) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Century egg multiplier',
|
||||
document.createTextNode(
|
||||
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return section;
|
||||
}
|
||||
45
src/Disp/MenuSections/InfoPage.js
Normal file
45
src/Disp/MenuSections/InfoPage.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/** Functions related to the Stats page */
|
||||
|
||||
import { ToggleHeader } from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { LatestReleaseNotes, ModDescription } from '../../Data/Moddata';
|
||||
|
||||
/**
|
||||
* This function adds stats created by CookieMonster to the stats page
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuInfo(title) {
|
||||
const info = document.createElement('div');
|
||||
info.className = 'subsection';
|
||||
|
||||
const span = document.createElement('span');
|
||||
span.style.cursor = 'pointer';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '14px';
|
||||
span.style.width = '14px';
|
||||
span.style.borderRadius = '7px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header.InfoTab ? '-' : '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader('InfoTab');
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
title.appendChild(span);
|
||||
info.appendChild(title);
|
||||
|
||||
if (CMOptions.Header.InfoTab) {
|
||||
const description = document.createElement('div');
|
||||
description.innerHTML = ModDescription;
|
||||
info.appendChild(description);
|
||||
const notes = document.createElement('div');
|
||||
notes.innerHTML = LatestReleaseNotes;
|
||||
info.appendChild(notes);
|
||||
}
|
||||
|
||||
const menu = l('menu').children[1];
|
||||
menu.insertBefore(info, menu.children[1]);
|
||||
}
|
||||
15
src/Disp/MenuSections/Refreshmenu.js
Normal file
15
src/Disp/MenuSections/Refreshmenu.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens
|
||||
* It is called by CM.Disp.Draw()
|
||||
*/
|
||||
export default function RefreshMenu() {
|
||||
if (
|
||||
CMOptions.UpStats &&
|
||||
Game.onMenu === 'stats' &&
|
||||
(Game.drawT - 1) % (Game.fps * 5) !== 0 &&
|
||||
(Game.drawT - 1) % Game.fps === 0
|
||||
)
|
||||
Game.UpdateMenu();
|
||||
}
|
||||
281
src/Disp/MenuSections/SettingsPage.js
Normal file
281
src/Disp/MenuSections/SettingsPage.js
Normal file
@@ -0,0 +1,281 @@
|
||||
/** Functions related to the Options/Preferences page */
|
||||
|
||||
import jscolor, * as JsColor from '@eastdesire/jscolor';
|
||||
import {
|
||||
LoadConfig,
|
||||
SaveConfig,
|
||||
} from '../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import {
|
||||
ConfigPrefix,
|
||||
ToggleConfig,
|
||||
ToggleConfigVolume,
|
||||
ToggleHeader,
|
||||
} from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ConfigGroups,
|
||||
ConfigGroupsNotification,
|
||||
} from '../../Data/Sectionheaders';
|
||||
import Config from '../../Data/SettingsData';
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import RefreshScale from '../HelperFunctions/RefreshScale';
|
||||
import UpdateColors from '../HelperFunctions/UpdateColors';
|
||||
import PlaySound from '../Notifications/Sound';
|
||||
import { Colors } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the options page
|
||||
* @param {string} config The name of the Config-group
|
||||
* @param {string} text The to-be displayed name of the header
|
||||
* @returns {object} div The header object
|
||||
*/
|
||||
function CreatePrefHeader(config, text) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'title';
|
||||
|
||||
div.style.opacity = '0.7';
|
||||
div.style.fontSize = '17px';
|
||||
div.appendChild(document.createTextNode(`${text} `));
|
||||
const span = document.createElement('span'); // Creates the +/- button
|
||||
span.style.cursor = 'pointer';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '14px';
|
||||
span.style.width = '14px';
|
||||
span.style.borderRadius = '7px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates an option-object for the options page
|
||||
* @param {string} config The name of the option
|
||||
* @returns {object} div The option object
|
||||
*/
|
||||
function CreatePrefOption(config) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
if (Config[config].type === 'bool') {
|
||||
const a = document.createElement('a');
|
||||
if (Config[config].toggle && CMOptions[config] === 0) {
|
||||
a.className = 'option off';
|
||||
} else {
|
||||
a.className = 'option';
|
||||
}
|
||||
a.id = ConfigPrefix + config;
|
||||
a.onclick = function () {
|
||||
ToggleConfig(config);
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'vol') {
|
||||
const volume = document.createElement('div');
|
||||
volume.className = 'sliderBox';
|
||||
const title = document.createElement('div');
|
||||
title.style.float = 'left';
|
||||
title.innerHTML = Config[config].desc;
|
||||
volume.appendChild(title);
|
||||
const percent = document.createElement('div');
|
||||
percent.id = `slider${config}right`;
|
||||
percent.style.float = 'right';
|
||||
percent.innerHTML = `${CMOptions[config]}%`;
|
||||
volume.appendChild(percent);
|
||||
const slider = document.createElement('input');
|
||||
slider.className = 'slider';
|
||||
slider.id = `slider${config}`;
|
||||
slider.style.clear = 'both';
|
||||
slider.type = 'range';
|
||||
slider.min = '0';
|
||||
slider.max = '100';
|
||||
slider.step = '1';
|
||||
slider.value = CMOptions[config];
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
slider.onchange = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
volume.appendChild(slider);
|
||||
div.appendChild(volume);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
PlaySound(
|
||||
CMOptions[config.replace('Volume', 'SoundURL')],
|
||||
config.replace('Volume', 'Sound'),
|
||||
config,
|
||||
true,
|
||||
);
|
||||
};
|
||||
a.textContent = 'Test sound';
|
||||
div.appendChild(a);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'url') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'text';
|
||||
input.readOnly = true;
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
input.style.width = '300px';
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const inputPrompt = document.createElement('input');
|
||||
inputPrompt.id = `${ConfigPrefix + config}Prompt`;
|
||||
inputPrompt.className = 'option';
|
||||
inputPrompt.type = 'text';
|
||||
inputPrompt.setAttribute('value', CMOptions[config]);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
Game.Prompt(inputPrompt.outerHTML, [
|
||||
[
|
||||
'Save',
|
||||
function () {
|
||||
CMOptions[`${config}`] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||
SaveConfig();
|
||||
Game.ClosePrompt();
|
||||
Game.UpdateMenu();
|
||||
},
|
||||
],
|
||||
'Cancel',
|
||||
]);
|
||||
};
|
||||
a.textContent = 'Edit';
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'color') {
|
||||
div.className = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
const innerDiv = document.createElement('div');
|
||||
innerDiv.className = 'listing';
|
||||
const input = document.createElement('input');
|
||||
input.id = Colors[i];
|
||||
input.style.width = '65px';
|
||||
input.setAttribute('value', CMOptions.Colors[Colors[i]]);
|
||||
innerDiv.appendChild(input);
|
||||
const change = function () {
|
||||
CMOptions.Colors[this.targetElement.id] = this.toHEXString();
|
||||
UpdateColors();
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
// eslint-disable-next-line no-new
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config.Colors.desc[Colors[i]];
|
||||
innerDiv.appendChild(label);
|
||||
div.appendChild(innerDiv);
|
||||
}
|
||||
jscolor.init();
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'numscale') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'number';
|
||||
input.value = CMOptions[config];
|
||||
input.min = Config[config].min;
|
||||
input.max = Config[config].max;
|
||||
input.oninput = function () {
|
||||
if (this.value > this.max) console.log('TEST');
|
||||
CMOptions[config] = this.value;
|
||||
SaveConfig();
|
||||
RefreshScale();
|
||||
};
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds the options/settings of CookieMonster to the options page
|
||||
* It is called by CM.Disp.AddMenu
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuPref(title) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(title);
|
||||
|
||||
Object.keys(ConfigGroups).forEach((group) => {
|
||||
const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group)
|
||||
frag.appendChild(groupObject);
|
||||
if (CMOptions.Header[group]) {
|
||||
// 0 is show, 1 is collapsed
|
||||
// Make sub-sections of Notification section
|
||||
if (group === 'Notification') {
|
||||
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
|
||||
const subGroupObject = CreatePrefHeader(
|
||||
subGroup,
|
||||
ConfigGroupsNotification[subGroup],
|
||||
); // (group, display-name of group)
|
||||
subGroupObject.style.fontSize = '15px';
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const resDef = document.createElement('div');
|
||||
resDef.className = 'listing';
|
||||
const resDefBut = document.createElement('a');
|
||||
resDefBut.className = 'option';
|
||||
resDefBut.onclick = function () {
|
||||
LoadConfig(ConfigDefault);
|
||||
};
|
||||
resDefBut.textContent = 'Restore Default';
|
||||
resDef.appendChild(resDefBut);
|
||||
frag.appendChild(resDef);
|
||||
|
||||
l('menu').childNodes[2].insertBefore(
|
||||
frag,
|
||||
l('menu').childNodes[2].childNodes[
|
||||
l('menu').childNodes[2].childNodes.length - 1
|
||||
],
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user