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

Fix farming storing extra data #5743

Merged
merged 1 commit into from
Mar 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
10 changes: 5 additions & 5 deletions src/mahoji/lib/abstracted_commands/farmingCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
', '
)}. *Don't include numbers, this command harvests all crops available of the specified patch type.*`;
}
const { patchesDetailed } = await getFarmingInfo(user.id);
const { patchesDetailed, patches } = await getFarmingInfo(user.id);
const patch = patchesDetailed.find(i => i.patchName === seedType)!;
if (patch.ready === null) return 'You have nothing planted in those patches.';

Expand All @@ -64,7 +64,7 @@
return `Please come back when your crops have finished growing in ${formatDuration(patch.readyIn!)}!`;
}

const treeStr = !plant ? null : treeCheck(plant, currentWoodcuttingLevel, GP, patch.lastQuantity);

Check warning on line 67 in src/mahoji/lib/abstracted_commands/farmingCommand.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected object value in conditional. The condition is always true

Check warning on line 67 in src/mahoji/lib/abstracted_commands/farmingCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected object value in conditional. The condition is always true
if (treeStr) return treeStr;

const timePerPatchTravel = Time.Second * plant.timePerPatchTravel;
Expand Down Expand Up @@ -106,9 +106,9 @@

await addSubTaskToActivityTask<FarmingActivityTaskOptions>({
plantsName: patch.lastPlanted,
patchType: patch,
patchType: patches[patch.patchName],
userID: user.id,
channelID: channelID.toString(),
channelID,
upgradeType,
duration,
quantity: patch.lastQuantity,
Expand Down Expand Up @@ -164,7 +164,7 @@
return `${user.minionName} needs ${plant.level} Farming to plant ${plant.name}.`;
}

const { patchesDetailed } = await getFarmingInfo(user.id);
const { patchesDetailed, patches } = await getFarmingInfo(user.id);
const patchType = patchesDetailed.find(i => i.patchName === plant.seedType)!;

const timePerPatchTravel = Time.Second * plant.timePerPatchTravel;
Expand Down Expand Up @@ -257,7 +257,7 @@

const compostTier = (user.user.minion_defaultCompostToUse as CropUpgradeType) ?? 'compost';
let upgradeType: CropUpgradeType | null = null;
if ((didPay && plant.canCompostandPay) || (!didPay && plant.canCompostPatch && compostTier)) {

Check warning on line 260 in src/mahoji/lib/abstracted_commands/farmingCommand.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 260 in src/mahoji/lib/abstracted_commands/farmingCommand.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
const compostCost = new Bank().add(compostTier, quantity);
if (user.owns(compostCost)) {
infoStr.push(`You are treating your patches with ${compostCost}.`);
Expand All @@ -269,7 +269,7 @@
if (!user.owns(cost)) return `You don't own ${cost}.`;
await transactItems({ userID: user.id, itemsToRemove: cost });

updateBankSetting('farming_cost_bank', cost);

Check warning on line 272 in src/mahoji/lib/abstracted_commands/farmingCommand.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 272 in src/mahoji/lib/abstracted_commands/farmingCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
// If user does not have something already planted, just plant the new seeds.
if (!patchType.patchPlanted) {
infoStr.unshift(`${user.minionName} is now planting ${quantity}x ${plant.name}.`);
Expand Down Expand Up @@ -302,7 +302,7 @@

await addSubTaskToActivityTask<FarmingActivityTaskOptions>({
plantsName: plant.name,
patchType,
patchType: patches[plant.seedType],
userID: user.id,
channelID: channelID.toString(),
quantity,
Expand Down
Loading