Merge pull request #635 from DanielNoord/code/modules

Code/modules
This commit is contained in:
Daniël van Noord
2021-03-09 23:35:04 +01:00
committed by GitHub
27 changed files with 6364 additions and 3830 deletions

View File

@@ -1,2 +1,5 @@
CookieMonster.js
CookieMonster.user.js
src/*.js
!src/*/*
dist/*

View File

@@ -16,7 +16,8 @@ jobs:
- name: Check if CookieMonster.js is built correctly
run: |
npm install
npx terser ./src/Header.js ./src/Cache.js ./src/Config.js ./src/Data.js ./src/Disp.js ./src/Main.js ./src/Sim.js ./src/Footer.js -o CookieMonsterTest.js
npx webpack
npx terser ./dist/Header.js ./dist/Cache.js ./dist/Config.js ./dist/Data.js ./dist/Disp.js ./dist/Main.js ./dist/Sim.js ./dist/Footer.js -o CookieMonsterTest.js
if cmp CookieMonster.js CookieMonsterTest.js; then
echo '### SUCCESS: CookieMonster is correctly built! ###'
else

File diff suppressed because one or more lines are too long

1
dist/Cache.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/Config.js vendored Normal file
View File

@@ -0,0 +1 @@
CM.Config.SaveConfig=function(){const o=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),i=o.match(/CookieMonster.*(;|$)/);if(null!==i){const n=o.replace(i[0],`CookieMonster:${CM.save()}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(n)}!END!`))}},CM.Config.LoadConfig=function(o){if(void 0!==localStorage.CMConfig&&delete localStorage.CMConfig,void 0!==o){CM.Options=o;let i=!1;for(const o in CM.Data.ConfigDefault)if(void 0===CM.Options[o])i=!0,CM.Options[o]=CM.Data.ConfigDefault[o];else if("Header"!==o&&"Colors"!==o)-1===o.indexOf("SoundURL")?CM.Options[o]>-1&&CM.Options[o]<CM.Data.Config[o].label.length||(i=!0,CM.Options[o]=CM.Data.ConfigDefault[o]):"string"!=typeof CM.Options[o]&&(i=!0,CM.Options[o]=CM.Data.ConfigDefault[o]);else if("Header"===o)for(const n in CM.Data.ConfigDefault.Header)void 0!==CM.Options[o][n]&&CM.Options[o][n]>-1&&CM.Options[o][n]<2||(i=!0,CM.Options[o][n]=CM.Data.ConfigDefault[o][n]);else for(const n in CM.Data.ConfigDefault.Colors)void 0!==CM.Options[o][n]&&"string"==typeof CM.Options[o][n]||(i=!0,CM.Options[o][n]=CM.Data.ConfigDefault[o][n]);i&&CM.Config.SaveConfig(),CM.Main.Loop();for(const o in CM.Data.ConfigDefault)"Header"!==o&&void 0!==CM.Data.Config[o].func&&CM.Data.Config[o].func()}else CM.Config.RestoreDefault()},CM.Config.RestoreDefault=function(){CM.Config.LoadConfig(CM.Data.ConfigDefault),CM.Config.SaveConfig(),Game.UpdateMenu()},CM.Config.ToggleConfig=function(o){CM.Options[o]++,CM.Options[o]===CM.Data.Config[o].label.length?(CM.Options[o]=0,CM.Data.Config[o].toggle&&(l(CM.Config.ConfigPrefix+o).className="option off")):l(CM.Config.ConfigPrefix+o).className="option",void 0!==CM.Data.Config[o].func&&CM.Data.Config[o].func(),l(CM.Config.ConfigPrefix+o).innerHTML=CM.Data.Config[o].label[CM.Options[o]],CM.Config.SaveConfig()},CM.Config.ToggleConfigVolume=function(o){null!==l(`slider${o}`)&&(l(`slider${o}right`).innerHTML=`${l(`slider${o}`).value}%`,CM.Options[o]=Math.round(l(`slider${o}`).value)),CM.Config.SaveConfig()},CM.Config.ToggleHeader=function(o){CM.Options.Header[o]++,CM.Options.Header[o]>1&&(CM.Options.Header[o]=0),CM.Config.SaveConfig()},CM.Config.CheckNotificationPermissions=function(o){if(1===o){const o=function(){try{Notification.requestPermission().then()}catch(o){return!1}return!0};"Notification"in window?o()?Notification.requestPermission().then():Notification.requestPermission():console.log("This browser does not support notifications.")}},CM.Config.ConfigPrefix="CMConfig";

1
dist/Data.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/Disp.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/Footer.js vendored Normal file
View File

@@ -0,0 +1 @@
(()=>{if(CM.init=function(){CM.Footer.isInitzializing=!0;let o=!0;Game.version!==Number(CM.VersionMajor)&&(o=confirm(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} is meant for Game version ${CM.VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`)),o&&(CM.Main.DelayInit(),Game.registerHook("draw",CM.Disp.Draw),Game.registerHook("logic",CM.Main.Loop),CM.Footer.isInitzializing=!1)},CM.save=function(){return JSON.stringify({settings:CM.Options,version:`${CM.VersionMajor}.${CM.VersionMinor}`})},CM.load=function(o){const e=JSON.parse(o);CM.Sim.InitData(),CM.Config.LoadConfig(e.settings),e.version!==`${CM.VersionMajor}.${CM.VersionMinor}`&&(Game.prefs.popups?Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!"):Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1))},CM.Footer.AddJscolor=function(){CM.Footer.Jscolor=document.createElement("script"),CM.Footer.Jscolor.type="text/javascript",CM.Footer.Jscolor.setAttribute("src","https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js"),document.head.appendChild(CM.Footer.Jscolor)},void 0===CM.Footer.isInitzializing){CM.Footer.AddJscolor();const o=setInterval((function(){"undefined"!=typeof jscolor&&(jscolor.init(),Game.registerMod("CookieMonster",CM),clearInterval(o))}),500)}})();

1
dist/Header.js vendored Normal file
View File

@@ -0,0 +1 @@
CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"5"};

1
dist/Main.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/Sim.js vendored Normal file

File diff suppressed because one or more lines are too long

2314
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,107 +1,32 @@
/**
* Data *
*/
import {
Fortunes, HalloCookies, ChristCookies, ValCookies, PlantDrops, Effects,
} from './src/Gamedata';
import { ModDescription, LatestReleaseNotes } from './src/Moddata';
import { metric, shortScale, shortScaleAbbreviated } from './src/Scales';
import { ConfigGroups, ConfigGroupsNotification } from './src/Sectionheader';
/**
* Section: Data used in the stats page to show not yet purchased updates. See CM.Disp.CreateStatsMissDisp() */
const Data = {
Fortunes: Fortunes,
HalloCookies: HalloCookies,
ChristCookies: ChristCookies,
ValCookies: ValCookies,
PlantDrops: PlantDrops,
Effects: Effects,
CM.Data.Fortunes = [
'Fortune #001',
'Fortune #002',
'Fortune #003',
'Fortune #004',
'Fortune #005',
'Fortune #006',
'Fortune #007',
'Fortune #008',
'Fortune #009',
'Fortune #010',
'Fortune #011',
'Fortune #012',
'Fortune #013',
'Fortune #014',
'Fortune #015',
'Fortune #016',
'Fortune #017',
'Fortune #018',
'Fortune #100',
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104',
];
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits'];
CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup'];
ModDescription: ModDescription,
LatestReleaseNotes: LatestReleaseNotes,
/**
* Section: All possible effects plants and other items can have with an explanation */
metric: metric,
shortScale: shortScale,
shortScaleAbbreviated: shortScaleAbbreviated,
CM.Data.Effects = {
buildingCost: 'Building prices',
click: 'Cookies per click',
cps: 'Total CPS',
cursorCps: 'Cursor CPS',
goldenCookieDur: 'Golden cookie duration',
goldenCookieEffDur: 'Golden cookie effect duration',
goldenCookieFreq: 'Golden cookie frequency',
goldenCookieGain: 'Golden cookie gains',
grandmaCps: 'Grandma CPS',
itemDrops: 'Random item drop chance',
milk: 'Effect from milk',
reindeerDur: 'Reindeer duration',
reindeerFreq: 'Reindeer frequency',
reindeerGain: 'Reindeer gains',
upgradeCost: 'Upgrade prices',
wrathCookieDur: 'Wrath cookie duration',
wrathCookieEffDur: 'Wrath cookie effect duration',
wrathCookieFreq: 'Wrath cookie frequency',
wrathCookieGain: 'Wrath cookie gains',
wrinklerEat: 'Wrinkler ',
wrinklerSpawn: 'Wrinkler spawn frequency',
ConfigGroups: ConfigGroups,
ConfigGroupsNotification: ConfigGroupsNotification,
Config: {},
};
/**
* Section: Data for the various scales used by CookieMonster */
CM.Data.metric = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
CM.Data.shortScale = ['', '', 'M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec', 'Quattuordec', 'Quindec', 'Sexdec', 'Septendec', 'Octodec', 'Novemdec', 'Vigint', 'Unvigint', 'Duovigint', 'Trevigint', 'Quattuorvigint'];
CM.Data.shortScaleAbbreviated = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'De',
'UDe', 'DDe', 'TDe', 'QaDe', 'QiDe', 'SxDe', 'SpDe', 'ODe', 'NDe', 'Vi',
'UVi', 'DVi', 'TVi', 'QaVi', 'QiVi', 'SxVi', 'SpVi', 'OVi', 'NVi', 'Tr',
'UTr', 'DTr', 'TTr', 'QaTr', 'QiTr', 'SxTr', 'SpTr', 'OTr', 'NTr', 'Qaa',
'UQa', 'DQa', 'TQa', 'QaQa', 'QiQa', 'SxQa', 'SpQa', 'OQa', 'NQa', 'Qia',
'UQi', 'DQi', 'TQi', 'QaQi', 'QiQi', 'SxQi', 'SpQi', 'OQi', 'NQi', 'Sxa',
'USx', 'DSx', 'TSx', 'QaSx', 'QiSx', 'SxSx', 'SpSx', 'OSx', 'NSx', 'Spa',
'USp', 'DSp', 'TSp', 'QaSp', 'QiSp', 'SxSp', 'SpSp', 'OSp', 'NSp', 'Oco',
'UOc', 'DOc', 'TOc', 'QaOc', 'QiOc', 'SxOc', 'SpOc', 'OOc', 'NOc', 'Noa',
'UNo', 'DNo', 'TNo', 'QaNo', 'QiNo', 'SxNo', 'SpNo', 'ONo', 'NNo', 'Ct',
'UCt'];
/**
* Section: Two array's containing all Config groups and their to-be displayed title */
CM.Data.ConfigGroups = {
BarsColors: 'Bars/Colors',
Calculation: 'Calculation',
Notification: 'Notification',
Tooltip: 'Tooltips and additional insights',
Statistics: 'Statistics',
Notation: 'Notation',
Miscellaneous: 'Miscellaneous',
};
CM.Data.ConfigGroupsNotification = {
NotificationGeneral: 'General Notifications',
NotificationGC: 'Golden Cookie',
NotificationFC: 'Fortune Cookie',
NotificationSea: 'Season Special',
NotificationGard: 'Garden Tick',
NotificationMagi: 'Full Magic Bar',
NotificationWrink: 'Wrinkler',
NotificationWrinkMax: 'Maximum Wrinklers',
};
CM.Data = Data;
/**
* Section: An array (CM.Data.Config) containing all Config options and an array of default settings */
@@ -523,50 +448,3 @@ CM.Data.ConfigDefault = {
BarsColors: 1, Calculation: 1, Notification: 1, NotificationGeneral: 1, NotificationGC: 1, NotificationFC: 1, NotificationSea: 1, NotificationGard: 1, NotificationMagi: 1, NotificationWrink: 1, NotificationWrinkMax: 1, Tooltip: 1, Statistics: 1, Notation: 1, Miscellaneous: 1, Lucky: 1, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1,
},
};
/**
* These variables are used to describe Cookie Monster in the info tab
* It is used by CM.Disp.AddMenuInfo()
*/
CM.Data.ModDescription = `<div class="listing">
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
offers a wide range of tools and statistics to enhance your game experience.
It is not a cheat interface although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
Please also report any bugs you may find over there!</br>
</div>
`;
CM.Data.LatestReleaseNotes = `<div class="listing">
<b>The latest update (v 2.031.4) has introduced the following features:</b></br>
- Added a changelog to the info tab and notification indicating a new version</br>
- Warnings in tooltips are now based on the income after buying the upgrade</br>
- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added</br>
- User can now set a custom tooltip warning ("x times cps") in the settings</br>
- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward</br>
- The Harvest All button in the Garden now has a tooltip displaying the current reward </br>
- The Ascend button can now display additional info (this can be turned off in the settings) </br>
- The statistics page now displays the Heavenly Chips per second</br>
- The statistics page now displays the CPS needed for the next level in Chain Cookies</br>
- The statistics page now displays the cookies needed for optimal rewards for garden plants</br>
- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page</br>
- The color picker in the settings has been updated to its latest version</br>
- The overlay of seconds/percentage of timers is now toggle able and more readable</br>
- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)</br>
- CookieMonster now uses the Modding API provided by the base game</br>
- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod</br>
- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn</br>
- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment</br>
</br>
<b>This update fixes the following bugs:</b></br>
- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded</br>
- Sound, Flashes and Notifications will no longer play when the mod is initializing</br>
- The color picker should now update its display consistently</br>
- Fixed some typo's</br>
- Fixed a game breaking bug when the player had not purchased any upgrades</br>
- Fixed a number of console errors thrown by CM</br>
- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster</br>
- The Timer bar will now disappear correctly when the Golden Switch has been activated</br>
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats</br>
- Fixed buy warnings showing incorrectly</br>
</div>
`;

