Jump to content

Can somebody help me


Oname98

Recommended Posts

Someone help me create a code for classic dice, I have the base but I don't configure it so that it moves the bar and changes the payment.
 
function CDAuto()
{
 
this.currentBet = 0;
this.betamount = 0;
this.stopped = true;
 
this.resolveBet = (betlog) => {
if (betlog.winAmount > 0) { // nếu thắng
cd.isHigh = !cd.isHigh; // ví dụ đảo chiều under/over
// this.currentBet = this.betamount; // vd, reset về bet ban đầu
} else { // nếu thua
console.log('thua rồi làm gì đây');
// this.currentBet = this.currentBet * 2; // vd x2 bet khi thua
// cd.betChance = 66; // vd đổi payout thành 1.3x (66%)
}
}
 
this.cplay = () => {
cd.bet(this.currentBet).then(this.resolveBet).then(() => {
if (!this.stopped) {
setTimeout(() => {
this.cplay();
}, 350);
}
});
}
 
this.start = () => {
this.betamount = parseFloat(document.querySelector('#betamount').value);
this.stopped = false;
 
this.stopButton.style.display = '';
this.startButton.style.display = 'none';
 
cd.isHigh = false; // bet roll under
cd.betChance = 50; // bet chance = 50%, payout 1.98x
 
this.currentBet = this.betamount;
 
this.cplay();
}
 
this.stop = () => {
this.startButton.style.display = '';
this.stopButton.style.display = 'none';
this.stopped = true;
}
 
const htmlToElement = function (html) {
let template = document.createElement('template');
html = html.trim();
template.innerHTML = html;
return template.content.firstChild;
}
 
document.querySelector('#ClassicDice-control-0 > div.ui-radio.game-control-switch > button > div.label').innerHTML='Script';
document.querySelector('#ClassicDice-control-0 > div.game-control-panel div.ui-input.small.is-disabled').style.display = 'none';
document.querySelector('#ClassicDice-control-0 > div.game-control-panel .game-coininput').style.display = 'none';
document.querySelector('#ClassicDice-control-0 > div.game-control-panel > div > button.bet-button').style.display='none';
 
this.funding = htmlToElement('<div class="ui-input small"><div class="input-label">Bet amount</div><div class="input-control"><input type="text" value="0.0001" id="betamount"></div></div>');
this.startButton = htmlToElement('<button class="ui-button button-big s-conic start-auto" style="margin-top:15px"><div class="button-inner">Start Auto</div></button>');
this.stopButton = htmlToElement('<button class="ui-button button-big s-conic2 stop-auto" style="margin-top:15px"><div class="button-inner">Stop Auto</div></button>');
this.stopButton.style.display = 'none';
 
document.querySelector('#ClassicDice-control-0 > div.game-control-panel > div').appendChild(this.funding);
document.querySelector('#ClassicDice-control-0 > div.game-control-panel > div').appendChild(this.startButton);
document.querySelector('#ClassicDice-control-0 > div.game-control-panel > div').appendChild(this.stopButton);
 
this.startButton.onclick = this.start;
this.stopButton.onclick = this.stop;
}
 
 

const cdauto = new CDAuto();

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...