Skip to content

Commit 672e7de

Browse files
author
bot
committed
fix API of prime & stake; save previous auto mode settings
1 parent becd3a4 commit 672e7de

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
* [Freebitco.in](https://freebitco.in/?r=16392656)
4848
* [PrimeDice](https://primedice.com/?c=mydicebot)
4949
* [Stake](https://stake.com/?code=mydicebot)
50-
* [YoloDice](https://yolodice.com/r?6fAf-wVz)
5150
* [WinDice](https://windice.io/?r=e63q8xq4y)
51+
* [WolfBet](https://wolf.bet/?c=mydicebot)
52+
* [YoloDice](https://yolodice.com/r?6fAf-wVz)
53+
5254
## Blockchain - STEEM
5355
* [EpicDice](https://epicdice.io/?ref=mydicebot)
5456
* [KryptoGames](https://kryptogamers.com/?ref=mydicebot)

src/api/models/prime.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = class PrimeDice extends BaseDice {
3131
if(!info){
3232
return false;
3333
}
34-
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
34+
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
3535
let ret = await this._send('', 'POST', data, req.session.accessToken);
3636
ret = ret.user;
3737
let userinfo = {
@@ -53,7 +53,7 @@ module.exports = class PrimeDice extends BaseDice {
5353
userinfo.wins = ret.statistic[i].wins;
5454
userinfo.bets = ret.statistic[i].bets;
5555
userinfo.losses = ret.statistic[i].losses;
56-
userinfo.wagered = parseFloat(ret.statistic[i].amount).toFixed(8);
56+
userinfo.wagered = parseFloat(ret.statistic[i].betAmount).toFixed(8);
5757
}
5858
}
5959
userinfo.success = 'true';
@@ -64,7 +64,7 @@ module.exports = class PrimeDice extends BaseDice {
6464

6565
async clear(req) {
6666
console.log('loading....');
67-
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
67+
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
6868
let ret = await this._send('', 'POST', data, req.session.accessToken);
6969
ret=ret.user;
7070
let info = {};
@@ -98,7 +98,7 @@ module.exports = class PrimeDice extends BaseDice {
9898
userinfo.wins = ret.statistic[i].wins;
9999
userinfo.bets = ret.statistic[i].bets;
100100
userinfo.losses = ret.statistic[i].losses;
101-
userinfo.wagered = parseFloat(ret.statistic[i].amount).toFixed(8);
101+
userinfo.wagered = parseFloat(ret.statistic[i].betAmount).toFixed(8);
102102
}
103103
}
104104
userinfo.success = 'true';
@@ -118,7 +118,7 @@ module.exports = class PrimeDice extends BaseDice {
118118
target = Math.floor((req.body.Chance*100));
119119
}
120120
target = parseFloat(target/100).toFixed(2);
121-
let data = " mutation{primediceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGamePrimedice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses amount profit currency}}}}";
121+
let data = " mutation{primediceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGamePrimedice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profit currency}}}}";
122122
let ret = await this._send('', 'POST', data, req.session.accessToken);
123123
let info = req.session.info;
124124
let betInfo = ret.primediceRoll;

src/api/models/stake.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = class StakeDice extends BaseDice {
1414
}
1515

1616
async login(userName, password, twoFactor ,apiKey, req) {
17-
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
17+
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
1818
let ret = await this._send('', 'POST', data, apiKey);
1919
req.session.accessToken = apiKey;
2020
req.session.username = apiKey;
@@ -31,7 +31,7 @@ module.exports = class StakeDice extends BaseDice {
3131
if(!info){
3232
return false;
3333
}
34-
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
34+
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
3535
let ret = await this._send('', 'POST', data, req.session.accessToken);
3636
ret = ret.user;
3737
let userinfo = {
@@ -53,7 +53,7 @@ module.exports = class StakeDice extends BaseDice {
5353
userinfo.wins = ret.statistic[i].wins;
5454
userinfo.bets = ret.statistic[i].bets;
5555
userinfo.losses = ret.statistic[i].losses;
56-
userinfo.wagered = parseFloat(ret.statistic[i].amount).toFixed(8);
56+
userinfo.wagered = parseFloat(ret.statistic[i].betAmount).toFixed(8);
5757
}
5858
}
5959
userinfo.success = 'true';
@@ -64,7 +64,7 @@ module.exports = class StakeDice extends BaseDice {
6464

6565
async clear(req) {
6666
console.log('loading....');
67-
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
67+
let data = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
6868
let ret = await this._send('', 'POST', data, req.session.accessToken);
6969
ret=ret.user;
7070
let info = {};
@@ -98,7 +98,7 @@ module.exports = class StakeDice extends BaseDice {
9898
userinfo.wins = ret.statistic[i].wins;
9999
userinfo.bets = ret.statistic[i].bets;
100100
userinfo.losses = ret.statistic[i].losses;
101-
userinfo.wagered = parseFloat(ret.statistic[i].amount).toFixed(8);
101+
userinfo.wagered = parseFloat(ret.statistic[i].betAmount).toFixed(8);
102102
}
103103
}
104104
userinfo.success = 'true';
@@ -118,7 +118,7 @@ module.exports = class StakeDice extends BaseDice {
118118
target = Math.floor((req.body.Chance*10000))-1;
119119
}
120120
target = parseFloat(target/10000).toFixed(2);
121-
let data = " mutation{diceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGameDice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses amount profit currency}}}}";
121+
let data = " mutation{diceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGameDice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profit currency}}}}";
122122
let ret = await this._send('', 'POST', data, req.session.accessToken);
123123
let info = req.session.info;
124124
let betInfo = ret.diceRoll;

src/views/info.pug

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,11 @@ block content
15681568
isloop = false;
15691569
$$("auto_bet_start_stop_button").setValue('START');
15701570
} else {
1571+
$$("auto_bet_form").serialize(function(m){
1572+
if(typeof m.data.value != "undefined") {
1573+
webix.storage.local.put("mydice_"+ m.data.id, m.data.value);
1574+
}
1575+
});
15711576
$$("auto_bet_start_stop_button").setValue('STOP');
15721577
autoBet();
15731578
isloop = true;
@@ -1711,7 +1716,17 @@ block content
17111716
}
17121717
webix.html.addStyle(".webix_primary{ z-index:10; }");
17131718
initPythonButton();
1719+
initAutoBetFormState();
17141720
});
1721+
function initAutoBetFormState(){
1722+
$$("auto_bet_form").serialize(function(m){
1723+
if(typeof m.data.value != "undefined") {
1724+
if(webix.storage.local.get("mydice_"+m.data.id)){
1725+
$$(m.data.id).setValue(webix.storage.local.get("mydice_"+m.data.id));
1726+
}
1727+
}
1728+
});
1729+
}
17151730
function initPythonButton(){
17161731
let btn = document.createElement("BUTTON");
17171732
btn.innerHTML = "click me";

0 commit comments

Comments
 (0)