100 lines
5.3 KiB
C#
100 lines
5.3 KiB
C#
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<string> LineOrder;
|
|
|
|
public static Dictionary<string, string> KnownMods;
|
|
public static Dictionary<string, string> KnownCheats;
|
|
public static Dictionary<string, string> KnownPeople;
|
|
public static Dictionary<string, string> 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<Dictionary<string,
|
|
string>>();
|
|
|
|
KnownMods =
|
|
root["knownMods"]?
|
|
.ToObject<Dictionary<string,
|
|
string>>();
|
|
|
|
KnownPeople =
|
|
root["knownPeople"]?
|
|
.ToObject<Dictionary<string,
|
|
string>>();
|
|
|
|
KnownCosmetics =
|
|
root["specialCosmetics"]?
|
|
.ToObject<Dictionary<string,
|
|
string>>();
|
|
});
|
|
|
|
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);
|
|
}
|
|
} |