Skip to content

Commit d2d02b8

Browse files
authored
feat: duels update 2025 (#768)
1 parent e4e62e2 commit d2d02b8

File tree

13 files changed

+367
-144
lines changed

13 files changed

+367
-144
lines changed

apps/discord-bot/src/commands/duels/duels.profile.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*/
88

99
import {
10+
BedWarsDuelsTable,
1011
BridgeDuelsTable,
1112
MultiDuelsGameModeTable,
1213
SingleDuelsGameModeTable,
1314
TitlesTable,
14-
UHCDuelsTable,
1515
} from "./tables/index.js";
1616
import { Container, Footer, Header, SidebarItem, formatProgression } from "#components";
1717
import { DuelsModes, FormattedGame, type GameMode } from "@statsify/schemas";
@@ -53,6 +53,9 @@ export const DuelsProfile = <T extends ProfileTime>({
5353
sidebar.push([t("stats.shotsFired"), t(stats.overall.shotsFired), "§6"]);
5454
}
5555

56+
if ("headshots" in stats)
57+
sidebar.push([t("stats.headshots"), t(stats.headshots), "§3"]);
58+
5659
if ("kit" in stats)
5760
sidebar.push([t("stats.kit"), prettify(stats.kit), "§e"]);
5861

@@ -66,15 +69,25 @@ export const DuelsProfile = <T extends ProfileTime>({
6669
break;
6770

6871
case "uhc":
69-
table = <UHCDuelsTable stats={duels[mode.api]} t={t} time={time} />;
72+
table = <SingleDuelsGameModeTable stats={duels[mode.api][mode.submode.api]} t={t} time={time} />;
73+
break;
74+
75+
case "bedwars":
76+
sidebar.push([t("stats.itemsPurchased"), t(duels.bedwars.overall.itemsPurchased), "§d"]);
77+
table = mode.submode.api === "overall" ? <BedWarsDuelsTable stats={duels[mode.api][mode.submode.api]} t={t} time={time} /> : <SingleDuelsGameModeTable stats={duels[mode.api][mode.submode.api]} t={t} time={time} />;
7078
break;
7179

7280
case "skywars":
7381
case "op":
74-
case "megawalls":
82+
case "classic":
7583
table = <MultiDuelsGameModeTable stats={duels[mode.api]} t={t} time={time} />;
7684
break;
7785

86+
case "spleef":
87+
if (mode.submode.api === "spleef") sidebar.push([t("stats.blocksBroken"), t(duels.spleef.spleef.blocksBroken), "§b"]);
88+
table = <SingleDuelsGameModeTable stats={duels[mode.api][mode.submode.api]} t={t} time={time} />;
89+
break;
90+
7891
case "overall":
7992
// ensures the profile is not a historical one so modeIcons is defined
8093
table = isTitles ?
@@ -91,6 +104,8 @@ export const DuelsProfile = <T extends ProfileTime>({
91104

92105
if (mode.api === "overall") {
93106
formattedMode = mode.submode.api === "stats" ? "Overall" : mode.submode.formatted;
107+
} else if ((mode.api === "bedwars" || mode.api === "spleef") && mode.submode.api !== "overall") {
108+
formattedMode = mode.submode.formatted;
94109
} else {
95110
formattedMode = `${mode.formatted}${mode.submode ? ` ${mode.submode.formatted}` : ""}`;
96111
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright (c) Statsify
3+
*
4+
* This source code is licensed under the GNU GPL v3 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
* https://github.com/Statsify/statsify/blob/main/LICENSE
7+
*/
8+
9+
import { Historical, Table } from "#components";
10+
import type { BedWarsDuelsOverallMode } from "@statsify/schemas";
11+
import type { LocalizeFunction } from "@statsify/discord";
12+
import type { ProfileTime } from "#commands/base.hypixel-command";
13+
14+
export interface BedWarsDuelsTableProps {
15+
stats: BedWarsDuelsOverallMode;
16+
t: LocalizeFunction;
17+
time: ProfileTime;
18+
}
19+
20+
export const BedWarsDuelsTable = ({ stats, t, time }: BedWarsDuelsTableProps) => (
21+
<Table.table>
22+
<Historical.exclude time={time}>
23+
<Table.tr>
24+
<Table.td
25+
title={t("stats.winstreak")}
26+
value={t(stats.winstreak)}
27+
color="§e"
28+
/>
29+
<Table.td
30+
title={t("stats.bestWinstreak")}
31+
value={t(stats.bestWinstreak)}
32+
color="§e"
33+
/>
34+
</Table.tr>
35+
</Historical.exclude>
36+
<Table.tr>
37+
<Table.td title={t("stats.wins")} value={t(stats.wins)} color="§a" />
38+
<Table.td title={t("stats.losses")} value={t(stats.losses)} color="§c" />
39+
<Table.td title={t("stats.wlr")} value={t(stats.wlr)} color="§6" />
40+
</Table.tr>
41+
<Table.tr>
42+
<Table.td title={t("stats.finalKills")} value={t(stats.finalKills)} color="§a" />
43+
<Table.td title={t("stats.finalDeaths")} value={t(stats.finalDeaths)} color="§c" />
44+
<Table.td title={t("stats.fkdr")} value={t(stats.fkdr)} color="§6" />
45+
</Table.tr>
46+
<Table.tr>
47+
<Table.td title={t("stats.kills")} value={t(stats.kills)} color="§a" />
48+
<Table.td title={t("stats.deaths")} value={t(stats.deaths)} color="§c" />
49+
<Table.td title={t("stats.kdr")} value={t(stats.kdr)} color="§6" />
50+
</Table.tr>
51+
<Table.tr>
52+
<Table.td title={t("stats.bedsBroken")} value={t(stats.bedsBroken)} color="§a" />
53+
<Table.td title={t("stats.bedsLost")} value={t(stats.bedsLost)} color="§c" />
54+
<Table.td title={t("stats.bblr")} value={t(stats.bblr)} color="§6" />
55+
</Table.tr>
56+
</Table.table>
57+
);

apps/discord-bot/src/commands/duels/tables/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
export * from "./bridge-duels.table.js";
1010
export * from "./multi-duels-game-mode.table.js";
1111
export * from "./single-duels-game-mode.table.js";
12-
export * from "./uhc-duels.table.js";
1312
export * from "./titles.table.js";
13+
export * from "./bedwars-duels.table.js";

apps/discord-bot/src/commands/duels/tables/single-duels-game-mode.table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* https://github.com/Statsify/statsify/blob/main/LICENSE
77
*/
88

9+
import { BaseDuelsGameMode, PVPBaseDuelsGameMode, SingleDuelsGameMode, SinglePVPDuelsGameMode } from "@statsify/schemas";
910
import { Historical, If, Table } from "#components";
1011
import { LocalizeFunction } from "@statsify/discord";
11-
import { SingleDuelsGameMode, SinglePVPDuelsGameMode } from "@statsify/schemas";
1212
import type { ProfileTime } from "#commands/base.hypixel-command";
1313

1414
interface SingleDuelsGameModeTableProps {
15-
stats: SinglePVPDuelsGameMode | SingleDuelsGameMode;
15+
stats: SinglePVPDuelsGameMode | SingleDuelsGameMode | PVPBaseDuelsGameMode | BaseDuelsGameMode;
1616
t: LocalizeFunction;
1717
time: ProfileTime;
1818
}

apps/discord-bot/src/commands/duels/tables/titles.table.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ function ModeTitle({ icon, title, wins, t }: { icon: Image; title: string;wins:
3333

3434
export const TitlesTable = ({ duels, t, modeIcons }: TitlesTableProps) => {
3535
const games = [
36+
{ icon: modeIcons.bedwars, title: duels.bedwars.titleFormatted, wins: duels.bedwars.overall.wins },
3637
{ icon: modeIcons.blitzsg, title: duels.blitzsg.titleFormatted, wins: duels.blitzsg.wins },
3738
{ icon: modeIcons.bow, title: duels.bow.titleFormatted, wins: duels.bow.wins },
38-
{ icon: modeIcons.bowSpleef, title: duels.bowSpleef.titleFormatted, wins: duels.bowSpleef.wins },
39+
{ icon: modeIcons.spleef, title: duels.spleef.titleFormatted, wins: duels.spleef.overallWins },
3940
{ icon: modeIcons.boxing, title: duels.boxing.titleFormatted, wins: duels.boxing.wins },
4041
{ icon: modeIcons.bridge, title: duels.bridge.titleFormatted, wins: duels.bridge.overall.wins },
41-
{ icon: modeIcons.classic, title: duels.classic.titleFormatted, wins: duels.classic.wins },
42+
{ icon: modeIcons.classic, title: duels.classic.titleFormatted, wins: duels.classic.overall.wins },
4243
{ icon: modeIcons.combo, title: duels.combo.titleFormatted, wins: duels.combo.wins },
43-
{ icon: modeIcons.megawalls, title: duels.megawalls.titleFormatted, wins: duels.megawalls.overall.wins },
44+
{ icon: modeIcons.megawalls, title: duels.megawalls.titleFormatted, wins: duels.megawalls.wins },
4445
{ icon: modeIcons.nodebuff, title: duels.nodebuff.titleFormatted, wins: duels.nodebuff.wins },
4546
{ icon: modeIcons.op, title: duels.op.titleFormatted, wins: duels.op.overall.wins },
47+
{ icon: modeIcons.quake, title: duels.quake.titleFormatted, wins: duels.quake.wins },
4648
{ icon: modeIcons.parkour, title: duels.parkour.titleFormatted, wins: duels.parkour.wins },
4749
{ icon: modeIcons.skywars, title: duels.skywars.titleFormatted, wins: duels.skywars.overall.wins },
4850
{ icon: modeIcons.sumo, title: duels.sumo.titleFormatted, wins: duels.sumo.wins },

apps/discord-bot/src/commands/duels/tables/uhc-duels.table.tsx

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

apps/discord-bot/src/constants.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ export const mapBackground = <T extends GamesWithBackgrounds, M extends ApiModeF
158158
let map: string;
159159

160160
switch (mode) {
161-
case "bowSpleef":
162-
map = "bowspleef";
161+
case "bedwars":
162+
map = submode === "rush" ? "bedwars_rush" : "bedwars";
163+
break;
164+
165+
case "spleef":
166+
map = submode === "bowSpleef" ? "spleef_bowSpleef" : "spleef";
163167
break;
164168

165169
case "bridge":
@@ -182,6 +186,10 @@ export const mapBackground = <T extends GamesWithBackgrounds, M extends ApiModeF
182186
map = "parkour";
183187
break;
184188

189+
case "quake":
190+
map = "quake";
191+
break;
192+
185193
case "skywars":
186194
map = "skywars";
187195
break;

assets/private

locales/en-US/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@
670670
"humans-killed": "Humans Killed",
671671
"infectedWins": "Infected Wins",
672672
"iron": "Iron",
673+
"itemsPurchased": "Items Purchased",
673674
"karma": "Karma",
674675
"kdr": "KDR",
675676
"kicks": "Kicks",

0 commit comments

Comments
 (0)