profile update with badges and achievements
This commit is contained in:
+88
-2
@@ -17,6 +17,10 @@ const {
|
||||
getUnixTime
|
||||
} = require("./cookieEconomy");
|
||||
|
||||
const {
|
||||
trackProfileEvent
|
||||
} = require("./profileSystem");
|
||||
|
||||
|
||||
/*
|
||||
* ============================================================
|
||||
@@ -1277,7 +1281,7 @@ async function finishBlackjack(
|
||||
|
||||
.setFooter({
|
||||
text:
|
||||
`crumbBlackjackResult:${game.userId}:${game.bet}`
|
||||
`crumbBlackjackResult:${game.userId}:${game.originalBet ?? game.bet}`
|
||||
})
|
||||
],
|
||||
|
||||
@@ -1350,6 +1354,88 @@ async function finishBlackjack(
|
||||
game.bet;
|
||||
|
||||
|
||||
let profileResult;
|
||||
|
||||
if (
|
||||
result ===
|
||||
"Push"
|
||||
) {
|
||||
profileResult =
|
||||
"push";
|
||||
}
|
||||
|
||||
else if (
|
||||
[
|
||||
"Win",
|
||||
"DealerBust",
|
||||
"Blackjack"
|
||||
].includes(
|
||||
result
|
||||
)
|
||||
) {
|
||||
profileResult =
|
||||
"win";
|
||||
}
|
||||
|
||||
else {
|
||||
profileResult =
|
||||
"loss";
|
||||
}
|
||||
|
||||
|
||||
await trackProfileEvent(
|
||||
interaction,
|
||||
game.userId,
|
||||
{
|
||||
type:
|
||||
"game_result",
|
||||
|
||||
game:
|
||||
"blackjack",
|
||||
|
||||
result:
|
||||
profileResult
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
if (
|
||||
profit >
|
||||
0
|
||||
) {
|
||||
await trackProfileEvent(
|
||||
interaction,
|
||||
game.userId,
|
||||
{
|
||||
type:
|
||||
"cookie_gain",
|
||||
|
||||
amount:
|
||||
profit
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
else if (
|
||||
profit <
|
||||
0
|
||||
) {
|
||||
await trackProfileEvent(
|
||||
interaction,
|
||||
game.userId,
|
||||
{
|
||||
type:
|
||||
"cookie_loss",
|
||||
|
||||
amount:
|
||||
Math.abs(
|
||||
profit
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const description = [
|
||||
"**Dealer**",
|
||||
formatCards(
|
||||
@@ -1439,7 +1525,7 @@ async function finishBlackjack(
|
||||
|
||||
.setFooter({
|
||||
text:
|
||||
`crumbBlackjackResult:${game.userId}:${game.bet}`
|
||||
`crumbBlackjackResult:${game.userId}:${game.originalBet ?? game.bet}`
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user