Jump to content

Code to reconnect if the script stop


Igmss
 Share

Recommended Posts

  • 5 weeks later...

Post from

rungxanhlv said:

function Auto_bet(){
var Run_btn = document.documentElement.innerHTML.includes('Run Script');

if(Run_btn == true ){
  document.querySelectorAll('div.button-inner')[2].click();
  var find_btn = "Confirm";
  var haystack = document.getElementsByClassName("button-inner");
  var i;

  for (i = 0; i < haystack.length; i++) {
    if(haystack[i].innerHTML == find_btn){
         console.log("Auto Start");
         haystack[i].click();
	}
  }
}
}


var Start_Auto_bet = setInterval(Auto_bet,1000);  


To cancel interval run this code or refesh your browser"

 

Link to comment
Share on other sites

  • 4 weeks later...

setInterval(function(){ 
    if(!crash.script.isRunning)
        crash.script.start();
}, 5000);

Link to comment
Share on other sites

  • 2 weeks later...
  • 11 months later...
On 12/2/2023 at 2:25 AM, Darklights said:

hdg.script.run and hdg.script.isRunning nőt work today 😞

hdg, lbg, cd are not defined now 

@Skele please help, how can I reuse the script in the console.

Thanks You 🫠

Edited by 9527
Link to comment
Share on other sites

Most likely will take some investigating to figure it out.  My guess is that it is all now being done in a service worker, so you would have to figure out the correct message and send it.  But I don't know for sure.  I guess the other way you can do it is to automate through the actual UI, as in actually call click on the button etc..  The problem here is that they do something funky with the bet amount field so that even if you set it programatically it won't persist unless you click into the field.  My guess as to what they are doing there is they are checking for a property on events that will tell you if it is actually a user event.  Unfortunately you can't fake this in a client side script.  You can however fake it in a browser plugin.

Link to comment
Share on other sites

19 hours ago, Skele said:

Most likely will take some investigating to figure it out.  My guess is that it is all now being done in a service worker, so you would have to figure out the correct message and send it.  But I don't know for sure.  I guess the other way you can do it is to automate through the actual UI, as in actually call click on the button etc..  The problem here is that they do something funky with the bet amount field so that even if you set it programatically it won't persist unless you click into the field.  My guess as to what they are doing there is they are checking for a property on events that will tell you if it is actually a user event.  Unfortunately you can't fake this in a client side script.  You can however fake it in a browser plugin.

DISCLAIMER: I am an amateur, not a professional coder. Use this at your own risk.

@Skele Hope this helps. - Haven't bothered with any of the animations, but the core functionality is similar to hdg.

const source = document.location.hostname;

let i1 = import("https://" + source + "/modules/games/Game-85ea9a2f.js").then(res => i_hdg = res);
let i2 = import("https://" + source + "/modules/games/AllPlayers-cd388afe.js").then(res => i_bet = res);
let i3 = import("https://" + source + "/modules/games/bc_external-24a959e1.js").then(res => i_externals = res);
await Promise.all([i1, i2, i3]);

var core_configer = (e, i, l) => i in e ? Object.defineProperty(e, i, {
    enumerable: !0,
    configurable: !0,
    writable: !0,
    value: l
}) : e[i] = l; 
var core_initer = (e, i) => {
    for (var l in i || (i = {}))
        Object.prototype.hasOwnProperty.call(i, l) && core_configer(e, l, i[l]);
    if (Object.getOwnPropertySymbols)
        for (var l of Object.getOwnPropertySymbols(i))
            Object.prototype.propertyIsEnumerable.call(i, l) && core_configer(e, l, i[l]);
    return e;
};
var core_setter = (e, i, l) => (core_configer(e, typeof i != "symbol" ? i + "" : i, l), l);

const c_bet = i_externals._.socket.encode(i_bet.$.roots.default.Bet);
const c_init = i_externals._.socket.decode(i_bet.$.roots.default.Init);
const c_betvalue = i_externals._.socket.encode(i_bet.$.roots.gameHashdice.BetValue);
const c_decimal = i_externals._.Decimal.clone({precision: 9});

