Skip to content

Commit ca77f91

Browse files
author
bot
committed
v20.8.9
1 parent 64bd595 commit ca77f91

File tree

4 files changed

+138
-8
lines changed

4 files changed

+138
-8
lines changed

src/api/controllers/apiController.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ exports.info = async function(req, res) {
8888

8989
exports.bet = async function(req, res) {
9090
try{
91+
if(req.body.intervalBetTime >0 ) {
92+
await sleep(req.body.intervalBetTime);
93+
} else {
94+
if(req.params.site == 'ParaDice') {
95+
await sleep(1000);
96+
}
97+
}
9198
let dice = Factory.create(req.params.site);
9299
let ret = await dice.bet(req);
93100
return res.status(200).json(ret);

src/console.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var needSimulatorActiveKeySites = ['Simulator'];
3535

3636
var nums = 0, currency = 'btc', base = 0, isloop = false, iswin = false;
3737
var code;
38-
var startTime = new Date(), settime, difftime = 0;
38+
var startTime = new Date(), settime, difftime = 0, intervalBetTime = 0;
3939
var basebet = 0.00000001, nextbet = 0.00000001, chance = 90, bethigh = false;
4040
var previousbet = 0, win = false, currentprofit = 0, balance = 0, bets = 0, wins = 0, losses = 0, profit = 0, currentstreak = 0, currentroll = 0 ,wagered = 0, totalprofit = 0;
4141
var maxwinstreak = 0, maxlossstreak = 0, maxwinstreakamount = 0, maxlossstreakamount = 0, maxstreakamount = 0, minstreakamount = 0, maxbetamount = 0 ;
@@ -89,7 +89,7 @@ if(readlineSync.keyInYN('Whether to read the last configuration?')) {
8989
} else {
9090
req.body.site = 'Simulator';
9191
req.body.HouseEdge = 0.001;
92-
sleepTime = 1000;
92+
intervalBetTime = 1000;
9393
}
9494

9595
if (readlineSync.keyInYN('Do you use proxy?')) {
@@ -257,7 +257,7 @@ screen.key(['enter'],async function(ch, key) {
257257
isloop = await bet(false, req);
258258
}
259259
if(isloop){
260-
await sleep(sleepTime);
260+
await sleep(intervalBetTime);
261261
betfunc();
262262
}
263263
await saveLog(logname,req.logdata+'\r\n');
@@ -284,6 +284,18 @@ console.log = function (message) {
284284
process.exit();
285285
}
286286
}
287+
console.error = function (message) {
288+
try {
289+
if (typeof message == 'object') {
290+
logs.log(JSON && JSON.stringify ? (JSON.stringify(message)).replace(/\"/g,"") : message+"\r\n");
291+
} else {
292+
logs.log(message+"\r\n");
293+
}
294+
} catch(err){
295+
console.error(err);
296+
process.exit();
297+
}
298+
}
287299

288300
async function login(req) {
289301
await dice.login(req.body.username, req.body.password, req.body.twoFactor, req.body.apiKey, req);
@@ -293,6 +305,14 @@ async function login(req) {
293305

294306
}
295307

308+
async function resetseed() {
309+
try {
310+
let ret = await dice.resetseed(req);
311+
} catch(err){
312+
console.error(err);
313+
}
314+
}
315+
296316
async function betScript(req) {
297317
if(!checkParams(req.body.PayIn,req.body.Chance)) {
298318
console.log('Please enter the correct parameters');
@@ -410,6 +430,7 @@ function setBetToLua(ret, currencyValue, currentAmount){
410430
}
411431
lastbet = {id:getCurrentBetId(ret),chance:chance, date:getBetDate(ret),roll:currentroll,amount:currentAmount,nonce:getNonce(ret),serverhash:getServerHash(ret),serverseed:getServerSeed(ret),clientseed:getClientSeed(ret),profit:profit,uid:getUid(ret),high:bethigh};
412432
}
433+
413434
function betTime() {
414435
difftime++;
415436
dayf = difftime/(24*60*60);
@@ -430,10 +451,15 @@ function betTime() {
430451
['AVGPROFIT:'+parseFloat(totalprofit/bets).toFixed(10) ]] });
431452
settime = setTimeout(function(){ betTime() }, 1000);
432453
}
454+
433455
function stopBetTime() {
434456
clearTimeout(settime);
435457
}
436458

459+
function betinterval(ms) {
460+
intervalBetTime = ms;
461+
}
462+
437463
function sleep(ms) {
438464
return new Promise(resolve => setTimeout(resolve, ms));
439465
}

src/package.json.console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mydicebot-console-200717",
2+
"name": "mydicebot-console-200809",
33
"version": "1.0.0",
44
"description": "MyDiceBot - Bet more, earn more!",
55
"homepage": "https://mydicebot.com",

src/views/info.pug

Lines changed: 101 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ block content
1212
var nums = 0, currency = 'btc', base = 0, isloop = false, currentLanguage = 'lua';
1313
var autoLossRadio, autoWinRadio;
1414
var code;
15-
var startTime = new Date(), settime, difftime = 0;
15+
var startTime = new Date(), settime, difftime = 0, intervalBetTime = 0;
1616
var toggleLog = false, toggleChart = true;
1717
var basebet = 0.00000001, nextbet = 0.00000001, chance = 90, bethigh = false;
1818
var previousbet = 0, win = false, currentprofit = 0, balance = 0, bets = 0, wins = 0, losses = 0, profit = 0, currentstreak = 0, currentroll = 0, currentAmount = 0, totalprofit = 0 ;
1919
var lastbet = {id:0,chance:chance, date:1585642326,roll:49.5,amount:nextbet,nonce:1000,serverhash:'mydice',serverseed:'mydice',clientseed:'mydice',profit:profit,uid:1000,high:bethigh};
2020
var humps = ['baseBet', 'nextBet', 'betHigh', 'previousBet', 'currentProfit', 'currentStreak','currentRoll','lastBet.Id','lastBet.Chance','lastBet.date','lastBet.Roll','lastBet.Amount','lastBet.nonce','lastBet.serverhash','lastBet.serverseed','lastBet.clientseed','lastBet.Profit','lastBet.uid','lastBet.high','lastBet'];
2121
var maxwinstreak = 0, maxlossstreak = 0, maxwinstreakamount = 0, maxlossstreakamount = 0, maxstreakamount = 0, minstreakamount = 0, maxbetamount= 0 ;
22-
fengari.load('function stop()\nisloop = false \n js.global:stop() \n print(isloop)\nend')();
22+
fengari.load('function stop()\nisloop = false \n js.global:stop() \nend')();
2323
fengari.load('function resetseed()\n js.global:resetseed() \nend')();
2424
fengari.load('function resetsession()\n js.global:resetsession() \nend')();
25+
fengari.load('function resetstats()\n js.global:resetstats() \nend')();
26+
fengari.load('function betinterval(ms)\n js.global:betinterval(ms) \nend')();
2527
fengari.load('function sound(file)\n js.global:sound(file) \nend')();
2628
fengari.load('function message(text, type, expire)\n js.global:message(text, type, expire) \nend')();
2729
fengari.load('function start()\n js.global:start() \nend')();
@@ -370,6 +372,34 @@ block content
370372
},
371373
width: 400,
372374
cells: [
375+
{
376+
header: "Tutorials",
377+
body: {
378+
id: "youtube_form",
379+
view: "form",
380+
height: 0,
381+
width: 0,
382+
scroll:true,
383+
rows: [
384+
{
385+
view:"iframe",
386+
src:"https://www.youtube.com/embed/mvCedgWmp8w"
387+
},
388+
{
389+
view:"iframe",
390+
src:"https://www.youtube.com/embed/u7MXeReh0VE?t=1"
391+
},
392+
{
393+
view:"iframe",
394+
src:"https://www.youtube.com/embed/0e8Hm9uf4xU?t=13"
395+
},
396+
{
397+
view:"iframe",
398+
src:"https://www.youtube.com/embed/vVxUOKJ_lSs?t=220"
399+
},
400+
]
401+
}
402+
},
373403
{
374404
header: "BOT",
375405
body: {
@@ -672,6 +702,14 @@ block content
672702
value: "0",
673703
name: "auto_bet_reseed"
674704
},
705+
{
706+
id: "auto_bet_interval",
707+
view: "text",
708+
label: "BET INTERVAL [ms] (0:NON-INTERVAL)",
709+
labelWidth: 230,
710+
value: "0",
711+
name: "auto_bet_interval"
712+
},
675713
]
676714
},
677715
{
@@ -1319,6 +1357,14 @@ block content
13191357
value: "0",
13201358
name: "auto_bet_reseed"
13211359
},
1360+
{
1361+
id: "auto_bet_interval",
1362+
view: "text",
1363+
label: "BET INTERVAL [ms] (0:NON-INTERVAL)",
1364+
labelWidth: 230,
1365+
value: "0",
1366+
name: "auto_bet_interval"
1367+
},
13221368
]},
13231369
{
13241370
id: "auto_resetseed_button",
@@ -1902,6 +1948,14 @@ block content
19021948
let layout = $$("mobile_toolbar").getParentView();
19031949
layout.show();
19041950
});
1951+
$$("auto_bet_interval").attachEvent("onFocus", function(current_view, prev_view){
1952+
let layout = $$("mobile_toolbar").getParentView();
1953+
layout.hide();
1954+
});
1955+
$$("auto_bet_interval").attachEvent("onBlur", function(current_view, prev_view){
1956+
let layout = $$("mobile_toolbar").getParentView();
1957+
layout.show();
1958+
});
19051959

19061960
$$("mobile_toolbar_total").attachEvent("onItemClick", function(){
19071961
$$("bet_total_stats").show();
@@ -2201,6 +2255,11 @@ block content
22012255
refresh(currencyValue);
22022256
resetBetTime();
22032257
}
2258+
function resetstats(){
2259+
currencyValue = $$("bet_currency_selection").getValue();
2260+
refreshStats(currencyValue);
2261+
resetBetTime();
2262+
}
22042263
function resetseed(){
22052264
let now = Math.floor(Date.now()/1000);
22062265
let diff = now - lastResetSeed;
@@ -2414,7 +2473,7 @@ block content
24142473
}
24152474
function action(c,h,p,ch,cv,cb){
24162475
let houseEdgeValue = $$("bet_house_edge_selection").getValue();
2417-
webix.ajax().post('bet', { Currency:c, PayIn:p, High:h, Chance:ch, CurrencyValue: cv, HouseEdge: houseEdgeValue }).then(function (result) {
2476+
webix.ajax().post('bet', { Currency:c, PayIn:p, High:h, Chance:ch, CurrencyValue: cv, HouseEdge: houseEdgeValue, intervalBetTime:intervalBetTime }).then(function (result) {
24182477
let ret = result.json();
24192478
cb(ret);
24202479
}).fail(function (xhr) {
@@ -2425,6 +2484,9 @@ block content
24252484
webix.message({type: 'error', text: response.err});
24262485
});
24272486
}
2487+
function betinterval(ms) {
2488+
intervalBetTime = ms;
2489+
}
24282490
function checkerr(mess){
24292491
let result = webix.ajax().sync().get('checkerr?mess='+mess+'&count='+errCount );
24302492
let ret = JSON.parse(result.responseText);
@@ -2458,6 +2520,7 @@ block content
24582520
}
24592521
currencyValue = $$("bet_currency_selection").getValue() -1;
24602522
let currentAmount = p/100000000;
2523+
intervalBetTime = $$("auto_bet_interval").getValue();
24612524
action(c,h,p,ch,currencyValue,function(ret) {
24622525
try{
24632526
if(isError(ret)) {
@@ -2665,6 +2728,28 @@ block content
26652728
stopOnWin = false;
26662729
stopOnLoss = false;
26672730
}
2731+
function clearStats(){
2732+
$$('bet_current_stats2').setValues({
2733+
bet_current_stats_current_streak:0,
2734+
bet_current_stats_max_win_streak:0,
2735+
bet_current_stats_max_loss_streak:0,
2736+
bet_current_stats_max_win_streak_amount:0,
2737+
bet_current_stats_max_loss_streak_amount:0,
2738+
bet_current_stats_max_bet_amount:0,
2739+
bet_current_stats_seed:0,
2740+
});
2741+
$$('bet_current_stats3').setValues({
2742+
bet_time:0,
2743+
bets:0,
2744+
bet_profit_per_hour:0,
2745+
bet_profit_per_day:0,
2746+
bet_profit_per_bet:0,
2747+
});
2748+
maxstreakamount = 0;
2749+
minstreakamount = 0;
2750+
stopOnWin = false;
2751+
stopOnLoss = false;
2752+
}
26682753
function refresh(newId) {
26692754
clear(function(userinfo){
26702755
setStats(userinfo, newId-1);
@@ -2673,6 +2758,14 @@ block content
26732758
clearSession();
26742759
});
26752760
}
2761+
function refreshStats(newId) {
2762+
clear(function(userinfo){
2763+
setStats(userinfo, newId-1);
2764+
$$('bet_datatable').clearAll();
2765+
$$("bet_chart_graph").clearAll();
2766+
clearStats();
2767+
});
2768+
}
26762769
function clear(cb){
26772770
$$("bet_chart").showProgress({
26782771
type:"icon",
@@ -2987,8 +3080,12 @@ block content
29873080
' window.resume()\n';
29883081
resetSeedFun = '\ndef resetseed():\n'+
29893082
' window.resetseed()\n';
3083+
betintervalFun = '\ndef betinterval(ms):\n'+
3084+
' window.betinterval(ms)\n';
29903085
resetSessionFun = '\ndef resetsession():\n'+
29913086
' window.resetsession()\n';
3087+
resetStatsFun = '\ndef resetstats():\n'+
3088+
' window.resetstats()\n';
29923089
stopFun = '\ndef stop():\n'+
29933090
' window.isloop = False\n'+
29943091
' global isloop\n'+
@@ -3022,7 +3119,7 @@ block content
30223119
'\ndocument["python_before_bet_button"].bind("click", beforebet)\n'+
30233120
'\ndocument["python_after_bet_button"].bind("click", afterbet)\n'+
30243121
'\ndocument["python_stop_button"].bind("click", stopbet)\n';
3025-
strScript = strScript + messageFun + resetSeedFun + resetSessionFun + soundFun + stopFun + startFun + resumeFun + stopBetFun + beforeBetFun + afterBetFun + clickFun;
3122+
strScript = strScript + messageFun + resetSeedFun + resetSessionFun + resetStatsFun + soundFun + stopFun + startFun + resumeFun + stopBetFun + beforeBetFun + afterBetFun + clickFun + betintervalFun;
30263123

30273124
//console.log("eval python:",strScript);
30283125
let dynamicStr = document.createElement ("script");

0 commit comments

Comments
 (0)