Fixing formatting

This commit is contained in:
2024-01-21 00:03:19 +01:00
parent 614feeff3e
commit 9ec53882d1
15 changed files with 138 additions and 277 deletions

View File

@@ -8,7 +8,7 @@ const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/"
const hypixel = "https://api.hypixel.net/player"
const guild = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/"
type GuildQuerqType = "player" | "name" | "id"
type GuildQueryType = "player" | "name" | "id"
type Profile = {
data: {
@@ -47,8 +47,10 @@ async function getIGN(uuid: string): Promise<string | null> {
async function getPlayer(uuid: string): Promise<PlayerData | null> {
const playerReq: Player = await fetch(hypixel, {
params: {
key: apikey,
uuid: uuid
},
headers: {
"API-Key": apikey
}
})
@@ -59,16 +61,15 @@ async function getPlayer(uuid: string): Promise<PlayerData | null> {
return playerReq.data.player
}
async function getGuild(
query: string,
type?: GuildQuerqType
): Promise<GuildData | null> {
async function getGuild(query: string, type?: GuildQueryType): Promise<GuildData | null> {
const reqType = type ? type : "player"
const guildReq: Guild = await fetch(guild, {
params: {
key: apikey,
[reqType]: query
},
headers: {
"API-Key": apikey
}
})

View File

@@ -38,10 +38,8 @@ function guildLevel(exp: number): number {
*/
function scaledGEXP(input: number): number {
if (input <= 200000) return Number(input)
if (input <= 700000)
return Number(Math.round((input - 200000) / 10 + 200000))
if (input > 700000)
return Number(Math.round((input - 700000) / 33 + 250000))
if (input <= 700000) return Number(Math.round((input - 200000) / 10 + 200000))
if (input > 700000) return Number(Math.round((input - 700000) / 33 + 250000))
return 0
}