feat(slots): add slot machine component with styling and logic #170

Merged
jleibl merged 9 commits from task/CAS-44/lootbox-selection into main 2025-05-07 16:10:05 +00:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit a3f34e960b - Show all commits

View file

@ -54,12 +54,13 @@ public class SlotService {
SpinResult spinResult = new SpinResult();
spinResult.setStatus(status.name().toLowerCase());
this.balanceService.subtractFunds(user, betAmount);
if (status == Status.WIN) {
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
this.balanceService.addFunds(user, winAmount);
spinResult.setAmount(winAmount);
} else {
this.balanceService.subtractFunds(user, betAmount);
spinResult.setAmount(betAmount);
}

View file

@ -109,17 +109,20 @@ export default class SlotsComponent implements OnInit, OnDestroy {
next: (result) => {
setTimeout(() => {
this.slotResult.set(result);
if (result.status === 'win') {
this.userService.updateLocalBalance(result.amount);
}
this.userService.refreshCurrentUser();
this.isSpinning = false;
}, 1500);
},
error: (err) => {
console.error('Error spinning slot machine:', err);
this.userService.updateLocalBalance(betAmount);
this.userService.refreshCurrentUser();
this.isSpinning = false;
},
});