Fixed things and added tokens finally
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { object } from "zod"
|
||||
import { Guild } from "../schema/guild"
|
||||
|
||||
export function getGuildMember(guild: Guild["guild"], uuid: string) {
|
||||
|
||||
@@ -20,11 +20,15 @@ export function getTotalCoins(stats: Record<string, Record<"coins", number | und
|
||||
}
|
||||
|
||||
export function getTotalQuests(quests: Player["player"]["quests"]) {
|
||||
if (!quests) return 0
|
||||
|
||||
return Object.values(quests).reduce((total, quest) => total + (quest.completions?.length || 0), 0)
|
||||
}
|
||||
|
||||
export function getTotalChallenges(challenges: Player["player"]["challenges"]["all_time"]) {
|
||||
return Object.values(challenges).reduce((total, challenge) => total + challenge, 0)
|
||||
export function getTotalChallenges(challenges: Player["player"]["challenges"]) {
|
||||
if (!challenges?.all_time) return 0
|
||||
|
||||
return Object.values(challenges.all_time).reduce((total, challenge) => total + challenge, 0)
|
||||
}
|
||||
|
||||
export function rewardClaimed(claimedAt?: number) {
|
||||
@@ -39,4 +43,3 @@ export function rewardClaimed(claimedAt?: number) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import z from "zod"
|
||||
|
||||
export const playerSchema = z.looseObject({
|
||||
player: z.looseObject({
|
||||
displayname: z.string().optional(),
|
||||
uuid: z.string().optional(),
|
||||
displayname: z.string(),
|
||||
uuid: z.string(),
|
||||
newPackageRank: z.string().optional(),
|
||||
monthlyPackageRank: z.string().optional(),
|
||||
rankPlusColor: z.string().optional(),
|
||||
@@ -14,6 +14,7 @@ export const playerSchema = z.looseObject({
|
||||
stats: z.looseObject({
|
||||
Bedwars: z.looseObject({
|
||||
Experience: z.number().default(0),
|
||||
coins: z.number().default(0),
|
||||
winstreak: z.number().optional(),
|
||||
kills_bedwars: z.number().default(0),
|
||||
deaths_bedwars: z.number().default(0),
|
||||
@@ -31,9 +32,9 @@ export const playerSchema = z.looseObject({
|
||||
completions: z.array(
|
||||
z.looseObject({
|
||||
time: z.number()
|
||||
}).optional()
|
||||
})
|
||||
).optional()
|
||||
}).optional()
|
||||
})
|
||||
).optional(),
|
||||
challenges: z.looseObject({
|
||||
all_time: z.record(z.string(), z.number())
|
||||
|
||||
Reference in New Issue
Block a user