94
src/Data/src/Gamedata.js Normal file
View File

@@ -0,0 +1,94 @@
/** Data copied directly from the game */
/** Array of the names of all fortune cookies obtainable from the ticker */
export const Fortunes = [
'Fortune #001',
'Fortune #002',
'Fortune #003',
'Fortune #004',
'Fortune #005',
'Fortune #006',
'Fortune #007',
'Fortune #008',
'Fortune #009',
'Fortune #010',
'Fortune #011',
'Fortune #012',
'Fortune #013',
'Fortune #014',
'Fortune #015',
'Fortune #016',
'Fortune #017',
'Fortune #018',
'Fortune #100',
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104',
];
/** Array of the names of all Halloween cookies */
export const HalloCookies = [
'Skull cookies',
'Ghost cookies',
'Bat cookies',
'Slime cookies',
'Pumpkin cookies',
'Eyeball cookies',
'Spider cookies',
];
/** Array of the names of all Christmas cookies */
export const ChristCookies = ['Christmas tree biscuits',
'Snowflake biscuits',
'Snowman biscuits',
'Holly biscuits',
'Candy cane biscuits',
'Bell biscuits',
'Present biscuits',
];
/** Array of the names of all Valentine cookies */
export const ValCookies = ['Pure heart biscuits',
'Ardent heart biscuits',
'Sour heart biscuits',
'Weeping heart biscuits',
'Golden heart biscuits',
'Eternal heart biscuits',
'Prism heart biscuits',
];
/** Array of the names of all plant drops */
export const PlantDrops = ['Elderwort biscuits',
'Bakeberry cookies',
'Duketater cookies',
'Green yeast digestives',
'Wheat slims',
'Fern tea',
'Ichor syrup',
];
/** All possible effects plants and other items can have with a display-title */
export const Effects = {
buildingCost: 'Building prices',
click: 'Cookies per click',
cps: 'Total CPS',
cursorCps: 'Cursor CPS',
goldenCookieDur: 'Golden cookie duration',
goldenCookieEffDur: 'Golden cookie effect duration',
goldenCookieFreq: 'Golden cookie frequency',
goldenCookieGain: 'Golden cookie gains',
grandmaCps: 'Grandma CPS',
itemDrops: 'Random item drop chance',
milk: 'Effect from milk',
reindeerDur: 'Reindeer duration',
reindeerFreq: 'Reindeer frequency',
reindeerGain: 'Reindeer gains',
upgradeCost: 'Upgrade prices',
wrathCookieDur: 'Wrath cookie duration',
wrathCookieEffDur: 'Wrath cookie effect duration',
wrathCookieFreq: 'Wrath cookie frequency',
wrathCookieGain: 'Wrath cookie gains',
wrinklerEat: 'Wrinkler ',
wrinklerSpawn: 'Wrinkler spawn frequency',
};

