headSplix.io

SplixPlus Head Code

当前为 2016-09-16 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/23245/147633/headSplixio.js

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

document.getElementById("miniMapPlayer").outerHTML += '<canvas style="position:relative;"width=600 height=800 id="minimapNodes"></canvas>';
minimapNodesCTX = document.getElementById("minimapNodes").getContext("2d");
overrideServer = {
 override: false,
 ip: ""
};
$("#miniMapPlayer").hide();
$("#minimapCanvas").hide();
$("#tutorialCanvas").hide();
CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
    if (w < 2 * r) {
        r = w / 2;
    }
    if (h < 2 * r) {
        r = h / 2;
    }
    this.beginPath();
    this.moveTo(x + r, y);
    this.arcTo(x + w, y, x + w, y + h, r);
    this.arcTo(x + w, y + h, x, y + h, r);
    this.arcTo(x, y + h, x, y, r);
    this.arcTo(x, y, x + w, y, r);
    this.closePath();
    return this;
};

function updateMinimap() {
    try {
        minimapNodesCTX.clearRect(0, 0, minimapNodes.width, minimapNodes.height);
        for (var i = 0; i < players.length; i++) {
            if (!players[i].isDead) {

                var x = players[i].pos[0] / mapSize * 160 + 1.5 - 14;
                var y = players[i].pos[1] / mapSize * 160 + 1.5 - 14;
                minimapNodesCTX.beginPath();
                minimapNodesCTX.roundRect(x, y, 7, 7, 2);
                minimapNodesCTX.lineWidth = 1.3;
                minimapNodesCTX.strokeStyle = "#000";
                minimapNodesCTX.stroke();
                minimapNodesCTX.fillStyle = "#fff";
                minimapNodesCTX.fill();
                minimapNodesCTX.fillText(players[i].name, x - 10, y + 20)
            }
        }
    } catch (e) {}
}
var minimapInterval = setInterval(function() {
    updateMinimap();
}, 100)
MAX_ZOOM = 100000
document.body.addEventListener("mousewheel", handleWheel, true);
function handleWheel(event) {
    var zoom = BLOCKS_ON_SCREEN * Math.pow(0.93, event.wheelDelta / 120 || event.detail || 0);
    if (zoom < 100) {
        BLOCKS_ON_SCREEN = 100;
    } else if (zoom > 16000) {
        BLOCKS_ON_SCREEN = 16000;
    } else {
        BLOCKS_ON_SCREEN = zoom;
    }
}
_getServer = getServer;
getServer = function() {
    if (overrideServer.override) {
     return {ip: "ws://" + overrideServer.ip + "/splix", ping: 1};
     $("#serverIpHolder")[0].innerHTML = "Server Ip: " + overrideServer.ip.split("ws://")[1].split("/splix")[0]
     overrideServer.override = false;
    }
    else {
        a = _getServer();
         $("#serverIpHolder")[0].innerHTML = "Server Ip: " + a.ip.split("ws://")[1].split("/splix")[0]
        return a;
    }
}
_startPingServers = startPingServers
startPingServers = function() {
//$("#serverIp").val(getServer().ip)
_startPingServers();
}
window.connectToSplixServer = function() {
 overrideServer.override = true;
 overrideServer.ip = $(".serverIp").val();
    connectWithTransition();
}

$("#leaderboard").append("<h1>SplixPlus.io</h1><p style='-moz-user-select: text; -khtml-user-select: text; -webkit-user-select: text; -ms-user-select: text; user-select: text;' id='serverIpHolder'>Server Ip: </p>");
$('<br><br><form id="splixPlusForm" class="fancyBox greenBox" style="display:inline-block;margin-left:auto;margin-right:auto;padding:30px" method="get"> <input type="text" style="border:0;outline:0;font-size:20px;padding:8px;box-shadow:1px 1px #155a1c,2px 2px #155a1c,3px 3px #155a1c,4px 4px #155a1c,5px 5px #155a1c,10px 10px 20px rgba(0,0,0,.2);margin:5px;-webkit-appearance:none" class="fancyBox serverIp" maxlength="50" id="serverIp" placeholder="Server Ip"> <input type="button" class="fancyBox" id="joinButton" value="Connect!" onclick="window.connectToSplixServer()"> </form>').insertAfter("#nameForm")