Changes according to Eslint

This commit is contained in:
Daniël van Noord committed 2021-03-16 09:32:50 +01:00
1 parent 26d8e75935
commit a65af049b6
63 files changed
+314 -295

No files matched your search

+2 -7
View File
@@ -18,18 +18,13 @@ module.exports = {
ecmaVersion: 12, ecmaVersion: 12,
}, },
rules: { rules: {
'import/no-named-default': 'off',
'import/no-mutable-exports': 'off', 'import/no-mutable-exports': 'off',
'no-param-reassign': 'off', 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-plusplus': 'off',
'no-new-func': 'off', 'no-new-func': 'off',
'no-restricted-syntax': 'off',
'prefer-destructuring': 'off',
'func-names': 'off', 'func-names': 'off',
'no-console': 'off', 'no-console': 'off',
'no-nested-ternary': 'off',
'no-new': 'off',
'no-alert': 'off', 'no-alert': 'off',
'no-restricted-globals': 'off', 'no-restricted-globals': 'off',
'prefer-destructuring': ['error', { object: true, array: false }],
}, },
}; };
+1 -1
View File
@@ -1,2 +1,2 @@
/*! For license information please see CookieMonster.js.LICENSE.txt */ /*! For license information please see CookieMonster.js.LICENSE.txt */
(()=>{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,n,i,a=((i={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",i.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?i.node(o):e.document))throw new Error("Missing root node");for(var n=o.querySelectorAll(t),a=new RegExp("(^|\\s)("+i.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r<n.length;r+=1){var l,s;if(!(n[r].jscolor&&n[r].jscolor instanceof i.pub)&&(void 0===n[r].type||"color"!=n[r].type.toLowerCase()||!i.isColorAttrSupported)&&(null!==(l=i.getDataAttr(n[r],"jscolor"))||n[r].className&&(s=n[r].className.match(a)))){var c=n[r],d="";null!==l?d=l:s&&(console.warn('Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.'+i.docsRef),s[4]&&(d=s[4]));var p=null;if(d.trim())try{p=i.parseOptionsStr(d)}catch(e){console.warn(e+"\n"+d)}try{new i.pub(c,p)}catch(e){console.warn(e)}}}},parseOptionsStr:function(e){var t=null;try{t=JSON.parse(e)}catch(o){if(!i.pub.looseJSON)throw new Error("Could not parse jscolor options as JSON: "+o);try{t=new Function("var opts = ("+e+'); return typeof opts === "object" ? opts : {};')()}catch(e){throw new Error("Could not evaluate jscolor options: "+e)}}return t},getInstances:function(){for(var e=[],t=0;t<i.instances.length;t+=1)i.instances[t]&&i.instances[t].targetElement&&e.push(i.instances[t]);return e},createEl:function(t){var o=e.document.createElement(t);return i.setData(o,"gui",!0),o},node:function(t){if(!t)return null;if("string"==typeof t){var o=t,n=null;try{n=e.document.querySelector(o)}catch(e){return console.warn(e),null}return n||console.warn("No element matches the selector: %s",o),n}return i.isNode(t)?t:(console.warn("Invalid node of type %s: %s",typeof t,t),null)},isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},nodeName:function(e){return!(!e||!e.nodeName)&&e.nodeName.toLowerCase()},removeChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},isTextInput:function(e){return e&&"input"===i.nodeName(e)&&"text"===e.type.toLowerCase()},isButton:function(e){if(!e)return!1;var t=i.nodeName(e);return"button"===t||"input"===t&&["button","submit","reset"].indexOf(e.type.toLowerCase())>-1},isButtonEmpty:function(e){switch(i.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(n=e.document.createElement("input"),!(!n.setAttribute||(n.setAttribute("type","color"),"color"!=n.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={},o=arguments[2];return t[a=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={};var n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(i.dataProp))return!0;for(var t=1;t<arguments.length;t+=1){var o=arguments[t];delete e[i.dataProp][o]}return!0},getData:function(e,t,o){if(!e.hasOwnProperty(i.dataProp)){if(void 0===o)return;e[i.dataProp]={}}var n=e[i.dataProp];return n.hasOwnProperty(t)||void 0===o||(n[t]=o),n[t]},getDataAttr:function(e,t){var o="data-"+t;return e.getAttribute(o)},setDataAttr:function(e,t,o){var n="data-"+t;e.setAttribute(n,o)},_attachedGroupEvents:{},attachGroupEvent:function(e,t,o,n){i._attachedGroupEvents.hasOwnProperty(e)||(i._attachedGroupEvents[e]=[]),i._attachedGroupEvents[e].push([t,o,n]),t.addEventListener(o,n,!1)},detachGroupEvents:function(e){if(i._attachedGroupEvents.hasOwnProperty(e)){for(var t=0;t<i._attachedGroupEvents[e].length;t+=1){var o=i._attachedGroupEvents[e][t];o[0].removeEventListener(o[1],o[2],!1)}delete i._attachedGroupEvents[e]}},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(e){e.setCapture&&(i._capturedTarget=e,i._capturedTarget.setCapture())},releaseTarget:function(){i._capturedTarget&&(i._capturedTarget.releaseCapture(),i._capturedTarget=null)},triggerEvent:function(t,o,n,a){if(t){var r=null;return"function"==typeof Event?r=new Event(o,{bubbles:n,cancelable:a}):(r=e.document.createEvent("Event")).initEvent(o,n,a),!!r&&(i.setData(r,"internal",!0),t.dispatchEvent(r),!0)}},triggerInputEvent:function(e,t,o,n){e&&i.isTextInput(e)Line truncated (()=>{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,n,i,a=((i={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",i.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?i.node(o):e.document))throw new Error("Missing root node");for(var n=o.querySelectorAll(t),a=new RegExp("(^|\\s)("+i.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r<n.length;r+=1){var l,s;if(!(n[r].jscolor&&n[r].jscolor instanceof i.pub)&&(void 0===n[r].type||"color"!=n[r].type.toLowerCase()||!i.isColorAttrSupported)&&(null!==(l=i.getDataAttr(n[r],"jscolor"))||n[r].className&&(s=n[r].className.match(a)))){var c=n[r],d="";null!==l?d=l:s&&(console.warn('Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.'+i.docsRef),s[4]&&(d=s[4]));var p=null;if(d.trim())try{p=i.parseOptionsStr(d)}catch(e){console.warn(e+"\n"+d)}try{new i.pub(c,p)}catch(e){console.warn(e)}}}},parseOptionsStr:function(e){var t=null;try{t=JSON.parse(e)}catch(o){if(!i.pub.looseJSON)throw new Error("Could not parse jscolor options as JSON: "+o);try{t=new Function("var opts = ("+e+'); return typeof opts === "object" ? opts : {};')()}catch(e){throw new Error("Could not evaluate jscolor options: "+e)}}return t},getInstances:function(){for(var e=[],t=0;t<i.instances.length;t+=1)i.instances[t]&&i.instances[t].targetElement&&e.push(i.instances[t]);return e},createEl:function(t){var o=e.document.createElement(t);return i.setData(o,"gui",!0),o},node:function(t){if(!t)return null;if("string"==typeof t){var o=t,n=null;try{n=e.document.querySelector(o)}catch(e){return console.warn(e),null}return n||console.warn("No element matches the selector: %s",o),n}return i.isNode(t)?t:(console.warn("Invalid node of type %s: %s",typeof t,t),null)},isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},nodeName:function(e){return!(!e||!e.nodeName)&&e.nodeName.toLowerCase()},removeChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},isTextInput:function(e){return e&&"input"===i.nodeName(e)&&"text"===e.type.toLowerCase()},isButton:function(e){if(!e)return!1;var t=i.nodeName(e);return"button"===t||"input"===t&&["button","submit","reset"].indexOf(e.type.toLowerCase())>-1},isButtonEmpty:function(e){switch(i.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(n=e.document.createElement("input"),!(!n.setAttribute||(n.setAttribute("type","color"),"color"!=n.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={},o=arguments[2];return t[a=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={};var n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(i.dataProp))return!0;for(var t=1;t<arguments.length;t+=1){var o=arguments[t];delete e[i.dataProp][o]}return!0},getData:function(e,t,o){if(!e.hasOwnProperty(i.dataProp)){if(void 0===o)return;e[i.dataProp]={}}var n=e[i.dataProp];return n.hasOwnProperty(t)||void 0===o||(n[t]=o),n[t]},getDataAttr:function(e,t){var o="data-"+t;return e.getAttribute(o)},setDataAttr:function(e,t,o){var n="data-"+t;e.setAttribute(n,o)},_attachedGroupEvents:{},attachGroupEvent:function(e,t,o,n){i._attachedGroupEvents.hasOwnProperty(e)||(i._attachedGroupEvents[e]=[]),i._attachedGroupEvents[e].push([t,o,n]),t.addEventListener(o,n,!1)},detachGroupEvents:function(e){if(i._attachedGroupEvents.hasOwnProperty(e)){for(var t=0;t<i._attachedGroupEvents[e].length;t+=1){var o=i._attachedGroupEvents[e][t];o[0].removeEventListener(o[1],o[2],!1)}delete i._attachedGroupEvents[e]}},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(e){e.setCapture&&(i._capturedTarget=e,i._capturedTarget.setCapture())},releaseTarget:function(){i._capturedTarget&&(i._capturedTarget.releaseCapture(),i._capturedTarget=null)},triggerEvent:function(t,o,n,a){if(t){var r=null;return"function"==typeof Event?r=new Event(o,{bubbles:n,cancelable:a}):(r=e.document.createEvent("Event")).initEvent(o,n,a),!!r&&(i.setData(r,"internal",!0),t.dispatchEvent(r),!0)}},triggerInputEvent:function(e,t,o,n){e&&i.isTextInput(e)Line truncated
+1 -1
View File
@@ -1,2 +1,2 @@
/*! For license information please see CookieMonster.js.LICENSE.txt */ /*! For license information please see CookieMonster.js.LICENSE.txt */
(()=>{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,n,i,a=((i={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",i.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?i.node(o):e.document))throw new Error("Missing root node");for(var n=o.querySelectorAll(t),a=new RegExp("(^|\\s)("+i.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r<n.length;r+=1){var l,s;if(!(n[r].jscolor&&n[r].jscolor instanceof i.pub)&&(void 0===n[r].type||"color"!=n[r].type.toLowerCase()||!i.isColorAttrSupported)&&(null!==(l=i.getDataAttr(n[r],"jscolor"))||n[r].className&&(s=n[r].className.match(a)))){var c=n[r],d="";null!==l?d=l:s&&(console.warn('Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.'+i.docsRef),s[4]&&(d=s[4]));var p=null;if(d.trim())try{p=i.parseOptionsStr(d)}catch(e){console.warn(e+"\n"+d)}try{new i.pub(c,p)}catch(e){console.warn(e)}}}},parseOptionsStr:function(e){var t=null;try{t=JSON.parse(e)}catch(o){if(!i.pub.looseJSON)throw new Error("Could not parse jscolor options as JSON: "+o);try{t=new Function("var opts = ("+e+'); return typeof opts === "object" ? opts : {};')()}catch(e){throw new Error("Could not evaluate jscolor options: "+e)}}return t},getInstances:function(){for(var e=[],t=0;t<i.instances.length;t+=1)i.instances[t]&&i.instances[t].targetElement&&e.push(i.instances[t]);return e},createEl:function(t){var o=e.document.createElement(t);return i.setData(o,"gui",!0),o},node:function(t){if(!t)return null;if("string"==typeof t){var o=t,n=null;try{n=e.document.querySelector(o)}catch(e){return console.warn(e),null}return n||console.warn("No element matches the selector: %s",o),n}return i.isNode(t)?t:(console.warn("Invalid node of type %s: %s",typeof t,t),null)},isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},nodeName:function(e){return!(!e||!e.nodeName)&&e.nodeName.toLowerCase()},removeChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},isTextInput:function(e){return e&&"input"===i.nodeName(e)&&"text"===e.type.toLowerCase()},isButton:function(e){if(!e)return!1;var t=i.nodeName(e);return"button"===t||"input"===t&&["button","submit","reset"].indexOf(e.type.toLowerCase())>-1},isButtonEmpty:function(e){switch(i.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(n=e.document.createElement("input"),!(!n.setAttribute||(n.setAttribute("type","color"),"color"!=n.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={},o=arguments[2];return t[a=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={};var n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(i.dataProp))return!0;for(var t=1;t<arguments.length;t+=1){var o=arguments[t];delete e[i.dataProp][o]}return!0},getData:function(e,t,o){if(!e.hasOwnProperty(i.dataProp)){if(void 0===o)return;e[i.dataProp]={}}var n=e[i.dataProp];return n.hasOwnProperty(t)||void 0===o||(n[t]=o),n[t]},getDataAttr:function(e,t){var o="data-"+t;return e.getAttribute(o)},setDataAttr:function(e,t,o){var n="data-"+t;e.setAttribute(n,o)},_attachedGroupEvents:{},attachGroupEvent:function(e,t,o,n){i._attachedGroupEvents.hasOwnProperty(e)||(i._attachedGroupEvents[e]=[]),i._attachedGroupEvents[e].push([t,o,n]),t.addEventListener(o,n,!1)},detachGroupEvents:function(e){if(i._attachedGroupEvents.hasOwnProperty(e)){for(var t=0;t<i._attachedGroupEvents[e].length;t+=1){var o=i._attachedGroupEvents[e][t];o[0].removeEventListener(o[1],o[2],!1)}delete i._attachedGroupEvents[e]}},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(e){e.setCapture&&(i._capturedTarget=e,i._capturedTarget.setCapture())},releaseTarget:function(){i._capturedTarget&&(i._capturedTarget.releaseCapture(),i._capturedTarget=null)},triggerEvent:function(t,o,n,a){if(t){var r=null;return"function"==typeof Event?r=new Event(o,{bubbles:n,cancelable:a}):(r=e.document.createEvent("Event")).initEvent(o,n,a),!!r&&(i.setData(r,"internal",!0),t.dispatchEvent(r),!0)}},triggerInputEvent:function(e,t,o,n){e&&i.isTextInput(e)Line truncated (()=>{var e={877:function(e){!function(t,o){"use strict";"object"!=typeof e.exports?o(t):e.exports=t.document?o(t):function(e){if(!e.document)throw new Error("jscolor needs a window with document");return o(e)}}("undefined"!=typeof window?window:this,(function(e){"use strict";var t,o,n,i,a=((i={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",i.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?i.node(o):e.document))throw new Error("Missing root node");for(var n=o.querySelectorAll(t),a=new RegExp("(^|\\s)("+i.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r<n.length;r+=1){var l,s;if(!(n[r].jscolor&&n[r].jscolor instanceof i.pub)&&(void 0===n[r].type||"color"!=n[r].type.toLowerCase()||!i.isColorAttrSupported)&&(null!==(l=i.getDataAttr(n[r],"jscolor"))||n[r].className&&(s=n[r].className.match(a)))){var c=n[r],d="";null!==l?d=l:s&&(console.warn('Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.'+i.docsRef),s[4]&&(d=s[4]));var p=null;if(d.trim())try{p=i.parseOptionsStr(d)}catch(e){console.warn(e+"\n"+d)}try{new i.pub(c,p)}catch(e){console.warn(e)}}}},parseOptionsStr:function(e){var t=null;try{t=JSON.parse(e)}catch(o){if(!i.pub.looseJSON)throw new Error("Could not parse jscolor options as JSON: "+o);try{t=new Function("var opts = ("+e+'); return typeof opts === "object" ? opts : {};')()}catch(e){throw new Error("Could not evaluate jscolor options: "+e)}}return t},getInstances:function(){for(var e=[],t=0;t<i.instances.length;t+=1)i.instances[t]&&i.instances[t].targetElement&&e.push(i.instances[t]);return e},createEl:function(t){var o=e.document.createElement(t);return i.setData(o,"gui",!0),o},node:function(t){if(!t)return null;if("string"==typeof t){var o=t,n=null;try{n=e.document.querySelector(o)}catch(e){return console.warn(e),null}return n||console.warn("No element matches the selector: %s",o),n}return i.isNode(t)?t:(console.warn("Invalid node of type %s: %s",typeof t,t),null)},isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},nodeName:function(e){return!(!e||!e.nodeName)&&e.nodeName.toLowerCase()},removeChildren:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},isTextInput:function(e){return e&&"input"===i.nodeName(e)&&"text"===e.type.toLowerCase()},isButton:function(e){if(!e)return!1;var t=i.nodeName(e);return"button"===t||"input"===t&&["button","submit","reset"].indexOf(e.type.toLowerCase())>-1},isButtonEmpty:function(e){switch(i.nodeName(e)){case"input":return!e.value||""===e.value.trim();case"button":return""===e.textContent.trim()}return null},isPassiveEventSupported:function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassive",null,o),e.removeEventListener("testPassive",null,o)}catch(e){}return t}(),isColorAttrSupported:(n=e.document.createElement("input"),!(!n.setAttribute||(n.setAttribute("type","color"),"color"!=n.type.toLowerCase()))),dataProp:"_data_jscolor",setData:function(){var e=arguments[0];if(3===arguments.length){var t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={},o=arguments[2];return t[a=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(i.dataProp)?e[i.dataProp]:e[i.dataProp]={};var n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(i.dataProp))return!0;for(var t=1;t<arguments.length;t+=1){var o=arguments[t];delete e[i.dataProp][o]}return!0},getData:function(e,t,o){if(!e.hasOwnProperty(i.dataProp)){if(void 0===o)return;e[i.dataProp]={}}var n=e[i.dataProp];return n.hasOwnProperty(t)||void 0===o||(n[t]=o),n[t]},getDataAttr:function(e,t){var o="data-"+t;return e.getAttribute(o)},setDataAttr:function(e,t,o){var n="data-"+t;e.setAttribute(n,o)},_attachedGroupEvents:{},attachGroupEvent:function(e,t,o,n){i._attachedGroupEvents.hasOwnProperty(e)||(i._attachedGroupEvents[e]=[]),i._attachedGroupEvents[e].push([t,o,n]),t.addEventListener(o,n,!1)},detachGroupEvents:function(e){if(i._attachedGroupEvents.hasOwnProperty(e)){for(var t=0;t<i._attachedGroupEvents[e].length;t+=1){var o=i._attachedGroupEvents[e][t];o[0].removeEventListener(o[1],o[2],!1)}delete i._attachedGroupEvents[e]}},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(e){e.setCapture&&(i._capturedTarget=e,i._capturedTarget.setCapture())},releaseTarget:function(){i._capturedTarget&&(i._capturedTarget.releaseCapture(),i._capturedTarget=null)},triggerEvent:function(t,o,n,a){if(t){var r=null;return"function"==typeof Event?r=new Event(o,{bubbles:n,cancelable:a}):(r=e.document.createEvent("Event")).initEvent(o,n,a),!!r&&(i.setData(r,"internal",!0),t.dispatchEvent(r),!0)}},triggerInputEvent:function(e,t,o,n){e&&i.isTextInput(e)Line truncated
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["webpack://cookiemonster-mod/CookieMonster.js"],"names":["__webpack_modules__","877","module","global","factory","exports","document","win","Error","window","this","BoxShadow","funcName","elm","jsc","jscolor","initialized","instances","readyQueue","register","addEventListener","pub","init","installBySelector","selector","rootNode","node","elms","querySelectorAll","matchClass","RegExp","lookupClass","i","length","dataOpts","m","undefined","type","toLowerCase","isColorAttrSupported","getDataAttr","className","match","targetElm","optsStr","console","warn","docsRef","opts","trim","parseOptionsStr","e","str","JSON","parse","eParse","looseJSON","Function","eEval","getInstances","inst","targetElement","push","createEl","tagName","el","createElement","setData","nodeOrSelector","sel","querySelector","isNode","val","Node","nodeType","nodeName","removeChildren","firstChild","removeChild","isTextInput","isButton","n","indexOf","isButtonEmpty","value","textContent","isPassiveEventSupported","supported","Object","defineProperty","get","removeEventListener","setAttribute","dataProp","obj","arguments","data","hasOwnProperty","prop","map","removeData","getData","setDefault","name","attrName","getAttribute","setDataAttr","_attachedGroupEvents","attachGroupEvent","groupName","evnt","func","detachGroupEvents","evt","preventDefault","returnValue","captureTarget","target","setCapture","_capturedTarget","releaseTarget","releaseCapture","triggerEvent","eventName","bubbles","cancelable","ev","Event","createEvent","initEvent","dispatchEvent","triggerInputEvent","eventKey","keys","9","13","27","code","keyCode","strList","replace","split","hasClass","classList","contains","addClass","classNames","add","removeClass","repl","remove","getCompStyle","getComputedStyle","currentStyle","setStyle","styles","important","reversible","priority","origStyle","setVal","style","setProperty","hexColor","r","g","b","Math","round","toString","substr","toUpperCase","hexaColor","a","rgbColor","rgbaColor","linearGradient","stdName","prefixes","helper","tryFunc","tryVal","background","getFuncName","Array","prototype","join","call","setBorderRadius","border-radius","setBoxShadow","box-shadow","getElementPos","relativeToViewport","x","y","rect","getBoundingClientRect","left","top","viewPos","getViewPos","getElementSize","offsetWidth","offsetHeight","getAbsPointerPos","changedTouches","clientX","clientY","getRelPointerPos","targetRect","srcElement","doc","documentElement","pageXOffset","scrollLeft","clientLeft","pageYOffset","scrollTop","clientTop","getViewSize","innerWidth","clientWidth","innerHeight","clientHeight","RGB_HSV","min","v","max","h","HSV_RGB","s","u","floor","parseColorString","ret","rgba","format","parseInt","charAt","mR","mG","mB","mA","par","re","parseFloat","parsePaletteValue","mixed","vals","isArray","colors","color","containsTranparentColor","isAlphaFormat","scaleCanvasForHighDPR","canvas","dpr","devicePixelRatio","width","height","getContext","scale","genColorPreviewCanvas","separatorPos","specWidth","scaleForHighDPR","sepW","previewSeparator","sqSize","chessboardSize","sqColor1","chessboardColor1","sqColor2","chessboardColor2","cWidth","cHeight","ctx","fillStyle","fillRect","start","clearRect","lineWidth","beginPath","strokeStyle","moveTo","lineTo","stroke","genColorPreviewGradient","position","params","right","apply","redrawPosition","picker","owner","tp","vp","thisObj","fixed","c","ts","vs","pd","getPickerDims","ps","borderW","borderH","l","smartPosition","pp","positionValue","contractShadow","_drawPosition","vShadow","shadowBlur","wrap","boxS","shadow","shadowColor","w","controlBorderWidth","sliderSpace","getControlPadding","sliderSize","getSliderChannel","hasAlphaChannel","pal","getPaletteDims","padding","closeButton","buttonHeight","pW","pH","contentW","contentH","paddedW","paddedH","borderWidth","palette","cols","rows","cellW","cellH","sampleCount","_palette","paletteCols","ceil","paletteSpacing","paletteHeight","pointerBorderWidth","pointerThickness","getPadYChannel","mode","triggerCallback","callback","error","triggerGlobal","eventNames","trigger","_pointerMoveEvent","mouse","touch","_pointerEndEvent","_pointerOrigin","onDocumentKeyUp","tryHide","onWindowResize","onWindowScroll","onParentScroll","onDocumentMouseDown","showOnClick","disabled","show","onControlPointerStart","onPickerTouchStart","controlName","pointerType","registerDragEvents","offset","onDocumentPointerMove","onDocumentPointerEnd","parent","frameElement","ofs","abs","rel","channels","fromHSVA","setPad","setSld","setASld","onPaletteSampleClick","currentTarget","_setFormat","getFormat","paletteSetsAlpha","_paletteHasTransparency","fromRGBA","hideOnPaletteClick","hide","ofsX","ofsY","pointerAbs","xVal","yVal","fmt","createPadCanvas","draw","hGrad","createLinearGradient","addColorStop","vGrad","createSliderGradient","color1","color2","grad","createASliderGradient","hShadow","blur","spread","inset","flags","leaveValue","leaveAlpha","leavePreviewLine truncated {"version":3,"sources":["webpack://cookiemonster-mod/CookieMonster.js"],"names":["__webpack_modules__","877","module","global","factory","exports","document","win","Error","window","this","BoxShadow","funcName","elm","jsc","jscolor","initialized","instances","readyQueue","register","addEventListener","pub","init","installBySelector","selector","rootNode","node","elms","querySelectorAll","matchClass","RegExp","lookupClass","i","length","dataOpts","m","undefined","type","toLowerCase","isColorAttrSupported","getDataAttr","className","match","targetElm","optsStr","console","warn","docsRef","opts","trim","parseOptionsStr","e","str","JSON","parse","eParse","looseJSON","Function","eEval","getInstances","inst","targetElement","push","createEl","tagName","el","createElement","setData","nodeOrSelector","sel","querySelector","isNode","val","Node","nodeType","nodeName","removeChildren","firstChild","removeChild","isTextInput","isButton","n","indexOf","isButtonEmpty","value","textContent","isPassiveEventSupported","supported","Object","defineProperty","get","removeEventListener","setAttribute","dataProp","obj","arguments","data","hasOwnProperty","prop","map","removeData","getData","setDefault","name","attrName","getAttribute","setDataAttr","_attachedGroupEvents","attachGroupEvent","groupName","evnt","func","detachGroupEvents","evt","preventDefault","returnValue","captureTarget","target","setCapture","_capturedTarget","releaseTarget","releaseCapture","triggerEvent","eventName","bubbles","cancelable","ev","Event","createEvent","initEvent","dispatchEvent","triggerInputEvent","eventKey","keys","9","13","27","code","keyCode","strList","replace","split","hasClass","classList","contains","addClass","classNames","add","removeClass","repl","remove","getCompStyle","getComputedStyle","currentStyle","setStyle","styles","important","reversible","priority","origStyle","setVal","style","setProperty","hexColor","r","g","b","Math","round","toString","substr","toUpperCase","hexaColor","a","rgbColor","rgbaColor","linearGradient","stdName","prefixes","helper","tryFunc","tryVal","background","getFuncName","Array","prototype","join","call","setBorderRadius","border-radius","setBoxShadow","box-shadow","getElementPos","relativeToViewport","x","y","rect","getBoundingClientRect","left","top","viewPos","getViewPos","getElementSize","offsetWidth","offsetHeight","getAbsPointerPos","changedTouches","clientX","clientY","getRelPointerPos","targetRect","srcElement","doc","documentElement","pageXOffset","scrollLeft","clientLeft","pageYOffset","scrollTop","clientTop","getViewSize","innerWidth","clientWidth","innerHeight","clientHeight","RGB_HSV","min","v","max","h","HSV_RGB","s","u","floor","parseColorString","ret","rgba","format","parseInt","charAt","mR","mG","mB","mA","par","re","parseFloat","parsePaletteValue","mixed","vals","isArray","colors","color","containsTranparentColor","isAlphaFormat","scaleCanvasForHighDPR","canvas","dpr","devicePixelRatio","width","height","getContext","scale","genColorPreviewCanvas","separatorPos","specWidth","scaleForHighDPR","sepW","previewSeparator","sqSize","chessboardSize","sqColor1","chessboardColor1","sqColor2","chessboardColor2","cWidth","cHeight","ctx","fillStyle","fillRect","start","clearRect","lineWidth","beginPath","strokeStyle","moveTo","lineTo","stroke","genColorPreviewGradient","position","params","right","apply","redrawPosition","picker","owner","tp","vp","thisObj","fixed","c","ts","vs","pd","getPickerDims","ps","borderW","borderH","l","smartPosition","pp","positionValue","contractShadow","_drawPosition","vShadow","shadowBlur","wrap","boxS","shadow","shadowColor","w","controlBorderWidth","sliderSpace","getControlPadding","sliderSize","getSliderChannel","hasAlphaChannel","pal","getPaletteDims","padding","closeButton","buttonHeight","pW","pH","contentW","contentH","paddedW","paddedH","borderWidth","palette","cols","rows","cellW","cellH","sampleCount","_palette","paletteCols","ceil","paletteSpacing","paletteHeight","pointerBorderWidth","pointerThickness","getPadYChannel","mode","triggerCallback","callback","error","triggerGlobal","eventNames","trigger","_pointerMoveEvent","mouse","touch","_pointerEndEvent","_pointerOrigin","onDocumentKeyUp","tryHide","onWindowResize","onWindowScroll","onParentScroll","onDocumentMouseDown","showOnClick","disabled","show","onControlPointerStart","onPickerTouchStart","controlName","pointerType","registerDragEvents","offset","onDocumentPointerMove","onDocumentPointerEnd","parent","frameElement","ofs","abs","rel","channels","fromHSVA","setPad","setSld","setASld","onPaletteSampleClick","currentTarget","_setFormat","getFormat","paletteSetsAlpha","_paletteHasTransparency","fromRGBA","hideOnPaletteClick","hide","ofsX","ofsY","pointerAbs","xVal","yVal","fmt","createPadCanvas","draw","hGrad","createLinearGradient","addColorStop","vGrad","createSliderGradient","color1","color2","grad","createASliderGradient","hShadow","blur","spread","inset","flags","leaveValue","leaveAlpha","leavePreviewLine truncated
+5 -4
View File
@@ -34,12 +34,13 @@ export class CMAvgQueue {
* @returns {number} ret The average * @returns {number} ret The average
*/ */
calcAverage(timePeriod) { calcAverage(timePeriod) {
if (timePeriod > this.maxLength) timePeriod = this.maxLength; let time = timePeriod;
if (timePeriod > this.queue.length) timePeriod = this.queue.length; if (time > this.maxLength) time = this.maxLength;
if (time > this.queue.length) time = this.queue.length;
let ret = 0; let ret = 0;
for ( for (
let i = this.queue.length - 1; let i = this.queue.length - 1;
i >= 0 && i > this.queue.length - 1 - timePeriod; i >= 0 && i > this.queue.length - 1 - time;
i-- i--
) { ) {
ret += this.queue[i]; ret += this.queue[i];
@@ -47,7 +48,7 @@ export class CMAvgQueue {
if (ret === 0) { if (ret === 0) {
return 0; return 0;
} }
return ret / timePeriod; return ret / time;
} }
} }
+3 -3
View File
@@ -13,9 +13,9 @@ import {
export default function CacheCurrWrinklerCPS() { export default function CacheCurrWrinklerCPS() {
CacheCurrWrinklerCPSMult = 0; CacheCurrWrinklerCPSMult = 0;
let count = 0; let count = 0;
for (const i in Game.wrinklers) { Object.keys(Game.wrinklers).forEach((i) => {
if (Game.wrinklers[i].phase === 2) count++; if (Game.wrinklers[i].phase === 2) count += 1;
} });
let godMult = 1; let godMult = 1;
if (SimObjects.Temple.minigameLoaded) { if (SimObjects.Temple.minigameLoaded) {
const godLvl = Game.hasGod('scorn'); const godLvl = Game.hasGod('scorn');
+2 -2
View File
@@ -4,9 +4,9 @@
*/ */
export default function GetCPSBuffMult() { export default function GetCPSBuffMult() {
let mult = 1; let mult = 1;
for (const i of Object.keys(Game.buffs)) { Object.keys(Game.buffs).forEach((i) => {
if (typeof Game.buffs[i].multCpS !== 'undefined') if (typeof Game.buffs[i].multCpS !== 'undefined')
mult *= Game.buffs[i].multCpS; mult *= Game.buffs[i].multCpS;
} });
return mult; return mult;
} }
+2 -2
View File
@@ -13,10 +13,10 @@ export default function CacheSellAllForChoEgg() {
if (Game.Objects.Bank.minigameLoaded) { if (Game.Objects.Bank.minigameLoaded) {
const marketGoods = Game.Objects.Bank.minigame.goods; const marketGoods = Game.Objects.Bank.minigame.goods;
let goodsVal = 0; let goodsVal = 0;
for (const i of Object.keys(marketGoods)) { Object.keys(marketGoods).forEach((i) => {
const marketGood = marketGoods[i]; const marketGood = marketGoods[i];
goodsVal += marketGood.stock * marketGood.val; goodsVal += marketGood.stock * marketGood.val;
} });
sellTotal += goodsVal * Game.cookiesPsRawHighest; sellTotal += goodsVal * Game.cookiesPsRawHighest;
} }
// Compute cookies earned by selling all buildings with optimal auras (ES + RB) // Compute cookies earned by selling all buildings with optimal auras (ES + RB)
+3 -2
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
/** Functions related to the Dragon */ /** Functions related to the Dragon */
@@ -44,7 +45,7 @@ export default function CacheDragonCost() {
price = Game.modifyBuildingPrice(SimObjects[target], price); price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price); price = Math.ceil(price);
cost += price; cost += price;
SimObjects[target].amount--; SimObjects[target].amount -= 1;
} }
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`; CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
} }
@@ -68,7 +69,7 @@ export default function CacheDragonCost() {
price = Game.modifyBuildingPrice(SimObjects[target], price); price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price); price = Math.ceil(price);
cost += price; cost += price;
SimObjects[target].amount--; SimObjects[target].amount -= 1;
} }
} }
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
+11 -10
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
@@ -19,7 +20,7 @@ import ColourOfPP from './ColourOfPP';
* It is called by CM.Cache.CacheBuildingsPP() * It is called by CM.Cache.CacheBuildingsPP()
*/ */
function CacheBuildingsBulkPP(target) { function CacheBuildingsBulkPP(target) {
for (const i of Object.keys(target)) { Object.keys(target).forEach((i) => {
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = target[i].pp =
Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) / Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) /
@@ -28,7 +29,7 @@ function CacheBuildingsBulkPP(target) {
} else target[i].pp = target[i].price / target[i].bonus; } else target[i].pp = target[i].price / target[i].bonus;
target[i].color = ColourOfPP(target[i], target[i].price); target[i].color = ColourOfPP(target[i], target[i].price);
} });
} }
/** /**
@@ -43,7 +44,7 @@ export default function CacheBuildingsPP() {
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode // Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) { if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) {
for (const i of Object.keys(CacheObjects1)) { Object.keys(CacheObjects1).forEach((i) => {
if (Game.cookiesPs) { if (Game.cookiesPs) {
CacheObjects1[i].pp = CacheObjects1[i].pp =
Math.max( Math.max(
@@ -56,7 +57,7 @@ export default function CacheBuildingsPP() {
CacheObjects1[i].pp = CacheObjects1[i].pp =
Game.Objects[i].getPrice() / CacheObjects1[i].bonus; Game.Objects[i].getPrice() / CacheObjects1[i].bonus;
CacheArrayOfPPs.push([CacheObjects1[i].pp, Game.Objects[i].getPrice()]); CacheArrayOfPPs.push([CacheObjects1[i].pp, Game.Objects[i].getPrice()]);
} });
// Set CM.Cache.min to best non-excluded buidliung // Set CM.Cache.min to best non-excluded buidliung
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]); CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
if (CMOptions.PPOnlyConsiderBuyable) { if (CMOptions.PPOnlyConsiderBuyable) {
@@ -70,7 +71,7 @@ export default function CacheBuildingsPP() {
CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0]; CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0];
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0]; CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP; CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
for (const i of Object.keys(CacheObjects1)) { Object.keys(CacheObjects1).forEach((i) => {
CacheObjects1[i].color = ColourOfPP( CacheObjects1[i].color = ColourOfPP(
CacheObjects1[i], CacheObjects1[i],
Game.Objects[i].getPrice(), Game.Objects[i].getPrice(),
@@ -80,7 +81,7 @@ export default function CacheBuildingsPP() {
if (CacheObjects1[i].pp === CacheArrayOfPPs[j][0]) if (CacheObjects1[i].pp === CacheArrayOfPPs[j][0])
CacheObjects1[i].color = ColorGray; CacheObjects1[i].color = ColorGray;
} }
} });
// Calculate PP of bulk-buy modes // Calculate PP of bulk-buy modes
CacheBuildingsBulkPP(CacheObjects10); CacheBuildingsBulkPP(CacheObjects10);
CacheBuildingsBulkPP(CacheObjects100); CacheBuildingsBulkPP(CacheObjects100);
@@ -90,7 +91,7 @@ export default function CacheBuildingsPP() {
if (Game.buyBulk === 1) target = CacheObjects1; if (Game.buyBulk === 1) target = CacheObjects1;
else if (Game.buyBulk === 10) target = CacheObjects10; else if (Game.buyBulk === 10) target = CacheObjects10;
else if (Game.buyBulk === 100) target = CacheObjects100; else if (Game.buyBulk === 100) target = CacheObjects100;
for (const i of Object.keys(target)) { Object.keys(target).forEach((i) => {
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = target[i].pp =
Math.max( Math.max(
@@ -101,7 +102,7 @@ export default function CacheBuildingsPP() {
Game.Objects[i].bulkPrice / target[i].bonus; Game.Objects[i].bulkPrice / target[i].bonus;
} else target[i].pp = Game.Objects[i].bulkPrice / target[i].bonus; } else target[i].pp = Game.Objects[i].bulkPrice / target[i].bonus;
CacheArrayOfPPs.push([target[i].pp, Game.Objects[i].bulkPrice]); CacheArrayOfPPs.push([target[i].pp, Game.Objects[i].bulkPrice]);
} });
// Set CM.Cache.min to best non-excluded buidliung // Set CM.Cache.min to best non-excluded buidliung
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]); CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
if (CMOptions.PPOnlyConsiderBuyable) { if (CMOptions.PPOnlyConsiderBuyable) {
@@ -116,12 +117,12 @@ export default function CacheBuildingsPP() {
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0]; CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP; CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
for (const i of Object.keys(CacheObjects1)) { Object.keys(CacheObjects1).forEach((i) => {
target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice); target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice);
// Colour based on excluding certain top-buildings // Colour based on excluding certain top-buildings
for (let j = 0; j < CMOptions.PPExcludeTop; j++) { for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray; if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray;
} }
} });
} }
} }
+2 -2
View File
@@ -7,7 +7,7 @@ import ColourOfPP from './ColourOfPP';
* It is called by CM.Cache.CachePP() * It is called by CM.Cache.CachePP()
*/ */
export default function CacheUpgradePP() { export default function CacheUpgradePP() {
for (const i of Object.keys(CacheUpgrades)) { Object.keys(CacheUpgrades).forEach((i) => {
if (Game.cookiesPs) { if (Game.cookiesPs) {
CacheUpgrades[i].pp = CacheUpgrades[i].pp =
Math.max( Math.max(
@@ -25,5 +25,5 @@ export default function CacheUpgradePP() {
CacheUpgrades[i], CacheUpgrades[i],
Game.Upgrades[i].getPrice(), Game.Upgrades[i].getPrice(),
); );
} });
} }
+6 -6
View File
@@ -20,13 +20,13 @@ import {
*/ */
function CacheBuildingIncome(amount, target) { function CacheBuildingIncome(amount, target) {
const result = []; const result = [];
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
result[i] = {}; result[i] = {};
result[i].bonus = BuyBuildingsBonusIncome(i, amount); result[i].bonus = BuyBuildingsBonusIncome(i, amount);
if (amount !== 1) { if (amount !== 1) {
CacheDoRemakeBuildPrices = 1; CacheDoRemakeBuildPrices = 1;
} }
} });
return result; return result;
} }
@@ -36,19 +36,19 @@ function CacheBuildingIncome(amount, target) {
*/ */
function CacheUpgradeIncome() { function CacheUpgradeIncome() {
CacheUpgrades = []; CacheUpgrades = [];
for (const i of Object.keys(Game.Upgrades)) { Object.keys(Game.Upgrades).forEach((i) => {
const bonusIncome = BuyUpgradesBonusIncome(i); const bonusIncome = BuyUpgradesBonusIncome(i);
CacheUpgrades[i] = {}; CacheUpgrades[i] = {};
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0]; if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1]; if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
} });
} }
/** /**
* This functions caches the price of each building and stores it in the cache * This functions caches the price of each building and stores it in the cache
*/ */
export function CacheBuildingsPrices() { export function CacheBuildingsPrices() {
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
CacheObjects1[i].price = BuildingGetPrice( CacheObjects1[i].price = BuildingGetPrice(
Game.Objects[i], Game.Objects[i],
Game.Objects[i].basePrice, Game.Objects[i].basePrice,
@@ -70,7 +70,7 @@ export function CacheBuildingsPrices() {
Game.Objects[i].free, Game.Objects[i].free,
100, 100,
); );
} });
} }
/** /**
+1 -1
View File
@@ -51,7 +51,7 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
); );
nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult); nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult);
totalFromChain += moni; totalFromChain += moni;
chain++; chain += 1;
} }
return [totalFromChain, moni, nextRequired]; return [totalFromChain, moni, nextRequired];
} }
+4 -4
View File
@@ -19,9 +19,9 @@ export default function CacheAllMissingUpgrades() {
CacheMissingUpgradesPrestige = ''; CacheMissingUpgradesPrestige = '';
const list = []; const list = [];
// sort the upgrades // sort the upgrades
for (const i of Object.keys(Game.Upgrades)) { Object.keys(Game.Upgrades).forEach((i) => {
list.push(Game.Upgrades[i]); list.push(Game.Upgrades[i]);
} });
const sortMap = function (a, b) { const sortMap = function (a, b) {
if (a.order > b.order) return 1; if (a.order > b.order) return 1;
if (a.order < b.order) return -1; if (a.order < b.order) return -1;
@@ -29,7 +29,7 @@ export default function CacheAllMissingUpgrades() {
}; };
list.sort(sortMap); list.sort(sortMap);
for (const i of Object.keys(list)) { Object.keys(list).forEach((i) => {
const me = list[i]; const me = list[i];
if (me.bought === 0) { if (me.bought === 0) {
@@ -45,5 +45,5 @@ export default function CacheAllMissingUpgrades() {
) )
CacheMissingUpgrades += str; CacheMissingUpgrades += str;
} }
} });
} }
+5 -5
View File
@@ -42,11 +42,11 @@ export function CacheStatsCookies() {
CacheEdifice = 0; CacheEdifice = 0;
let max = 0; let max = 0;
let n = 0; let n = 0;
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount; if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
if (Game.Objects[i].amount > 0) n++; if (Game.Objects[i].amount > 0) n += 1;
} });
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
if ( if (
(Game.Objects[i].amount < max || n === 1) && (Game.Objects[i].amount < max || n === 1) &&
Game.Objects[i].amount < 400 && Game.Objects[i].amount < 400 &&
@@ -55,7 +55,7 @@ export function CacheStatsCookies() {
CacheEdifice = Game.Objects[i].price * 2; CacheEdifice = Game.Objects[i].price * 2;
CacheEdificeBuilding = i; CacheEdificeBuilding = i;
} }
} });
} }
/** /**
+1 -1
View File
@@ -20,7 +20,7 @@ export default function CacheWrinklers() {
CacheWrinklersNormal = 0; CacheWrinklersNormal = 0;
CacheWrinklersFattest = [0, null]; CacheWrinklersFattest = [0, null];
for (let i = 0; i < Game.wrinklers.length; i++) { for (let i = 0; i < Game.wrinklers.length; i++) {
let sucked = Game.wrinklers[i].sucked; let { sucked } = Game.wrinklers[i];
let toSuck = 1.1; let toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
@@ -1,5 +1,5 @@
import { default as ConfigDefault } from '../../Data/SettingsDefault'; import ConfigDefault from '../../Data/SettingsDefault';
import { default as ConfigData } from '../../Data/SettingsData'; import ConfigData from '../../Data/SettingsData';
import { CMOptions } from '../VariablesAndData'; import { CMOptions } from '../VariablesAndData';
import save from '../../InitSaveLoad/save'; import save from '../../InitSaveLoad/save';
import CMLoop from '../../Main/Loop'; import CMLoop from '../../Main/Loop';
@@ -43,7 +43,7 @@ export function LoadConfig(settings) {
// Check values // Check values
let mod = false; let mod = false;
for (const i in ConfigDefault) { Object.keys(ConfigDefault).forEach((i) => {
if (typeof CMOptions[i] === 'undefined') { if (typeof CMOptions[i] === 'undefined') {
mod = true; mod = true;
CMOptions[i] = ConfigDefault[i]; CMOptions[i] = ConfigDefault[i];
@@ -61,7 +61,7 @@ export function LoadConfig(settings) {
CMOptions[i] = ConfigDefault[i]; CMOptions[i] = ConfigDefault[i];
} }
} else if (i === 'Header') { } else if (i === 'Header') {
for (const j in ConfigDefault.Header) { Object.keys(ConfigDefault.Header).forEach((j) => {
if ( if (
typeof CMOptions[i][j] === 'undefined' || typeof CMOptions[i][j] === 'undefined' ||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2) !(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
@@ -69,10 +69,10 @@ export function LoadConfig(settings) {
mod = true; mod = true;
CMOptions[i][j] = ConfigDefault[i][j]; CMOptions[i][j] = ConfigDefault[i][j];
} }
} });
} else { } else {
// Colors // Colors
for (const j in ConfigDefault.Colors) { Object.keys(ConfigDefault.Colors).forEach((j) => {
if ( if (
typeof CMOptions[i][j] === 'undefined' || typeof CMOptions[i][j] === 'undefined' ||
typeof CMOptions[i][j] !== 'string' typeof CMOptions[i][j] !== 'string'
@@ -80,16 +80,16 @@ export function LoadConfig(settings) {
mod = true; mod = true;
CMOptions[i][j] = ConfigDefault[i][j]; CMOptions[i][j] = ConfigDefault[i][j];
} }
} });
} }
} });
if (mod) SaveConfig(); if (mod) SaveConfig();
CMLoop(); // Do loop once CMLoop(); // Do loop once
for (const i in ConfigDefault) { Object.keys(ConfigDefault).forEach((i) => {
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') { if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
ConfigData[i].func(); ConfigData[i].func();
} }
} });
} else { } else {
// Default values // Default values
LoadConfig(ConfigDefault); LoadConfig(ConfigDefault);
+3 -3
View File
@@ -1,4 +1,4 @@
import { default as ConfigData } from '../Data/SettingsData'; import ConfigData from '../Data/SettingsData';
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings'; import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
import { CMOptions } from './VariablesAndData'; import { CMOptions } from './VariablesAndData';
@@ -13,7 +13,7 @@ export const ConfigPrefix = 'CMConfig';
* @param {string} config The name of the option * @param {string} config The name of the option
*/ */
export function ToggleConfig(config) { export function ToggleConfig(config) {
CMOptions[config]++; CMOptions[config] += 1;
if (CMOptions[config] === ConfigData[config].label.length) { if (CMOptions[config] === ConfigData[config].label.length) {
CMOptions[config] = 0; CMOptions[config] = 0;
@@ -49,7 +49,7 @@ export function ToggleConfigVolume(config) {
* @param {string} config The name of the header * @param {string} config The name of the header
*/ */
export function ToggleHeader(config) { export function ToggleHeader(config) {
CMOptions.Header[config]++; CMOptions.Header[config] += 1;
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0; if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
SaveConfig(); SaveConfig();
} }
+4 -3
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-return-assign */
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
import { GCTimers } from '../../Disp/VariablesAndData'; import { GCTimers } from '../../Disp/VariablesAndData';
import { CMOptions } from '../VariablesAndData'; import { CMOptions } from '../VariablesAndData';
@@ -8,12 +9,12 @@ import { CMOptions } from '../VariablesAndData';
*/ */
export default function ToggleGCTimer() { export default function ToggleGCTimer() {
if (CMOptions.GCTimer === 1) { if (CMOptions.GCTimer === 1) {
for (const i of Object.keys(GCTimers)) { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.display = 'block'; GCTimers[i].style.display = 'block';
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left; GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top; GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
} });
} else { } else {
for (const i of Object.keys(GCTimers)) GCTimers[i].style.display = 'none'; Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
} }
} }
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
/** General functions to format or beautify strings */ /** General functions to format or beautify strings */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
@@ -93,23 +94,25 @@ export function Beautify(num, floats, forced) {
* @returns {string} Formatted time * @returns {string} Formatted time
*/ */
export function FormatTime(time, longFormat) { export function FormatTime(time, longFormat) {
let formattedTime = time;
if (time === Infinity) return time; if (time === Infinity) return time;
time = Math.ceil(time); formattedTime = Math.ceil(time);
const y = Math.floor(time / 31557600); const y = Math.floor(formattedTime / 31557600);
const d = Math.floor((time % 31557600) / 86400); const d = Math.floor((formattedTime % 31557600) / 86400);
const h = Math.floor((time % 86400) / 3600); const h = Math.floor((formattedTime % 86400) / 3600);
const m = Math.floor((time % 3600) / 60); const m = Math.floor((formattedTime % 3600) / 60);
const s = Math.floor(time % 60); const s = Math.floor(formattedTime % 60);
let str = ''; let str = '';
if (CMOptions.TimeFormat) { if (CMOptions.TimeFormat) {
if (time > 3155760000) return 'XX:XX:XX:XX:XX'; if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
str += `${(y < 10 ? '0' : '') + y}:`; str += `${(y < 10 ? '0' : '') + y}:`;
str += `${(d < 10 ? '0' : '') + d}:`; str += `${(d < 10 ? '0' : '') + d}:`;
str += `${(h < 10 ? '0' : '') + h}:`; str += `${(h < 10 ? '0' : '') + h}:`;
str += `${(m < 10 ? '0' : '') + m}:`; str += `${(m < 10 ? '0' : '') + m}:`;
str += (s < 10 ? '0' : '') + s; str += (s < 10 ? '0' : '') + s;
} else { } else {
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d'; if (formattedTime > 777600000)
return longFormat ? 'Over 9000 days!' : '>9000d';
str += str +=
y > 0 y > 0
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
+7 -6
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import { import {
CacheObjects1, CacheObjects1,
CacheObjects10, CacheObjects10,
@@ -30,17 +31,17 @@ export default function UpdateBuildings() {
if (Game.buyMode === 1) { if (Game.buyMode === 1) {
if (CMOptions.BuildColor === 1) { if (CMOptions.BuildColor === 1) {
for (const i of Object.keys(target)) { Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color = l(`productPrice${Game.Objects[i].id}`).style.color =
CMOptions.Colors[target[i].color]; CMOptions.Colors[target[i].color];
} });
} else { } else {
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color'); l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
} });
} }
} else if (Game.buyMode === -1) { } else if (Game.buyMode === -1) {
for (const i of Object.keys(CacheObjects1)) { Object.keys(CacheObjects1).forEach((i) => {
const o = Game.Objects[i]; const o = Game.Objects[i];
l(`productPrice${o.id}`).style.color = ''; l(`productPrice${o.id}`).style.color = '';
/* /*
@@ -54,7 +55,7 @@ export default function UpdateBuildings() {
l(`productPrice${o.id}`).innerHTML = Beautify( l(`productPrice${o.id}`).innerHTML = Beautify(
BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1), BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1),
); );
} });
} }
// Build array of pointers, sort by pp, use array index (+2) as the grid row number // Build array of pointers, sort by pp, use array index (+2) as the grid row number
+13 -12
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import { CacheUpgrades } from '../../Cache/VariablesAndData'; import { CacheUpgrades } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
@@ -29,10 +30,10 @@ export default function UpdateUpgrades() {
let purple = 0; let purple = 0;
let gray = 0; let gray = 0;
for (const i of Object.keys(Game.UpgradesInStore)) { Object.keys(Game.UpgradesInStore).forEach((i) => {
const me = Game.UpgradesInStore[i]; const me = Game.UpgradesInStore[i];
let addedColor = false; let addedColor = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j++) { for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if ( if (
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1 l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
) { ) {
@@ -49,14 +50,14 @@ export default function UpdateUpgrades() {
div.className = ColorBackPre + CacheUpgrades[me.name].color; div.className = ColorBackPre + CacheUpgrades[me.name].color;
l(`upgrade${i}`).appendChild(div); l(`upgrade${i}`).appendChild(div);
} }
if (CacheUpgrades[me.name].color === ColorBlue) blue++; if (CacheUpgrades[me.name].color === ColorBlue) blue += 1;
else if (CacheUpgrades[me.name].color === ColorGreen) green++; else if (CacheUpgrades[me.name].color === ColorGreen) green += 1;
else if (CacheUpgrades[me.name].color === ColorYellow) yellow++; else if (CacheUpgrades[me.name].color === ColorYellow) yellow += 1;
else if (CacheUpgrades[me.name].color === ColorOrange) orange++; else if (CacheUpgrades[me.name].color === ColorOrange) orange += 1;
else if (CacheUpgrades[me.name].color === ColorRed) red++; else if (CacheUpgrades[me.name].color === ColorRed) red += 1;
else if (CacheUpgrades[me.name].color === ColorPurple) purple++; else if (CacheUpgrades[me.name].color === ColorPurple) purple += 1;
else if (CacheUpgrades[me.name].color === ColorGray) gray++; else if (CacheUpgrades[me.name].color === ColorGray) gray += 1;
} });
l('CMUpgradeBarBlue').textContent = blue; l('CMUpgradeBarBlue').textContent = blue;
l('CMUpgradeBarGreen').textContent = green; l('CMUpgradeBarGreen').textContent = green;
@@ -70,7 +71,7 @@ export default function UpdateUpgrades() {
const arr = []; const arr = [];
// Build array of pointers, sort by pp, set flex positions // Build array of pointers, sort by pp, set flex positions
// This regulates sorting of upgrades // This regulates sorting of upgrades
for (let x = 0; x < Game.UpgradesInStore.length; x++) { for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
const o = {}; const o = {};
o.name = Game.UpgradesInStore[x].name; o.name = Game.UpgradesInStore[x].name;
o.price = Game.UpgradesInStore[x].basePrice; o.price = Game.UpgradesInStore[x].basePrice;
@@ -95,7 +96,7 @@ export default function UpdateUpgrades() {
const nameChecker = function (arr2, upgrade) { const nameChecker = function (arr2, upgrade) {
return arr2.findIndex((e) => e.name === upgrade.name); return arr2.findIndex((e) => e.name === upgrade.name);
}; };
for (let x = 0; x < Game.UpgradesInStore.length; x++) { for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
l(`upgrade${x}`).style.order = l(`upgrade${x}`).style.order =
nameChecker(arr, Game.UpgradesInStore[x]) + 1; nameChecker(arr, Game.UpgradesInStore[x]) + 1;
} }
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
/** Section: Functions related to the Golden Cookie Timers */ /** Section: Functions related to the Golden Cookie Timers */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
@@ -10,11 +10,11 @@ export default function CalculateGrimoireRefillTime(
maxMagic, maxMagic,
targetMagic, targetMagic,
) { ) {
let magic = currentMagic;
let count = 0; let count = 0;
while (currentMagic < targetMagic) { while (magic < targetMagic) {
currentMagic += magic += Math.max(0.002, (magic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
Math.max(0.002, (currentMagic / Math.max(maxMagic, 100)) ** 0.5) * 0.002; count += 1;
count++;
} }
return count / Game.fps; return count / Game.fps;
} }
+2 -2
View File
@@ -3,9 +3,9 @@
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats() * It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
*/ */
export default function PopAllNormalWrinklers() { export default function PopAllNormalWrinklers() {
for (const i of Object.keys(Game.wrinklers)) { Object.keys(Game.wrinklers).forEach((i) => {
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) { if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
Game.wrinklers[i].hp = 0; Game.wrinklers[i].hp = 0;
} }
} });
} }
+5 -5
View File
@@ -63,9 +63,9 @@ export function CreateBotBar() {
l('wrapper').appendChild(BotBar); l('wrapper').appendChild(BotBar);
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
CreateBotBarBuildingColumn(i); CreateBotBarBuildingColumn(i);
} });
} }
/** /**
@@ -74,7 +74,7 @@ export function CreateBotBar() {
export function UpdateBotBar() { export function UpdateBotBar() {
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) { if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
let count = 0; let count = 0;
for (const i of Object.keys(CacheObjects1)) { Object.keys(CacheObjects1).forEach((i) => {
let target = Game.buyBulk; let target = Game.buyBulk;
if (Game.buyMode === 1) { if (Game.buyMode === 1) {
LastTargetBotBar = target; LastTargetBotBar = target;
@@ -84,7 +84,7 @@ export function UpdateBotBar() {
if (target === 1) target = CacheObjects1; if (target === 1) target = CacheObjects1;
if (target === 10) target = CacheObjects10; if (target === 10) target = CacheObjects10;
if (target === 100) target = CacheObjects100; if (target === 100) target = CacheObjects100;
count++; count += 1;
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[ l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
count count
].childNodes[1].textContent = Game.Objects[i].amount; ].childNodes[1].textContent = Game.Objects[i].amount;
@@ -115,6 +115,6 @@ export function UpdateBotBar() {
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[ l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count count
].textContent = timeColor.text; ].textContent = timeColor.text;
} });
} }
} }
+7 -7
View File
@@ -105,7 +105,7 @@ export function UpdateTimerBar() {
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
Game.fps, Game.fps,
); );
numberOfTimers++; numberOfTimers += 1;
} else l('CMTimerBarGC').style.display = 'none'; } else l('CMTimerBarGC').style.display = 'none';
// Regulates visibility of Reindeer timer // Regulates visibility of Reindeer timer
@@ -152,7 +152,7 @@ export function UpdateTimerBar() {
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
Game.fps, Game.fps,
); );
numberOfTimers++; numberOfTimers += 1;
} else { } else {
l('CMTimerBarRen').style.display = 'none'; l('CMTimerBarRen').style.display = 'none';
} }
@@ -160,7 +160,7 @@ export function UpdateTimerBar() {
// On every frame all buff-timers are deleted and re-created // On every frame all buff-timers are deleted and re-created
const BuffTimerBars = {}; const BuffTimerBars = {};
l('CMTimerBarBuffTimers').innerHTML = ''; l('CMTimerBarBuffTimers').innerHTML = '';
for (const i of Object.keys(Game.buffs)) { Object.keys(Game.buffs).forEach((i) => {
if (Game.buffs[i]) { if (Game.buffs[i]) {
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [ const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [
{ id: `${Game.buffs[i].name}Bar` }, { id: `${Game.buffs[i].name}Bar` },
@@ -187,13 +187,13 @@ export function UpdateTimerBar() {
timer.lastChild.children[2].textContent = Math.ceil( timer.lastChild.children[2].textContent = Math.ceil(
Game.buffs[i].time / Game.fps, Game.buffs[i].time / Game.fps,
); );
numberOfTimers++; numberOfTimers += 1;
BuffTimerBars[Game.buffs[i].name] = timer; BuffTimerBars[Game.buffs[i].name] = timer;
} }
} });
for (const i of Object.keys(BuffTimerBars)) { Object.keys(BuffTimerBars).forEach((i) => {
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]); l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
} });
if (numberOfTimers !== 0) { if (numberOfTimers !== 0) {
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`; l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
+14 -14
View File
@@ -112,47 +112,47 @@ export default function AddMenuStats(title) {
let specDisp = false; let specDisp = false;
const missingHalloweenCookies = []; const missingHalloweenCookies = [];
for (const i of Object.keys(GameData.HalloCookies)) { Object.keys(GameData.HalloCookies).forEach((i) => {
if (!Game.Has(GameData.HalloCookies[i])) { if (!Game.Has(GameData.HalloCookies[i])) {
missingHalloweenCookies.push(GameData.HalloCookies[i]); missingHalloweenCookies.push(GameData.HalloCookies[i]);
specDisp = true; specDisp = true;
} }
} });
const missingChristmasCookies = []; const missingChristmasCookies = [];
for (const i of Object.keys(GameData.ChristCookies)) { Object.keys(GameData.ChristCookies).forEach((i) => {
if (!Game.Has(GameData.ChristCookies[i])) { if (!Game.Has(GameData.ChristCookies[i])) {
missingChristmasCookies.push(GameData.ChristCookies[i]); missingChristmasCookies.push(GameData.ChristCookies[i]);
specDisp = true; specDisp = true;
} }
} });
const missingValentineCookies = []; const missingValentineCookies = [];
for (const i of Object.keys(GameData.ValCookies)) { Object.keys(GameData.ValCookies).forEach((i) => {
if (!Game.Has(GameData.ValCookies[i])) { if (!Game.Has(GameData.ValCookies[i])) {
missingValentineCookies.push(GameData.ValCookies[i]); missingValentineCookies.push(GameData.ValCookies[i]);
specDisp = true; specDisp = true;
} }
} });
const missingNormalEggs = []; const missingNormalEggs = [];
for (const i of Object.keys(Game.eggDrops)) { Object.keys(Game.eggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.eggDrops[i])) { if (!Game.HasUnlocked(Game.eggDrops[i])) {
missingNormalEggs.push(Game.eggDrops[i]); missingNormalEggs.push(Game.eggDrops[i]);
specDisp = true; specDisp = true;
} }
} });
const missingRareEggs = []; const missingRareEggs = [];
for (const i of Object.keys(Game.rareEggDrops)) { Object.keys(Game.rareEggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.rareEggDrops[i])) { if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
missingRareEggs.push(Game.rareEggDrops[i]); missingRareEggs.push(Game.rareEggDrops[i]);
specDisp = true; specDisp = true;
} }
} });
const missingPlantDrops = []; const missingPlantDrops = [];
for (const i of Object.keys(GameData.PlantDrops)) { Object.keys(GameData.PlantDrops).forEach((i) => {
if (!Game.HasUnlocked(GameData.PlantDrops[i])) { if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
missingPlantDrops.push(GameData.PlantDrops[i]); missingPlantDrops.push(GameData.PlantDrops[i]);
specDisp = true; specDisp = true;
} }
} });
const choEgg = const choEgg =
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'); Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg'); const centEgg = Game.Has('Century egg');
@@ -266,11 +266,11 @@ export default function AddMenuStats(title) {
); );
if (Game.Has('Fortune cookies')) { if (Game.Has('Fortune cookies')) {
const fortunes = []; const fortunes = [];
for (const i of Object.keys(GameData.Fortunes)) { Object.keys(GameData.Fortunes).forEach((i) => {
if (!Game.Has(GameData.Fortunes[i])) { if (!Game.Has(GameData.Fortunes[i])) {
fortunes.push(GameData.Fortunes[i]); fortunes.push(GameData.Fortunes[i]);
} }
} });
if (fortunes.length !== 0) if (fortunes.length !== 0)
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
+2 -2
View File
@@ -106,12 +106,12 @@ export function StatsMissDisp(theMissDisp) {
title.style.textAlign = 'center'; title.style.textAlign = 'center';
title.textContent = 'Missing'; title.textContent = 'Missing';
missing.appendChild(title); missing.appendChild(title);
for (const i of Object.keys(theMissDisp)) { Object.keys(theMissDisp).forEach((i) => {
const div = document.createElement('div'); const div = document.createElement('div');
div.style.textAlign = 'center'; div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theMissDisp[i])); div.appendChild(document.createTextNode(theMissDisp[i]));
missing.appendChild(div); missing.appendChild(div);
} });
placeholder.appendChild(missing); placeholder.appendChild(missing);
span.onmouseover = function () { span.onmouseover = function () {
Game.tooltip.draw(this, escape(placeholder.innerHTML)); Game.tooltip.draw(this, escape(placeholder.innerHTML));
@@ -10,7 +10,7 @@ import {
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades * This function creates the missing upgrades sections for prestige, normal and cookie upgrades
*/ */
export function AddMissingUpgrades() { export function AddMissingUpgrades() {
for (const menuSection of l('menu').children) { l('menu').childNodes.forEach((menuSection) => {
if (menuSection.children[0]) { if (menuSection.children[0]) {
if ( if (
menuSection.children[0].innerHTML === 'Prestige' && menuSection.children[0].innerHTML === 'Prestige' &&
@@ -82,7 +82,7 @@ export function AddMissingUpgrades() {
} }
} }
} }
} });
} }
/** /**
@@ -99,7 +99,7 @@ export function crateMissing(me) {
if (!Game.prefs.crates) noFrame = 1; if (!Game.prefs.crates) noFrame = 1;
if (noFrame) classes += ' noFrame'; if (noFrame) classes += ' noFrame';
let icon = me.icon; let { icon } = me;
if (me.iconFunction) icon = me.iconFunction(); if (me.iconFunction) icon = me.iconFunction();
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`; const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
return `<div class="${classes}" return `<div class="${classes}"
+9 -9
View File
@@ -170,7 +170,7 @@ function CreatePrefOption(config) {
SaveConfig(); SaveConfig();
Game.UpdateMenu(); Game.UpdateMenu();
}; };
new JsColor(input, { hash: true, position: 'right', onInput: change }); JsColor(input, { hash: true, position: 'right', onInput: change });
const label = document.createElement('label'); const label = document.createElement('label');
label.textContent = Config.Colors.desc[Colors[i]]; label.textContent = Config.Colors.desc[Colors[i]];
innerDiv.appendChild(label); innerDiv.appendChild(label);
@@ -216,14 +216,14 @@ export default function AddMenuPref(title) {
const frag = document.createDocumentFragment(); const frag = document.createDocumentFragment();
frag.appendChild(title); frag.appendChild(title);
for (const group of Object.keys(ConfigGroups)) { Object.keys(ConfigGroups).forEach((group) => {
const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group) const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group)
frag.appendChild(groupObject); frag.appendChild(groupObject);
if (CMOptions.Header[group]) { if (CMOptions.Header[group]) {
// 0 is show, 1 is collapsed // 0 is show, 1 is collapsed
// Make sub-sections of Notification section // Make sub-sections of Notification section
if (group === 'Notification') { if (group === 'Notification') {
for (const subGroup of Object.keys(ConfigGroupsNotification)) { Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
const subGroupObject = CreatePrefHeader( const subGroupObject = CreatePrefHeader(
subGroup, subGroup,
ConfigGroupsNotification[subGroup], ConfigGroupsNotification[subGroup],
@@ -232,20 +232,20 @@ export default function AddMenuPref(title) {
subGroupObject.style.opacity = '0.5'; subGroupObject.style.opacity = '0.5';
frag.appendChild(subGroupObject); frag.appendChild(subGroupObject);
if (CMOptions.Header[subGroup]) { if (CMOptions.Header[subGroup]) {
for (const option in Config) { Object.keys(Config).forEach((option) => {
if (Config[option].group === subGroup) if (Config[option].group === subGroup)
frag.appendChild(CreatePrefOption(option)); frag.appendChild(CreatePrefOption(option));
} });
} }
} });
} else { } else {
for (const option of Object.keys(Config)) { Object.keys(Config).forEach((option) => {
if (Config[option].group === group) if (Config[option].group === group)
frag.appendChild(CreatePrefOption(option)); frag.appendChild(CreatePrefOption(option));
} });
} }
} }
} });
const resDef = document.createElement('div'); const resDef = document.createElement('div');
resDef.className = 'listing'; resDef.className = 'listing';
+2 -1
View File
@@ -10,7 +10,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
* @param {string} title The title of the to-be created notifications * @param {string} title The title of the to-be created notifications
* @param {string} message The text of the to-be created notifications * @param {string} message The text of the to-be created notifications
*/ */
export default function Notification(notifyConfig, title, message) { export default function CreateNotification(notifyConfig, title, message) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ( if (
CMOptions[notifyConfig] === 1 && CMOptions[notifyConfig] === 1 &&
@@ -18,6 +18,7 @@ export default function Notification(notifyConfig, title, message) {
isInitializing === false isInitializing === false
) { ) {
const CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; const CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
// eslint-disable-next-line no-new
new Notification(title, { body: message, badge: CookieIcon }); new Notification(title, { body: message, badge: CookieIcon });
} }
} }
+1
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
ColorTextPre, ColorTextPre,
@@ -1,3 +1,4 @@
/* eslint-disable no-restricted-syntax */
import { import {
CacheObjects1, CacheObjects1,
CacheObjects10, CacheObjects10,
@@ -8,7 +8,7 @@ import * as Create from '../CreateTooltip';
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
export default function GardenPlots() { export default function GardenPlots() {
const minigame = Game.Objects.Farm.minigame; const { minigame } = Game.Objects.Farm;
if ( if (
CMOptions.TooltipPlots && CMOptions.TooltipPlots &&
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0 minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
@@ -14,7 +14,7 @@ import * as Create from '../CreateTooltip';
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
export default function Grimoire() { export default function Grimoire() {
const minigame = Game.Objects['Wizard tower'].minigame; const { minigame } = Game.Objects['Wizard tower'];
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]); const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) { if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
@@ -8,7 +8,7 @@ import * as Create from '../CreateTooltip';
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
export default function HarvestAll() { export default function HarvestAll() {
const minigame = Game.Objects.Farm.minigame; const { minigame } = Game.Objects.Farm;
if (CMOptions.TooltipLump) { if (CMOptions.TooltipLump) {
l('CMTooltipBorder').appendChild( l('CMTooltipBorder').appendChild(
Create.TooltipCreateHeader('Cookies gained from harvesting:'), Create.TooltipCreateHeader('Cookies gained from harvesting:'),
+4 -4
View File
@@ -16,7 +16,7 @@ export function CheckWrinklerTooltip() {
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) { if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) {
// Latter is set by CM.Main.AddWrinklerAreaDetect // Latter is set by CM.Main.AddWrinklerAreaDetect
let showingTooltip = false; let showingTooltip = false;
for (const i of Object.keys(Game.wrinklers)) { Object.keys(Game.wrinklers).forEach((i) => {
const me = Game.wrinklers[i]; const me = Game.wrinklers[i];
if (me.phase > 0 && me.selected) { if (me.phase > 0 && me.selected) {
showingTooltip = true; showingTooltip = true;
@@ -36,11 +36,11 @@ export function CheckWrinklerTooltip() {
Game.tooltip.draw(this, escape(placeholder.innerHTML)); Game.tooltip.draw(this, escape(placeholder.innerHTML));
TooltipWrinkler = i; TooltipWrinkler = i;
TooltipWrinklerBeingShown[i] = 1; TooltipWrinklerBeingShown[i] = 1;
} else break; }
} else { } else {
TooltipWrinklerBeingShown[i] = 0; TooltipWrinklerBeingShown[i] = 0;
} }
} });
if (!showingTooltip) { if (!showingTooltip) {
Game.tooltip.hide(); Game.tooltip.hide();
} }
@@ -54,7 +54,7 @@ export function CheckWrinklerTooltip() {
*/ */
export function UpdateWrinklerTooltip() { export function UpdateWrinklerTooltip() {
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) { if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) {
let sucked = Game.wrinklers[TooltipWrinkler].sucked; let { sucked } = Game.wrinklers[TooltipWrinkler];
let toSuck = 1.1; let toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
+10 -10
View File
@@ -6,7 +6,7 @@ import {
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers'; import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon'; import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
import { GCTimers } from '../../Disp/VariablesAndData'; import { GCTimers } from '../../Disp/VariablesAndData';
@@ -24,13 +24,13 @@ import {
function FindShimmer() { function FindShimmer() {
CurrSpawnedGoldenCookieState = 0; CurrSpawnedGoldenCookieState = 0;
CacheGoldenShimmersByID = {}; CacheGoldenShimmersByID = {};
for (const i of Object.keys(Game.shimmers)) { Object.keys(Game.shimmers).forEach((i) => {
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i]; CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
CacheSpawnedGoldenShimmer = Game.shimmers[i]; CacheSpawnedGoldenShimmer = Game.shimmers[i];
CurrSpawnedGoldenCookieState += 1; CurrSpawnedGoldenCookieState += 1;
} }
} });
} }
/** /**
@@ -39,42 +39,42 @@ function FindShimmer() {
*/ */
export default function CheckGoldenCookie() { export default function CheckGoldenCookie() {
FindShimmer(); FindShimmer();
for (const i of Object.keys(GCTimers)) { Object.keys(GCTimers).forEach((i) => {
if (typeof CacheGoldenShimmersByID[i] === 'undefined') { if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
GCTimers[i].parentNode.removeChild(GCTimers[i]); GCTimers[i].parentNode.removeChild(GCTimers[i]);
delete GCTimers[i]; delete GCTimers[i];
} }
} });
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) { if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
LastGoldenCookieState = Game.shimmerTypes.golden.n; LastGoldenCookieState = Game.shimmerTypes.golden.n;
if (LastGoldenCookieState) { if (LastGoldenCookieState) {
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) { if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
Flash(3, 'GCFlash'); Flash(3, 'GCFlash');
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume'); PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
Notification( CreateNotification(
'GCNotification', 'GCNotification',
'Golden Cookie Spawned', 'Golden Cookie Spawned',
'A Golden Cookie has spawned. Click it now!', 'A Golden Cookie has spawned. Click it now!',
); );
} }
for (const i of Object.keys(Game.shimmers)) { Object.keys(Game.shimmers).forEach((i) => {
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') { if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
CreateGCTimer(Game.shimmers[i]); CreateGCTimer(Game.shimmers[i]);
} }
} });
} }
UpdateFavicon(); UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState; LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) { } else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
for (const i of Object.keys(GCTimers)) { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity; GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
GCTimers[i].style.transform = GCTimers[i].style.transform =
CacheGoldenShimmersByID[i].l.style.transform; CacheGoldenShimmersByID[i].l.style.transform;
GCTimers[i].textContent = Math.ceil( GCTimers[i].textContent = Math.ceil(
CacheGoldenShimmersByID[i].life / Game.fps, CacheGoldenShimmersByID[i].life / Game.fps,
); );
} });
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { LastMagicBarFull } from '../VariablesAndData'; import { LastMagicBarFull } from '../VariablesAndData';
@@ -13,13 +13,13 @@ export default function CheckMagicMeter() {
Game.Objects['Wizard tower'].minigameLoaded && Game.Objects['Wizard tower'].minigameLoaded &&
CMOptions.GrimoireBar === 1 CMOptions.GrimoireBar === 1
) { ) {
const minigame = Game.Objects['Wizard tower'].minigame; const { minigame } = Game.Objects['Wizard tower'];
if (minigame.magic < minigame.magicM) LastMagicBarFull = false; if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) { else if (!LastMagicBarFull) {
LastMagicBarFull = true; LastMagicBarFull = true;
Flash(3, 'MagicFlash'); Flash(3, 'MagicFlash');
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume'); PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
Notification( CreateNotification(
'MagicNotification', 'MagicNotification',
'Magic Meter full', 'Magic Meter full',
'Your Magic Meter is full. Cast a spell!', 'Your Magic Meter is full. Cast a spell!',
+4 -5
View File
@@ -2,7 +2,7 @@
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { LastSeasonPopupState } from '../VariablesAndData'; import { LastSeasonPopupState } from '../VariablesAndData';
@@ -13,15 +13,14 @@ import { LastSeasonPopupState } from '../VariablesAndData';
export default function CheckSeasonPopup() { export default function CheckSeasonPopup() {
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) { if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned; LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
for (const i of Object.keys(Game.shimmers)) { Object.keys(Game.shimmers).forEach((i) => {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
CacheSeasonPopShimmer = Game.shimmers[i]; CacheSeasonPopShimmer = Game.shimmers[i];
break;
} }
} });
Flash(3, 'SeaFlash'); Flash(3, 'SeaFlash');
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume'); PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
Notification( CreateNotification(
'SeaNotification', 'SeaNotification',
'Reindeer sighted!', 'Reindeer sighted!',
'A Reindeer has spawned. Click it now!', 'A Reindeer has spawned. Click it now!',
+2 -2
View File
@@ -1,6 +1,6 @@
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { LastTickerFortuneState } from '../VariablesAndData'; import { LastTickerFortuneState } from '../VariablesAndData';
@@ -18,7 +18,7 @@ export default function CheckTickerFortune() {
if (LastTickerFortuneState) { if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash'); Flash(3, 'FortuneFlash');
PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
Notification( CreateNotification(
'FortuneNotification', 'FortuneNotification',
'Fortune Cookie found', 'Fortune Cookie found',
'A Fortune Cookie has appeared on the Ticker.', 'A Fortune Cookie has appeared on the Ticker.',
+6 -6
View File
@@ -1,6 +1,6 @@
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { LastWrinklerCount } from '../VariablesAndData'; import { LastWrinklerCount } from '../VariablesAndData';
@@ -11,9 +11,9 @@ import { LastWrinklerCount } from '../VariablesAndData';
export default function CheckWrinklerCount() { export default function CheckWrinklerCount() {
if (Game.elderWrath > 0) { if (Game.elderWrath > 0) {
let CurrentWrinklers = 0; let CurrentWrinklers = 0;
for (const i in Game.wrinklers) { Object.keys(Game.wrinklers).forEach((i) => {
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++; if (Game.wrinklers[i].phase === 2) CurrentWrinklers += 1;
} });
if (CurrentWrinklers > LastWrinklerCount) { if (CurrentWrinklers > LastWrinklerCount) {
LastWrinklerCount = CurrentWrinklers; LastWrinklerCount = CurrentWrinklers;
if ( if (
@@ -44,13 +44,13 @@ export default function CheckWrinklerCount() {
CurrentWrinklers === Game.getWrinklersMax() && CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxNotification CMOptions.WrinklerMaxNotification
) { ) {
Notification( CreateNotification(
'WrinklerMaxNotification', 'WrinklerMaxNotification',
'Maximum Wrinklers Reached', 'Maximum Wrinklers Reached',
'You have reached your maximum ammount of wrinklers', 'You have reached your maximum ammount of wrinklers',
); );
} else { } else {
Notification( CreateNotification(
'WrinklerNotification', 'WrinklerNotification',
'A Wrinkler appeared', 'A Wrinkler appeared',
'A new wrinkler has appeared', 'A new wrinkler has appeared',
+2 -2
View File
@@ -38,13 +38,13 @@ export default function InitializeCookieMonster() {
CreateUpgradeBar(); CreateUpgradeBar();
CreateWhiteScreen(); CreateWhiteScreen();
CreateFavicon(); CreateFavicon();
for (const i of Object.keys(TooltipText)) { Object.keys(TooltipText).forEach((i) => {
CreateSimpleTooltip( CreateSimpleTooltip(
TooltipText[i][0], TooltipText[i][0],
TooltipText[i][1], TooltipText[i][1],
TooltipText[i][2], TooltipText[i][2],
); );
} });
CreateWrinklerButtons(); CreateWrinklerButtons();
UpdateBuildingUpgradeStyle(); UpdateBuildingUpgradeStyle();
@@ -20,7 +20,7 @@ function ReplaceNativeGrimoireDraw() {
!HasReplaceNativeGrimoireDraw && !HasReplaceNativeGrimoireDraw &&
Game.Objects['Wizard tower'].minigameLoaded Game.Objects['Wizard tower'].minigameLoaded
) { ) {
const minigame = Game.Objects['Wizard tower'].minigame; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireDraw = minigame.draw; BackupGrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function () { Game.Objects['Wizard tower'].minigame.draw = function () {
BackupGrimoireDraw(); BackupGrimoireDraw();
@@ -46,7 +46,7 @@ function ReplaceNativeGrimoireLaunch() {
!HasReplaceNativeGrimoireLaunch && !HasReplaceNativeGrimoireLaunch &&
Game.Objects['Wizard tower'].minigameLoaded Game.Objects['Wizard tower'].minigameLoaded
) { ) {
const minigame = Game.Objects['Wizard tower'].minigame; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireLaunch = minigame.launch; BackupGrimoireLaunch = minigame.launch;
BackupGrimoireLaunchMod = new Function( BackupGrimoireLaunchMod = new Function(
`return ${minigame.launch `return ${minigame.launch
+18 -16
View File
@@ -6,21 +6,23 @@ import { TooltipGrimoireBackup } from '../VariablesAndData';
*/ */
export default function ReplaceTooltipGrimoire() { export default function ReplaceTooltipGrimoire() {
if (Game.Objects['Wizard tower'].minigameLoaded) { if (Game.Objects['Wizard tower'].minigameLoaded) {
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) { Object.keys(Game.Objects['Wizard tower'].minigame.spellsById).forEach(
if (l(`grimoireSpell${i}`).onmouseover !== null) { (i) => {
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover; if (l(`grimoireSpell${i}`).onmouseover !== null) {
l(`grimoireSpell${i}`).onmouseover = function () { TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
Game.tooltip.dynamic = 1; l(`grimoireSpell${i}`).onmouseover = function () {
Game.tooltip.draw( Game.tooltip.dynamic = 1;
this, Game.tooltip.draw(
function () { this,
return CreateTooltip('g', `${i}`); function () {
}, return CreateTooltip('g', `${i}`);
'this', },
); 'this',
Game.tooltip.wobble(); );
}; Game.tooltip.wobble();
} };
} }
},
);
} }
} }
@@ -8,7 +8,7 @@ import { TooltipUpgradeBackup } from '../VariablesAndData';
*/ */
export default function ReplaceTooltipUpgrade() { export default function ReplaceTooltipUpgrade() {
TooltipUpgradeBackup = []; TooltipUpgradeBackup = [];
for (const i of Object.keys(Game.UpgradesInStore)) { Object.keys(Game.UpgradesInStore).forEach((i) => {
if (l(`upgrade${i}`).onmouseover !== null) { if (l(`upgrade${i}`).onmouseover !== null) {
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover; TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
l(`upgrade${i}`).onmouseover = function () { l(`upgrade${i}`).onmouseover = function () {
@@ -26,5 +26,5 @@ export default function ReplaceTooltipUpgrade() {
} }
}; };
} }
} });
} }
+4 -2
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
/** Functions related to replacing tooltips */ /** Functions related to replacing tooltips */
@@ -14,7 +15,7 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
* This function replaces the original .onmouseover functions of buildings * This function replaces the original .onmouseover functions of buildings
*/ */
function ReplaceTooltipBuild() { function ReplaceTooltipBuild() {
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
const me = Game.Objects[i]; const me = Game.Objects[i];
if (l(`product${me.id}`).onmouseover !== null) { if (l(`product${me.id}`).onmouseover !== null) {
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover; TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
@@ -30,7 +31,7 @@ function ReplaceTooltipBuild() {
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
} }
} });
} }
/** /**
@@ -129,6 +130,7 @@ export default function ReplaceTooltips() {
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if // Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
// they were not loaded initially // they were not loaded initially
// eslint-disable-next-line prefer-destructuring
LoadMinigames = Game.LoadMinigames; LoadMinigames = Game.LoadMinigames;
Game.LoadMinigames = function () { Game.LoadMinigames = function () {
LoadMinigames(); LoadMinigames();
+2 -2
View File
@@ -15,8 +15,8 @@ export default function AddWrinklerAreaDetect() {
l('backgroundLeftCanvas').onmouseout = function () { l('backgroundLeftCanvas').onmouseout = function () {
TooltipWrinklerArea = 0; TooltipWrinklerArea = 0;
Game.tooltip.hide(); Game.tooltip.hide();
for (const i of Object.keys(Game.wrinklers)) { Object.keys(Game.wrinklers).forEach((i) => {
TooltipWrinklerBeingShown[i] = 0; TooltipWrinklerBeingShown[i] = 0;
} });
}; };
} }
+13 -13
View File
@@ -31,15 +31,15 @@ export default function CalculateGains() {
let mult = 1; let mult = 1;
// Include minigame effects // Include minigame effects
const effs = {}; const effs = {};
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs) { if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs) {
const myEffs = Game.Objects[i].minigame.effs; const myEffs = Game.Objects[i].minigame.effs;
for (const ii in myEffs) { Object.keys(myEffs).forEach((ii) => {
if (effs[ii]) effs[ii] *= myEffs[ii]; if (effs[ii]) effs[ii] *= myEffs[ii];
else effs[ii] = myEffs[ii]; else effs[ii] = myEffs[ii];
} });
} }
} });
SimEffs = effs; SimEffs = effs;
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1)
@@ -54,7 +54,7 @@ export default function CalculateGains() {
if (SimHas('Heralds') && Game.ascensionMode !== 1) if (SimHas('Heralds') && Game.ascensionMode !== 1)
mult *= 1 + 0.01 * Game.heralds; mult *= 1 + 0.01 * Game.heralds;
for (const i of Object.keys(Game.cookieUpgrades)) { Object.keys(Game.cookieUpgrades).forEach((i) => {
const me = Game.cookieUpgrades[i]; const me = Game.cookieUpgrades[i];
if (SimHas(me.name)) { if (SimHas(me.name)) {
// Some upgrades have a functio as .power (notably the valentine cookies) // Some upgrades have a functio as .power (notably the valentine cookies)
@@ -64,7 +64,7 @@ export default function CalculateGains() {
mult *= 1 + SimUpgrades[me.name].power(SimUpgrades[me.name]) * 0.01; mult *= 1 + SimUpgrades[me.name].power(SimUpgrades[me.name]) * 0.01;
} else mult *= 1 + me.power * 0.01; } else mult *= 1 + me.power * 0.01;
} }
} });
if (SimHas('Specialized chocolate chips')) mult *= 1.01; if (SimHas('Specialized chocolate chips')) mult *= 1.01;
if (SimHas('Designer cocoa beans')) mult *= 1.02; if (SimHas('Designer cocoa beans')) mult *= 1.02;
@@ -160,7 +160,7 @@ export default function CalculateGains() {
if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult; if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult;
if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult; if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult;
for (const i of Object.keys(SimObjects)) { Object.keys(SimObjects).forEach((i) => {
const me = SimObjects[i]; const me = SimObjects[i];
let storedCps = me.cps(me); let storedCps = me.cps(me);
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1)
@@ -171,7 +171,7 @@ export default function CalculateGains() {
) )
storedCps *= 1 + 0.05 * milkProgress * milkMult; storedCps *= 1 + 0.05 * milkProgress * milkMult;
SimCookiesPs += me.amount * storedCps; SimCookiesPs += me.amount * storedCps;
} });
if (SimHas('"egg"')) SimCookiesPs += 9; // "egg" if (SimHas('"egg"')) SimCookiesPs += 9; // "egg"
@@ -210,14 +210,14 @@ export default function CalculateGains() {
mult *= 1 + SimAuraMult('Radiant Appetite'); mult *= 1 + SimAuraMult('Radiant Appetite');
const rawCookiesPs = SimCookiesPs * mult; const rawCookiesPs = SimCookiesPs * mult;
for (const i of Object.keys(Game.CpsAchievements)) { Object.keys(Game.CpsAchievements).forEach((i) => {
if (rawCookiesPs >= Game.CpsAchievements[i].threshold) if (rawCookiesPs >= Game.CpsAchievements[i].threshold)
SimWin(Game.CpsAchievements[i].name); SimWin(Game.CpsAchievements[i].name);
} });
SimCookiesPsRaw = rawCookiesPs; SimCookiesPsRaw = rawCookiesPs;
const n = Game.shimmerTypes.golden.n; const { n } = Game.shimmerTypes.golden;
const auraMult = SimAuraMult("Dragon's Fortune"); const auraMult = SimAuraMult("Dragon's Fortune");
for (let i = 0; i < n; i++) { for (let i = 0; i < n; i++) {
mult *= 1 + auraMult * 1.23; mult *= 1 + auraMult * 1.23;
@@ -233,9 +233,9 @@ export default function CalculateGains() {
let goldenSwitchMult = 1.5; let goldenSwitchMult = 1.5;
if (SimHas('Residual luck')) { if (SimHas('Residual luck')) {
const upgrades = Game.goldenCookieUpgrades; const upgrades = Game.goldenCookieUpgrades;
for (const i of Object.keys(upgrades)) { Object.keys(upgrades).forEach((i) => {
if (SimHas(upgrades[i])) goldenSwitchMult += 0.1; if (SimHas(upgrades[i])) goldenSwitchMult += 0.1;
} });
} }
mult *= goldenSwitchMult; mult *= goldenSwitchMult;
} }
+12 -12
View File
@@ -11,9 +11,9 @@ import { SimObjects, SimUpgradesOwned } from '../VariablesAndData';
*/ */
export default function CheckOtherAchiev() { export default function CheckOtherAchiev() {
let grandmas = 0; let grandmas = 0;
for (const i of Object.keys(Game.GrandmaSynergies)) { Object.keys(Game.GrandmaSynergies).forEach((i) => {
if (SimHas(Game.GrandmaSynergies[i])) grandmas++; if (SimHas(Game.GrandmaSynergies[i])) grandmas += 1;
} });
if (!SimHasAchiev('Elder') && grandmas >= 7) SimWin('Elder'); if (!SimHasAchiev('Elder') && grandmas >= 7) SimWin('Elder');
if (!SimHasAchiev('Veteran') && grandmas >= 14) SimWin('Veteran'); if (!SimHasAchiev('Veteran') && grandmas >= 14) SimWin('Veteran');
@@ -21,7 +21,7 @@ export default function CheckOtherAchiev() {
let mathematician = 1; let mathematician = 1;
let base10 = 1; let base10 = 1;
let minAmount = 100000; let minAmount = 100000;
for (const i of Object.keys(SimObjects)) { Object.keys(SimObjects).forEach((i) => {
buildingsOwned += SimObjects[i].amount; buildingsOwned += SimObjects[i].amount;
minAmount = Math.min(SimObjects[i].amount, minAmount); minAmount = Math.min(SimObjects[i].amount, minAmount);
if (!SimHasAchiev('Mathematician')) { if (!SimHasAchiev('Mathematician')) {
@@ -38,7 +38,7 @@ export default function CheckOtherAchiev() {
) )
base10 = 0; base10 = 0;
} }
} });
if (minAmount >= 1) SimWin('One with everything'); if (minAmount >= 1) SimWin('One with everything');
if (mathematician === 1) SimWin('Mathematician'); if (mathematician === 1) SimWin('Mathematician');
if (base10 === 1) SimWin('Base 10'); if (base10 === 1) SimWin('Base 10');
@@ -76,23 +76,23 @@ export default function CheckOtherAchiev() {
SimWin('The elder scrolls'); SimWin('The elder scrolls');
let hasAllHalloCook = true; let hasAllHalloCook = true;
for (const i of Object.keys(HalloCookies)) { Object.keys(HalloCookies).forEach((i) => {
if (!SimHas(HalloCookies[i])) hasAllHalloCook = false; if (!SimHas(HalloCookies[i])) hasAllHalloCook = false;
} });
if (hasAllHalloCook) SimWin('Spooky cookies'); if (hasAllHalloCook) SimWin('Spooky cookies');
let hasAllChristCook = true; let hasAllChristCook = true;
for (const i of Object.keys(ChristCookies)) { Object.keys(ChristCookies).forEach((i) => {
if (!SimHas(ChristCookies[i])) hasAllChristCook = false; if (!SimHas(ChristCookies[i])) hasAllChristCook = false;
} });
if (hasAllChristCook) SimWin('Let it snow'); if (hasAllChristCook) SimWin('Let it snow');
if (SimHas('Fortune cookies')) { if (SimHas('Fortune cookies')) {
const list = Game.Tiers.fortune.upgrades; const list = Game.Tiers.fortune.upgrades;
let fortunes = 0; let fortunes = 0;
for (const i of Object.keys(list)) { Object.keys(list).forEach((i) => {
if (SimHas(list[i].name)) fortunes++; if (SimHas(list[i].name)) fortunes += 1;
} });
if (fortunes >= list.length) SimWin('O Fortuna'); if (fortunes >= list.length) SimWin('O Fortuna');
} }
} }
+6 -6
View File
@@ -12,20 +12,20 @@ import InitUpgrade from './InitUpgrade';
export default function InitData() { export default function InitData() {
// Buildings // Buildings
SimObjects = []; SimObjects = [];
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
SimObjects[i] = InitialBuildingData(i); SimObjects[i] = InitialBuildingData(i);
} });
// Upgrades // Upgrades
SimUpgrades = []; SimUpgrades = [];
for (const i of Object.keys(Game.Upgrades)) { Object.keys(Game.Upgrades).forEach((i) => {
SimUpgrades[i] = InitUpgrade(i); SimUpgrades[i] = InitUpgrade(i);
} });
// Achievements // Achievements
SimAchievements = []; SimAchievements = [];
for (const i of Object.keys(Game.Achievements)) { Object.keys(Game.Achievements).forEach((i) => {
SimAchievements[i] = InitAchievement(i); SimAchievements[i] = InitAchievement(i);
} });
CopyData(); CopyData();
} }
+2 -2
View File
@@ -16,9 +16,9 @@ export default function InitUpgrade(upgradeName) {
if (me.name === 'Sugar crystal cookies') { if (me.name === 'Sugar crystal cookies') {
you.power = function () { you.power = function () {
let n = 5; let n = 5;
for (const i in SimObjects) { Object.keys(SimObjects).forEach((i) => {
if (SimObjects[i].level >= 10) n += 1; if (SimObjects[i].level >= 10) n += 1;
} });
return n; return n;
}; };
} else { } else {
@@ -29,9 +29,9 @@ export default function InitialBuildingData(buildingName) {
if (SimHas('Nonillion fingers')) add *= 20; if (SimHas('Nonillion fingers')) add *= 20;
let mult = 1; let mult = 1;
let num = 0; let num = 0;
for (const i in SimObjects) { Object.keys(SimObjects).forEach((i) => {
if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount; if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount;
} });
add *= num; add *= num;
mult *= SimGetTieredCpsMult(it); mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS('Cursor'); mult *= Game.magicCpS('Cursor');
@@ -49,9 +49,9 @@ export default function InitialBuildingData(buildingName) {
} else if (me.name === 'Grandma') { } else if (me.name === 'Grandma') {
you.cps = function (it) { you.cps = function (it) {
let mult = 1; let mult = 1;
for (const i in Game.GrandmaSynergies) { Object.keys(Game.GrandmaSynergies).forEach((i) => {
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2; if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
} });
if (SimHas('Bingo center/Research facility')) mult *= 4; if (SimHas('Bingo center/Research facility')) mult *= 4;
if (SimHas('Ritual rolling pins')) mult *= 2; if (SimHas('Ritual rolling pins')) mult *= 2;
if (SimHas('Naughty list')) mult *= 2; if (SimHas('Naughty list')) mult *= 2;
@@ -75,9 +75,9 @@ export default function InitialBuildingData(buildingName) {
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05; if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let num = 0; let num = 0;
for (const i in SimObjects) { Object.keys(SimObjects).forEach((i) => {
if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount; if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount;
} });
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num; // if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num; mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
@@ -6,14 +6,14 @@ import SimHas from './SimHas';
*/ */
export default function SimGetTieredCpsMult(me) { export default function SimGetTieredCpsMult(me) {
let mult = 1; let mult = 1;
for (const i in me.tieredUpgrades) { Object.keys(me.tieredUpgrades).forEach((i) => {
if ( if (
!Game.Tiers[me.tieredUpgrades[i].tier].special && !Game.Tiers[me.tieredUpgrades[i].tier].special &&
SimHas(me.tieredUpgrades[i].name) SimHas(me.tieredUpgrades[i].name)
) )
mult *= 2; mult *= 2;
} });
for (const i in me.synergies) { Object.keys(me.synergies).forEach((i) => {
if (SimHas(me.synergies[i].name)) { if (SimHas(me.synergies[i].name)) {
const syn = me.synergies[i]; const syn = me.synergies[i];
if (syn.buildingTie1.name === me.name) if (syn.buildingTie1.name === me.name)
@@ -21,7 +21,7 @@ export default function SimGetTieredCpsMult(me) {
else if (syn.buildingTie2.name === me.name) else if (syn.buildingTie2.name === me.name)
mult *= 1 + 0.001 * syn.buildingTie1.amount; mult *= 1 + 0.001 * syn.buildingTie1.amount;
} }
} });
if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07; if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07;
if (me.grandma && SimHas(me.grandma.name)) if (me.grandma && SimHas(me.grandma.name))
mult *= 1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1)); mult *= 1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1));
@@ -8,26 +8,27 @@ import SimHasGod from './SimHasGod';
* This function calculates the sell price of a building based on current "sim data" * This function calculates the sell price of a building based on current "sim data"
* @param {string} building Name of the building * @param {string} building Name of the building
* @param {number} price Current price of building * @param {number} price Current price of building
* @returns {number} price The modified building price * @returns {number} ModifiedPrice The modified building price
*/ */
export default function SimModifyBuildingPrice(building, price) { export default function SimModifyBuildingPrice(building, price) {
if (SimHas('Season savings')) price *= 0.99; let ModifiedPrice = price;
if (SimHas("Santa's dominion")) price *= 0.99; if (SimHas('Season savings')) ModifiedPrice *= 0.99;
if (SimHas('Faberge egg')) price *= 0.99; if (SimHas("Santa's dominion")) ModifiedPrice *= 0.99;
if (SimHas('Divine discount')) price *= 0.99; if (SimHas('Faberge egg')) ModifiedPrice *= 0.99;
if (SimHas('Fortune #100')) price *= 0.99; if (SimHas('Divine discount')) ModifiedPrice *= 0.99;
// if (SimHasAura('Fierce Hoarder')) price *= 0.98; if (SimHas('Fortune #100')) ModifiedPrice *= 0.99;
price *= 1 - SimAuraMult('Fierce Hoarder') * 0.02; // if (SimHasAura('Fierce Hoarder')) ModifiedPrice *= 0.98;
if (Game.hasBuff('Everything must go')) price *= 0.95; ModifiedPrice *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
if (Game.hasBuff('Crafty pixies')) price *= 0.98; if (Game.hasBuff('Everything must go')) ModifiedPrice *= 0.95;
if (Game.hasBuff('Nasty goblins')) price *= 1.02; if (Game.hasBuff('Crafty pixies')) ModifiedPrice *= 0.98;
if (building.fortune && SimHas(building.fortune.name)) price *= 0.93; if (Game.hasBuff('Nasty goblins')) ModifiedPrice *= 1.02;
price *= SimEff('buildingCost'); if (building.fortune && SimHas(building.fortune.name)) ModifiedPrice *= 0.93;
ModifiedPrice *= SimEff('buildingCost');
if (SimObjects.Temple.minigameLoaded) { if (SimObjects.Temple.minigameLoaded) {
const godLvl = SimHasGod('creation'); const godLvl = SimHasGod('creation');
if (godLvl === 1) price *= 0.93; if (godLvl === 1) ModifiedPrice *= 0.93;
else if (godLvl === 2) price *= 0.95; else if (godLvl === 2) ModifiedPrice *= 0.95;
else if (godLvl === 3) price *= 0.98; else if (godLvl === 3) ModifiedPrice *= 0.98;
} }
return price; return ModifiedPrice;
} }
+6 -6
View File
@@ -37,7 +37,7 @@ export default function CopyData() {
SimPrestige = Game.prestige; SimPrestige = Game.prestige;
// Buildings // Buildings
for (const i of Object.keys(Game.Objects)) { Object.keys(Game.Objects).forEach((i) => {
const me = Game.Objects[i]; const me = Game.Objects[i];
let you = SimObjects[i]; let you = SimObjects[i];
if (you === undefined) { if (you === undefined) {
@@ -61,10 +61,10 @@ export default function CopyData() {
you.minigame = me.minigame; you.minigame = me.minigame;
} }
SimObjects[i] = you; SimObjects[i] = you;
} });
// Upgrades // Upgrades
for (const i of Object.keys(Game.Upgrades)) { Object.keys(Game.Upgrades).forEach((i) => {
const me = Game.Upgrades[i]; const me = Game.Upgrades[i];
let you = SimUpgrades[i]; let you = SimUpgrades[i];
if (you === undefined) { if (you === undefined) {
@@ -73,10 +73,10 @@ export default function CopyData() {
} }
you.bought = me.bought; you.bought = me.bought;
SimUpgrades[i] = you; SimUpgrades[i] = you;
} });
// Achievements // Achievements
for (const i of Object.keys(Game.Achievements)) { Object.keys(Game.Achievements).forEach((i) => {
const me = Game.Achievements[i]; const me = Game.Achievements[i];
let you = SimAchievements[i]; let you = SimAchievements[i];
if (you === undefined) { if (you === undefined) {
@@ -85,7 +85,7 @@ export default function CopyData() {
} }
you.won = me.won; you.won = me.won;
SimAchievements[i] = you; SimAchievements[i] = you;
} });
// Auras // Auras
CacheDragonAuras(); CacheDragonAuras();
+1 -1
View File
@@ -11,7 +11,7 @@ export default function SimWin(what) {
if (SimAchievements[what]) { if (SimAchievements[what]) {
if (SimAchievements[what].won === 0) { if (SimAchievements[what].won === 0) {
SimAchievements[what].won = 1; SimAchievements[what].won = 1;
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned++; if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1;
} }
} }
} }
+5 -3
View File
@@ -16,13 +16,15 @@ export default function BuildingGetPrice(
free, free,
increase, increase,
) { ) {
let startingAmount = start;
let moni = 0; let moni = 0;
for (let i = 0; i < increase; i++) { for (let i = 0; i < increase; i += 1) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free); let price =
basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
price = Game.modifyBuildingPrice(build, price); price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
moni += price; moni += price;
start++; startingAmount += 1;
} }
return moni; return moni;
} }
@@ -33,14 +33,14 @@ export default function BuyBuildingsBonusIncome(building, amount) {
if (me.amount >= 700) SimWin('Gotta hand it to you'); if (me.amount >= 700) SimWin('Gotta hand it to you');
if (me.amount >= 800) SimWin("The devil's workshop"); if (me.amount >= 800) SimWin("The devil's workshop");
} else { } else {
for (const j in Game.Objects[me.name].tieredAchievs) { Object.keys(Game.Objects[me.name].tieredAchievs).forEach((j) => {
if ( if (
me.amount >= me.amount >=
Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock
) { ) {
SimWin(Game.Objects[me.name].tieredAchievs[j].name); SimWin(Game.Objects[me.name].tieredAchievs[j].name);
} }
} });
} }
const lastAchievementsOwned = SimAchievementsOwned; const lastAchievementsOwned = SimAchievementsOwned;
+6 -6
View File
@@ -34,9 +34,9 @@ function MouseCps() {
if (SimHas('Octillion fingers')) add *= 20; if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20; if (SimHas('Nonillion fingers')) add *= 20;
let num = 0; let num = 0;
for (const i of Object.keys(SimObjects)) { Object.keys(SimObjects).forEach((i) => {
num += SimObjects[i].amount; num += SimObjects[i].amount;
} });
num -= SimObjects.Cursor.amount; num -= SimObjects.Cursor.amount;
add *= num; add *= num;
@@ -83,10 +83,10 @@ function MouseCps() {
} }
} }
for (const i of Object.keys(Game.buffs)) { Object.keys(Game.buffs).forEach((i) => {
if (typeof Game.buffs[i].multClick !== 'undefined') if (typeof Game.buffs[i].multClick !== 'undefined')
mult *= Game.buffs[i].multClick; mult *= Game.buffs[i].multClick;
} });
// if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05; // if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05;
mult *= 1 + SimAuraMult('Dragon Cursor') * 0.05; mult *= 1 + SimAuraMult('Dragon Cursor') * 0.05;
@@ -132,10 +132,10 @@ export default function BuyUpgradesBonusIncome(upgrade) {
} }
const me = SimUpgrades[upgrade]; const me = SimUpgrades[upgrade];
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))
SimUpgradesOwned++; SimUpgradesOwned += 1;
if (upgrade === 'Elder Pledge') { if (upgrade === 'Elder Pledge') {
SimPledges++; SimPledges += 1;
if (SimPledges > 0) SimWin('Elder nap'); if (SimPledges > 0) SimWin('Elder nap');
if (SimPledges >= 5) SimWin('Elder slumber'); if (SimPledges >= 5) SimWin('Elder slumber');
} else if (upgrade === 'Elder Covenant') { } else if (upgrade === 'Elder Covenant') {
+14 -9
View File
@@ -22,21 +22,26 @@ export default function BuildingSell(
) { ) {
// Calculate money gains from selling buildings // Calculate money gains from selling buildings
// If noSim is set, use Game methods to compute price instead of Sim ones. // If noSim is set, use Game methods to compute price instead of Sim ones.
noSim = typeof noSim === 'undefined' ? 0 : noSim; const noSimRes = typeof noSim === 'undefined' ? 0 : noSim;
let toChange = amount;
let startingAmount = start;
let moni = 0; let moni = 0;
if (amount === -1) amount = start; if (amount === -1) toChange = startingAmount;
if (!amount) amount = Game.buyBulk; if (!amount) toChange = Game.buyBulk;
for (let i = 0; i < amount; i++) { for (let i = 0; i < toChange; i++) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free); let price =
price = noSim basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
price = noSimRes
? Game.modifyBuildingPrice(build, price) ? Game.modifyBuildingPrice(build, price)
: SimModifyBuildingPrice(build, price); : SimModifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
const giveBack = noSim ? build.getSellMultiplier() : SimGetSellMultiplier(); const giveBack = noSimRes
? build.getSellMultiplier()
: SimGetSellMultiplier();
price = Math.floor(price * giveBack); price = Math.floor(price * giveBack);
if (start > 0) { if (startingAmount > 0) {
moni += price; moni += price;
start--; startingAmount -= 1;
} }
} }
return moni; return moni;
@@ -21,10 +21,10 @@ export default function SellBuildingsForChoEgg() {
// Change auras to Earth Shatterer + Reality bending to optimize money made by selling // Change auras to Earth Shatterer + Reality bending to optimize money made by selling
let buildingsToSacrifice = 2; let buildingsToSacrifice = 2;
if (SimDragonAura === 5 || SimDragonAura === 18) { if (SimDragonAura === 5 || SimDragonAura === 18) {
--buildingsToSacrifice; buildingsToSacrifice -= 1;
} }
if (SimDragonAura2 === 5 || SimDragonAura2 === 18) { if (SimDragonAura2 === 5 || SimDragonAura2 === 18) {
--buildingsToSacrifice; buildingsToSacrifice -= 1;
} }
SimDragonAura = 5; SimDragonAura = 5;
SimDragonAura2 = 18; SimDragonAura2 = 18;
@@ -32,17 +32,17 @@ export default function SellBuildingsForChoEgg() {
// Sacrifice highest buildings for the aura switch // Sacrifice highest buildings for the aura switch
for (let i = 0; i < buildingsToSacrifice; ++i) { for (let i = 0; i < buildingsToSacrifice; ++i) {
let highestBuilding = 'Cursor'; let highestBuilding = 'Cursor';
for (const j in SimObjects) { Object.keys(SimObjects).forEach((j) => {
if (SimObjects[j].amount > 0) { if (SimObjects[j].amount > 0) {
highestBuilding = j; highestBuilding = j;
} }
} });
SimObjects[highestBuilding].amount--; SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned--; SimBuildingsOwned -= 1;
} }
// Get money made by selling all remaining buildings // Get money made by selling all remaining buildings
for (const i of Object.keys(SimObjects)) { Object.keys(SimObjects).forEach((i) => {
const me = SimObjects[i]; const me = SimObjects[i];
sellTotal += BuildingSell( sellTotal += BuildingSell(
Game.Objects[me.name], Game.Objects[me.name],
@@ -51,7 +51,7 @@ export default function SellBuildingsForChoEgg() {
Game.Objects[i].free, Game.Objects[i].free,
me.amount, me.amount,
); );
} });
return sellTotal; return sellTotal;
} }