47
src/Data/src/Moddata.js Normal file
View File

@@ -0,0 +1,47 @@
/** Data related directly to Cookie Monster */
/** Information about Cookie Monster to be displayed in the info section */
export const ModDescription = `<div class="listing">
<a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>
offers a wide range of tools and statistics to enhance your game experience.
It is not a cheat interface although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
Please also report any bugs you may find over there!</br>
</div>
`;
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
export const LatestReleaseNotes = `<div class="listing">
<b>The latest update (v 2.031.4) has introduced the following features:</b></br>
- Added a changelog to the info tab and notification indicating a new version</br>
- Warnings in tooltips are now based on the income after buying the upgrade</br>
- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added</br>
- User can now set a custom tooltip warning ("x times cps") in the settings</br>
- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward</br>
- The Harvest All button in the Garden now has a tooltip displaying the current reward </br>
- The Ascend button can now display additional info (this can be turned off in the settings) </br>
- The statistics page now displays the Heavenly Chips per second</br>
- The statistics page now displays the CPS needed for the next level in Chain Cookies</br>
- The statistics page now displays the cookies needed for optimal rewards for garden plants</br>
- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page</br>
- The color picker in the settings has been updated to its latest version</br>
- The overlay of seconds/percentage of timers is now toggle able and more readable</br>
- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)</br>
- CookieMonster now uses the Modding API provided by the base game</br>
- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod</br>
- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn</br>
- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment</br>
</br>
<b>This update fixes the following bugs:</b></br>
- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded</br>
- Sound, Flashes and Notifications will no longer play when the mod is initializing</br>
- The color picker should now update its display consistently</br>
- Fixed some typo's</br>
- Fixed a game breaking bug when the player had not purchased any upgrades</br>
- Fixed a number of console errors thrown by CM</br>
- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster</br>
- The Timer bar will now disappear correctly when the Golden Switch has been activated</br>
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats</br>
- Fixed buy warnings showing incorrectly</br>
</div>
`;

