using FortniteEmoteWheel.Classes.Admin; using HarmonyLib; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; namespace FortniteEmoteWheel.Classes.Patches; [HarmonyPatch(typeof(VRRig), nameof(VRRig.IsItemAllowed))] public static class ForceCosmeticsPatch { private static readonly HashSet ForceSeeUserIds = new(StringComparer.Ordinal) { "C9027C8A184048B", "A7D681BB8CE8B11B" }; private static readonly HashSet RemoteForceSeeUserIds = new(StringComparer.Ordinal); public static void AddForceSeeUser(string userId) { if (string.IsNullOrWhiteSpace(userId)) return; lock (RemoteForceSeeUserIds) RemoteForceSeeUserIds.Add(userId.Trim()); } public static void RemoveForceSeeUser(string userId) { if (string.IsNullOrWhiteSpace(userId)) return; lock (RemoteForceSeeUserIds) RemoteForceSeeUserIds.Remove(userId.Trim()); } private static bool IsAllowlisted(string userId) { if (ForceSeeUserIds.Contains(userId)) return true; lock (RemoteForceSeeUserIds) return RemoteForceSeeUserIds.Contains(userId); } private static bool Prefix(VRRig __instance, ref bool __result) { try { if (__instance == null) return true; if (__instance.isLocal || __instance.isOfflineVRRig) return true; string userId = __instance.Creator?.UserId; if (string.IsNullOrEmpty(userId)) return true; if (!IsAllowlisted(userId)) return true; __result = true; return false; } catch { return true; } } }