const myhdg = class myhdg extends i_hdg.default{
    constructor(l, o, s) {
        super(l, o, core_initer({
            allBets: [],
            myBets: [],
            autoType: "Preset"
        }, s));
        this.socket.on("b", i_externals._.utils.intervalQueue(i_externals._.socket.decodeBind(r => {
            if (r.userId == i_externals._.accountStore.state.userId) {
                this.cacheNickName = r.nickName;
                return;
            }
            this.formatBetLog(r)
        }, i_bet.$.roots.default.BetLog), 500)),
        this.socket.on("j-change", i_externals._.socket.decodeBind(r => r.infos.forEach(this.setJackpot), i_bet.J))
    }
    async bet(l, o = 0) {
        try {
            let s = this.betRequest(l, c_betvalue(this.mybetvalue), o);
            this.onBetRequest && (s = this.onBetRequest(s));
            let r = await s;
            this.addresult(r);
            return this.addMyBet(r),
            this.emit("betEnd", {
                amount: new c_decimal(r.betAmount),
                odds: r.odds,
                currencyName: r.currencyName
            }), r;
        } catch (s) {
            throw s
        }
    }
    async betRequest(l, o, s = 0) {
        let r = await this.socketRequest("bet", c_bet({
            frontgroundId: this.txId,
            currencyName: ss.wallet.current,
            betAmount: l.toString(),
            betValue: o,
            scriptId: s
        })).then(this.betResultDecoder);
        return this.getBetlog(r)
    }
    mypayout = (p) => {
        return new c_decimal(p).mul(this.oddsScale).toNumber();
    };
    mybetvalue = i_bet.$.roots.gameHashdice.BetValue.create({
        payout: this.mypayout(2),
        isHigh: "true"
    });
    addresult(result) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.g1k8hpak.game-recent > div > div");
        if(x !== null) {
            if(result.winAmount > 0) {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-win \">" + result.gameValue.gameValue + "</div></div>";
            } else {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-lose \">" + result.gameValue.gameValue + "</div></div>";
            }
            x.removeChild(x.firstChild);  
        }
    }
}

class data {
    constructor() {
        this.wagered = 0;
        this.profit = 0;
        this.winNum = 0;
        this.lossNum = 0;
        this.profits = [0];
    }
    clearData() {
        this.wagered = 0,
        this.profit = 0,
        this.winNum = 0,
        this.lossNum = 0,
        this.profits = [0]
    }
    addData(a, o) {
        let n = new c_decimal(o).sub(1).mul(a).toNumber();
        this.wagered = new c_decimal(this.wagered).add(a).toNumber();
        this.profit = new c_decimal(this.profit).add(n).toNumber();
        o >= 1 ? this.winNum++ : this.lossNum++;
        this.profits = this.profits.concat(this.profit);
        window["@bc/core"].livestats.wagered = this.wagered;
        window["@bc/core"].livestats.profit = this.profit;
        window["@bc/core"].livestats.winNum = this.winNum;
        window["@bc/core"].livestats.lossNum = this.lossNum;
        window["@bc/core"].livestats.profits = window["@bc/core"].livestats.profits.concat(this.profit);
    }
}

let x = new myhdg()
let qwe = new data()
x.addListener("betEnd", t => qwe.addData(t.amount, t.odds));
window["@bc/core"].livestats.currencyName = ss.wallet.current;

image.png.62710ce28bcea0bab7d9e6439344d800.png

The highlighted bits do change from time to time and need to be updated.

Link to comment
Share on other sites

Dude this is pretty awesome.  And yes the Hashes on the files will change whenever they update. Thanks for this though.

Edited by Skele
Link to comment
Share on other sites

The only downside of having to create a new instance of the class is that it won't interact with any of the UI. Not a big deal for me, but I'm not sure if there is a better way to do this. The benefit of extending the class is that you can inject what ever methods or variables you need. 

Before the most recent update all the stuff I'm using existed in the chunks, so even if they take away the modules, it should be possible to just find everything where ever they move it to. 

I haven't tried, but I also assume it would be fairly trivial to implement the same thing for lbg or crash since I'm using their constructors and build in methods. 

Link to comment
Share on other sites

yeah it interacting with the UI doesn't matter to me either, i already recreate limbo's UI for when i am on shuffle. so it wouldn't be hard at all actually to just reuse that stuff.  And this method should work for all the games i would imagine.  Except for maybe beauties.  Hit me up on TG. @skele69

@Sjjmhwpenyb

Edited by Skele
Link to comment
Share on other sites

Update: Added sections that:

1.  manually sets the 'roll' value on bet outcome

image.png.5985b490a60cc1f6dafcf1632c15c801.png

2.  manually sets high / low button selected and value on bet

