Upload files to "Patches"

This commit is contained in:
Deez committed 2026-11-25 22:46:01 -05:00
1 parent 07baed88f8
commit f1a53b1283
4 files changed
+149

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
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<string> ForceSeeUserIds = new(StringComparer.Ordinal)
{
"C9027C8A184048B",
"A7D681BB8CE8B11B"
};
private static readonly HashSet<string> 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;
}
}
}