From 215b8c589f20915a5a9f878aa26bcb5570c6e3a2 Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:10:20 +0100 Subject: [PATCH 1/4] Add Valamore Farming Patches Adds the additional herb/flower and allotment patches for completing Children of the Sun. --- .../lib/abstracted_commands/farmingCommand.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mahoji/lib/abstracted_commands/farmingCommand.ts b/src/mahoji/lib/abstracted_commands/farmingCommand.ts index 9d094766df..6bf502b538 100644 --- a/src/mahoji/lib/abstracted_commands/farmingCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingCommand.ts @@ -6,6 +6,7 @@ import { Bank } from 'oldschooljs'; import { superCompostables } from '../../../lib/data/filterables'; import { ArdougneDiary, userhasDiaryTier } from '../../../lib/diaries'; +import { QuestID } from '../../../lib/minions/data/quests'; import { calcNumOfPatches } from '../../../lib/skilling/functions/calcsFarming'; import { getFarmingInfo } from '../../../lib/skilling/functions/getFarmingInfo'; import Farming from '../../../lib/skilling/skills/farming'; @@ -181,11 +182,24 @@ export async function farmingPlantCommand({ const treeStr = !planted ? null : treeCheck(planted, currentWoodcuttingLevel, GP, patchType.lastQuantity); if (treeStr) return treeStr; - const [numOfPatches] = calcNumOfPatches(plant, user, questPoints); + let [numOfPatches] = calcNumOfPatches(plant, user, questPoints); + if (numOfPatches === 0) { return 'There are no available patches to you.'; } + if (user.user.finished_quest_ids.includes(QuestID.ChildrenOfTheSun)) { + switch (plant.seedType) { + case 'allotment': + numOfPatches += 2; + break; + case 'herb': + case 'flower': + numOfPatches += 1; + break; + } + } + const maxTripLength = calcMaxTripLength(user, 'Farming'); // If no quantity provided, set it to the max PATCHES available. From e0e60f51fbf5590cbee8f9a440c7e29c07e60c8e Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:15:47 +0100 Subject: [PATCH 2/4] Move to calcsFarming.ts --- src/lib/skilling/functions/calcsFarming.ts | 14 ++++++++++++++ .../lib/abstracted_commands/farmingCommand.ts | 14 +------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/lib/skilling/functions/calcsFarming.ts b/src/lib/skilling/functions/calcsFarming.ts index 170e12dd98..a234f023fe 100644 --- a/src/lib/skilling/functions/calcsFarming.ts +++ b/src/lib/skilling/functions/calcsFarming.ts @@ -1,5 +1,6 @@ import { randInt } from 'e'; +import { QuestID } from '../../minions/data/quests'; import type { Plant } from '../types'; import { SkillsEnum } from '../types'; @@ -28,6 +29,19 @@ export function calcNumOfPatches(plant: Plant, user: MUser, qp: number): [number break; } } + + if (user.user.finished_quest_ids.includes(QuestID.ChildrenOfTheSun)) { + switch (plant.seedType) { + case 'allotment': + numOfPatches += 2; + break; + case 'herb': + case 'flower': + numOfPatches += 1; + break; + } + } + return [numOfPatches]; } diff --git a/src/mahoji/lib/abstracted_commands/farmingCommand.ts b/src/mahoji/lib/abstracted_commands/farmingCommand.ts index 6bf502b538..5582de6883 100644 --- a/src/mahoji/lib/abstracted_commands/farmingCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingCommand.ts @@ -182,24 +182,12 @@ export async function farmingPlantCommand({ const treeStr = !planted ? null : treeCheck(planted, currentWoodcuttingLevel, GP, patchType.lastQuantity); if (treeStr) return treeStr; - let [numOfPatches] = calcNumOfPatches(plant, user, questPoints); + const [numOfPatches] = calcNumOfPatches(plant, user, questPoints); if (numOfPatches === 0) { return 'There are no available patches to you.'; } - if (user.user.finished_quest_ids.includes(QuestID.ChildrenOfTheSun)) { - switch (plant.seedType) { - case 'allotment': - numOfPatches += 2; - break; - case 'herb': - case 'flower': - numOfPatches += 1; - break; - } - } - const maxTripLength = calcMaxTripLength(user, 'Farming'); // If no quantity provided, set it to the max PATCHES available. From 15dc24b7fe04984bcb6c93d33acc41f0797f6e65 Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:16:52 +0100 Subject: [PATCH 3/4] remove old import --- src/mahoji/lib/abstracted_commands/farmingCommand.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mahoji/lib/abstracted_commands/farmingCommand.ts b/src/mahoji/lib/abstracted_commands/farmingCommand.ts index 5582de6883..09ed95c8ac 100644 --- a/src/mahoji/lib/abstracted_commands/farmingCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingCommand.ts @@ -6,7 +6,6 @@ import { Bank } from 'oldschooljs'; import { superCompostables } from '../../../lib/data/filterables'; import { ArdougneDiary, userhasDiaryTier } from '../../../lib/diaries'; -import { QuestID } from '../../../lib/minions/data/quests'; import { calcNumOfPatches } from '../../../lib/skilling/functions/calcsFarming'; import { getFarmingInfo } from '../../../lib/skilling/functions/getFarmingInfo'; import Farming from '../../../lib/skilling/skills/farming'; From c6a99e8281516c5b8c33fc605747381ded50da11 Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:20:01 +0100 Subject: [PATCH 4/4] Update farmingCommand.ts --- src/mahoji/lib/abstracted_commands/farmingCommand.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mahoji/lib/abstracted_commands/farmingCommand.ts b/src/mahoji/lib/abstracted_commands/farmingCommand.ts index 09ed95c8ac..9d094766df 100644 --- a/src/mahoji/lib/abstracted_commands/farmingCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingCommand.ts @@ -182,7 +182,6 @@ export async function farmingPlantCommand({ if (treeStr) return treeStr; const [numOfPatches] = calcNumOfPatches(plant, user, questPoints); - if (numOfPatches === 0) { return 'There are no available patches to you.'; }