Package: g-python
G-PythonG-Earth extension interface for Python.G-Earth + G-Python allows you to create simple scripts for Habbo and run them on the fly!InstallationRequires python >= 3.2:https://www.python.org/downloads/Note: during Windows installation, make sure to select "Add python to PATH" if you want to install G-Python extensions in G-EarthThen execute the following in a terminal:python -m pip install g-pythonFeaturesG-Python exports the following modules:fromg_python.gextensionimportExtensionfromg_python.hmessageimportDirection,HMessagefromg_python.hpacketimportHPacketfromg_pythonimporthparsersfromg_pythonimporthtoolsAt any point where a(header)idis required, anameorhashcan be used as well, if G-Earth is connected to Harble API"hparsers" contains a load of useful parsers"htools" contains fully prepared environments for accessing your Inventory, Room Furniture, and Room UsersUsageExamples are available in thetests/folder.(highly recommended to check out, since it contains functionality not shown underneath)This is a template extension with the minimal amount of code to connect with G-Earth:importsysfromg_python.gextensionimportExtensionextension_info={"title":"Extension stuff","description":"g_python test","version":"1.0","author":"sirjonasxx"}ext=Extension(extension_info,sys.argv)# sys.argv are the commandline arguments, for example ['-p', '9092'] (G-Earth's extensions port)ext.start()It is possible to register for events: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',lambda:print('Connection started'))ext.on_event('connection_end',lambda:print('Connection ended'))Packet injection:# sending packets to the serverext.send_to_server(HPacket('RoomUserAction',1))# wave using harble api nameext.send_to_server(HPacket(1843,1))# wave using header Idext.send_to_server(HPacket('623058bd68a68267114aa8d1ee15b597',1))# wave using harble api hash# sending packets from raw text:ext.send_to_client('{l}{u:1411}{i:0}{s:"hi"}{i:0}{i:23}{i:0}{i:2}')ext.send_to_client('[0][0][0][6][5][131][0][0][0][0]')ext.send_to_client(HPacket.from_string('[0][0][0][6][5][131][0][0][0][0]',ext))# string methods:packet=HPacket(1231,"hi",5,"old",False,True,"lol")expression=packet.g_expression(ext)# G-Earth's predicted expressiong_string=packet.g_string(ext)# G-Earth's string representationIntercepting packets:# intercept & print all packetsdefall_packets(message):packet=message.packetprint(packet.g_string(ext))ext.intercept(Direction.TO_CLIENT,all_packets)ext.intercept(Direction.TO_SERVER,all_packets)# intercept & parse specific packetsdefon_walk(message):(x,y)=message.packet.read('ii')print("Walking to x:{}, y={}".format(x,y))defon_speech(message):(text,color,index)=message.packet.read('sii')message.is_blocked=(text=='blocked')# block packet if speech equals "blocked"print("User said:{}".format(text))ext.intercept(Direction.TO_SERVER,on_walk,'RoomUserWalk')ext.intercept(Direction.TO_SERVER,on_speech,'RoomUserTalk')There is much more, such as:packet manipulationspecific settings to be given to an Extension objecthparsers: example intests/user_profile.pyhtools:tests/room_stuff.py&tests/inventory_items.py