Skip to content

Commit

Permalink
Test work hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
YoctoProductions committed Dec 27, 2024
1 parent c02a0cf commit e0dfc67
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions api/src/accounts/accounts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,23 @@ export class AccountsService {

// Check if the user has enough gems
const skinPrice = cosmetic.price;
if (user.gems < skinPrice) {
return { error: 'Not enough gems' };
if (cosmetic.ultimate) {
if (user.ultimacy < skinPrice) {
return { error: 'Not enough ultimacy' };
}
} else {
if (user.gems < skinPrice) {
return { error: 'Not enough gems' };
}
}

// Update the 'owned' field
skinsData.owned.push(itemId);

// Deduct the gems from the user's account
user.gems -= skinPrice;
if (!cosmetic.ultimate) {
user.gems -= skinPrice;
}

// Save the updated skins data and gems back to the user's account
user.skins = skinsData;
Expand Down

0 comments on commit e0dfc67

Please sign in to comment.