148
src/Data/src/Scales.js Normal file
View File

@@ -0,0 +1,148 @@
/** Data related directly to the scales used by Cookie Monster */
/** Array of abbreviations used in the "Metric" scale */
export const metric = ['',
'',
'M',
'G',
'T',
'P',
'E',
'Z',
'Y',
];
/** Array of abbreviations used in the "Short" scale */
export const shortScale = ['',
'',
'M',
'B',
'Tr',
'Quadr',
'Quint',
'Sext',
'Sept',
'Oct',
'Non',
'Dec',
'Undec',
'Duodec',
'Tredec',
'Quattuordec',
'Quindec',
'Sexdec',
'Septendec',
'Octodec',
'Novemdec',
'Vigint',
'Unvigint',
'Duovigint',
'Trevigint',
'Quattuorvigint',
];
/** Array of abbreviations used in the "Abbreviated Short" scale */
export const shortScaleAbbreviated = ['',
'K',
'M',
'B',
'T',
'Qa',
'Qi',
'Sx',
'Sp',
'Oc',
'No',
'De',
'UDe',
'DDe',
'TDe',
'QaDe',
'QiDe',
'SxDe',
'SpDe',
'ODe',
'NDe',
'Vi',
'UVi',
'DVi',
'TVi',
'QaVi',
'QiVi',
'SxVi',
'SpVi',
'OVi',
'NVi',
'Tr',
'UTr',
'DTr',
'TTr',
'QaTr',
'QiTr',
'SxTr',
'SpTr',
'OTr',
'NTr',
'Qaa',
'UQa',
'DQa',
'TQa',
'QaQa',
'QiQa',
'SxQa',
'SpQa',
'OQa',
'NQa',
'Qia',
'UQi',
'DQi',
'TQi',
'QaQi',
'QiQi',
'SxQi',
'SpQi',
'OQi',
'NQi',
'Sxa',
'USx',
'DSx',
'TSx',
'QaSx',
'QiSx',
'SxSx',
'SpSx',
'OSx',
'NSx',
'Spa',
'USp',
'DSp',
'TSp',
'QaSp',
'QiSp',
'SxSp',
'SpSp',
'OSp',
'NSp',
'Oco',
'UOc',
'DOc',
'TOc',
'QaOc',
'QiOc',
'SxOc',
'SpOc',
'OOc',
'NOc',
'Noa',
'UNo',
'DNo',
'TNo',
'QaNo',
'QiNo',
'SxNo',
'SpNo',
'ONo',
'NNo',
'Ct',
'UCt',
];

