Skip to content

Commit 8085b80

Browse files
committed
refactor(MurderMystery)
1 parent 948765b commit 8085b80

19 files changed

+1596
-260
lines changed

src/Structures/MiniGames/BuildBattle/BuildBattle.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
import BuildBattleEmblem from './Emblem/BuildBattleEmblem.ts';
21
import BuildBattleLastWin from './BuildBattleLastWin.js';
3-
import BuildBattleLeaderboardSettings from './BuildBattleLeaderboardSettings.js';
42
import BuildBattleVotes from './BuildBattleVotes.js';
3+
import Emblem from '../Shared/Emblem/Emblem.ts';
4+
import LeaderboardSettings from '../Shared/LeaderboardSettings.ts';
55
import { BuildBattleTitleRequirements } from '../../../Utils/Constants.ts';
66
import { monthAB } from '../../../Utils/Oscillation.ts';
77
import type {
88
BuildBattleBackdrop,
9+
BuildBattleEmblemIcon,
910
BuildBattleHat,
1011
BuildBattleIsland,
12+
BuildBattleLeaderboardSettingsMode,
1113
BuildBattleMovementTrail,
1214
BuildBattlePackageItem,
13-
BuildBattleShopSort,
1415
BuildBattleSong,
1516
BuildBattleSuit,
1617
BuildBattleTitle,
17-
BuildBattleVictoryDance
18+
BuildBattleVictoryDance,
19+
ShopSort
1820
} from '../../../Types/Player.ts';
1921

2022
class BuildBattle {
2123
activeIsland: BuildBattleIsland | 'island_none';
2224
activeMovementTrail: BuildBattleMovementTrail | 'movement_trail_none';
2325
correctGuesses: number;
24-
emblem: BuildBattleEmblem;
26+
emblem: Emblem<BuildBattleEmblemIcon>;
2527
playedGames: number;
2628
lastPurchasedSong: BuildBattleSong | 'UNKNOWN';
2729
lastWon: BuildBattleLastWin;
28-
leaderboardSettings: BuildBattleLeaderboardSettings;
30+
leaderboardSettings: LeaderboardSettings<BuildBattleLeaderboardSettingsMode>;
2931
loadout: string[];
3032
monthlyTokensA: number;
3133
monthlyTokensB: number;
@@ -38,7 +40,7 @@ class BuildBattle {
3840
score: number;
3941
title: BuildBattleTitle;
4042
selectedBackdrop: BuildBattleBackdrop | 'backdrops_none';
41-
shopSort: BuildBattleShopSort | 'UNKNOWN';
43+
shopSort: ShopSort | 'UNKNOWN';
4244
shopSortEnableOwnedFirst: boolean;
4345
soloMostPoints: number;
4446
superVotes: number;
@@ -59,11 +61,13 @@ class BuildBattle {
5961
this.activeIsland = data?.active_island || 'island_none';
6062
this.activeMovementTrail = data?.active_movement_trail || 'movement_trail_none';
6163
this.correctGuesses = data?.correct_guesses || 0;
62-
this.emblem = new BuildBattleEmblem(data?.emblem || {});
64+
this.emblem = new Emblem<BuildBattleEmblemIcon>(data?.emblem || {});
6365
this.playedGames = data?.games_played || 0;
6466
this.lastPurchasedSong = data?.last_purchased_song || 'UNKNOWN';
6567
this.lastWon = new BuildBattleLastWin(data?.last_won || {});
66-
this.leaderboardSettings = new BuildBattleLeaderboardSettings(data?.leaderboardSettings || {});
68+
this.leaderboardSettings = new LeaderboardSettings<BuildBattleLeaderboardSettingsMode>(
69+
data?.leaderboardSettings || {}
70+
);
6771
this.loadout = data?.buildbattle_loadout || [];
6872
this.monthlyTokensA = data?.monthly_tokens_a || data?.monthly_coins_a || 0;
6973
this.monthlyTokensB = data?.monthly_tokens_b || data?.monthly_coins_b || 0;
@@ -76,7 +80,7 @@ class BuildBattle {
7680
this.score = data?.score || 0;
7781
this.title = BuildBattle.getBuildBattleTitle(this.score);
7882
this.selectedBackdrop = data?.selected_backdrop || 'backdrops_none';
79-
this.shopSort = data?.shop_sort || false;
83+
this.shopSort = data?.shop_sort || 'UNKNOWN';
8084
this.shopSortEnableOwnedFirst = data?.shop_sort_enable_owned_first || false;
8185
this.soloMostPoints = data?.solo_most_points || 0;
8286
this.superVotes = data?.super_votes || 0;

src/Structures/MiniGames/BuildBattle/BuildBattleLeaderboardSettings.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Structures/MiniGames/BuildBattle/Emblem/BuildBattleEmblem.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/Structures/MiniGames/MurderMystery/MurderMystery.test.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)