Closed belldandu closed 9 years ago
Did some testing. Turns out sega uses the team chat packet on shared ship for messages sent from people not in your party that are in quest with you.
Thanks sega :|
Here's a new task.
Use this for reference to the original issue: https://github.com/cyberkitsune/PSO2Proxy/issues/152
Here are some screenshots after adding the below code to translator.py: http://i.imgur.com/H5VZ19k.jpg http://i.imgur.com/bjyhHzx.jpg
PS the below code is not a fix its just a copy paste from 0x7,0x0 as a test
@p.PacketHook(0x7, 0x11) def get_chat_packet(context, packet): """ :type context: ShipProxy.ShipProxy """ try: if context.psoClient and context.playerId and data.clients.connectedClients[context.playerId].preferences.get_preference('translate_out'): player_id = struct.unpack_from("I", packet, 0x8)[0] if player_id != 0: # ??? return channel_id = struct.unpack_from("I", packet, 0x14)[0] message = packet[0x1C:].decode('utf-16').rstrip("\0") d = threads.deferToThread(generate_translated_message, player_id, channel_id, message, "ja", "en") d.addCallback(context.peer.send_crypto_packet) return None except KeyError: return packet if context.peer.psoClient and context.peer.playerId in data.clients.connectedClients: user_prefs = data.clients.connectedClients[context.peer.playerId].preferences if not user_prefs.get_preference('translate_chat'): return packet player_id = struct.unpack_from("I", packet, 0x8)[0] if player_id == 0: # We sent it return packet channel_id = struct.unpack_from("I", packet, 0x14)[0] message = packet[0x1C:].decode('utf-16').rstrip("\0") if message.startswith("/"): return packet # Command japanese = False for char in message: char_script = script(unicode(char)) if char_script != 'Latin' and char_script != 'Common': japanese = True break if not japanese: return packet d = threads.deferToThread(generate_translated_message, player_id, channel_id, message, "en", "ja") d.addCallback(context.peer.send_crypto_packet) return None return packet def generate_translated_message(player_id, channel_id, message, end_lang, start_lang): if provider == "Bing" and time.time() - lastKeyTime >= 600: translator.access_token = translator.get_access_token() try: if end_lang == "ja": message_string = "%s" % translator.translate(message, end_lang, start_lang) else: message_string = "%s {def}(%s)" % (translator.translate(message, end_lang, start_lang), message) except Exception as e: print (str(e)) message_string = message return packetFactory.ChatPacket(player_id, message_string, channel_id).build()
Thanks guys
Did some testing. Turns out sega uses the team chat packet on shared ship for messages sent from people not in your party that are in quest with you.
Thanks sega :|
Here's a new task.
Use this for reference to the original issue: https://github.com/cyberkitsune/PSO2Proxy/issues/152
Here are some screenshots after adding the below code to translator.py: http://i.imgur.com/H5VZ19k.jpg http://i.imgur.com/bjyhHzx.jpg
PS the below code is not a fix its just a copy paste from 0x7,0x0 as a test