Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 33

// ==UserScript==

// @name Coxy's Predictor


// @namespace http://tampermonkey.net/
// @version Remade
// @description A free predictor for you to use. Enjoy :)
// @author Made by coxy57 & bitzk & cyber
// @match https://*.bloxflip.com/*
// @require https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest
// @require
https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.10.1/sha256.min.js
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// ==/UserScript==

(function () {
'use strict';
// vars
var slider_val = "1";
var tower_val = "1";
var bombvar = false;
var newcolor = "";
let update = document.createElement('div');
var menuContainer = document.createElement('div');
var changeColor = document.createElement('input');
var guiContent = document.createElement('div');
let currentMethod = "pastGames";
let credits = {
'made_by': 'coxy57'
}
// vars

GM_addStyle(`
@keyframes textGlow {
0% { text-shadow: 0 0 15px #ff00ff, 0 0 30px #ff00ff, 0 0 45px #ff00ff;
opacity: 1; }
50% { text-shadow: 0 0 30px #ff00ff, 0 0 45px #ff00ff, 0 0 60px
#ff00ff; opacity: 0.8; }
100% { text-shadow: 0 0 15px #ff00ff, 0 0 30px #ff00ff, 0 0 45px
#ff00ff; opacity: 0; }
}
.coxy57 {
}
#towerGlow {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #01ff70;
width: 100px;
height: 100px;
border-radius: 10px;
box-shadow: 0 0 10px 5px #01ff70;
animation: glowEffect 2s infinite alternate;
}

@keyframes glowEffect {
0% {
box-shadow: 0 0 10px 5px #01ff70;
}
100% {
box-shadow: 0 0 30px 15px #01ff70;
}
}
#overlay {
position: fixed;
top: 18px;
right: 600px;
display: flex;
justify-content: space-around;
align-items: center;
z-index: 9999;
}

#buttonsContainer {
display: flex;
gap: 1em;
}
#customg {
margin-bottom: 15px;
position: fixed;
bottom: 0;
left: 10px;
width: calc(100% - 20px);
background-color: white;
display: flex;
justify-content: space-between;
padding: 10px;
font-size: 20px;
z-index: 9999;
border-radius: 15px;
}
.custom-ele {
color: black;
cursor: pointer;
margin: 0 10px;
transition: background-color 0.3s ease;
border-radius: 5px;
}
.custom-ele:hover {
background-color: #cccccc;
border-radius: 5px;
}
.custom-ele.clicked {
background-color: #cccccc;
border-radius: 5px;
}

.custom-button {
border-radius: 7px;
background-color: rgb(40, 46, 84);
color: #8690BF;
border: none;
padding: 10px 22px;
cursor: pointer;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10px;
}

.custom-button:hover {
background-color: rgb(30, 36, 64);
}
.coxy57test {
}
#guiContainer {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%
height: 100%
background: rgba(0, 0, 0, 0.7);
z-index: 9999;
}

#guiContent {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
height 2000px;
background: linear-gradient(45deg, #8e44ad, #9b59b6, #a569bd, #bb8fce,
#d2b4e9);
border-radius: 10px;
padding: 20px;
color: #FFF;
z-index: 10000;
}

#guiTitle {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
text-align: center;
}
#guiMonkeyCoxy57 {
font-size: 10px;
margin-bottom: 10px;
}

.gui-button-container {
display: flex;
justify-content: space-around;
margin-top: 20px;
}

.gui-button {
background-color: #fff;
color: #3498db;
padding: 12px;
margin: 8px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s, color 0.3s;
font-weight: bold;
}

.gui-button:hover {
background-color: #1e2440;
}

#closeButton {
position: absolute;
top: 10px;
right: 10px;
width: 30px;
height: 30px;
background-color: red;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
color: black;
background-color: #2c344e;
color: #fff;
transition: background-color 0.3s, color 0.3s;
}

.slider {
width: 100%;
}

#nigga {
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
background: linear-gradient(45deg, #8e44ad, #9b59b6, #a569bd, #bb8fce,
#d2b4e9);
color: #FFF;
font-weight: bold;
cursor: pointer;
}

button:hover {
background-color: #5e6a9f;
}

#main-menu {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 9999;
display: flex;
flex-direction: column;
width: 300px;
height: 550px;
padding: 20px;
background: #6495ED;
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
color: #fff;
}

#main-title {
color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}

#settings-item {
color: #3498db;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 20px;
font-weight: bold;
background-color: white;
margin-bottom: 10px;
border-radius: 8px;
padding: 5px;
}

#basic-title {
color: #fff;
display: flex;
font-size: 15px;
font-weight: bold;
align-items: center;
border: none;
border-radius: 8px;
}

#settings-icon {
cursor: pointer;
font-size: 20px;
}

.button-x {
font-weight: bold;
background-color: #fff;
color: #3498db;
padding: 12px;
margin: 8px;
border: none;
margin-bottom: 15px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s, color 0.3s;
}
.button-notif {
margin-top: 10px;
width: 150px;
height: 50px;
padding: 10px;
font-size: 15px;
background-color: #fff;
color: #6495ED;
border: 1px solid #6495ED;
border-radius: 5px;
cursor: pointer;
}

.button-x:hover {
background-color: #1e2440;
}

#main-content {
margin-top: 10px;
}

#button-section {
display: flex;
flex-direction: column;
}
#notificationBox {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 400px;
height: 200px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px;
border: 1px solid gray;
z-index: 9999;
background-color: #6495ED;
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
color: #fff;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}

#notificationBox.show {
opacity: 1;
}
.notificationLabel {
font-size: 18px;
font-weight: bold;
text-align: center;
display: block;

}
.mines-highlight {
background-color: lightgreen;
box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
transition: background-color 0.5s ease, box-shadow 0.3s ease;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}

.mines-highlight:hover {
animation: pulse 1s infinite;
}

.cartoontxt {
font-family: 'Comic Sans MS', cursive, sans-serif;
font-size: 36px;
font-weight: bold;
color: white;
text-align: center;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.glowing-background {
box-shadow: 0 0 10px 2px #00ff00;
}
@keyframes glow {
0% {
box-shadow: 0 0 10px 5px rgba(0, 255, 0, 0.8);
}
100% {
box-shadow: 0 0 20px 10px rgba(0, 255, 0, 0.2);
}
}
`);
// credits go to coxy.57 for the mine prediction
function load_presets() {
const tower = localStorage.getItem('coxypredtowers');
const mines = localStorage.getItem('coxypredmines');
const theme = localStorage.getItem('coxypredtheme');
if (tower) {
tower_val = tower.toString();
}
if (mines) {
slider_val = mines.toString()
}
if (theme) {
changeColor.style.value = theme.toString();
menuContainer.style.background = theme.toString();
guiContent.style.background = theme.toString();
}
}
function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function checkingame(callback,gamemode) {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/' + gamemode,
onload: function (response) {
const ingame = JSON.parse(response.responseText);
const g = ingame.hasGame
callback(g)
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
function glowEle(element) {
element.classList.add('glowing-background');
}
function notification(t) {
const box = document.createElement('div');
const text = document.createElement('label');
text.textContent = t;
text.className = "notificationLabel"

const button = document.createElement('button');


button.textContent = "Ok, I understand.";
button.className = "button-notif";

box.id = "notificationBox";

box.appendChild(text);
box.appendChild(button);
document.body.appendChild(box);

setTimeout(function() {
box.classList.add('show');
}, 100);

const removeButtonClicked = false;


button.addEventListener('click', function() {
box.classList.remove('show');
box.remove();
removeButtonClicked = true;
});
setTimeout(function() {
const get_box = document.getElementById('notificationBox');
if (get_box && !removeButtonClicked) {
get_box.classList.remove('show');
get_box.remove();
}
},10000);
}

function saveData(b,item) {
localStorage.setItem("coxypred" + b,item);
}
function towersPred(difficulty) {
const size = 1000;
const num = 0;
const apiurl = `https://api.bloxflip.com/games/towers/history?size=$
{size}&page=${num}`;

switch (currentMethod) {
case "pastGames":
GM_xmlhttpRequest({
method: "GET",
url: apiurl,
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const made_by = ["coxy_57"];
const data = JSON.parse(response.responseText);
const new_data = data.data;
const filter_data = new_data.filter(item =>
item.completedLevels.length >= 1);
const final = filter_data[0].towerLevels;
update.style.fontSize = "13px";
const nn = final.flatMap((row, rowIndex) =>
row.map((element, colIndex) => {
const value = element === 1 ? '✅' : element === 0 ? '❌'
: element;
return colIndex !== row.length - 1 ? value : (colIndex
% 3 === 2) ? value + '<br>' : value;
})
);
update.innerHTML = nn.join('');

for (let i = 0; i < final.length; i++) {


let towerLevel = final[i];

for (let j = 0; j < towerLevel.length; j++) {


const d = towerLevel[j];
const path = `#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g >
div > div > div:nth-child(${i + 1}) > div:nth-child(${j + 1}) > button`;
var get = document.querySelector(path);
if (get) {
get.style.backgroundColor = d === 1 ?
glowEle(get) : get.classList.remove('glowing-background');
} else {
get.id = "";
}
}
}
},
onerror: function (response) {
console.error('An error has occurred');
}
});
break;

case "Neighbors":
GM_xmlhttpRequest({
method: "GET",
url: apiurl,
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const made_by = ["coxy_57"];
const data = JSON.parse(response.responseText);
const new_data = data.data;
const filter_data = new_data.filter(item =>
item.completedLevels.length >= 1);
const final = filter_data[0].towerLevels;
const towerNigga = []
for (let i = 0; i < final.length; i++) {
let towerLevel = final[i]
const get_safes = towerLevel.reduce((acc, value, index)
=> (value === 0 ? acc.concat(index) : acc), []);
const eq = Math.abs((get_safes[0] + get_safes[1]))
const n = Math.min(eq,2);
const newRow = new Array(3).fill(0);
newRow[n] = 1
towerNigga.push(newRow)
}
update.style.fontSize = "13px";
const nn = towerNigga.flatMap((row, rowIndex) =>
row.map((element, colIndex) => {
const value = element === 1 ? '✅' : element === 0 ? '❌'
: element;
return colIndex !== row.length - 1 ? value : (colIndex
% 3 === 2) ? value + '<br>' : value;
})
);
update.innerHTML = nn.join('');

for (let i = 0; i < towerNigga.length; i++) {


let towerLevel = towerNigga[i];

for (let j = 0; j < towerLevel.length; j++) {


const d = towerLevel[j];
const path = `#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g >
div > div > div:nth-child(${i + 1}) > div:nth-child(${j + 1}) > button`;
var get = document.querySelector(path);
if (get) {
get.style.backgroundColor = d === 1 ?
glowEle(get) : get.classList.remove('glowing-background');
} else {
get.classList.remove('glowing-background');
}
}
}
},
onerror: function (response) {
console.error('An error has occurred');
}
});
break;
case "CoxyAlgorithm":
GM_xmlhttpRequest({
method: "GET",
url: apiurl,
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const made_by = ["coxy_57"];
const data = JSON.parse(response.responseText);
const new_data = data.data;
const filter_data = new_data.filter(item =>
item.completedLevels.length >= 1);
const final = filter_data[0].towerLevels;
const towerNigga = []
for (let i = 0; i < final.length; i++) {
let towerLevel = final[i]
const get_safes = towerLevel.reduce((acc, value, index)
=> (value === 0 ? acc.concat(index) : acc), []);
// coxy shit right here my nigga
const coxy_57_0 = towerLevel.indexOf(1);
const eq = Math.abs((get_safes[0] + get_safes[1] -
coxy_57_0 + get_safes[0] - 1 + (coxy_57_0 * get_safes[1])))
const n = Math.min(Math.max(0,eq),2);
console.log(n);
const newRow = new Array(3).fill(0);
newRow[n] = 1
towerNigga.push(newRow)
}
update.style.fontSize = "13px";
const nn = towerNigga.flatMap((row, rowIndex) =>
row.map((element, colIndex) => {
const value = element === 1 ? '✅' : element === 0 ? '❌'
: element;
return colIndex !== row.length - 1 ? value : (colIndex
% 3 === 2) ? value + '<br>' : value;
})
);
update.innerHTML = nn.join('');

for (let i = 0; i < towerNigga.length; i++) {


let towerLevel = towerNigga[i];

for (let j = 0; j < towerLevel.length; j++) {


const d = towerLevel[j];
const path = `#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g >
div > div > div:nth-child(${i + 1}) > div:nth-child(${j + 1}) > button`;
var get = document.querySelector(path);
if (get) {
get.style.backgroundColor = d === 1 ?
glowEle(get) : get.classList.remove('glowing-background');
} else {
get.classList.remove('glowing-background');
}
}
}
},
onerror: function (response) {
console.error('An error has occurred');
}
});
break;
}
}

function towersAutoPlay(leavegamebtn) {
const size = 1000;
const num = 0;
const apiurl = `https://api.bloxflip.com/games/towers/history?size=$
{size}&page=${num}`;

GM_xmlhttpRequest({
method: "GET",
url: apiurl,
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const made_by = ["coxy_57"];
const data = JSON.parse(response.responseText);
const new_data = data.data;
const filter_data = new_data.filter(item =>
item.completedLevels.length >= 1);
const final = filter_data[0].towerLevels;
var checker = 0;

for (let i = 0; i < final.length; i++) {


let towerLevel = final[i];

for (let j = 0; j < towerLevel.length; j++) {


const d = towerLevel[j];
const path = `#__next > div.layout_layout__JvcqL > div >
div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR > div.game-
layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g > div > div
> div:nth-child(${i + 1}) > div:nth-child(${j + 1}) > button`;
var get = document.querySelector(path);
if (get && checker < parseInt(tower_val)) {
if (d===1) {
setTimeout(function() {
get.click()
},1000)
checker++;
}
} else {
break;
}
}
}
checkingame(function(response) {
if (response) {
setTimeout(function() {
leavegamebtn.click();
// coxy 57 is very cool
},4000);
} else {
console.log('I love coxy57!');
console.log('Not in game, you have died.');
}
},'towers');
},
onerror: function (response) {
console.error('An error has occurred');
}
});
}

