Ejemplo n.º 1
0
    def _get_response_packet(self, join_result_code):
        notif_type = {
            0: NotificationType.YOU_JOINED,
            1: NotificationType.WRONG_PASSWORD
        }[join_result_code]

        channel = self.conn.server.chat_manager.get_channel(self.channel_name)

        notification = Notification(notif_type, channel)
        return notification.to_packet()
Ejemplo n.º 2
0
    def _get_response_packet(self, join_result_code):
        notif_type = {
            0: NotificationType.YOU_JOINED,
            1: NotificationType.WRONG_PASSWORD
        }[join_result_code]

        channel = self.conn.server.chat_manager.get_channel(self.channel_name)

        notification = Notification(notif_type, channel)
        return notification.to_packet()
Ejemplo n.º 3
0
    def _notify_leave(self, channel, leaver_guid):
        """ Send to all members of this channel that a player left. """
        members = channel.get_members()
        notification = Notification(NotificationType.LEFT, channel)
        notification.join_leave_guid = leaver_guid
        notify_packet = notification.to_packet()

        self.server.broadcast(notify_packet,
                              state=WorldConnectionState.IN_WORLD,
                              guids=members)
Ejemplo n.º 4
0
    def _notify_join(self, channel, joiner_guid):
        """ Send to all members of this channel that a player joined. """
        members = channel.get_members()
        notification = Notification(NotificationType.JOINED, channel)
        notification.join_leave_guid = joiner_guid
        notify_packet = notification.to_packet()

        members.remove(joiner_guid)
        self.server.broadcast(notify_packet,
                              state=WorldConnectionState.IN_WORLD,
                              guids=members)
Ejemplo n.º 5
0
    def _get_response_packet(self, leave_result_code):
        notif_type = {
            0: NotificationType.YOU_LEFT,
            1: NotificationType.NOT_MEMBER,
            2: NotificationType.INVALID_NAME
        }[leave_result_code]

        channel = self.conn.server.chat_manager.get_channel(self.channel_name)

        notification = Notification(notif_type, channel)
        return notification.to_packet()
Ejemplo n.º 6
0
    def _notify_leave(self, channel, leaver_guid):
        """ Send to all members of this channel that a player left. """
        members = channel.get_members()
        notification = Notification(NotificationType.LEFT, channel)
        notification.join_leave_guid = leaver_guid
        notify_packet = notification.to_packet()

        self.server.broadcast(
            notify_packet,
            state = WorldConnectionState.IN_WORLD,
            guids = members
        )
Ejemplo n.º 7
0
    def _notify_join(self, channel, joiner_guid):
        """ Send to all members of this channel that a player joined. """
        members = channel.get_members()
        notification = Notification(NotificationType.JOINED, channel)
        notification.join_leave_guid = joiner_guid
        notify_packet = notification.to_packet()

        members.remove(joiner_guid)
        self.server.broadcast(
            notify_packet,
            state = WorldConnectionState.IN_WORLD,
            guids = members
        )
Ejemplo n.º 8
0
    def _get_channel_response_packet(self, result_code):
        notif_type = {
            0: None,
            1: NotificationType.NOT_MEMBER,
            2: NotificationType.INVALID_NAME,
            3: None,
            4: NotificationType.MUTED
        }[result_code]

        if notif_type is None:
            return None

        channel_name = self.message.channel_name
        channel = self.conn.server.chat_manager.get_channel(channel_name)

        notification = Notification(notif_type, channel)
        return notification.to_packet()
Ejemplo n.º 9
0
    def _get_channel_response_packet(self, result_code):
        notif_type = {
            0: None,
            1: NotificationType.NOT_MEMBER,
            2: NotificationType.INVALID_NAME,
            3: None,
            4: NotificationType.MUTED
        }[result_code]

        if notif_type is None:
            return None

        channel_name = self.message.channel_name
        channel = self.conn.server.chat_manager.get_channel(channel_name)

        notification = Notification(notif_type, channel)
        return notification.to_packet()