added new logic to the new rewards
This commit is contained in:
+37
-9
@@ -12,7 +12,8 @@ const {
|
||||
} = require("./cookieEconomy");
|
||||
|
||||
const {
|
||||
recordGameOutcome
|
||||
recordGameOutcome,
|
||||
trackProfileEvent
|
||||
} = require("./profileSystem");
|
||||
|
||||
const ROULETTE_BETS = [
|
||||
@@ -206,7 +207,10 @@ async function startRouletteAllIn(
|
||||
async function showRouletteChoices(
|
||||
interaction,
|
||||
bet,
|
||||
allIn = false
|
||||
requestedAllIn = false,
|
||||
source = "normal",
|
||||
previousAllIn = false,
|
||||
previousBet = 0
|
||||
) {
|
||||
if (
|
||||
!Number.isSafeInteger(bet) ||
|
||||
@@ -262,7 +266,7 @@ async function showRouletteChoices(
|
||||
})
|
||||
.setFooter({
|
||||
text:
|
||||
`crumbRouletteBet:${interaction.user.id}:${bet}:${allIn ? 1 : 0}`
|
||||
`crumbRouletteBet:${interaction.user.id}:${bet}:${requestedAllIn ? 1 : 0}:${source}:${previousAllIn ? 1 : 0}:${previousBet}`
|
||||
});
|
||||
|
||||
return interaction.update({
|
||||
@@ -303,6 +307,9 @@ async function runRouletteBack(
|
||||
const bet =
|
||||
Number(parts[2]);
|
||||
|
||||
const previousAllIn =
|
||||
parts[3] === "1";
|
||||
|
||||
if (
|
||||
ownerId !==
|
||||
interaction.user.id
|
||||
@@ -383,8 +390,14 @@ async function playRoulette(
|
||||
const bet =
|
||||
Number(parts[2]);
|
||||
|
||||
const allIn =
|
||||
parts[3] === "1";
|
||||
const source =
|
||||
parts[4] || "normal";
|
||||
|
||||
const previousAllIn =
|
||||
parts[5] === "1";
|
||||
|
||||
const previousBet =
|
||||
Number(parts[6] ?? 0);
|
||||
|
||||
if (
|
||||
ownerId !==
|
||||
@@ -476,6 +489,23 @@ async function playRoulette(
|
||||
throw error;
|
||||
}
|
||||
|
||||
const allIn =
|
||||
bet === playerBalance;
|
||||
|
||||
await trackProfileEvent(
|
||||
interaction,
|
||||
playerId,
|
||||
{
|
||||
type: "game_start",
|
||||
game: "roulette",
|
||||
source,
|
||||
bet,
|
||||
allIn,
|
||||
previousAllIn,
|
||||
previousBet
|
||||
}
|
||||
);
|
||||
|
||||
await interaction.update({
|
||||
embeds: [
|
||||
buildSpinEmbed(
|
||||
@@ -594,9 +624,7 @@ async function playRoulette(
|
||||
won &&
|
||||
choiceKey ===
|
||||
"Zero",
|
||||
allIn:
|
||||
won &&
|
||||
allIn
|
||||
allIn
|
||||
}
|
||||
);
|
||||
|
||||
@@ -664,7 +692,7 @@ async function playRoulette(
|
||||
)
|
||||
.setFooter({
|
||||
text:
|
||||
`crumbRouletteResult:${playerId}:${bet}`
|
||||
`crumbRouletteResult:${playerId}:${bet}:${allIn ? 1 : 0}`
|
||||
});
|
||||
|
||||
return interaction.editReply({
|
||||
|
||||
Reference in New Issue
Block a user