image.png.e513f0a61451499d80dcec8bfe26f268.png

Now has all the useful GUI, I think. Still no animations, that just wastes time.

const source = document.location.hostname;

let i1 = import("https://" + source + "/modules/games/Game-85ea9a2f.js").then(res => i_hdg = res);
let i2 = import("https://" + source + "/modules/games/AllPlayers-cd388afe.js").then(res => i_bet = res);
let i3 = import("https://" + source + "/modules/games/bc_external-24a959e1.js").then(res => i_externals = res);
await Promise.all([i1, i2, i3]);

var core_configer = (e, i, l) => i in e ? Object.defineProperty(e, i, {
    enumerable: !0,
    configurable: !0,
    writable: !0,
    value: l
}) : e[i] = l; 
var core_initer = (e, i) => {
    for (var l in i || (i = {}))
        Object.prototype.hasOwnProperty.call(i, l) && core_configer(e, l, i[l]);
    if (Object.getOwnPropertySymbols)
        for (var l of Object.getOwnPropertySymbols(i))
            Object.prototype.propertyIsEnumerable.call(i, l) && core_configer(e, l, i[l]);
    return e;
};
var core_setter = (e, i, l) => (core_configer(e, typeof i != "symbol" ? i + "" : i, l), l);

const c_bet = i_externals._.socket.encode(i_bet.$.roots.default.Bet);
const c_init = i_externals._.socket.decode(i_bet.$.roots.default.Init);
const c_betvalue = i_externals._.socket.encode(i_bet.$.roots.gameHashdice.BetValue);
const c_decimal = i_externals._.Decimal.clone({precision: 9});

const c_hdg = class c_hdg extends i_hdg.default{
    constructor(l, o, s) {
        super(l, o, core_initer({
            allBets: [],
            myBets: [],
            autoType: "Preset"
        }, s));
        core_setter(this, "gameUnique", "HashDice");
        this.socket.on("b", i_externals._.utils.intervalQueue(i_externals._.socket.decodeBind(r => {
            if (r.userId == i_externals._.accountStore.state.userId) {
                this.cacheNickName = r.nickName;
                return;
            }
            this.formatBetLog(r)
        }, i_bet.$.roots.default.BetLog), 500)),
        this.socket.on("j-change", i_externals._.socket.decodeBind(r => r.infos.forEach(this.setJackpot), i_bet.J))
    }
    async dobet(amount, payout, ishigh, id = 0) {
        try {
            let bet = this.betRequest(amount, c_betvalue(this.mybetvalue(payout, ishigh)), id);
            this.addpayout(payout, ishigh)
            //this.onBetRequest && (bet = this.onBetRequest(bet));
            let outcome = this.getBetlog(await bet);
            this.addMyBet(outcome);
            this.emit("betEnd", {
                amount: new c_decimal(outcome.betAmount),
                odds: outcome.odds,
                currencyName: outcome.currencyName
            });
            this.addresult(outcome);
            return outcome;
        } catch (error) {
            throw new Error(error);
        }
    }
    async betRequest(amount, betvalue, id = 0) {
        return this.socketRequest("bet", c_bet({
            frontgroundId: this.txId,
            currencyName: ss.wallet.current,
            betAmount: amount.toString(),
            betValue: betvalue,
            scriptId: id
        })).then(this.betResultDecoder);
    }
    mypayout = (p) => {
        return new c_decimal(p).mul(this.oddsScale).toNumber();
    };
    mybetvalue = (payout, isHigh) => i_bet.$.roots.gameHashdice.BetValue.create({
        payout: this.mypayout(payout),
        isHigh: isHigh
    });
    addpayout(odds, ishigh) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.m18yg54v");
        if(x !== null) {
            if(ishigh) {
                x.childNodes[0].className = "high-btn active";
                x.childNodes[1].className = "low-btn";
            } else {
                x.childNodes[0].className = "high-btn";
                x.childNodes[1].className = "low-btn active";
            }
            let payout = 100000 / odds * 0.99;
            x.childNodes[0].firstChild.innerHTML = "High &gt; " + (99999 - payout).toFixed();
            x.childNodes[1].firstChild.innerHTML = "Low &lt; " + payout.toFixed();
        }
    }
    addresult(result) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.g1k8hpak.game-recent > div > div");
        if(x !== null) {
            if(result.winAmount > 0) {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-win \">" + result.gameValue.gameValue + "</div></div>";
            } else {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-lose \">" + result.gameValue.gameValue + "</div></div>";
            }
            x.removeChild(x.firstChild);  
        }
        let n = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.nknc1ws > div > div > div.lottery-numb");
        if(n !== null) {
            let height = Math.floor(n.firstChild.firstChild.clientHeight / 11);
            let strres = result.gameValue.gameValue.toString();
            for (let z = 0; z < strres.length; z++) {
                n.childNodes[z].firstChild.style.cssText = "background-position-y: -" + parseInt(strres[z]) * height + "px;"
            }
        }
    }
}

