def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.id = ObjectID() self.id.serialize(bit_stream) self.parent_id = ObjectID() self.parent_id.serialize(bit_stream) bit_stream.write_int(len(self.components)) for item in self.components: bit_stream.write_str(item) bit_stream.write_int(len(self.parent_components)) for item in self.parent_components: bit_stream.write_str(item) bit_stream.write_dt(self.create_time) bit_stream.write_dt(self.modified_time) bit_stream.write_int(len(self.properties)) for key in self.properties: bit_stream.write_str(key) bit_stream.write_int(len(self.properties[key])) for item in self.properties[key]: bit_stream.write_str(item) bit_stream.write_int(len(self.children_group)) for key in self.children_group: bit_stream.write_str(key) bit_stream.write_int(len(self.children_group[key])) for item in self.children_group[key]: bit_stream.write_int(len(item)) for list_item in item: list_item.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() bit_stream.write_none() # GSFZoneInstance bit_stream.write_none() # GSFVillage self.home.serialize(bit_stream) bit_stream.write_str(self.sync_server_token) bit_stream.write_str(self.sync_server_ip) bit_stream.write_int(self.sync_server_port)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_int(self.code) bit_stream.write_str(self.name) bit_stream.write_bool(self.chat_send_allowed) bit_stream.write_bool(self.chat_receive_allowed) bit_stream.write_bool(self.login_allowed) bit_stream.write_int(self.ban_length)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.asset_map)) for key in self.asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.asset_map[key])) for item in self.asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.asset_packages)) for item in self.asset_packages: item.serialize(bit_stream)
def test_read_write_primitive(self): int_values = [-32769, -32768, -128, -127, -8, -7, 0, 7, 8, 127, 128, 32768, 32769] bit_stream = BitStream() for i in int_values: bit_stream.write_int(i) bit_stream.write_long(i) bit_stream.write_str(str(i)) bit_stream.cursor = 0 for i in int_values: self.assertEqual(bit_stream.read_int(), i) self.assertEqual(bit_stream.read_long(), i) self.assertEqual(bit_stream.read_str(), str(i))
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.asset_map)) for key in self.asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.asset_map[key])) for item in self.asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.asset_packages)) for item in self.asset_packages: item.serialize(bit_stream) self.stats_type_id.serialize(bit_stream) bit_stream.write_bool(self.is_default, nullable=True)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_str(self.asset_type_name) bit_stream.write_str(self.cdn_id) bit_stream.write_str(self.res_name) bit_stream.write_str(self.group_name) bit_stream.write_long(self.file_size)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() # GSFMessage bit_stream.write_start() # MessageHeader bit_stream.write_int(self.__flags__) bit_stream.write_int(self.__service_class__) bit_stream.write_int(self.__message_type__) if self.is_service: bit_stream.write_int(self.request_id) if self.is_request: bit_stream.write_str(None) # log_correlator (always empty) if self.is_response: bit_stream.write_int(self.__result_code__) bit_stream.write_int(self.__app_code__) if self.__app_code__ != 0: app_code_name = self.app_code.name if self.__app_code__ is not None else '' bit_stream.write_str(app_code_name) if self.__app_code__ == 17: bit_stream.write_int(0) # app_codes size (always empty)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_str(self.name) bit_stream.write_long(self.size) bit_stream.write_bytes(self.thumbnail) bit_stream.write_dt(self.publish_timestamp) bit_stream.write_short(self.num_rooms) bit_stream.write_short(self.num_tubes) bit_stream.write_short(self.rating, True) bit_stream.write_bool(self.is_locked) bit_stream.write_bool(self.is_home_maze) bit_stream.write_bool(self.is_published) bit_stream.write_bool(self.is_publish_expired) self.player_id.serialize(bit_stream) bit_stream.write_int(0) # GSFPlayerMazePieces self.home_theme.serialize(bit_stream) self.parent_id.serialize(bit_stream) self.source_id.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() if self.player_maze: self.player_maze.serialize(bit_stream) else: bit_stream.write_none() bit_stream.write_str(self.player_name) bit_stream.write_bool(self.findable) bit_stream.write_dt(self.findable_date) if self.home_theme: self.home_theme.serialize(bit_stream) else: bit_stream.write_none() if self.player_id: self.player_id.serialize(bit_stream) else: bit_stream.write_none() bit_stream.write_int(len(self.player_mazes)) for item in self.player_mazes: item.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_dt(self.create_date) bit_stream.write_dt(self.accepted_date) bit_stream.write_dt(self.started_date) bit_stream.write_dt(self.expiry_date) bit_stream.write_dt(self.completed_date) self.player_id.serialize(bit_stream) self.quest_state_id.serialize(bit_stream) bit_stream.write_str(self.quest_state_name) self.player_avatar_id.serialize(bit_stream) self.parent_player_quest_id.serialize(bit_stream) self.quest.serialize(bit_stream) bit_stream.write_int(self.player_level) bit_stream.write_int(self.npc_relationship_level) bit_stream.write_int(self.npc_relationship_points) bit_stream.write_int(self.player_money) bit_stream.write_int(self.player_xp) bit_stream.write_bool(self.unlocked) self.rule_property.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_dt(self.create_date) if self.active_player_avatar: self.active_player_avatar.serialize(bit_stream) else: bit_stream.write_none() self.home_theme_id.serialize(bit_stream) self.current_race_mode.serialize(bit_stream) bit_stream.write_str(self.workshop_options) bit_stream.write_bool(self.is_tutorial_completed) self.yard_building_id.serialize(bit_stream) bit_stream.write_dt(self.last_login) bit_stream.write_long(self.play_time, nullable=True) bit_stream.write_bool(self.is_qa) self.home_village_plot_id.serialize(bit_stream) self.store_village_plot_id.serialize(bit_stream) self.player_store_id.serialize(bit_stream) self.player_maze_id.serialize(bit_stream) self.village_id.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.container_aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.container_asset_map)) for key in self.container_asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.container_asset_map[key])) for item in self.container_asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.container_asset_pkg)) for item in self.container_asset_pkg: item.serialize(bit_stream) bit_stream.write_short(self.rotation_days) bit_stream.write_short(self.rotation_rate) self.reporting_level_id.serialize(bit_stream) bit_stream.write_bool(self.paid) bit_stream.write_bool(self.premium) bit_stream.write_bool(self.closed) bit_stream.write_str(self.pricing_info) bit_stream.write_short(self.expiry_period) bit_stream.write_int(self.ordinal) self.expiry_tier_id.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.tier_id.serialize(bit_stream) bit_stream.write_str(self.player_name) bit_stream.write_str(self.world_name) self.crisp_data.serialize(bit_stream) bit_stream.write_bool(self.verified) bit_stream.write_dt(self.verification_expiry) bit_stream.write_dt(self.scs_block_expiry) self.eula_id.serialize(bit_stream) self.current_eula_id.serialize(bit_stream) bit_stream.write_bool(self.u_13) bit_stream.write_bool(self.chat_blocked_parent) bit_stream.write_bool(self.chat_allowed) bit_stream.write_dt(self.chat_blocked_expiry) bit_stream.write_bool(self.findable) bit_stream.write_dt(self.findable_date) bit_stream.write_dt(self.user_subscription_expiry_date) bit_stream.write_bool(self.qa) bit_stream.write_int(len(self.player_settings)) for ps in self.player_settings: ps.serialize(bit_stream)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.asset_map)) for key in self.asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.asset_map[key])) for item in self.asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.asset_packages)) for item in self.asset_packages: item.serialize(bit_stream) self.rule_property.serialize(bit_stream) bit_stream.write_bool(self.locked) bit_stream.write_bool(self.is_multiplayer) bit_stream.write_bool(self.is_player_hosted) bit_stream.write_bool(self.is_played_offline) self.dimensions.serialize(bit_stream) bit_stream.write_int(len(self.buildings)) for item in self.buildings: item.serialize(bit_stream) bit_stream.write_str(self.ptag) bit_stream.write_int(self.capacity)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) self.avatar.serialize(bit_stream) self.player_id.serialize(bit_stream) bit_stream.write_str(self.name) bit_stream.write_str(self.bio) bit_stream.write_str(self.secret_code) bit_stream.write_dt(self.create_ts) self.player_avatar_outfit_id.serialize(bit_stream) bit_stream.write_short(self.outfit_no) bit_stream.write_long(self.play_time, nullable=True) bit_stream.write_dt(self.last_play)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) self.from_player_id.serialize(bit_stream) bit_stream.write_str(self.from_player_name) self.to_player_id.serialize(bit_stream) bit_stream.write_str(self.village_name) self.village_id.serialize(bit_stream) self.object_id.serialize(bit_stream) bit_stream.write_str(self.notification_text) self.notification.serialize(bit_stream) bit_stream.write_bool(self.is_read) bit_stream.write_dt(self.create_date) bit_stream.write_dt(self.expiry_date)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.container_aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.container_asset_map)) for key in self.container_asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.container_asset_map[key])) for item in self.container_asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.container_asset_pkg)) for item in self.container_asset_pkg: item.serialize(bit_stream) bit_stream.write_str(self.player_stats_type_value.name) bit_stream.write_bool(self.is_avatar) bit_stream.write_str(self.name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_int(len(self.asset_map)) for key in self.asset_map: bit_stream.write_str(key) bit_stream.write_int(len(self.asset_map[key])) for item in self.asset_map[key]: item.serialize(bit_stream) bit_stream.write_int(len(self.asset_packages)) for item in self.asset_packages: item.serialize(bit_stream) bit_stream.write_str(self.dimensions) bit_stream.write_double(self.weight) bit_stream.write_double(self.height) bit_stream.write_short(self.max_outfits) bit_stream.write_str(self.name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.site_info.serialize(bit_stream) bit_stream.write_str(self.session_status.name) self.session_id.serialize(bit_stream) bit_stream.write_long(self.conversation_id) bit_stream.write_str(self.asset_delivery_url) self.player.serialize(bit_stream) bit_stream.write_short(self.max_outfit) bit_stream.write_int(len(self.player_stats)) for ps in self.player_stats: ps.serialize(bit_stream) self.player_info.serialize(bit_stream) bit_stream.write_dt(self.current_server_time) bit_stream.write_dt(self.system_lockout_time) bit_stream.write_dt(self.system_shutdown_time) bit_stream.write_int(self.client_inactivity_timeout) bit_stream.write_str(self.cnl)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() bit_stream.write_str(self.filter_name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.crisp_action_id.serialize(bit_stream) bit_stream.write_str(self.crisp_message) bit_stream.write_dt(self.crisp_expiry_date) bit_stream.write_bool(self.crisp_confirmed)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.site_frame.serialize(bit_stream) bit_stream.write_str(self.asset_delivery_url)
def test_write_str(self): bit_stream = BitStream() bit_stream.write_str('ЯAmazing') self.assertEqual(bit_stream.data, b'\xC1\x20\xD0\xAFAmazing')
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) self.player_id.serialize(bit_stream) bit_stream.write_str(self.setting_name) bit_stream.write_str(self.value)
def serialize(self, bit_stream: BitStream): if not bit_stream.read_start(): return bit_stream.write_str(self.filter_name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() bit_stream.write_int(len(self.names)) for name in self.names: bit_stream.write_str(name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() bit_stream.write_str(self.client_version)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.aw_object_id.serialize(bit_stream) bit_stream.write_str(self.name)
def serialize(self, bit_stream: BitStream): bit_stream.write_start() self.site_id.serialize(bit_stream) bit_stream.write_str(self.nickname_first) bit_stream.write_str(self.nickname_last) self.site_user_id.serialize(bit_stream)