Skip to content

Commit

Permalink
Tidy and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
TastyPumPum committed Mar 12, 2024
1 parent 4eba6ad commit 847e0b9
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 260 deletions.
1 change: 0 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ enum activity_type_enum {
AgilityArena
ChampionsChallenge
AerialFishing
CrystalImpling
DriftNet
MahoganyHomes
GnomeRestaurant
Expand Down
4 changes: 1 addition & 3 deletions src/lib/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { groupoMonsterTask } from '../tasks/minions/groupMonsterActivity';
import { herbloreTask } from '../tasks/minions/herbloreActivity';
import { aerialFishingTask } from '../tasks/minions/HunterActivity/aerialFishingActivity';
import { birdHouseTask } from '../tasks/minions/HunterActivity/birdhouseActivity';
import { crystalImplingTask } from '../tasks/minions/HunterActivity/crystalImplingActivity';
import { driftNetTask } from '../tasks/minions/HunterActivity/driftNetActivity';
import { hunterTask } from '../tasks/minions/HunterActivity/hunterActivity';
import { mageArenaTwoTask } from '../tasks/minions/mageArena2Activity';
Expand Down Expand Up @@ -182,8 +181,7 @@ export const tasks: MinionTask[] = [
specificQuestTask,
camdozaalMiningTask,
camdozaalSmithingTask,
camdozaalFishingTask,
crystalImplingTask
camdozaalFishingTask
];

export async function processPendingActivities() {
Expand Down
3 changes: 1 addition & 2 deletions src/lib/implings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ export function handlePassiveImplings(user: MUser, data: ActivityTaskData) {
activity_type_enum.Construction,
activity_type_enum.TombsOfAmascut,
activity_type_enum.DriftNet,
activity_type_enum.UnderwaterAgilityThieving,
activity_type_enum.CrystalImpling
activity_type_enum.UnderwaterAgilityThieving
].includes(data.type)
)
return null;
Expand Down
11 changes: 1 addition & 10 deletions src/lib/types/minions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,6 @@ export interface HunterActivityTaskOptions extends ActivityTaskOptions {
usingStaminaPotion: boolean;
}

export interface CrystalImplingActivityTaskOptions extends ActivityTaskOptions {
type: 'CrystalImpling';
creatureName: string;
quantity: number;
usingHuntPotion: boolean;
usingStaminaPotion: boolean;
}

export interface AlchingActivityTaskOptions extends ActivityTaskOptions {
type: 'Alching';
itemID: number;
Expand Down Expand Up @@ -606,5 +598,4 @@ export type ActivityTaskData =
| FightCavesActivityTaskOptions
| ActivityTaskOptionsWithQuantity
| MinigameActivityTaskOptionsWithNoChanges
| CutLeapingFishActivityTaskOptions
| CrystalImplingActivityTaskOptions;
| CutLeapingFishActivityTaskOptions;
7 changes: 7 additions & 0 deletions src/lib/util/activityInArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Monsters } from 'oldschooljs';
import {
ActivityTaskData,
AgilityActivityTaskOptions,
HunterActivityTaskOptions,
MonsterActivityTaskOptions,
PickpocketActivityTaskOptions
} from '../types/minions';
Expand Down Expand Up @@ -37,6 +38,12 @@ const WorldLocationsChecker = [
) {
return true;
}
if (
activity.type === 'Hunter' &&
(activity as HunterActivityTaskOptions).creatureName === 'Crystal impling'
) {
return true;
}

return false;
}
Expand Down
4 changes: 0 additions & 4 deletions src/lib/util/minionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,6 @@ export function minionStatus(user: MUser) {
return `${name} is currently hunting ${data.quantity}x ${creature!.name}. ${formattedDuration}`;
}

case 'CrystalImpling': {
return `${name} is currently hunting crystal implings. ${formattedDuration}`;
}

case 'Birdhouse': {
return `${name} is currently doing a bird house run. ${formattedDuration}`;
}
Expand Down
10 changes: 0 additions & 10 deletions src/lib/util/repeatStoredTrip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
ConstructionActivityTaskOptions,
CookingActivityTaskOptions,
CraftingActivityTaskOptions,
CrystalImplingActivityTaskOptions,
CutLeapingFishActivityTaskOptions,
DarkAltarOptions,
EnchantingActivityTaskOptions,
Expand Down Expand Up @@ -348,15 +347,6 @@ export const tripHandlers = {
stamina_potions: data.usingStaminaPotion
})
},
[activity_type_enum.CrystalImpling]: {
commandName: 'hunt',
args: (data: CrystalImplingActivityTaskOptions) => ({
name: data.creatureName,
quantity: data.quantity,
hunter_potion: data.usingHuntPotion,
stamina_potions: data.usingStaminaPotion
})
},
[activity_type_enum.Inferno]: {
commandName: 'activities',
args: () => ({ inferno: { action: 'start' } })
Expand Down
25 changes: 13 additions & 12 deletions src/mahoji/commands/hunt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { formatDuration, itemID } from '../../lib/util';
import addSubTaskToActivityTask from '../../lib/util/addSubTaskToActivityTask';
import { calcMaxTripLength } from '../../lib/util/calcMaxTripLength';
import { updateBankSetting } from '../../lib/util/updateBankSetting';
import { crystalImplingCommand } from '../lib/abstracted_commands/crystalImplingCommand';
import { OSBMahojiCommand } from '../lib/util';
import { userHasGracefulEquipped } from '../mahojiSettings';

Expand Down Expand Up @@ -119,14 +118,10 @@ export const huntCommand: OSBMahojiCommand = {
}
}

let crystalImpling = false;

if (creature.name === 'Crystal impling') {
return crystalImplingCommand({
user,
quantity: options.quantity,
stamina_potions: options.stamina_potions,
hunter_potions: options.hunter_potion,
channelID: channelID.toString()
});
crystalImpling = true;
}

// Reduce time if user is experienced hunting the creature, every hour become 1% better to a cap of 10% or 20% if tracking technique.
Expand Down Expand Up @@ -169,7 +164,13 @@ export const huntCommand: OSBMahojiCommand = {
const maxTripLength = calcMaxTripLength(user, 'Hunter');

let { quantity } = options;
if (!quantity) quantity = Math.floor(maxTripLength / ((catchTime * Time.Second) / traps));
if (!quantity) {
if (crystalImpling) {
quantity = Math.floor(maxTripLength / Time.Minute);
} else {
quantity = Math.floor(maxTripLength / ((catchTime * Time.Second) / traps));
}
}

let duration = Math.floor(((quantity * catchTime) / traps) * Time.Second);

Expand Down Expand Up @@ -267,9 +268,9 @@ export const huntCommand: OSBMahojiCommand = {
type: 'Hunter'
});

let response = `${user.minionName} is now ${creature.huntTechnique} ${quantity}x ${
creature.name
}, it'll take around ${formatDuration(duration)} to finish.`;
let response = `${user.minionName} is now ${crystalImpling ? 'hunting' : `${creature.huntTechnique}`} ${
crystalImpling ? '' : `${quantity}x `
}${creature.name}, it'll take around ${formatDuration(duration)} to finish.`;

if (boosts.length > 0) {
response += `\n\n**Boosts:** ${boosts.join(', ')}.`;
Expand Down
109 changes: 0 additions & 109 deletions src/mahoji/lib/abstracted_commands/crystalImplingCommand.ts

This file was deleted.

100 changes: 0 additions & 100 deletions src/tasks/minions/HunterActivity/crystalImplingActivity.ts

This file was deleted.

Loading

0 comments on commit 847e0b9

Please sign in to comment.