class data {
    constructor() {
        this.wagered = 0;
        this.profit = 0;
        this.winNum = 0;
        this.lossNum = 0;
        this.profits = [0];
    }
    clearData() {
        this.wagered = 0,
        this.profit = 0,
        this.winNum = 0,
        this.lossNum = 0,
        this.profits = [0]
    }
    addData(a, o) {
        let n = new c_decimal(o).sub(1).mul(a).toNumber();
        this.wagered = new c_decimal(this.wagered).add(a).toNumber();
        this.profit = new c_decimal(this.profit).add(n).toNumber();
        o >= 1 ? this.winNum++ : this.lossNum++;
        this.profits = this.profits.concat(this.profit);
        window["@bc/core"].livestats.wagered = this.wagered;
        window["@bc/core"].livestats.profit = this.profit;
        window["@bc/core"].livestats.winNum = this.winNum;
        window["@bc/core"].livestats.lossNum = this.lossNum;
        window["@bc/core"].livestats.profits = window["@bc/core"].livestats.profits.concat(this.profit);
    }
}

let myhdg = new c_hdg();
let mydata = new data();
myhdg.addListener("betEnd", res => mydata.addData(res.amount, res.odds));
window["@bc/core"].livestats.currencyName = ss.wallet.current;

myhdg.socket.connect();
myhdg.init();
myhdg.initPms;
myhdg.active();

 

Edited by Sjjmhwpenyb
**replaced variable defined elsewhere**
Link to comment
Share on other sites

1 hour ago, Sjjmhwpenyb said:

Update: Added sections that:

1.  manually sets the 'roll' value on bet outcome

image.png.5985b490a60cc1f6dafcf1632c15c801.png

2.  manually sets high / low button selected and value on bet

image.png.e513f0a61451499d80dcec8bfe26f268.png

Now has all the useful GUI, I think. Still no animations, that just wastes time.

const source = document.location.hostname;

let i1 = import("https://" + source + "/modules/games/Game-85ea9a2f.js").then(res => i_hdg = res);
let i2 = import("https://" + source + "/modules/games/AllPlayers-cd388afe.js").then(res => i_bet = res);
let i3 = import("https://" + source + "/modules/games/bc_external-24a959e1.js").then(res => i_externals = res);
await Promise.all([i1, i2, i3]);

var core_configer = (e, i, l) => i in e ? Object.defineProperty(e, i, {
    enumerable: !0,
    configurable: !0,
    writable: !0,
    value: l
}) : e[i] = l; 
var core_initer = (e, i) => {
    for (var l in i || (i = {}))
        Object.prototype.hasOwnProperty.call(i, l) && core_configer(e, l, i[l]);
    if (Object.getOwnPropertySymbols)
        for (var l of Object.getOwnPropertySymbols(i))
            Object.prototype.propertyIsEnumerable.call(i, l) && core_configer(e, l, i[l]);
    return e;
};
var core_setter = (e, i, l) => (core_configer(e, typeof i != "symbol" ? i + "" : i, l), l);

const c_bet = i_externals._.socket.encode(i_bet.$.roots.default.Bet);
const c_init = i_externals._.socket.decode(i_bet.$.roots.default.Init);
const c_betvalue = i_externals._.socket.encode(i_bet.$.roots.gameHashdice.BetValue);
const c_decimal = i_externals._.Decimal.clone({precision: 9});

