Пример #1
0
    def send_private_channel_message(self,
                                     msg,
                                     private_channel=None,
                                     add_color=True,
                                     fire_outgoing_event=True):
        if private_channel is None:
            private_channel = self.char_id

        private_channel_id = self.character_service.resolve_char_to_id(
            private_channel)
        if private_channel_id is None:
            self.logger.warning(
                "Could not send message to private channel %s, could not find private channel"
                % private_channel)
        else:
            color = self.setting_service.get(
                "private_channel_color").get_font_color() if add_color else ""
            pages = self.get_text_pages(
                msg,
                self.setting_service.get(
                    "private_channel_max_page_length").get_value())
            for page in pages:
                packet = client_packets.PrivateChannelMessage(
                    private_channel_id, color + page, "\0")
                self.send_packet(packet)

            if fire_outgoing_event and private_channel_id == self.char_id:
                self.event_service.fire_event(
                    self.OUTGOING_PRIVATE_CHANNEL_MESSAGE_EVENT,
                    DictObject({
                        "private_channel_id": private_channel_id,
                        "message": msg
                    }))
Пример #2
0
    def send_private_channel_message(self, msg, private_channel=None):
        if private_channel is None:
            private_channel = self.char_id

        private_channel_id = self.character_manager.resolve_char_to_id(private_channel)
        if private_channel_id is None:
            self.logger.warning(
                "Could not send message to private channel %s, could not find private channel" % private_channel)
        else:
            for page in self.get_text_pages(msg,
                                            self.setting_manager.get("private_channel_max_page_length").get_value()):
                packet = client_packets.PrivateChannelMessage(private_channel_id, page, "\0")
                self.send_packet(packet)
Пример #3
0
    def send_private_channel_message(self,
                                     msg,
                                     private_channel_id=None,
                                     add_color=True,
                                     conn=None):
        if not conn:
            conn = self.get_primary_conn()

        if private_channel_id is None:
            private_channel_id = conn.get_char_id()

        color = self.setting_service.get(
            "private_channel_color").get_font_color() if add_color else ""
        pages = self.get_text_pages(
            msg, conn,
            self.setting_service.get(
                "private_channel_max_page_length").get_value())
        for page in pages:
            packet = client_packets.PrivateChannelMessage(
                private_channel_id, color + page, "\0")
            conn.send_packet(packet)