Skip to content

Commit

Permalink
Merge branch 'master' into colosseum
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Jun 17, 2024
2 parents e69033f + 627e68f commit 456b359
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/lib/data/Collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ export const allCollectionLogs: ICollection = {
fmtProg: kcProg(Monsters.Hespori)
},
'The Inferno': {
kcActivity: {
Default: async (_, minigameScores) =>
minigameScores.find(i => i.minigame.column === 'inferno')!.score
},
alias: ['zuk', 'inferno'],
items: theInfernoCL,
fmtProg: ({ minigames }) => `${minigames.inferno} KC`
Expand Down
7 changes: 4 additions & 3 deletions src/lib/data/CollectionsExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,14 @@ export const grotesqueGuardiansCL = resolveItems([
'Granite dust'
]);
export const hesporiCL = resolveItems(['Bottomless compost bucket', 'Iasor seed', 'Kronos seed', 'Attas seed']);
export const theInfernoCL = resolveItems(['Jal-nib-rek', 'Infernal cape', 'Tokkul']);
export const theInfernoCL = resolveItems(['Jal-nib-rek', 'Infernal cape']);
export const kalphiteQueenCL = resolveItems([
'Kalphite princess',
'Kq head',
'Jar of sand',
'Dragon 2h sword',
'Dragon chainbody'
'Dragon chainbody',
'Dragon pickaxe'
]);
export const kingBlackDragonCL = resolveItems([
'Prince black dragon',
Expand Down Expand Up @@ -391,12 +392,12 @@ export const spiritAnglerOutfit = resolveItems([
export const temporossCL = resolveItems([
'Tiny tempor',
'Big harpoonfish',
...spiritAnglerOutfit,
'Tome of water (empty)',
'Soaked page',
'Tackle box',
'Fish barrel',
'Dragon harpoon',
...spiritAnglerOutfit,
'Spirit flakes'
]);
export const thermonuclearSmokeDevilCL = resolveItems([
Expand Down
4 changes: 4 additions & 0 deletions src/lib/util/migrateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export async function migrateUser(_source: string | MUser, _dest: string | MUser
const sourceUser = typeof _source === 'string' ? await mUserFetch(_source) : _source;
const destUser = typeof _dest === 'string' ? await mUserFetch(_dest) : _dest;

if (sourceUser.id === destUser.id) {
throw new UserError('Destination user cannot be the same as the source!');
}

// First check for + cancel active GE Listings:
await Promise.all([cancelUsersListings(sourceUser), cancelUsersListings(destUser)]);

Expand Down
15 changes: 12 additions & 3 deletions src/mahoji/commands/ge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { handleMahojiConfirmation } from '../../lib/util/handleMahojiConfirmatio
import { deferInteraction } from '../../lib/util/interactionReply';
import itemIsTradeable from '../../lib/util/itemIsTradeable';
import { cancelGEListingCommand } from '../lib/abstracted_commands/cancelGEListingCommand';
import { itemOption, ownedItemOption, tradeableItemArr } from '../lib/mahojiCommandOptions';
import { itemOption, tradeableItemArr } from '../lib/mahojiCommandOptions';
import { OSBMahojiCommand } from '../lib/util';

export type GEListingWithTransactions = GEListing & {
Expand Down Expand Up @@ -130,10 +130,19 @@ export const geCommand: OSBMahojiCommand = {
description: 'Sell something on the grand exchange.',
options: [
{
...ownedItemOption(item => Boolean(item.tradeable_on_ge)),
name: 'item',
type: ApplicationCommandOptionType.String,
description: 'The item you want to sell.',
required: true
required: true,
autocomplete: async (value, { id }) => {
const user = await mUserFetch(id);

return user.bank
.items()
.filter(i => i[0].tradeable_on_ge)
.filter(i => (!value ? true : i[0].name.toLowerCase().includes(value.toLowerCase())))
.map(i => ({ name: `${i[0].name} (${i[1]}x Owned)`, value: i[0].name }));
}
},
quantityOption,
priceOption
Expand Down
8 changes: 7 additions & 1 deletion src/mahoji/commands/rp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const itemFilters = [
];

function isProtectedAccount(user: MUser) {
if ([...ADMIN_IDS, ...OWNER_IDS].includes(user.id)) return true;
const botAccounts = ['303730326692429825', '729244028989603850', '969542224058654790'];
if ([...ADMIN_IDS, ...OWNER_IDS, ...botAccounts].includes(user.id)) return true;
if ([BitField.isModerator, BitField.isContributor].some(bf => user.bitfield.includes(bf))) return true;
return false;
}
Expand Down Expand Up @@ -809,7 +810,12 @@ ORDER BY item_id ASC;`);
if (!isOwner && !isAdmin) {
return randArrItem(gifs);
}

const { source, dest, reason } = options.player.migrate_user;

if (source.user.id === dest.user.id) {
return 'Destination cannot be the same as the source!';
}
const sourceUser = await mUserFetch(source.user.id);
const destUser = await mUserFetch(dest.user.id);

Expand Down
5 changes: 2 additions & 3 deletions tests/unit/snapshots/clsnapshots.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Hard Treasure Trails (134)
Hespori (4)
Implings (12)
K'ril Tsutsaroth (8)
Kalphite Queen (5)
Kalphite Queen (6)
King Black Dragon (4)
Kraken (4)
Kree'arra (8)
Expand Down Expand Up @@ -94,7 +94,7 @@ Tempoross (12)
The Fight Caves (2)
The Forgotten Four (40)
The Gauntlet (5)
The Inferno (3)
The Inferno (2)
The Leviathan (10)
The Nightmare (12)
The Whisperer (10)
Expand Down Expand Up @@ -1419,7 +1419,6 @@ The stuff
Thieving bag
Thread of elidinis
Tiny tempor
Tokkul
Toktz-ket-xil
Toktz-mej-tal
Toktz-xil-ak
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1486,11 +1486,11 @@ brace-expansion@^2.0.1:
balanced-match "^1.0.0"

braces@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

buffer@^5.5.0:
version "5.7.1"
Expand Down Expand Up @@ -2681,10 +2681,10 @@ filing-cabinet@^4.1.6:
tsconfig-paths "^4.2.0"
typescript "^5.0.4"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand Down

0 comments on commit 456b359

Please sign in to comment.