Skip to content

Commit

Permalink
Merge branch 'bso' into update99
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Mar 2, 2024
2 parents 1893cf9 + 0b94cf3 commit 67761e0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/lib/minions/functions/lmsSimCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,22 @@ export async function lmsSimCommand(channel: Channel | undefined, names?: string
} else {
filtered = new Set(splitContestants);
if (filtered.size !== splitContestants.length) {
channel.send('I am sorry, but a user cannot play twice.');
return channel.send('I am sorry, but a user cannot play twice.');
}

if (filtered.size < 4) {
channel.send(
return channel.send(
'Please specify atleast 4 players for Last Man Standing, like so: `+lms Alex, Kyra, Magna, Rick`, or type `+lms auto` to automatically pick people from the chat.'
);
}

if (filtered.size > 48) {
channel.send('I am sorry but the amount of players can be no greater than 48.');
return channel.send('I am sorry but the amount of players can be no greater than 48.');
}
}

if (playing.has(channel.guildId)) {
channel.send('There is a game in progress in this server already, try again when it finishes.');
return channel.send('There is a game in progress in this server already, try again when it finishes.');
}

playing.add(channel.guildId);
Expand Down
24 changes: 19 additions & 5 deletions src/mahoji/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ async function bankSortConfig(
user: MUser,
sortMethod: string | undefined,
addWeightingBank: string | undefined,
removeWeightingBank: string | undefined
removeWeightingBank: string | undefined,
resetWeightingBank: string | undefined
): CommandResponse {
const currentMethod = user.user.bank_sort_method;
const currentWeightingBank = new Bank(user.user.bank_sort_weightings as ItemBank);
Expand All @@ -342,7 +343,7 @@ async function bankSortConfig(
return patronMsg(PerkTier.Two);
}

if (!sortMethod && !addWeightingBank && !removeWeightingBank) {
if (!sortMethod && !addWeightingBank && !removeWeightingBank && !resetWeightingBank) {
const sortStr = currentMethod
? `Your current bank sort method is ${inlineCode(currentMethod)}.`
: 'You have not set a bank sort method.';
Expand Down Expand Up @@ -386,12 +387,13 @@ async function bankSortConfig(

if (addWeightingBank) newBank.add(inputBank);
else if (removeWeightingBank) newBank.remove(inputBank);
else if (resetWeightingBank && resetWeightingBank === 'reset') newBank.bank = {};

await user.update({
bank_sort_weightings: newBank.bank
});

return bankSortConfig(await mUserFetch(user.id), undefined, undefined, undefined);
return bankSortConfig(await mUserFetch(user.id), undefined, undefined, undefined, undefined);
}

async function bgColorConfig(user: MUser, hex?: string) {
Expand Down Expand Up @@ -849,6 +851,12 @@ export const configCommand: OSBMahojiCommand = {
name: 'remove_weightings',
description: "Remove weightings for extra bank sorting (e.g. '1 trout, 5 coal')",
required: false
},
{
type: ApplicationCommandOptionType.String,
name: 'reset_weightings',
description: "Type 'reset' to confirm you want to delete ALL of your bank weightings.",
required: false
}
]
},
Expand Down Expand Up @@ -1173,7 +1181,12 @@ LIMIT 20;
combat_options?: { action: 'add' | 'remove' | 'list' | 'help'; input: string };
set_rsn?: { username: string };
bg_color?: { color?: string };
bank_sort?: { sort_method?: string; add_weightings?: string; remove_weightings?: string };
bank_sort?: {
sort_method?: string;
add_weightings?: string;
remove_weightings?: string;
reset_weightings?: string;
};
favorite_alchs?: { add?: string; remove?: string; add_many?: string; reset?: boolean };
favorite_food?: { add?: string; remove?: string; reset?: boolean };
favorite_items?: { add?: string; remove?: string; reset?: boolean };
Expand Down Expand Up @@ -1251,7 +1264,8 @@ LIMIT 20;
user,
bank_sort.sort_method,
bank_sort.add_weightings,
bank_sort.remove_weightings
bank_sort.remove_weightings,
bank_sort.reset_weightings
);
}
if (favorite_alchs) {
Expand Down
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 @@ -51,7 +51,7 @@ export async function harvestCommand({
', '
)}. *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 Down Expand Up @@ -113,9 +113,9 @@ ${boostStr.length > 0 ? '**Boosts**: ' : ''}${boostStr.join(', ')}`;

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 @@ -171,7 +171,7 @@ export async function farmingPlantCommand({
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 @@ -330,7 +330,7 @@ export async function farmingPlantCommand({

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

0 comments on commit 67761e0

Please sign in to comment.