def world_start(name='world_start'): return Struct( name, Variant('planet'), StarByteArray('sky_data'), StarByteArray('weather_data'), BFloat32('x'), BFloat32('y'), # Dungeon ID stuff here Variant('world_properties'), UBInt32('client_id'), Flag('local_interpolation'))
def client_connect(name='client_connect'): return Struct( name, StarByteArray('asset_digest'), HexAdapter(Field('uuid', 16)), star_string('name'), star_string('species'), ChunkVariant('ship_data'), UBInt32('ship_level'), UBInt32('max_fuel'), VLQ('capabilities_length'), Array(lambda ctx: ctx.capabilities_length, Struct('capabilities', star_string('value'))), star_string('account'))
def swap_in_container(name='swap_in_container'): return Struct( name, VLQ('entity_id'), # Where are we putting stuff star_string('item_name'), VLQ('count'), Byte('variant_type'), StarByteArray('item_description'), VLQ('slot'))
# (0) - ProtocolVersion : S -> C protocol_version = lambda name="protocol_version": Struct(name, UBInt32("server_build")) # (7) - ClientConnect : C -> S client_connect = lambda name="client_connect": Struct(name, VLQ("asset_digest_length"), String("asset_digest", lambda ctx: ctx.asset_digest_length), Flag("uuid_exists"), If(lambda ctx: ctx.uuid_exists is True, HexAdapter(Field("uuid", 16)) ), star_string("name"), star_string("species"), StarByteArray("ship_data"), UBInt32("ship_level"), UBInt32("max_fuel"), VLQ("capabilities_length"), Array(lambda ctx: ctx.capabilities_length, Struct("capabilities", star_string("value"))), star_string("account")) # (3) - HandshakeChallenge : S -> C handshake_challenge = lambda name="handshake_challenge": Struct(name, StarByteArray("salt")) # (9) - HandshakeResponse : C -> S handshake_response = lambda name="handshake_response": Struct(name, star_string("hash"))
def entity_update(name='entity_update'): return Struct(name, UBInt32('entity_id'), StarByteArray('delta'))
def swap_in_container_result(name='swap_in_container_result'): return Struct(name, star_string('item_name'), VLQ('count'), Byte('variant_type'), GreedyRange(StarByteArray('item_description')))
def handshake_challenge(name='handshake_challenge'): return Struct(name, StarByteArray('salt'))
WARP_UP=2, WARP_OTHER_SHIP=3, WARP_DOWN=4, WARP_HOME=5), world_coordinate(), star_string("player")) warp_command_write = lambda t, sector=u'', x=0, y=0, z=0, planet=0, satellite=0, player=u'': warp_command( ).build( Container( warp_type=t, world_coordinate=Container( sector=sector, x=x, y=y, z=z, planet=planet, satellite=satellite), player=player)) world_start = lambda name="world_start": Struct( name, Variant("planet"), Variant("world_structure"), StarByteArray("sky_structure"), StarByteArray("weather_data"), BFloat32("spawn_x"), BFloat32("spawn_y"), Variant("world_properties"), UBInt32("client_id"), Flag("local_interpolation")) world_stop = lambda name="world_stop": Struct(name, star_string("status")) give_item = lambda name="give_item": Struct(name, star_string( "name"), VLQ("count"), Byte("variant_type"), star_string("description")) give_item_write = lambda name, count: give_item().build( Container(name=name, count=count, variant_type=7, description='')) update_world_properties = lambda name="world_properties": Struct( name, UBInt8("count"), Array(lambda ctx: ctx.count, Struct("properties", star_string("key"), Variant("value"))))