From 519e67dce9dcb5ce876dda1234d1bdb1cdd31e18 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 25 Jan 2021 18:07:55 +0100 Subject: [PATCH 1/3] Create CONTRIBUTING.md --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ff2fd18 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,22 @@ +The following is a description of the our approach to the project. + +Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data. + +Here is a description of what should be stored in each of the source JS. Make edits to the source file first and then use the combine file to compile the final file: + +JS | Description +-- | - +Cache | Functions related to creating and storing data cache +Config | Functions related to manipulating CM configuration +Data | Hard coded values +Disp | Functions related to displaying CM's UI +Footer | The footer of CM's JS (not modified often or ever) +Header | The header of CM's JS (not modified often or ever) +Main | Functions related to the main loop and initializing CM +Sim | Functions related to simulate something + +These are some additional guidelines: +- Try to use DOM as much as possible instead of using string manipulation to modify HTML. +- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message. +- Try to follow the formatting and annotation as specified by JSCode +- PR's should target the `dev` branch From 8505b1621d7a8f5f4442e57605c24b650656fb8b Mon Sep 17 00:00:00 2001 From: Zohnannor <35764628+Zohnannor@users.noreply.github.com> Date: Mon, 25 Jan 2021 19:02:24 +0300 Subject: [PATCH 2/3] Update CM.Disp.FormatTime Add years to date formatting, fixes #502 --- CookieMonster.js | 1 + 1 file changed, 1 insertion(+) diff --git a/CookieMonster.js b/CookieMonster.js index b690a6d..bed6c54 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1328,6 +1328,7 @@ CM.Disp.FormatTime = function(time, longFormat) { 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') + ', '; From 51ab15f2ecedbf8c9b016f946b42f2ae82319e64 Mon Sep 17 00:00:00 2001 From: Zohnannor Date: Mon, 25 Jan 2021 22:20:59 +0300 Subject: [PATCH 3/3] Fix in Disp.js and combine --- src/Disp.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Disp.js b/src/Disp.js index 102f600..f2f7fbd 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -147,6 +147,7 @@ CM.Disp.FormatTime = function(time, longFormat) { 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') + ', ';