XP Calculation will be done client sided
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
export const calculateXP = (
|
|
||||||
normalBerries: bigint,
|
|
||||||
poisonBerries: bigint,
|
|
||||||
slowBerries: bigint,
|
|
||||||
ultraBerries: bigint,
|
|
||||||
speedyBerries: bigint,
|
|
||||||
coinBerries: bigint
|
|
||||||
): bigint => {
|
|
||||||
let totalXp: bigint = 0n
|
|
||||||
|
|
||||||
totalXp += normalBerries
|
|
||||||
totalXp -= poisonBerries
|
|
||||||
totalXp -= slowBerries
|
|
||||||
totalXp += ultraBerries * 5n
|
|
||||||
totalXp += speedyBerries * 10n
|
|
||||||
totalXp += coinBerries * 10n
|
|
||||||
|
|
||||||
if (totalXp < 0n) totalXp = 0n
|
|
||||||
return totalXp
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
} from '../../../lib/util'
|
} from '../../../lib/util'
|
||||||
import { berryDashUserData, users } from '../../../lib/tables'
|
import { berryDashUserData, users } from '../../../lib/tables'
|
||||||
import { eq, sql } from 'drizzle-orm'
|
import { eq, sql } from 'drizzle-orm'
|
||||||
import { calculateXP } from '../../../lib/bd'
|
|
||||||
|
|
||||||
export const handler = async (context: Context) => {
|
export const handler = async (context: Context) => {
|
||||||
const dbInfo0 = getDatabaseConnection(0)
|
const dbInfo0 = getDatabaseConnection(0)
|
||||||
@@ -77,14 +76,6 @@ export const handler = async (context: Context) => {
|
|||||||
totalAntiBerries: BigInt(
|
totalAntiBerries: BigInt(
|
||||||
savedata?.gameStore?.totalAntiBerries ?? 0
|
savedata?.gameStore?.totalAntiBerries ?? 0
|
||||||
).toString(),
|
).toString(),
|
||||||
xp: calculateXP(
|
|
||||||
BigInt(savedata?.gameStore?.totalNormalBerries ?? 0),
|
|
||||||
BigInt(savedata?.gameStore?.totalPoisonBerries ?? 0),
|
|
||||||
BigInt(savedata?.gameStore?.totalSlowBerries ?? 0),
|
|
||||||
BigInt(savedata?.gameStore?.totalUltraBerries ?? 0),
|
|
||||||
BigInt(savedata?.gameStore?.totalSpeedyBerries ?? 0),
|
|
||||||
BigInt(savedata?.gameStore?.totalCoinBerries ?? 0)
|
|
||||||
).toString(),
|
|
||||||
coins: BigInt(savedata?.bird?.customIcon?.balance ?? 0).toString()
|
coins: BigInt(savedata?.bird?.customIcon?.balance ?? 0).toString()
|
||||||
}
|
}
|
||||||
return row
|
return row
|
||||||
|
|||||||
Reference in New Issue
Block a user