Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Player #85

Merged
merged 11 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
654 changes: 495 additions & 159 deletions src/API/getPlayer.test.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/API/getPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import Player from '../structures/Player';
import Player from '../structures/Player/Player';
import { PlayerRequestOptions } from './API';

class getPlayer extends Endpoint {
Expand Down
2 changes: 2 additions & 0 deletions src/API/getSkyblockFireSales.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ test('getSkyblockFireSales', async () => {
vi.spyOn(global, 'fetch').mockResolvedValue({
...defaultRequestData,
json: () =>
/* eslint-disable camelcase */
Promise.resolve({
success: true,
sales: [
{ item_id: 'PET_SKIN_LION_WHITE', start: 1725120000000, end: 1725552000000, amount: 6500, price: 650 },
{ item_id: 'PET_SKIN_LION_BLACK', start: 1725120000000, end: 1725552000000, amount: 6500, price: 650 }
]
})
/* eslint-enable camelcase */
} as any);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export * from './structures/MiniGames/VampireZ';
export * from './structures/MiniGames/Walls';
export * from './structures/MiniGames/Warlords';
export * from './structures/MiniGames/WoolGames';
export * from './structures/Pet';
export * from './structures/Pets';
export * from './structures/Player';
export * from './structures/PlayerCosmetics';
export * from './structures/Player/Pet';
export * from './structures/Player/Pets';
export * from './structures/Player/Player';
export * from './structures/Player/Cosmetics';
export * from './structures/RecentGame';
export * from './structures/SkyBlock/Auctions/Auction';
export * from './structures/SkyBlock/Auctions/AuctionInfo';
Expand Down Expand Up @@ -106,7 +106,7 @@ export * from './structures/WatchdogStats';

export * from './utils/Constants';
export * from './utils/Guild';
export * from './utils/Player';
export * from './structures/Player/Utils';
export * from './utils/SkyblockUtils';
export * from './utils/divide';
export * from './utils/isGuildID';
Expand Down
42 changes: 42 additions & 0 deletions src/structures/Housing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class HousingGivenCookies {
date: string;
houses: string[];
constructor(date: string, houses: string[]) {
this.date = date;
this.houses = houses;
}
}

class Housing {
allowedBlocks: string[];
playerVisibility: number;
showBorder: boolean;
showTips: boolean;
tutorialStage: string;
packages: string[];
firstHouseJoinTimestamp: number;
firstHouseJoinAt: Date;
plotSize: number;
givenCookies: HousingGivenCookies[];
constructor(data: Record<string, any>) {
this.allowedBlocks = data.allowedBlocks;
this.playerVisibility = data?.playerSettings?.VISIBILITY
? Number(data?.playerSettings?.VISIBILITY.split('-')[1])
: 4;
this.showBorder = data?.playerSettings?.BORDER ? Boolean(data?.playerSettings?.BORDER.split('-')[1]) : true;
this.showTips = data?.playerSettings?.TIPS ? Boolean(data?.playerSettings?.TIPS.split('-')[1]) : false;
this.tutorialStage = data.tutorialStep;
this.packages = data.packages;
this.firstHouseJoinTimestamp = data.firstHouseJoinMs;
this.firstHouseJoinAt = new Date(this.firstHouseJoinTimestamp);
this.plotSize = data.plotSize;
this.givenCookies = [];
Object.keys(data)
.filter((key) => key.startsWith('given_cookies_'))
.map((key) => {
this.givenCookies.push(new HousingGivenCookies(key, data[key]));
});
}
}

export default Housing;
46 changes: 0 additions & 46 deletions src/structures/Pets.ts

This file was deleted.

102 changes: 0 additions & 102 deletions src/structures/Player.test.ts

This file was deleted.

Loading
Loading