Rolocate Server Region Data (Data Saving)

Server regions for RoLocate to use.

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/547134/1754967/Rolocate%20Server%20Region%20Data%20%28Data%20Saving%29.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Rolocate Server Region Data
// @namespace https://oqarshi.github.io/
// @version 1.3
// @description Server regions for RoLocate to use (by datacenter ID).
// @author Oqarshi
// @grant none
// ==/UserScript==

window.serverRegionsByIp = null;
window.loadServerRegions = function () {
if (window.serverRegionsByIp) return;
window.serverRegionsByIp={
_locations:{
"0":{city:"Singapore",country:{name:"Singapore",code:"SG"},region:{name:"Singapore",code:"Singapore"},latitude:1.3521,longitude:103.8198},
"1":{city:"Ashburn",country:{name:"United States",code:"US"},region:{name:"Virginia",code:"VA"},latitude:39.0438,longitude:-77.4874},
"2":{city:"London",country:{name:"United Kingdom",code:"GB"},region:{name:"England",code:"England"},latitude:51.513,longitude:-0.08},
"3":{city:"Chicago",country:{name:"United States",code:"US"},region:{name:"Illinois",code:"IL"},latitude:41.85,longitude:-87.65},
"4":{city:"Miami",country:{name:"United States",code:"US"},region:{name:"Florida",code:"FL"},latitude:25.7743,longitude:-80.1937},
"5":{city:"Tokyo",country:{name:"Japan",code:"JP"},region:{name:"Tokyo",code:"Tokyo"},latitude:35.6895,longitude:139.6917},
"6":{city:"Frankfurt am Main",country:{name:"Germany",code:"DE"},region:{name:"Hesse",code:"Hesse"},latitude:50.1109,longitude:8.6821},
"7":{city:"Mumbai",country:{name:"India",code:"IN"},region:{name:"Maharashtra",code:"Maharashtra"},latitude:19.076,longitude:72.8777},
"8":{city:"Los Angeles",country:{name:"United States",code:"US"},region:{name:"California",code:"CA"},latitude:34.0522,longitude:-118.2437},
"9":{city:"Sydney",country:{name:"Australia",code:"AU"},region:{name:"New South Wales",code:"New South Wales"},latitude:-33.8678,longitude:151.2073},
"10":{city:"Dallas",country:{name:"United States",code:"US"},region:{name:"Texas",code:"TX"},latitude:32.7831,longitude:-96.8067},
"11":{city:"New York City",country:{name:"United States",code:"US"},region:{name:"New York",code:"NY"},latitude:40.7143,longitude:-74.006},
"12":{city:"Amsterdam",country:{name:"Netherlands",code:"NL"},region:{name:"North Holland",code:"North Holland"},latitude:52.374,longitude:4.8897},
"13":{city:"Seattle",country:{name:"United States",code:"US"},region:{name:"Washington",code:"WA"},latitude:47.6062,longitude:-122.3321},
"14":{city:"Paris",country:{name:"France",code:"FR"},region:{name:"Île-de-France",code:"Île-de-France"},latitude:48.8534,longitude:2.3488},
"15":{city:"Portland",country:{name:"United States",code:"US"},region:{name:"Oregon",code:"OR"},latitude:45.5231,longitude:-122.6765},
"16":{city:"Columbus",country:{name:"United States",code:"US"},region:{name:"Ohio",code:"OH"},latitude:39.9625,longitude:-83.0032},
"17":{city:"San Jose",country:{name:"United States",code:"US"},region:{name:"California",code:"CA"},latitude:37.3382,longitude:-121.8863},
"18":{city:"Dublin",country:{name:"Ireland",code:"IE"},region:{name:"Leinster",code:"Leinster"},latitude:53.3498,longitude:-6.26031},
"19":{city:"São Paulo",country:{name:"Brazil",code:"BR"},region:{name:"São Paulo",code:"São Paulo"},latitude:-23.5505,longitude:-46.6333},
"20":{city:"Osaka",country:{name:"Japan",code:"JP"},region:{name:"Osaka",code:"Osaka"},latitude:34.6937,longitude:135.5023},
"21":{city:"Atlanta",country:{name:"United States",code:"US"},region:{name:"Georgia",code:"GA"},latitude:33.749,longitude:-84.388},
},
// Datacenter ID to location mapping
"295":"0",
"299":"1",
"302":"2",
"306":"3",
"332":"4",
"335":"3",
"337":"5",
"352":"6",
"359":"7",
"363":"1",
"365":"8",
"366":"1",
"369":"9",
"370":"8",
"372":"0",
"374":"4",
"375":"10",
"377":"5",
"378":"6",
"380":"8",
"386":"1",
"387":"11",
"388":"12",
"390":"1",
"397":"8",
"401":"1",
"403":"8",
"404":"8",
"405":"8",
"412":"8",
"413":"8",
"414":"8",
"415":"8",
"416":"0",
"417":"0",
"418":"1",
"425":"5",
"426":"1",
"427":"1",
"428":"1",
"429":"8",
"430":"0",
"431":"13",
"432":"4",
"433":"4",
"434":"4",
"436":"8",
"437":"14",
"438":"1",
"439":"1",
"440":"0",
"441":"0",
"442":"1",
"447":"8",
"448":"14",
"449":"2",
"450":"9",
"455":"0",
"456":"0",
"457":"6",
"458":"6",
"460":"13",
"462":"0",
"463":"3",
"464":"3",
"465":"0",
"468":"3",
"471":"9",
"473":"1",
"474":"1",
"475":"1",
"476":"1",
"477":"1",
"478":"1",
"479":"1",
"480":"1",
"481":"1",
"482":"1",
"485":"1",
"486":"1",
"487":"13",
"488":"1",
"489":"1",
"490":"8",
"491":"1",
"493":"15",
"494":"15",
"495":"15",
"496":"15",
"497":"15",
"498":"16",
"499":"16",
"500":"16",
"501":"16",
"502":"16",
"503":"1",
"504":"1",
"505":"1",
"506":"1",
"507":"1",
"508":"1",
"509":"1",
"510":"1",
"511":"1",
"512":"6",
"513":"0",
"514":"0",
"515":"0",
"516":"0",
"517":"0",
"518":"7",
"519":"7",
"520":"7",
"521":"7",
"522":"7",
"523":"1",
"524":"12",
"525":"1",
"526":"1",
"527":"1",
"528":"1",
"529":"13",
"530":"1",
"531":"1",
"532":"1",
"533":"7",
"534":"7",
"535":"1",
"536":"1",
"537":"1",
"25492":"6",
"25494":"6",
"25495":"6",
"25496":"6",
"25497":"6",
"25506":"5",
"25507":"5",
"25508":"5",
"25509":"5",
"25510":"5",
"25512":"1",
"25513":"1",
"25514":"1",
"25515":"1",
"25516":"1",
"25517":"16",
"25518":"16",
"25519":"16",
"25520":"16",
"25521":"16",
"25522":"15",
"25523":"15",
"25524":"15",
"25525":"15",
"25526":"15",
"25527":"0",
"25528":"0",
"25529":"0",
"25535":"7",
"25536":"7",
"25537":"7",
"25538":"6",
"25543":"5",
"25544":"5",
"25545":"5",
"25546":"5",
"25774":"19",
"25775":"18",
"25776":"18",
"25777":"18",
"25778":"18",
"25779":"18",
"25781":"18",
"25782":"18",
"25783":"18",
"25784":"18",
"25785":"17",
"25787":"17",
"25788":"17",
"25789":"17",
"25790":"17",
"25791":"17",
"25792":"17",
"25793":"17",
"25795":"17",
"25796":"19",
"25798":"9",
"25799":"19",
"25804":"9",
"25805":"15",
"25806":"15",
"25808":"13",
"25809":"19",
"25810":"19",
"25811":"17",
"25813":"7",
"25817":"0",
"25818":"17",
"25819":"17",
"25820":"17",
"25821":"17",
"25822":"17",
"25823":"17",
"25825":"20",
"25826":"20",
"25827":"20",
"25828":"20",
"25829":"20",
"25830":"20",
"25832":"20",
"25833":"20",
"25834":"20",
"25835":"20",
"25837":"20",
"25838":"20",
"25839":"20",
"25840":"20",
"25841":"20",
"25842":"20",
"25843":"20",
"25844":"20",
"25845":"20",
"25846":"20",
"25850":"20",
"25851":"10",
"25853":"6",
"25861":"17",
"25862":"1",
"25931":"0",
"25939":"0",
"25960":"2",
"26021":"21",
"26030":"0",
"26032":"0",
"26033":"0",
"26034":"0",
"26035":"0",
"26036":"0",
"26037":"0",
"26040":"1",
"26041":"1",
"26048":"3",
"26049":"3",
"26050":"3",
"26051":"3",
"26052":"3",
"26053":"3",
"26057":"1",
"26059":"14",
"26060":"14",
"26061":"14",
"26062":"14",
"26063":"14",
"26064":"14",
"26074":"17",
"26075":"17",
"26077":"16",
"26083":"17",
"26095":"18",
"26097":"6"
};

window.getLocationForIp = function(ip) {
    const locationId = window.serverRegionsByIp[ip];
    if (locationId && window.serverRegionsByIp._locations[locationId]) {
        return window.serverRegionsByIp._locations[locationId];
    }
    return null;
};

window.getServerRegionsByIp = function() {
    const result = {};
    for (const [ip, locationId] of Object.entries(window.serverRegionsByIp)) {
        if (ip !== '_locations' && window.serverRegionsByIp._locations[locationId]) {
            result[ip] = window.serverRegionsByIp._locations[locationId];
        }
    }
    return result;
};
};