fix: correct blackjack PnL calculation and enhance UI
Some checks failed
Deploy to Production / test (push) Failing after 35s
Some checks failed
Deploy to Production / test (push) Failing after 35s
- Fix incorrect PnL calculations where multipliers were treated as amounts - Add proper net profit calculation: (multiplier × bet) - bet - Update UI with gradient backgrounds, icons, and improved animations - Add slide-in and pulse-slow keyframe animations - Enhance dealer area with status-based styling - Improve action buttons with colored gradients and hover effects - Revise round result banner with better visual hierarchy
This commit is contained in:
@@ -95,13 +95,14 @@ export class GameServer {
|
||||
const gameName = gameRegistry.get(room.gameSlug)?.name ?? "Game";
|
||||
const payoutDetails: Record<string, { net: number }> = {};
|
||||
|
||||
for (const [playerId, grossPayout] of Object.entries(roundPayouts)) {
|
||||
// roundPayout is already the gross payout amount (not a multiplier)
|
||||
const netProfit = Math.floor(grossPayout) - betAmount; // Calculate net profit (gross payout minus original bet)
|
||||
for (const [playerId, multiplier] of Object.entries(roundPayouts)) {
|
||||
// roundPayout contains multipliers (e.g., win=2, blackjack=2.5, push=1)
|
||||
const grossAmount = Math.floor(betAmount * multiplier);
|
||||
const netProfit = grossAmount - betAmount;
|
||||
try {
|
||||
await economyService.modifyUserBalance(
|
||||
playerId,
|
||||
BigInt(grossPayout),
|
||||
BigInt(grossAmount),
|
||||
TransactionType.GAME_WIN,
|
||||
`${gameName} round payout (room ${roomId.slice(0, 8)})`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user