@maktubbet/sdk 3.2.24 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/crash/index.cjs +53 -14
- package/dist/crash/index.cjs.map +1 -1
- package/dist/crash/index.js +53 -14
- package/dist/crash/index.js.map +1 -1
- package/dist/index.cjs +53 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -14
- package/dist/index.js.map +1 -1
- package/dist/vanilla.global.js +53 -14
- package/dist/vanilla.global.js.map +1 -1
- package/dist/vanilla.js +53 -14
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/crash/index.cjs
CHANGED
|
@@ -16751,6 +16751,39 @@ function useCrashSocket({ enabled, accessToken, onMessage }) {
|
|
|
16751
16751
|
|
|
16752
16752
|
// src/crash/components/CrashGameInner.tsx
|
|
16753
16753
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
16754
|
+
var SS_ROUND_KEY = "__maktub_crash_round";
|
|
16755
|
+
var SS_BET_KEY = "__maktub_crash_bet_round";
|
|
16756
|
+
var SS_CASHOUT_KEY = "__maktub_crash_cashout_round";
|
|
16757
|
+
function getCurrentRoundId() {
|
|
16758
|
+
try {
|
|
16759
|
+
return sessionStorage.getItem(SS_ROUND_KEY);
|
|
16760
|
+
} catch {
|
|
16761
|
+
return null;
|
|
16762
|
+
}
|
|
16763
|
+
}
|
|
16764
|
+
function setCurrentRoundId(roundId) {
|
|
16765
|
+
try {
|
|
16766
|
+
sessionStorage.setItem(SS_ROUND_KEY, roundId);
|
|
16767
|
+
} catch {
|
|
16768
|
+
}
|
|
16769
|
+
}
|
|
16770
|
+
function wasProcessed(key) {
|
|
16771
|
+
const roundId = getCurrentRoundId();
|
|
16772
|
+
if (!roundId) return false;
|
|
16773
|
+
try {
|
|
16774
|
+
return sessionStorage.getItem(key) === roundId;
|
|
16775
|
+
} catch {
|
|
16776
|
+
return false;
|
|
16777
|
+
}
|
|
16778
|
+
}
|
|
16779
|
+
function markProcessed(key) {
|
|
16780
|
+
const roundId = getCurrentRoundId();
|
|
16781
|
+
if (!roundId) return;
|
|
16782
|
+
try {
|
|
16783
|
+
sessionStorage.setItem(key, roundId);
|
|
16784
|
+
} catch {
|
|
16785
|
+
}
|
|
16786
|
+
}
|
|
16754
16787
|
var GROWTH_SPEED = 6e-5;
|
|
16755
16788
|
function CrashGame({ userName }) {
|
|
16756
16789
|
const betSound2 = useSoundEffect(bet_default);
|
|
@@ -16809,6 +16842,9 @@ function CrashGame({ userName }) {
|
|
|
16809
16842
|
switch (msg.type) {
|
|
16810
16843
|
case "round:phase": {
|
|
16811
16844
|
const serverPhase = msg.phase;
|
|
16845
|
+
if (msg.roundId) {
|
|
16846
|
+
setCurrentRoundId(msg.roundId);
|
|
16847
|
+
}
|
|
16812
16848
|
if (serverPhase === "waiting") {
|
|
16813
16849
|
setPhase("waiting");
|
|
16814
16850
|
setRoundBets([]);
|
|
@@ -16888,18 +16924,21 @@ function CrashGame({ userName }) {
|
|
|
16888
16924
|
};
|
|
16889
16925
|
setRoundBets((prev) => [...prev.filter((b) => b.userId !== msg.userId), entry]);
|
|
16890
16926
|
if (msg.userId === socket.userId) {
|
|
16891
|
-
|
|
16892
|
-
|
|
16893
|
-
|
|
16894
|
-
|
|
16895
|
-
|
|
16896
|
-
|
|
16897
|
-
|
|
16898
|
-
|
|
16899
|
-
|
|
16900
|
-
|
|
16901
|
-
|
|
16902
|
-
|
|
16927
|
+
if (!wasProcessed(SS_BET_KEY)) {
|
|
16928
|
+
markProcessed(SS_BET_KEY);
|
|
16929
|
+
userHasBetRef.current = true;
|
|
16930
|
+
setUserHasBet(true);
|
|
16931
|
+
setIsMutating(false);
|
|
16932
|
+
setActiveBetData({
|
|
16933
|
+
id: `ws-bet-${Date.now()}`,
|
|
16934
|
+
game: "crash",
|
|
16935
|
+
isActive: true,
|
|
16936
|
+
amount: msg.amount,
|
|
16937
|
+
payout: 0,
|
|
16938
|
+
payoutMultiplier: 0,
|
|
16939
|
+
state: { crashPoint: 0, cashoutMultiplier: 0 }
|
|
16940
|
+
});
|
|
16941
|
+
}
|
|
16903
16942
|
}
|
|
16904
16943
|
break;
|
|
16905
16944
|
}
|
|
@@ -16908,12 +16947,12 @@ function CrashGame({ userName }) {
|
|
|
16908
16947
|
(b) => b.userId === msg.userId ? { ...b, cashoutMultiplier: msg.multiplier, payout: msg.payout } : b
|
|
16909
16948
|
));
|
|
16910
16949
|
if (msg.userId === socket.userId) {
|
|
16950
|
+
if (wasProcessed(SS_CASHOUT_KEY)) break;
|
|
16951
|
+
markProcessed(SS_CASHOUT_KEY);
|
|
16911
16952
|
userCashedOutRef.current = true;
|
|
16912
16953
|
setUserCashedOut(true);
|
|
16913
16954
|
winSound2.play();
|
|
16914
16955
|
const payout = msg.payout;
|
|
16915
|
-
const newBalance = balanceRef.current + payout;
|
|
16916
|
-
setBalanceSync(newBalance);
|
|
16917
16956
|
setIsMutating(false);
|
|
16918
16957
|
addStat({
|
|
16919
16958
|
amount: betAmountRef.current,
|