fix(plugin): restore AI translation settings initialization
Resolve the auto-translation property setter through GameNames so runtime obfuscation does not abort FChat setup.
This commit is contained in:
1 parent
00f1092940
commit
c5584cc19b
1 file changed
+3
-1
@@ -33,7 +33,9 @@ internal static class NativeChatTranslation
|
||||
{
|
||||
ChatTranslationProvider.Diagnostics = message => Plugin.Log?.LogInfo(message);
|
||||
NativeTranslationDisplay.Install(harmony);
|
||||
harmony.Patch(AccessTools.PropertySetter(typeof(ChatSettingPacket), nameof(ChatSettingPacket.IsOnAutoTranslateChat)),
|
||||
harmony.Patch(typeof(ChatSettingPacket).GetGameProperty(nameof(ChatSettingPacket.IsOnAutoTranslateChat),
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)?.GetSetMethod() ??
|
||||
throw new MissingMethodException(nameof(ChatSettingPacket), nameof(ChatSettingPacket.IsOnAutoTranslateChat)),
|
||||
prefix: new HarmonyMethod(typeof(NativeChatTranslation), nameof(BeforeAutomaticChanged)),
|
||||
postfix: new HarmonyMethod(typeof(NativeChatTranslation), nameof(AutomaticChanged)));
|
||||
harmony.Patch(Game.Method(() => Guild.SendGuildChatTranslateRequest(0, null, 0, 0)),
|
||||
|
||||
Reference in new issue
Block a user