Merge pull request #745 from DanielNoord/cyclius

Cyclius and ESLint errors
This commit is contained in:
Daniël van Noord authored and GitHub committed 2021-04-04 20:15:17 +02:00
commit e7cf3b076d
56 files changed
+173 -194

No files matched your search

-6
View File
@@ -1,6 +0,0 @@
CookieMonster.js
CookieMonster.user.js
src/*.js
!src/CookieMonster.js
!src/*/*
dist/*
+1 -4
View File
@@ -15,14 +15,11 @@ module.exports = {
parserOptions: { parserOptions: {
ecmaVersion: 12, ecmaVersion: 12,
}, },
ignorePatterns: ['*CookieMonster*.js', 'dist/*', 'node_modules/*'],
rules: { rules: {
'import/no-mutable-exports': 'off', 'import/no-mutable-exports': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-new-func': 'off',
'func-names': 'off', 'func-names': 'off',
'no-console': 'off',
'no-alert': 'off',
'no-restricted-globals': 'off',
'prefer-destructuring': ['error', { object: true, array: false }], 'prefer-destructuring': ['error', { object: true, array: false }],
'max-len': [ 'max-len': [
1, 1,
+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 -6
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData'; import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
import { import {
ChoEggDiff, ChoEggDiff,
@@ -65,9 +64,9 @@ export class CMAvgQueue {
* Called by CM.Cache.InitCache() * Called by CM.Cache.InitCache()
*/ */
export function InitCookiesDiff() { export function InitCookiesDiff() {
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]); ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]); // eslint-disable-line no-unused-vars
} }
+3 -4
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData'; import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
import { import {
@@ -41,7 +39,7 @@ export default function CacheAvgCPS() {
if ((Game.T / Game.fps) % 1 === 0) { if ((Game.T / Game.fps) % 1 === 0) {
let choEggTotal = Game.cookies + CacheSellForChoEgg; let choEggTotal = Game.cookies + CacheSellForChoEgg;
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal; if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); // eslint-disable-line no-unused-vars
choEggTotal *= 0.05; choEggTotal *= 0.05;
// Add recent gains to AvgQueue's // Add recent gains to AvgQueue's
@@ -89,8 +87,9 @@ export default function CacheAvgCPS() {
CacheAverageGainBank + CacheAverageGainBank +
CacheAverageGainWrink + CacheAverageGainWrink +
(choEgg ? CacheAverageGainChoEgg : 0); (choEgg ? CacheAverageGainChoEgg : 0);
} else CacheAvgCPSWithChoEgg = CacheAverageCPS; } else CacheAvgCPSWithChoEgg = CacheAverageCPS; // eslint-disable-line no-unused-vars
// eslint-disable-next-line no-unused-vars
CacheAverageClicks = ClicksDiff.calcAverage( CacheAverageClicks = ClicksDiff.calcAverage(
ClickTimes[CMOptions.AvgClicksHist], ClickTimes[CMOptions.AvgClicksHist],
); );
+2 -3
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
import { import {
CacheCurrWrinklerCount, CacheCurrWrinklerCount,
@@ -23,8 +22,8 @@ export default function CacheCurrWrinklerCPS() {
else if (godLvl === 2) godMult *= 1.1; else if (godLvl === 2) godMult *= 1.1;
else if (godLvl === 3) godMult *= 1.05; else if (godLvl === 3) godMult *= 1.05;
} }
CacheCurrWrinklerCount = count; CacheCurrWrinklerCount = count; // eslint-disable-line no-unused-vars
CacheCurrWrinklerCPSMult = CacheCurrWrinklerCPSMult = // eslint-disable-line no-unused-vars
count * count *
(count * 0.05 * 1.1) * (count * 0.05 * 1.1) *
(Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) *
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc'; import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData'; import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
@@ -10,5 +9,5 @@ import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
export default function CacheNoGoldSwitchCPS() { export default function CacheNoGoldSwitchCPS() {
if (Game.Has('Golden switch [off]')) { if (Game.Has('Golden switch [off]')) {
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS(); CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs; } else CacheNoGoldSwitchCookiesPS = Game.cookiesPs; // eslint-disable-line no-unused-vars
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg'; import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
import { CacheSellForChoEgg } from '../VariablesAndData'; import { CacheSellForChoEgg } from '../VariablesAndData';
@@ -21,5 +20,5 @@ export default function CacheSellAllForChoEgg() {
} }
// Compute cookies earned by selling all buildings with optimal auras (ES + RB) // Compute cookies earned by selling all buildings with optimal auras (ES + RB)
sellTotal += SellBuildingsForChoEgg(); sellTotal += SellBuildingsForChoEgg();
CacheSellForChoEgg = sellTotal; CacheSellForChoEgg = sellTotal; // eslint-disable-line no-unused-vars
} }
+3 -3
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { ClickTimes } from '../Disp/VariablesAndData'; import { ClickTimes } from '../Disp/VariablesAndData';
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue'; import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
import CacheAvgCPS from './CPS/CPS'; import CacheAvgCPS from './CPS/CPS';
@@ -34,8 +33,9 @@ export default function InitCache() {
CacheAllMissingUpgrades(); CacheAllMissingUpgrades();
CacheSeasonSpec(); CacheSeasonSpec();
InitCookiesDiff(); InitCookiesDiff();
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS() /** Used by CM.Cache.CacheHeavenlyChipsPS() */
CacheAverageCookiesFromClicks = new CMAvgQueue( HeavenlyChipsDiff = new CMAvgQueue(5); // eslint-disable-line no-unused-vars
CacheAverageCookiesFromClicks = new CMAvgQueue( // eslint-disable-line no-unused-vars
ClickTimes[ClickTimes.length - 1] * 20, ClickTimes[ClickTimes.length - 1] * 20,
); );
CacheHeavenlyChipsPS(); CacheHeavenlyChipsPS();
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting';
import GetCPS from '../Disp/HelperFunctions/GetCPS'; import GetCPS from '../Disp/HelperFunctions/GetCPS';
import CacheAvgCPS from './CPS/CPS'; import CacheAvgCPS from './CPS/CPS';
@@ -27,5 +26,5 @@ export default function LoopCache() {
1, 1,
) - ) -
(Game.cookiesEarned + Game.cookiesReset); (Game.cookiesEarned + Game.cookiesReset);
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); // eslint-disable-line no-unused-vars
} }
+2 -3
View File
@@ -1,10 +1,9 @@
/* eslint-disable no-unused-vars */
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData'; import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData';
/** /**
* This functions caches the currently selected Dragon Auras * This functions caches the currently selected Dragon Auras
*/ */
export default function CacheDragonAuras() { export default function CacheDragonAuras() {
CacheDragonAura = Game.dragonAura; CacheDragonAura = Game.dragonAura; // eslint-disable-line no-unused-vars
CacheDragonAura2 = Game.dragonAura2; CacheDragonAura2 = Game.dragonAura2; // eslint-disable-line no-unused-vars
} }
+1 -4
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Functions related to the Dragon */ /** Functions related to the Dragon */
import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
@@ -6,8 +5,6 @@ import CopyData from '../../Sim/SimulationData/CopyData';
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData'; import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
import { import {
CacheCostDragonUpgrade, CacheCostDragonUpgrade,
CacheDragonAura,
CacheDragonAura2,
CacheLastDragonLevel, CacheLastDragonLevel,
} from '../VariablesAndData'; } from '../VariablesAndData';
@@ -70,7 +67,7 @@ export default function CacheDragonCost() {
cost += price; cost += price;
SimObjects[target].amount -= 1; SimObjects[target].amount -= 1;
} }
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; // eslint-disable-line no-unused-vars
}); });
} }
} }
+6 -7
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-param-reassign */
/* 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';
import { ColourGray } from '../../Disp/VariablesAndData'; import { ColourGray } from '../../Disp/VariablesAndData';
@@ -20,16 +18,17 @@ import ColourOfPP from './ColourOfPP';
function CacheColour(target, amount) { function CacheColour(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
if (CMOptions.PPRigidelMode && amount === 1) { if (CMOptions.PPRigidelMode && amount === 1) {
target[i].color = ColourGray; target[i].color = ColourGray; // eslint-disable-line no-param-reassign
return; return;
} }
// eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP( target[i].color = ColourOfPP(
target[i], target[i],
Game.Objects[i].getSumPrice(amount), Game.Objects[i].getSumPrice(amount),
); );
// 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 === CachePPArray[j][0]) target[i].color = ColourGray; if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
} }
}); });
} }
@@ -38,11 +37,11 @@ function CachePP(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
const price = Game.Objects[i].getSumPrice(amount); const price = Game.Objects[i].getSumPrice(amount);
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = target[i].pp = // eslint-disable-line no-param-reassign
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) /
Game.cookiesPs + Game.cookiesPs +
price / target[i].bonus; price / target[i].bonus;
} else target[i].pp = price / target[i].bonus; } else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
if (!(CMOptions.PPRigidelMode && amount === 1)) if (!(CMOptions.PPRigidelMode && amount === 1))
CachePPArray.push([target[i].pp, amount]); CachePPArray.push([target[i].pp, amount]);
}); });
@@ -73,7 +72,7 @@ export default function CacheBuildingsPP() {
} }
} }
} }
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; // eslint-disable-line no-unused-vars
CacheColour(CacheObjects1, 1); CacheColour(CacheObjects1, 1);
CacheColour(CacheObjects10, 10); CacheColour(CacheObjects10, 10);
+1 -4
View File
@@ -1,13 +1,10 @@
/* eslint-disable no-unused-vars */
/** Section: Functions related to caching income */ /** Section: Functions related to caching income */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome'; import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades'; import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
import { import {
CacheAverageCPS,
CacheAverageGainBank, CacheAverageGainBank,
CacheAverageGainWrink, CacheAverageGainWrink,
CacheAverageGainWrinkFattest, CacheAverageGainWrinkFattest,
@@ -30,7 +27,7 @@ function CacheBuildingIncome(amount) {
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; // eslint-disable-line no-unused-vars
} }
}); });
return result; return result;
+8 -9
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
import { import {
CacheChainFrenzyMaxReward, CacheChainFrenzyMaxReward,
@@ -89,8 +88,8 @@ export function CacheChain() {
maxPayout, maxPayout,
CacheGoldenCookiesMult, CacheGoldenCookiesMult,
); );
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars
CacheChainRequiredNext = CacheChainRequiredNext = // eslint-disable-line no-unused-vars
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment; CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
CacheChainWrathMaxReward = MaxChainCookieReward( CacheChainWrathMaxReward = MaxChainCookieReward(
@@ -98,9 +97,9 @@ export function CacheChain() {
maxPayout, maxPayout,
CacheWrathCookiesMult, CacheWrathCookiesMult,
); );
CacheChainWrathRequired = CacheChainWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult; (CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainWrathRequiredNext = CacheChainWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainWrathMaxReward[2] / CacheChainWrathMaxReward[2] /
60 / 60 /
60 / 60 /
@@ -112,9 +111,9 @@ export function CacheChain() {
maxPayout * 7, maxPayout * 7,
CacheGoldenCookiesMult, CacheGoldenCookiesMult,
); );
CacheChainFrenzyRequired = CacheChainFrenzyRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult; (CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
CacheChainFrenzyRequiredNext = CacheChainFrenzyRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyMaxReward[2] / CacheChainFrenzyMaxReward[2] /
60 / 60 /
60 / 60 /
@@ -126,9 +125,9 @@ export function CacheChain() {
maxPayout * 7, maxPayout * 7,
CacheWrathCookiesMult, CacheWrathCookiesMult,
); );
CacheChainFrenzyWrathRequired = CacheChainFrenzyWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult; (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainFrenzyWrathRequiredNext = CacheChainFrenzyWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyWrathMaxReward[2] / CacheChainFrenzyWrathMaxReward[2] /
60 / 60 /
60 / 60 /
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheHCPerSecond, CacheHCPerSecond,
CacheLastHeavenlyCheck, CacheLastHeavenlyCheck,
@@ -34,6 +33,6 @@ export default function CacheHeavenlyChipsPS() {
CacheLastHeavenlyChips = ascendNowToGet; CacheLastHeavenlyChips = ascendNowToGet;
// Get average gain over period of 5 seconds // Get average gain over period of 5 seconds
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5); CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5); // eslint-disable-line no-unused-vars
} }
} }
+2 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades'; import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades';
import { import {
CacheMissingUpgrades, CacheMissingUpgrades,
@@ -36,6 +35,7 @@ export default function CacheAllMissingUpgrades() {
let str = ''; let str = '';
str += crateMissing(me); str += crateMissing(me);
/* eslint-disable no-unused-vars */
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str; if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str; else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
else if ( else if (
@@ -44,6 +44,7 @@ export default function CacheAllMissingUpgrades() {
me.pool !== 'debug' me.pool !== 'debug'
) )
CacheMissingUpgrades += str; CacheMissingUpgrades += str;
/* eslint-enable no-unused-vars */
} }
}); });
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CacheSeaSpec } from '../VariablesAndData'; import { CacheSeaSpec } from '../VariablesAndData';
/** /**
@@ -12,6 +11,6 @@ export default function CacheSeasonSpec() {
if (Game.hasBuff('Elder frenzy')) val *= 0.5; if (Game.hasBuff('Elder frenzy')) val *= 0.5;
if (Game.hasBuff('Frenzy')) val *= 0.75; if (Game.hasBuff('Frenzy')) val *= 0.75;
CacheSeaSpec = Math.max(25, val); CacheSeaSpec = Math.max(25, val);
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2; if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2; // eslint-disable-line no-unused-vars
} }
} }
+6 -7
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Functions related to Caching stats */ /** Functions related to Caching stats */
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas'; import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
@@ -29,15 +28,15 @@ export function CacheStatsCookies() {
const cpsBuffMult = GetCPSBuffMult(); const cpsBuffMult = GetCPSBuffMult();
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult; if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
else CacheLucky = 0; else CacheLucky = 0;
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyFrenzy = CacheLucky * 7; CacheLuckyFrenzy = CacheLucky * 7;
CacheLuckyRewardFrenzy = CacheLuckyRewardFrenzy = // eslint-disable-line no-unused-vars
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
CacheLuckyWrathRewardFrenzy = CacheLuckyWrathRewardFrenzy = // eslint-disable-line no-unused-vars
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
CacheConjure = CacheLucky * 2; CacheConjure = CacheLucky * 2;
CacheConjureReward = CacheConjure * 0.15; CacheConjureReward = CacheConjure * 0.15; // eslint-disable-line no-unused-vars
CacheEdifice = 0; CacheEdifice = 0;
let max = 0; let max = 0;
@@ -53,7 +52,7 @@ export function CacheStatsCookies() {
Game.Objects[i].price * 2 > CacheEdifice Game.Objects[i].price * 2 > CacheEdifice
) { ) {
CacheEdifice = Game.Objects[i].price * 2; CacheEdifice = Game.Objects[i].price * 2;
CacheEdificeBuilding = i; CacheEdificeBuilding = i; // eslint-disable-line no-unused-vars
} }
}); });
} }
+2 -3
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Caches data related to Wrinklers */ /** Caches data related to Wrinklers */
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
@@ -32,9 +31,9 @@ export default function CacheWrinklers() {
else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl === 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
} }
CacheWrinklersTotal += sucked; CacheWrinklersTotal += sucked; // eslint-disable-line no-unused-vars
if (Game.wrinklers[i].type === 0) { if (Game.wrinklers[i].type === 0) {
CacheWrinklersNormal += sucked; CacheWrinklersNormal += sucked; // eslint-disable-line no-unused-vars
if (sucked > CacheWrinklersFattest[0]) if (sucked > CacheWrinklersFattest[0])
CacheWrinklersFattest = [sucked, i]; CacheWrinklersFattest = [sucked, i];
} }
+1 -1
View File
@@ -18,7 +18,7 @@ function CheckNotificationPermissions(ToggleOnOff) {
// Check if the browser supports notifications and which type // Check if the browser supports notifications and which type
if (!('Notification' in window)) { if (!('Notification' in window)) {
console.log('This browser does not support notifications.'); console.log('This browser does not support notifications.'); // eslint-disable-line no-console
} else if (checkNotificationPromise()) { } else if (checkNotificationPromise()) {
Notification.requestPermission().then(); Notification.requestPermission().then();
} else { } else {
+1 -1
View File
@@ -1,4 +1,3 @@
/* 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';
@@ -15,6 +14,7 @@ export default function ToggleGCTimer() {
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top; GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
}); });
} else { } else {
// eslint-disable-next-line no-return-assign
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none')); Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
} }
} }
+1 -3
View File
@@ -1,4 +1,2 @@
/* eslint-disable prefer-const */ export let CMOptions = {}; // eslint-disable-line prefer-const
export let CMOptions = {};
export const ConfigPrefix = 'CMConfig'; export const ConfigPrefix = 'CMConfig';
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import init from './InitSaveLoad/init'; import init from './InitSaveLoad/init';
import load from './InitSaveLoad/load'; import load from './InitSaveLoad/load';
import save from './InitSaveLoad/save'; import save from './InitSaveLoad/save';
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions'; import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles'; import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
import ToggleBotBar from '../Config/Toggles/ToggleBotBar'; import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
@@ -72,7 +71,7 @@ const Config = {
'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) wrinklers', 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) wrinklers',
true, true,
function () { function () {
SimDoSims = true; SimDoSims = true; // eslint-disable-line no-unused-vars
}, },
), ),
@@ -1,4 +1,3 @@
/* 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';
@@ -78,6 +77,7 @@ export function Beautify(num, floats, forced) {
} }
} }
if (answer === '') { if (answer === '') {
// eslint-disable-next-line no-console
console.log( console.log(
`Could not beautify number with Cookie Monster Beautify: ${num}`, `Could not beautify number with Cookie Monster Beautify: ${num}`,
); );
@@ -86,7 +86,7 @@ export function Beautify(num, floats, forced) {
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ','); if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
return answer; return answer;
} }
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
return BackupFunctions.Beautify(num, floats); return BackupFunctions.Beautify(num, floats);
} }
@@ -119,15 +119,15 @@ export function FormatTime(time, longFormat) {
return longFormat ? 'Over 9000 days!' : '>9000d'; 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')}, ` // eslint-disable-line no-nested-ternary
: ''; : '';
str += str +=
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : ''; d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : ''; // eslint-disable-line no-nested-ternary
if (str.length > 0 || h > 0) if (str.length > 0 || h > 0)
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; // eslint-disable-line no-nested-ternary
if (str.length > 0 || m > 0) if (str.length > 0 || m > 0)
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; // eslint-disable-line no-nested-ternary
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); // eslint-disable-line no-nested-ternary
} }
return str; return str;
} }
+4 -5
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-nested-ternary */
import { import {
CacheObjects1, CacheObjects1,
CacheObjects10, CacheObjects10,
@@ -72,10 +71,10 @@ export default function UpdateBuildings() {
}); });
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1
@@ -90,10 +89,10 @@ export default function UpdateBuildings() {
}); });
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1
+2 -3
View File
@@ -1,4 +1,3 @@
/* 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 {
@@ -81,9 +80,9 @@ export default function UpdateUpgrades() {
if (CMOptions.SortUpgrades) { if (CMOptions.SortUpgrades) {
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1
@@ -1,4 +1,3 @@
/* 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';
@@ -28,14 +27,14 @@ export default function CreateGCTimer(cookie) {
cookie.pop(); cookie.pop();
}; };
GCTimer.onmouseover = function () { GCTimer.onmouseover = function () {
cookie.l.style.filter = cookie.l.style.filter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
cookie.l.style.webkitFilter = cookie.l.style.webkitFilter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
}; };
GCTimer.onmouseout = function () { GCTimer.onmouseout = function () {
cookie.l.style.filter = ''; cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign
cookie.l.style.webkitFilter = ''; cookie.l.style.webkitFilter = ''; // eslint-disable-line no-param-reassign
}; };
GCTimers[cookie.id] = GCTimer; GCTimers[cookie.id] = GCTimer;
@@ -218,7 +218,6 @@ export default function CreatePrefOption(config) {
input.min = Config[config].min; input.min = Config[config].min;
input.max = Config[config].max; input.max = Config[config].max;
input.oninput = function () { input.oninput = function () {
if (this.value > this.max) console.log('TEST');
CMOptions[config] = this.value; CMOptions[config] = this.value;
SaveConfig(); SaveConfig();
RefreshScale(); RefreshScale();
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { CMOptions } from '../../../Config/VariablesAndData'; import { CMOptions } from '../../../Config/VariablesAndData';
function CrateTooltipLockedAchievements(me) { function CrateTooltipLockedAchievements(me) {
@@ -58,9 +57,11 @@ export default function AddMissingAchievements() {
if (!achievsCrate.className.includes('enabled')) { if (!achievsCrate.className.includes('enabled')) {
const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0]; const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0];
const { icon } = Game.AchievementsById[id]; const { icon } = Game.AchievementsById[id];
// eslint-disable-next-line no-param-reassign
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${ achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${
-icon[1] * 48 -icon[1] * 48
}px`; }px`;
// eslint-disable-next-line no-param-reassign
achievsCrate.onmouseover = function () { achievsCrate.onmouseover = function () {
if (!Game.mouseDown) { if (!Game.mouseDown) {
Game.setOnCrate(this); Game.setOnCrate(this);
+3 -3
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
ColourTextPre, ColourTextPre,
@@ -163,7 +162,7 @@ export function TooltipCreateCalculationSection(tooltip) {
tooltip.appendChild(income); tooltip.appendChild(income);
tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click')); tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click'));
tooltip.lastChild.style.display = 'none'; tooltip.lastChild.style.display = 'none'; // eslint-disable-line no-param-reassign
const click = document.createElement('div'); const click = document.createElement('div');
click.style.marginBottom = '4px'; click.style.marginBottom = '4px';
click.style.color = 'white'; click.style.color = 'white';
@@ -186,7 +185,8 @@ export function TooltipCreateCalculationSection(tooltip) {
tooltip.appendChild( tooltip.appendChild(
TooltipCreateHeader('Production left till next achievement'), TooltipCreateHeader('Production left till next achievement'),
); );
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left // Assign a id in order to hide when no achiev's are left
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // eslint-disable-line no-param-reassign
const production = document.createElement('div'); const production = document.createElement('div');
production.id = 'CMTooltipProduction'; production.id = 'CMTooltipProduction';
tooltip.appendChild(production); tooltip.appendChild(production);
+3 -6
View File
@@ -1,11 +1,8 @@
/* eslint-disable no-unused-vars */ import UpdateTooltips from './UpdateTooltips';
import UpdateTooltips, * as UpdateTooltip from './UpdateTooltips';
import { TooltipCreateTooltipBox } from './CreateTooltip';
import { import {
Beautify, Beautify,
GetTimeColour, GetTimeColour,
} from '../BeautifyAndFormatting/BeautifyFormatting'; } from '../BeautifyAndFormatting/BeautifyFormatting';
import CopyData from '../../Sim/SimulationData/CopyData';
import { import {
SimpleTooltipElements, SimpleTooltipElements,
TooltipName, TooltipName,
@@ -143,8 +140,8 @@ export function CreateTooltip(type, name) {
} }
// Sets global variables used by CM.Disp.UpdateTooltip() // Sets global variables used by CM.Disp.UpdateTooltip()
TooltipType = type; TooltipType = type; // eslint-disable-line no-unused-vars
TooltipName = name; TooltipName = name; // eslint-disable-line no-unused-vars
UpdateTooltips(); UpdateTooltips();
+9 -10
View File
@@ -1,4 +1,3 @@
/* eslint-disable prefer-const */
/** /**
* Section: Variables used in Disp functions */ * Section: Variables used in Disp functions */
@@ -91,15 +90,15 @@ export const SimpleTooltipElements = {};
* These are variables used by the functions that create tooltips for wrinklers * These are variables used by the functions that create tooltips for wrinklers
* See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() * See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
*/ */
export let TooltipWrinklerArea = 0; export let TooltipWrinklerArea = 0; // eslint-disable-line prefer-const
export let TooltipWrinkler = -1; export let TooltipWrinkler = -1; // eslint-disable-line prefer-const
/** /**
* This array is used to store whether a Wrinkler tooltip is being shown or not * This array is used to store whether a Wrinkler tooltip is being shown or not
* [i] = 1 means tooltip is being shown, [i] = 0 means hidden * [i] = 1 means tooltip is being shown, [i] = 0 means hidden
* It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() * It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
*/ */
export let TooltipWrinklerBeingShown = []; export let TooltipWrinklerBeingShown = []; // eslint-disable-line prefer-const
export let CMLastAscendState; export let CMLastAscendState;
export let CMSayTime; export let CMSayTime;
@@ -107,9 +106,9 @@ export let CMSayTime;
/** /**
* These are variables used to create various displays when the game is loaded on the "sell all" screen * These are variables used to create various displays when the game is loaded on the "sell all" screen
*/ */
export let LastTargetBotBar = 1; export let LastTargetBotBar = 1; // eslint-disable-line prefer-const
export let LastTargetBuildings = 1; export let LastTargetBuildings = 1; // eslint-disable-line prefer-const
export let LastTargetTooltipBuilding = 1; export let LastTargetTooltipBuilding = 1; // eslint-disable-line prefer-const
/** /**
* These arrays are used in the stats page to show * These arrays are used in the stats page to show
@@ -133,12 +132,12 @@ export const BuffColours = {
/** /**
* This array is used to track GC timers * This array is used to track GC timers
*/ */
export let GCTimers = {}; export let GCTimers = {}; // eslint-disable-line prefer-const
/** /**
* Used to store the number of cookies to be displayed in the tab-title * Used to store the number of cookies to be displayed in the tab-title
*/ */
export let Title = ''; export let Title = ''; // eslint-disable-line prefer-const
export let TooltipPrice; export let TooltipPrice;
export let TooltipBonusIncome; export let TooltipBonusIncome;
@@ -152,4 +151,4 @@ export let LastNumberOfTimers;
/** /**
* This stores the names of settings shown in the favourites section * This stores the names of settings shown in the favourites section
*/ */
export let FavouriteSettings = []; export let FavouriteSettings = []; // eslint-disable-line prefer-const
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable prefer-const */
/** Variable that shows if Cookie Moonster is initzializing */ /** Variable that shows if Cookie Moonster is initzializing */
export let isInitializing = false; export let isInitializing = false; // eslint-disable-line prefer-const
export let test; export let test;
+2 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import CMDrawHook from '../Disp/DrawHook'; import CMDrawHook from '../Disp/DrawHook';
import CMClickHook from '../Main/ClickHook'; import CMClickHook from '../Main/ClickHook';
@@ -16,6 +15,7 @@ export default function init() {
isInitializing = true; isInitializing = true;
let proceed = true; let proceed = true;
if (Game.version !== Number(VersionMajor)) { if (Game.version !== Number(VersionMajor)) {
// eslint-disable-next-line no-restricted-globals, no-alert
proceed = confirm( proceed = confirm(
`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`, `Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`,
); );
@@ -25,6 +25,6 @@ export default function init() {
Game.registerHook('draw', CMDrawHook); Game.registerHook('draw', CMDrawHook);
Game.registerHook('logic', CMLoopHook); Game.registerHook('logic', CMLoopHook);
Game.registerHook('click', CMClickHook); Game.registerHook('click', CMClickHook);
isInitializing = false; isInitializing = false; // eslint-disable-line no-unused-vars
} }
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings'; import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import { FavouriteSettings } from '../Disp/VariablesAndData'; import { FavouriteSettings } from '../Disp/VariablesAndData';
@@ -13,7 +12,7 @@ export default function load(str) {
InitData(); InitData();
// The if-statement is a failsafe for old saves // The if-statement is a failsafe for old saves
if (typeof save.favouriteSettings !== 'undefined') if (typeof save.favouriteSettings !== 'undefined')
FavouriteSettings = save.favouriteSettings; FavouriteSettings = save.favouriteSettings; // eslint-disable-line no-unused-vars
LoadConfig(save.settings); LoadConfig(save.settings);
if (save.version !== `${VersionMajor}.${VersionMinor}`) { if (save.version !== `${VersionMajor}.${VersionMinor}`) {
if (Game.prefs.popups) if (Game.prefs.popups)
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheSpawnedGoldenShimmer, CacheSpawnedGoldenShimmer,
CacheGoldenShimmersByID, CacheGoldenShimmersByID,
@@ -66,7 +65,7 @@ export default function CheckGoldenCookie() {
} }
UpdateFavicon(); UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState; LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; // eslint-disable-line no-unused-vars
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) { } else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
Object.keys(GCTimers).forEach((i) => { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity; GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
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';
@@ -15,7 +14,7 @@ export default function CheckSeasonPopup() {
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned; LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
Object.keys(Game.shimmers).forEach((i) => { 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]; // eslint-disable-line no-unused-vars
} }
}); });
Flash(3, 'SeaFlash', false); Flash(3, 'SeaFlash', false);
+2 -4
View File
@@ -1,10 +1,8 @@
/* eslint-disable no-unused-vars */
import InitCache from '../Cache/CacheInit'; import InitCache from '../Cache/CacheInit';
import { CacheStatsCookies } from '../Cache/Stats/Stats'; import { CacheStatsCookies } from '../Cache/Stats/Stats';
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings'; import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar'; import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
import UpdateColours from '../Disp/HelperFunctions/UpdateColours';
import { CreateBotBar } from '../Disp/InfoBars/BottomBar'; import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar'; import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons'; import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
@@ -31,7 +29,7 @@ export default function InitializeCookieMonster() {
InitCache(); InitCache();
// Stored to check if we need to re-initiliaze data // Stored to check if we need to re-initiliaze data
LastModCount = Object.keys(Game.mods).length; LastModCount = Object.keys(Game.mods).length; // eslint-disable-line no-unused-vars
// Creating visual elements // Creating visual elements
CreateCssArea(); CreateCssArea();
@@ -60,7 +58,7 @@ export default function InitializeCookieMonster() {
Game.CalculateGains(); Game.CalculateGains();
LoadConfig(); LoadConfig();
CMLastAscendState = Game.OnAscend; CMLastAscendState = Game.OnAscend; // eslint-disable-line no-unused-vars
if (Game.prefs.popups) if (Game.prefs.popups)
Game.Popup( Game.Popup(
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
@@ -47,8 +46,8 @@ function ReplaceNativeGrimoireLaunch() {
Game.Objects['Wizard tower'].minigameLoaded Game.Objects['Wizard tower'].minigameLoaded
) { ) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireLaunch = minigame.launch; BackupGrimoireLaunch = minigame.launch; // eslint-disable-line no-unused-vars
BackupGrimoireLaunchMod = new Function( BackupGrimoireLaunchMod = new Function( // eslint-disable-line no-new-func
`return ${minigame.launch `return ${minigame.launch
.toString() .toString()
.split('=this') .split('=this')
+2 -3
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */
/** Functions related to replacing tooltips */ /** Functions related to replacing tooltips */
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip'; import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
@@ -39,7 +37,7 @@ function ReplaceTooltipBuild() {
*/ */
function ReplaceTooltipLump() { function ReplaceTooltipLump() {
if (Game.canLumps()) { if (Game.canLumps()) {
TooltipLumpBackup = l('lumps').onmouseover; TooltipLumpBackup = l('lumps').onmouseover; // eslint-disable-line no-unused-vars
l('lumps').onmouseover = function () { l('lumps').onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(
@@ -72,6 +70,7 @@ function ReplaceTooltipGarden() {
}; };
Array.from(l('gardenPlot').children).forEach((child) => { Array.from(l('gardenPlot').children).forEach((child) => {
const coords = child.id.slice(-3); const coords = child.id.slice(-3);
// eslint-disable-next-line no-param-reassign
child.onmouseover = function () { child.onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(
+12 -5
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import jscolor from '@eastdesire/jscolor'; import jscolor from '@eastdesire/jscolor';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
@@ -13,7 +12,11 @@ import UpdateTooltipLocation from '../../Disp/Tooltips/PositionLocation';
import { CMSayTime, Title } from '../../Disp/VariablesAndData'; import { CMSayTime, Title } from '../../Disp/VariablesAndData';
import { SimDoSims } from '../../Sim/VariablesAndData'; import { SimDoSims } from '../../Sim/VariablesAndData';
import ReplaceTooltipUpgrade from '../ReplaceGameElements/TooltipUpgrades'; import ReplaceTooltipUpgrade from '../ReplaceGameElements/TooltipUpgrades';
import { BackupFunctions } from '../VariablesAndData'; import {
BackupFunctions,
CenturyDateAtBeginLoop,
CycliusDateAtBeginLoop,
} from '../VariablesAndData';
import FixMouseY from './FixMouse'; import FixMouseY from './FixMouse';
/** /**
@@ -28,12 +31,14 @@ export default function ReplaceNative() {
BackupFunctions.CalculateGains = Game.CalculateGains; BackupFunctions.CalculateGains = Game.CalculateGains;
Game.CalculateGains = function () { Game.CalculateGains = function () {
BackupFunctions.CalculateGains(); BackupFunctions.CalculateGains();
SimDoSims = 1; SimDoSims = 1; // eslint-disable-line no-unused-vars
CycliusDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
CenturyDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
}; };
BackupFunctions.tooltip = {}; BackupFunctions.tooltip = {};
BackupFunctions.tooltip.draw = Game.tooltip.draw; BackupFunctions.tooltip.draw = Game.tooltip.draw;
BackupFunctions.tooltip.drawMod = new Function( BackupFunctions.tooltip.drawMod = new Function( // eslint-disable-line no-new-func
`return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`, `return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`,
)(); )();
Game.tooltip.draw = function (from, text, origin) { Game.tooltip.draw = function (from, text, origin) {
@@ -41,7 +46,7 @@ export default function ReplaceNative() {
}; };
BackupFunctions.tooltip.update = Game.tooltip.update; BackupFunctions.tooltip.update = Game.tooltip.update;
BackupFunctions.tooltip.updateMod = new Function( BackupFunctions.tooltip.updateMod = new Function( // eslint-disable-line no-new-func
`return ${Game.tooltip.update `return ${Game.tooltip.update
.toString() .toString()
.split('this.') .split('this.')
@@ -126,6 +131,7 @@ export default function ReplaceNative() {
}; };
BackupFunctions.sayTime = Game.sayTime; BackupFunctions.sayTime = Game.sayTime;
// eslint-disable-next-line no-unused-vars
CMSayTime = function (time, detail) { CMSayTime = function (time, detail) {
if (Number.isNaN(time) || time <= 0) if (Number.isNaN(time) || time <= 0)
return BackupFunctions.sayTime(time, detail); return BackupFunctions.sayTime(time, detail);
@@ -139,6 +145,7 @@ export default function ReplaceNative() {
// Update tab title // Update tab title
let title = 'Cookie Clicker'; let title = 'Cookie Clicker';
if (Game.season === 'fools') title = 'Cookie Baker'; if (Game.season === 'fools') title = 'Cookie Baker';
// eslint-disable-next-line no-unused-vars
Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${ Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${
Game.cookies === 1 ? 'cookie' : 'cookies' Game.cookies === 1 ? 'cookie' : 'cookies'
} - ${title}`; } - ${title}`;
+12 -6
View File
@@ -1,17 +1,15 @@
/* eslint-disable prefer-const */
export let LastModCount; export let LastModCount;
export let TooltipBuildBackup = []; export let TooltipBuildBackup = []; // eslint-disable-line prefer-const
export let TooltipLumpBackup; export let TooltipLumpBackup;
export let TooltipGrimoireBackup = []; export let TooltipGrimoireBackup = []; // eslint-disable-line prefer-const
export let TooltipUpgradeBackup = []; export let TooltipUpgradeBackup = []; // eslint-disable-line prefer-const
export let BackupGrimoireLaunch; export let BackupGrimoireLaunch;
export let BackupGrimoireLaunchMod; export let BackupGrimoireLaunchMod;
export let BackupGrimoireDraw; export let BackupGrimoireDraw;
export let HasReplaceNativeGrimoireLaunch; export let HasReplaceNativeGrimoireLaunch;
export let HasReplaceNativeGrimoireDraw; export let HasReplaceNativeGrimoireDraw;
export let LoadMinigames; export let LoadMinigames;
export let BackupFunctions = {}; export let BackupFunctions = {}; // eslint-disable-line prefer-const
export let LastSeasonPopupState; export let LastSeasonPopupState;
export let LastTickerFortuneState; export let LastTickerFortuneState;
@@ -21,3 +19,11 @@ export let LastSpawnedGoldenCookieState;
export let LastMagicBarFull; export let LastMagicBarFull;
export let CurrSpawnedGoldenCookieState; export let CurrSpawnedGoldenCookieState;
export let LastWrinklerCount; export let LastWrinklerCount;
/** Stores the date at Game.CalculateGains for God Cyclius
*/
export let CycliusDateAtBeginLoop = Date.now(); // eslint-disable-line prefer-const
/** Stores the date at Game.CalculateGains for the Century egg
*/
export let CenturyDateAtBeginLoop = Date.now(); // eslint-disable-line prefer-const
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
TooltipWrinklerArea, TooltipWrinklerArea,
TooltipWrinklerBeingShown, TooltipWrinklerBeingShown,
@@ -13,7 +12,7 @@ export default function AddWrinklerAreaDetect() {
TooltipWrinklerArea = 1; TooltipWrinklerArea = 1;
}; };
l('backgroundLeftCanvas').onmouseout = function () { l('backgroundLeftCanvas').onmouseout = function () {
TooltipWrinklerArea = 0; TooltipWrinklerArea = 0; // eslint-disable-line no-unused-vars
Game.tooltip.hide(); Game.tooltip.hide();
Object.keys(Game.wrinklers).forEach((i) => { Object.keys(Game.wrinklers).forEach((i) => {
TooltipWrinklerBeingShown[i] = 0; TooltipWrinklerBeingShown[i] = 0;
+22 -7
View File
@@ -1,6 +1,9 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
import { CacheCentEgg } from '../../Cache/VariablesAndData'; import { CacheCentEgg } from '../../Cache/VariablesAndData';
import {
CenturyDateAtBeginLoop,
CycliusDateAtBeginLoop,
} from '../../Main/VariablesAndData';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult'; import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff'; import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier'; import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier';
@@ -38,7 +41,7 @@ export default function CalculateGains() {
}); });
} }
}); });
SimEffs = effs; SimEffs = effs; // eslint-disable-line no-unused-vars
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1)
mult += mult +=
@@ -92,13 +95,25 @@ export default function CalculateGains() {
godLvl = SimHasGod('ages'); godLvl = SimHasGod('ages');
if (godLvl === 1) if (godLvl === 1)
mult *= mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 3)) * Math.PI * 2); 1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2,
);
else if (godLvl === 2) else if (godLvl === 2)
mult *= mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 12)) * Math.PI * 2); 1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2,
);
else if (godLvl === 3) else if (godLvl === 3)
mult *= mult *=
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 24)) * Math.PI * 2); 1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2,
);
godLvl = SimHasGod('decadence'); godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93; if (godLvl === 1) buildMult *= 0.93;
@@ -189,7 +204,7 @@ export default function CalculateGains() {
if (SimHas('Century egg')) { if (SimHas('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day // The boost increases a little every day, with diminishing returns up to +10% on the 100th day
let day = let day =
(Math.floor((Date.now() - Game.startDate) / 1000 / 10) * 10) / (Math.floor((CenturyDateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) /
60 / 60 /
60 / 60 /
24; 24;
@@ -211,7 +226,7 @@ export default function CalculateGains() {
SimWin(Game.CpsAchievements[i].name); SimWin(Game.CpsAchievements[i].name);
}); });
SimCookiesPsRaw = rawCookiesPs; SimCookiesPsRaw = rawCookiesPs; // eslint-disable-line no-unused-vars
const { n } = Game.shimmerTypes.golden; const { n } = Game.shimmerTypes.golden;
const auraMult = SimAuraMult("Dragon's Fortune"); const auraMult = SimAuraMult("Dragon's Fortune");
+10 -11
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras'; import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras';
import { import {
CacheDragonAura, CacheDragonAura,
@@ -30,11 +29,11 @@ import {
*/ */
export default function CopyData() { export default function CopyData() {
// Other variables // Other variables
SimUpgradesOwned = Game.UpgradesOwned; SimUpgradesOwned = Game.UpgradesOwned; // eslint-disable-line no-unused-vars
SimPledges = Game.pledges; SimPledges = Game.pledges; // eslint-disable-line no-unused-vars
SimAchievementsOwned = Game.AchievementsOwned; SimAchievementsOwned = Game.AchievementsOwned; // eslint-disable-line no-unused-vars
SimHeavenlyPower = Game.heavenlyPower; SimHeavenlyPower = Game.heavenlyPower; // eslint-disable-line no-unused-vars
SimPrestige = Game.prestige; SimPrestige = Game.prestige; // eslint-disable-line no-unused-vars
// Buildings // Buildings
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
@@ -53,9 +52,9 @@ export default function CopyData() {
you.free = me.free; you.free = me.free;
if (me.minigameLoaded) { if (me.minigameLoaded) {
if (me.name === 'Temple') { if (me.name === 'Temple') {
SimGod1 = me.minigame.slot[0]; SimGod1 = me.minigame.slot[0]; // eslint-disable-line no-unused-vars
SimGod2 = me.minigame.slot[1]; SimGod2 = me.minigame.slot[1]; // eslint-disable-line no-unused-vars
SimGod3 = me.minigame.slot[2]; SimGod3 = me.minigame.slot[2]; // eslint-disable-line no-unused-vars
} }
you.minigameLoaded = me.minigameLoaded; you.minigameLoaded = me.minigameLoaded;
you.minigame = me.minigame; you.minigame = me.minigame;
@@ -89,6 +88,6 @@ export default function CopyData() {
// Auras // Auras
CacheDragonAuras(); CacheDragonAuras();
SimDragonAura = CacheDragonAura; SimDragonAura = CacheDragonAura; // eslint-disable-line no-unused-vars
SimDragonAura2 = CacheDragonAura2; SimDragonAura2 = CacheDragonAura2; // eslint-disable-line no-unused-vars
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData'; import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData';
/** /**
@@ -11,7 +10,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 += 1; if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1; // eslint-disable-line no-unused-vars
} }
} }
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheDragonAura, CacheDragonAura,
CacheDragonAura2, CacheDragonAura2,
@@ -41,7 +40,7 @@ export default function CalculateChangeAura(aura) {
if (Game.ObjectsById[i].amount > 0) { if (Game.ObjectsById[i].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name; const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1; SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1; SimBuildingsOwned -= 1; // eslint-disable-line no-unused-vars
price = price =
SimObjects[highestBuilding].basePrice * SimObjects[highestBuilding].basePrice *
Game.priceIncrease ** Game.priceIncrease **
+1 -3
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult'; import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
@@ -130,9 +129,8 @@ export default function BuyUpgradesBonusIncome(upgrade) {
} else { } else {
SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2; SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2;
} }
const me = SimUpgrades[upgrade];
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))
SimUpgradesOwned += 1; SimUpgradesOwned += 1; // eslint-disable-line no-unused-vars
if (upgrade === 'Elder Pledge') { if (upgrade === 'Elder Pledge') {
SimPledges += 1; SimPledges += 1;
+8 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData'; import CopyData from '../SimulationData/CopyData';
@@ -14,14 +13,21 @@ import {
* This functions calculates the cps and cost of changing a Dragon Aura * This functions calculates the cps and cost of changing a Dragon Aura
* It is called by CM.Disp.AddAuraInfo() * It is called by CM.Disp.AddAuraInfo()
* @param {number} god The number of the slot to be swapped in * @param {number} god The number of the slot to be swapped in
* * @param {number slot The slot the god will go to * @param {number slot The slot the god will go to
* @returns {number} CM.Sim.cookiesPs - Game.cookiesPs The bonus cps and the price of the change * @returns {number} CM.Sim.cookiesPs - Game.cookiesPs The bonus cps and the price of the change
*/ */
export default function CalculateChangeGod(god, slot) { export default function CalculateChangeGod(god, slot) {
CopyData(); CopyData();
const { minigame } = Game.Objects.Temple;
const CurrentSlot = minigame.godsById[god].slot;
if (CurrentSlot === '0') SimGod1 = minigame.slot[slot];
else if (CurrentSlot === '1') SimGod2 = minigame.slot[slot];
else if (CurrentSlot === '2') SimGod3 = minigame.slot[slot];
/* eslint-disable no-unused-vars */
if (slot === 0) SimGod1 = god; if (slot === 0) SimGod1 = god;
else if (slot === 1) SimGod2 = god; else if (slot === 1) SimGod2 = god;
else if (slot === 2) SimGod3 = god; else if (slot === 2) SimGod3 = god;
/* eslint-enable no-unused-vars */
const lastAchievementsOwned = SimAchievementsOwned; const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains(); CalculateGains();
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CacheRealCookiesEarned } from '../../Cache/VariablesAndData'; import { CacheRealCookiesEarned } from '../../Cache/VariablesAndData';
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
@@ -96,7 +95,7 @@ export default function ResetBonus(newHeavenlyChips) {
const ResetCPS = SimCookiesPs - curCPS; const ResetCPS = SimCookiesPs - curCPS;
// Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local // Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local
SimPrestige = Game.prestige; SimPrestige = Game.prestige; // eslint-disable-line no-unused-vars
return ResetCPS; return ResetCPS;
} }
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CopyData from '../SimulationData/CopyData'; import CopyData from '../SimulationData/CopyData';
import { import {
SimBuildingsOwned, SimBuildingsOwned,
@@ -38,7 +37,7 @@ export default function SellBuildingsForChoEgg() {
} }
}); });
SimObjects[highestBuilding].amount -= 1; SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1; SimBuildingsOwned -= 1; // eslint-disable-line no-unused-vars
} }
// Get money made by selling all remaining buildings // Get money made by selling all remaining buildings
+3 -4
View File
@@ -1,9 +1,8 @@
/* eslint-disable prefer-const */
/** All variables used by simulation functions */ /** All variables used by simulation functions */
export let SimObjects = []; export let SimObjects = []; // eslint-disable-line prefer-const
export let SimUpgrades = []; export let SimUpgrades = []; // eslint-disable-line prefer-const
export let SimAchievements = []; export let SimAchievements = []; // eslint-disable-line prefer-const
export let SimBuildingsOwned; export let SimBuildingsOwned;
export let SimUpgradesOwned; export let SimUpgradesOwned;
export let SimPledges; export let SimPledges;