Skip to content

Commit

Permalink
add powerups and powerorbs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobk999 committed Aug 18, 2024
1 parent ecd1aa1 commit 019e567
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
5 changes: 4 additions & 1 deletion apps/discord-bot/src/commands/tntgames/tntgames.profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const TNTGamesProfile = ({
const sidebar: SidebarItem[] = [
[t("stats.coins"), t(tntgames.coins), "§6"],
[t("stats.overallWins"), t(tntgames.wins), "§e"],
[t("stats.blocksRan"), t(tntgames.blocksRan), "§7"],
];

let table;
Expand All @@ -46,11 +45,13 @@ export const TNTGamesProfile = ({
<Table.td title={t("stats.wlr")} value={t(tntgames.tntRun.wlr)} color="§6" />
<Historical.include time={time}>
<Table.td title={t("stats.potionsSplashed")} value={t(tntgames.tntRun.potionsSplashed)} color="§5" />
<Table.td title={t("stats.blocksRan")} value={t(tntgames.tntRun.blocksRan)} color="§5" />
</Historical.include>
</Table.tr>
<Historical.exclude time={time}>
<Table.tr>
<Table.td title={t("stats.potionsSplashed")} value={t(tntgames.tntRun.potionsSplashed)} color="§5" />
<Table.td title={t("stats.blocksRan")} value={t(tntgames.tntRun.blocksRan)} color="§9" />
<Table.td title={t("stats.bestTime")} value={formatTime(tntgames.tntRun.record)} color="§e" />
</Table.tr>
</Historical.exclude>
Expand Down Expand Up @@ -99,6 +100,7 @@ export const TNTGamesProfile = ({
<Table.tr>
<Table.td title={t("stats.wins")} value={t(tntgames.tntTag.wins)} color="§a" />
<Table.td title={t("stats.tags")} value={t(tntgames.tntTag.tags)} color="§e" />
<Table.td title={t("stats.powerups")} value={t(tntgames.tntTag.powerups)} color="§b" />
</Table.tr>
</>
);
Expand All @@ -119,6 +121,7 @@ export const TNTGamesProfile = ({
<Table.td title={t("stats.wins")} value={t(tntgames.wizards.wins)} color="§a" />
<Table.td title={t("stats.points")} value={t(tntgames.wizards.points)} color="§e" />
<Table.td title={t("stats.airTime")} value={formatTime(tntgames.wizards.airTime)} color="§b" />
<Table.td title={t("stats.powerOrbs")} value={t(tntgames.wizards.powerOrbs)} color="§b" />
</Table.tr>
</>
);
Expand Down
7 changes: 3 additions & 4 deletions apps/discord-bot/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export const mapBackground = <T extends GamesWithBackgrounds>(
return mapBackground(SPEED_UHC_MODES, getDefaultApiMode(SPEED_UHC_MODES));

case "TNT_GAMES":
return mapBackground(TNT_GAMES_MODES, getDefaultApiMode(TNT_GAMES_MODES));
return ["tntgames", "overall"];

case "TURBO_KART_RACERS":
return mapBackground(
Expand All @@ -278,7 +278,7 @@ export const mapBackground = <T extends GamesWithBackgrounds>(
return mapBackground(WARLORDS_MODES, getDefaultApiMode(WARLORDS_MODES));

case "WOOLGAMES":
return mapBackground(WOOLGAMES_MODES, getDefaultApiMode(WOOLGAMES_MODES));
return ["woolgames", "overall"];
}

throw new Error(`Missing background for mode: ${mode}`);
Expand Down Expand Up @@ -322,8 +322,7 @@ export const mapBackground = <T extends GamesWithBackgrounds>(
return ["smashheroes", "overall"];

case TNT_GAMES_MODES:
// [TODO]: use custom backgrounds for each mode
return ["tntgames", "overall"];
return ["tntgames", mode];

case TURBO_KART_RACERS_MODES:
return ["turbokartracers", "overall"];
Expand Down
2 changes: 1 addition & 1 deletion assets/private
5 changes: 3 additions & 2 deletions locales/en-US/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,9 @@
"draws": "Draws",
"sheepThrown": "Sheep Thrown",
"airTime": "Air Time",
"potionsSplashed": "Potions Splashed"
"magicWool": "Magic Wool"
"potionsSplashed": "Potions Splashed",
"magicWool": "Magic Wool",
"powerOrbs": "Power Orbs"
},
"tips": {
"discord": "$t(emojis:socials.discord) Join our **$t(socials.discord)** and get **20% lower cooldowns** $t(emojis:heart)",
Expand Down
9 changes: 2 additions & 7 deletions packages/schemas/src/player/gamemodes/tntgames/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Field } from "#metadata";
import type { APIData } from "@statsify/util";

export const TNT_GAMES_MODES = new GameModes([
// { api: "overall" },
{ api: "pvpRun", hypixel: "PVPRUN", formatted: "PVP Run" },
{ api: "tntTag", hypixel: "TNTAG", formatted: "TNT Tag" },
{ api: "tntRun", hypixel: "TNTRUN", formatted: "TNT Run" },
Expand Down Expand Up @@ -44,9 +43,6 @@ export class TNTGames {
@Field()
public wins: number;

@Field()
public blocksRan: number;

@Field({
leaderboard: { fieldName: "TNT Run", extraDisplay: "this.tntRun.naturalPrefix" },
})
Expand All @@ -67,12 +63,11 @@ export class TNTGames {
public constructor(data: APIData, ap: APIData) {
this.coins = data.coins;
this.wins = data.wins;
this.blocksRan = ap.tntgames_block_runner;

this.tntRun = new TNTRun(data);
this.tntRun = new TNTRun(data, ap);
this.pvpRun = new PVPRun(data);
this.bowSpleef = new BowSpleef(data);
this.wizards = new Wizards(data);
this.wizards = new Wizards(data, ap);
this.tntTag = new TNTTag(data, ap);
}
}
Expand Down
16 changes: 14 additions & 2 deletions packages/schemas/src/player/gamemodes/tntgames/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export class TNTRun {
@Field()
public potionsSplashed: number;

@Field()
public blocksRan: number;

@Field()
public progression: Progression;

Expand All @@ -165,12 +168,13 @@ export class TNTRun {
@Field()
public nextPrefix: string;

public constructor(data: APIData) {
public constructor(data: APIData, ap: APIData) {
this.wins = data.wins_tntrun;
this.losses = data.deaths_tntrun;
this.wlr = ratio(this.wins, this.losses);
this.record = (data.record_tntrun ?? 0) * 1000;
this.potionsSplashed = data.run_potions_splashed_on_players;
this.blocksRan = ap?.tntgames_block_runner;

const score = this.wins ?? 0;

Expand Down Expand Up @@ -225,6 +229,9 @@ export class TNTTag {
@Field()
public tags: number;

@Field({ leaderboard: { name: "Power-Ups" } })
public powerups: number;

@Field()
public progression: Progression;

Expand All @@ -243,6 +250,7 @@ export class TNTTag {
this.deaths = data.deaths_tntag;
this.kdr = ratio(this.kills, this.deaths);
this.tags = ap?.tntgames_clinic;
this.powerups = ap?.tntgames_the_upper_hand;

const score = this.wins ?? 0;

Expand Down Expand Up @@ -312,6 +320,9 @@ export class Wizards {
@Field({ leaderboard: { formatter: formatTime } })
public airTime: number;

@Field()
public powerOrbs: number;

@Field()
public progression: Progression;

Expand Down Expand Up @@ -351,7 +362,7 @@ export class Wizards {
@Field()
public arcaneWizard: WizardsClass;

public constructor(data: APIData) {
public constructor(data: APIData, ap: APIData) {
this.class = data.wizards_selected_class ?? "none";
// Hypixel doesn't capitalize the word "Wizard" so the class name cant't be pretty printed
this.class = this.class.replace("new_", "").replace("wizard", "Wizard");
Expand All @@ -363,6 +374,7 @@ export class Wizards {
this.assists = data.assists_capture;
this.points = data.points_capture;
this.airTime = data.air_time_capture;
this.powerOrbs = ap?.tntgames_power_hungry;

const score = this.wins ?? 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class WoolWarsClass {
@Field()
public assists: number;

@Field()
@Field({ leaderboard: { name: "Power-Ups" } })
public powerups: number;

@Field({ leaderboard: { additionalFields: ["this.woolPlaced"] } })
Expand Down

0 comments on commit 019e567

Please sign in to comment.