Beispiel #1
0
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)
Beispiel #2
0
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 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 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)
Beispiel #5
0
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)
Beispiel #6
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 RoomRatingMessageComposer:
    def __init__(self, room_score):
        self.response = Response(outgoing.RoomRatingMessageComposer)
        self.response.write_int(room_score)
        self.response.write_bool(False)
class AvailabilityMessageComposer:
    def __init__(self):
        self.response = Response(outgoing.AvailabilityMessageComposer)
        self.response.write_bool(True)
        self.response.write_bool(False)
        self.response.write_bool(True)