Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ExpertStreamerImplementation v1.1.0
ExpertStreamerImplementation.dll
Decompiled a year agousing System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HarmonyLib; using REPOLib.Modules; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ExpertStreamerImplementation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExpertStreamerImplementation")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d4e12834-6d5d-4d53-84b2-c9f76e27c7d0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ExpertStreamerImplementation { [HarmonyPatch(typeof(SemiFunc))] internal class SemiFuncPatch { [HarmonyPatch("EnemySpawn")] [HarmonyPrefix] private static bool SemiFunc_Prefix(ref bool __result) { if (ExpertStreamerImplementation.Instance.AboutToSpawn) { __result = true; ExpertStreamerImplementation.Instance.AboutToSpawn = false; return false; } return true; } } [BepInPlugin("ExpertRobi.StreamerImplementation", "ExpertStreamerImplementation", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ExpertStreamerImplementation : BaseUnityPlugin { private const string modGUID = "ExpertRobi.StreamerImplementation"; private const string modName = "ExpertStreamerImplementation"; private const string modVersion = "1.0"; internal static ExpertStreamerImplementation Instance; public bool AboutToSpawn = false; private HttpListener httpListener; private const string url = "http://localhost:29016/"; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll(); StartServer(); } private void StartServer() { httpListener = new HttpListener(); httpListener.Prefixes.Add("http://localhost:29016/"); httpListener.Start(); Task.Run(() => ListenForRequests()); Logger.LogInfo((object)"API Server Online: Use this for your Events: http://localhost:29016/"); } private async Task ListenForRequests() { while (httpListener.IsListening) { HandleRequest(await httpListener.GetContextAsync()); } } private void HandleRequest(HttpListenerContext context) { try { Logger.LogInfo((object)$"Request Received: {context.Request.Url}"); string absolutePath = context.Request.Url.AbsolutePath; if (context.Request.HttpMethod != "GET") { SendResponse(context, 405, "USE GET METHOD FOR SPAWN."); return; } Dictionary<string, string> dictionary = new Dictionary<string, string> { { "/donations/spawnDuck", "Duck" }, { "/donations/spawnValuableThrower", "Valuable Thrower" }, { "/donations/spawnHead", "Head" }, { "/donations/spawnSlowMouth", "Slow Mouth" }, { "/donations/spawnRunner", "Runner" }, { "/donations/spawnAnimal", "Animal" }, { "/donations/spawnRobe", "Robe" }, { "/donations/spawnFloater", "Floater" }, { "/donations/spawnThinMan", "Thin Man" }, { "/donations/spawnSlowWalker", "Slow Walker" }, { "/donations/spawnCeilingEye", "Ceiling Eye" }, { "/donations/spawnTumbler", "Tumbler" }, { "/donations/spawnBowtie", "Bowtie" }, { "/donations/spawnHunter", "Hunter" }, { "/donations/spawnBeamer", "Beamer" }, { "/donations/spawnUpscream", "Upscream" }, { "/donations/spawnHidden", "Hidden" } }; if (dictionary.ContainsKey(absolutePath)) { TriggerEnemySpawn(dictionary[absolutePath]); SendResponse(context, 200, "Spawn " + dictionary[absolutePath] + " Executed."); } else { SendResponse(context, 404, "Endpoint not valid or not Implemented."); } } catch { Logger.LogInfo((object)"Error!"); } } private void SendResponse(HttpListenerContext context, int statusCode, string message) { byte[] bytes = Encoding.UTF8.GetBytes(message); context.Response.StatusCode = statusCode; context.Response.ContentLength64 = bytes.Length; context.Response.OutputStream.Write(bytes, 0, bytes.Length); context.Response.OutputStream.Close(); } private void TriggerEnemySpawn(string enemyType) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) string text = "Enemies/Enemy - " + enemyType; GameObject val = null; foreach (EnemySetup registeredEnemy in Enemies.RegisteredEnemies) { foreach (GameObject spawnObject in registeredEnemy.spawnObjects) { if (((Object)spawnObject).name.Contains(enemyType)) { val = spawnObject; break; } } } if ((Object)(object)val == (Object)null) { val = Resources.Load<GameObject>(text); } if (!((Object)(object)val != (Object)null)) { return; } EnemySetup val2 = ScriptableObject.CreateInstance<EnemySetup>(); val2.spawnObjects = new List<GameObject> { val }; LevelPoint val3 = null; float num = 500f; foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { float num2 = Vector3.Distance(((Component)levelPathPoint).transform.position, ((Component)PlayerController.instance).transform.position); if (num2 < num) { val3 = levelPathPoint; num = num2; } } if ((Object)(object)val3 != (Object)null) { Instance.AboutToSpawn = true; RunManager.instance.EnemiesSpawnedRemoveStart(); LevelGenerator.Instance.EnemySpawn(val2, ((Component)val3).transform.position); EnemyDirector.instance.DebugResult(); Logger.LogInfo((object)(enemyType + " spawned")); RunManager.instance.EnemiesSpawnedRemoveEnd(); } } private void OnApplicationQuit() { if (httpListener != null) { httpListener.Stop(); httpListener.Close(); } Logger.LogInfo((object)"Server API Stopped."); } } } namespace ExpertStreamerImplementation.Patches { [HarmonyPatch(typeof(SpectateNameUI), "SetName")] internal class SpectateNameUIPatch { [HarmonyPrefix] public static void Prefix(SpectateNameUI __instance, ref string name) { if (name == "ExpertRobiTv") { name = "<color=purple>[STREAMER]</color> ExpertRobiTv"; } ((TMP_Text)__instance.Text).text = name; } } }