Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected updatePartnerAdapterBalance(fudge: boolean = false, specificVal?: number): void
- {
- const totalWin : number = this.models.winModel.getTotalWin() ? this.models.winModel.getTotalWin() : 0;
- const currentWin : number = this.models.winModel.getCurrentWin() ? this.models.winModel.getCurrentWin() : 0;
- if (this.partnerAdapter)
- {
- let cash: number = this.models.openBetModel ? this.models.openBetModel.getCash() : this.models.playerModel.getBalance();
- if (specificVal)
- {
- if (this.models.openBetModel)
- {
- cash = specificVal - this.models.openBetModel.getFreebets();
- }
- else
- {
- cash = specificVal;
- }
- }
- else if (this.models.playModel.getRecovering())
- {
- cash = this.models.playerModel.getPrevBalance() - (currentWin + totalWin);
- }
- const freebets: number = this.models.openBetModel ? this.models.openBetModel.getFreebets() : 0;
- let balance: number = specificVal ? specificVal : this.models.playerModel.getBalance();
- if (this.models.playModel.getRecovering() && !specificVal)
- {
- balance = this.models.playerModel.getPrevBalance() - (totalWin + currentWin);
- }
- if (fudge && !this.models.playModel.getRecovering())
- {
- if (this.models.openBetModel)
- {
- cash = this.models.playerModel.getPrevBalance() - (this.models.stakeModel.getTotalBet() + this.models.openBetModel.getFreebets());
- }
- else
- {
- //calculate the new balance before winnings
- cash = this.models.playerModel.getPrevBalance() - this.models.stakeModel.getTotalBet();
- }
- // If the new balance is negative, it means that it has been externally updated by the user
- // (otherwise the server would have returned a insufficient funds error)
- // so we set the new balance to zero, and it will be corrected when spin stops
- cash = Math.max(cash, 0);
- }
- this.partnerAdapter.handleBalanceDisplay(cash, freebets, balance);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement