diff --git a/Directory.Build.props b/Directory.Build.props
index c4dffba..4cf5038 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -126,11 +126,6 @@
false
$(VRChatFolder)\Mods\ActionMenuApi.dll
-
- false
- false
- $(VRChatFolder)\Mods\VRChatUtilityKit.dll
-
false
false
diff --git a/StandaloneThirdPerson/Main.cs b/StandaloneThirdPerson/Main.cs
index 85b8a43..c1d7ae7 100644
--- a/StandaloneThirdPerson/Main.cs
+++ b/StandaloneThirdPerson/Main.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Linq;
+using HarmonyLib;
using MelonLoader;
using UnityEngine;
using Main = StandaloneThirdPerson.Main;
@@ -19,8 +20,8 @@ internal partial class Main : MelonMod
private static Camera vrcCamera;
private static bool initialised;
- private static bool Allowed => VRChatUtilityKit.Utilities.VRCUtils.AreRiskyFunctionsAllowed;
-
+ internal static bool Allowed;
+
public override void OnApplicationStart()
{
//Credits to https://github.com/Psychloor/PlayerRotater/blob/master/PlayerRotater/ModMain.cs#L40 for this vr check
@@ -28,7 +29,6 @@ public override void OnApplicationStart()
ModSettings.RegisterSettings();
ModSettings.LoadSettings();
MelonCoroutines.Start(WaitForUIInit());
- VRChatUtilityKit.Utilities.NetworkEvents.OnRoomJoined += new Action(delegate { currentMode = CameraMode.Normal; });
}
private static IEnumerator WaitForUIInit()
@@ -187,5 +187,16 @@ public override void OnPreferencesSaved()
{
ModSettings.LoadSettings();
}
+
+ [HarmonyPatch(typeof(NetworkManager), "OnJoinedRoom")]
+ internal class OnJoinedRoomPatch
+ {
+ private static void Prefix()
+ {
+ currentMode = CameraMode.Normal;
+ Allowed = false;
+ MelonCoroutines.Start(Utils.CheckWorld());
+ }
+ }
}
}
\ No newline at end of file
diff --git a/StandaloneThirdPerson/Utils.cs b/StandaloneThirdPerson/Utils.cs
index bff6afa..143e625 100644
--- a/StandaloneThirdPerson/Utils.cs
+++ b/StandaloneThirdPerson/Utils.cs
@@ -1,4 +1,11 @@
-namespace StandaloneThirdPerson
+using System;
+using System.Collections;
+using MelonLoader;
+using UnityEngine;
+using UnityEngine.Networking;
+using VRC.Core;
+
+namespace StandaloneThirdPerson
{
public static class Utils
{
@@ -6,5 +13,59 @@ public static bool IsBigMenuOpen()
{
return VRCUiManager.field_Private_Static_VRCUiManager_0.field_Internal_Dictionary_2_String_VRCUiPage_0.Count > 0;
}
+
+
+ // Credits to Psychloor for this: https://github.com/Psychloor/PlayerRotater/blob/master/PlayerRotater/Utilities.cs#L76
+ internal static IEnumerator CheckWorld()
+ {
+ var worldId = RoomManager.field_Internal_Static_ApiWorld_0.id;
+
+ // Check if black/whitelisted from EmmVRC - thanks Emilia and the rest of EmmVRC Staff
+ var uwr = UnityWebRequest.Get($"https://dl.emmvrc.com/riskyfuncs.php?worldid= {worldId}");
+ uwr.SendWebRequest();
+ while (!uwr.isDone)
+ yield return new WaitForEndOfFrame();
+ var result = uwr.m_DownloadHandler.text?.Trim().ToLower();
+ uwr.Dispose();
+ if (!string.IsNullOrWhiteSpace(result))
+ switch (result)
+ {
+ case "allowed":
+ Main.Allowed = true;
+ yield break;
+
+ case "denied":
+ Main.Allowed = false;
+ yield break;
+ }
+
+
+ // no result from server or they're currently down
+ // Check tags then. should also be in cache as it just got downloaded
+ API.Fetch(
+ worldId,
+ new Action(
+ container =>
+ {
+ ApiWorld apiWorld;
+ if ((apiWorld = container.Model.TryCast()) != null)
+ {
+ foreach (var worldTag in apiWorld.tags)
+ if (worldTag.IndexOf("game", StringComparison.OrdinalIgnoreCase) != -1
+ || worldTag.IndexOf("club", StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ Main.Allowed = false;
+ return;
+ }
+
+ Main.Allowed = true;
+ }
+ else
+ {
+ MelonLogger.Error("Failed to cast ApiModel to ApiWorld");
+ }
+ }),
+ disableCache: false);
+ }
}
}
\ No newline at end of file
diff --git a/VRChatMods.sln b/VRChatMods.sln
index f71d5cd..50852a7 100644
--- a/VRChatMods.sln
+++ b/VRChatMods.sln
@@ -14,8 +14,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorldPredownload", "WorldPr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionMenuUtils", "ActionMenuUtils\ActionMenuUtils.csproj", "{7477F0C4-44AC-4049-A81E-E6A66F28B73C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DownloadFix", "DownloadFix\DownloadFix.csproj", "{F61964B1-1EE3-4AB1-9FC7-3456CCE5DEA8}"
-EndProject
+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrityCheckWeaver", "IntegrityCheckWeaver\IntegrityCheckWeaver.csproj", "{1FEBBC75-FCE2-45A6-B26A-135324F33FF1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrityCheckGenerator", "IntegrityCheckGenerator\IntegrityCheckGenerator.csproj", "{E2E254FC-EBB1-4F5D-B2F3-26FAED02B77F}"
@@ -37,10 +36,6 @@ Global
{7477F0C4-44AC-4049-A81E-E6A66F28B73C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7477F0C4-44AC-4049-A81E-E6A66F28B73C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7477F0C4-44AC-4049-A81E-E6A66F28B73C}.Release|Any CPU.Build.0 = Release|Any CPU
- {F61964B1-1EE3-4AB1-9FC7-3456CCE5DEA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F61964B1-1EE3-4AB1-9FC7-3456CCE5DEA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F61964B1-1EE3-4AB1-9FC7-3456CCE5DEA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F61964B1-1EE3-4AB1-9FC7-3456CCE5DEA8}.Release|Any CPU.Build.0 = Release|Any CPU
{1FEBBC75-FCE2-45A6-B26A-135324F33FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FEBBC75-FCE2-45A6-B26A-135324F33FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FEBBC75-FCE2-45A6-B26A-135324F33FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU