Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Jul 21, 2024
1 parent 0a348b9 commit 11b3f83
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
16 changes: 8 additions & 8 deletions src/lib/bankImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,16 @@ export class BankImageTask {

await fs.writeFile(path.join(CACHE_DIR, `${itemID}.png`), imageBuffer);

try {
try {
const image = await loadImage(imageBuffer);

this.itemIconsList.add(itemID);
this.itemIconImagesCache.set(itemID, image);
return image;
} catch(err) {
console.error(`${itemID} image failed to load`);
return this.fetchAndCacheImage(getItemOrThrow("Bones").id);
}
this.itemIconsList.add(itemID);
this.itemIconImagesCache.set(itemID, image);
return image;
} catch (err) {
console.error(`${itemID} image failed to load`);
return this.fetchAndCacheImage(getItemOrThrow('Bones').id);
}
}

drawBorder(ctx: SKRSContext2D, sprite: IBgSprite, titleLine = true) {
Expand Down
28 changes: 14 additions & 14 deletions src/lib/randomizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Bank, Items } from 'oldschooljs';
import { ONE_TRILLION } from './constants';
import { customItems } from './customItems/util';
import { keyCrates } from './keyCrates';
import { SkillsArray } from './skilling/types';
import type { ItemBank } from './types';
import { resolveItems } from './util';
import { SkillsArray } from './skilling/types';

declare module 'oldschooljs' {
interface Bank {
Expand Down Expand Up @@ -85,22 +85,22 @@ export async function updateUsersRandomizerMap(user: MUser) {
const sourceSkills = shuffleArr(SkillsArray);
const shuffledSkills = seedShuffle(SkillsArray, key);

const skillMapping: Record<string,string> = {};
for (let i= 0; i < sourceSkills.length; i++) {
const skillMapping: Record<string, string> = {};
for (let i = 0; i < sourceSkills.length; i++) {
skillMapping[sourceSkills[i]] = shuffledSkills[i];
}

const map = buildItemMap(key);
const obj: ItemBank = {};
for (const [key, val] of Object.entries(map)) {
obj[Number(val)] = Number(key);
}
const map = buildItemMap(key);
const obj: ItemBank = {};
for (const [key, val] of Object.entries(map)) {
obj[Number(val)] = Number(key);
}

await user.update({ item_map: map, item_map_key: key, reverse_item_map: obj, skill_map: skillMapping });
await user.update({ item_map: map, item_map_key: key, reverse_item_map: obj, skill_map: skillMapping });

const testBank = new Bank();
for (const item of allItems) {
testBank.add(item, 1);
}
remapBank(user, testBank);
const testBank = new Bank();
for (const item of allItems) {
testBank.add(item, 1);
}
remapBank(user, testBank);
}
9 changes: 2 additions & 7 deletions src/lib/util/handleTripFinish.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { Stopwatch, channelIsSendable } from '@oldschoolgg/toolkit';
import { activity_type_enum } from '@prisma/client';
import type {
AttachmentBuilder,
ButtonBuilder,
MessageCollector,
MessageCreateOptions
} from 'discord.js';
import type { AttachmentBuilder, ButtonBuilder, MessageCollector, MessageCreateOptions } from 'discord.js';
import { Time, randInt, roll } from 'e';
import { Bank } from 'oldschooljs';
import { alching } from '../../mahoji/commands/laps';
Expand Down Expand Up @@ -428,7 +423,7 @@ export async function handleTripFinish(
if (itemsToAddWithCL.length > 0 || itemsToRemove.length > 0) {
await user.transactItems({ itemsToAdd: itemsToAddWithCL, collectionLog: true, itemsToRemove });
if (itemsToAddWithCL.length > 0) {
messages.push(`You received: ${itemsToAddWithCL}`);
messages.push(`You received: ${itemsToAddWithCL}`);
}
}

Expand Down

0 comments on commit 11b3f83

Please sign in to comment.