Skip to content

Commit

Permalink
Crate spawn fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Oct 29, 2024
1 parent e75d98d commit 295e8e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lib/util/handleCrateSpawns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { Time, reduceNumByPercent, roll } from 'e';
import { Bank, resolveItems } from 'oldschooljs';

import getOSItem from './getOSItem';
import { itemNameFromID } from './smallUtils';

const crateItem = getOSItem('Sinister crate (s7)');

export function handleCrateSpawns(user: MUser, duration: number) {
export function handleCrateSpawns(user: MUser, duration: number, messages?: string[]) {
const accountAge = user.accountAgeInDays();
let dropratePerMinute = 50 * 60;
if (accountAge) {
Expand All @@ -31,7 +32,10 @@ export function handleCrateSpawns(user: MUser, duration: number) {
'Cob'
]);
if (hweenPets.some(pet => user.usingPet(pet))) {
dropratePerMinute = Math.ceil(dropratePerMinute / 5);
dropratePerMinute = Math.ceil(dropratePerMinute / 10);
if (messages) {
messages.push(`10x higher droprates for ${itemNameFromID(user.user.minion_equippedPet!)}`);
}
}

if (user.isIronman) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/handleTripFinish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ const tripFinishEffects: TripFinishEffect[] = [
{
name: 'Crate Spawns',
fn: async ({ data, messages, user }) => {
const crateRes = handleCrateSpawns(user, data.duration);
const crateRes = handleCrateSpawns(user, data.duration, messages);
if (crateRes && crateRes.length > 0) {
messages.push(bold(`You found ${crateRes}!`));
return {
Expand Down

0 comments on commit 295e8e5

Please sign in to comment.