const c_hdg = class c_hdg extends i_hdg.default{
    constructor(l, o, s) {
        super(l, o, core_initer({
            allBets: [],
            myBets: [],
            autoType: "Preset"
        }, s));
        core_setter(this, "gameUnique", "HashDice");
        this.socket.on("b", i_externals._.utils.intervalQueue(i_externals._.socket.decodeBind(r => {
            if (r.userId == i_externals._.accountStore.state.userId) {
                this.cacheNickName = r.nickName;
                return;
            }
            this.formatBetLog(r)
        }, i_bet.$.roots.default.BetLog), 500)),
        this.socket.on("j-change", i_externals._.socket.decodeBind(r => r.infos.forEach(this.setJackpot), i_bet.J))
    }
    async dobet(amount, payout, ishigh, id = 0) {
        try {
            let bet = this.betRequest(amount, c_betvalue(this.mybetvalue(payout, ishigh)), id);
            this.addpayout(payout, ishigh)
            //this.onBetRequest && (bet = this.onBetRequest(bet));
            let outcome = this.getBetlog(await bet);
            this.addMyBet(outcome);
            this.emit("betEnd", {
                amount: new c_decimal(outcome.betAmount),
                odds: outcome.odds,
                currencyName: outcome.currencyName
            });
            this.addresult(outcome);
            return outcome;
        } catch (error) {
            throw new Error(error);
        }
    }
    async betRequest(amount, betvalue, id = 0) {
        return this.socketRequest("bet", c_bet({
            frontgroundId: this.txId,
            currencyName: ss.wallet.current,
            betAmount: amount.toString(),
            betValue: betvalue,
            scriptId: id
        })).then(this.betResultDecoder);
    }
    mypayout = (p) => {
        return new c_decimal(p).mul(this.oddsScale).toNumber();
    };
    mybetvalue = (payout, isHigh) => i_bet.$.roots.gameHashdice.BetValue.create({
        payout: this.mypayout(payout),
        isHigh: isHigh
    });
    addpayout(odds, ishigh) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.m18yg54v");
        if(x !== null) {
            if(ishigh) {
                x.childNodes[0].className = "high-btn active";
                x.childNodes[1].className = "low-btn";
            } else {
                x.childNodes[0].className = "high-btn";
                x.childNodes[1].className = "low-btn active";
            }
            let payout = 100000 / odds * 0.99;
            x.childNodes[0].firstChild.innerHTML = "High &gt; " + (99999 - payout).toFixed();
            x.childNodes[1].firstChild.innerHTML = "Low &lt; " + payout.toFixed();
        }
    }
    addresult(result) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.g1k8hpak.game-recent > div > div");
        if(x !== null) {
            if(result.winAmount > 0) {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-win \">" + result.gameValue.gameValue + "</div></div>";
            } else {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-lose \">" + result.gameValue.gameValue + "</div></div>";
            }
            x.removeChild(x.firstChild);  
        }
        let n = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.nknc1ws > div > div > div.lottery-numb");
        if(n !== null) {
            let height = Math.floor(n.firstChild.firstChild.clientHeight / 11);
            let strres = result.gameValue.gameValue.toString();
            for (let z = 0; z < strres.length; z++) {
                n.childNodes[z].firstChild.style.cssText = "background-position-y: -" + parseInt(strres[z]) * height + "px;"
            }
        }
    }
}

class data {
    constructor() {
        this.wagered = 0;
        this.profit = 0;
        this.winNum = 0;
        this.lossNum = 0;
        this.profits = [0];
    }
    clearData() {
        this.wagered = 0,
        this.profit = 0,
        this.winNum = 0,
        this.lossNum = 0,
        this.profits = [0]
    }
    addData(a, o) {
        let n = new c_decimal(o).sub(1).mul(a).toNumber();
        this.wagered = new c_decimal(this.wagered).add(a).toNumber();
        this.profit = new c_decimal(this.profit).add(n).toNumber();
        o >= 1 ? this.winNum++ : this.lossNum++;
        this.profits = this.profits.concat(this.profit);
        window["@bc/core"].livestats.wagered = this.wagered;
        window["@bc/core"].livestats.profit = this.profit;
        window["@bc/core"].livestats.winNum = this.winNum;
        window["@bc/core"].livestats.lossNum = this.lossNum;
        window["@bc/core"].livestats.profits = window["@bc/core"].livestats.profits.concat(this.profit);
    }
}

let myhdg = new c_hdg();
let mydata = new data();
myhdg.addListener("betEnd", res => mydata.addData(res.amount, res.odds));
window["@bc/core"].livestats.currencyName = ss.wallet.current;

myhdg.socket.connect();
myhdg.init();
myhdg.initPms;
myhdg.active();

 

where am i gonna add all this codes? in console? i feel lost

 

Link to comment
Share on other sites

2 hours ago, Thghnvyhvxrtgb said:

where am i gonna add all this codes? in console? i feel lost

 

