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:
Flechazo committed 2026-10-14 21:35:24 +08:00
1 parent 00f1092940
commit c5584cc19b
1 file changed
+3 -1
+3 -1
View File
@@ -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)),