mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-27 16:09:07 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user