Skip to content

Instantly share code, notes, and snippets.

View at15four2020's full-sized avatar
๐Ÿ“†
The time is going

Fifteen Four at15four2020

๐Ÿ“†
The time is going
View GitHub Profile
@at15four2020
at15four2020 / js-timeout-polyfill.js
Last active May 20, 2020 01:48 — forked from kayhadrin/js-timeout-polyfill.js
Nashorn setTimeout polyfill
/**
* js-timeout-polyfill
* @see https://blogs.oracle.com/nashorn/entry/setinterval_and_settimeout_javascript_functions
*/
(function (global) {
'use strict';
if (global.setTimeout ||
global.clearTimeout ||
global.setInterval ||
var STYLE = 0
// 0 : WHITE
// 3 : RED
// 4 : BLUE
// 5 : YELLOW
// 6 : GREEN
// 7 : GREY
// 8 : MAGIC? WORK
// 9 : ZOMBIE ARM WORK
// 10 : SKELETON WORK
@at15four2020
at15four2020 / GParsers.gprog.md
Last active September 23, 2022 15:27
GProgrammer parsers

Parsers

This is a list of known packages parsers mainly to be used in G-Earth with the GProgrammer extension, but the code may be useful to understand the package structure and read it anywhere.

Return structure

Every parser may share some caracteritcs:

  • The parser is responsable to read the whole package, from the start to the end;
  • The return type is always an object;
function _intercepted(message) {
var side = message.getDestination()
var packet = message.getPacket()
var sideListeners = side == TOCLIENT ? _toClientListeners : _toServerListeners
var handlers = sideListeners[packet.headerId()]
if (!handlers) return
handlers.forEach(function (handler) {
try {
@at15four2020
at15four2020 / G-Recorder.gprog.js
Last active July 3, 2021 20:59
Record outgoing packages and save/replay later.
var GPlaceRecorder = (function() {
if (typeof setTimeout == 'undefined') {
load("https://gist.githubusercontent.com/kayhadrin/4bf141103420b79126e434dfcf6d4826/raw/a9174bacb2e4d0d8a619d2575b8de55a291c8786/js-timeout-polyfill.js")
}
if (typeof RoomChatManager == 'undefined') {
load("https://gist.github.com/Alynva/7f5dd840fc54fa49e0c538f51b69ac93/raw/RoomChatManager.gprog.js")
}
var headersToRecord = ['PlaceObject', 'MoveObject'] // PlaceObject 1905, MoveObject 2379
var replayInterval = 500
var http = (function() {
function asResponse(con){
var d = read(con.inputStream);
return d;
}
function read(inputStream){
var inReader = new java.io.BufferedReader(new
java.io.InputStreamReader(inputStream));
@at15four2020
at15four2020 / GMarketplaceBuyer.gprog.js
Last active September 23, 2022 15:27
Buy items from the marketplace as soon as they appear.
var GMarketplaceBuyer = (function () {
if (typeof setTimeout == 'undefined') {
load("https://gist.githubusercontent.com/kayhadrin/4bf141103420b79126e434dfcf6d4826/raw/a9174bacb2e4d0d8a619d2575b8de55a291c8786/js-timeout-polyfill.js")
}
if (typeof Promise == 'undefined') {
load("https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.min.js")
}
if (typeof RoomChatManager == 'undefined') {
load("https://gist.github.com/Alynva/7f5dd840fc54fa49e0c538f51b69ac93/raw/RoomChatManager.gprog.js")
}
if (typeof PrivateChatManager == "undefined") {
PrivateChatManager = (function() {
let botCount = 0
let botIds = 99999999
function blockMessage(message) {
message.setBlocked(true)
}
interceptToServer('GetExtendedProfile', blockMessage)
interceptToClient('ErrorReport', blockMessage)
// BlockProgramming.gprog.js
if (typeof BlockProgramming == "undefined") {
BlockProgramming = (function() {
if (typeof parse_in_Users == 'undefined') {
load('https://gist.github.com/at15four2020/2d69302316f3705dec18e6a04c432896/raw/parse_in_Users.gprog.js')
}
if (typeof parse_in_UserUpdate == 'undefined') {
load('https://gist.github.com/at15four2020/2d69302316f3705dec18e6a04c432896/raw/parse_in_UserUpdate.gprog.js')
if (typeof FFBot == "undefined") {
FFBot = (function() {
if (typeof PrivateChatManager == 'undefined') {
load("https://gist.githubusercontent.com/at15four2020/7a380485e641fb48e9a30593869c1150/raw/PrivateChatManager.gprog.js")
}
if (typeof BlockProgramming == 'undefined') {
load('https://gist.github.com/at15four2020/6b405f224d91fa50975546031f764aec/raw/BlockProgramming.gprog.js')
}
let chat