From 0ac2e91f6749bc8921eef51a2dfcd15a3c5d37d7 Mon Sep 17 00:00:00 2001 From: Deez Date: Wed, 25 Nov 2026 20:15:31 -0500 Subject: [PATCH] Upload files to "/" --- Constants.cs | 10 ++++ Directory.Build.props | 9 ++++ Directory.Build.targets | 11 +++++ OnDataReceived.cs | 56 ++++++++++++++++++++++ Plugin.cs | 100 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 186 insertions(+) create mode 100644 Constants.cs create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 OnDataReceived.cs create mode 100644 Plugin.cs diff --git a/Constants.cs b/Constants.cs new file mode 100644 index 0000000..2adf37d --- /dev/null +++ b/Constants.cs @@ -0,0 +1,10 @@ +namespace TooMuchInfo +{ + internal class Constants + { + public const string Guid = "deez.toomuchinfo"; + public const string Name = "Deez's TooMuchInfo"; + public const string Version = "1.2.3"; + public const string HashKey = "deez.uk/discord"; + } +} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..e0a92e9 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag + $(GamePath)\Gorilla Tag_Data\Managed + $(GamePath)\BepInEx\core + $(GamePath)\BepInEx\plugins + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..c1ce6c3 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OnDataReceived.cs b/OnDataReceived.cs new file mode 100644 index 0000000..ab73ab7 --- /dev/null +++ b/OnDataReceived.cs @@ -0,0 +1,56 @@ +using GorillaNetworking; +using HarmonyLib; +using Photon.Pun; +using System; +using System.Linq; +using TooMuchInfo.Tools; + +namespace TooMuchInfo.Patches; + +[HarmonyPatch(typeof(VRRig))] +[HarmonyPatch("SerializeReadShared", MethodType.Normal)] +public static class OnDataReceived +{ + private static void Postfix(VRRig __instance) + { + UpdatePlayerPing(__instance); + UpdatePlayerCosmetXState(__instance); + __instance.UpdateName(); + } + + private static void UpdatePlayerPing(VRRig rig) + { + double estimatedPing = Math.Abs((rig.velocityHistoryList[0].time - PhotonNetwork.Time) * 1000); + int clampedPing = (int)Math.Clamp(Math.Round(estimatedPing), 0, int.MaxValue); + + Extensions.PlayerPing[rig] = clampedPing; + } + + private static void UpdatePlayerCosmetXState(VRRig rig) + { + if (!Extensions.PlayerMods.ContainsKey(rig)) + Extensions.PlayerMods[rig] = []; + + if (!rig.HasCosmetics()) + return; + + CosmeticsController.CosmeticSet cosmeticSet = rig.cosmeticSet; + bool hasCosmetx = + cosmeticSet.items.Any(cosmetic => !cosmetic.isNullItem && + !rig._playerOwnedCosmetics.Contains( + cosmetic.itemName)) && !rig.inTryOnRoom; + + switch (hasCosmetx) + { + case true when !Extensions.PlayerMods[rig].Contains("[COSMETX]"): + Extensions.PlayerMods[rig].Add("[COSMETX]"); + + break; + + case false when Extensions.PlayerMods[rig].Contains("[COSMETX]"): + Extensions.PlayerMods[rig].Remove("[COSMETX]"); + + break; + } + } +} \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs new file mode 100644 index 0000000..38518e3 --- /dev/null +++ b/Plugin.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using BepInEx; +using ExitGames.Client.Photon; +using HarmonyLib; +using Newtonsoft.Json.Linq; +using Photon.Pun; +using TooMuchInfo.Tools; +using Extensions = TooMuchInfo.Tools.Extensions; + +namespace TooMuchInfo; + +[BepInPlugin(Constants.Guid, Constants.Name, Constants.Version)] +public class Plugin : BaseUnityPlugin +{ + public static bool ShowSpecialCosmetics; + public static bool ShowKnownPeople; + public static bool ShowFpsPlatformPing; + public static bool ShowCreationDate; + public static bool ShowMods; + + public static List LineOrder; + + public static Dictionary KnownMods; + public static Dictionary KnownCheats; + public static Dictionary KnownPeople; + public static Dictionary KnownCosmetics; + + private void Awake() + { + ShowSpecialCosmetics = Config.Bind("Display", "SpecialCosmetics", true).Value; + ShowKnownPeople = Config.Bind("Display", "KnownPeople", true).Value; + ShowFpsPlatformPing = Config.Bind("Display", "FpsPlatformPing", true).Value; + ShowCreationDate = Config.Bind("Display", "CreationDate", true).Value; + ShowMods = Config.Bind("Display", "Mods", true).Value; + + LineOrder = Config.Bind( + "Order", + "LineOrder", + "SpecialCosmetics,Name,FpsPlatformPing,CreationDate,Mods" + ).Value.Split(',').Select(x => x.Trim()).ToList(); + + new Harmony(Constants.Guid).PatchAll(); + } + + private void Start() => GorillaTagger.OnPlayerSpawned(() => + { + Hashtable properties = new() { { $"{Constants.HashKey}", $"Made by Deez - {Constants.Name}" }, }; PhotonNetwork.LocalPlayer.SetCustomProperties(properties); + VRRigCache.OnRigDeactivated += rigContainer => + { + VRRig vrrig = rigContainer.vrrig; + + Extensions.PlayerWithCosmetics.Remove(vrrig); + Extensions.PlayerPlatforms.Remove(vrrig); + Extensions.PlayerMods.Remove(vrrig); + }; + + using HttpClient httpClient = new(); + HttpResponseMessage response = + httpClient.GetAsync( + "https://deez.uk/data").Result; + + using Stream deezDataStream = + response.Content.ReadAsStreamAsync().Result; + + using StreamReader reader = new(deezDataStream); + JObject root = JObject.Parse(reader.ReadToEnd()); + + KnownCheats = + root["knownCheats"]? + .ToObject>(); + + KnownMods = + root["knownMods"]? + .ToObject>(); + + KnownPeople = + root["knownPeople"]? + .ToObject>(); + + KnownCosmetics = + root["specialCosmetics"]? + .ToObject>(); + }); + + private void Update() + { + if (VRRig.LocalRig.playerText1 == null || NetworkSystem.Instance.LocalPlayer == null) + return; + + VRRig.LocalRig.playerText1.text = + NetworkSystem.Instance.LocalPlayer.SanitizedNickName.AnimateGradiant(VRRig.LocalRig.playerColor); + } +} \ No newline at end of file