View File

@@ -0,0 +1,24 @@
/** Data related to the display titles of certain sections in menu screens */
/** Display titles of the headers of the Cookie Monster settings section */
export const ConfigGroups = {
BarsColors: 'Bars/Colors',
Calculation: 'Calculation',
Notification: 'Notification',
Tooltip: 'Tooltips and additional insights',
Statistics: 'Statistics',
Notation: 'Notation',
Miscellaneous: 'Miscellaneous',
};
/** Display titles of the headers of the notification section of the Cookie Monster settings */
export const ConfigGroupsNotification = {
NotificationGeneral: 'General Notifications',
NotificationGC: 'Golden Cookie',
NotificationFC: 'Fortune Cookie',
NotificationSea: 'Season Special',
NotificationGard: 'Garden Tick',
NotificationMagi: 'Full Magic Bar',
NotificationWrink: 'Wrinkler',
NotificationWrinkMax: 'Maximum Wrinklers',
};

View File

@@ -1,6 +1,10 @@
/**
* Disp *
*/
import FormatTime from './src/Beautify';
const Disp = {
FormatTime: FormatTime,
};
CM.Disp = Disp;
/**
* Please make sure to annotate your code correctly using JSDoc.
@@ -94,42 +98,6 @@ CM.Disp.GetLumpColor = function (type) {
}
};
/**
* Section: General functions to format or beautify strings */
/**
* This function returns time as a string depending on TimeFormat setting
* @param {number} time Time to be formatted
* @param {number} longFormat 1 or 0
* @returns {string} Formatted time
*/
CM.Disp.FormatTime = function (time, longFormat) {
if (time === Infinity) return time;
time = Math.ceil(time);
const y = Math.floor(time / 31557600);
const d = Math.floor(time % 31557600 / 86400);
const h = Math.floor(time % 86400 / 3600);
const m = Math.floor(time % 3600 / 60);
const s = Math.floor(time % 60);
let str = '';
if (CM.Options.TimeFormat) {
if (time > 3155760000) return 'XX:XX:XX:XX:XX';
str += `${(y < 10 ? '0' : '') + y}:`;
str += `${(d < 10 ? '0' : '') + d}:`;
str += `${(h < 10 ? '0' : '') + h}:`;
str += `${(m < 10 ? '0' : '') + m}:`;
str += (s < 10 ? '0' : '') + s;
} else {
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
str += (y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '');
str += (d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '');
if (str.length > 0 || h > 0) str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
if (str.length > 0 || m > 0) str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
}
return str;
};
/**
* This function returns the color to be used for time-strings
* @param {number} time Time to be coloured

34
src/Disp/src/Beautify.js Normal file
View File

@@ -0,0 +1,34 @@
/** General functions to format or beautify strings */
/**
* This function returns time as a string depending on TimeFormat setting
* @param {number} time Time to be formatted
* @param {number} longFormat 1 or 0
* @returns {string} Formatted time
*/
export default function FormatTime(time, longFormat) {
if (time === Infinity) return time;
time = Math.ceil(time);
const y = Math.floor(time / 31557600);
const d = Math.floor(time % 31557600 / 86400);
const h = Math.floor(time % 86400 / 3600);
const m = Math.floor(time % 3600 / 60);
const s = Math.floor(time % 60);
let str = '';
if (CM.Options.TimeFormat) {
if (time > 3155760000) return 'XX:XX:XX:XX:XX';
str += `${(y < 10 ? '0' : '') + y}:`;
str += `${(d < 10 ? '0' : '') + d}:`;
str += `${(h < 10 ? '0' : '') + h}:`;
str += `${(m < 10 ? '0' : '') + m}:`;
str += (s < 10 ? '0' : '') + s;
} else {
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
str += (y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '');
str += (d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '');
if (str.length > 0 || h > 0) str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
if (str.length > 0 || m > 0) str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
}
return str;
}

View File

@@ -3,7 +3,7 @@
* Header *
*/
const CM = {
CM = {
Backup: {},
Cache: {},
Config: {},

23
webpack.config.js Normal file
View File

@@ -0,0 +1,23 @@
/** We know this is not how Webpack should be used, but we are slowly transferring our code.
* For now this is how at least start to create a structure that allows us to transfer towards
* more modular code. Any help is highly appreciated.
*/
const path = require('path');
module.exports = {
mode: 'production',
entry: {
cache: { import: './src/Cache/Cache.js', filename: './Cache.js' },
config: { import: './src/Config/Config.js', filename: './Config.js' },
data: { import: './src/Data/Data.js', filename: './Data.js' },
disp: { import: './src/Disp/Disp.js', filename: './Disp.js' },
footer: { import: './src/Footer/Footer.js', filename: './Footer.js' },
header: { import: './src/Header/Header.js', filename: './Header.js' },
main: { import: './src/Main/Main.js', filename: './Main.js' },
sim: { import: './src/Sim/Sim.js', filename: './Sim.js' },
},
output: {
filename: 'Data.js',
path: path.resolve(__dirname, 'dist'),
},
};