def __init__( self, extension: Extension, prefix: str = ":", bot_settings: HBotProfile = None ) -> None: self._extension = extension self._prefix = prefix self._bot_settings = HBotProfile() if bot_settings is None else bot_settings self._commands = {} self._chat_opened = False self._once_per_connection = False extension.intercept(Direction.TO_SERVER, self.should_open_chat) extension.intercept( Direction.TO_CLIENT, self.on_friend_list, "FriendListFragment", mode="async" ) extension.intercept(Direction.TO_SERVER, self.on_send_message, "SendMsg") extension.intercept( Direction.TO_SERVER, self.on_get_profile, "GetExtendedProfile" )
import sys from time import sleep from g_python.gextension import Extension from g_python.hmessage import Direction, HMessage from g_python.hpacket import HPacket extension_info = { "title": "Packets example", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } ext = Extension(extension_info, sys.argv) ext.start() ext.send_to_server(HPacket("Chat", "hi", 1, 1)) def on_walk(message): # packet = message.packet # x = packet.read_int() # y = packet.read_int() (x, y) = message.packet.read('ii') print("Walking to x:{}, y={}".format(x, y)) # send packet to server from HPacket() object # ext.send_to_server(HPacket(1843, 1)) # wave ext.send_to_server(HPacket('AvatarExpression', 1)) # wave # # 2 ways of sending packets from string representations
import sys from g_python.gextension import Extension from g_python.hdirection import Direction from g_python.hunitytools import UnityRoomUsers from FriendAdder import FriendAdder extension_info = { "title": "I need friends", "description": "adds friends automatically", "version": "1.1", "author": "kSlide" } def on_machine_id(message): identifier = message.packet.read_string() print(str(identifier)) if __name__ == '__main__': extension = Extension(extension_info, sys.argv) extension.intercept(Direction.TO_SERVER, on_machine_id, 813) extension.start() FriendAdder(extension, UnityRoomUsers(extension))
import sys from g_python.gextension import Extension from g_python.htools import Inventory extension_info = { "title": "Inventory items", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } ext = Extension(extension_info, sys.argv, {"use_click_trigger": True}) ext.start() inv = Inventory(ext) # inventory items will be available under: # inv.inventory_items (list of HInventoryItem) def request_inventory(): print("Requesting inventory") inv.request() def on_inventory_load(items): print("Found {} items!".format(len(items))) ext.on_event('double_click', request_inventory) inv.on_inventory_load(on_inventory_load)
import sys from g_python.gextension import Extension from g_python.hmessage import Direction, HMessage extension_info = { "title": "Show Wireds", "description": "Allow you to see the wireds", "version": "2.0", "author": "Lande" } ext = Extension(extension_info, sys.argv) ext.start() list_wireds = [] on = False def hide_wired(message): if on: message.is_blocked = True (id_furni, boolean, int1, int2) = message.packet.read("sBii") list_wireds.append([id_furni, boolean, int1, int2]) def re_send(j): pack = '{l}{h:2703}' for i in j: if isinstance(i, bool): pack += '{b:' + str(i) + '}' elif isinstance(i, int):
import sys from g_python.gextension import Extension from g_python.hunitytools import UnityRoomUsers, UnityRoomFurni extension_info = { "title": "Room stuff", "description": "g_python test", "version": "1.2", "author": "sirjonasxx & Hellsin6" } ext = Extension(extension_info, sys.argv) ext.start() def print_furnis(furnis): for furni in furnis: print("furno", furni.id, furni.type_id, furni.tile, furni.owner) room_users = UnityRoomUsers(ext) room_users.on_new_users(lambda users: print(list(map(str, users)))) room_furni = UnityRoomFurni(ext) room_furni.on_floor_furni_load(lambda furnis: print_furnis(furnis)) ''' LEGACY FLASH STUFF room_furni.on_wall_furni_load(lambda furni: print("Found {} wall furniture in room".format(len(furni))))
import sys from g_python.gextension import Extension from g_python.hmessage import Direction extension_info = { "title": "long example LOL", "description": "g_python test", "version": "1.0", "author": "Hellsin6" } ext = Extension(extension_info, sys.argv) ext.start() def StuffDataUpdate(message): (x, y, z) = message.packet.read('lis') print('StuffDataUpdate', x, y, z) furni_id = message.packet.read_long(6) print('read_long', furni_id) ext.intercept(Direction.TO_CLIENT, StuffDataUpdate, 88)
import sys from g_python.gextension import Extension from g_python.hmessage import Direction extension_info = { "title": "Packet Logger", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } ext = Extension(extension_info, sys.argv) ext.start() def all_packets(message): packet = message.packet s = packet.g_string(ext) expr = packet.g_expression(ext) print('{} --> {}'.format(message.direction.name, s)) if expr != '': print(expr) print('------------------------------------') ext.intercept(Direction.TO_CLIENT, all_packets) ext.intercept(Direction.TO_SERVER, all_packets)
PLACE_FURNI = 1268 REDEEM = 1009 SPEECH_OUT = 1831 SPEECH_IN = 2174 # -------------------------------------- extension_info = { "title": "Auto Redeem", "description": "!ar", "version": "2.0", "author": "Lande" } ext = Extension(extension_info, sys.argv) ext.start() on = False def speech(msg): global on (text, color, index) = msg.packet.read('sii') if text == '!ar': msg.is_blocked = True message(' Use `!ar on` or `!ar off` ') if text == '!ar on': msg.is_blocked = True on = True message(' Auto Redeem On ')
CMD = "!ab" # --------------------------- import sys from g_python.gextension import Extension from g_python.hmessage import Direction extension_info = { "title": "Anti Bobba", "description": CMD + " on/off", "version": "2.0", "author": "Lande" } ext = Extension(extension_info, sys.argv) ext.start() on = False def speech(msg): global on (text, bubble, idd) = msg.packet.read('sii') if on: if not text.startswith(CMD): msg.is_blocked = True message = ""
import sys from g_python import hparsers from g_python.gextension import Extension from g_python.hmessage import Direction extension_info = { "title": "User profile", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } ext = Extension(extension_info, sys.argv) ext.start() def user_profile(message): profile = hparsers.HUserProfile(message.packet) print(profile) ext.intercept(Direction.TO_CLIENT, user_profile, 'ExtendedProfile')
from g_python.gextension import Extension from g_python.hmessage import Direction, HMessage from g_python.hpacket import HPacket from g_python import hparsers, hunityparsers from g_python import htools, hunitytools extension_info = { "title": "$G_PYTHON_SHELL_TITLE$", "description": "G-Python scripting console", "version": "1.0", "author": "" } ext = Extension(extension_info, ["--port", "$G_EARTH_PORT$", "--auth-token", "$COOKIE$"], {"can_leave": False}) ext.start() def is_closed(): return ext.is_closed() def send_to_client(packet): return ext.send_to_client(packet) def send_to_server(packet): return ext.send_to_server(packet)
from g_python.gextension import Extension extension_info = { "title": "Extension stuff", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } extension_settings = { "use_click_trigger": True, "can_leave": True, "can_delete": True } ext = Extension(extension_info, sys.argv, extension_settings) def on_connection_start(): print('Connected with: {}:{}'.format(ext.connection_info['host'], ext.connection_info['port'])) print(ext.packet_infos) ext.on_event('double_click', lambda: print('Extension has been clicked')) ext.on_event('init', lambda: print('Initialized with g-earth')) ext.on_event('connection_start', on_connection_start) ext.on_event('connection_end', lambda: print('Connection ended')) ext.start()
class Ui_MainWindow(object): def __init__(self): extension_info = { "title": "FFBot", "description": "Bot for FallingFurni", "author": "Luizin & Lande", "version": "2.0" } self.extension = Extension(extension_info=extension_info, args=sys.argv) self.extension.start() def client_type(ext): sleep(0.50) return ext.connection_info["client_type"] self.client_type = client_type(self.extension) self.unity_string = "UNITY" self.flash_string = "FLASH" if str(self.client_type).__contains__(self.unity_string): headers = { "RoomUserWalk": 'Move', "RoomPlaceItem": 'ActiveObjectAdd', "UserTyping": 'UserStartTyping', "RoomPlaceItem_Wired": 'ActiveObjectUpdate' } else: headers = { "RoomUserWalk": 'MoveAvatar', "RoomPlaceItem": 'ObjectAdd', "UserTyping": 'StartTyping', "RoomPlaceItem_Wired": 'ObjectUpdate' } self.prefix = "!" self.disableType = False self.isStarted = False self.Capture = False self.FallingFurni = False self.location_x = 0 self.location_y = 0 self.specific = False self.autoStop = False self.isWired = False self.RoomPlaceItem = headers["RoomPlaceItem"] self.RoomUserWalk = headers["RoomUserWalk"] self.UserTyping = headers["UserTyping"] self.RoomPlaceItemWired = headers["RoomPlaceItem_Wired"] self.extension.intercept(Direction.TO_SERVER, self.DisableType, self.UserTyping) self.extension.intercept(Direction.TO_SERVER, self.CaptureTile, self.RoomUserWalk) self.extension.intercept(Direction.TO_CLIENT, self.FFBot, self.RoomPlaceItem, mode="async") self.extension.intercept(Direction.TO_CLIENT, self.FFBotWithWired, self.RoomPlaceItemWired, mode="async") def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(376, 376) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout_5 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_5.setObjectName("gridLayout_5") self.gridLayout_1 = QtWidgets.QGridLayout() self.gridLayout_1.setObjectName("gridLayout_1") self.gridLayout_3 = QtWidgets.QGridLayout() self.gridLayout_3.setObjectName("gridLayout_3") self.checkBox_6 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_6.setObjectName("checkBox_6") self.gridLayout_3.addWidget(self.checkBox_6, 4, 0, 1, 1) self.checkBox_5 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_5.setObjectName("checkBox_5") self.gridLayout_3.addWidget(self.checkBox_5, 2, 0, 1, 1) self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget) self.doubleSpinBox.setObjectName("doubleSpinBox") self.gridLayout_3.addWidget(self.doubleSpinBox, 1, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout_3.addWidget( self.label_2, 0, 0, 1, 1, QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom) self.checkBox_7 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_7.setObjectName("checkBox_7") self.gridLayout_3.addWidget(self.checkBox_7, 5, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout_3.addItem(spacerItem, 6, 0, 1, 1) self.gridLayout_1.addLayout(self.gridLayout_3, 2, 1, 1, 1) self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.checkBox_4 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_4.setObjectName("checkBox_4") self.gridLayout_2.addWidget(self.checkBox_4, 8, 0, 1, 1) self.checkBox_1 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_1.setObjectName("checkBox_1") self.gridLayout_2.addWidget(self.checkBox_1, 1, 0, 1, 1) self.checkBox_2 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_2.setObjectName("checkBox_2") self.gridLayout_2.addWidget(self.checkBox_2, 3, 0, 1, 1) self.label_1 = QtWidgets.QLabel(self.centralwidget) self.label_1.setObjectName("label_1") self.gridLayout_2.addWidget( self.label_1, 5, 0, 1, 1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) self.checkBox_3 = QtWidgets.QCheckBox(self.centralwidget) self.checkBox_3.setObjectName("checkBox_3") self.gridLayout_2.addWidget(self.checkBox_3, 4, 0, 1, 1) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout_2.addItem(spacerItem1, 0, 0, 1, 1) self.gridLayout_1.addLayout(self.gridLayout_2, 0, 1, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.gridLayout_1.addItem(spacerItem2, 1, 1, 1, 1) self.gridLayout_5.addLayout(self.gridLayout_1, 0, 1, 1, 1) self.console_log = QtWidgets.QPlainTextEdit(self.centralwidget) self.console_log.setReadOnly(True) self.console_log.setObjectName("console_log") self.gridLayout_5.addWidget(self.console_log, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) # ------------------------------------------------------------------------- self.checkBox_1.clicked.connect(self.ffbot) self.checkBox_2.clicked.connect(self.wired) self.checkBox_3.clicked.connect(self.fspecific) self.checkBox_4.clicked.connect(self.auto_stop) self.checkBox_5.clicked.connect(self.capture) self.checkBox_6.clicked.connect(self.disabletype) self.checkBox_7.clicked.connect(self.TopMost) def ffbot(self): if self.FallingFurni: self.FallingFurni = False self.Message("FallingFurni: OFF") else: self.FallingFurni = True self.Message("FallingFurni: ON") def wired(self): if self.isWired: self.isWired = False self.Message('FFBot Wired: OFF') else: self.isWired = True self.Message('FFBOT Wired: ON') def fspecific(self): if self.specific: self.specific = False self.Message("Specific Tile: OFF") else: self.specific = True self.Message("Specific Tile: ON") def auto_stop(self): if self.autoStop: self.autoStop = False self.Message("AUTO STOP: OFF") else: self.autoStop = True self.Message("AUTO STOP: ON") def capture(self): if self.Capture: self.Capture = False self.Message("Capture: OFF") else: self.Capture = True self.Message("Capture: ON") def disabletype(self): if self.disableType: self.disableType = False else: self.disableType = True if self.disableType: self.Message("IgnoreType: ON") else: self.Message("IgnoreType: OFF") def TopMost(self): if self.checkBox_7.isChecked(): MainWindow.setWindowFlag(QtCore.Qt.WindowStaysOnTopHint, on=True) self.Message("TopMost: ON") else: MainWindow.setWindowFlag(QtCore.Qt.WindowStaysOnTopHint, on=False) self.Message("TopMost: OFF") MainWindow.show() def Message(self, msg): msg = f'[FallingFurni] ~ {msg}' self.console_log.appendPlainText(msg) # ----------------------------------------------------------------------------- def DisableType(self, msg): if self.disableType: msg.is_blocked = True def CaptureTile(self, msg): if self.Capture: msg.is_blocked = True self.Capture = False (x, y) = msg.packet.read('ii') self.location_x, self.location_y = x, y self.checkBox_5.setChecked(False) self.label_1.setText(f"Tile : {x} ; {y}") self.Message(f"Capture Position: {x},{y}") def walk(self, x, y): d = self.doubleSpinBox.value() sleep(d) self.extension.send_to_server(HPacket(self.RoomUserWalk, x, y)) self.Message(f"Walk to : {x} ; {y} with {d} delay") if self.autoStop: self.FallingFurni = False self.checkBox_1.setChecked(False) self.isWired = False self.checkBox_2.setChecked(False) def FFBot(self, message): if self.FallingFurni: packet = message.packet if self.specific: self.walk(self.location_x, self.location_y) else: if str(self.client_type).__contains__(self.flash_string): ( _, _, x, y, _, _, _, _, _, _, _, _, _, ) = packet.read('iiiiissiisiii') else: ( _, _, x, y, _, _, _, _, _, _, _, _, _, ) = packet.read('liiiiliiisiil') self.walk(x, y) def FFBotWithWired(self, message): if self.isWired: packet = message.packet if self.specific: self.walk(self.location_x, self.location_y) else: if str(self.client_type).__contains__(self.flash_string): ( _, _, x, y, _, _, _, _, _, _, _, _, _, _, ) = packet.read('iiiiissiisiiis') else: (_, _, x, y, _, _, _, _, _, _, _, _, _) = packet.read('liiiliiisiils') self.walk(x, y) # ----------------------------------------------------------------------------- def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "FFBot")) self.checkBox_6.setText(_translate("MainWindow", "Disable Type")) self.checkBox_5.setText(_translate("MainWindow", "Capture")) self.label_2.setText(_translate("MainWindow", "Delay :")) self.checkBox_7.setText(_translate("MainWindow", "Top Most")) self.checkBox_4.setText(_translate("MainWindow", "Auto Stop")) self.checkBox_1.setText(_translate("MainWindow", "FFBot")) self.checkBox_2.setText(_translate("MainWindow", "Wired")) self.label_1.setText(_translate("MainWindow", "Tile : x ; y")) self.checkBox_3.setText(_translate("MainWindow", "Specific"))
import sys from time import sleep from g_python.gextension import Extension from g_python.hmessage import Direction, HMessage from g_python.hpacket import HPacket extension_info = { "title": "Packets example", "description": "g_python test", "version": "1.0", "author": "sirjonasxx" } ext = Extension(extension_info, sys.argv) ext.start() def on_walk(message): # packet = message.packet # x = packet.read_int() # y = packet.read_int() (x, y) = message.packet.read('ii') print("Walking to x:{}, y={}".format(x, y)) # send packet to server from HPacket() object # ext.send_to_server(HPacket(1843, 1)) # wave ext.send_to_server(HPacket('RoomUserAction', 1)) # wave # 2 ways of sending packets from string representations ext.send_to_client('{l}{u:1411}{i:0}{s:"hi"}{i:0}{i:23}{i:0}{i:2}')
def __init__(self): extension_info = { "title": "FFBot", "description": "Bot for FallingFurni", "author": "Luizin & Lande", "version": "2.0" } self.extension = Extension(extension_info=extension_info, args=sys.argv) self.extension.start() def client_type(ext): sleep(0.50) return ext.connection_info["client_type"] self.client_type = client_type(self.extension) self.unity_string = "UNITY" self.flash_string = "FLASH" if str(self.client_type).__contains__(self.unity_string): headers = { "RoomUserWalk": 'Move', "RoomPlaceItem": 'ActiveObjectAdd', "UserTyping": 'UserStartTyping', "RoomPlaceItem_Wired": 'ActiveObjectUpdate' } else: headers = { "RoomUserWalk": 'MoveAvatar', "RoomPlaceItem": 'ObjectAdd', "UserTyping": 'StartTyping', "RoomPlaceItem_Wired": 'ObjectUpdate' } self.prefix = "!" self.disableType = False self.isStarted = False self.Capture = False self.FallingFurni = False self.location_x = 0 self.location_y = 0 self.specific = False self.autoStop = False self.isWired = False self.RoomPlaceItem = headers["RoomPlaceItem"] self.RoomUserWalk = headers["RoomUserWalk"] self.UserTyping = headers["UserTyping"] self.RoomPlaceItemWired = headers["RoomPlaceItem_Wired"] self.extension.intercept(Direction.TO_SERVER, self.DisableType, self.UserTyping) self.extension.intercept(Direction.TO_SERVER, self.CaptureTile, self.RoomUserWalk) self.extension.intercept(Direction.TO_CLIENT, self.FFBot, self.RoomPlaceItem, mode="async") self.extension.intercept(Direction.TO_CLIENT, self.FFBotWithWired, self.RoomPlaceItemWired, mode="async")
from g_python.gextension import Extension extension_info = { "title": "Snake", "description": "Play snake", "version": "2.0", "author": "Lande" } extension_settings = { "use_click_trigger": True, "can_leave": True, "can_delete": True } ext = Extension(extension_info, sys.argv, extension_settings) ext.start() ext.on_event('double_click', lambda: main()) class Snake: def __init__(self): self.length = 1 self.positions = [((screen_width / 2), (screen_height / 2))] self.direction = right self.color = (50, 255, 50) self.score = 0 def get_head_position(self): return self.positions[0]