Please disclose if your mod was created primarily 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 Yar v0.4.5
Yar.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_API.GameInterfaceAPI; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using Yar.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Yar")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Yar")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6e403451-7efa-4027-ad10-e18939ca0090")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Yar { [BepInPlugin("IHaveAName2653.Yar", "Yar", "0.4.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class YarModBase : BaseUnityPlugin { private const string modGUID = "IHaveAName2653.Yar"; private const string modName = "Yar"; private const string modVersion = "0.4.3"; private readonly Harmony harmony = new Harmony("IHaveAName2653.Yar"); private static YarModBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("IHaveAName2653.Yar"); mls.LogInfo((object)"It appears as if Yar has begun"); mls.LogInfo((object)"Yar Version: 0.4.3"); mls.LogInfo((object)"Enabled Plugins:"); mls.LogInfo((object)"Harder Eclipse - 0.2"); mls.LogInfo((object)"Better Eclipse - 0.2.7"); mls.LogInfo((object)"Drop Items With Terminal - 0.4"); mls.LogInfo((object)"Eclipse is now hell :)"); harmony.PatchAll(typeof(ReallyHardEclipse)); harmony.PatchAll(typeof(MakeEclipsedBetter)); harmony.PatchAll(typeof(MakePlayersDropItems)); } } } namespace Yar.Patches { [HarmonyPatch(typeof(RoundManager))] internal class OverrideSpawnCode { [HarmonyPatch("PlotOutEnemiesForNextHour")] [HarmonyPostfix] private static void MakeEclipsePainful() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) _ = TimeOfDay.Instance.currentLevelWeather; _ = 5; } } [HarmonyPatch(typeof(Terminal))] internal class MakePlayersDropItems { public static InputAction act; [HarmonyPatch("Update")] [HarmonyPostfix] private static void MakeEclipsedMoreLoot() { if (act.triggered && InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.ctrlKey, 0f)) { Debug.Log((object)"!!!!!! Input Action getting player to drop items !!!!!!"); PlayerControllerB targetedPlayer = StartOfRound.Instance.mapScreen.targetedPlayer; targetedPlayer.DropAllHeldItemsClientRpc(); targetedPlayer.DropAllHeldItemsAndSync(); targetedPlayer.activatingItem = false; targetedPlayer.currentItemSlot = 0; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartTheBinding() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown act = new InputAction((string)null, (InputActionType)1, "<Keyboard>/o", "press(behaviour=1)", (string)null, (string)null); act.Enable(); } } [HarmonyPatch(typeof(RoundManager))] internal class MakeEclipsedBetter { private static float lastKnownMultiplier; private static int CheckTimer; [HarmonyPatch("Update")] [HarmonyPostfix] private static void MakeEclipsedMoreLoot() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 CheckTimer++; if (CheckTimer > 20) { if ((int)TimeOfDay.Instance.currentLevelWeather == 5) { lastKnownMultiplier = RoundManager.Instance.scrapValueMultiplier; RoundManager.Instance.scrapValueMultiplier = 10f; } else if (RoundManager.Instance.scrapValueMultiplier >= 10f) { RoundManager.Instance.scrapValueMultiplier = lastKnownMultiplier; } CheckTimer %= 20; } } } [HarmonyPatch(typeof(EclipseWeather))] internal class ReallyHardEclipse { [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void MakeEclipsePainful() { //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) int num = 3333; RoundManager.Instance.minOutsideEnemiesToSpawn = num; RoundManager.Instance.minEnemiesToSpawn = num; RoundManager.Instance.hourTimeBetweenEnemySpawnBatches = 1; List<int> list = new List<int>(); list.Clear(); TimeOfDay timeScript = RoundManager.Instance.timeScript; float num2 = timeScript.lengthOfHours * 0f; int num3 = 0; for (int i = 0; i < Math.Max(RoundManager.Instance.currentLevel.DaytimeEnemies.Count, 300); i++) { EnemyType enemyType = RoundManager.Instance.currentLevel.DaytimeEnemies[i].enemyType; if (enemyType.PowerLevel > RoundManager.Instance.currentLevel.maxDaytimeEnemyPowerCount - RoundManager.Instance.currentDaytimeEnemyPower || enemyType.numberSpawned >= RoundManager.Instance.currentLevel.DaytimeEnemies[i].enemyType.MaxCount || enemyType.normalizedTimeInDayToLeave < TimeOfDay.Instance.normalizedTimeOfDay || enemyType.spawningDisabled) { list.Add(0); continue; } int num4 = (int)((float)RoundManager.Instance.currentLevel.DaytimeEnemies[i].rarity * enemyType.probabilityCurve.Evaluate(num2 / timeScript.totalTime)); list.Add(num4); num3 += num4; } GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode"); int randomWeightedIndex = RoundManager.Instance.GetRandomWeightedIndex(list.ToArray(), RoundManager.Instance.EnemySpawnRandom); Vector3 position = array[RoundManager.Instance.AnomalyRandom.Next(0, array.Length)].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); Debug.Log((object)$"Anomaly random 4: {position.x}, {position.y}, {position.z}"); int num5 = 0; bool flag = false; for (int j = 0; j < array.Length - 1; j++) { for (int k = 0; k < RoundManager.Instance.spawnDenialPoints.Length; k++) { flag = true; if (Vector3.Distance(position, RoundManager.Instance.spawnDenialPoints[k].transform.position) < 16f) { num5 = (num5 + 1) % array.Length; position = array[num5].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); flag = false; break; } } if (flag) { break; } } Object.Instantiate<GameObject>(RoundManager.Instance.currentLevel.OutsideEnemies[randomWeightedIndex].enemyType.enemyPrefab, position, Quaternion.Euler(Vector3.zero)).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); } } [HarmonyPatch(typeof(StormyWeather))] internal class StormyWeatherPatch { public static InputAction act; [HarmonyPatch("Update")] [HarmonyPostfix] private static void LightningUpdate() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (act.triggered) { Debug.Log((object)"trigger explode"); Camera gameplayCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; Vector3 val = Vector3.zero; gameplayCamera.ScreenPointToRay(Vector2.op_Implicit(((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue())); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)gameplayCamera).transform.position, ((Component)gameplayCamera).transform.eulerAngles, ref val2, 100000f)) { val = ((RaycastHit)(ref val2)).point; } ((StormyWeather)Object.FindFirstObjectByType(typeof(StormyWeather))).LightningStrike(val, false); Debug.Log((object)"hi"); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void LightningBind() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown act = new InputAction((string)null, (InputActionType)1, "<Keyboard>/l", "press(behaviour=1)", (string)null, (string)null); act.Enable(); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { public static InputAction act; [HarmonyPatch("Update")] [HarmonyPostfix] private static void InfCredits() { if (act.triggered) { Object.FindObjectOfType<Terminal>().groupCredits = 100000000; Debug.Log((object)"hi hello we triggered."); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void MakeSureThatTheTerminalHasCredits() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown act = new InputAction((string)null, (InputActionType)1, "<Keyboard>/i", "press(behaviour=1)", (string)null, (string)null); act.Enable(); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { public static InputAction die; public static InputAction explode; [HarmonyPatch("Update")] [HarmonyPostfix] private static void update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if ((int)GameState.ShipState == 1) { if (die.triggered) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Vector3 velocity = ((Component)localPlayerController).gameObject.GetComponent<CharacterController>().velocity; localPlayerController.KillPlayer(velocity, true, (CauseOfDeath)0, 0); Debug.Log((object)"yes we should be dead"); } if (explode.triggered) { Debug.Log((object)"trigger explode"); _ = GameNetworkManager.Instance.localPlayerController.gameplayCamera; Landmine.SpawnExplosion(Vector3.zero, true, 2.5f, 5f); Debug.Log((object)"hi"); } } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void start() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Debug.Log((object)"should start"); die = new InputAction((string)null, (InputActionType)1, "<Keyboard>/Alpha9", "press(behaviour=1)", (string)null, (string)null); die.Enable(); explode = new InputAction((string)null, (InputActionType)1, "<Keyboard>/Alpha8", "press(behaviour=1)", (string)null, (string)null); explode.Enable(); Debug.Log((object)"binds added"); } } }