SHOW:
|
|
- or go back to the newest paste.
1 | //COMMAND// | |
2 | //changeBet() ex: changeBet('0.00000005'); | |
3 | ||
4 | console.clear(); | |
5 | var startbalance = 0; | |
6 | var stopAt= '?'; | |
7 | var round = 0; | |
8 | var gameLost=0; | |
9 | var gameWin=0; | |
10 | var higherbet=0; | |
11 | startbalance = $('#balance').text(); | |
12 | var startValue = '0.00000001', // Don't lower the decimal point more than 4x of current balance | |
13 | stopPercentage = 0.001, // In %. I wouldn't recommend going past 0.08 | |
14 | maxWait = 500, // In milliseconds | |
15 | stopped = false, | |
16 | stopBefore = 3; // In minutes | |
17 | var oldbet= 0.00000001; | |
18 | document.getElementById("advertise_link_li").innerHTML = '<a href="#" onclick="startGame()" class="advertise_link">START BOT</a>'; | |
19 | var $loButton = $('#double_your_btc_bet_lo_button'), | |
20 | $hiButton = $('#double_your_btc_bet_hi_button'); | |
21 | ||
22 | function higherBet(){ | |
23 | console.log('Highest bet: '+higherbet); | |
24 | } | |
25 | ||
26 | function changeBet(bet){ | |
27 | startValue=bet; | |
28 | } | |
29 | ||
30 | function realtime(time) { | |
31 | var sec_num =parseInt(time, 10) ; // don't forget the second param | |
32 | var hours = Math.floor(sec_num / 3600); | |
33 | var minutes = Math.floor((sec_num - (hours * 3600)) / 60); | |
34 | var seconds = sec_num - (hours * 3600) - (minutes * 60); | |
35 | ||
36 | if (hours!=0) {hours = hours+' Hours ';} else{hours = '';} | |
37 | ||
38 | if (minutes!=0) {minutes = minutes+' Minutes ';} | |
39 | else{minutes = '';} | |
40 | ||
41 | ||
42 | if (seconds < 10) {seconds = seconds;} | |
43 | var time = 'Playing time = '+hours+minutes+seconds+' Secondes'; | |
44 | return time; | |
45 | } | |
46 | ||
47 | function roundnumb(){ | |
48 | console.clear(); | |
49 | if( round == stopAt) | |
50 | { | |
51 | stopGame() | |
52 | } | |
53 | else | |
54 | { | |
55 | round = round + 1; | |
56 | console.log('Round #' + round + ' / ' + stopAt); | |
57 | } | |
58 | ||
59 | var newbalance= $('#balance').text() | |
60 | var profit = (Number(newbalance) - Number(startbalance)).toFixed(8) ; | |
61 | console.log('Profit:' + profit + ' Bitcoin') | |
62 | } | |
63 | //Number of round. Type stopatRound(NUMBER_OF_ROUND) to change | |
64 | //function stopatRound(limitRound){ | |
65 | //stopAt=limitRound; | |
66 | //} | |
67 | function multiply(){ | |
68 | var current = $('#double_your_btc_stake').val(); | |
69 | var multiply = (current * 2).toFixed(8); | |
70 | $('#double_your_btc_stake').val(multiply); | |
71 | console.log('Bet = ' + multiply); | |
72 | if( higherbet < multiply ){ higherbet=multiply; } | |
73 | } | |
74 | function getRandomWait(){ | |
75 | var wait = Math.floor(Math.random() * maxWait ) + 100; //(Math.floor(Math.random() * 800) + 300) ; // avant 100 | |
76 | console.log('Waiting for ' + wait + 'ms before next bet.'); | |
77 | return wait ; | |
78 | } | |
79 | function startGame(limit){ | |
80 | document.getElementById("advertise_link_li").innerHTML = '<a href="#" onclick="stopGame()" class="advertise_link">STOP BOT</a>'; | |
81 | starttime=(new Date()).getTime(); | |
82 | startValue = prompt("Number of satoshi you want to bet?", '0.00000001'); | |
83 | oldbet=startValue; | |
84 | ||
85 | round = 0; | |
86 | gameLost=0; | |
87 | gameWin=0; | |
88 | console.log('Game started!'); | |
89 | reset(); | |
90 | $loButton.trigger('click'); | |
91 | if(limit !== null) { | |
92 | stopAt=limit; | |
93 | } | |
94 | else | |
95 | { | |
96 | stopAt=-1; | |
97 | } | |
98 | ||
99 | } | |
100 | function stopGame(){ | |
101 | document.getElementById("advertise_link_li").innerHTML = '<a href="#" onclick="startGame()" class="advertise_link">START BOT</a>'; | |
102 | console.log('Game will stop soon! Let me finish.'); | |
103 | stopped = true; | |
104 | startValue=oldbet; | |
105 | ||
106 | } | |
107 | ||
108 | function reset(){ | |
109 | if( round % 100 === 0 && round !=0) | |
110 | { | |
111 | startValue=(startValue * 1.000).toFixed(8); //New bet after 100 round | |
112 | console.log('Round ' + round + ': bet change for ' + startValue); | |
113 | } | |
114 | $('#double_your_btc_stake').val(startValue); | |
115 | } | |
116 | // quick and dirty hack if you have very little bitcoins like 0.0000001 | |
117 | function deexponentize(number){ | |
118 | return number * 1000000; | |
119 | } | |
120 | function iHaveEnoughMoni(){ | |
121 | var balance = deexponentize(parseFloat($('#balance').text())); | |
122 | var current = deexponentize($('#double_your_btc_stake').val()); | |
123 | return ((balance*2)/100) * (current*2) > stopPercentage/100; | |
124 | } | |
125 | function stopBeforeRedirect(){ | |
126 | var minutes = parseInt($('title').text()); | |
127 | if( minutes < stopBefore ) | |
128 | { | |
129 | console.log('Approaching redirect! Stop the game so we don\'t get redirected while loosing.'); | |
130 | stopGame(); | |
131 | return true; | |
132 | } | |
133 | return false; | |
134 | } | |
135 | // Unbind old shit | |
136 | $('#double_your_btc_bet_lose').unbind(); | |
137 | $('#double_your_btc_bet_win').unbind(); | |
138 | // Loser | |
139 | $('#double_your_btc_bet_lose').bind("DOMSubtreeModified",function(event){ | |
140 | ||
141 | if( $(event.currentTarget).is(':contains("lose")') ) | |
142 | { | |
143 | gameLost = gameLost + 1; | |
144 | roundnumb(); | |
145 | console.log('%cWin: ' + gameWin + ' Lost: ' + gameLost, 'color: #00CC00'); | |
146 | endtime=(new Date()).getTime(); | |
147 | var time=Math.floor((endtime-starttime )/1000); | |
148 | higherBet(); | |
149 | console.log(realtime(time)); | |
150 | console.log('You LOST!'); | |
151 | multiply(); | |
152 | setTimeout(function(){ | |
153 | $loButton.trigger('click'); | |
154 | }, getRandomWait()); | |
155 | //$loButton.trigger('click'); | |
156 | } | |
157 | ||
158 | } | |
159 | ||
160 | ); | |
161 | // Winner | |
162 | $('#double_your_btc_bet_win').bind("DOMSubtreeModified",function(event){ | |
163 | if( $(event.currentTarget).is(':contains("win")') ) | |
164 | { | |
165 | ||
166 | gameWin = gameWin + 1; | |
167 | roundnumb(); | |
168 | console.log('%cWin: ' + gameWin + ' Lost: ' + gameLost, 'color: #FF0000'); | |
169 | endtime=(new Date()).getTime(); | |
170 | var time=Math.floor((endtime-starttime )/1000); | |
171 | console.log(realtime(time)); | |
172 | higherBet(); | |
173 | if( stopBeforeRedirect() ) | |
174 | { | |
175 | return; | |
176 | } | |
177 | if( iHaveEnoughMoni() ) | |
178 | { | |
179 | ||
180 | console.log('You WON!'); | |
181 | reset(); | |
182 | if( stopped ) | |
183 | { | |
184 | stopped = false; | |
185 | return false; | |
186 | } | |
187 | } | |
188 | else | |
189 | { | |
190 | console.log('You WON! '); | |
191 | } | |
192 | setTimeout(function(){ | |
193 | $loButton.trigger('click'); | |
194 | }, getRandomWait()); | |
195 | } | |
196 | ||
197 | } | |
198 | ); |