您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Somes tools for add informations in ChopCoin
当前为
// ==UserScript== // @name CC Tools (HPrivakos's version) // @namespace HPrivakosScripts // @description Somes tools for add informations in ChopCoin // @author HPrivakos (and Unregistered) // @include http://chopcoin.io/* // @version 1 // @grant none // ==/UserScript== var timer = 0; var timerFloat = 0; var xCoord = 0; var yCoord = 0; var nodeCount = 0; var frequency = 2; // how many times per second to update title var id = 0; var ign = "nothing"; var precision = 100; // number to divide the board by, since its 12,000 x 12,000, the range will be 0-12 // All modes and UTC time var modes = {"text":[{"AdditionalText":"","MaxCells":"16","MaxVirus":"50","Name":"NormalMode","RecombineTime":"20","ShootsBomb":"2","Speed":"Default"},{"AdditionalText":"","MaxCells":"40","MaxVirus":"50","Name":"SplitMode","RecombineTime":"10","ShootsBomb":"1","Speed":"Default"},{"AdditionalText":"","MaxCells":"16","MaxVirus":"120","Name":"BombMode","RecombineTime":"20","ShootsBomb":"2","Speed":"Default"},{"AdditionalText":"","MaxCells":"16","MaxVirus":"50","Name":"SpeedMode","RecombineTime":"20","ShootsBomb":"2","Speed":"Default"},{"AdditionalText":"Faucet is closed for the moment.","Name" :"FaucetStop"}],"time":[{"Name":"SpeedMode","Hours":"0"},{"Name":"NormalMode","Hours":"159"},{"Name":"BombMode","Hours":"401"},{"Name":"SplitMode","Hours":"603"},{"Name":"SpeedMode","Hours":"805"},{"Name":"NormalMode","Hours":"1007"},{"Name":"BombMode","Hours":"1209"},{"Name":"SplitMode","Hours":"1411"},{"Name":"SpeedMode","Hours":"1613"},{"Name":"NormalMode","Hours":"1815"},{"Name":"FaucetStop","Hours":"2017"},{"Name":"SplitMode","Hours":"2200"},{"Name":"Inifinite","Hours":"9999"}]}; window.addEventListener("keydown", dealWithKeyboard, false); try { var faPlayers = document.getElementsByClassName('current_players')[0].innerText; var lrPlayers = document.getElementsByClassName('current_players')[1].innerText; } catch(err) {} var players = [faPlayers, lrPlayers]; var urls = ["http://192.99.3.54:5556/", "http://192.99.3.54:7891/"]; setTimeout( function(){ setInterval(function(){getJSON(urls[0], 0);}, 2000)} , 1000); // delay 1s, check every 2s setTimeout( function(){ setInterval(function(){getJSON(urls[1], 1);}, 4000)} , 2000); // delay 2s, check every 4s document.getElementById('chatshowhide').style.textAlign = 'right'; document.getElementById('chatshowhide').innerHTML = '<span style="float:left;color:white;" id="extras1" ></span>\ <span id="timer1" style="color:#aaf;"></span> | \ <span id="nodes1" style="color:#afa;"></span> | \ <span id="faPlayers1" style="color:#ffa;"></span> \ <span id="lrPlayers1" style="color:#ffa;"></span> | \ <span id="coordx1" style="color:#faa;"></span> \ <span id="coordy1" style="color:#faa;"></span> \ <span id="coordy1" style="color:#faa;"></span> \ <span id="actualMode" style="color:#faa;float:left;"></span> \ <span id="additionalText" style="color:#faa;float:left;"></span> \ <span id="shootsBomb" style="color:#faa;float:left;"></span> \ <span id="maxCells" style="color:#faa;float:left;"></span> \ <span id="recombineTime" style="color:#faa;float:left;"></span> \ <span id="speed" style="color:#faa;float:left;"></span> \' + document.getElementById('chatshowhide').innerHTML; // visible when chatbox is up document.getElementById('chatlink').style.textAlign = 'left'; document.getElementById('chatlink').style.fontSize = '16px'; document.getElementById('chatlink').innerHTML = '<a href="/chat/"><span lang="en" style="float:right;font-size:12px;">Chat commands / User groups / Rules</span></a>\ <span style="float:right;color:white;" id="extras2" ></span>\ <span id="timer2" style="color:#447;"></span> | \ <span id="nodes2" style="color:#474;"></span> | \ <span id="faPlayers2" style="color:#774;"></span> \ <span id="lrPlayers2" style="color:#774;"></span> | \ <span id="coordx2" style="color:#744;"></span> \ <span id="coordy2" style="color:#744;"></span> '; setTimeout(function(){ setTitle(); }, 100); function setTitle() { getCoords(); getNodeCount(); if (timerFloat != 0) { timerFloat -= 1/frequency; timer = Math.round(timerFloat); } document.title = timer + " | " + nodeCount + " | " + xCoord + " : " + yCoord; setText(); setTimeout(function(){ setTitle(); }, 1000/frequency); } function getCoords() { xCoord = Math.round(chopcoin.game.viewport.nx / precision); yCoord = Math.round(chopcoin.game.viewport.ny / precision); if(isNaN(xCoord)) xCoord = 0; if(isNaN(yCoord)) yCoord = 0; } function getNodeCount() { nodeCount = chopcoin.game.nodes.player.length; if (nodeCount == 0) nodeCount = 'X'; } function setText() { faPlayers = players[0]; lrPlayers = players[1]; document.getElementById('timer1').textContent = timer; document.getElementById('nodes1').textContent = nodeCount; document.getElementById('faPlayers1').textContent = faPlayers; document.getElementById('lrPlayers1').textContent = lrPlayers; document.getElementById('coordx1').textContent = xCoord; document.getElementById('coordy1').textContent = yCoord; document.getElementById('timer2').textContent = timer; document.getElementById('nodes2').textContent = nodeCount; document.getElementById('faPlayers2').textContent = faPlayers; document.getElementById('lrPlayers2').textContent = lrPlayers; document.getElementById('coordx2').textContent = xCoord; document.getElementById('coordy2').textContent = yCoord; } function dealWithKeyboard(e) { if (e.keyCode == "32") { if(chopcoin.game.server_id == "faucet") timerFloat = 20; else timerFloat = 30; } else if (e.keyCode == "49") { getAccount(); } } function getJSON(url, roomNum) { xmlhttp = new XMLHttpRequest(); var responseObj; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { if(typeof InstallTrigger !== 'undefined') { // just for firefox :\ jsonStr = xmlhttp.responseText; players[roomNum] = jsonStr.substring(19, jsonStr.indexOf("max_players")-2); } else { responseObj = JSON.parse(xmlhttp.responseText); //console.log(responseObj); players[roomNum] = responseObj.current_players; } } }; xmlhttp.open("GET", url, true); xmlhttp.send(); } function getAccount() { var xmlhttp = new XMLHttpRequest(); var doc = document.implementation.createHTMLDocument('account'); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { //doc.innerHTML = xmlhttp.responseText; doc.documentElement.innerHTML = xmlhttp.responseText; balance = doc.getElementById('account_information').childNodes[1].childNodes[2].childNodes[3].innerText; var provisional = doc.getElementById('account_information').childNodes[1].childNodes[4].childNodes[3].innerText.split(' ', 1)[0] + " BTC"; console.log(balance); document.getElementById('extras1').textContent = balance; document.getElementById('extras2').textContent = balance; setTimeout( function(){ document.getElementById('extras1').textContent = ''; }, 3000); // 2s setTimeout( function(){ document.getElementById('extras2').textContent = ''; }, 3000); // 2s setTimeout( function(){ document.getElementById('extras1').textContent = provisional; }, 3100); setTimeout( function(){ document.getElementById('extras2').textContent = provisional; }, 3100); setTimeout( function(){ document.getElementById('extras1').textContent = ''; }, 6100); setTimeout( function(){ document.getElementById('extras2').textContent = ''; }, 6100); } }; xmlhttp.open("GET", "http://chopcoin.io/account/", true); xmlhttp.send(); } /* function faucetInformations() { console.log("Bonjour"); var date = new Date(); var hours = "0" + date.getUTCHours(); var minutes = "0" + date.getUTCMinutes(); var dTotal = hours.substr(-2) + minutes.substr(-2); for(m=0;m<11;m++){ if(dTotal > modes.time[m].Hours && dTotal < modes.time[m+1].Hours){ for(i=0;i<3;i++){ if(modes.time[m].Name == modes.text[i].Name){ document.getElementById('actualMode').textContent = modes.time[i].Name; document.getElementById('additionalText').textContent = modes.text[i].AdditionalText; document.getElementById('shootsBomb').textContent = modes.text[i].ShootsBomb; document.getElementById('maxCells').textContent = modes.text[i].MaxCells; document.getElementById('recombineTime').textContent = modes.text[i].RecombineTime; document.getElementById('speed').textContent = modes.text[i].Speed; } } if(modes.time[m].Name == modes.text[4].Name){document.getElementById('additionalText').textContent = modes.text[4].AdditionalText} } } } */ setInterval(function(){ faucetInformations(); }, 5000);