Skip to content

Commit

Permalink
Use ultimacy calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
YoctoProductions committed Dec 26, 2024
1 parent e2d0635 commit 155d8f0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
16 changes: 12 additions & 4 deletions client/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,18 @@ export function addCommas(num: number) {

export function calculateGemsXP(coins: number, kills: number) {
const xp = Math.floor(coins / 20) + kills
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: 1000
if (coins >= 1250000) {
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: Math.floor((coins ** 1.3 / 3200) * 2),
};
} else {
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: Math.floor((coins ** 2.5 / 10 ** 11) * 3),
};
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/GlobalLeaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function LeaderboardCard({ type, row, index }: { type: string, row: any, index:
</>) : (
<h5 className="mb-0">
{type === 'xp' && numberWithCommas(row.xp) + ' XP'}
{type === 'ultimacy' && numberWithCommas(row.ultimacy) + ' Ultimacy'}
{type === 'ultimacy' && numberWithCommas(row.ultimacy) + ' ultimacy'}
{type === 'total-coins' && numberWithCommas(row.coins) + ' coins'}
{type === 'total-kills' && numberWithCommas(row.kills) + ' stabs'}
{type === 'total-playtime' && secondsToTime(row.playtime) + ' played'}
Expand Down
16 changes: 12 additions & 4 deletions server/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ module.exports = {

calculateGemsXP(coins, kills) {
const xp = Math.floor(coins / 20) + kills
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: 1000
if (coins >= 1250000) {
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: Math.floor((coins ** 1.3 / 3200) * 2),
};
} else {
return {
xp,
gems: Math.floor(xp / 5),
ultimacy: Math.floor((coins ** 2.5 / 10 ** 11) * 3),
};
}
},

Expand Down

0 comments on commit 155d8f0

Please sign in to comment.