Merge pull request #605 from Aktanusa/dev (v 2.031.4)

Version 2.031.4
This commit is contained in:
Daniël van Noord
2021-02-24 00:26:25 +01:00
committed by GitHub
19 changed files with 7457 additions and 8671 deletions

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
CookieMonster.js
CookieMonster.user.js

50
.eslintrc.js Normal file
View File

@@ -0,0 +1,50 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
globals: {
module: 'readonly',
Game: 'writable',
l: 'readonly',
b64_to_utf8: 'readonly',
utf8_to_b64: 'readonly',
Beautify: 'writable',
realAudio: 'readonly',
JSColor: 'readonly',
jscolor: 'readonly',
BeautifyAll: 'readonly',
CM: 'writable',
unsafeWindow: 'readonly',
},
extends: 'airbnb-base',
parserOptions: {
ecmaVersion: 12,
},
rules: {
indent: ['error', 'tab'],
'no-tabs': 'off',
'max-len': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-new-func': 'off',
'no-eval': 'off',
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-mixed-operators': 'off',
'prefer-destructuring': 'off',
'func-names': 'off',
'no-use-before-define': 'off',
'no-console': 'off',
'no-nested-ternary': 'off',
'object-shorthand': 'off',
'no-else-return': 'off',
'prefer-arrow-callback': 'off',
'no-new': 'off',
'no-alert': 'off',
'new-cap': 'off',
'no-restricted-globals': 'off',
'no-template-curly-in-string': 'off',
radix: 'off',
},
};

25
.github/workflows/CI.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: CI
on: [push, pull_request]
jobs:
Check_ESLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ESLint
run: |
npm install
npx eslint src
Check_main_file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check if CookieMonster.js is built correctly
run: |
npm install
npx terser ./src/Header.js ./src/Cache.js ./src/Config.js ./src/Data.js ./src/Disp.js ./src/Main.js ./src/Sim.js ./src/Footer.js -o CookieMonsterTest.js
if cmp CookieMonster.js CookieMonsterTest.js; then
echo '### SUCCESS: CookieMonster is correctly built! ###'
else
echo '### WARNING: CookieMonster.js does not seem to be correct. Make sure to run "npm run build" after saving all your changes! ###'
exit 1
fi

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

View File

@@ -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

View File

@@ -1,2 +0,0 @@
#!/bin/sh
cat ./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

File diff suppressed because one or more lines are too long

19
CookieMonster.user.js Normal file
View 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);

View File

