diff --git a/commands/applications/cookies.js b/commands/applications/cookies.js index 4dc093f..b8b6ad4 100644 --- a/commands/applications/cookies.js +++ b/commands/applications/cookies.js @@ -447,56 +447,59 @@ async function steal(interaction) { * Thief stats. */ - await trackProfileEvent( - interaction, - user.id, - { - type: - "steal_success", - amount, - targetUserId: - target.id - } - ); +await trackProfileEvent( + interaction, + user.id, + { + type: "steal_success", + source: "steal", + amount, + targetUserId: + target.id + } +); - await trackProfileEvent( - interaction, - user.id, - { - type: - "cookie_gain", - amount - } - ); +await trackProfileEvent( + interaction, + user.id, + { + type: "cookie_gain", + source: "steal", + amount, + targetUserId: + target.id + } +); /* * Victim stats. */ - await trackProfileEvent( - interaction, - target.id, - { - type: - "stolen_from_me", - amount, - thiefUserId: - user.id - } - ); +await trackProfileEvent( + interaction, + target.id, + { + type: "stolen_from_me", + source: "steal", + amount, + thiefUserId: + user.id + } +); - - await trackProfileEvent( - interaction, - target.id, - { - type: - "cookie_loss", - amount - } - ); +await trackProfileEvent( + interaction, + target.id, + { + type: "cookie_loss", + source: "steal", + amount, + thiefUserId: + user.id + } +); const [ @@ -653,28 +656,32 @@ async function steal(interaction) { * Profile tracking. */ - await trackProfileEvent( - interaction, - user.id, - { - type: - "cookie_loss", - amount: - penalty - } - ); +await trackProfileEvent( + interaction, + user.id, + { + type: "cookie_loss", + source: "steal_penalty", + amount: + penalty, + targetUserId: + target.id + } +); - await trackProfileEvent( - interaction, - target.id, - { - type: - "cookie_gain", - amount: - penalty - } - ); +await trackProfileEvent( + interaction, + target.id, + { + type: "cookie_gain", + source: "steal_penalty", + amount: + penalty, + thiefUserId: + user.id + } +); const [ @@ -902,30 +909,34 @@ async function give(interaction) { * Sender lifetime giving. */ - await trackProfileEvent( - interaction, - user.id, - { - type: - "cookies_given", - amount - } - ); +await trackProfileEvent( + interaction, + user.id, + { + type: "cookies_given", + source: "give", + amount, + targetUserId: + target.id + } +); /* * Recipient lifetime gain. */ - await trackProfileEvent( - interaction, - target.id, - { - type: - "cookie_gain", - amount - } - ); +await trackProfileEvent( + interaction, + target.id, + { + type: "cookie_gain", + source: "give", + amount, + senderUserId: + user.id + } +); const [ diff --git a/utils/bankruptcy.js b/utils/bankruptcy.js index 97b90fe..4481f01 100644 --- a/utils/bankruptcy.js +++ b/utils/bankruptcy.js @@ -161,14 +161,16 @@ async function declareBankruptcy(interaction, userId = interaction.user.id) { }; } - await trackProfileEvent( - interaction, - userId, - { - type: "cookie_gain", - amount: BANKRUPTCY_GRANT - } - ); +await trackProfileEvent( + interaction, + userId, + { + type: "cookie_gain", + source: "bankruptcy", + amount: + BANKRUPTCY_GRANT + } +); return { ok: true, diff --git a/utils/cookieHeist.js b/utils/cookieHeist.js index 7f058df..c758465 100644 --- a/utils/cookieHeist.js +++ b/utils/cookieHeist.js @@ -72,7 +72,7 @@ async function resolveCookieHeist( if ( type !== "cookieHeist" || ownerId !== - interaction.user.id + interaction.user.id ) { return temporaryEphemeralReply( interaction, @@ -85,7 +85,7 @@ async function resolveCookieHeist( const method = HEIST_METHODS[ - methodName + methodName ]; if (!method) { @@ -269,17 +269,24 @@ async function resolveCookieHeist( } ); + /* + * ============================================================ + * HEIST + * ============================================================ + */ + await trackProfileEvent( interaction, playerId, { - type: - "vault_steal", + type: "vault_steal", + source: "heist", + game: "heist", + result: "win", amount } ); - const [ playerAfter, vaultAfter diff --git a/utils/crumbBlackjack.js b/utils/crumbBlackjack.js index 92ca855..8097322 100644 --- a/utils/crumbBlackjack.js +++ b/utils/crumbBlackjack.js @@ -304,6 +304,7 @@ async function startBlackjack( game: "blackjack", source, bet, + wager: bet, allIn, previousAllIn, previousBet @@ -1328,9 +1329,9 @@ function shuffleDeck( deck[i], deck[j] ] = [ - deck[j], - deck[i] - ]; + deck[j], + deck[i] + ]; } } diff --git a/utils/crumbCollect.js b/utils/crumbCollect.js index ea17c73..113f27e 100644 --- a/utils/crumbCollect.js +++ b/utils/crumbCollect.js @@ -87,14 +87,15 @@ async function collectCookies( ); - await trackProfileEvent( - interaction, - userId, - { - type: "cookie_gain", - amount - } - ); +await trackProfileEvent( + interaction, + userId, + { + type: "cookie_gain", + source: "collect", + amount + } +); const balance = await getCookieBalance( diff --git a/utils/crumbRoulette.js b/utils/crumbRoulette.js index e4ba23c..469c6ee 100644 --- a/utils/crumbRoulette.js +++ b/utils/crumbRoulette.js @@ -495,19 +495,20 @@ async function playRoulette( const allIn = bet === playerBalance; - await trackProfileEvent( - interaction, - playerId, - { - type: "game_start", - game: "roulette", - source, - bet, - allIn, - previousAllIn, - previousBet - } - ); +await trackProfileEvent( + interaction, + playerId, + { + type: "game_start", + game: "roulette", + source, + bet, + wager: bet, + allIn, + previousAllIn, + previousBet + } +); await interaction.update({ embeds: [ diff --git a/utils/crumbSlots.js b/utils/crumbSlots.js index fa17bb3..228503e 100644 --- a/utils/crumbSlots.js +++ b/utils/crumbSlots.js @@ -199,16 +199,21 @@ async function playSlots( throw error; } - await trackProfileEvent( - interaction, - playerId, - { - type: "game_start", - game: "slots", - source, - bet - } - ); +await trackProfileEvent( + interaction, + playerId, + { + type: "game_start", + game: "slots", + source, + bet, + wager: bet, + allIn: + bet === playerBalance, + previousAllIn, + previousBet + } +); await interaction.update({ embeds: [