Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Cooking boosts stack, also rebalance slightly. #5697

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/mahoji/commands/cook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
required: true,
autocomplete: async (value: string) => {
return [...Cookables.map(i => i.name), ...LeapingFish.map(i => i.item.name)]
.filter(name => (!value ? true : name.toLowerCase().includes(value.toLowerCase())))

Check warning on line 31 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 31 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
.map(i => ({
name: i,
value: i
Expand Down Expand Up @@ -59,14 +59,14 @@
}

const cookable = Cooking.Cookables.find(
cookable =>

Check warning on line 62 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'cookable' is already declared in the upper scope on line 61 column 9

Check warning on line 62 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'cookable' is already declared in the upper scope on line 61 column 9
stringMatches(cookable.name, options.name) ||
cookable.alias?.some(alias => stringMatches(alias, options.name))
);

if (!cookable) {
return `Thats not a valid item to cook. Valid cookables are ${Cooking.Cookables.map(
cookable => cookable.name

Check warning on line 69 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'cookable' is already declared in the upper scope on line 61 column 9

Check warning on line 69 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'cookable' is already declared in the upper scope on line 61 column 9
).join(', ')}.`;
}

Expand All @@ -89,15 +89,23 @@
if (cookable.id === itemID('Jug of wine') || cookable.id === itemID('Wine of zamorak')) {
timeToCookSingleCookable /= 1.6;
if (hasRemy) timeToCookSingleCookable /= 1.5;
} else if (user.hasEquippedOrInBank('Cooking master cape')) {
boosts.push('5x for Cooking master cape');
timeToCookSingleCookable /= 5;
} else if (user.hasEquippedOrInBank('Dwarven gauntlets')) {
boosts.push('3x for Dwarven gauntlets');
timeToCookSingleCookable /= 3;
} else if (hasRemy) {
boosts.push('2x for Remy');
timeToCookSingleCookable /= 2;
} else {
let cookingBoost = 1;
let cookingBoostItems: string[] = [];
if (user.hasEquippedOrInBank('Cooking master cape')) {
cookingBoostItems.push('Cooking master cape');
cookingBoost += 2.5;
}
if (user.hasEquippedOrInBank('Dwarven gauntlets')) {
cookingBoostItems.push('Dwarven gauntlets');
cookingBoost += 1.5;
}
if (hasRemy) {
cookingBoostItems.push('Remy');
cookingBoost += 1;
}
timeToCookSingleCookable /= cookingBoost;
boosts.push(`+${(cookingBoost - 1) * 100}% for ${cookingBoostItems.join(', ')}.`);
}

const userBank = user.bank;
Expand All @@ -113,7 +121,7 @@

const totalCost = inputCost.clone().multiply(quantity);

if (!userBank.fits(totalCost)) {

Check warning on line 124 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required

Check warning on line 124 in src/mahoji/commands/cook.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required
return `You don't have enough items. You need: ${inputCost}.`;
}

Expand Down
Loading