function autoplayMines(mineAmount,j) {
// credits go to coxy.57 for the mine prediction
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines/history?size=5000&page=0',
onload: function (response) {
const getbomb = JSON.parse(response.responseText);
const mines = getbomb.data.filter(item => item.minesAmount === mineAmount);
const minelocs = mines.map(item => item.mineLocations)
var on = minelocs.flatMap(row => row).slice(0,13);
const dix = document.querySelector('#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g >
div > div');
if (dix) {
var coxy57 = 0;
// credits go to coxy.57 for the mine prediction
const spots = dix.querySelectorAll('button');
for (const s of on) {
if (coxy57 < parseInt(slider_val)) {
spots[s].click();
coxy57 ++;
// credits go to coxy.57 for the mine prediction
} else {
break;
}
};
checkingame(function (response) {
if (response) {
console.log('clicked');

setTimeout(function () {
j.click();
},4000);
} else {
console.log('Not in game. You have died.');
}
});
} else {
// credits go to coxy.57 for the mine prediction
console.log('Could not get DIV.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
function calculateDistance(pt1, pt2) {
const x1 = Math.floor(pt1 / 5);
const y1 = pt1 % 5;
const x2 = Math.floor(pt2 / 5);
const y2 = pt2 % 5;
return Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
}
function bombLocationAlgo(mineAmount) {
// credits go to coxy.57 for the mine prediction
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines/history?size=5000&page=0',
onload: function (response) {
const getbomb = JSON.parse(response.responseText);
const mines = getbomb.data.filter(item => item.minesAmount === mineAmount);
const minelocs = mines.map(item => item.uncoveredLocations)
var on = minelocs.flatMap(row => row).slice(0,13);
const dix = document.querySelector('#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnRight__oj_7g >
div > div');
if (dix) {
var coxy57 = 0;
// credits go to coxy.57 for the mine prediction
const spots = dix.querySelectorAll('button');
for (const button of on) {
if (coxy57 < parseInt(slider_val)) {
spots[button].style.boxShadow = '0 0 30px #ff0000, 0 0 20px #ff0000,
0 0 30px #ff0000';
coxy57 += 1;
} else {
break;
}
};
} else {
// credits go to coxy.57 for the mine prediction
console.log('Could not get DIV.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
function caculateAverage(data) {
const weights = [1, 2, 1, 3];
const weightn = weights && weights.length === data.length
? data.map((num, i) => num * weights[i])
: data;
const sortedn = [...weightn].sort((a, b) => a - b);
const trimmed = Math.round(10 * sortedn.length / 100);
const getfinal = sortedn.slice(trimmed, sortedn.length - trimmed);

const sumnums = getfinal.reduce((acc, num) => acc + num, 0);


const average = sumnums / getfinal.length;

return Number(average.toFixed(3));
}
function crashPred(history) {
switch (currentMethod) {
case "pastGames":
var c = history.map(item => item.crashPoint);
var prediction = caculateAverage(c)
notification('Predicted Crashpoint: ' + prediction)
break;
case "Neighbors":
break;
default:
console.log(currentMethod)
}
}
function roulettePred(history, currentMethod) {
switch (currentMethod) {
case "pastGames": {
const colors = history.map(item => item.winningColor);

function train_model(data) {
const model = {};

for (let i = 0; i < data.length - 1; i++) {


const cc = data[i];
const nc = data[i + 1];

if (!model[cc]) {
model[cc] = {};
}

if (!model[cc][nc]) {
model[cc][nc] = 1;
} else {
model[cc][nc]++;
}
}

for (const color in model) {


const transx = model[color];
const tt = Object.values(transx).reduce((sum, count) => sum
+ count, 0);

for (const next in transx) {


transx[next] /= tt;
}
}

return model;
}

function initalize_color(data, model) {


const last = data[data.length - 1];
const possible = model[last];

if (!possible) {
const counts = data.reduce((acc, color) => {
acc[color] = (acc[color] || 0) + 1;
return acc;
}, {});

const freq = Object.keys(counts).reduce((a, b) =>


(counts[a] > counts[b] ? a : b));
return freq
}

const vd = Math.random();
let probability = 0;

for (const n in possible) {


probability += possible[n];
if (vd <= probability) {
return n;
}
}

return last;
}

const model = train_model(colors);


const predict = initalize_color(colors, model);

if (predict) {
notification('Predicted color: ' + predict);
} else {
notification('An error occurred while trying to predict
color.');
}

break;
}

case "Neighbors":
console.log('neighbor not working yet');
// Implement Neighbors case here
break;

default:
console.log(currentMethod);
}
}
function minesPred(mineAmount) {
switch (currentMethod) {
case "pastGames":
// Credits go to coxy.57 for the mine prediction
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines/history?
size=5000&page=0',
onload: function (response) {
update.style.marginLeft = "0px";
const getbomb = JSON.parse(response.responseText);
const mines = getbomb.data.filter(item => item.minesAmount
=== mineAmount);
const minelocs = mines.map(item => item.mineLocations)
var on = minelocs.flatMap(row => row).slice(0, 13);
var org = 0
const fit = Array.from({ length: 25 }).fill(0);
for (const button of on) {
if (org < parseInt(slider_val)) {
fit[button] = 1
org++
} else {
break;
}
}
const rr = fit
.map(bit => (bit === 1 ? '✔️
' : '❌'))
.map((symbol, index) => (index % 5 === 4 ? symbol +
'<br>' : symbol))
.join('');
update.innerHTML = rr;
const dix = document.querySelector('#__next >
div.layout_layout__JvcqL > div > div.layout_layoutColumn__e9oxs > div.game-
layout_gameLayout__bgIOR > div.game-layout_gameLayoutColumn__q01vS.game-
layout_gameLayoutColumnRight__oj_7g > div > div');
if (dix) {
var coxy57 = 0;
// Credits go to coxy.57 for the mine prediction
const spots = dix.querySelectorAll('button');
spots.forEach(button => {
button.classList.remove('mines-highlight');
});
if (bombvar) {
bombLocationAlgo(mineAmount);
}
for (const button of on) {
if (coxy57 < parseInt(slider_val)) {
spots[button].classList.add('mines-highlight');
coxy57 += 1;
} else {
break;
}
};
update.style.marginLeft = "10px";
} else {
// Credits go to coxy.57 for the mine prediction
console.log('Could not get DIV.');
}
},
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
break;

case "Neighbors":
// Credits go to coxy.57 for the mine prediction
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines/history?
size=5000&page=0',
onload: function (response) {
update.style.marginLeft = "0px";
const getbomb = JSON.parse(response.responseText);
const mines = getbomb.data.filter(item => item.minesAmount
=== mineAmount);
const minelocs = mines.map(item => item.uncoveredLocations)
var on = minelocs.flatMap(row => row).slice(0, 100);
var org = 0
const fit = Array.from({ length: 25 }).fill(0);
for (const button of on) {
if (org < parseInt(slider_val)) {
try {
fit[button] = 1
org++
} catch (e) {
console.log(e);
}
} else {
break;
}
}
const rr = fit
.map(bit => (bit === 1 ? ' ' : '❌'))
.map((symbol, index) => (index % 5 === 4 ? symbol +
'<br>' : symbol))
.join('');
update.innerHTML = rr;
const dix = document.querySelector('#__next >
div.layout_layout__JvcqL > div > div.layout_layoutColumn__e9oxs > div.game-
layout_gameLayout__bgIOR > div.game-layout_gameLayoutColumn__q01vS.game-
layout_gameLayoutColumnRight__oj_7g > div > div');
if (dix) {
var coxy57 = 0;
// Credits go to coxy.57 for the mine prediction
const spots = dix.querySelectorAll('button');
spots.forEach(button => {
button.classList.remove('mines-highlight');
});
if (bombvar) {
bombLocationAlgo(mineAmount);
}
for (const button of on) {
if (coxy57 < parseInt(slider_val)) {
spots[button].classList.add('mines-highlight');
coxy57 += 1;
} else {
break;
}
};
update.style.marginLeft = "10px";
} else {
// Credits go to coxy.57 for the mine prediction
console.log('Could not get DIV.');
}
},
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
break;
case "CoxyAlgorithm":
// Credits go to coxy.57 for the mine prediction
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines/history?
size=5000&page=0',
onload: function (response) {
update.style.marginLeft = "0px";
const getbomb = JSON.parse(response.responseText);
const mines = getbomb.data.filter(item => item.minesAmount
=== mineAmount);
const minelocs = mines.map(item => item.mineLocations)
var on = minelocs.flatMap(row => row).slice(0, 100);
var org = 0
const fit = Array.from({ length: 25 }).fill(0);
let counter = 0;
for (let i = 0; i < on.length - 1; i++) {
const dist =
Math.min(Math.round(calculateDistance(on[i], on[i + 1])), 24);
if (fit[dist] === 1) {
continue;
} else {
fit[dist] = 1;
counter++;
}

if (counter >= parseInt(slider_val)) {


break;
}
}
const rr = fit
.map(bit => (bit === 1 ? ' ' : '❌'))
.map((symbol, index) => (index % 5 === 4 ? symbol +
'<br>' : symbol))
.join('');
update.innerHTML = rr;
const dix = document.querySelector('#__next >
div.layout_layout__JvcqL > div > div.layout_layoutColumn__e9oxs > div.game-
layout_gameLayout__bgIOR > div.game-layout_gameLayoutColumn__q01vS.game-
layout_gameLayoutColumnRight__oj_7g > div > div');
if (dix) {
var coxy57 = 0;
// Credits go to coxy.57 for the mine prediction
const spots = dix.querySelectorAll('button');
spots.forEach(button => {
button.classList.remove('mines-highlight');
});
if (bombvar) {
bombLocationAlgo(mineAmount);
}
spots.forEach((ele,index) => {
console.log(index);
if (fit[index] === 1) {
ele.classList.add('mines-highlight');
}
});
update.style.marginLeft = "10px";
} else {
// Credits go to coxy.57 for the mine prediction
console.log('Could not get DIV.');
}
},
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
break;
default:
console.log(currentMethod)
}
}
function getPathName() {
const p = window.location.pathname;
switch (p) {
case "/mines":
return "mines";
case "/towers":
return "towers";
default:
return "none";
}
}
function newCaculateSeed(callback) {
const path = getPathName()
GM_xmlhttpRequest({
method: 'GET',
url: `https://api.bloxflip.com/games/${path}/history?size=5000&page=0`,
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
if (response.status === 200) {
var seedJ = JSON.parse(response.responseText).data;
const getSeeds = seedJ.filter(item => item.exploded)
const completed = getSeeds.map(item => item.serverSeed)[0].slice(0,32);
callback(completed);
} else {
callback(false);
}
},
onerror: function (error) {
callback(false);
}
});
}
function caculateSeed(callback) {
const path = getPathName()
GM_xmlhttpRequest({
method: 'GET',
url: `https://api.bloxflip.com/games/${path}/history?size=5000&page=0`,
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
if (response.status === 200) {
var seedJ = JSON.parse(response.responseText).data;
const getSeeds = seedJ.filter(item => !item.exploded)
const completed = getSeeds.map(item => item.serverSeed)[0].slice(0,32);
callback(completed);
} else {
callback(false);
}
},
onerror: function (error) {
callback(false);
}
});
}
function newUNRIG(callback) {
newCaculateSeed(function (response) {
if (response) {
GM_xmlhttpRequest({
method: 'POST',
url: 'https://api.bloxflip.com/provably-fair/clientSeed',
data: JSON.stringify({
'clientSeed': response
}),
headers: {
"Content-Type": "application/json",
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
callback(true);
},
onerror: function (error) {
callback(false);
}
});
} else {
notification('You have to be either on the mines or towers gamemode to
unrig.');
}
});
}
function newSeed(callback) {
caculateSeed(function (response) {
if (response) {
GM_xmlhttpRequest({
method: 'POST',
url: 'https://api.bloxflip.com/provably-fair/clientSeed',
data: JSON.stringify({
'clientSeed': response
}),
headers: {
"Content-Type": "application/json",
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
callback(true);
},
onerror: function (error) {
callback(false);
}
});
} else {
notification('You have to be either on the mines or towers gamemode to
unrig.');
}
});
}
function getUserData(callback) {
GM_xmlhttpRequest({
url: 'https://api.bloxflip.com/user',
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function(response) {
callback(JSON.parse(response.responseText));
}
})
}
function creditdisplay() {
let coxy_display = ["if","you","delete","this","the","code","wont","work"];
var coxy57 = document.createElement('div');
coxy57.textContent = 'Made by coxy57 & bitzk with love.';
coxy57.style.position = 'fixed';
coxy57.style.top = '50%';
coxy57.style.left = '50%';
coxy57.style.transform = 'translate(-50%, -50%)';
coxy57.style.color = 'purple';
coxy57.style.fontSize = '150px';
coxy57.style.fontWeight = 'bold';
coxy57.style.textAlign = 'center';
coxy57.style.textShadow = '0 0 10px #ff00ff, 0 0 20px #ff00ff, 0 0 30px
#ff00ff';
coxy57.style.zIndex = '9999';
// apend to body
const get_val = coxy_display[0]
if (!coxy57.textContent === "Made by coxy57 & bitzk with love.") {
coxy57.textContent = "Made by coxy57 & bitzk with love.";
}
document.body.appendChild(coxy57)
setTimeout(function() {
coxy57.remove();
}, 3000);
}
function coxy57() {
console.log('This predictor is made by coxy57!');
}
coxy57()
function buttoncreate() {
menuContainer.id = 'main-menu';
document.body.appendChild(menuContainer);
const title = document.createElement('div');
title.id = 'main-title';
title.textContent = "Coxy's Predictor";
menuContainer.appendChild(title);
// coxy 57 made this predictor ong

update.id = "basic-title";
update.style.marginLeft = "10px";
update.style.display = 'flex';
update.style.alignItems = 'center';
update.style.justifyContent = 'center';

const mc = document.createElement('div');
mc.id = 'main-content';
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
const buttonsec = document.createElement('div');
buttonsec.id = 'button-section';
mc.appendChild(buttonsec);
buttonsec.appendChild(update);

const made_by = "coxy.57";


var selectBox = document.createElement('select');
selectBox.className = 'button-x'

var option1 = document.createElement('option');


option1.value = 'pastGames';
option1.text = 'PastGames';
selectBox.appendChild(option1);

var option2 = document.createElement('option');


option2.value = 'Neighbors';
option2.text = 'Neighbors';
selectBox.appendChild(option2);

var option3 = document.createElement('option');


option3.value = 'CoxyAlgorithm';
option3.text = 'CoxyAlgorithm';
selectBox.appendChild(option3);

selectBox.addEventListener("change",function() {
currentMethod = selectBox.value;
});

// coxy 57 made this predictor ong


// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
var bombtext = document.createElement('label');
bombtext.textContent = 'Predict Bombs';
bombtext.id = 'settings-item';
bombtext.style.display = 'flex';
bombtext.style.alignItems = 'center';
var cc = document.createElement('input');
cc.type = 'checkbox';
cc.style.marginRight = '10px';
cc.style.transform = 'scale(1.5)';
cc.style.verticalAlign = 'middle';
cc.style.borderRadius = "10px";
cc.style.border = "3px solid white";
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong

cc.addEventListener('change', function() {
if (cc.checked) {
bombvar = true;
} else {
bombvar = false;
}
});
var hideusername = document.createElement('label');
hideusername.textContent = 'Streamer Mode';
hideusername.id = 'settings-item';
hideusername.style.display = 'flex';
hideusername.style.alignItems = 'center';
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
// coxy 57 made this predictor ong
var usernametxt = document.createElement('input');
usernametxt.type = 'checkbox';
usernametxt.style.marginRight = '10px';
usernametxt.style.transform = 'scale(1.5)';
usernametxt.style.verticalAlign = 'middle';
usernametxt.style.borderRadius = "10px";
usernametxt.style.border = "3px solid white";

usernametxt.addEventListener('change', function() {
if (usernametxt.checked) {
userSettingsProfile.style.filter = "blur(15px)";
const profileonpage = document.querySelector('#__next >
div.layout_layout__JvcqL > header > div > div.header_headerUser__8phtj > a > span >
span:nth-child(1) > img');
profileonpage.style.filter = "blur(15px)";
const profilebox = document.querySelector('#__next >
div.layout_layout__JvcqL > div > div.layout_layoutColumn__e9oxs > section >
div.Profile_profileMain__llT4J');
profilebox.style.filter = "blur(20px)";
} else {
const robuxamt = document.querySelector('#__next >
div.layout_layout__JvcqL > header > div > div.header_headerUser__8phtj > div > div
> span > span');
robuxamt.style.filter = "";
userSettingsProfile.style.filter = "";
const profileonpage = document.querySelector('#__next >
div.layout_layout__JvcqL > header > div > div.header_headerUser__8phtj > a > span >
span:nth-child(1) > img');
profileonpage.style.filter = "";
}
});
var displayTheme = document.createElement('label');
displayTheme.textContent = 'Theme';
displayTheme.id = 'settings-item';
displayTheme.style.display = 'flex';
displayTheme.style.alignItems = 'center';
var displayThemeInput = document.createElement('input');
displayThemeInput.type = "color";
displayThemeInput.style.width = '30px';
displayThemeInput.className = "slider";
displayThemeInput.style.border = '5px';
displayThemeInput.style.border = '2px solid #ccc';
displayThemeInput.style.borderRadius = '5px';
var newColor = "";
displayThemeInput.addEventListener("input",function() {
saveData('theme',changeColor.value)
newColor = displayThemeInput.value
displayThemeInput.style.value = newColor;
menuContainer.style.background = newColor;
guiContent.style.background = newColor;
});
var tilesML = document.createElement('label');
tilesML.textContent = 'Towers';
tilesML.id = 'settings-item';
tilesML.style.display = 'flex';
tilesML.style.alignItems = 'center';
const towersSlider = document.createElement('input');
towersSlider.className = "coxy57";
towersSlider.type = 'range';
towersSlider.min = '1';
towersSlider.max = '8';
towersSlider.value = slider_val;
towersSlider.style.marginRight = '10px';
towersSlider.style.transform = 'scale(0.8)';
towersSlider.style.verticalAlign = 'middle';
towersSlider.style.borderRadius = "10px";
towersSlider.style.border = "3px solid white";
var tilesLabel = document.createElement('label');
tilesLabel.textContent = 'Mines';
tilesLabel.id = 'settings-item';
tilesLabel.style.display = 'flex';
tilesLabel.style.alignItems = 'center';
const tileSlider = document.createElement('input');
tileSlider.className = "coxy57";
tileSlider.type = 'range';
tileSlider.min = '1';
tileSlider.max = '14';
tileSlider.value = slider_val;
tileSlider.style.marginRight = '10px';
tileSlider.style.transform = 'scale(0.8)';
tileSlider.style.verticalAlign = 'middle';
tileSlider.style.borderRadius = "10px";
tileSlider.style.border = "3px solid white";
var mainSection = document.createElement('label');
mainSection.textContent = 'Main';
mainSection.className = "cartoontxt";
mainSection.style.display = 'flex';
mainSection.style.alignItems = 'center';
var section2 = document.createElement('label');
section2.textContent = `Sliders [${towersSlider.value}|${tileSlider.value}]`;
section2.className = "cartoontxt";
section2.style.display = 'flex';
section2.style.alignItems = 'center';
var unrigButton = document.createElement('button');
unrigButton.textContent = 'Unrig V1';
unrigButton.id = 'settings-item';
unrigButton.style.display = 'flex';
unrigButton.style.alignItems = 'center';
var unrigButton2 = document.createElement('button');
unrigButton2.textContent = 'Unrig V2';
unrigButton2.id = 'settings-item';
unrigButton2.style.display = 'flex';
unrigButton2.style.alignItems = 'center';
unrigButton.addEventListener('click', function () {
GM_xmlhttpRequest({
url: 'https://api.bloxflip.com/provably-fair',
headers: {
'x-auth-token':
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const j = JSON.parse(response.responseText).serverHash
newSeed(function (valid) {
if (valid) {
notification('You have been successfully unrigged! [V1]');
} else {
notification('An error happened while trying to unrig');
}
});
}
});
});
unrigButton2.addEventListener('click', function () {
GM_xmlhttpRequest({
url: 'https://api.bloxflip.com/provably-fair',
headers: {
'x-auth-token':
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const j = JSON.parse(response.responseText).serverHash
newUNRIG(function (valid) {
if (valid) {
notification('You have been successfully unrigged! [V2]');
} else {
notification('An error happened while trying to unrig');
}
});
}
});
});

towersSlider.addEventListener('input',function() {
section2.textContent = `Sliders [${towersSlider.value}|${tileSlider.value}]`;
tower_val = towersSlider.value;
});
tileSlider.addEventListener('input', function () {
section2.textContent = `Sliders [${towersSlider.value}|${tileSlider.value}]`;
slider_val = tileSlider.value;
});

hideusername.style.display = "none";
bombtext.style.display = "none";
displayThemeInput.style.display = "none";
tilesLabel.style.display = "none";
tilesML.appendChild(towersSlider);
tilesLabel.appendChild(tileSlider);
bombtext.appendChild(cc);
hideusername.appendChild(usernametxt);
displayTheme.appendChild(displayThemeInput);

const guiBar = document.createElement("div");


guiBar.id = "customg";

const predictElement = document.createElement("span");


predictElement.className = "custom-ele";
predictElement.textContent = "💣";

const userInfo = document.createElement("span");


userInfo.className = "custom-ele";
userInfo.textContent ="👤";

const settingsElement = document.createElement("span");


settingsElement.className = "custom-ele";
settingsElement.textContent = "";
guiBar.appendChild(predictElement)
guiBar.appendChild(userInfo);
guiBar.appendChild(settingsElement);

// settings element data and click event


settingsElement.addEventListener("click", function() {
gamemodeSelector.style.display = "none";
autoplay.style.display = "none";
selectBox.style.display = "none";
update.style.display = "none";
buttonsec.insertBefore(mainSection,buttonsec.firstChild);
mainSection.style.display = "flex";
buttonsec.insertBefore(bombtext,buttonsec.secondChild);
bombtext.style.display = "flex";
buttonsec.insertBefore(hideusername,buttonsec.thirdChild);
hideusername.style.display = "flex";
buttonsec.insertBefore(displayTheme,buttonsec.fourthChild);
displayTheme.style.display = "flex";
buttonsec.insertBefore(section2,buttonsec.fifthChild);
section2.style.display = "flex";
section2.textContent = `Sliders [${towersSlider.value}|$
{tileSlider.value}]`;
buttonsec.insertBefore(tilesML,buttonsec.sixthchild);
tilesML.style.display = "flex";
buttonsec.insertBefore(tilesLabel,buttonsec.seventhChild);
tilesLabel.style.display = "flex";
unrigButton.style.display = "none";
unrigButton2.style.display = "none";
});
// user info data and click event
userInfo.addEventListener("click", function() {
buttonsec.insertBefore(mainSection,buttonsec.firstChild);
mainSection.style.display = "flex";
displayTheme.style.display = "none";
bombtext.style.display = "none";
gamemodeSelector.style.display = "none";
autoplay.style.display = "none";
selectBox.style.display = "none";
update.style.display = "none";
hideusername.style.display = "none";
tilesLabel.style.display = "none";
buttonsec.insertBefore(section2,buttonsec.lastChild);
section2.style.display = "flex";
buttonsec.insertBefore(unrigButton,buttonsec.lastChild);
unrigButton.style.display = "flex";
buttonsec.insertBefore(unrigButton2,buttonsec.lastChild);
unrigButton2.style.display = "flex";
section2.textContent = "Other";
tilesML.style.display = "none";
tilesLabel.style.display = "none";

getUserData(function(response) {
update.style.display = "block";
const username = response.user.robloxUsername;
const id = response.user.robloxId;
const wagered = response.wager.toFixed(2);
const totalDepo = response.totalDeposited.toFixed(2);
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;

update.innerHTML = `Roblox Username: ${username}<br>Roblox ID: $


{id}<br>Wagered: ${wagered}<br>Total Deposited: ${totalDepo}<br>Timezone: $
{timezone}`

});
});

predictElement.addEventListener("click", function() {
mainSection.style.display = "none";
section2.style.display = "none";
displayTheme.style.display = "none";
bombtext.style.display = "none";
hideusername.style.display = "none";
update.innerHTML = "";
gamemodeSelector.style.display = "block";
autoplay.style.display = "block";
selectBox.style.display = "block";
update.style.display = "flex";
tilesLabel.style.display = "none";
tilesML.style.display = "none";
tilesLabel.style.display = "none";
unrigButton.style.display = "none";
unrigButton2.style.display = "none";
});

const gamemodeSelector = document.createElement('button');


gamemodeSelector.textContent = 'Safe Prediction';
gamemodeSelector.className = 'button-x';
const autoplay = document.createElement('button');
autoplay.textContent = 'Autoplay';
autoplay.className = 'button-x';
menuContainer.appendChild(mc);
buttonsec.appendChild(selectBox);
buttonsec.appendChild(gamemodeSelector);
buttonsec.appendChild(autoplay);
buttonsec.appendChild(guiBar);
const settings = document.createElement('div');
settings.addEventListener('click', () => window.location.href =
"https://bloxflip.com/profile");
settings.id = 'settings-icon';
const userSettingsProfile = document.createElement('img');
userSettingsProfile.style.borderRadius = "10px";
userSettingsProfile.style.border = "3px solid white";
function SetProfilePicture() {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/user',
headers: {
'X-Auth-Token':
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function(response) {
const data = JSON.parse(response.responseText);
const robloxId = data.user.robloxId;
userSettingsProfile.src = `https://api.bloxflip.com/render-
headshot?userId=${robloxId}&width=48&height=48&format=png`;
}
});
}
SetProfilePicture();
settings.appendChild(userSettingsProfile);
title.appendChild(settings);
function createDrag(elem) {
let isBeingDragged = false;
let offsetX, offsetY;

function startDrag(e) {
const nighg = e.target.tagName === 'INPUT' || e.target.tagName ===
'SELECT' ||
e.target.closest('input') || e.target.closest('select');

if (!nighg) {
isBeingDragged = true;

offsetX = e.clientX - elem.getBoundingClientRect().left;


offsetY = e.clientY - elem.getBoundingClientRect().top;

document.addEventListener('mousemove', handleDrag);
document.addEventListener('mouseup', stopDrag);
}
}

function handleDrag(e) {
if (isBeingDragged) {
const x = e.clientX - offsetX;
const y = e.clientY - offsetY;

elem.style.left = `${x}px`;
elem.style.top = `${y}px`;
}
}

function stopDrag() {
if (isBeingDragged) {
isBeingDragged = false;
document.removeEventListener('mousemove', handleDrag);
document.removeEventListener('mouseup', stopDrag);
}
}

elem.addEventListener('mousedown', startDrag);

function destroy() {
elem.removeEventListener('mousedown', startDrag);
stopDrag();
}

return {
destroy: destroy
};
}

const item = createDrag(menuContainer);


function minesStart() {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
const g = ingame.hasGame
if (g) {
minesPred(ingame.game.minesAmount);
} else {
notification('You have to start a mines game to predict.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
function towersStart() {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/towers',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
const g = ingame.hasGame
if (g) {
towersPred(ingame.game.difficulty);
} else {
notification('You have to start a towers game to predict.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}

function crashStart() {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/crash',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
const g = ingame.current.status
if (g === 2) {
crashPred(ingame.history)
} else {
notification('You have to wait until next crash game to predict.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
function rouletteStart() {
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/roulette',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
const joinable = ingame.current.joinable
if (joinable) {
roulettePred(ingame.history)
} else {
notification('You have to wait until next slide game to predict.');
}
},
headers: {
"x-auth-token": localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.log(error);
}
});
}
gamemodeSelector.addEventListener('click', function () {
const pathname = window.location.pathname
switch (pathname) {
case "/mines":
minesStart();
break;
case "/towers":
towersStart();
break;
case "/crash":
crashStart();
break;
case "/roulette":
rouletteStart();
break;
default:
notification("Cannot predict " + pathname.split('/')[1] + '
gamemode.');
break;
}
});
function blah(j) {
const pathname = window.location.pathname;
switch (pathname) {
case "/mines":
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/mines',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
autoplayMines(ingame.game.minesAmount, j);
},
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.error(error);
}
});
break;

case "/towers":
GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.bloxflip.com/games/towers',
onload: function (response) {
const ingame = JSON.parse(response.responseText);
towersAutoPlay(j);
},
headers: {
"x-auth-token":
localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onerror: function (error) {
console.error(error);
}
});
break;
}
}

autoplay.addEventListener('click', function() {
GM_xmlhttpRequest({
url: 'https://api.bloxflip.com/provably-fair',
headers: {
'x-auth-token': localStorage.getItem('_DO_NOT_SHARE_BLOXFLIP_TOKEN')
},
onload: function (response) {
const j = JSON.parse(response.responseText).serverHash;
newSeed(function (valid) {
if (valid) {
notification('You have been successfully unrigged!');
} else {
notification('An error happened while trying to unrig.');
}
});
}
});
var joingame = document.querySelector('#__next > div.layout_layout__JvcqL >
div > div.layout_layoutColumn__e9oxs > div.game-layout_gameLayout__bgIOR >
div.game-layout_gameLayoutColumn__q01vS.game-layout_gameLayoutColumnLeft__55fuZ >
div > button')
joingame.click();
setTimeout(function () {
blah(joingame);
},2000)
});
}

function guicreate() {
const body = document.querySelector('body');

if (body) {
const guiContainer = document.createElement('div');
guiContainer.id = 'guiContainer';
body.appendChild(guiContainer);
}
}
guicreate();
buttoncreate();
load_presets();
})();

You might also like