// ==UserScript==
// @name Freebitco.in StatBot
// @namespace https://greasyfork.org/en/users/435604-esinjay
// @version 1.0
// @description This script shows the statistics of previous rolls for each given odd and automatically changes the Client Seed for each roll.
// @author eSinJay
// @license GPL v.3
// @match https://freebitco.in/*
// @run-at document-end
// @grant none
// @downloadURL https://update.greasyfork.icu/scripts/395243/Freebitcoin%20StatBot.user.js
// @updateURL https://update.greasyfork.icu/scripts/395243/Freebitcoin%20StatBot.meta.js
// ==/UserScript==
//------------------------------------------------------------------------ Сonfiguration Values ------------------------------------------------------------------------
const odds = [1.2, 1.5, 2, 4, 6, 8, 10, 12, 16, 24, 32, 48, 94, 452, 4750];
let oddVals = [];
let oddStat = [];
let isBetButtonClicked = false;
let rollsCount = 0;
let tableRowId = 0;
let starterBalance = 0;
let statTableExists = false;
//------------------------------------------------------------------------ Сonfiguration Values ------------------------------------------------------------------------
//------------------------------------------------------------------------ Additional Functions ------------------------------------------------------------------------
function id(id) {
return document.getElementById(id);
}
function createVariableForOdd(odd) {
let hiNum = parseInt(Math.round(10000 - (9500 / parseFloat(odd).toFixed(2))));
let loNum = parseInt(Math.round((9500 / parseFloat(odd).toFixed(2))));
oddVals[odd] = {
hiNum: hiNum,
loNum: loNum
};
oddStat[odd] = {
hiLose: 0,
hiMaxSeqLose: 0,
hiWinCount: 0,
loLose: 0,
loMaxSeqLose: 0,
loWinCount: 0
};
}
function isBetButtonDisabled(mod) {
return id('double_your_btc_bet_' + mod + '_button').getAttribute('disabled');
}
function generateRandomString(comb, minLength, maxLength) {
let randomString = '';
let characters = '';
let numbers = '0123456789';
let upperCaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
let lowerCaseLetters = 'abcdefghijklmnopqrstuvwxyz';
let length = Math.floor(Math.random() * (maxLength - minLength + 1)) + minLength;
if (comb == 'random') comb = Math.floor(Math.random() * 7);
switch (comb) {
case 1:
characters = numbers;
break;
case 2:
characters = upperCaseLetters;
break;
case 3:
characters = lowerCaseLetters;
break;
case 4:
characters = numbers + upperCaseLetters;
break;
case 5:
characters = numbers + lowerCaseLetters;
break;
case 6:
characters = upperCaseLetters + lowerCaseLetters;
break;
default:
characters = numbers + upperCaseLetters + lowerCaseLetters;
}
for (let i = 0; i < length; i++) {
randomString += characters.charAt(Math.floor(Math.random() * characters.length));
}
return randomString;
}
//------------------------------------------------------------------------ Additional Functions ------------------------------------------------------------------------
//------------------------------------------------------------------------------ Main Code -----------------------------------------------------------------------------
let rollStat = {
update: function() {
let currentBalance = (Number(parseFloat(id('balance').textContent)) + Number(parseFloat(id('bonus_account_balance').textContent))).toFixed(8);
let profit = (currentBalance - starterBalance).toFixed(8);
rollsCount += 1;
odds.forEach(this.setVals);
if (statTableExists === false) this.setTable(currentBalance);
id('stat-rolls-count').innerHTML = 'Rolls played : ' + rollsCount;
id('stat-starter-balance').innerHTML = 'Starter balance : ' + starterBalance;
id('stat-current-balance').innerHTML = 'Current balance : ' + currentBalance;
id('stat-profit1').innerHTML = 'Profit : ' + profit;
odds.forEach(function(odd) {
tableRowId += 1;
id('stat-table-td-hilose' + tableRowId).textContent = oddStat[odd].hiLose;
id('stat-table-td-himaxseqlose' + tableRowId).textContent = oddStat[odd].hiMaxSeqLose;
id('stat-table-td-hiwincount' + tableRowId).textContent = oddStat[odd].hiWinCount;
id('stat-table-td-lolose' + tableRowId).textContent = oddStat[odd].loLose;
id('stat-table-td-lomaxseqlose' + tableRowId).textContent = oddStat[odd].loMaxSeqLose;
id('stat-table-td-lowincount' + tableRowId).textContent = oddStat[odd].loWinCount;
});
tableRowId = 0;
},
setVals: function(odd) {
let prevRollNum = parseInt(id('previous_roll').textContent);
if (prevRollNum > oddVals[odd].hiNum) {
oddStat[odd].hiWinCount += 1;
oddStat[odd].hiLose = 0;
} else {
oddStat[odd].hiLose += 1;
if (oddStat[odd].hiLose > oddStat[odd].hiMaxSeqLose) oddStat[odd].hiMaxSeqLose += 1;
}
if (prevRollNum < oddVals[odd].loNum) {
oddStat[odd].loWinCount += 1;
oddStat[odd].loLose = 0;
} else {
oddStat[odd].loLose += 1;
if (oddStat[odd].loLose > oddStat[odd].loMaxSeqLose) oddStat[odd].loMaxSeqLose += 1;
}
},
setTable: function(currentBalance) {
let hStyle = [];
hStyle = document.getElementsByTagName('head');
hStyle[0].insertAdjacentHTML('beforeend',
' ');
id('double_your_btc_main_container_outer').insertAdjacentHTML('afterend', '
Rolls played : ' + rollsCount + ' | Starter balance : ' + starterBalance + ' | Current balance : ' + currentBalance + ' | Profit : ' + (currentBalance - starterBalance).toFixed(8) + ' |
Odd | Target (HI) | Lose | Max Lose | Win Count | Target (LO) | Lose | Max Lose | Win Count |
---|
');
odds.forEach(function(odd) {
tableRowId += 1;
id('stat-table1').insertAdjacentHTML('beforeend', '' + odd + ' | ' + oddVals[odd].hiNum + ' | 0 | 0 | 0 | ' + oddVals[odd].loNum + ' | 0 | 0 | 0 |
');
});
tableRowId = 0;
statTableExists = true;
}
};
function init(mod) {
if (isBetButtonDisabled(mod) == 'disabled') {
isBetButtonClicked = true;
return
} else {
if (isBetButtonClicked === true) {
id('next_client_seed').value = generateRandomString('random', 3, 20);
rollStat.update();
isBetButtonClicked = false;
} else {
return
}
}
}
id('double_your_btc_bet_hi_button').addEventListener("DOMSubtreeModified", function() {
init('hi');
});
id('double_your_btc_bet_lo_button').addEventListener("DOMSubtreeModified", function() {
init('lo');
});
starterBalance = (Number(parseFloat(id('balance').textContent)) + Number(parseFloat(id('bonus_account_balance').textContent))).toFixed(8);
odds.forEach(createVariableForOdd);
rollStat.setTable(starterBalance);
//------------------------------------------------------------------------------ Main Code -----------------------------------------------------------------------------