Skip to content

Commit

Permalink
Merge branch 'oldschoolgg:master' into Farming-Button
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-TURBO authored Mar 17, 2024
2 parents da746fc + 46cc4e0 commit 346c4e4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/lib/addXP.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { formatOrdinal, toTitleCase } from '@oldschoolgg/toolkit';
import { bold } from 'discord.js';
import { noOp, Time } from 'e';
import { convertXPtoLVL, toKMB } from 'oldschooljs/dist/util/util';

Expand Down Expand Up @@ -136,6 +137,15 @@ export async function addXP(user: MUser, params: AddXpParams): Promise<string> {
[`skills_${params.skillName}`]: Math.floor(newXP)
});

if (currentXP < MAX_XP && newXP === MAX_XP && Object.values(user.skillsAsXP).every(xp => xp === MAX_XP)) {
globalClient.emit(
Events.ServerNotification,
bold(
`🎉 ${skill.emoji} **${user.badgedUsername}'s** minion, ${user.minionName}, just achieved the maximum possible total XP!`
)
);
}

let str = '';
if (preMax !== -1) {
str += params.minimal
Expand Down
3 changes: 3 additions & 0 deletions src/lib/grandExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of
const components = [disableDMsButton];
if (newSellerListingQuantityRemaining > 0) {
components.push(createGECancelButton(sellerListing));
str += `\n\nYou have ${newSellerListingQuantityRemaining}x remaining to sell in your listing.`;
} else {
str += '\n\nThis listing has now been fully fulfilled.';
}

await sellerDJSUser.send({ content: str, components: makeComponents(components) }).catch(noOp);
Expand Down
9 changes: 7 additions & 2 deletions src/lib/simulation/nex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ interface TeamMember {
totalDefensivePercent: number;
}

interface NexContext {
export interface NexContext {
quantity: number;
team: { id: string; contribution: number; deaths: number[] }[];
team: { id: string; contribution: number; deaths: number[]; ghost?: true }[];
}

export const purpleNexItems = resolveItems([
Expand Down Expand Up @@ -166,6 +166,11 @@ export function handleNexKills({ quantity, team }: NexContext) {
}
}

for (const member of team) {
if (member.ghost) {
teamLoot.map.delete(member.id);
}
}
return teamLoot;
}

Expand Down
27 changes: 25 additions & 2 deletions src/tasks/minions/nexActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { formatOrdinal } from '@oldschoolgg/toolkit';

import { NEX_ID } from '../../lib/constants';
import { trackLoot } from '../../lib/lootTrack';
import { handleNexKills } from '../../lib/simulation/nex';
import { handleNexKills, NexContext } from '../../lib/simulation/nex';
import { NexTaskOptions } from '../../lib/types/minions';
import { handleTripFinish } from '../../lib/util/handleTripFinish';
import { makeBankImage } from '../../lib/util/makeBankImage';
Expand All @@ -17,12 +17,35 @@ export const nexTask: MinionTask = {
const allMUsers = await Promise.all(users.map(id => mUserFetch(id)));

const survivedQuantity = wipedKill ? wipedKill - 1 : quantity;
const teamResult = userDetails.map(u => ({
let teamResult: NexContext['team'] = userDetails.map(u => ({
id: u[0],
contribution: u[1],
deaths: u[2]
}));

if (allMUsers.length === 1) {
teamResult = teamResult.concat(
{
id: '2',
contribution: teamResult[0].contribution,
deaths: [],
ghost: true
},
{
id: '3',
contribution: teamResult[0].contribution,
deaths: [],
ghost: true
},
{
id: '4',
contribution: teamResult[0].contribution,
deaths: [],
ghost: true
}
);
}

const loot = handleNexKills({
quantity: survivedQuantity,
team: teamResult
Expand Down

0 comments on commit 346c4e4

Please sign in to comment.