class NavigatorMetaDataComposer: def __init__(self): self.response = Response(outgoing.NavigatorMetaDataComposer) self.response.write_int(len(game.navigator_manager.get_parent_tabs())) for tab in game.navigator_manager.get_parent_tabs(): self.response.write_string(tab.tab_name) self.response.write_int(0)
class HeightMapMessageComposer: def __init__(self, room, map_size_x, map_size_y): self.response = Response(outgoing.HeightMapMessageComposer) self.response.write_int(map_size_x) self.response.write_int(map_size_x * map_size_y) for y in range(0, map_size_y): for x in range(0, map_size_x): self.response.write_short( int(room.get_model().square_height[x][y] * 256))
class NavigatorCategoriesComposer: def __init__(self, categories): self.response = Response(outgoing.NavigatorCategories) self.response.write_int(4 + len(categories)) for category in categories: self.response.write_string("category__" + category.name) self.response.write_string("recommended") self.response.write_string("new_ads") self.response.write_string("staffpicks") self.response.write_string("official")
class FlatCategoriesMessageComposer: def __init__(self, categories, rank): self.response = Response(outgoing.FlatCategoriesMessageComposer) self.response.write_int(len(categories)) for category in categories: self.response.write_int(category.id) self.response.write_string(category.name) self.response.write_bool(category.min_rank <= rank) self.response.write_bool(False) self.response.write_string("NONE") self.response.write_string("") self.response.write_bool(False)
class UserStatusMessageComposer: def __init__(self, users): self.response = Response(outgoing.UserStatusMessageComposer) self.response.write_int(len(users)) for entity in users: self.response.write_int(entity.room_user.virtual_id) self.response.write_int(entity.room_user.position.x) self.response.write_int(entity.room_user.position.y) self.response.write_string(str(entity.room_user.position.z)) self.response.write_int(entity.room_user.head_rotation) self.response.write_int(entity.room_user.rotation) status = "/" for key, value in entity.room_user.statuses.items(): status += key + " " + value + "/" self.response.write_string(status + "/")
class RoomDataMessageComposer: def __init__(self, room, player, is_loading, check_entry): self.response = Response(outgoing.RoomDataMessageComposer) self.response.write_bool(is_loading) room.data.serialise(self.response, is_loading) self.response.write_bool(check_entry) self.response.write_bool(False) self.response.write_bool(False) self.response.write_bool(False) self.response.write_int(room.data.who_can_mute) self.response.write_int(room.data.who_can_kick) self.response.write_int(room.data.who_can_ban) self.response.write_bool(room.has_rights(player.details.id, True)) # is mod or owner self.response.write_int(0) self.response.write_int(0) self.response.write_int(0) self.response.write_int(0) self.response.write_int(0)
class NavigatorPreferencesComposer: def __init__(self): self.response = Response(outgoing.NavigatorPreferencesComposer) self.response.write_int(50) self.response.write_int(50) self.response.write_int(580) self.response.write_int(600) self.response.write_bool_int(True) self.response.write_int(1)
class UserObjectMessageComposer: def __init__(self, details): self.response = Response(outgoing.UserObjectMessageComposer) self.response.write_int(details.id) self.response.write_string(details.username) self.response.write_string(details.figure) self.response.write_string("M") self.response.write_string(details.motto) self.response.write_string("") self.response.write_bool(False) # ? self.response.write_int(0) # Respect self.response.write_int(3) # Daily Respect Points self.response.write_int(3) # Daily Pet Respect Points self.response.write_bool(True) self.response.write_string("1448526834") self.response.write_bool(True) self.response.write_bool(False)
class SearchResultSetComposer: def __init__(self, session, tab, search_query): categories = game.navigator_manager.get_navigator_categories() self.response = Response(outgoing.SearchResultSetComposer) self.response.write_string(tab.tab_name) self.response.write_string(search_query) # If empty search query if len(search_query) == 0: tabs = [] room_limit = True if tab.child_id != -1: tabs.append(tab) room_limit = False else: tabs += (tab.get_child_tabs()) if tab.show_categories: self.response.write_int(len(tabs) + len(categories)) else: self.response.write_int(len(tabs)) for navigator_tab in tabs: self.response.write_string(navigator_tab.tab_name) self.response.write_string(navigator_tab.title) if room_limit: self.response.write_int(navigator_tab.button_type) self.response.write_bool(navigator_tab.thumbnail) else: self.response.write_int(2) self.response.write_bool(False) self.response.write_bool_int(navigator_tab.thumbnail) _rooms = navigator_tab.populator.generate_listing( room_limit, session) self.response.write_int(len(_rooms)) # room_dao count for room in _rooms: room.data.serialise(self.response, False) if tab.show_categories: for category in categories: self.response.write_string(category.name.lower().replace( " ", "_").replace(",", "").replace("&", "").replace("__", "_")) self.response.write_string("") self.response.write_int(2) self.response.write_bool(False) self.response.write_int(0) _rooms = [] self.response.write_int(len(_rooms)) # room_dao count for room in _rooms: room.data.serialise(self.response, False) else: self.response.write_int(0)
class FloorMapMessageComposer: def __init__(self, room): self.response = Response(outgoing.FloorMapMessageComposer) self.response.write_bool(True) self.response.write_int(room.data.wall_height) self.response.write_string(room.get_model().floor_map)
class RightsLevelMessageComposer: def __init__(self, level): self.response = Response(outgoing.RightsLevelMessageComposer) self.response.write_int(level)
class RoomRatingMessageComposer: def __init__(self, room_score): self.response = Response(outgoing.RoomRatingMessageComposer) self.response.write_int(room_score) self.response.write_bool(False)
class RoomModelMessageComposer: def __init__(self, model_name, room_id): self.response = Response(outgoing.InitialRoomInfoMessageComposer) self.response.write_string(model_name) self.response.write_int(room_id)
class UserDisplayMessageComposer: def __init__(self, users): self.response = Response(outgoing.UserDisplayMessageComposer) self.response.write_int(len(users)) for entity in users: self.response.write_int(entity.details.id) self.response.write_string(entity.details.username) self.response.write_string(entity.details.motto) self.response.write_string(entity.details.figure) self.response.write_int(entity.room_user.virtual_id) self.response.write_int(entity.room_user.position.x) self.response.write_int(entity.room_user.position.y) self.response.write_string(str(entity.room_user.position.z)) self.response.write_int(0) self.response.write_int(1) self.response.write_string("m") self.response.write_int(-1) self.response.write_int(-1) self.response.write_int(0) self.response.write_int(1337) self.response.write_bool(False)
class MOTDMessageComposer: def __init__(self, message): self.response = Response(outgoing.MOTDMessageComposer) self.response.write_int(1) self.response.write_string(message)
class PrepareRoomMessageComposer: def __init__(self, room_id): self.response = Response(outgoing.RoomUpdateMessageComposer) self.response.write_int(room_id)