I suppose you could technically just dump it all into the console and it would work, not sure how you intend to actually use it from there though. Probably better to modify it to suit your needs then include it in the .js with the rest of your script or a separate .js that you import to your script. I think with javascript injection scripts like this, it is probably quite important to have a pretty good idea of what the code is doing and how it works before implementing it, especially if it was written by someone who doesn't have enough experience to be giving advise (like me). 

The purpose of this was more just to see if it was possible, and because I thought it was quite unkind for BC to just take away hdg without any notice or warning, not to thoroughly test its implementation. 

Edited by Sjjmhwpenyb
Link to comment
Share on other sites

@Sjjmhwpenyb hit me up on telegram.

Link to comment
Share on other sites

On 10/12/2022 at 11:14 PM, Igmss said:

Any one can help? 

        var minimumPayout = 1.0102; // Set your desired minimum payout value here

        if (config.payout.value < minimumPayout) {
            log.info('Payout is below the minimum allowed. Using minimum payout.');
            config.payout.value = minimumPayout;
        }

Link to comment
Share on other sites

On 12/6/2023 at 9:05 AM, Sjjmhwpenyb said:

Update: Added sections that:

1.  manually sets the 'roll' value on bet outcome

image.png.5985b490a60cc1f6dafcf1632c15c801.png

2.  manually sets high / low button selected and value on bet

image.png.e513f0a61451499d80dcec8bfe26f268.png

Now has all the useful GUI, I think. Still no animations, that just wastes time.

const source = document.location.hostname;

let i1 = import("https://" + source + "/modules/games/Game-85ea9a2f.js").then(res => i_hdg = res);
let i2 = import("https://" + source + "/modules/games/AllPlayers-cd388afe.js").then(res => i_bet = res);
let i3 = import("https://" + source + "/modules/games/bc_external-24a959e1.js").then(res => i_externals = res);
await Promise.all([i1, i2, i3]);

var core_configer = (e, i, l) => i in e ? Object.defineProperty(e, i, {
    enumerable: !0,
    configurable: !0,
    writable: !0,
    value: l
}) : e[i] = l; 
var core_initer = (e, i) => {
    for (var l in i || (i = {}))
        Object.prototype.hasOwnProperty.call(i, l) && core_configer(e, l, i[l]);
    if (Object.getOwnPropertySymbols)
        for (var l of Object.getOwnPropertySymbols(i))
            Object.prototype.propertyIsEnumerable.call(i, l) && core_configer(e, l, i[l]);
    return e;
};
var core_setter = (e, i, l) => (core_configer(e, typeof i != "symbol" ? i + "" : i, l), l);

const c_bet = i_externals._.socket.encode(i_bet.$.roots.default.Bet);
const c_init = i_externals._.socket.decode(i_bet.$.roots.default.Init);
const c_betvalue = i_externals._.socket.encode(i_bet.$.roots.gameHashdice.BetValue);
const c_decimal = i_externals._.Decimal.clone({precision: 9});

