Add prettier to pre-commit and run it
This commit is contained in:
19
.github/CONTRIBUTING.md
vendored
19
.github/CONTRIBUTING.md
vendored
@@ -2,17 +2,18 @@ Cookie Monster is written to modify Cookie Clicker as little as possible. This m
|
|||||||
|
|
||||||
The following is a short description of the various `src` directories and their contents:
|
The following is a short description of the various `src` directories and their contents:
|
||||||
|
|
||||||
JS | Description
|
| JS | Description |
|
||||||
-- | -
|
| ------------ | -------------------------------------------------------------------------- |
|
||||||
Cache | Functions related to creating and storing data cache
|
| Cache | Functions related to creating and storing data cache |
|
||||||
Config | Functions related to manipulating CM configuration
|
| Config | Functions related to manipulating CM configuration |
|
||||||
Data | Hard coded values
|
| Data | Hard coded values |
|
||||||
Disp | Functions related to displaying CM's UI
|
| Disp | Functions related to displaying CM's UI |
|
||||||
InitSaveLoad | Functions related to registering the CM object with the Game's Modding API
|
| InitSaveLoad | Functions related to registering the CM object with the Game's Modding API |
|
||||||
Main | Functions related to the main loop and initializing CM
|
| Main | Functions related to the main loop and initializing CM |
|
||||||
Sim | Functions related to simulate something
|
| Sim | Functions related to simulate something |
|
||||||
|
|
||||||
These are some additional guidelines:
|
These are some additional guidelines:
|
||||||
|
|
||||||
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
|
- 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.
|
- 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.
|
||||||
- PR's should target the `dev` branch
|
- PR's should target the `dev` branch
|
||||||
|
|||||||
6
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
6
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -16,8 +16,7 @@ body:
|
|||||||
id: what-happened
|
id: what-happened
|
||||||
attributes:
|
attributes:
|
||||||
label: Bug description
|
label: Bug description
|
||||||
description:
|
description: What is the bug about?
|
||||||
What is the bug about?
|
|
||||||
placeholder: |
|
placeholder: |
|
||||||
# Please describe the bug and what you would have expected the mod to do
|
# Please describe the bug and what you would have expected the mod to do
|
||||||
validations:
|
validations:
|
||||||
@@ -26,8 +25,7 @@ body:
|
|||||||
id: reproduce
|
id: reproduce
|
||||||
attributes:
|
attributes:
|
||||||
label: To reproduce
|
label: To reproduce
|
||||||
description:
|
description: How can you reproduce the bug?
|
||||||
How can you reproduce the bug?
|
|
||||||
placeholder: |
|
placeholder: |
|
||||||
The steps needed to reproduce the behavior:
|
The steps needed to reproduce the behavior:
|
||||||
1.
|
1.
|
||||||
|
|||||||
3
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
3
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
@@ -16,8 +16,7 @@ body:
|
|||||||
id: what-is-wanted
|
id: what-is-wanted
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature description
|
label: Feature description
|
||||||
description:
|
description: Describe the function you'd like to see added to CookieMonster
|
||||||
Describe the function you'd like to see added to CookieMonster
|
|
||||||
placeholder: |
|
placeholder: |
|
||||||
# A clear and concise description of what you want to happen.
|
# A clear and concise description of what you want to happen.
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
directory: "/" # Location of package manifests
|
directory: '/' # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: 'weekly'
|
||||||
|
|||||||
2
.github/workflows/publish-dev.yml
vendored
2
.github/workflows/publish-dev.yml
vendored
@@ -2,7 +2,7 @@ name: Publish
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "dev"
|
- 'dev'
|
||||||
jobs:
|
jobs:
|
||||||
publish-dev:
|
publish-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
9
.pre-commit-config.yaml
Normal file
9
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v2.7.1
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
args:
|
||||||
|
- '--print-width=100'
|
||||||
|
- '--single-quote'
|
||||||
|
- '--trailing-comma=all'
|
||||||
20
README.md
20
README.md
@@ -3,7 +3,7 @@
|
|||||||
## Cookie Monster
|
## Cookie Monster
|
||||||
|
|
||||||
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. **It is not a cheat interface** – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
**Cookie Monster** is an addon you can load into Cookie Clicker, that offers a wide range of tools and statistics to enhance the game. **It is not a cheat interface** – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
|
||||||
The mod helps you to *whichever* degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
The mod helps you to _whichever_ degree you want, if you only need some help shortening long numbers, it does that. If you need to be accompanied by hand to pick the best buildings to buy, it does that, but **everything is an option**.
|
||||||
|
|
||||||
### Current version
|
### Current version
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Github Pages is hosted from the `gh-pages` branch
|
|||||||
|
|
||||||
### What it does
|
### What it does
|
||||||
|
|
||||||
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. CM will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, CM will know and highlight that building's value. CM uses the following formula to calculate the PP:
|
At its core, Cookie Monster computes an index for both buildings and upgrades: the **Payback Period (PP)**. CM will take _everything_ in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, CM will know and highlight that building's value. CM uses the following formula to calculate the PP:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
max(cost - cookies in bank, 0)/cps + cost/Δ cps
|
||||||
@@ -45,7 +45,7 @@ Copy this code and save it as a bookmark. Paste it in the URL section. To activa
|
|||||||
```javascript
|
```javascript
|
||||||
javascript: (function () {
|
javascript: (function () {
|
||||||
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
|
||||||
}());
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
If (for some reason) the above doesn't work, trying pasting everything after the <code>javascript:</code> bit into your browser's console.
|
If (for some reason) the above doesn't work, trying pasting everything after the <code>javascript:</code> bit into your browser's console.
|
||||||
@@ -80,10 +80,10 @@ Before pushing a new version to `main` and Github pages use the `build-final` co
|
|||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
* **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
- **[Raving_Kumquat](https://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
- **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
- **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||||
* **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
- **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
|
||||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
- **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||||
* **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
- **[DanielNoord](https://github.com/DanielNoord)**: Current maintainer
|
||||||
* **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
- **[bitsandbytes1708](https://github.com/bitsandbytes1708)**: Current maintainer
|
||||||
|
|||||||
9185
dist/CookieMonster.js
vendored
9185
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
9185
dist/CookieMonsterDev.js
vendored
9185
dist/CookieMonsterDev.js
vendored
File diff suppressed because one or more lines are too long
@@ -15,8 +15,11 @@ export default function CacheDragonCost() {
|
|||||||
Game.dragonLevel < 25 &&
|
Game.dragonLevel < 25 &&
|
||||||
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
|
||||||
) {
|
) {
|
||||||
const objectMatch = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/);
|
const objectMatch = Game.dragonLevels[Game.dragonLevel].buy
|
||||||
let target = objectMatch !== null ? objectMatch[1] : Game.ObjectsById[Game.dragonLevel-5].name;
|
.toString()
|
||||||
|
.match(/Objects\[(.*)\]/);
|
||||||
|
let target =
|
||||||
|
objectMatch !== null ? objectMatch[1] : Game.ObjectsById[Game.dragonLevel - 5].name;
|
||||||
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
const amount = Game.dragonLevels[Game.dragonLevel].buy
|
||||||
.toString()
|
.toString()
|
||||||
.match(/sacrifice\((.*?)\)/)[1];
|
.match(/sacrifice\((.*?)\)/)[1];
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ export default function FormatTime(time, longFormat) {
|
|||||||
|
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 0) {
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat === 0) {
|
||||||
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||||
str +=
|
str += y > 0 ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` : '';
|
||||||
y > 0
|
|
||||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
|
|
||||||
: '';
|
|
||||||
if (str.length > 0 || d > 0)
|
if (str.length > 0 || d > 0)
|
||||||
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `;
|
str += `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, `;
|
||||||
if (str.length > 0 || h > 0)
|
if (str.length > 0 || h > 0)
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ export default function AddMenu() {
|
|||||||
title.textContent = 'Cookie Monster Statistics';
|
title.textContent = 'Cookie Monster Statistics';
|
||||||
AddMenuStats(title);
|
AddMenuStats(title);
|
||||||
}
|
}
|
||||||
} else if (Game.onMenu === 'prefs') { // Added because Framework is broken
|
} else if (Game.onMenu === 'prefs') {
|
||||||
|
// Added because Framework is broken
|
||||||
l('menu').childNodes[2].insertBefore(
|
l('menu').childNodes[2].insertBefore(
|
||||||
createMenuOptions(),
|
createMenuOptions(),
|
||||||
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
|
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||||
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
||||||
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
||||||
@@ -56,13 +55,7 @@ export default function Grimoire() {
|
|||||||
const reward = document.createElement('span');
|
const reward = document.createElement('span');
|
||||||
reward.style.color = '#33FF00';
|
reward.style.color = '#33FF00';
|
||||||
reward.textContent = Beautify(
|
reward.textContent = Beautify(
|
||||||
Math.max(
|
Math.max(Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 30), 7),
|
||||||
Math.min(
|
|
||||||
Game.cookies * 0.15,
|
|
||||||
Game.cookiesPs * 60 * 30
|
|
||||||
),
|
|
||||||
7
|
|
||||||
),
|
|
||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
conjure.appendChild(reward);
|
conjure.appendChild(reward);
|
||||||
@@ -72,14 +65,8 @@ export default function Grimoire() {
|
|||||||
const loss = document.createElement('span');
|
const loss = document.createElement('span');
|
||||||
loss.style.color = 'red';
|
loss.style.color = 'red';
|
||||||
loss.textContent = Beautify(
|
loss.textContent = Beautify(
|
||||||
Math.min(
|
Math.min(Game.cookies, Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 15) + 13),
|
||||||
Game.cookies,
|
2,
|
||||||
Math.min(
|
|
||||||
Game.cookies * 0.15,
|
|
||||||
Game.cookiesPs * 60 * 15
|
|
||||||
) + 13
|
|
||||||
),
|
|
||||||
2
|
|
||||||
);
|
);
|
||||||
conjure.appendChild(loss);
|
conjure.appendChild(loss);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function ReplaceNativeGrimoireDraw() {
|
|||||||
minigame.magicBarTextL.innerHTML += ` (${FormatTime(
|
minigame.magicBarTextL.innerHTML += ` (${FormatTime(
|
||||||
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM),
|
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM),
|
||||||
)})`;
|
)})`;
|
||||||
minigame.magicBarL.style.width = "75%" // TODO: Fix this after Orteil pushes fix to main game;
|
minigame.magicBarL.style.width = '75%'; // TODO: Fix this after Orteil pushes fix to main game;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
HasReplaceNativeGrimoireDraw = true;
|
HasReplaceNativeGrimoireDraw = true;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default function ReplaceNative() {
|
|||||||
l('bigCookie').addEventListener(
|
l('bigCookie').addEventListener(
|
||||||
'click',
|
'click',
|
||||||
(event) => {
|
(event) => {
|
||||||
FixMouseY(()=> Game.ClickCookie(event,0));
|
FixMouseY(() => Game.ClickCookie(event, 0));
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ export default function CalculateGains() {
|
|||||||
if (SimHas('Kitten specialists')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
if (SimHas('Kitten specialists')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
||||||
if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
||||||
if (SimHas('Kitten consultants')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
if (SimHas('Kitten consultants')) catMult *= 1 + milkProgress * 0.2 * milkMult;
|
||||||
if (SimHas('Kitten assistants to the regional manager')) catMult *= 1 + milkProgress * 0.175 * milkMult;
|
if (SimHas('Kitten assistants to the regional manager'))
|
||||||
|
catMult *= 1 + milkProgress * 0.175 * milkMult;
|
||||||
if (SimHas('Kitten marketeers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
|
if (SimHas('Kitten marketeers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
|
||||||
if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult;
|
if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult;
|
||||||
if (SimHas('Kitten executives')) catMult *= 1 + milkProgress * 0.115 * milkMult;
|
if (SimHas('Kitten executives')) catMult *= 1 + milkProgress * 0.115 * milkMult;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export default function SimAuraMult(what) {
|
|||||||
n = 1;
|
n = 1;
|
||||||
if (
|
if (
|
||||||
Game.dragonAuras[SimDragonAura].name === 'Reality Bending' ||
|
Game.dragonAuras[SimDragonAura].name === 'Reality Bending' ||
|
||||||
Game.dragonAuras[SimDragonAura2].name === 'Reality Bending' &&
|
(Game.dragonAuras[SimDragonAura2].name === 'Reality Bending' &&
|
||||||
Game.dragonLevel >= Game.dragonAurasBN[what].id + 4
|
Game.dragonLevel >= Game.dragonAurasBN[what].id + 4)
|
||||||
)
|
)
|
||||||
n += 0.1;
|
n += 0.1;
|
||||||
return n;
|
return n;
|
||||||
|
|||||||
@@ -5,15 +5,19 @@ import SimHas from './SimHas';
|
|||||||
* This functions creates functions similarly to Game.GetTieredCpsMult but checks Sim Data instead of Game Data
|
* This functions creates functions similarly to Game.GetTieredCpsMult but checks Sim Data instead of Game Data
|
||||||
*/
|
*/
|
||||||
export default function SimGetTieredCpsMult(me) {
|
export default function SimGetTieredCpsMult(me) {
|
||||||
|
|
||||||
let mult = 1;
|
let mult = 1;
|
||||||
Object.keys(me.tieredUpgrades).forEach((i) => {
|
Object.keys(me.tieredUpgrades).forEach((i) => {
|
||||||
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)){
|
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)) {
|
||||||
let tierMult=2;
|
let tierMult = 2;
|
||||||
// unshackled multipliers
|
// unshackled multipliers
|
||||||
if (Game.ascensionMode!==1 && SimHas(me.unshackleUpgrade) && SimHas(Game.Tiers[me.tieredUpgrades[i].tier].unshackleUpgrade)) tierMult+=me.id===1?0.5:(20-me.id)*0.1;
|
if (
|
||||||
mult*=tierMult;
|
Game.ascensionMode !== 1 &&
|
||||||
};
|
SimHas(me.unshackleUpgrade) &&
|
||||||
|
SimHas(Game.Tiers[me.tieredUpgrades[i].tier].unshackleUpgrade)
|
||||||
|
)
|
||||||
|
tierMult += me.id === 1 ? 0.5 : (20 - me.id) * 0.1;
|
||||||
|
mult *= tierMult;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Object.keys(me.synergies).forEach((i) => {
|
Object.keys(me.synergies).forEach((i) => {
|
||||||
if (SimHas(me.synergies[i].name)) {
|
if (SimHas(me.synergies[i].name)) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { SimGod1, SimGod2, SimGod3, SimObjects } from '../VariablesAndData';
|
import { SimGod1, SimGod2, SimGod3, SimObjects } from '../VariablesAndData';
|
||||||
import SimHasAura from './SimHasAura'
|
import SimHasAura from './SimHasAura';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks for the current God level in the sim data
|
* This function checks for the current God level in the sim data
|
||||||
@@ -16,13 +16,13 @@ export default function SimHasGod(what) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (SimGod2 === god.id) {
|
if (SimGod2 === god.id) {
|
||||||
if (SimHasAura('Supreme Intellect')){
|
if (SimHasAura('Supreme Intellect')) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (SimGod3 === god.id) {
|
if (SimGod3 === god.id) {
|
||||||
if (SimHasAura('Supreme Intellect')){
|
if (SimHasAura('Supreme Intellect')) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function MouseCps() {
|
|||||||
if (SimHas('Octillion fingers')) add *= 20;
|
if (SimHas('Octillion fingers')) add *= 20;
|
||||||
if (SimHas('Nonillion fingers')) add *= 20;
|
if (SimHas('Nonillion fingers')) add *= 20;
|
||||||
if (SimHas('Decillion fingers')) add *= 20;
|
if (SimHas('Decillion fingers')) add *= 20;
|
||||||
if (SimHas('Unshackled cursors')) add*= 25;
|
if (SimHas('Unshackled cursors')) add *= 25;
|
||||||
let num = 0;
|
let num = 0;
|
||||||
Object.keys(SimObjects).forEach((i) => {
|
Object.keys(SimObjects).forEach((i) => {
|
||||||
num += SimObjects[i].amount;
|
num += SimObjects[i].amount;
|
||||||
|
|||||||
Reference in New Issue
Block a user