@betorigami/games 3.2.4 → 3.2.5
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/index.mjs +101 -62
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20503,20 +20503,20 @@ let AdvancedDiceGame = class extends xt {
|
|
|
20503
20503
|
}
|
|
20504
20504
|
async handleBetExecution(ae, he) {
|
|
20505
20505
|
if (!this.gameData.currency) throw new Error(l$1("alerts.gameError", this.gameData?.language || k));
|
|
20506
|
-
const ke = this.buildGameInputs(),
|
|
20507
|
-
let
|
|
20508
|
-
if (
|
|
20506
|
+
const ke = Big(this.gameData.balance), Bt = this.buildGameInputs(), Rt = { language: this.gameData.language, amount: ae, gameInputs: Bt, meta: he ? $h(he) : void 0 };
|
|
20507
|
+
let Kt;
|
|
20508
|
+
if (this.isDemoMode && ke.lt(Rt.amount) ? Kt = { success: !1, error: l$1("alerts.insufficientBalance", this.gameData?.language || "en") } : (this.preDeductStake(ke, ae), Kt = await this.advancedDiceApi.startBet(Rt)), Kt.success) {
|
|
20509
20509
|
this.isInstantBet || this.gameData.soundEffects?.play(ma.diceRoll());
|
|
20510
|
-
const
|
|
20511
|
-
this.gameData.updateBalance(
|
|
20512
|
-
const
|
|
20513
|
-
|
|
20514
|
-
const { result:
|
|
20515
|
-
this.resultValue =
|
|
20510
|
+
const { betActions: Ca } = Kt.data, Ba = Ca[Ca.length - 1];
|
|
20511
|
+
if (!Ba) throw this.gameData.updateBalance(ke), new Error("No action data received");
|
|
20512
|
+
const Wa = this.isDemoMode ? ke.minus(Kt.data.amount ?? 0).plus(Kt.data.payout ?? 0) : Big(Kt.data.afterBalance ?? 0);
|
|
20513
|
+
this.gameData.updateBalance(Wa), this.showDice = !0;
|
|
20514
|
+
const { result: is } = Ba.data.ADVANCED_DICE, ns = is[0];
|
|
20515
|
+
this.resultValue = ns, this.isWin = Big(Kt.data.multiplier ?? 0).gt(1), this.isWin && setTimeout(() => {
|
|
20516
20516
|
this.playWinFeedback();
|
|
20517
|
-
}, 300), this.addToHistory(
|
|
20518
|
-
} else he || this.showError(
|
|
20519
|
-
return
|
|
20517
|
+
}, 300), this.addToHistory(ns / 100, this.isWin, Kt.data.id ?? ""), this.updateHistoryWithBet(Kt.data);
|
|
20518
|
+
} else this.gameData.updateBalance(ke), he || this.showError(Kt.error);
|
|
20519
|
+
return Kt;
|
|
20520
20520
|
}
|
|
20521
20521
|
addToHistory(ae, he, ke) {
|
|
20522
20522
|
this.history = [...this.history, { multiplier: ae, won: he, id: ke }].slice(-5);
|
|
@@ -22707,8 +22707,14 @@ let BlitzGame = class extends xt {
|
|
|
22707
22707
|
this.resetForNextBet(() => {
|
|
22708
22708
|
this.cardDetails = [], this.revealCardIndex = -1, this.progressActive = !1, this.gameOutcome = null, this.winPopupBet = null;
|
|
22709
22709
|
});
|
|
22710
|
-
const ke =
|
|
22711
|
-
|
|
22710
|
+
const ke = Big(this.gameData.balance);
|
|
22711
|
+
if (this.isDemoMode && ke.lt(ae)) return { success: !1, errorCode: Ed.INSUFFICIENT_BALANCE };
|
|
22712
|
+
this.preDeductStake(ke, ae);
|
|
22713
|
+
const Bt = { amount: ae, gameInputs: { pickCount: this.picks }, meta: he ? $h(he) : void 0 }, Rt = await this.placeBet(() => this.getBlitzApi().startBet(Bt));
|
|
22714
|
+
if (!Rt.success) return this.gameData.updateBalance(ke), Rt;
|
|
22715
|
+
this.cardDetails = Rt.cards.map((Ca) => BlitzUtils.getCardDetails(Ca)), this.updateHistoryWithBet({ id: Rt.id, amount: Rt.amount.toNumber(), payout: Rt.payout.toNumber() }), this.isInstantBet ? await this.revealCardsInstant(Rt) : await this.revealCards(Rt, !he);
|
|
22716
|
+
const Kt = this.isDemoMode ? ke.minus(Rt.amount).plus(Rt.payout) : Rt.afterBalance;
|
|
22717
|
+
return this.gameData.updateBalance(Kt), Rt;
|
|
22712
22718
|
}
|
|
22713
22719
|
async revealCardsInstant(ae) {
|
|
22714
22720
|
const he = BlitzUtils.getRevealTargetIndex(this.cardDetails), ke = BlitzUtils.getLossIndex(this.cardDetails);
|
|
@@ -23935,10 +23941,16 @@ let DiceGame = class extends xt {
|
|
|
23935
23941
|
}
|
|
23936
23942
|
}
|
|
23937
23943
|
async handleBetExecution(ae, he) {
|
|
23938
|
-
const ke =
|
|
23939
|
-
|
|
23944
|
+
const ke = Big(this.gameData.balance);
|
|
23945
|
+
if (this.isDemoMode && ke.lt(ae)) return { success: !1, errorCode: Ed.INSUFFICIENT_BALANCE };
|
|
23946
|
+
this.preDeductStake(ke, ae);
|
|
23947
|
+
const Bt = { amount: ae, direction: this.diceDirection, selectedValue: this.selectedValue, meta: he ? $h(he) : void 0 }, Rt = await this.getDiceApi().startBet(Bt);
|
|
23948
|
+
if (!Rt.success) return this.gameData.updateBalance(ke), Rt;
|
|
23949
|
+
this.isInstantBet || this.gameData.soundEffects?.play(ma.diceRoll());
|
|
23950
|
+
const Kt = this.isDemoMode ? ke.minus(Rt.amount).plus(Rt.payout) : Rt.afterBalance;
|
|
23951
|
+
return this.gameData.updateBalance(Kt), this.resultValue = Rt.result, this.isWin = Rt.isWin, this.isWin && setTimeout(() => {
|
|
23940
23952
|
this.playWinFeedback();
|
|
23941
|
-
}, 300), this.addToHistory(
|
|
23953
|
+
}, 300), this.addToHistory(Rt.result / 100, this.isWin, Rt.id), this.updateHistoryWithBet({ id: Rt.id, amount: Rt.amount.toNumber(), payout: Rt.payout.toNumber() }), Rt;
|
|
23942
23954
|
}
|
|
23943
23955
|
async executeAutobet(ae, he) {
|
|
23944
23956
|
const ke = await this.handleBetExecution(he, ae);
|
|
@@ -24851,54 +24863,72 @@ let KenoGame = class extends xt {
|
|
|
24851
24863
|
}
|
|
24852
24864
|
async handleBetExecution(ae, he) {
|
|
24853
24865
|
if (!this.gameData.currency) throw new Error("Currency is not set");
|
|
24854
|
-
const ke = { language: this.gameData.language, amount: ae, riskLevel: this.kenoRisk, selectedNumbers: this.selectedTiles };
|
|
24855
|
-
let
|
|
24856
|
-
if (
|
|
24857
|
-
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24866
|
+
const ke = Big(this.gameData.balance), Bt = { language: this.gameData.language, amount: ae, riskLevel: this.kenoRisk, selectedNumbers: this.selectedTiles };
|
|
24867
|
+
let Rt;
|
|
24868
|
+
if (this.isDemoMode && ke.lt(Bt.amount)) Rt = { success: !1, error: l$1("alerts.insufficientBalance", this.gameData?.language || "en") };
|
|
24869
|
+
else {
|
|
24870
|
+
this.preDeductStake(ke, ae);
|
|
24871
|
+
try {
|
|
24872
|
+
Rt = await this.kenoApi.startBet(Bt);
|
|
24873
|
+
} catch (Kt) {
|
|
24874
|
+
throw this.gameData.updateBalance(ke), Kt;
|
|
24875
|
+
}
|
|
24876
|
+
}
|
|
24877
|
+
if (Rt.success) {
|
|
24878
|
+
const { betActions: Kt } = Rt.data, Ca = Kt[Kt.length - 1]?.data.KENO;
|
|
24879
|
+
if (!Ca || !("result" in Ca)) throw this.gameData.updateBalance(ke), new Error("No keno data found");
|
|
24880
|
+
this.multiplier = this.getDisplayMultiplier(this.gameData.betAmount, Number(Rt.data.multiplier), Ca.result);
|
|
24881
|
+
const Ba = new Set(this.selectedTiles);
|
|
24861
24882
|
await this.executeInstantOrAnimated(async () => {
|
|
24862
|
-
this.playLossGemRevealFeedback(
|
|
24883
|
+
this.playLossGemRevealFeedback(Ca.result, Ba), this.resultTiles = [...Ca.result];
|
|
24863
24884
|
}, async () => {
|
|
24864
|
-
let
|
|
24865
|
-
for (const
|
|
24866
|
-
}), this.gameWinPopupShowing = this.multiplier > 0, this.gameWinPopupShowing && this.playWinFeedback(), this.payout = Big(
|
|
24867
|
-
const
|
|
24868
|
-
this.gameData.updateBalance(
|
|
24869
|
-
}
|
|
24870
|
-
return
|
|
24885
|
+
let is = 0;
|
|
24886
|
+
for (const ns of Ca.result) is = this.playAnimatedRevealFeedback(ns, Ba, is), this.resultTiles = [...this.resultTiles, ns], await Pt(he);
|
|
24887
|
+
}), this.gameWinPopupShowing = this.multiplier > 0, this.gameWinPopupShowing && this.playWinFeedback(), this.payout = Big(Rt.data.payout ?? 0), this.addToHistory(Big(Rt.data.multiplier ?? 0).toNumber(), this.gameWinPopupShowing, Rt.data.id ?? ""), this.updateHistoryWithBet(Rt.data);
|
|
24888
|
+
const Wa = this.isDemoMode ? ke.minus(Rt.data.amount ?? 0).plus(Rt.data.payout ?? 0) : Big(Rt.data.afterBalance ?? 0);
|
|
24889
|
+
this.gameData.updateBalance(Wa);
|
|
24890
|
+
} else this.gameData.updateBalance(ke);
|
|
24891
|
+
return Rt;
|
|
24871
24892
|
}
|
|
24872
24893
|
addToHistory(ae, he, ke) {
|
|
24873
24894
|
const Bt = [...this.history, { multiplier: ae, won: he, id: ke }];
|
|
24874
24895
|
this.history = Bt.slice(-5);
|
|
24875
24896
|
}
|
|
24876
24897
|
async executeAutobet(ae, he) {
|
|
24898
|
+
if (!this.gameData.currency) throw new Error("Currency is not set");
|
|
24899
|
+
if (this.resetForNextBet(() => {
|
|
24900
|
+
this.resultTiles = [], this.gameOver = !1, this.gameWinPopupShowing = !1;
|
|
24901
|
+
}), this.selectedTiles.length === 0) return { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: l$1("games.keno.selectTileToAutobet", this.gameData.language || k) };
|
|
24902
|
+
const ke = Big(this.gameData.balance);
|
|
24903
|
+
let Bt, Rt;
|
|
24904
|
+
this.preDeductStake(ke, he);
|
|
24877
24905
|
try {
|
|
24878
|
-
|
|
24879
|
-
if (this.
|
|
24880
|
-
|
|
24881
|
-
|
|
24882
|
-
const
|
|
24883
|
-
if (!
|
|
24884
|
-
const
|
|
24885
|
-
|
|
24886
|
-
const
|
|
24887
|
-
this.multiplier = this.getDisplayMultiplier(he, Number(Rt.multiplier), is);
|
|
24888
|
-
const ns = new Set(this.selectedTiles);
|
|
24906
|
+
const Kt = { language: this.gameData.language, amount: he, riskLevel: this.kenoRisk, selectedNumbers: this.selectedTiles, meta: ae ? $h(ae) : void 0 }, Ca = await this.placeBet(() => this.kenoApi.startBet(Kt));
|
|
24907
|
+
if (!Ca.success) return this.gameData.updateBalance(ke), { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: Ca.error || l$1("alerts.errorProcessingBet", this.gameData.language || k) };
|
|
24908
|
+
const Ba = Ca.data;
|
|
24909
|
+
Bt = Big(Ba.payout ?? 0).minus(Ba.amount ?? 0), Rt = Mh(Number(Ba.multiplier));
|
|
24910
|
+
const Wa = Ba.betActions, is = Wa[Wa.length - 1]?.data.KENO;
|
|
24911
|
+
if (!is || !("result" in is)) throw this.gameData.updateBalance(ke), new Error("No keno data found");
|
|
24912
|
+
const { result: ns } = is;
|
|
24913
|
+
this.multiplier = this.getDisplayMultiplier(he, Number(Ba.multiplier), ns);
|
|
24914
|
+
const as = new Set(this.selectedTiles);
|
|
24889
24915
|
await this.executeInstantOrAnimated(async () => {
|
|
24890
|
-
this.playLossGemRevealFeedback(
|
|
24916
|
+
this.playLossGemRevealFeedback(ns, as), this.resultTiles = [...ns];
|
|
24891
24917
|
}, async () => {
|
|
24892
|
-
let
|
|
24893
|
-
for (const
|
|
24894
|
-
}), this.gameWinPopupShowing = this.multiplier > 0, this.gameWinPopupShowing && this.playWinFeedback(), this.payout = Big(
|
|
24895
|
-
const
|
|
24896
|
-
|
|
24897
|
-
} catch (
|
|
24898
|
-
return console.error("Error in executeAutobet:", ke), { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: l$1("alerts.gameError", this.gameData.language || k) };
|
|
24918
|
+
let ss = 0;
|
|
24919
|
+
for (const rs of ns) ss = this.playAnimatedRevealFeedback(rs, as, ss), this.resultTiles = [...this.resultTiles, rs], await Pt(this.getDelay(150));
|
|
24920
|
+
}), this.gameWinPopupShowing = this.multiplier > 0, this.gameWinPopupShowing && this.playWinFeedback(), this.payout = Big(Ba.payout ?? 0), this.addToHistory(Number(Ba.multiplier ?? 0), this.gameWinPopupShowing, Ba.id ?? ""), this.updateHistoryWithBet(Ba);
|
|
24921
|
+
const Ka = this.isDemoMode ? ke.minus(Ca.data.amount ?? 0).plus(Ca.data.payout ?? 0) : Big(Ca.data.afterBalance ?? 0);
|
|
24922
|
+
this.gameData.updateBalance(Ka);
|
|
24923
|
+
} catch (Kt) {
|
|
24924
|
+
return console.error("Error in executeAutobet:", Kt), this.gameData.updateBalance(ke), { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: l$1("alerts.gameError", this.gameData.language || k) };
|
|
24925
|
+
}
|
|
24926
|
+
try {
|
|
24927
|
+
await this.holdResultDisplay();
|
|
24899
24928
|
} finally {
|
|
24900
|
-
this.gameOver = !0;
|
|
24929
|
+
this.gameWinPopupShowing = !1, this.gameOver = !0;
|
|
24901
24930
|
}
|
|
24931
|
+
return { pnl: Bt, gameOutcome: Rt, hasError: !1 };
|
|
24902
24932
|
}
|
|
24903
24933
|
render() {
|
|
24904
24934
|
const ae = this.selectedTiles.length, he = this.gameData.mainWidth >= 768, ke = this.kenoEdge, Bt = Qr.configs(ke).find((Kt) => Kt.tiles === this.selectedTiles.length)?.payout[this.kenoRisk][this.selectedTiles.length] ?? 1, Rt = Rh(this.gameData);
|
|
@@ -25457,9 +25487,11 @@ let LimboGame = class extends xt {
|
|
|
25457
25487
|
if (!this.areInputsDisabled) {
|
|
25458
25488
|
this.isManualPlaying = !0;
|
|
25459
25489
|
try {
|
|
25460
|
-
const ae = await this.handleBetExecution(this.gameData.betAmount);
|
|
25461
|
-
if (!
|
|
25462
|
-
await this.awaitRevealAnimation(
|
|
25490
|
+
const ae = Big(this.gameData.balance), he = await this.handleBetExecution(this.gameData.betAmount);
|
|
25491
|
+
if (!he.success) return void this.showError(l$1(Lh(he.errorCode), this.gameData.language));
|
|
25492
|
+
await this.awaitRevealAnimation(he.id);
|
|
25493
|
+
const ke = this.isDemoMode ? ae.minus(he.amount).plus(he.payout) : he.afterBalance;
|
|
25494
|
+
this.gameData.updateBalance(ke);
|
|
25463
25495
|
} finally {
|
|
25464
25496
|
this.isManualPlaying = !1;
|
|
25465
25497
|
}
|
|
@@ -25469,8 +25501,11 @@ let LimboGame = class extends xt {
|
|
|
25469
25501
|
this.resetForNextBet(() => {
|
|
25470
25502
|
this.resultMultiplier = null;
|
|
25471
25503
|
});
|
|
25472
|
-
const ke =
|
|
25473
|
-
|
|
25504
|
+
const ke = Big(this.gameData.balance);
|
|
25505
|
+
if (this.isDemoMode && ke.lt(ae)) return { success: !1, errorCode: Ed.INSUFFICIENT_BALANCE };
|
|
25506
|
+
this.preDeductStake(ke, ae);
|
|
25507
|
+
const Bt = this.targetMultiplier, Rt = { amount: ae, targetMultiplier: Number(Big(Bt).mul(MULTIPLIER_PRECISION).toFixed(0)), meta: he ? $h(he) : void 0 }, Kt = await this.placeBet(() => this.getLimboApi().startBet(Rt));
|
|
25508
|
+
return Kt.success ? (this.resultMultiplier = Kt.resultMultiplier.toNumber(), this.betTargetMultiplier = Bt, this.betId = Kt.id, this.updateHistoryWithBet({ id: Kt.id, amount: Kt.amount.toNumber(), payout: Kt.payout.toNumber() }), Kt) : (this.gameData.updateBalance(ke), Kt);
|
|
25474
25509
|
}
|
|
25475
25510
|
async awaitRevealAnimation(ae) {
|
|
25476
25511
|
this.isInstantBet || await this.waitForAnimationComplete(ae);
|
|
@@ -25489,11 +25524,13 @@ let LimboGame = class extends xt {
|
|
|
25489
25524
|
});
|
|
25490
25525
|
}
|
|
25491
25526
|
async executeAutobet(ae, he) {
|
|
25492
|
-
const ke = await this.handleBetExecution(he, ae);
|
|
25493
|
-
if (!
|
|
25494
|
-
await this.awaitRevealAnimation(
|
|
25495
|
-
const
|
|
25496
|
-
|
|
25527
|
+
const ke = Big(this.gameData.balance), Bt = await this.handleBetExecution(he, ae);
|
|
25528
|
+
if (!Bt.success) return { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: l$1(Lh(Bt.errorCode), this.gameData.language) };
|
|
25529
|
+
await this.awaitRevealAnimation(Bt.id);
|
|
25530
|
+
const Rt = this.isDemoMode ? ke.minus(Bt.amount).plus(Bt.payout) : Bt.afterBalance;
|
|
25531
|
+
this.gameData.updateBalance(Rt);
|
|
25532
|
+
const Kt = Bt.payout.minus(Bt.amount), Ca = Mh(Bt.multiplier.toNumber());
|
|
25533
|
+
return await this.holdResultDisplay(), { pnl: Kt, gameOutcome: Ca, hasError: !1 };
|
|
25497
25534
|
}
|
|
25498
25535
|
calculateProfitOnWin() {
|
|
25499
25536
|
return Big(this.gameData.betAmount).mul(this.targetMultiplier).minus(this.gameData.betAmount).toFixed(4);
|
|
@@ -28801,6 +28838,7 @@ let RouletteGame = class extends fa {
|
|
|
28801
28838
|
try {
|
|
28802
28839
|
if (this.isDemoMode && Bt.lt(this.totalBetAmount)) throw new Error(l$1("alerts.insufficientBalance", this.gameData?.language || k));
|
|
28803
28840
|
if (this.isMaxPayoutExceeded(this.chipEvents)) throw new Error(l$1("alerts.maxPayoutExceeded", this.gameData?.language || k));
|
|
28841
|
+
this.preDeductStake(Bt, this.totalBetAmount);
|
|
28804
28842
|
const Rt = await this.placeBet(() => this.rouletteApi.startBet({ language: this.gameData.language, gameInputs: ke, meta: ae ? $h(ae) : void 0 }));
|
|
28805
28843
|
if (Rt.success) {
|
|
28806
28844
|
const { data: Kt } = Rt;
|
|
@@ -28808,6 +28846,7 @@ let RouletteGame = class extends fa {
|
|
|
28808
28846
|
}
|
|
28809
28847
|
throw new Error(Rt.error);
|
|
28810
28848
|
} catch (Rt) {
|
|
28849
|
+
this.gameData.updateBalance(Bt);
|
|
28811
28850
|
const Kt = Rt instanceof Error ? Rt.message : l$1("alerts.gameError", this.gameData?.language || k);
|
|
28812
28851
|
return this.showError(Kt), { success: !1, error: Kt };
|
|
28813
28852
|
}
|