Skip to content

Commit 26125f2

Browse files
authored
feat: add new duels titles (#769)
1 parent d2d02b8 commit 26125f2

File tree

7 files changed

+359
-244
lines changed

7 files changed

+359
-244
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "./tables/index.js";
1616
import { Container, Footer, Header, SidebarItem, formatProgression } from "#components";
1717
import { DuelsModes, FormattedGame, type GameMode } from "@statsify/schemas";
18-
import { prettify } from "@statsify/util";
18+
import { formatTime, prettify } from "@statsify/util";
1919
import type { BaseProfileProps, ProfileTime } from "#commands/base.hypixel-command";
2020
import type { DuelsModeIcons } from "./duels.command.js";
2121

@@ -59,6 +59,13 @@ export const DuelsProfile = <T extends ProfileTime>({
5959
if ("kit" in stats)
6060
sidebar.push([t("stats.kit"), prettify(stats.kit), "§e"]);
6161

62+
if (mode.api === "parkour") {
63+
sidebar.push(
64+
[t("stats.bestTime"), duels.parkour.bestTime === 0 ? "N/A" : formatTime(duels.parkour.bestTime), "§d"],
65+
[t("stats.checkpoints"), t(duels.parkour.checkpoints), "§5"]
66+
);
67+
}
68+
6269
const isTitles = time === "LIVE" && mode.api === "overall" && mode.submode.api === "titles";
6370

6471
let table: JSX.Element;

locales/en-US/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@
585585
"bronzeTrophies": "Bronze Trophies",
586586
"candyFound": "Candy Found",
587587
"challenges": "Challenges",
588+
"checkpoints": "Checkpoints",
588589
"class": "Class",
589590
"coins": "Coins",
590591
"contracts": "Contracts",

packages/schemas/src/player/gamemodes/duels/index.ts

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ import {
1212
BlitzSGDuels,
1313
BridgeDuels,
1414
MultiPVPDuelsGameMode,
15+
PVPBaseDuelsGameMode,
16+
ParkourDuels,
1517
QuakeDuels,
1618
SingleBowPVPDuelsGameMode,
17-
SingleDuelsGameMode,
1819
SinglePVPDuelsGameMode,
1920
SkyWarsDuels,
2021
SpleefDuels,
2122
UHCDuels,
2223
} from "./mode.js";
2324
import { type ExtractGameModes, GameModes } from "#game";
2425
import { Field } from "#metadata";
26+
import { add } from "@statsify/math";
2527
import type { APIData } from "@statsify/util";
2628

2729
export const DUELS_MODES = new GameModes([
@@ -33,11 +35,14 @@ export const DUELS_MODES = new GameModes([
3335
],
3436
},
3537
{ api: "arena", hypixel: "DUELS_DUEL_ARENA" },
36-
{ api: "bedwars", formatted: "BedWars", submodes: [
37-
{ api: "overall" },
38-
{ api: "bedwars", formatted: "BedWars Duel" },
39-
{ api: "rush", formatted: "Bed Rush" },
40-
],
38+
{
39+
api: "bedwars",
40+
formatted: "BedWars",
41+
submodes: [
42+
{ api: "overall" },
43+
{ api: "bedwars", formatted: "BedWars Duel" },
44+
{ api: "rush", formatted: "Bed Rush" },
45+
],
4146
},
4247
{ api: "blitzsg", hypixel: "DUELS_BLITZ_DUEL", formatted: "BlitzSG" },
4348
{ api: "bow", hypixel: "DUELS_BOW_DUEL" },
@@ -57,22 +62,28 @@ export const DUELS_MODES = new GameModes([
5762
{ api: "megawalls", formatted: "MegaWalls" },
5863
{ api: "nodebuff", hypixel: "DUELS_POTION_DUEL", formatted: "NoDebuff" },
5964
{ api: "op", formatted: "OP" },
60-
{ api: "quake" },
65+
{ api: "quake", hypixel: "DUELS_QUAKE_DUEL" },
6166
{ api: "parkour", hypixel: "DUELS_PARKOUR_EIGHT" },
6267
{ api: "skywars", formatted: "SkyWars" },
63-
{ api: "spleef", submodes: [
64-
{ api: "spleef" },
65-
{ api: "bowSpleef" },
66-
] },
68+
{
69+
api: "spleef",
70+
submodes: [
71+
{ api: "spleef" },
72+
{ api: "bowSpleef" },
73+
],
74+
},
6775
{ api: "sumo", hypixel: "DUELS_SUMO_DUEL" },
68-
{ api: "uhc", formatted: "UHC", submodes: [
69-
{ api: "overall" },
70-
{ api: "solo" },
71-
{ api: "doubles" },
72-
{ api: "fours" },
73-
{ api: "deathmatch" },
74-
] },
75-
76+
{
77+
api: "uhc",
78+
formatted: "UHC",
79+
submodes: [
80+
{ api: "overall" },
81+
{ api: "solo" },
82+
{ api: "doubles" },
83+
{ api: "fours" },
84+
{ api: "deathmatch" },
85+
],
86+
},
7687
{ hypixel: "DUELS_MW_DUEL", formatted: "MegaWalls Solo" },
7788
{ hypixel: "DUELS_MW_DOUBLES", formatted: "MegaWalls Doubles" },
7889
{ hypixel: "DUELS_UHC_DUEL", formatted: "UHC Solo" },
@@ -157,7 +168,7 @@ export class Duels {
157168
public op: MultiPVPDuelsGameMode;
158169

159170
@Field({ leaderboard: { extraDisplay: "this.parkour.titleFormatted" } })
160-
public parkour: SingleDuelsGameMode;
171+
public parkour: ParkourDuels;
161172

162173
@Field({ leaderboard: { extraDisplay: "this.quake.titleFormatted" } })
163174
public quake: QuakeDuels;
@@ -200,11 +211,21 @@ export class Duels {
200211
this.bridge = new BridgeDuels(data);
201212
this.classic = new MultiPVPDuelsGameMode(data, "Classic", "classic", "classic");
202213
this.combo = new SinglePVPDuelsGameMode(data, "Combo", "combo_duel");
214+
215+
// Add removed doubles stats
203216
this.megawalls = new SinglePVPDuelsGameMode(data, "MW", "mw_duel");
217+
const megawallsDoubles = new PVPBaseDuelsGameMode(data, "mw_doubles");
218+
this.megawalls.wins = add(this.megawalls.wins, megawallsDoubles.wins);
219+
this.megawalls.losses = add(this.megawalls.losses, megawallsDoubles.losses);
220+
this.megawalls.kills = add(this.megawalls.kills, megawallsDoubles.kills);
221+
this.megawalls.deaths = add(this.megawalls.deaths, megawallsDoubles.wins);
222+
this.megawalls.blocksPlaced = add(this.megawalls.blocksPlaced, megawallsDoubles.blocksPlaced);
223+
PVPBaseDuelsGameMode.applyRatios(this.megawalls);
224+
204225
this.nodebuff = new SinglePVPDuelsGameMode(data, "NoDebuff", "potion_duel");
205226
this.op = new MultiPVPDuelsGameMode(data, "OP", "op", "op");
206227

207-
this.parkour = new SingleDuelsGameMode(data, "Parkour", "parkour_eight");
228+
this.parkour = new ParkourDuels(data);
208229
this.quake = new QuakeDuels(data);
209230
this.skywars = new SkyWarsDuels(data);
210231
this.spleef = new SpleefDuels(data);

0 commit comments

Comments
 (0)