@@ -1,3 +1,4 @@
![ESLint](https://github.com/Aktanusa/CookieMonster/workflows/ESLint/badge.svg?event=push)
## 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.
@@ -50,27 +51,7 @@ If (for some reason) the above doesn't work, trying pasting everything after the
### 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.
```javascript
// ==UserScript==
// @name Cookie Monster
// @namespace Cookie
// @include http://orteil.dashnet.org/cookieclicker/
// @include https://orteil.dashnet.org/cookieclicker/
// @version 1
// @grant none
// ==/UserScript==
(function() {
const checkReady = setInterval(function() {
if (typeof Game.ready !== 'undefined' && Game.ready) {
Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonster.js');
clearInterval(checkReady);
}
}, 1000);
})();
```
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".
## Bugs and suggestions
@@ -82,6 +63,12 @@ If the bug is still here, you can submit an issue for it. Please do so by using
All suggestions are welcome, even the smallest ones.
## Contributing
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

3616
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

53
package.json Normal file
View File

@@ -0,0 +1,53 @@
{
"name": "cookiemonster-mod",
"version": "2.031.4",
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
"main": "CookieMonster.js",
"keywords": [
"Cookie Clicker",
"javascript",
"mod",
"Dashnet",
"Orteil"
],
"scripts": {
"build": "npx eslint src && terser ./src/Header.js ./src/Cache.js ./src/Config.js ./src/Data.js ./src/Disp.js ./src/Main.js ./src/Sim.js ./src/Footer.js -o CookieMonster.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Aktanusa/CookieMonster.git"
},
"license": "MIT",
"author": {
"name": "Aktanusa",
"email": "chanam.geo@yahoo.com"
},
"contributors": [
{
"name": "Daniël van Noord",
"email": "13665637+DanielNoord@users.noreply.github.com"
},
{
"name": "Aran Leite",
"email": "hyoretsu@gmail.com",
"url": "https://www.linkedin.com/in/aranleite"
}
],
"bugs": {
"url": "https://github.com/Aktanusa/CookieMonster/issues"
},
"homepage": "https://github.com/Aktanusa/CookieMonster#readme",
"devDependencies": {
"eslint": "^7.19.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"terser": "^5.6.0-beta"
},
"ccrepo": {
"icon": [
10,
0
],
"name": "Cookie Monster"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/**********
/**
* Config *
**********/
*/
/********
/**
* Section: Functions related to saving, loading and restoring configs */
/**
@@ -11,59 +11,53 @@
* It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(),
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
*/
CM.Config.SaveConfig = function() {
let saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]);
CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
if (CookieMonsterSave != null) {
newSaveString = saveString.replace(CookieMonsterSave[0], "CookieMonster:" + CM.save());
localStorage.setItem('CookieClickerGame', escape(utf8_to_b64(newSaveString)+'!END!'))
CM.Config.SaveConfig = function () {
const saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]);
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
if (CookieMonsterSave !== null) {
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${CM.save()}`);
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
}
}
};
/**
* This function loads the config of CookieMonster saved in localStorage and loads it into CM.Options
* It is called by CM.DelayInit() and CM.Config.RestoreDefault()
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
*/
CM.Config.LoadConfig = function(settings) {
CM.Config.LoadConfig = function (settings) {
// This removes cookies left from earlier versions of CookieMonster
if (typeof localStorage.CMConfig != "undefined") {
if (typeof localStorage.CMConfig !== 'undefined') {
delete localStorage.CMConfig;
}
if (settings != null) {
if (settings !== undefined) {
CM.Options = settings;
// Check values
var mod = false;
for (var i in CM.Data.ConfigDefault) {
let mod = false;
for (const i in CM.Data.ConfigDefault) {
if (typeof CM.Options[i] === 'undefined') {
mod = true;
CM.Options[i] = CM.Data.ConfigDefault[i];
}
else if (i != 'Header' && i != 'Colors') {
if (i.indexOf('SoundURL') == -1) {
if (!(CM.Options[i] > -1 && CM.Options[i] < CM.ConfigData[i].label.length)) {
} else if (i !== 'Header' && i !== 'Colors') {
if (i.indexOf('SoundURL') === -1) {
if (!(CM.Options[i] > -1 && CM.Options[i] < CM.Data.Config[i].label.length)) {
mod = true;
CM.Options[i] = CM.Data.ConfigDefault[i];
}
}
else { // Sound URLs
if (typeof CM.Options[i] != 'string') {
} else if (typeof CM.Options[i] !== 'string') { // Sound URLs
mod = true;
CM.Options[i] = CM.Data.ConfigDefault[i];
}
}
}
else if (i == 'Header') {
for (var j in CM.Data.ConfigDefault.Header) {
} else if (i === 'Header') {
for (const j in CM.Data.ConfigDefault.Header) {
if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) {
mod = true;
CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
}
}
}
else { // Colors
for (var j in CM.Data.ConfigDefault.Colors) {
if (typeof CM.Options[i][j] === 'undefined' || typeof CM.Options[i][j] != 'string') {
} else { // Colors
for (const j in CM.Data.ConfigDefault.Colors) {
if (typeof CM.Options[i][j] === 'undefined' || typeof CM.Options[i][j] !== 'string') {
mod = true;
CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
}
@@ -71,29 +65,28 @@ CM.Config.LoadConfig = function(settings) {
}
}
if (mod) CM.Config.SaveConfig();
CM.Loop(); // Do loop once
for (var i in CM.Data.ConfigDefault) {
if (i != 'Header' && typeof CM.ConfigData[i].func !== 'undefined') {
CM.ConfigData[i].func();
CM.Main.Loop(); // Do loop once
for (const i in CM.Data.ConfigDefault) {
if (i !== 'Header' && typeof CM.Data.Config[i].func !== 'undefined') {
CM.Data.Config[i].func();
}
}
}
else { // Default values
} else { // Default values
CM.Config.RestoreDefault();
}
}
};
/**
* This function reloads and resaves the default config as stored in CM.Data.ConfigDefault
* It is called by resDefBut.onclick loaded in the options page or by CM.Config.LoadConfig if no localStorage is found
*/
CM.Config.RestoreDefault = function() {
CM.Config.RestoreDefault = function () {
CM.Config.LoadConfig(CM.Data.ConfigDefault);
CM.Config.SaveConfig();
Game.UpdateMenu();
}
};
/********
/**
* Section: Functions related to toggling or changing configs */
/**
@@ -101,48 +94,47 @@ CM.Config.RestoreDefault = function() {
* It is called by the onclick event of options of the "bool" type
* @param {string} config The name of the option
*/
CM.Config.ToggleConfig = function(config) {
CM.Config.ToggleConfig = function (config) {
CM.Options[config]++;
if (CM.Options[config] == CM.ConfigData[config].label.length) {
if (CM.Options[config] === CM.Data.Config[config].label.length) {
CM.Options[config] = 0;
if (CM.ConfigData[config].toggle) l(CM.ConfigPrefix + config).className = 'option off';
}
else l(CM.ConfigPrefix + config).className = 'option';
if (CM.Data.Config[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
} else l(CM.Config.ConfigPrefix + config).className = 'option';
if (typeof CM.ConfigData[config].func !== 'undefined') {
CM.ConfigData[config].func();
if (typeof CM.Data.Config[config].func !== 'undefined') {
CM.Data.Config[config].func();
}
l(CM.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
l(CM.Config.ConfigPrefix + config).innerHTML = CM.Data.Config[config].label[CM.Options[config]];
CM.Config.SaveConfig();
}
};
/**
* This function sets the value of the specified volume-option and updates the display in the options menu
* It is called by the oninput and onchange event of "vol" type options
* @param {string} config The name of the option
*/
CM.Config.ToggleConfigVolume = function(config) {
if (l("slider" + config) != null) {
l("slider" + config + "right").innerHTML = l("slider" + config).value + "%";
CM.Options[config] = Math.round(l("slider" + config).value);
CM.Config.ToggleConfigVolume = function (config) {
if (l(`slider${config}`) !== null) {
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
CM.Options[config] = Math.round(l(`slider${config}`).value);
}
CM.Config.SaveConfig();
}
};
/**
* This function toggles header options by incrementing them with 1 and handling changes
* It is called by the onclick event of the +/- next to headers
* @param {string} config The name of the header
*/
CM.Config.ToggleHeader = function(config) {
CM.Config.ToggleHeader = function (config) {
CM.Options.Header[config]++;
if (CM.Options.Header[config] > 1) CM.Options.Header[config] = 0;
CM.Config.SaveConfig();
}
};
/********
/**
* Section: Functions related to notifications */
/**
@@ -151,29 +143,33 @@ CM.Config.ToggleHeader = function(config) {
* Note that most browsers will stop asking if the user has ignored the prompt around 6 times
* @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1)
*/
CM.Config.CheckNotificationPermissions = function(ToggleOnOff) {
if (ToggleOnOff == 1) {
CM.Config.CheckNotificationPermissions = function (ToggleOnOff) {
if (ToggleOnOff === 1) {
// Check if browser support Promise version of Notification Permissions
function checkNotificationPromise() {
const checkNotificationPromise = function () {
try {
Notification.requestPermission().then();
} catch(e) {
} 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()) {
console.log('This browser does not support notifications.');
} else if (checkNotificationPromise()) {
Notification.requestPermission().then();
}
else {
} else {
Notification.requestPermission();
}
}
}
}
};
/**
* Section: Variables used in Config functions */
/**
* Used to name certain DOM elements and refer to them
*/
CM.Config.ConfigPrefix = 'CMConfig';

View File

@@ -1,8 +1,8 @@
/********
/**
* Data *
********/
*/
/********
/**
* Section: Data used in the stats page to show not yet purchased updates. See CM.Disp.CreateStatsMissDisp() */
CM.Data.Fortunes = [
@@ -28,56 +28,83 @@ CM.Data.Fortunes = [
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104'
'Fortune #104',
];
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits'];
CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup']
CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup'];
/********
/**
* Section: All possible effects plants and other items can have with an explanation */
CM.Data.Effects = {
buildingCost: 'Building prices',
click: 'Cookies per click',
cps: 'Total CPS',
cursorCps: 'Cursor CPS',
goldenCookieDur: 'Golden cookie duration',
goldenCookieEffDur: 'Golden cookie effect duration',
goldenCookieFreq: 'Golden cookie frequency',
goldenCookieGain: 'Golden cookie gains',
grandmaCps: 'Grandma CPS',
itemDrops: 'Random item drop chance',
milk: 'Effect from milk',
reindeerDur: 'Reindeer duration',
reindeerFreq: 'Reindeer frequency',
reindeerGain: 'Reindeer gains',
upgradeCost: 'Upgrade prices',
wrathCookieDur: 'Wrath cookie duration',
wrathCookieEffDur: 'Wrath cookie effect duration',
wrathCookieFreq: 'Wrath cookie frequency',
wrathCookieGain: 'Wrath cookie gains',
wrinklerEat: 'Wrinkler ',
wrinklerSpawn: 'Wrinkler spawn frequency',
};
/**
* Section: Data for the various scales used by CookieMonster */
CM.Data.metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
CM.Data.shortScale = ['', '', 'M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec', 'Quattuordec', 'Quindec', 'Sexdec', 'Septendec', 'Octodec', 'Novemdec', 'Vigint', 'Unvigint', 'Duovigint', 'Trevigint', 'Quattuorvigint'];
CM.Data.shortScaleAbbreviated = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'De',
'UDe', 'DDe', 'TDe', 'QaDe', 'QiDe', 'SxDe', 'SpDe', 'ODe', 'NDe', 'Vi',
'UVi', 'DVi', 'TVi', 'QaVi', 'QiVi', 'SxVi', 'SpVi', 'OVi', 'NVi', 'Tr',
'UTr', 'DTr', 'TTr', 'QaTr', 'QiTr', 'SxTr', 'SpTr', 'OTr', 'NTr', 'Qaa',
'UQa', 'DQa', 'TQa', 'QaQa', 'QiQa', 'SxQa', 'SpQa', 'OQa', 'NQa', 'Qia',
'UQi', 'DQi', 'TQi', 'QaQi', 'QiQi', 'SxQi', 'SpQi', 'OQi', 'NQi', 'Sxa',
'USx', 'DSx', 'TSx', 'QaSx', 'QiSx', 'SxSx', 'SpSx', 'OSx', 'NSx', 'Spa',
'USp', 'DSp', 'TSp', 'QaSp', 'QiSp', 'SxSp', 'SpSp', 'OSp', 'NSp', 'Oco',
'UOc', 'DOc', 'TOc', 'QaOc', 'QiOc', 'SxOc', 'SpOc', 'OOc', 'NOc', 'Noa',
'UNo', 'DNo', 'TNo', 'QaNo', 'QiNo', 'SxNo', 'SpNo', 'ONo', 'NNo', 'Ct',
'UCt']
'UDe', 'DDe', 'TDe', 'QaDe', 'QiDe', 'SxDe', 'SpDe', 'ODe', 'NDe', 'Vi',
'UVi', 'DVi', 'TVi', 'QaVi', 'QiVi', 'SxVi', 'SpVi', 'OVi', 'NVi', 'Tr',
'UTr', 'DTr', 'TTr', 'QaTr', 'QiTr', 'SxTr', 'SpTr', 'OTr', 'NTr', 'Qaa',
'UQa', 'DQa', 'TQa', 'QaQa', 'QiQa', 'SxQa', 'SpQa', 'OQa', 'NQa', 'Qia',
'UQi', 'DQi', 'TQi', 'QaQi', 'QiQi', 'SxQi', 'SpQi', 'OQi', 'NQi', 'Sxa',
'USx', 'DSx', 'TSx', 'QaSx', 'QiSx', 'SxSx', 'SpSx', 'OSx', 'NSx', 'Spa',
'USp', 'DSp', 'TSp', 'QaSp', 'QiSp', 'SxSp', 'SpSp', 'OSp', 'NSp', 'Oco',
'UOc', 'DOc', 'TOc', 'QaOc', 'QiOc', 'SxOc', 'SpOc', 'OOc', 'NOc', 'Noa',
'UNo', 'DNo', 'TNo', 'QaNo', 'QiNo', 'SxNo', 'SpNo', 'ONo', 'NNo', 'Ct',
'UCt'];
/********
/**
* Section: Two array's containing all Config groups and their to-be displayed title */
CM.ConfigGroups = {
BarsColors: "Bars/Colors",
Calculation: "Calculation",
Notification: "Notification",
Tooltip: "Tooltips",
Statistics: "Statistics",
Notation: "Notation",
Miscellaneous: "Miscellaneous"
}
CM.Data.ConfigGroups = {
BarsColors: 'Bars/Colors',
Calculation: 'Calculation',
Notification: 'Notification',
Tooltip: 'Tooltips and additional insights',
Statistics: 'Statistics',
Notation: 'Notation',
Miscellaneous: 'Miscellaneous',
};
CM.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",
}
CM.Data.ConfigGroupsNotification = {
NotificationGeneral: 'General Notifications',
NotificationGC: 'Golden Cookie',
NotificationFC: 'Fortune Cookie',
NotificationSea: 'Season Special',
NotificationGard: 'Garden Tick',
NotificationMagi: 'Full Magic Bar',
NotificationWrink: 'Wrinkler',
NotificationWrinkMax: 'Maximum Wrinklers',
};
/********
* Section: An array (CM.ConfigData) containing all Config options and an array of default settings */
/**
* Section: An array (CM.Data.Config) containing all Config options and an array of default settings */
/**
* This includes all options of CookieMonster and relevant data
@@ -90,16 +117,36 @@ CM.ConfigGroupsNotification = {
* @item {function} func A function to be called when the option is toggled
*/
// Barscolors
CM.ConfigData.BotBar = {type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function() {CM.Disp.ToggleBotBar();}};
CM.ConfigData.TimerBar = {type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}};
CM.ConfigData.TimerBarPos = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.SortBuildings = {type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}};
CM.ConfigData.SortUpgrades = {type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}};
CM.ConfigData.BuildColor = {type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {type: 'bool', group: 'BarsColors', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpgradeBarAndColor();}};
CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
CM.Data.Config.BotBar = {
type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function () { CM.Disp.ToggleBotBar(); },
};
CM.Data.Config.TimerBar = {
type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function () { CM.Disp.ToggleTimerBar(); },
};
CM.Data.Config.TimerBarPos = {
type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function () { CM.Disp.ToggleTimerBarPos(); },
};
CM.Data.Config.TimerBarOverlay = {
type: 'bool', group: 'BarsColors', label: ['Timer Bar Overlay OFF', 'Timer Bar Overlay Only Seconds', 'Timer Bar Overlay Full'], desc: 'Overlay on timers displaying seconds and/or percentage left', toggle: true,
};
CM.Data.Config.SortBuildings = {
type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings(); },
};
CM.Data.Config.SortUpgrades = {
type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades(); },
};
CM.Data.Config.BuildColor = {
type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function () { CM.Disp.UpdateBuildings(); },
};
CM.Data.Config.BulkBuildColor = {
type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function () { CM.Disp.UpdateBuildings(); },
};
CM.Data.Config.UpBarColor = {
type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function () { CM.Disp.ToggleUpgradeBarAndColor(); },
};
CM.Data.Config.Colors = {
type: 'color',
group: 'BarsColors',
desc: {
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
@@ -109,110 +156,274 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels',
Gray: 'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
Pink: 'Color Pink. Used for Dragonflight bar',
Brown: 'Color Brown. Used for Dragon Harvest bar'
Brown: 'Color Brown. Used for Dragon Harvest bar',
},
func: function() {CM.Disp.UpdateColors();}
func: function () { CM.Disp.UpdateColors(); },
};
CM.Data.Config.UpgradeBarFixedPos = {
type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function () { CM.Disp.ToggleUpgradeBarFixedPos(); },
};
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
// Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
CM.ConfigData.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
CM.Data.Config.CalcWrink = {
type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true,
};
CM.Data.Config.CPSMode = {
type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false,
};
CM.Data.Config.AvgCPSHist = {
type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false,
};
CM.Data.Config.AvgClicksHist = {
type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false,
};
CM.Data.Config.ColorPPBulkMode = {
type: 'bool', group: 'Calculation', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false, func: function () { CM.Cache.CachePP(); },
};
CM.Data.Config.PPExcludeTop = {
type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true,
};
CM.Data.Config.PPSecondsLowerLimit = {
type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity,
};
CM.Data.Config.PPOnlyConsiderBuyable = {
type: 'bool', group: 'Calculation', label: ["Don't Ignore Non-Buyable", 'Ignore Non-Buyable'], desc: "Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'", toggle: true,
};
CM.Data.Config.ToolWarnBon = {
type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true,
};
// Notification
CM.ConfigData.Title = {type: 'bool', group: 'NotificationGeneral', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
CM.ConfigData.GCNotification = {type: 'bool', group: 'NotificationGC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.GCNotification);}};
CM.ConfigData.GCFlash = {type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true};
CM.ConfigData.GCSound = {type: 'bool', group: 'NotificationGC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true};
CM.ConfigData.GCVolume = {type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.GCVolume.label[i] = i + '%';
CM.Data.Config.Title = {
type: 'bool', group: 'NotificationGeneral', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns; "!" means that Golden Cookie/Reindeer can spawn', toggle: true,
};
CM.Data.Config.GeneralSound = {
type: 'bool', group: 'NotificationGeneral', label: ['Consider Game Volume Setting OFF', 'Consider Game Volume Setting ON'], desc: 'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down', toggle: true,
};
CM.Data.Config.GCNotification = {
type: 'bool', group: 'NotificationGC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.GCNotification); },
};
CM.Data.Config.GCFlash = {
type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true,
};
CM.Data.Config.GCSound = {
type: 'bool', group: 'NotificationGC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true,
};
CM.Data.Config.GCVolume = {
type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.GCVolume.label[i] = `${i}%`;
}
CM.ConfigData.GCSoundURL = {type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
CM.ConfigData.FortuneNotification = {type: 'bool', group: 'NotificationFC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification);}};
CM.ConfigData.FortuneFlash = {type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true};
CM.ConfigData.FortuneSound = {type: 'bool', group: 'NotificationFC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true};
CM.ConfigData.FortuneVolume = {type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.FortuneVolume.label[i] = i + '%';
CM.Data.Config.GCSoundURL = {
type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns',
};
CM.Data.Config.FortuneNotification = {
type: 'bool', group: 'NotificationFC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification); },
};
CM.Data.Config.FortuneFlash = {
type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true,
};
CM.Data.Config.FortuneSound = {
type: 'bool', group: 'NotificationFC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true,
};
CM.Data.Config.FortuneVolume = {
type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.FortuneVolume.label[i] = `${i}%`;
}
CM.ConfigData.FortuneSoundURL = {type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'};
CM.ConfigData.SeaNotification = {type: 'bool', group: 'NotificationSea', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification);}};
CM.ConfigData.SeaFlash = {type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true};
CM.ConfigData.SeaSound = {type: 'bool', group: 'NotificationSea', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Season Popup', toggle: true};
CM.ConfigData.SeaVolume = {type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.SeaVolume.label[i] = i + '%';
CM.Data.Config.FortuneSoundURL = {
type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie',
};
CM.Data.Config.SeaNotification = {
type: 'bool', group: 'NotificationSea', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification); },
};
CM.Data.Config.SeaFlash = {
type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true,
};
CM.Data.Config.SeaSound = {
type: 'bool', group: 'NotificationSea', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Season Popup', toggle: true,
};
CM.Data.Config.SeaVolume = {
type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.SeaVolume.label[i] = `${i}%`;
}
CM.ConfigData.SeaSoundURL = {type: 'url', group: 'NotificationSea', label: 'Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'};
CM.ConfigData.GardFlash = {type: 'bool', group: 'NotificationGard', label: ['Garden Tick Flash OFF', 'Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true};
CM.ConfigData.GardSound = {type: 'bool', group: 'NotificationGard', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true};
CM.ConfigData.GardVolume = {type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.GardVolume.label[i] = i + '%';
CM.Data.Config.SeaSoundURL = {
type: 'url', group: 'NotificationSea', label: 'Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns',
};
CM.Data.Config.GardFlash = {
type: 'bool', group: 'NotificationGard', label: ['Garden Tick Flash OFF', 'Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true,
};
CM.Data.Config.GardSound = {
type: 'bool', group: 'NotificationGard', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true,
};
CM.Data.Config.GardVolume = {
type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.GardVolume.label[i] = `${i}%`;
}
CM.ConfigData.GardSoundURL = {type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
CM.ConfigData.MagicNotification = {type: 'bool', group: 'NotificationMagi', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification);}};
CM.ConfigData.MagicFlash = {type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true};
CM.ConfigData.MagicSound = {type: 'bool', group: 'NotificationMagi', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true};
CM.ConfigData.MagicVolume = {type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.MagicVolume.label[i] = i + '%';
CM.Data.Config.GardSoundURL = {
type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks',
};
CM.Data.Config.MagicNotification = {
type: 'bool', group: 'NotificationMagi', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification); },
};
CM.Data.Config.MagicFlash = {
type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true,
};
CM.Data.Config.MagicSound = {
type: 'bool', group: 'NotificationMagi', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true,
};
CM.Data.Config.MagicVolume = {
type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.MagicVolume.label[i] = `${i}%`;
}
CM.ConfigData.MagicSoundURL = {type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'};
CM.ConfigData.WrinklerNotification = {type: 'bool', group: 'NotificationWrink', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification);}};
CM.ConfigData.WrinklerFlash = {type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true};
CM.ConfigData.WrinklerSound = {type: 'bool', group: 'NotificationWrink', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true};
CM.ConfigData.WrinklerVolume = {type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.WrinklerVolume.label[i] = i + '%';
CM.Data.Config.MagicSoundURL = {
type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium',
};
CM.Data.Config.WrinklerNotification = {
type: 'bool', group: 'NotificationWrink', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification); },
};
CM.Data.Config.WrinklerFlash = {
type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true,
};
CM.Data.Config.WrinklerSound = {
type: 'bool', group: 'NotificationWrink', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true,
};
CM.Data.Config.WrinklerVolume = {
type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.WrinklerVolume.label[i] = `${i}%`;
}
CM.ConfigData.WrinklerSoundURL = {type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'};
CM.ConfigData.WrinklerMaxNotification = {type: 'bool', group: 'NotificationWrinkMax', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification);}};
CM.ConfigData.WrinklerMaxFlash = {type: 'bool', group: 'NotificationWrinkMax', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true};
CM.ConfigData.WrinklerMaxSound = {type: 'bool', group: 'NotificationWrinkMax', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true};
CM.ConfigData.WrinklerMaxVolume = {type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) {
CM.ConfigData.WrinklerMaxVolume.label[i] = i + '%';
CM.Data.Config.WrinklerSoundURL = {
type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears',
};
CM.Data.Config.WrinklerMaxNotification = {
type: 'bool', group: 'NotificationWrinkMax', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () { CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification); },
};
CM.Data.Config.WrinklerMaxFlash = {
type: 'bool', group: 'NotificationWrinkMax', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true,
};
CM.Data.Config.WrinklerMaxSound = {
type: 'bool', group: 'NotificationWrinkMax', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true,
};
CM.Data.Config.WrinklerMaxVolume = {
type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume',
};
for (let i = 0; i < 101; i++) {
CM.Data.Config.WrinklerMaxVolume.label[i] = `${i}%`;
}
CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared'};
CM.Data.Config.WrinklerMaxSoundURL = {
type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared',
};
// Tooltip
CM.ConfigData.TooltipInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Tooltip Information OFF', 'Extra Tooltip Information ON'], desc: 'Extra information in tooltips', toggle: true};
CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true};
CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true};
CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
CM.ConfigData.ToolWarnConjureFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true};
CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true};
CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
CM.ConfigData.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true};
CM.Data.Config.TooltipBuildUpgrade = {
type: 'bool', group: 'Tooltip', label: ['Building/Upgrade Tooltip Information OFF', 'Building/Upgrade Tooltip Information ON'], desc: 'Extra information in Building/Upgrade tooltips', toggle: true,
};
CM.Data.Config.TooltipAmor = {
type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true,
};
CM.Data.Config.ToolWarnLucky = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true,
};
CM.Data.Config.ToolWarnLuckyFrenzy = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true,
};
CM.Data.Config.ToolWarnConjure = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true,
};
CM.Data.Config.ToolWarnConjureFrenzy = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true,
};
CM.Data.Config.ToolWarnEdifice = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true,
};
CM.Data.Config.ToolWarnUser = {
type: 'numscale', group: 'Tooltip', label: 'Tooltip Warning At x times CPS: ', desc: 'Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether', min: 0, max: Infinity,
};
CM.Data.Config.ToolWarnPos = {
type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function () { CM.Disp.ToggleToolWarnPos(); },
};
CM.Data.Config.TooltipGrim = {
type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true,
};
CM.Data.Config.TooltipWrink = {
type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true,
};
CM.Data.Config.TooltipLump = {
type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true,
};
CM.Data.Config.TooltipPlots = {
type: 'bool', group: 'Tooltip', label: ['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'], desc: 'Shows a tooltip for plants that have a cookie reward.', toggle: true,
};
CM.Data.Config.DragonAuraInfo = {
type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true,
};
CM.Data.Config.TooltipAscendButton = {
type: 'bool', group: 'Tooltip', label: ['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'], desc: 'Shows additional info in the ascend tooltip', toggle: true,
};
// Statistics
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
CM.ConfigData.MissingUpgrades = {type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true};
CM.ConfigData.UpStats = {type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false};
CM.ConfigData.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false};
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
CM.Data.Config.Stats = {
type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true,
};
CM.Data.Config.MissingUpgrades = {
type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true,
};
CM.Data.Config.UpStats = {
type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false,
};
CM.Data.Config.TimeFormat = {
type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false,
};
CM.Data.Config.DetailedTime = {
type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function () { CM.Disp.ToggleDetailedTime(); },
};
CM.Data.Config.GrimoireBar = {
type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true,
};
CM.Data.Config.HeavenlyChipsTarget = {
type: 'numscale', group: 'Statistics', label: 'Heavenly Chips Target: ', desc: 'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections', min: 1, max: Infinity,
};
CM.Data.Config.ShowMissedGC = {
type: 'bool', group: 'Statistics', label: ['Missed GC OFF', 'Missed GC ON'], desc: 'Show a stat in the statistics screen that counts how many Golden Cookies you have missed', toggle: true,
};
// Notation
CM.ConfigData.Scale = {type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleCutoff = {type: 'numscale', group: 'Notation', label: 'Notation Cut-off Point', desc: 'The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations.', min: 1, max: 999999999};
CM.Data.Config.Scale = {
type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function () { CM.Disp.RefreshScale(); },
};
CM.Data.Config.ScaleDecimals = {
type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function () { CM.Disp.RefreshScale(); },
};
CM.Data.Config.ScaleSeparator = {
type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function () { CM.Disp.RefreshScale(); },
};
CM.Data.Config.ScaleCutoff = {
type: 'numscale', group: 'Notation', label: 'Notation Cut-off Point: ', desc: 'The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations', min: 1, max: 999999999,
};
// Miscellaneous
CM.ConfigData.GCTimer = {type: 'bool', group: 'Miscellaneous', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}};
CM.ConfigData.Favicon = {type: 'bool', group: 'Miscellaneous', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}};
CM.ConfigData.WrinklerButtons = {type: 'bool', group: 'Miscellaneous', label: ['Extra Buttons OFF', 'Extra Buttons ON'], desc: 'Show buttons for popping wrinklers at bottom of cookie section', toggle: true, func: function() {CM.Disp.UpdateWrinklerButtons();}};
CM.Data.Config.GCTimer = {
type: 'bool', group: 'Miscellaneous', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function () { CM.Disp.ToggleGCTimer(); },
};
CM.Data.Config.Favicon = {
type: 'bool', group: 'Miscellaneous', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function () { CM.Disp.UpdateFavicon(); },
};
CM.Data.Config.WrinklerButtons = {
type: 'bool', group: 'Miscellaneous', label: ['Extra Buttons OFF', 'Extra Buttons ON'], desc: 'Show buttons for popping wrinklers at bottom of cookie section', toggle: true, func: function () { CM.Disp.UpdateWrinklerButtons(); },
};
CM.Data.Config.BulkBuyBlock = {
type: 'bool', group: 'Miscellaneous', label: ['Block Bulk Buying OFF', 'Block Bulk Buying ON'], desc: "Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.", toggle: true,
};
/**
* This array describes all default settings
@@ -222,16 +433,22 @@ CM.Data.ConfigDefault = {
BotBar: 1,
TimerBar: 1,
TimerBarPos: 0,
TimerBarOverlay: 2,
BuildColor: 1,
BulkBuildColor: 0,
ColorPPBulkMode: 0,
UpBarColor: 1,
UpgradeBarFixedPos: 1,
CalcWrink: 0,
CPSMode: 1,
AvgCPSHist: 3,
AvgClicksHist: 0,
ColorPPBulkMode: 1,
PPExcludeTop: 0,
PPSecondsLowerLimit: 0,
PPOnlyConsiderBuyable: 0,
ToolWarnBon: 0,
Title: 1,
GeneralSound: 1,
GCNotification: 0,
GCFlash: 1,
GCSound: 1,
@@ -266,35 +483,90 @@ CM.Data.ConfigDefault = {
WrinklerMaxSound: 1,
WrinklerMaxVolume: 100,
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
Title: 1,
TooltipInfo: 1,
TooltipBuildUpgrade: 1,
TooltipAmor: 0,
ToolWarnLucky: 1,
ToolWarnLuckyFrenzy: 1,
ToolWarnConjure: 1,
ToolWarnConjureFrenzy: 1,
ToolWarnEdifice: 1,
ToolWarnUser: 0,
ToolWarnPos: 1,
TooltipGrim:1,
ToolWrink: 1,
TooltipGrim: 1,
TooltipWrink: 1,
TooltipLump: 1,
TooltipPlots: 1,
DragonAuraInfo: 1,
TooltipAscendButton: 1,
Stats: 1,
MissingUpgrades: 1,
UpStats: 1,
TimeFormat: 0,
DetailedTime: 1,
GrimoireBar: 1,
HeavenlyChipsTarget: 1,
ShowMissedGC: 1,
Scale: 2,
ScaleDecimals: 2,
ScaleSeparator: 0,
ScaleCutoff: 999999,
Colors: {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
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,
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, Spells: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
BulkBuyBlock: 0,
Header: {
BarsColors: 1, Calculation: 1, Notification: 1, NotificationGeneral: 1, NotificationGC: 1, NotificationFC: 1, NotificationSea: 1, NotificationGard: 1, NotificationMagi: 1, NotificationWrink: 1, NotificationWrinkMax: 1, Tooltip: 1, Statistics: 1, Notation: 1, Miscellaneous: 1, Lucky: 1, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1,
},
};
/**
* These variables are used to describe Cookie Monster in the info tab
* It is used by CM.Disp.AddMenuInfo()
*/
CM.Data.ModDescription = `<div class="listing">
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
offers a wide range of tools and statistics to enhance your game experience.
It is not a cheat interface although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
Please also report any bugs you may find over there!</br>
</div>
`;
CM.Data.LatestReleaseNotes = `<div class="listing">
<b>The latest update (v 2.031.4) has introduced the following features:</b></br>
- Added a changelog to the info tab and notification indicating a new version</br>
- Warnings in tooltips are now based on the income after buying the upgrade</br>
- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added</br>
- User can now set a custom tooltip warning ("x times cps") in the settings</br>
- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward</br>
- The Harvest All button in the Garden now has a tooltip displaying the current reward </br>
- The Ascend button can now display additional info (this can be turned off in the settings) </br>
- The statistics page now displays the Heavenly Chips per second</br>
- The statistics page now displays the CPS needed for the next level in Chain Cookies</br>
- The statistics page now displays the cookies needed for optimal rewards for garden plants</br>
- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page</br>
- The color picker in the settings has been updated to its latest version</br>
- The overlay of seconds/percentage of timers is now toggle able and more readable</br>
- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)</br>
- CookieMonster now uses the Modding API provided by the base game</br>
- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod</br>
- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn</br>
- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment</br>
</br>
<b>This update fixes the following bugs:</b></br>
- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded</br>
- Sound, Flashes and Notifications will no longer play when the mod is initializing</br>
- The color picker should now update its display consistently</br>
- Fixed some typo's</br>
- Fixed a game breaking bug when the player had not purchased any upgrades</br>
- Fixed a number of console errors thrown by CM</br>
- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster</br>
- The Timer bar will now disappear correctly when the Golden Switch has been activated</br>
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats</br>
- Fixed buy warnings showing incorrectly</br>
</div>
`;

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/**********
/**
* Footer *
**********/
*/
/********
/**
* Section: Functions related to base game modding API */
/**
@@ -11,39 +11,46 @@
* declare hooks here"
* It starts the further initialization of CookieMonster and registers hooks
*/
CM.init = function() {
var proceed = true;
if (Game.version != CM.VersionMajor) {
proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?');
CM.init = function () {
CM.Footer.isInitzializing = true;
let proceed = true;
if (Game.version !== Number(CM.VersionMajor)) {
proceed = confirm(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} is meant for Game version ${CM.VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`);
}
if (proceed) {
CM.DelayInit();
CM.Main.DelayInit();
Game.registerHook('draw', CM.Disp.Draw);
Game.registerHook('logic', CM.Main.Loop);
CM.Footer.isInitzializing = false;
}
}
};
/**
* This registers a save function to the CM object. Per Game code/comments:
* "use this to store persistent data associated with your mod
* return 'a string to be saved';"
*/
CM.save = function() {
CM.save = function () {
return JSON.stringify({
settings: CM.Options,
version: CM.VersionMajor + '.' + CM.VersionMinor,
version: `${CM.VersionMajor}.${CM.VersionMinor}`,
});
}
};
/**
* This registers a load function to the CM object. Per Game code/comments:
* "do stuff with the string data you saved previously"
*/
CM.load = function(str) {
let save = JSON.parse(str);
CM.load = function (str) {
const save = JSON.parse(str);
CM.Config.LoadConfig(save.settings);
}
if (save.version !== `${CM.VersionMajor}.${CM.VersionMinor}`) {
if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!');
else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1);
}
};
/********
/**
* Section: Functions related to the initialization of CookieMonster */
/**
@@ -51,27 +58,24 @@ CM.load = function(str) {
* functionality needed to dynamiccaly change colours
* It is called by the last function in the footer
*/
CM.Footer.AddJscolor = function() {
CM.Footer.AddJscolor = function () {
CM.Footer.Jscolor = document.createElement('script');
CM.Footer.Jscolor.type = 'text/javascript';
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
document.head.appendChild(CM.Footer.Jscolor);
}
};
/**
* This functions starts the initizialization and register CookieMonster
* It is called as the last function in this script's execution
* TODO: Make this async await
*/
if (!CM.isRunning) {
if (typeof CM.Footer.isInitzializing === 'undefined') {
CM.Footer.AddJscolor();
var delay = setInterval(function() {
const delay = setInterval(function () {
if (typeof jscolor !== 'undefined') {
jscolor.init();
Game.registerMod('CookieMonster', CM);
clearInterval(delay);
}
}, 500);
CM.isRunning = 1
}

View File

@@ -1,31 +1,18 @@
/**********
/* eslint-disable no-unused-vars */
/**
* Header *
**********/
RunCookieMonsterHeader = function() {
CM = {};
CM.Backup = {};
CM.Cache = {};
CM.Config = {};
CM.ConfigData = {};
CM.Data = {};
CM.Disp = {};
CM.Footer = {};
CM.Main = {};
CM.Options = {};
CM.Sim = {};
}
if (typeof CM == "undefined") {
RunCookieMonsterHeader();
}
*/
const CM = {
Backup: {},
Cache: {},
Config: {},
Data: { Config: {} },
Disp: {},
Footer: {},
Main: {},
Options: {},
Sim: {},
VersionMajor: '2.031',
VersionMinor: '4',
};

View File

@@ -1,215 +1,61 @@
/********
/**
* Main *
********/
CM.ReplaceNative = function() {
CM.Backup.Beautify = Beautify;
Beautify = CM.Disp.Beautify;
CM.Backup.CalculateGains = Game.CalculateGains;
eval('CM.Backup.CalculateGainsMod = ' + Game.CalculateGains.toString().split('ages\');').join('ages\');CM.Sim.DateAges = Date.now();').split('if (Game.Has(\'Century').join('CM.Sim.DateCentury = Date.now();if (Game.Has(\'Century'));
Game.CalculateGains = function() {
CM.Backup.CalculateGainsMod();
CM.Sim.DoSims = 1;
}
CM.Backup.tooltip = {};
CM.Backup.tooltip.draw = Game.tooltip.draw;
eval('CM.Backup.tooltip.drawMod = ' + Game.tooltip.draw.toString().split('this').join('Game.tooltip'));
Game.tooltip.draw = function(from, text, origin) {
CM.Backup.tooltip.drawMod(from, text, origin);
}
CM.Backup.tooltip.update = Game.tooltip.update;
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this.').join('Game.tooltip.'));
Game.tooltip.update = function() {
CM.Backup.tooltip.updateMod();
CM.Disp.UpdateTooltipLocation();
}
CM.Backup.UpdateWrinklers = Game.UpdateWrinklers;
Game.UpdateWrinklers = function() {
CM.Main.FixMouseY(CM.Backup.UpdateWrinklers);
}
CM.Backup.UpdateSpecial = Game.UpdateSpecial;
Game.UpdateSpecial = function() {
CM.Main.FixMouseY(CM.Backup.UpdateSpecial);
}
// Assumes newer browsers
l('bigCookie').removeEventListener('click', Game.ClickCookie, false);
l('bigCookie').addEventListener('click', function() { CM.Main.FixMouseY(Game.ClickCookie); }, false);
// Probably better to load per minigame
CM.Backup.scriptLoaded = Game.scriptLoaded;
Game.scriptLoaded = function(who, script) {
CM.Backup.scriptLoaded(who, script);
CM.Disp.ReplaceTooltipGrimoire()
CM.ReplaceNativeGrimoire();
}
// TODO: Move this ReplaceTooltip function too other ReplaceTooltip functions
// OR: Move all other into this function
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
Game.RebuildUpgrades = function() {
CM.Backup.RebuildUpgrades();
CM.Disp.ReplaceTooltipUpgrade();
Game.CalculateGains();
}
CM.Backup.DescribeDragonAura = Game.DescribeDragonAura;
/**
* This functions adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
* This adds information about CPS differences and costs to the aura choosing interface
* @param {number} aura The number of the aura currently selected by the mouse/user
*/
Game.DescribeDragonAura = function(aura) {
CM.Backup.DescribeDragonAura(aura);
CM.Disp.AddAuraInfo(aura);
}
CM.Backup.ToggleSpecialMenu = Game.ToggleSpecialMenu;
/**
* This functions adds the code to display the tooltips for the levelUp button of the dragon
/**
* Section: Functions related to the main and initialization loop */
/**
* Main loop of Cookie Monster
* CM.init registers it to the "logic" hook provided by the modding api
*/
Game.ToggleSpecialMenu = function(on) {
CM.Backup.ToggleSpecialMenu(on);
CM.Disp.AddDragonLevelUpTooltip();
}
CM.Backup.UpdateMenu = Game.UpdateMenu;
Game.UpdateMenu = function() {
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
CM.Backup.UpdateMenu();
CM.Disp.AddMenu();
}
}
CM.Backup.sayTime = Game.sayTime;
CM.Disp.sayTime = function(time, detail) {
if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
else return CM.Disp.FormatTime(time / Game.fps, 1);
}
CM.Backup.Loop = Game.Loop;
Game.Loop = function() {
CM.Backup.Loop();
CM.Loop();
}
CM.Backup.Logic = Game.Logic;
eval('CM.Backup.LogicMod = ' + Game.Logic.toString().split('document.title').join('CM.Cache.Title'));
Game.Logic = function() {
CM.Backup.LogicMod();
// Update Title
CM.Disp.UpdateTitle();
}
}
CM.ReplaceNativeGrimoire = function() {
CM.ReplaceNativeGrimoireLaunch();
CM.ReplaceNativeGrimoireDraw();
}
CM.ReplaceNativeGrimoireLaunch = function() {
if (!CM.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireLaunch = minigame.launch;
eval('CM.Backup.GrimoireLaunchMod = ' + minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame'));
Game.Objects['Wizard tower'].minigame.launch = function() {
CM.Backup.GrimoireLaunchMod();
CM.Disp.ReplaceTooltipGrimoire();
CM.HasReplaceNativeGrimoireDraw = false;
CM.ReplaceNativeGrimoireDraw();
}
CM.HasReplaceNativeGrimoireLaunch = true;
}
}
CM.ReplaceNativeGrimoireDraw = function() {
if (!CM.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function() {
CM.Backup.GrimoireDraw();
if (CM.Options.GrimoireBar == 1 && minigame.magic < minigame.magicM) {
minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')';
}
}
CM.HasReplaceNativeGrimoireDraw = true;
}
}
CM.Loop = function() {
if (CM.Disp.lastAscendState != Game.OnAscend) {
CM.Main.Loop = function () {
if (CM.Disp.lastAscendState !== Game.OnAscend) {
CM.Disp.lastAscendState = Game.OnAscend;
CM.Disp.UpdateAscendState();
}
if (!Game.OnAscend && Game.AscendTimer == 0) {
if (!Game.OnAscend && Game.AscendTimer === 0) {
// Check if any other mods have been loaded
if (CM.Main.LastModCount !== Object.keys(Game.mods).length) {
CM.Sim.CreateSimFunctions();
CM.Sim.InitData();
CM.Cache.InitCache();
CM.Main.LastModCount = Object.keys(Game.mods).length;
}
// CM.Sim.DoSims is set whenever CPS has changed
if (CM.Sim.DoSims) {
CM.Cache.RemakeIncome();
CM.Cache.CacheIncome();
CM.Sim.NoGoldSwitchCookiesPS(); // Needed first
CM.Cache.RemakeGoldenAndWrathCookiesMults();
CM.Cache.NoGoldSwitchCPS(); // Needed first
CM.Cache.CacheGoldenAndWrathCookiesMults();
CM.Cache.CacheStats();
CM.Cache.CacheMissingUpgrades();
CM.Cache.RemakeChain();
CM.Cache.CacheChain();
CM.Cache.CacheDragonCost();
CM.Cache.RemakeSeaSpec();
CM.Cache.RemakeSellForChoEgg();
CM.Cache.CacheSeaSpec();
CM.Cache.CacheSellForChoEgg();
CM.Sim.DoSims = 0;
}
// Check for aura change to recalculate buildings prices
var hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
const hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
if (!CM.Cache.HadBuildAura && hasBuildAura) {
CM.Cache.HadBuildAura = true;
CM.Cache.DoRemakeBuildPrices = 1;
}
else if (CM.Cache.HadBuildAura && !hasBuildAura) {
} else if (CM.Cache.HadBuildAura && !hasBuildAura) {
CM.Cache.HadBuildAura = false;
CM.Cache.DoRemakeBuildPrices = 1;
}
if (CM.Cache.DoRemakeBuildPrices) {
CM.Cache.RemakeBuildingsPrices();
CM.Cache.CacheBuildingsPrices();
CM.Cache.DoRemakeBuildPrices = 0;
}
// Update Wrinkler Bank
CM.Cache.CacheWrinklers();
// Calculate PP
CM.Cache.RemakePP();
// Update colors
CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades();
// Redraw timers
CM.Disp.UpdateTimerBar();
// Update Bottom Bar
CM.Disp.UpdateBotBar();
// Update Tooltip
CM.Disp.UpdateTooltip();
// Update Wrinkler Tooltip
CM.Disp.CheckWrinklerTooltip();
CM.Disp.UpdateWrinklerTooltip();
// Change menu refresh interval
CM.Disp.RefreshMenu();
}
CM.Cache.LoopCache();
// Check all changing minigames and game-states
CM.Main.CheckGoldenCookie();
@@ -218,231 +64,473 @@ CM.Loop = function() {
CM.Main.CheckGardenTick();
CM.Main.CheckMagicMeter();
CM.Main.CheckWrinklerCount();
}
};
// Update Average CPS (might need to move)
CM.Cache.UpdateCurrWrinklerCPS();
CM.Cache.UpdateAvgCPS();
}
/**
* Initialization loop of Cookie Monster
* Called by CM.init()
*/
CM.Main.DelayInit = function () {
// Create CM.Sim functions
CM.Sim.CreateSimFunctions();
CM.DelayInit = function() {
CM.Sim.InitData();
CM.Cache.InitCache();
// Stored to check if we need to re-initiliaze data
CM.Main.LastModCount = Object.keys(Game.mods).length;
// Creating visual elements
CM.Disp.CreateCssArea();
CM.Disp.CreateBotBar();
CM.Disp.CreateTimerBar();
CM.Disp.CreateUpgradeBar();
CM.Disp.CreateWhiteScreen();
CM.Disp.CreateFavicon();
for (var i in CM.Disp.TooltipText) {
for (const i of Object.keys(CM.Disp.TooltipText)) {
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
}
CM.Disp.CreateWrinklerButtons();
CM.Disp.ReplaceTooltipBuild();
CM.Disp.ReplaceTooltipGrimoire();
CM.Disp.ReplaceTooltipLump();
CM.Disp.UpdateBuildingUpgradeStyle();
CM.Main.ReplaceTooltips();
CM.Main.AddWrinklerAreaDetect();
CM.Cache.InitCookiesDiff();
CM.ReplaceNative();
CM.ReplaceNativeGrimoire();
// Replace native functions
CM.Main.ReplaceNative();
CM.Main.ReplaceNativeGrimoire();
Game.CalculateGains();
CM.Config.LoadConfig(); // Must be after all things are created!
CM.Disp.lastAscendState = Game.OnAscend;
CM.Disp.lastBuyMode = Game.buyMode;
CM.Disp.lastBuyBulk = Game.buyBulk;
if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!');
else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!', '', '', 1, 1);
// given the architecture of your code, you probably want these lines somewhere else,
// but I stuck them here for convenience
l("products").style.display = "grid";
l("storeBulk").style.gridRow = "1/1";
l("upgrades").style.display = "flex";
l("upgrades").style["flex-wrap"] = "wrap";
if (Game.prefs.popups) Game.Popup(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} loaded!`);
else Game.Notify(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} loaded!`, '', '', 1, 1);
Game.Win('Third-party');
}
};
/********
* Section: Functions related to checking for changes in Minigames/GC's/Ticker
* TODO: Possibly move this section */
/**
* Section: Functions related to replacing stuff */
/**
* This function replaces certain native (from the base-game) functions
* It is called by CM.Main.DelayInit()
*/
CM.Main.ReplaceNative = function () {
CM.Backup.Beautify = Beautify;
Beautify = CM.Disp.Beautify;
CM.Backup.CalculateGains = Game.CalculateGains;
eval(`CM.Backup.CalculateGainsMod = ${Game.CalculateGains.toString().split('ages\');').join('ages\');CM.Sim.DateAges = Date.now();').split('if (Game.Has(\'Century')
.join('CM.Sim.DateCentury = Date.now();if (Game.Has(\'Century')}`);
Game.CalculateGains = function () {
CM.Backup.CalculateGainsMod();
CM.Sim.DoSims = 1;
};
CM.Backup.tooltip = {};
CM.Backup.tooltip.draw = Game.tooltip.draw;
eval(`CM.Backup.tooltip.drawMod = ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`);
Game.tooltip.draw = function (from, text, origin) {
CM.Backup.tooltip.drawMod(from, text, origin);
};
CM.Backup.tooltip.update = Game.tooltip.update;
eval(`CM.Backup.tooltip.updateMod = ${Game.tooltip.update.toString().split('this.').join('Game.tooltip.')}`);
Game.tooltip.update = function () {
CM.Backup.tooltip.updateMod();
CM.Disp.UpdateTooltipLocation();
};
CM.Backup.UpdateWrinklers = Game.UpdateWrinklers;
Game.UpdateWrinklers = function () {
CM.Main.FixMouseY(CM.Backup.UpdateWrinklers);
};
CM.Backup.UpdateSpecial = Game.UpdateSpecial;
Game.UpdateSpecial = function () {
CM.Main.FixMouseY(CM.Backup.UpdateSpecial);
};
// Assumes newer browsers
l('bigCookie').removeEventListener('click', Game.ClickCookie, false);
l('bigCookie').addEventListener('click', function () { CM.Main.FixMouseY(Game.ClickCookie); }, false);
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
Game.RebuildUpgrades = function () {
CM.Backup.RebuildUpgrades();
CM.Disp.ReplaceTooltipUpgrade();
Game.CalculateGains();
};
CM.Backup.ClickProduct = Game.ClickProduct;
/**
* This function adds a check to the purchase of a building to allow BulkBuyBlock to work.
* If the options is 1 (on) bulkPrice is under cookies you can't buy the building.
*/
Game.ClickProduct = function (what) {
if (!CM.Options.BulkBuyBlock || Game.ObjectsById[what].bulkPrice < Game.cookies) {
CM.Backup.ClickProduct(what);
}
};
CM.Backup.DescribeDragonAura = Game.DescribeDragonAura;
/**
* This function adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
* This adds information about CPS differences and costs to the aura choosing interface
* @param {number} aura The number of the aura currently selected by the mouse/user
*/
Game.DescribeDragonAura = function (aura) {
CM.Backup.DescribeDragonAura(aura);
CM.Disp.AddAuraInfo(aura);
};
CM.Backup.ToggleSpecialMenu = Game.ToggleSpecialMenu;
/**
* This function adds the code to display the tooltips for the levelUp button of the dragon
*/
Game.ToggleSpecialMenu = function (on) {
CM.Backup.ToggleSpecialMenu(on);
CM.Disp.AddDragonLevelUpTooltip();
};
CM.Backup.UpdateMenu = Game.UpdateMenu;
Game.UpdateMenu = function () {
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
CM.Backup.UpdateMenu();
CM.Disp.AddMenu();
}
};
CM.Backup.sayTime = Game.sayTime;
CM.Disp.sayTime = function (time, detail) {
if (Number.isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
else return CM.Disp.FormatTime(time / Game.fps, 1);
};
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
CM.Backup.Logic = Game.Logic;
CM.Backup.LogicMod = new Function(
`return ${Game.Logic.toString()
.split('document.title')
.join('CM.Disp.Title')
.split("' more cookies</b> for the next level.<br>';")
.join("` more cookies</b> for the next level.<br>${CM.Options.TooltipAscendButton ? `<div class='line'></div>It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.<br>` : ``}`;")}`,
)();
Game.Logic = function () {
CM.Backup.LogicMod();
// Update Title
CM.Disp.UpdateTitle();
};
};
/**
* This function fixes replaces the Launch and Draw functions of the Grimoire
* It is called by CM.Main.DelayInit() and Game.LoadMinigames()
*/
CM.Main.ReplaceNativeGrimoire = function () {
CM.Main.ReplaceNativeGrimoireLaunch();
CM.Main.ReplaceNativeGrimoireDraw();
};
/**
* This function fixes replaces the .launch function of the Grimoire
* It is called by CM.Main.ReplaceNativeGrimoire()
*/
CM.Main.ReplaceNativeGrimoireLaunch = function () {
if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
const minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireLaunch = minigame.launch;
eval(`CM.Backup.GrimoireLaunchMod = ${minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')}`);
Game.Objects['Wizard tower'].minigame.launch = function () {
CM.Backup.GrimoireLaunchMod();
CM.Main.ReplaceTooltipGrimoire();
CM.HasReplaceNativeGrimoireDraw = false;
CM.Main.ReplaceNativeGrimoireDraw();
};
CM.Main.HasReplaceNativeGrimoireLaunch = true;
}
};
/**
* This function fixes replaces the .draw function of the Grimoire
* It is called by CM.Main.ReplaceNativeGrimoire()
*/
CM.Main.ReplaceNativeGrimoireDraw = function () {
if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
const minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function () {
CM.Backup.GrimoireDraw();
if (CM.Options.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
minigame.magicBarTextL.innerHTML += ` (${CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM))})`;
}
};
CM.Main.HasReplaceNativeGrimoireDraw = true;
}
};
/**
* Section: Functions related to first initizalition of CM */
/**
* This function call all functions that replace Game-tooltips with CM-enhanced tooltips
* It is called by CM.Main.DelayInit()
*/
CM.Main.ReplaceTooltips = function () {
CM.Main.ReplaceTooltipBuild();
CM.Main.ReplaceTooltipLump();
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
// they were not loaded initially
CM.Backup.LoadMinigames = Game.LoadMinigames;
Game.LoadMinigames = function () {
CM.Backup.LoadMinigames();
CM.Main.ReplaceTooltipGarden();
CM.Main.ReplaceTooltipGrimoire();
CM.Main.ReplaceNativeGrimoire();
};
Game.LoadMinigames();
};
/**
* Section: Functions related to replacing tooltips */
/**
* This function replaces the original .onmouseover functions of buildings so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'b'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipBuild = function () {
CM.Main.TooltipBuildBackup = [];
for (const i of Object.keys(Game.Objects)) {
const me = Game.Objects[i];
if (l(`product${me.id}`).onmouseover !== null) {
CM.Main.TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
eval(`l('product' + me.id).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('b', '${i}');}, 'store'); Game.tooltip.wobble();}`);
}
}
};
/**
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 's'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipLump = function () {
if (Game.canLumps()) {
CM.Main.TooltipLumpBackup = l('lumps').onmouseover;
eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}');
}
};
/**
* This function replaces the original .onmouseover functions of the Grimoire minigame so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'g'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipGrimoire = function () {
if (Game.Objects['Wizard tower'].minigameLoaded) {
CM.Main.TooltipGrimoireBackup = [];
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
if (l(`grimoireSpell${i}`).onmouseover !== null) {
CM.Main.TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
eval(`l('grimoireSpell' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('g', '${i}');}, 'this'); Game.tooltip.wobble();}`);
}
}
}
};
/**
* This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'p'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipGarden = function () {
if (Game.Objects.Farm.minigameLoaded) {
l('gardenTool-1').onmouseover = function () { Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function () { return CM.Disp.Tooltip('ha', 'HarvestAllButton'); }, 'this'); Game.tooltip.wobble(); };
Array.from(l('gardenPlot').children).forEach((child) => {
const coords = child.id.slice(-3);
child.onmouseover = function () { Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function () { return CM.Disp.Tooltip('p', [`${coords[0]}`, `${coords[2]}`]); }, 'this'); Game.tooltip.wobble(); };
});
}
};
/**
* Section: Functions related to checking for changes in Minigames/GC's/Ticker */
/**
* Auxilirary function that finds all currently spawned shimmers.
* CM.Cache.spawnedGoldenShimmer stores the non-user spawned cookie to later determine data for the favicon and tab-title
* It is called by CM.CM.Main.CheckGoldenCookie
*/
CM.Main.FindShimmer = function() {
CM.Main.FindShimmer = function () {
CM.Main.currSpawnedGoldenCookieState = 0;
CM.Cache.goldenShimmersByID = {}
for (var i in Game.shimmers) {
CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i]
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'golden') {
CM.Cache.goldenShimmersByID = {};
for (const i of Object.keys(Game.shimmers)) {
CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
CM.Cache.spawnedGoldenShimmer = Game.shimmers[i];
CM.Main.currSpawnedGoldenCookieState += 1;
}
}
}
};
/**
* This function checks for changes in the amount of Golden Cookies
* It is called by CM.Loop
* TODO: Remove the delete function, as it does not delete correctly and crowds CM.Disp.GCTimers
* It is called by CM.Main.Loop
*/
CM.Main.CheckGoldenCookie = function() {
CM.Main.CheckGoldenCookie = function () {
CM.Main.FindShimmer();
for (var i in CM.Disp.GCTimers) {
if (typeof CM.Cache.goldenShimmersByID[i] == "undefined") {
for (const i of Object.keys(CM.Disp.GCTimers)) {
if (typeof CM.Cache.goldenShimmersByID[i] === 'undefined') {
CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);
// TODO remove delete here
delete CM.Disp.GCTimers[i];
}
}
if (CM.Main.lastGoldenCookieState != Game.shimmerTypes['golden'].n) {
CM.Main.lastGoldenCookieState = Game.shimmerTypes['golden'].n;
if (CM.Main.lastGoldenCookieState !== Game.shimmerTypes.golden.n) {
CM.Main.lastGoldenCookieState = Game.shimmerTypes.golden.n;
if (CM.Main.lastGoldenCookieState) {
if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) {
CM.Disp.Flash(3, 'GCFlash');
CM.Disp.PlaySound(CM.Options.GCSoundURL, 'GCSound', 'GCVolume');
CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!")
CM.Disp.Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!');
}
for (var i in Game.shimmers) {
if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] == "undefined") {
for (const i of Object.keys(Game.shimmers)) {
if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] === 'undefined') {
CM.Disp.CreateGCTimer(Game.shimmers[i]);
}
}
}
CM.Disp.UpdateFavicon();
CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState;
if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0;
}
else if (CM.Options.GCTimer == 1 && CM.Main.lastGoldenCookieState) {
for (var i in CM.Disp.GCTimers) {
if (CM.Main.currSpawnedGoldenCookieState === 0) CM.Cache.spawnedGoldenShimmer = 0;
} else if (CM.Options.GCTimer === 1 && CM.Main.lastGoldenCookieState) {
for (const i of Object.keys(CM.Disp.GCTimers)) {
CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity;
CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform;
CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps);
}
}
}
};
/**
* This function checks if there is reindeer that has spawned
* It is called by CM.Loop
* It is called by CM.Main.Loop
*/
CM.Main.CheckSeasonPopup = function() {
if (CM.Main.lastSeasonPopupState != Game.shimmerTypes['reindeer'].spawned) {
CM.Main.lastSeasonPopupState = Game.shimmerTypes['reindeer'].spawned;
for (var i in Game.shimmers) {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'reindeer') {
CM.Main.CheckSeasonPopup = function () {
if (CM.Main.lastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
CM.Main.lastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
for (const i of Object.keys(Game.shimmers)) {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
CM.Cache.seasonPopShimmer = Game.shimmers[i];
break;
}
}
CM.Disp.Flash(3, 'SeaFlash');
CM.Disp.PlaySound(CM.Options.SeaSoundURL, 'SeaSound', 'SeaVolume');
CM.Disp.Notification('SeaNotification',"Reindeer sighted!", "A Reindeer has spawned. Click it now!")
CM.Disp.Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!');
}
}
};
/**
* This function checks if there is a fortune cookie on the ticker
* It is called by CM.Loop
* It is called by CM.Main.Loop
*/
CM.Main.CheckTickerFortune = function() {
if (CM.Main.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) {
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune');
CM.Main.CheckTickerFortune = function () {
if (CM.Main.lastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
if (CM.Main.lastTickerFortuneState) {
CM.Disp.Flash(3, 'FortuneFlash');
CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
CM.Disp.Notification('FortuneNotification', "Fortune Cookie found", "A Fortune Cookie has appeared on the Ticker.")
CM.Disp.Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.');
}
}
}
};
/**
* This function checks if a garden tick has happened
* It is called by CM.Loop
* It is called by CM.Main.Loop
*/
CM.Main.CheckGardenTick = function() {
if (Game.Objects['Farm'].minigameLoaded && CM.Main.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) {
if (CM.Main.lastGardenNextStep != 0 && CM.Main.lastGardenNextStep < Date.now()) {
CM.Main.CheckGardenTick = function () {
if (Game.Objects.Farm.minigameLoaded && CM.Main.lastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) {
if (CM.Main.lastGardenNextStep !== 0 && CM.Main.lastGardenNextStep < Date.now()) {
CM.Disp.Flash(3, 'GardFlash');
CM.Disp.PlaySound(CM.Options.GardSoundURL, 'GardSound', 'GardVolume');
}
CM.Main.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep;
CM.Main.lastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
}
}
};
/**
* This function checks if the magic meter is full
* It is called by CM.Loop
* It is called by CM.Main.Loop
*/
CM.Main.CheckMagicMeter = function() {
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar == 1) {
var minigame = Game.Objects['Wizard tower'].minigame;
CM.Main.CheckMagicMeter = function () {
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) {
const minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
else if (!CM.Main.lastMagicBarFull) {
CM.Main.lastMagicBarFull = true;
CM.Disp.Flash(3, 'MagicFlash');
CM.Disp.PlaySound(CM.Options.MagicSoundURL, 'MagicSound', 'MagicVolume');
CM.Disp.Notification('MagicNotification', "Magic Meter full", "Your Magic Meter is full. Cast a spell!")
CM.Disp.Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!');
}
}
}
};
/**
* This function checks if any new Wrinklers have popped up
* It is called by CM.Loop
* It is called by CM.Main.Loop
*/
CM.Main.CheckWrinklerCount = function() {
CM.Main.CheckWrinklerCount = function () {
if (Game.elderWrath > 0) {
var CurrentWrinklers = 0;
for (var i in Game.wrinklers) {
if (Game.wrinklers[i].phase == 2) CurrentWrinklers++;
let CurrentWrinklers = 0;
for (const i in Game.wrinklers) {
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
}
if (CurrentWrinklers > CM.Main.lastWrinklerCount) {
CM.Main.lastWrinklerCount = CurrentWrinklers
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) {
CM.Main.lastWrinklerCount = CurrentWrinklers;
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) {
CM.Disp.Flash(3, 'WrinklerMaxFlash');
} else {
CM.Disp.Flash(3, 'WrinklerFlash');
}
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) {
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) {
CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
} else {
CM.Disp.PlaySound(CM.Options.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
}
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) {
CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers")
if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) {
CM.Disp.Notification('WrinklerMaxNotification', 'Maximum Wrinklers Reached', 'You have reached your maximum ammount of wrinklers');
} else {
CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared")
CM.Disp.Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared');
}
} else {
CM.Main.lastWrinklerCount = CurrentWrinklers
CM.Main.lastWrinklerCount = CurrentWrinklers;
}
}
}
};
/**
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
* It is called by CM.DelayInit
* TODO: The system for displaying wrinklers should ideally use a similar system as other tooltips
* Thus, writing a CM.Disp.ReplaceTooltipWrinkler function etc.
* It is called by CM.Main.DelayInit
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
*/
CM.Main.AddWrinklerAreaDetect = function() {
l('backgroundLeftCanvas').onmouseover = function() {CM.Disp.TooltipWrinklerArea = 1;};
l('backgroundLeftCanvas').onmouseout = function() {
CM.Main.AddWrinklerAreaDetect = function () {
l('backgroundLeftCanvas').onmouseover = function () { CM.Disp.TooltipWrinklerArea = 1; };
l('backgroundLeftCanvas').onmouseout = function () {
CM.Disp.TooltipWrinklerArea = 0;
Game.tooltip.hide();
for (var i in Game.wrinklers) {
for (const i of Object.keys(Game.wrinklers)) {
CM.Disp.TooltipWrinklerBeingShown[i] = 0;
}
};
}
};
/********
/**
* Section: Functions related to the mouse */
/**
@@ -450,32 +538,13 @@ CM.Main.AddWrinklerAreaDetect = function() {
* It is called by Game.UpdateWrinklers(), Game.UpdateSpecial() and the .onmousover of the BigCookie
* before execution of their actual function
*/
CM.Main.FixMouseY = function(target) {
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
CM.Main.FixMouseY = function (target) {
if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
const timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
Game.mouseY -= timerBarHeight;
target();
Game.mouseY += timerBarHeight;
}
else {
} else {
target();
}
}
CM.HasReplaceNativeGrimoireLaunch = false;
CM.HasReplaceNativeGrimoireDraw = false;
CM.Main.lastGoldenCookieState = 0;
CM.Main.lastSpawnedGoldenCookieState = 0;
CM.Main.currSpawnedGoldenCookieState
CM.Main.lastTickerFortuneState = 0;
CM.Main.lastSeasonPopupState = 0;
CM.Main.lastGardenNextStep = 0;
CM.Main.lastMagicBarFull = 0;
CM.Main.lastWrinklerCount = 0;
CM.ConfigPrefix = 'CMConfig';
CM.VersionMajor = '2.031';
CM.VersionMinor = '3';
};

1010
src/Sim.js

File diff suppressed because it is too large Load Diff