mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-26 07:29:00 -07:00
43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using HarmonyLib;
|
|
|
|
internal static class InviteOnlineFriendsPatch
|
|
{
|
|
internal static void Apply(Harmony harmony)
|
|
{
|
|
harmony.Patch(AccessTools.PropertyGetter(typeof(ECFHJOKNJIJ), "OHKPFEMEPAE"),
|
|
prefix: new HarmonyMethod(typeof(InviteOnlineFriendsPatch), nameof(EnableDialog)));
|
|
harmony.Patch(AccessTools.PropertyGetter(typeof(ECFHJOKNJIJ), "EBCNNMAJGBN"),
|
|
prefix: new HarmonyMethod(typeof(InviteOnlineFriendsPatch), nameof(IncomingDialog)));
|
|
}
|
|
|
|
private static bool EnableDialog(ECFHJOKNJIJ __instance, ref bool __result)
|
|
{
|
|
return ReadServerOverride(__instance, "Radicade.Invites.ShowOnlineFriendsBeforeJoining", ref __result);
|
|
}
|
|
|
|
private static bool IncomingDialog(ECFHJOKNJIJ __instance, ref bool __result)
|
|
{
|
|
return ReadServerOverride(__instance, "Radicade.Invites.UseRRUIDialog", ref __result);
|
|
}
|
|
|
|
private static readonly System.Collections.Generic.HashSet<string> logged = new();
|
|
|
|
private static bool ReadServerOverride(ECFHJOKNJIJ instance, string key, ref bool result)
|
|
{
|
|
try
|
|
{
|
|
var configs = instance.CCNKOPKDIJI;
|
|
if (configs == null || !configs.FNBNNDMHFCK) return true;
|
|
if (!bool.TryParse(configs.KFNCGHMLMAI(key), out var value)) return true;
|
|
result = value;
|
|
return false;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
if (logged.Add(key + ":error"))
|
|
RadicadeEacBypassPlugin.LogSource.LogWarning("[InviteUI] config lookup failed: " + ex.Message);
|
|
return true;
|
|
}
|
|
}
|
|
}
|