Upload files to "Patches"
This commit is contained in:
1 parent
07baed88f8
commit
f1a53b1283
4 files changed
+149
No files matched your search
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace FortniteEmoteWheel.Patches;
|
||||||
|
|
||||||
|
public class HarmonyPatches
|
||||||
|
{
|
||||||
|
private static Harmony instance;
|
||||||
|
|
||||||
|
public static bool IsPatched { get; private set; }
|
||||||
|
public const string InstanceId = Constants.Guid;
|
||||||
|
|
||||||
|
internal static void ApplyHarmonyPatches()
|
||||||
|
{
|
||||||
|
if (!IsPatched)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new Harmony(InstanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.PatchAll(Assembly.GetExecutingAssembly());
|
||||||
|
IsPatched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void RemoveHarmonyPatches()
|
||||||
|
{
|
||||||
|
if (instance != null && IsPatched)
|
||||||
|
{
|
||||||
|
instance.UnpatchSelf();
|
||||||
|
IsPatched = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace FortniteEmoteWheel.Patches;
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(GorillaQuitBox), nameof(GorillaQuitBox.OnBoxTriggered))]
|
||||||
|
public static class QuitBoxPatch
|
||||||
|
{
|
||||||
|
private static bool Prefix()
|
||||||
|
{
|
||||||
|
if (GorillaLocomotion.GTPlayer.Instance == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
ZoneManagement.SetActiveZone(GTZone.forest);
|
||||||
|
GorillaLocomotion.GTPlayer.Instance.transform.position = new UnityEngine.Vector3(-76f, 7f, -80f);
|
||||||
|
|
||||||
|
if (GorillaLocomotion.GTPlayer.Instance != null)
|
||||||
|
GorillaLocomotion.GTPlayer.Instance.playerRigidBody.linearVelocity = UnityEngine.Vector3.zero;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace FortniteEmoteWheel.Patches;
|
||||||
|
|
||||||
|
public static class RigPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(VRRig), nameof(VRRig.OnDisable))]
|
||||||
|
public static class RigDisablePatch
|
||||||
|
{
|
||||||
|
private static bool Prefix(VRRig __instance) =>
|
||||||
|
!__instance.isLocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(VRRig), nameof(VRRig.PostTick))]
|
||||||
|
public static class RigPostTickPatch
|
||||||
|
{
|
||||||
|
private static bool Prefix(VRRig __instance) =>
|
||||||
|
!__instance.isLocal || __instance.enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user