// ==UserScript==
// @name Surviv.io | Auto start game.
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description inspired by emitwohs
// @icon https://images-ext-2.discordapp.net/external/ABiWTylC0rumeHGESrIzPlK8ujd_DJ_FYA8hcaUgkDU/%3Fsize%3D4096/https/cdn.discordapp.com/avatars/816845308142682192/68c22e8cdd3546cdf159cb4e552bba52.png
// @author sk
// @grant GM_addStyle
// @license MIT
// @run-at document-end
// @match https://surviv.io/*
// @match https://surviv2.io/*
// @match https://2dbattleroyale.com/*
// @match https://2dbattleroyale.org/*
// @match https://piearesquared.info/*
// @match https://thecircleisclosing.com/*
// @match https://secantsecant.com/*
// @match https://parmainitiative.com/*
// @match https://ot38.club/*
// @match https://drchandlertallow.com/*
// @match https://rarepotato.com/*
// @match https://archimedesofsyracuse.info/*
// @match https://nevelskoygroup.com/*
// @match https://kugahi.com/*
// @match https://kugaheavyindustry.com/*
// @match https://chandlertallowmd.com/*
// @downloadURL none
// ==/UserScript==
GM_addStyle(`
.skallwaysshow {
display:block!important;
opacity:1!important;
}
#start-row-header {
top:70px!important;
}
`);
// re-style server warning
document.querySelector('#start-row-top').classList.add('center-start-row');
document.getElementById('server-warning').style = "height:fit-content;line-height:20px;background-image: linear-gradient(to right, rgba(112, 210, 36, 0.7), rgba(50, 168, 82, 0.7), rgba(0, 255, 255, 0.7));width: 500px;padding: 30px;border-radius: 20px;top: 170px!important;font-size: 20px;color: #fff;";
document.getElementById('server-warning').innerHTML = "Press the \"Scout!\" button at top right corner to start scouting.";
document.getElementById('server-warning').classList.add('skallwaysshow');
// banana
var abort = true;
document.getElementById('modal-support').remove();
document.getElementById('btn-support').innerHTML = 'Scout!'
if (document.getElementById('sk_support') !== null) {document.getElementById('sk_support').innerHTML = 'Scout!'}
document.getElementById('btn-support').onclick = function() {
if (abort) {
document.getElementById('btn-support').innerHTML = 'Abort!'
if (document.getElementById('sk_support') !== null) {document.getElementById('sk_support').innerHTML = 'Abort!'}
abort = false;
var y = document.querySelectorAll('#server-opts')[1].querySelectorAll('option')[0].innerHTML.slice(9),
mode = document.querySelector('#index-play-mode-selected').dataset.l10n,
type = document.querySelector('#index-play-type-selected').dataset.l10n,
zone = [];
if (y === 'North America') {
y = 'na'
zone.push("nyc", "sfo", "chi")
} else if (y === 'South America') {
y = 'sa'
zone.push('sao')
} else if (y === 'Europe') {
y = 'eu'
zone.push("waw", "fra");
} else if (y === 'Asia') {
y = 'as'
zone.push('sgp')
} else if (y === 'South Korea') {
y = 'kr'
zone.push('sel')
};
if ((mode === 'index-play-mode-main') && (type === 'index-play-type-1')) {
mode = 0;
} else if ((mode === 'index-play-mode-main') && (type === 'index-play-type-2')) {
mode = 1;
} else if ((mode === 'index-play-mode-main') && (type === 'index-play-type-4')) {
mode = 2;
} else if (mode !== 'index-play-mode-main') {
mode = 3;
}
// auto start game
var i = 0,
s = false,
previous = [],
startTime,
endTime;
var x = JSON.parse(`
{
"version": 129,
"region": "",
"zones": "",
"playerCount": 0,
"autoFill": true,
"gameModeIdx": "",
"isMobile": false,
"adminCreate": false,
"privCode": false
}
`);
x.region = y;
x.zones = zone;
x.gameModeIdx = mode;
next();
startTime = new Date();
function next() {
if (!abort) {
if (s) {
abort = false
document.getElementById('btn-support').innerHTML = 'Scout!'
if (document.getElementById('sk_support') !== null) {document.getElementById('sk_support').innerHTML = 'Scout!'}
clearTimeout(interval);
return;
}
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://surviv.io/api/find_game');
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.onload = function() {
previous.push(JSON.parse(xhr.responseText).res[0].gameId);
if (previous.at(-1) != previous[0]) {
document.getElementById('server-warning').innerHTML = 'New lobby is found!\nID: ' + JSON.parse(xhr.responseText).res[0].gameId;
if (document.getElementById('team-menu').style.display == 'block') {document.getElementById("btn-start-team").click()}
else {document.getElementById('btn-start-battle').click();}
s = true;
};
endTime = new Date();
var timeDiff = endTime - startTime;
timeDiff /= 1000;
var seconds = timeDiff.toFixed(2);
document.getElementById('server-warning').innerHTML = `Scouting...
Scout count: ${i} times
Time elapsed: ${seconds} seconds
Press the "Abort!" at top right corner to abort.`
};
xhr.send(JSON.stringify(x));
i++;
var interval = setTimeout(next, 750);
}
}
} else {
abort = true;
document.getElementById('btn-support').innerHTML = 'Scout!'
if (document.getElementById('sk_support') !== null) document.getElementById('sk_support').innerHTML = 'Scout!'
document.getElementById('server-warning').innerHTML = `Aborted!
Press the "Scout!" button at top right corner to start scouting.`
}
}