Gartic.io Listen to WebSocket in Your Room

With this script, when you enter a room, you listen to the websocket. While in the game, you can send data to the game from the console with wsObj.send(). wsObj.id gives your current room id. wsObj.lengthID gives your id consisting of letters.

// ==UserScript==
// @name         Gartic.io Listen to WebSocket in Your Room
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  With this script, when you enter a room, you listen to the websocket. While in the game, you can send data to the game from the console with wsObj.send(). wsObj.id gives your current room id. wsObj.lengthID gives your id consisting of letters.
// @author       Mré
// @license      MIT
// @match        *://gartic.io/*
// @icon         https://see.fontimg.com/api/rf5/rvaw8/OTRjZDMyNDZkNzRiNDg3Njk3N2I3NzlmODRmOTY1ZTQudHRm/TXLDqSA/hidden.png?r=fs&h=490&w=1000&fg=B31008&bg=DEDEDE&tb=1&s=490
// @grant none
// ==/UserScript==

let originalSend = WebSocket.prototype.send,setTrue=false;
window.wsObj={}

WebSocket.prototype.send=function(data){
console.log("Gönderilen Veri: "+data)
originalSend.apply(this, arguments)
if(Object.keys(window.wsObj).length==0){window.wsObj=this;window.eventAdd()}
};

window.eventAdd=()=>{
if(!setTrue){
setTrue=1
window.wsObj.addEventListener("message",(msg)=>{
try{
let data=JSON.parse(msg.data.slice(2))
console.log(data)
if(data[0]==5){
window.wsObj.lengthID=data[1]
window.wsObj.id=data[2]
window.wsObj.roomCode=data[3]
}
}catch(err){}
})
}
}
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元