diff --git a/dist/util/bank.js b/dist/util/bank.js index 1363c2d..2864a5f 100644 --- a/dist/util/bank.js +++ b/dist/util/bank.js @@ -10,11 +10,11 @@ exports.generateRandomBank = generateRandomBank; const e_1 = require("e"); const oldschooljs_1 = require("oldschooljs"); function increaseBankQuantitesByPercent(bank, percent, whitelist = null) { - for (const [key, value] of Object.entries(bank.bank)) { - if (whitelist !== null && !whitelist.includes(Number.parseInt(key))) + for (const [item, qty] of bank.items()) { + if (whitelist !== null && !whitelist.includes(item.id)) continue; - const increased = Math.floor((0, e_1.increaseNumByPercent)(value, percent)); - bank.bank[key] = increased; + const increased = Math.floor((0, e_1.increaseNumByPercent)(qty, percent)); + bank.set(item.id, increased); } } function convertBankToPerHourStats(bank, time) { diff --git a/package.json b/package.json index af9adc2..61f0088 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "zod": "3.23.8" }, "peerDependencies": { - "discord.js": "^14.15.3", - "oldschooljs": "^2.5.9" + "discord.js": "^14.16.2", + "oldschooljs": "^2.6.1" }, "devDependencies": { "@biomejs/biome": "^1.8.3", @@ -40,8 +40,8 @@ "@types/node": "^20.14.9", "@vitest/coverage-v8": "^1.6.0", "concurrently": "^8.2.2", - "discord.js": "^14.15.3", - "oldschooljs": "^2.5.9", + "discord.js": "^14.16.2", + "oldschooljs": "^2.6.1", "rimraf": "^5.0.7", "typescript": "^5.5.3", "vitest": "^1.6.0" diff --git a/src/util/bank.ts b/src/util/bank.ts index 812a2b0..3ed22a9 100644 --- a/src/util/bank.ts +++ b/src/util/bank.ts @@ -3,10 +3,10 @@ import { Bank, Items } from 'oldschooljs'; import type { ItemBank } from 'oldschooljs/dist/meta/types'; export function increaseBankQuantitesByPercent(bank: Bank, percent: number, whitelist: number[] | null = null) { - for (const [key, value] of Object.entries(bank.bank)) { - if (whitelist !== null && !whitelist.includes(Number.parseInt(key))) continue; - const increased = Math.floor(increaseNumByPercent(value, percent)); - bank.bank[key] = increased; + for (const [item, qty] of bank.items()) { + if (whitelist !== null && !whitelist.includes(item.id)) continue; + const increased = Math.floor(increaseNumByPercent(qty, percent)); + bank.set(item.id, increased); } } diff --git a/yarn.lock b/yarn.lock index 36236b2..a1d42f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -156,18 +156,18 @@ __metadata: languageName: node linkType: hard -"@discordjs/builders@npm:^1.8.2": - version: 1.8.2 - resolution: "@discordjs/builders@npm:1.8.2" - dependencies: - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/util": "npm:^1.1.0" - "@sapphire/shapeshift": "npm:^3.9.7" - discord-api-types: "npm:0.37.83" +"@discordjs/builders@npm:^1.9.0": + version: 1.9.0 + resolution: "@discordjs/builders@npm:1.9.0" + dependencies: + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/shapeshift": "npm:^4.0.0" + discord-api-types: "npm:0.37.97" fast-deep-equal: "npm:^3.1.3" ts-mixer: "npm:^6.0.4" - tslib: "npm:^2.6.2" - checksum: 10c0/108fe8903e9bc875a28b39629589391e44f41835169114e93c15548b5635632862168d4bec3392eac12e981d06b830d90f11b7af38fd664d7ea9cfa46b0726f3 + tslib: "npm:^2.6.3" + checksum: 10c0/3287b87624c11112faeac0acc0063427dd85f4174ca7b2c3bbd0f77feab99e97193e5d6e6fb5989000eb50aff67d2831af3fc6cdf2907a05ac23a475f5b65ab6 languageName: node linkType: hard @@ -185,12 +185,19 @@ __metadata: languageName: node linkType: hard -"@discordjs/formatters@npm:^0.4.0": - version: 0.4.0 - resolution: "@discordjs/formatters@npm:0.4.0" +"@discordjs/collection@npm:^2.1.1": + version: 2.1.1 + resolution: "@discordjs/collection@npm:2.1.1" + checksum: 10c0/7bbb007271a046c981957b4a0543f6ca7e4c294a2d40987437ff06db5e92dbf35b8dc61719db2a7bc99557a58275742aa34be9f50487870a6e80acfc4fe45fa1 + languageName: node + linkType: hard + +"@discordjs/formatters@npm:^0.5.0": + version: 0.5.0 + resolution: "@discordjs/formatters@npm:0.5.0" dependencies: - discord-api-types: "npm:0.37.83" - checksum: 10c0/9788e00559155f1767f85d02f14b0368affd4b7b86c1ff2207779906093ad9caf86cd74a60e681da5e762234b45fc9368c044247a484b4691cd652d5ff0d4f70 + discord-api-types: "npm:0.37.97" + checksum: 10c0/784e7a7cb82874eb3d5741c8058088accdc6151151d5dbafa634efdb184e0f5666a95e57ac8f6e514b2819b07f764dbb1d4258c0dbba37fc5645f800182ae1d9 languageName: node linkType: hard @@ -211,6 +218,23 @@ __metadata: languageName: node linkType: hard +"@discordjs/rest@npm:^2.4.0": + version: 2.4.0 + resolution: "@discordjs/rest@npm:2.4.0" + dependencies: + "@discordjs/collection": "npm:^2.1.1" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/async-queue": "npm:^1.5.3" + "@sapphire/snowflake": "npm:^3.5.3" + "@vladfrangu/async_event_emitter": "npm:^2.4.6" + discord-api-types: "npm:0.37.97" + magic-bytes.js: "npm:^1.10.0" + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/2de35ff6c0ad734685e329fc29df52823faf6e9eb68045b780f5b657555c699da7e9e0ffdf2ab1ee7ef902d7a8901993b6ea6e0f3c85938570a2b74e15207c0a + languageName: node + linkType: hard + "@discordjs/util@npm:^1.1.0": version: 1.1.0 resolution: "@discordjs/util@npm:1.1.0" @@ -218,7 +242,14 @@ __metadata: languageName: node linkType: hard -"@discordjs/ws@npm:^1.1.1": +"@discordjs/util@npm:^1.1.1": + version: 1.1.1 + resolution: "@discordjs/util@npm:1.1.1" + checksum: 10c0/a374648aae0dd98345996f41891add0523388297a6f6b99c7a37c83de4d832d91a464195502126967fac0f071e5ecb80f776ee42a887fffa9c5c0f4612381b98 + languageName: node + linkType: hard + +"@discordjs/ws@npm:1.1.1": version: 1.1.1 resolution: "@discordjs/ws@npm:1.1.1" dependencies: @@ -518,22 +549,22 @@ __metadata: decimal.js: "npm:^10.4.3" deep-object-diff: "npm:^1.1.9" deepmerge: "npm:4.3.1" - discord.js: "npm:^14.15.3" + discord.js: "npm:^14.16.2" e: "npm:0.2.33" emoji-regex: "npm:^10.2.1" fast-deep-equal: "npm:^3.1.3" ioredis: "npm:^5.4.1" ioredis-mock: "npm:^8.9.0" math-expression-evaluator: "npm:^1.3.14" - oldschooljs: "npm:^2.5.9" + oldschooljs: "npm:^2.6.1" pure-rand: "npm:^6.1.0" rimraf: "npm:^5.0.7" typescript: "npm:^5.5.3" vitest: "npm:^1.6.0" zod: "npm:3.23.8" peerDependencies: - discord.js: ^14.15.3 - oldschooljs: ^2.5.9 + discord.js: ^14.16.2 + oldschooljs: ^2.6.1 languageName: unknown linkType: soft @@ -670,13 +701,20 @@ __metadata: languageName: node linkType: hard -"@sapphire/shapeshift@npm:^3.9.7": - version: 3.9.7 - resolution: "@sapphire/shapeshift@npm:3.9.7" +"@sapphire/async-queue@npm:^1.5.3": + version: 1.5.3 + resolution: "@sapphire/async-queue@npm:1.5.3" + checksum: 10c0/fcf860cdde9bfbc1625dab5e11924caa871c9e741a8fb836193a519267179a4a1979604f88f8a40855c6b931bc82d489dcd11d034fea38bb8a4d9816ab821ed1 + languageName: node + linkType: hard + +"@sapphire/shapeshift@npm:^4.0.0": + version: 4.0.0 + resolution: "@sapphire/shapeshift@npm:4.0.0" dependencies: fast-deep-equal: "npm:^3.1.3" lodash: "npm:^4.17.21" - checksum: 10c0/29883d4c1986714fd4b2a7e4a58bf30a4598a02bbe031605dd99b766310a98889e2ae6f16bf37f43d91cf5960733dc1a619bfdaa85a96bc0ff9cc5ce57b8e689 + checksum: 10c0/2abbfd20977e800455108688e45fff7b7c6e197256c8f8a54db90025a900914908b5fa4ffcbd1eacb4c692792cbed980613aa878e09f1fd87ab5052b6a6d6bce languageName: node linkType: hard @@ -827,6 +865,13 @@ __metadata: languageName: node linkType: hard +"@vladfrangu/async_event_emitter@npm:^2.4.6": + version: 2.4.6 + resolution: "@vladfrangu/async_event_emitter@npm:2.4.6" + checksum: 10c0/1fe634878902da584493ecb8e81c855436c002b215dd7c25c21780930fc5621ebe8eb79d5b899a56af0d1ea9ea9171e35175221e4438e2f56c67ce64d4b8a373 + languageName: node + linkType: hard + "abbrev@npm:^2.0.0": version: 2.0.0 resolution: "abbrev@npm:2.0.0" @@ -1186,23 +1231,30 @@ __metadata: languageName: node linkType: hard -"discord.js@npm:^14.15.3": - version: 14.15.3 - resolution: "discord.js@npm:14.15.3" +"discord-api-types@npm:0.37.97": + version: 0.37.97 + resolution: "discord-api-types@npm:0.37.97" + checksum: 10c0/1a08a0f44d3a7439fd1ac4128e4a853c498fa5477e40bc68f2c62d5b2abe8aad1d1d402d8a59a6ac55adf348354dc6c97865a11548b1a25bf2f0878cff3a54b0 + languageName: node + linkType: hard + +"discord.js@npm:^14.16.2": + version: 14.16.2 + resolution: "discord.js@npm:14.16.2" dependencies: - "@discordjs/builders": "npm:^1.8.2" + "@discordjs/builders": "npm:^1.9.0" "@discordjs/collection": "npm:1.5.3" - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/rest": "npm:^2.3.0" - "@discordjs/util": "npm:^1.1.0" - "@discordjs/ws": "npm:^1.1.1" + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/rest": "npm:^2.4.0" + "@discordjs/util": "npm:^1.1.1" + "@discordjs/ws": "npm:1.1.1" "@sapphire/snowflake": "npm:3.5.3" - discord-api-types: "npm:0.37.83" + discord-api-types: "npm:0.37.97" fast-deep-equal: "npm:3.1.3" lodash.snakecase: "npm:4.1.1" - tslib: "npm:2.6.2" - undici: "npm:6.13.0" - checksum: 10c0/21a4e28541c29bf7170835f42cebc684e83615221f3c1262677e1f363e8fd28e7367e35bceabaea15873d965aecf0a832df6d572790ddec104bd0e025d11bdb8 + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/2b4289d6a3b3f5c2978dbfa840225d2f789eaf161ae85bf12e0125b5096eb64562c170dfc7f0d1ee389beb565cabe45733a27853178b2d0dc78548b5d1a83338 languageName: node linkType: hard @@ -2171,14 +2223,13 @@ __metadata: languageName: node linkType: hard -"oldschooljs@npm:^2.5.9": - version: 2.5.9 - resolution: "oldschooljs@npm:2.5.9" +"oldschooljs@npm:^2.6.1": + version: 2.6.1 + resolution: "oldschooljs@npm:2.6.1" dependencies: - deepmerge: "npm:4.3.1" e: "npm:^0.2.33" node-fetch: "npm:2.6.7" - checksum: 10c0/6e9f44153a876c2fe389a5c65d437b9526d0cfb0a574696823144f59dee84e36330dcb88a76fdaa3199f9c00c7ba9d57559bf6d6b511e792be90e0783091eac1 + checksum: 10c0/1a95ba311806aaad624fca2a4feeb71757ecd62dea0df9c9f03e63ef81580f1ce40d8cf36e2d0b52ae184305e9876c62ed586c188e330e36f22767bd0c44ab2b languageName: node linkType: hard @@ -2809,13 +2860,6 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.6.2": - version: 2.6.2 - resolution: "tslib@npm:2.6.2" - checksum: 10c0/e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb - languageName: node - linkType: hard - "tslib@npm:^2.1.0, tslib@npm:^2.6.2": version: 2.6.3 resolution: "tslib@npm:2.6.3" @@ -2823,6 +2867,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:^2.6.3": + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 10c0/469e1d5bf1af585742128827000711efa61010b699cb040ab1800bcd3ccdd37f63ec30642c9e07c4439c1db6e46345582614275daca3e0f4abae29b0083f04a6 + languageName: node + linkType: hard + "type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": version: 4.0.8 resolution: "type-detect@npm:4.0.8" @@ -2871,6 +2922,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:6.19.8": + version: 6.19.8 + resolution: "undici@npm:6.19.8" + checksum: 10c0/07fd8520bce7e34ea29c07ef0de27b734183042cdb4e2f1262cd1fb9b755a6b04ff2471040395dfb1770fb7786069a97c5178bcf706b80a34075994f46feb37c + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0"