diff --git a/CannedNet.Client/Patches/PhotonPatches.cs b/CannedNet.Client/Patches/PhotonPatches.cs index 48e61c8..23cbe40 100644 --- a/CannedNet.Client/Patches/PhotonPatches.cs +++ b/CannedNet.Client/Patches/PhotonPatches.cs @@ -58,9 +58,9 @@ public class Photon_AppSettings_Patch __result = new() { AppVersion = __result?.AppVersion, - AppIdRealtime = "c74d22b7-6665-41cf-9ce8-fc70b625caa6", - AppIdVoice = "f7adbf03-edae-4a7d-bb4b-9e06de75bd96", - AppIdChat = "4538ca46-903b-48d9-bf33-247ea468a29d", + AppIdRealtime = Plugin.AppIdRT.Value, + AppIdVoice = Plugin.AppIdVoice.Value, + AppIdChat = Plugin.AppIdChat.Value, FixedRegion = "us", UseNameServer = true, Protocol = ConnectionProtocol.Udp, diff --git a/CannedNet.Client/Patches/SendRequestPatch.cs b/CannedNet.Client/Patches/SendRequestPatch.cs index ce8edf3..7e22a3e 100644 --- a/CannedNet.Client/Patches/SendRequestPatch.cs +++ b/CannedNet.Client/Patches/SendRequestPatch.cs @@ -13,7 +13,7 @@ public class SendRequestPatch Plugin.Log.LogInfo($"hi {request.Uri.Host}"); if (request.Uri.Host.ToString().Contains("ns.rec.net")) - request.Uri = new Il2CppSystem.Uri("https://ns.lapis.codes"); + request.Uri = new Il2CppSystem.Uri(Plugin.ServerHostname.Value); } } } \ No newline at end of file diff --git a/CannedNet.Client/Plugin.cs b/CannedNet.Client/Plugin.cs index f22e98d..ffac652 100644 --- a/CannedNet.Client/Plugin.cs +++ b/CannedNet.Client/Plugin.cs @@ -1,25 +1,54 @@ +using System; +using System.Collections; +using System.Text.Json; using BepInEx; +using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; +using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.SceneManagement; +using UnityEngine.Networking; namespace CannedNet.Client; [BepInPlugin("lapis.cannednet.client", "CannedNet Client", "1.0.0")] public class Plugin : BasePlugin { - private const string PhotonDataUrl = "https://ns.lapis.codes/photon"; - internal static new ManualLogSource Log; - public static string appIdRT; - public static string appIdVoice; - public static string appIdChat; + public static ConfigEntry AppIdRT { get; private set; } + public static ConfigEntry AppIdVoice { get; private set; } + public static ConfigEntry AppIdChat { get; private set; } + public static ConfigEntry ServerHostname { get; private set; } public override void Load() { Log = base.Log; - Log.LogInfo($"I JUST HIT THE JACKPOTTTT!!!!! YUH YUH YUH!"); + + AppIdRT = Config.Bind("Photon", "App Id Realtime", "", "Photon Realtime App ID"); + AppIdVoice = Config.Bind("Photon", "App Id Voice", "", "Photon Voice App ID"); + AppIdChat = Config.Bind("Photon", "App Id Chat", "", "Photon Chat App ID"); + ServerHostname = Config.Bind("Server", "NameServer Host", "https://ns.lapis.codes", "Host for the NameServer."); + Harmony.CreateAndPatchAll(typeof(Plugin).Assembly); + + SceneManager.sceneLoaded += (Action)OnSceneLoaded; + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + if (scene.name == "ScreenAccountSelection") + { + var cheatMgr = GameObject.Find("GameRoot/Startup/Core Systems/[CheatManager]"); + if (cheatMgr != null) + { + GameObject.Destroy(cheatMgr); + Log.LogInfo("cheatmanager destroyed"); + } + } } } +