const c_hdg = class c_hdg extends i_hdg.default{
    constructor(l, o, s) {
        super(l, o, core_initer({
            allBets: [],
            myBets: [],
            autoType: "Preset"
        }, s));
        core_setter(this, "gameUnique", "HashDice");
        this.socket.on("b", i_externals._.utils.intervalQueue(i_externals._.socket.decodeBind(r => {
            if (r.userId == i_externals._.accountStore.state.userId) {
                this.cacheNickName = r.nickName;
                return;
            }
            this.formatBetLog(r)
        }, i_bet.$.roots.default.BetLog), 500)),
        this.socket.on("j-change", i_externals._.socket.decodeBind(r => r.infos.forEach(this.setJackpot), i_bet.J))
    }
    async dobet(amount, payout, ishigh, id = 0) {
        try {
            let bet = this.betRequest(amount, c_betvalue(this.mybetvalue(payout, ishigh)), id);
            this.addpayout(payout, ishigh)
            //this.onBetRequest && (bet = this.onBetRequest(bet));
            let outcome = this.getBetlog(await bet);
            this.addMyBet(outcome);
            this.emit("betEnd", {
                amount: new c_decimal(outcome.betAmount),
                odds: outcome.odds,
                currencyName: outcome.currencyName
            });
            this.addresult(outcome);
            return outcome;
        } catch (error) {
            throw new Error(error);
        }
    }
    async betRequest(amount, betvalue, id = 0) {
        return this.socketRequest("bet", c_bet({
            frontgroundId: this.txId,
            currencyName: ss.wallet.current,
            betAmount: amount.toString(),
            betValue: betvalue,
            scriptId: id
        })).then(this.betResultDecoder);
    }
    mypayout = (p) => {
        return new c_decimal(p).mul(this.oddsScale).toNumber();
    };
    mybetvalue = (payout, isHigh) => i_bet.$.roots.gameHashdice.BetValue.create({
        payout: this.mypayout(payout),
        isHigh: isHigh
    });
    addpayout(odds, ishigh) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.m18yg54v");
        if(x !== null) {
            if(ishigh) {
                x.childNodes[0].className = "high-btn active";
                x.childNodes[1].className = "low-btn";
            } else {
                x.childNodes[0].className = "high-btn";
                x.childNodes[1].className = "low-btn active";
            }
            let payout = 100000 / odds * 0.99;
            x.childNodes[0].firstChild.innerHTML = "High &gt; " + (99999 - payout).toFixed();
            x.childNodes[1].firstChild.innerHTML = "Low &lt; " + payout.toFixed();
        }
    }
    addresult(result) {
        let x = document.querySelector("#game-HashDice > div > div.game-view > div.g1k8hpak.game-recent > div > div");
        if(x !== null) {
            if(result.winAmount > 0) {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-win \">" + result.gameValue.gameValue + "</div></div>";
            } else {
                x.innerHTML += "<div class=\"recent-item\" style=\"width: 11.1111%;\"><\div class=\"item-wrap is-lose \">" + result.gameValue.gameValue + "</div></div>";
            }
            x.removeChild(x.firstChild);  
        }
        let n = document.querySelector("#game-HashDice > div > div.game-view > div.wklevwm.game-box.n17cpum0 > div > div.nknc1ws > div > div > div.lottery-numb");
        if(n !== null) {
            let height = Math.floor(n.firstChild.firstChild.clientHeight / 11);
            let strres = result.gameValue.gameValue.toString();
            for (let z = 0; z < strres.length; z++) {
                n.childNodes[z].firstChild.style.cssText = "background-position-y: -" + parseInt(strres[z]) * height + "px;"
            }
        }
    }
}

class data {
    constructor() {
        this.wagered = 0;
        this.profit = 0;
        this.winNum = 0;
        this.lossNum = 0;
        this.profits = [0];
    }
    clearData() {
        this.wagered = 0,
        this.profit = 0,
        this.winNum = 0,
        this.lossNum = 0,
        this.profits = [0]
    }
    addData(a, o) {
        let n = new c_decimal(o).sub(1).mul(a).toNumber();
        this.wagered = new c_decimal(this.wagered).add(a).toNumber();
        this.profit = new c_decimal(this.profit).add(n).toNumber();
        o >= 1 ? this.winNum++ : this.lossNum++;
        this.profits = this.profits.concat(this.profit);
        window["@bc/core"].livestats.wagered = this.wagered;
        window["@bc/core"].livestats.profit = this.profit;
        window["@bc/core"].livestats.winNum = this.winNum;
        window["@bc/core"].livestats.lossNum = this.lossNum;
        window["@bc/core"].livestats.profits = window["@bc/core"].livestats.profits.concat(this.profit);
    }
}

let myhdg = new c_hdg();
let mydata = new data();
myhdg.addListener("betEnd", res => mydata.addData(res.amount, res.odds));
window["@bc/core"].livestats.currencyName = ss.wallet.current;

myhdg.socket.connect();
myhdg.init();
myhdg.initPms;
myhdg.active();

 

Hello, i have a script. Do you mind to help me edit it to a strategy. Maybe i can contact you on telegram?

Link to comment
Share on other sites

My technique is 90% of success.  

Link to comment
Share on other sites

The code I've been using for a while, unfortunately BCGAME has now disabled cd, hdg, lbg.... They hate who use scirpt  

 

