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

Commit

Permalink
Player (#85)
Browse files Browse the repository at this point in the history
* player

* Plaer

* Add missing Player Data

* Missing Player Data

* Rewrite Player

* Fix BaseURL
  • Loading branch information
Kathund authored Oct 4, 2024
1 parent 34f3197 commit f4d4b12
Show file tree
Hide file tree
Showing 38 changed files with 1,845 additions and 599 deletions.
2 changes: 1 addition & 1 deletion src/API/getAchievements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test('getAchievements', async () => {
expectTypeOf(tier.tier).toEqualTypeOf<number>();
expect(tier.points).toBeDefined();
expect(tier.points).toBeGreaterThanOrEqual(0);
expectTypeOf(tier.points).toEqualTypeOf<number>();
expectTypeOf(tier.points).toEqualTypeOf<number | undefined>();
expect(tier.amount).toBeDefined();
expect(tier.amount).toBeGreaterThanOrEqual(0);
expectTypeOf(tier.amount).toEqualTypeOf<number>();
Expand Down
657 changes: 498 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
Expand Up @@ -2,7 +2,7 @@ import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import Guild from '../structures/Guild/Guild';
import House from '../structures/House';
import Player from '../structures/Player';
import Player from '../structures/Player/Player';
import RecentGame from '../structures/RecentGame';
import { PlayerRequestOptions } from './API';
import { RequestData } from '../Private/RequestHandler';
Expand Down
2 changes: 1 addition & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Guild from './structures/Guild/Guild';
import GuildAchievements from './structures/Static/Achievements/Guild';
import House from './structures/House';
import Leaderboard from './structures/Leaderboard';
import Player from './structures/Player';
import Player from './structures/Player/Player';
import Product from './structures/SkyBlock/Bazaar/Product';
import Quests from './structures/Static/Quests';
import RateLimit from './Private/RateLimit';
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 @@ -107,7 +107,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;
2 changes: 1 addition & 1 deletion src/structures/MiniGames/Pit.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Client from '../../Client';
import Pit, { PitArmor } from './Pit';
import PitInventoryItem from './PitInventoryItem';
import Player from '../Player';
import Player from '../Player/Player';
import { expect, expectTypeOf, test } from 'vitest';

test('Pit', () => {
Expand Down
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

0 comments on commit f4d4b12

Please sign in to comment.