Skip to content

Commit

Permalink
feat: revamp arcade/party games stats and add /partygames (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobk999 authored Aug 14, 2024
1 parent a527310 commit 7dd526b
Show file tree
Hide file tree
Showing 39 changed files with 317 additions and 82 deletions.
1 change: 1 addition & 0 deletions apps/discord-bot/src/commands/arcade/arcade.profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const ArcadeProfile = ({

let sidebar: SidebarItem[] = [
[t("stats.coins"), t(arcade.coins), "§6"],
[t("stats.coinConversions"), t(arcade.coinConversions), "§e"],
[t("stats.arcadeWins"), t(arcade.wins), "§b"],
];

Expand Down
9 changes: 1 addition & 8 deletions apps/discord-bot/src/commands/arcade/modes/dropper-maps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const DropperMapGroup = ({ dropper, group, stat, t }: DropperMapGroupProps) => (
{group
.map(([key, mapName]) => {
const map = dropper.maps[key];

let value;

switch (stat) {
Expand All @@ -65,13 +64,7 @@ const DropperMapGroup = ({ dropper, group, stat, t }: DropperMapGroupProps) => (
break;
}

return (
<box width="100%" padding={{ left: 8, right: 8, top: 4, bottom: 4 }}>
<text>§l{mapName}</text>
<div width="remaining" margin={{ left: 2, right: 2 }} />
<text>{value}</text>
</box>
);
return <Table.td title={mapName} value={value} size="inline" color="§f" />;
})}
</Table.tr>
);
31 changes: 31 additions & 0 deletions apps/discord-bot/src/commands/arcade/modes/party-games.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { LocalizeFunction } from "@statsify/discord";
import { PartyGames } from "@statsify/schemas";
import { Table } from "#components";
import { formatRaceTime } from "@statsify/util";

interface PartyGamesTableProps {
stats: PartyGames;
Expand All @@ -22,5 +23,35 @@ export const PartyGamesTable = ({ stats, t }: PartyGamesTableProps) => (
<Table.td title={t("stats.roundWins")} value={t(stats.roundsWon)} color="§e" />
<Table.td title={t("stats.starsEarned")} value={t(stats.starsEarned)} color="§6" />
</Table.tr>
<Table.ts title="Best Times">
<Table.tr>
<Table.td title="Anvil Spleef" value={stats.anvilSpleefBestTime === 0 ? "§7N/A" : formatRaceTime(stats.anvilSpleefBestTime)} color="§a" size="inline" />
<Table.td title="Lab Escape" value={stats.labEscapeBestTime === 0 ? "§7N/A" : formatRaceTime(stats.labEscapeBestTime)} color="§a" size="inline" />
<Table.td title="Jigsaw Rush" value={stats.jigsawRushBestTime === 0 ? "§7N/A" : formatRaceTime(stats.jigsawRushBestTime)} color="§a" size="inline" />
</Table.tr>
<Table.tr>
<Table.td title="The Floor Is Lava" value={stats.theFloorIsLavaBestTime === 0 ? "§7N/A" : formatRaceTime(stats.theFloorIsLavaBestTime)} color="§a" size="inline" />
<Table.td title="Chicken Rings" value={stats.chickenRingsBestTime === 0 ? "§7N/A" : formatRaceTime(stats.chickenRingsBestTime)} color="§a" size="inline" />
<Table.td title="Jungle Jump" value={stats.jungleJumpBestTime === 0 ? "§7N/A" : formatRaceTime(stats.jungleJumpBestTime)} color="§a" size="inline" />
</Table.tr>
<Table.tr>
<Table.td title="Bombardment" value={stats.bombardmentBestTime === 0 ? "§7N/A" : formatRaceTime(stats.bombardmentBestTime)} color="§a" size="inline" />
<Table.td title="Minecart Racing" value={stats.minecartRacingBestTime === 0 ? "§7N/A" : formatRaceTime(stats.minecartRacingBestTime)} color="§a" size="inline" />
<Table.td title="Spider Maze" value={stats.spiderMazeBestTime === 0 ? "§7N/A" : formatRaceTime(stats.spiderMazeBestTime)} color="§a" size="inline" />
</Table.tr>
</Table.ts>
<Table.ts title="Best Scores">
<Table.tr>
<Table.td title="Animal Slaughter" value={t(stats.animalSlaughterBestScore)} color="§a" size="inline" />
<Table.td title="Dive" value={t(stats.diveBestScore)} color="§a" size="inline" />
<Table.td title="High Ground" value={t(stats.highGroundBestScore)} color="§a" size="inline" />
</Table.tr>
<Table.tr>
<Table.td title="Hoe Hoe Hoe" value={t(stats.hoeHoeHoeBestScore)} color="§a" size="inline" />
<Table.td title="Lawn Moower" value={t(stats.lawnMoowerBestScore)} color="§a" size="inline" />
<Table.td title="RPG-16" value={t(stats.rpg16BestScore)} color="§a" size="inline" />
</Table.tr>
</Table.ts>
</Table.table>
);

111 changes: 111 additions & 0 deletions apps/discord-bot/src/commands/arcade/party-game.profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* Copyright (c) Statsify
*
* This source code is licensed under the GNU GPL v3 license found in the
* LICENSE file in the root directory of this source tree.
* https://github.com/Statsify/statsify/blob/main/LICENSE
*/

/**
* Copyright (c) Statsify
*
* This source code is licensed under the GNU GPL v3 license found in the
* LICENSE file in the root directory of this source tree.
* https://github.com/Statsify/statsify/blob/main/LICENSE
*/

import { Container, Footer, Header, Table } from "#components";
import { FormattedGame, type GameMode, type PartyGamesModes } from "@statsify/schemas";
import { PartyGamesTable } from "./modes/index.js";
import type { BaseProfileProps } from "#commands/base.hypixel-command";

export interface PartyGamesProfileProps extends BaseProfileProps {
mode: GameMode<PartyGamesModes>;
}

export const PartyGamesProfile = ({
skin,
player,
background,
logo,
user,
badge,
mode,
t,
time,
}: PartyGamesProfileProps) => {
const { arcade } = player.stats;
const { partyGames } = arcade;

let table;

switch (mode.api) {
case "overall":
table = <PartyGamesTable stats={arcade.partyGames} t={t} />;
break;
case "roundWins":
table = (
<Table.table>
<Table.tr>
<Table.td title="Animal Slaughter" value={t(partyGames.animalSlaughterWins)} size="inline" color="§a" />
<Table.td title="Anvil Spleef" value={t(partyGames.anvilSpleefWins)} size="inline" color="§a" />
<Table.td title="Avalanche" value={t(partyGames.avalancheWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Bombardment" value={t(partyGames.bombardmentWins)} size="inline" color="§a" />
<Table.td title="Cannon Painting" value={t(partyGames.cannonPaintingWins)} size="inline" color="§a" />
<Table.td title="Chicken Rings" value={t(partyGames.chickenRingsWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Dive" value={t(partyGames.diveWins)} size="inline" color="§a" />
<Table.td title="Fire Leapers" value={t(partyGames.fireLeapersWins)} size="inline" color="§a" />
<Table.td title="Frozen Floor" value={t(partyGames.frozenFloorWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="High Ground" value={t(partyGames.highGroundWins)} size="inline" color="§a" />
<Table.td title="Hoe Hoe Hoe" value={t(partyGames.hoeHoeHoeWins)} size="inline" color="§a" />
<Table.td title="Jigsaw Rush" value={t(partyGames.jigsawRushWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Jungle Jump" value={t(partyGames.jungleJumpWins)} size="inline" color="§a" />
<Table.td title="Lab Escape" value={t(partyGames.labEscapeWins)} size="inline" color="§a" />
<Table.td title="Lawn Moower" value={t(partyGames.lawnMoowerWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Minecart Racing" value={t(partyGames.minecartRacingWins)} size="inline" color="§a" />
<Table.td title="Pig Fishing" value={t(partyGames.pigFishingWins)} size="inline" color="§a" />
<Table.td title="Pig Jousting" value={t(partyGames.pigJoustingWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="RPG-16" value={t(partyGames.rpg16Wins)} size="inline" color="§a" />
<Table.td title="Shooting Range" value={t(partyGames.shootingRangeWins)} size="inline" color="§a" />
<Table.td title="Spider Maze" value={t(partyGames.spiderMazeWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Super Sheep" value={t(partyGames.superSheepWins)} size="inline" color="§a" />
<Table.td title="The Floor Is Lava" value={t(partyGames.theFloorIsLavaWins)} size="inline" color="§a" />
<Table.td title="Trampolinio" value={t(partyGames.trampolinioWins)} size="inline" color="§a" />
</Table.tr>
<Table.tr>
<Table.td title="Volcano" value={t(partyGames.volcanoWins)} size="inline" color="§a" />
<Table.td title="Workshop" value={t(partyGames.workshopWins)} size="inline" color="§a" />
</Table.tr>
</Table.table>
);
break;
}

return (
<Container background={background}>
<Header
skin={skin}
name={player.prefixName}
badge={badge}
title={`§l${FormattedGame.PARTY_GAMES} §fStats §r(${mode.formatted})`}
time={time}
/>
{table}
<Footer logo={logo} user={user} />
</Container>
);
};
30 changes: 30 additions & 0 deletions apps/discord-bot/src/commands/arcade/party-games.command.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) Statsify
*
* This source code is licensed under the GNU GPL v3 license found in the
* LICENSE file in the root directory of this source tree.
* https://github.com/Statsify/statsify/blob/main/LICENSE
*/

import {
BaseHypixelCommand,
BaseProfileProps,
ProfileData,
} from "#commands/base.hypixel-command";
import { Command } from "@statsify/discord";
import { PARTY_GAMES_MODES, PartyGamesModes } from "@statsify/schemas";
import { PartyGamesProfile } from "./party-game.profile.js";

@Command({ description: (t) => t("commands.party-games") })
export class PartyGamesCommand extends BaseHypixelCommand<PartyGamesModes> {
public constructor() {
super(PARTY_GAMES_MODES);
}

public getProfile(
base: BaseProfileProps,
{ mode }: ProfileData<PartyGamesModes>
): JSX.Element {
return <PartyGamesProfile {...base} mode={mode} />;
}
}
12 changes: 11 additions & 1 deletion apps/discord-bot/src/components/Table/TableData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface TableDataProps {
title: string;
value: string;
color: string;
size?: "small" | "regular";
size?: "small" | "regular" | "inline";
}

/**
Expand All @@ -37,6 +37,16 @@ export const TableData = ({ title, value, color, size = "regular" }: TableDataPr
);
}

if (size === "inline") {
return (
<box width="100%" padding={{ left: 8, right: 8, top: 4, bottom: 4 }}>
<text>§l{color}{title}</text>
<div width="remaining" margin={{ left: 2, right: 2 }} />
<text>{color}{value}</text>
</box>
);
}

return (
<box direction="column" location="center" width="100%">
<text margin={{ top: 8, bottom: 4, left: 6, right: 6 }}>{`${color}${title}`}</text>
Expand Down
6 changes: 6 additions & 0 deletions apps/discord-bot/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ import {
MurderMysteryModes,
PAINTBALL_MODES,
PARKOUR_MODES,
PARTY_GAMES_MODES,
PIT_MODES,
PaintballModes,
ParkourModes,
PartyGamesModes,
PitModes,
PlayerStats,
QUAKE_MODES,
Expand Down Expand Up @@ -90,6 +92,7 @@ export type GamesWithBackgrounds =
| MurderMysteryModes
| PaintballModes
| ParkourModes
| PartyGamesModes
| PitModes
| QuakeModes
| SkyWarsModes
Expand Down Expand Up @@ -207,6 +210,9 @@ export const mapBackground = <T extends GamesWithBackgrounds>(
case PARKOUR_MODES:
return ["parkour", "overall"];

case PARTY_GAMES_MODES:
return ["arcade", "partyGames"];

case QUEST_MODES:
case CHALLENGE_MODES:
switch (mode) {
Expand Down
2 changes: 1 addition & 1 deletion locales/bg/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Wins",
"souls": "Souls",
"stampLevel": "Coin Conversions",
"coinConversions": "Coin Conversions",
"starsEarned": "Stars Earned",
"started": "Started",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/cs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Výhry v Solo",
"souls": "Duše",
"stampLevel": "Převedené mince",
"coinConversions": "Převedené mince",
"starsEarned": "Získané hvězdy",
"started": "Začátek",
"status": "Stav",
Expand Down
2 changes: 1 addition & 1 deletion locales/da/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Wins",
"souls": "Souls",
"stampLevel": "Coin Conversions",
"coinConversions": "Coin Conversions",
"starsEarned": "Stars Earned",
"started": "Started",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/de/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Siege",
"souls": "Seelen",
"stampLevel": "Münzumwandlungen",
"coinConversions": "Münzumwandlungen",
"starsEarned": "Erhaltene Sterne",
"started": "Begonnen",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/el/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Νίκες",
"souls": "Ψυχές",
"stampLevel": "Μετατροπές Νομισμάτων",
"coinConversions": "Μετατροπές Νομισμάτων",
"starsEarned": "Αποκτημένα Αστέρια",
"started": "Ξεκίνησε",
"status": "Κατάσταση",
Expand Down
3 changes: 2 additions & 1 deletion locales/en-US/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"murdermystery": "$t(commands.hypixel-command, { \"name\": \"Murder Mystery\" })",
"paintball": "$t(commands.hypixel-command, { \"name\": \"Paintball\" })",
"parkour": "$t(commands.hypixel-command, { \"name\": \"Parkour\" })",
"party-games": "$t(commands.hypixel-command, { \"name\": \"Party Games\" })",
"ping": "View Statsify's creators and contributors",
"pit": "$t(commands.hypixel-command, { \"name\": \"Pit\" })",
"player-leaderboard": "$t(commands.leaderboard-command, { \"name\": \"Player\" })",
Expand Down Expand Up @@ -739,7 +740,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Wins",
"souls": "Souls",
"stampLevel": "Coin Conversions",
"coinConversions": "Coin Conversions",
"starsEarned": "Stars Earned",
"started": "Started",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/es-ES/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Victorias en solitario",
"souls": "Almas",
"stampLevel": "Conversiones de monedas",
"coinConversions": "Conversiones de monedas",
"starsEarned": "Estrellas Ganadas",
"started": "Comenzó",
"status": "Estatus",
Expand Down
2 changes: 1 addition & 1 deletion locales/fi/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo-voittoa",
"souls": "Sielua",
"stampLevel": "Kolikonmuunnokset",
"coinConversions": "Kolikonmuunnokset",
"starsEarned": "Tähteä ansaittu",
"started": "Alkoi",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/fr/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Tickets de sommeil",
"soloWins": "Victoires en solo",
"souls": "Âmes",
"stampLevel": "Conversions de pièces",
"coinConversions": "Conversions de pièces",
"starsEarned": "Étoiles gagnées",
"started": "Commencé",
"status": "Statut",
Expand Down
2 changes: 1 addition & 1 deletion locales/hi/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Wins",
"souls": "Souls",
"stampLevel": "Coin Conversions",
"coinConversions": "Coin Conversions",
"starsEarned": "Stars Earned",
"started": "Started",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/hr/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Wins",
"souls": "Souls",
"stampLevel": "Coin Conversions",
"coinConversions": "Coin Conversions",
"starsEarned": "Stars Earned",
"started": "Started",
"status": "Status",
Expand Down
2 changes: 1 addition & 1 deletion locales/hu/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Slumber Tickets",
"soloWins": "Solo Győzelmek",
"souls": "Lelkek",
"stampLevel": "Pénzváltások",
"coinConversions": "Pénzváltások",
"starsEarned": "Szerzett Csillagok",
"started": "Kezdet",
"status": "Státusz",
Expand Down
2 changes: 1 addition & 1 deletion locales/it/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"slumberTickets": "Biglietti Slumber",
"soloWins": "Vittorie in Singolo",
"souls": "Souls",
"stampLevel": "Conversione Monete",
"coinConversions": "Conversione Monete",
"starsEarned": "Stelle Guadagnate",
"started": "Iniziato",
"status": "Stato",
Expand Down
Loading

0 comments on commit 7dd526b

Please sign in to comment.