def test_system_message_ext_msg_handling(self): # tests SystemMessage with an ExtendedMessage containing a reference param mmdb_parser = MMDBParser("../../text.mdb") bot = Tyrbot() bot.mmdb_parser = mmdb_parser packet = SystemMessage.from_bytes(b'\x00\x05\xc0\xbe\x00\x00\x00\x00\x03@\xe2E\x00\x05l\x0f\xcf\xcaw') packet = bot.system_message_ext_msg_handling(packet) self.assertEqual("Could not send message to offline player: the message is too big to fit in the inbox", packet.extended_message.get_message())
def system_message_ext_msg_handling(self, packet: server_packets.SystemMessage): try: category_id = 20000 instance_id = packet.message_id template = self.mmdb_parser.get_message_string(category_id, instance_id) params = self.mmdb_parser.parse_params(packet.message_args) packet.extended_message = ExtendedMessage(category_id, instance_id, template, params) self.logger.log_chat("SystemMessage", None, packet.extended_message.get_message()) except Exception as e: self.logger.error("Error handling extended message: " + str(packet), e) return packet