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 REPOImprovements v1.0.2
REPO_Improvements.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("REPO_Improvements")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("REPO_Improvements")] [assembly: AssemblyTitle("REPO_Improvements")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RepoImprovements { [BepInPlugin("com.example.myrepo", "RepoImprovements", "1.0.0")] public class RepoImprovementsPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(EnemyParent), "Update")] public class StopNaturalRespawn { private class BoxedInt { public int Value; } private static ConditionalWeakTable<EnemyParent, BoxedInt> lastTicks = new ConditionalWeakTable<EnemyParent, BoxedInt>(); [HarmonyPrefix] private static void Prefix(EnemyParent __instance) { if (IsStartup || (bool)AccessTools.Field(typeof(EnemyParent), "Spawned").GetValue(__instance)) { return; } if (!lastTicks.TryGetValue(__instance, out BoxedInt value)) { value = new BoxedInt { Value = GlobalActivationTick }; lastTicks.Add(__instance, value); } if (value.Value < GlobalActivationTick) { value.Value = GlobalActivationTick; AccessTools.Field(typeof(EnemyParent), "DespawnedTimer").SetValue(__instance, 0.1f); Debug.LogWarning((object)("[R.E.P.O.I] " + __instance.enemyName + " is spawned!")); return; } float num = (float)AccessTools.Field(typeof(EnemyParent), "DespawnedTimer").GetValue(__instance); if (num < 900f) { AccessTools.Field(typeof(EnemyParent), "DespawnedTimer").SetValue(__instance, 999f); } } } [HarmonyPatch(typeof(ExtractionPoint), "StateComplete")] public class ExtractorEnemySpawn { [HarmonyPrefix] private static void Prefix(ExtractionPoint __instance) { if (!SemiFunc.IsMasterClientOrSingleplayer() || !(bool)AccessTools.Field(typeof(ExtractionPoint), "stateStart").GetValue(__instance)) { return; } Debug.LogWarning((object)"[R.E.P.O.I] Extractor complete. All enemies is awake!"); GlobalActivationTick++; EnemyParent[] array = Object.FindObjectsByType<EnemyParent>((FindObjectsSortMode)0); EnemyParent[] array2 = array; foreach (EnemyParent val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && !(bool)AccessTools.Field(typeof(EnemyParent), "Spawned").GetValue(val)) { AccessTools.Field(typeof(EnemyParent), "DespawnedTimer").SetValue(val, 0.1f); Debug.LogWarning((object)("[R.E.P.O.I] Enemy " + val.enemyName + " is awake!")); } } } } [HarmonyPatch(typeof(MainMenuOpen), "Start")] public class MainMenuPopup { private static bool hasShown; [HarmonyPostfix] private static void Postfix() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!hasShown && (Object)(object)MenuManager.instance != (Object)null) { string text = "REPO IMPROVEMENTS"; Color yellow = Color.yellow; string text2 = "THANKS FOR INSTALLING THE MOD! There’ll be even more updates and changes coming in the future. Enjoy the game :D"; string text3 = "NICE!"; MenuManager.instance.PagePopUp(text, yellow, text2, text3, true); hasShown = true; } } } [CompilerGenerated] private sealed class <StartupStabilization>d__7 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RepoImprovementsPlugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartupStabilization>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(10f); <>1__state = 1; return true; case 1: <>1__state = -1; IsStartup = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static RepoImprovementsPlugin? Instance; public static int GlobalActivationTick = 0; public static bool IsStartup = true; public static int CurrentBuyerID = 0; public static int FakePlayerCount = 1; public static int OriginalQuotaBase = 1000; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("com.example.myrepo"); val.PatchAll(); ((MonoBehaviour)this).StartCoroutine(StartupStabilization()); ((BaseUnityPlugin)this).Logger.LogWarning((object)"MOD ACTIVATED!"); } [IteratorStateMachine(typeof(<StartupStabilization>d__7))] private IEnumerator StartupStabilization() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartupStabilization>d__7(0) { <>4__this = this }; } } [HarmonyPatch(typeof(EnemyHealth), "HurtRPC")] public class LowHealthEnemySYNC { [HarmonyPostfix] private static void Postfix(EnemyHealth __instance, int _damage) { if (!PhotonNetwork.InRoom) { return; } Traverse val = Traverse.Create((object)__instance); PhotonView value = val.Field("photonView").GetValue<PhotonView>(); if ((Object)(object)value != (Object)null && !value.IsMine) { int value2 = val.Field("healthCurrent").GetValue<int>(); value2 -= _damage; if (value2 < 0) { value2 = 0; } val.Field("healthCurrent").SetValue((object)value2); } int value3 = val.Field("healthCurrent").GetValue<int>(); int health = __instance.health; if (!val.Field("dead").GetValue<bool>() && value3 > 0) { float num = (float)value3 / (float)health; if (num <= 0.36f) { val.Field("hurtEffect").SetValue((object)true); val.Field("hurtLerp").SetValue((object)0f); } } } } [HarmonyPatch(typeof(EnemyHealth), "Update")] public class LowHealthEnemyPULSE { [HarmonyPostfix] private static void Postfix(EnemyHealth __instance) { //IL_0163: Unknown result type (might be due to invalid IL or missing references) Traverse val = Traverse.Create((object)__instance); PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); int value = val.Field("healthCurrent").GetValue<int>(); if (val.Field("dead").GetValue<bool>() || value <= 0) { return; } float num = (float)value / (float)__instance.health; if (!(num <= 0.3f)) { return; } float num2 = (PhotonNetwork.InRoom ? ((float)(PhotonNetwork.Time % 1000.0)) : (Time.time % 1000f)); float num3 = Mathf.Abs(Mathf.Sin(num2 * 5f)) * 0.5f + 0.2f; List<Material> value2 = val.Field("instancedMaterials").GetValue<List<Material>>(); int value3 = val.Field("materialHurtColor").GetValue<int>(); int value4 = val.Field("materialHurtAmount").GetValue<int>(); val.Field("hurtEffect").SetValue((object)true); val.Field("hurtLerp").SetValue((object)0f); if (value2 == null) { return; } foreach (Material item in value2) { if (!((Object)(object)item == (Object)null)) { item.SetColor(value3, new Color(1f, 0f, 0f, 1f)); item.SetFloat(value4, num3); } } } } [HarmonyPatch(typeof(ShopManager), "ShopCheck")] public class AutoUpgrade { [HarmonyPrefix] private static void Prefix(ShopManager __instance) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } List<ItemAttributes> value = Traverse.Create((object)__instance).Field("shoppingList").GetValue<List<ItemAttributes>>(); if (value == null) { return; } List<ItemAttributes> list = new List<ItemAttributes>(value); foreach (ItemAttributes item in list) { if ((Object)(object)item == (Object)null) { continue; } RoomVolumeCheck value2 = Traverse.Create((object)item).Field("roomVolumeCheck").GetValue<RoomVolumeCheck>(); if ((Object)(object)value2 == (Object)null) { continue; } value2.CheckSet(); if (!Traverse.Create((object)value2).Field("inExtractionPoint").GetValue<bool>()) { continue; } ItemUpgrade component = ((Component)item).GetComponent<ItemUpgrade>(); if (!((Object)(object)component != (Object)null) || !component.isPlayerUpgrade || (bool)AccessTools.Field(typeof(ItemUpgrade), "upgradeDone").GetValue(component)) { continue; } int value3 = Traverse.Create((object)item).Field("value").GetValue<int>(); int num = SemiFunc.StatGetRunCurrency(); if (num < value3) { continue; } int num2 = num - value3; SemiFunc.StatSetRunCurrency(num2); __instance.totalCurrency = num2; bool flag = PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player == (Object)null) { continue; } ItemToggle component2 = ((Component)item).GetComponent<ItemToggle>(); if (!((Object)(object)component2 != (Object)null)) { continue; } int viewID = player.photonView.ViewID; AccessTools.Field(typeof(ItemUpgrade), "upgradeDone").SetValue(component, false); component2.toggleState = true; if (flag) { PhotonView component3 = ((Component)item).GetComponent<PhotonView>(); if ((Object)(object)component3 != (Object)null) { component3.RPC("ToggleItemRPC", player.photonView.Owner, new object[2] { true, viewID }); } } else { Traverse.Create((object)component2).Method("ToggleItemLogic", new object[2] { true, viewID }).GetValue(); component.PlayerUpgrade(); } } AccessTools.Field(typeof(ItemUpgrade), "upgradeDone").SetValue(component, true); SemiFunc.ShopUpdateCost(); PhysGrabObject component4 = ((Component)item).GetComponent<PhysGrabObject>(); if ((Object)(object)component4 != (Object)null) { component4.DestroyPhysGrabObject(); } Debug.LogWarning((object)("[R.E.P.O.I] Upgrade " + ((Object)item.item).name + " applied to all players.")); } } } [HarmonyPatch(typeof(ShopManager), "UpgradeValueGet")] public class PlayerCountScalablePricing { [HarmonyPrefix] private static bool Prefix(ref float __result, float _value, Item item, ShopManager __instance) { float num = _value; float num2 = 0.75f; int count = GameDirector.instance.PlayerList.Count; num += num * num2 * (float)(count - 1); Traverse val = Traverse.Create((object)__instance); float value = val.Field("upgradeValueIncrease").GetValue<float>(); int itemsUpgradesPurchased = StatsManager.instance.GetItemsUpgradesPurchased(((Object)item).name); num += num * value * (float)itemsUpgradesPurchased; __result = Mathf.Ceil(num); return false; } } [HarmonyPatch(typeof(FlashlightController), "LightOn")] public class FlashlightBaseIntensity { [HarmonyPostfix] private static void Postfix(FlashlightController __instance) { Traverse val = Traverse.Create((object)__instance); float value = val.Field("baseIntensity").GetValue<float>(); if (value > 0.9f) { val.Field("baseIntensity").SetValue((object)2.5f); } } } [HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")] public class DynamicQuotaScale { [HarmonyPrefix] private static void Prefix(ref int value) { RepoImprovementsPlugin.OriginalQuotaBase = value; int count = GameDirector.instance.PlayerList.Count; int num = ((count <= 1) ? RepoImprovementsPlugin.FakePlayerCount : count); if (num > 1) { float num2 = 0.75f; float num3 = 1f + num2 * (float)(num - 1); value = Mathf.CeilToInt((float)value * num3); Debug.LogWarning((object)$"[R.E.P.O.I] Quota Scaled! New Goal: {value} (Players: {num})"); } } } public static class QuotaUtils { public static void UpdateQuotaInstantly() { if ((Object)(object)RoundDirector.instance == (Object)null) { return; } int count = GameDirector.instance.PlayerList.Count; int num = ((count <= 1) ? RepoImprovementsPlugin.FakePlayerCount : count); float num2 = 0.75f; float num3 = 1f + num2 * (float)(num - 1); int num4 = Mathf.CeilToInt((float)RepoImprovementsPlugin.OriginalQuotaBase * num3); Traverse val = Traverse.Create((object)RoundDirector.instance); val.Field("haulGoal").SetValue((object)num4); val.Field("extractionHaulGoal").SetValue((object)num4); if (PhotonNetwork.InRoom) { PhotonView value = val.Field("photonView").GetValue<PhotonView>(); if ((Object)(object)value != (Object)null) { value.RPC("StartRoundRPC", (RpcTarget)0, new object[1] { num4 }); } } SemiFunc.ShopUpdateCost(); int value2 = val.Field("haulGoal").GetValue<int>(); Debug.LogWarning((object)$"[R.E.P.O.I] New quota set to: {value2}"); } } [HarmonyPatch(typeof(CameraAim), "AimTargetSoftSet")] public class SoftenCeilingEyeHold { [HarmonyPrefix] private static void Prefix(ref float time, ref float strength, ref float strengthNoAim, GameObject obj, ref int priority) { if ((Object)(object)obj != (Object)null && ((Object)obj).name == "Controller") { time = 0.1f; strength = 2f; strengthNoAim = 0.75f; priority = 100; } } } [HarmonyPatch(typeof(EnemyTickHealAura), "Awake")] public class TickHealAuraDuration { [HarmonyPostfix] private static void Postfix(EnemyTickHealAura __instance) { Traverse.Create((object)__instance).Field("totalDuration").SetValue((object)10f); Traverse.Create((object)__instance).Field("timeUntilDestroy").SetValue((object)0.5f); } } [HarmonyPatch(typeof(EnemyTickAnim), "Awake")] public class ChangeMaxHealthSimple { private static void Postfix(EnemyTickAnim __instance) { __instance.maxHealth = 60; } } [HarmonyPatch(typeof(EnemyTick), "Update")] public class ForceTickWeight { [HarmonyPostfix] private static void Postfix(EnemyTick __instance) { float num = 1.9f; Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.mass = num; } object value = Traverse.Create((object)__instance).Field("enemy").Field("Rigidbody") .Field("physGrabObject") .GetValue(); if (value != null) { Traverse.Create(value).Field("massOriginal").SetValue((object)num); Traverse.Create(value).Field("mass").SetValue((object)num); } } } [HarmonyPatch(typeof(EnemyTick), "Awake")] public class PatchTickSuckSpeed { [HarmonyPostfix] private static void Postfix(EnemyTick __instance) { float num = 1.5f; Traverse.Create((object)__instance).Field("suckFrequency").SetValue((object)num); } } }