//Classic Dice
function CDAuto() { 
 
    const minbet = cd.minAmount.toNumber(); 
     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.001" 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.currentBet = 0; 
    this.betamount = 0; 
     this.W_streak = 0; 
  
    this.resolveBet = (betlog) => { 
        if (betlog.winAmount > 0) {         
            
               this.W_streak += 1; 
 
               if (this.W_streak > 2) { // Reset to base
      
                this.currentBet = this.betamount; 
                 
                } else { this.currentBet *= 4 }
                  

        } else {    
            cd.changeToggleWin();
               this.W_streak = 0; 
            this.currentBet *= 4;  
        } 
    } 
 
    this.cplay = () => { 
        cd.bet(this.currentBet).then(this.resolveBet).then(() => { 
            if (!this.stopped) { 
                setTimeout(() => { 
                    this.cplay(); 
                }, 10); 
            } 
        }); 
    } 
 
    this.start = () => { 
        this.betamount = parseFloat(document.querySelector('#betamount').value); 
        this.stopped = false; 
 
        this.stopButton.style.display = ''; 
        this.startButton.style.display = 'none'; 
 
        cd.isHigh = true; 
        cd.betChance = 90; 
 
        this.currentBet = this.betamount; 
 
        this.cplay(); 
    } 
 
    this.stop = () => { 
        this.startButton.style.display = ''; 
        this.stopButton.style.display = 'none'; 
        this.stopped = true; 
    } 
 
    this.startButton.onclick = this.start; 
    this.stopButton.onclick = this.stop; 

 
const cdauto = new CDAuto();

 

Link to comment
Share on other sites

Okay guys, this should work for hashdice...

note that it checks every 30 seconds, just a personal preference giving me enough time to make a small change if I stop it manually.

 

setInterval(function() {
  try {
    // Locate the "Run Script" button
    const runScriptButton = document.querySelector("#HashDice-control-2 > div.game-control-panel > div > div.sqshipa.scripts-inputs > div.actions > button.ui-button.button-normal.s-conic2");

    // Check if the button exists and has the correct text content
    if (runScriptButton && runScriptButton.textContent.trim() === "Run Script") {
      // Click the "Run Script" button
      runScriptButton.click();
      console.log("Clicked 'Run Script' button automatically.");

      // Wait 3 seconds for the confirmation button to appear
      setTimeout(function() {
        try {
          // Locate the confirmation button
          const confirmationButton = document.querySelector("#root > div.wdcb8sn.ui-pop-overlayer > div > div > div.btns > button.ui-button.button-normal.s-conic.light > div");

          // Click the confirmation button if it exists
          if (confirmationButton) {
            confirmationButton.click();
            console.log("Clicked confirmation button automatically.");
          } else {
            console.log("Confirmation button not found.");
          }
        } catch (error) {
          console.error("Error attempting to click the confirmation button:", error);
        }
      }, 3000);
    } else {
      console.log("'Run Script' button not found or not displaying correct text.");
    }
  } catch (error) {
    console.error("Error attempting to click the 'Run Script' button:", error);
  }
}, 30000); // Check every 30 seconds


 

Edited by Xiotplliaile
Link to comment
Share on other sites

  • 4 weeks later...

WORKING VERSION!
This update fixes any bugs the last one had.

Also, for the newbies, this is used by opening developer tools (on basically any browser) then pasting it into the console. 


 

setInterval(function() {
  try {
    // Locate the "Run Script" button
    const runScriptButton = document.querySelector("#HashDice-control-2 > div.game-control-panel > div > div.sqshipa.scripts-inputs > div.actions > button.ui-button.button-normal.s-conic2");

    // Check if the button exists and has the correct text content
    if (runScriptButton && runScriptButton.textContent.trim() === "Run Script") {
      // Click the "Run Script" button
      runScriptButton.click();
      console.log("Clicked 'Run Script' button automatically.");

      // Flag to track successful "Run Script" button click
      let runScriptClicked = true;

      // Only proceed to look for the confirmation button if the "Run Script" button was successfully clicked
      if (runScriptClicked) {
        setTimeout(function() {
          try {
            // Locate the confirmation button
            const confirmationButton = document.querySelector("#root > div.wdcb8sn.ui-pop-overlayer > div > div > div.btns > button.ui-button.button-normal.s-conic.light > div");

            // Click the confirmation button if it exists
            if (confirmationButton) {
              confirmationButton.click();
              console.log("Clicked confirmation button automatically.");
            } else {
              console.log("Confirmation button not found.");
            }
          } catch (error) {
            console.error("Error attempting to click the confirmation button:", error);
          }
        }, 3000);
      }
    } else {
      console.log("'Run Script' button not found or not displaying correct text.");
    }
  } catch (error) {
    console.error("Error attempting to click the 'Run Script' button:", error);
  }
}, 30000); // Check every 30 seconds

 

Edited by Xiotplliaile
Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...