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 BozorosTweaks v1.1.0
BozorosTweaks.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BozorosTweaks.Patches; using BozorosTweaks.Util; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BozorosTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Fixes, tweaks, and small additions for LethalMatt's Bozoros!")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("BozorosTweaks")] [assembly: AssemblyTitle("BozorosTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BozorosTweaks { [BepInPlugin("pacoito.BozorosTweaks", "BozorosTweaks", "1.1.0")] public class Plugin : BaseUnityPlugin { internal const string GUID = "pacoito.BozorosTweaks"; internal const string PLUGIN_NAME = "BozorosTweaks"; internal const string VERSION = "1.1.0"; internal static ManualLogSource? StaticLogger { get; private set; } internal static Harmony? Harmony { get; private set; } private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown StaticLogger = ((BaseUnityPlugin)this).Logger; try { Harmony = new Harmony("pacoito.BozorosTweaks"); Harmony.PatchAll(typeof(LoadPatches)); Harmony.PatchAll(typeof(ClownGiantPatch)); Harmony.PatchAll(typeof(CollisionPatches)); StaticLogger.LogInfo((object)"'BozorosTweaks' loaded!"); } catch (Exception arg) { StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "BozorosTweaks", arg)); } } } } namespace BozorosTweaks.Util { internal class VanillaPrefabUtils { internal static bool GetInsideEnemyPrefab(string enemyName, out GameObject? enemyPrefab) { string enemyName2 = enemyName; enemyPrefab = null; for (int i = 0; i < StartOfRound.Instance.levels.Length; i++) { EnemyType val = StartOfRound.Instance.levels[i]?.Enemies?.Find((SpawnableEnemyWithRarity enemy) => string.CompareOrdinal(enemy.enemyType.enemyName, enemyName2) == 0)?.enemyType; if ((Object)(object)val != (Object)null) { enemyPrefab = val.enemyPrefab; return true; } } ManualLogSource? staticLogger = Plugin.StaticLogger; if (staticLogger != null) { staticLogger.LogWarning((object)("Could not find enemy '" + enemyName2 + "' in any moon's list of spawns.")); } return false; } internal static bool GetOutsideEnemyPrefab(string enemyName, out GameObject? enemyPrefab) { string enemyName2 = enemyName; enemyPrefab = null; for (int i = 0; i < StartOfRound.Instance.levels.Length; i++) { EnemyType val = StartOfRound.Instance.levels[i]?.OutsideEnemies?.Find((SpawnableEnemyWithRarity enemy) => string.CompareOrdinal(enemy.enemyType.enemyName, enemyName2) == 0)?.enemyType; if ((Object)(object)val != (Object)null) { enemyPrefab = val.enemyPrefab; return true; } } ManualLogSource? staticLogger = Plugin.StaticLogger; if (staticLogger != null) { staticLogger.LogWarning((object)("Could not find enemy '" + enemyName2 + "' in any moon's list of spawns.")); } return false; } } } namespace BozorosTweaks.Patches { [HarmonyPatch(typeof(ForestGiantAI), "Start")] internal class ClownGiantPatch { public static GameObject? ForestGiantPrefab { get; internal set; } private static void Postfix(ForestGiantAI __instance) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) if (((Object)((Component)__instance).gameObject).name.StartsWith("ClownGiant")) { GameObject? forestGiantPrefab = ForestGiantPrefab; ForestGiantAI val = default(ForestGiantAI); if (forestGiantPrefab != null && forestGiantPrefab.TryGetComponent<ForestGiantAI>(ref val)) { ((EnemyAI)__instance).enemyHP = ((EnemyAI)val).enemyHP; ((EnemyAI)__instance).enemyType = ((EnemyAI)val).enemyType; ((EnemyAI)__instance).enemyBehaviourStates = ((EnemyAI)val).enemyBehaviourStates; __instance.giantFall = val.giantFall; __instance.giantCry = val.giantCry; GameObject gameObject = ((Component)((Component)__instance).transform.Find("FGiantModelContainer/AnimContainer")).gameObject; gameObject.GetComponent<Animator>().runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(((Component)ForestGiantPrefab.transform.Find("FGiantModelContainer/AnimContainer")).GetComponent<Animator>().runtimeAnimatorController); gameObject.AddComponent<EnemyAnimationEvent>().mainScript = (EnemyAI)(object)__instance; __instance.giantBurningAudio = ((Component)Object.Instantiate<Transform>(ForestGiantPrefab.transform.Find("FGiantModelContainer/BurningSFX"), gameObject.transform.GetParent(), false)).GetComponent<AudioSource>(); ((Object)__instance.giantBurningAudio).name = "BurningSFX"; __instance.burningParticlesContainer = ((Component)Object.Instantiate<Transform>(ForestGiantPrefab.transform.Find("FireParticlesContainer"), ((Component)__instance).transform, false)).gameObject; ((Object)__instance.burningParticlesContainer).name = "FireParticlesContainer"; __instance.deathFallPosition = Object.Instantiate<Transform>(ForestGiantPrefab.transform.Find("FallPosition"), ((Component)__instance).transform, false); ((Object)__instance.deathFallPosition).name = "FallPosition"; LoadPatches.BozorosScene = ((Component)__instance).gameObject.scene; } } } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] internal class CollisionPatches { [HarmonyPostfix] private static void DisableTentColliders(SelectableLevel newLevel) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LoadPatches.BozorosEnvironment == (Object)null) { return; } Transform val = LoadPatches.BozorosEnvironment.transform.Find("Bozoros_Map/Tents"); BoxCollider val2 = default(BoxCollider); for (int i = 0; i < ((val != null) ? new int?(val.childCount) : null); i++) { Transform child = val.GetChild(i); if (((Object)child).name[0] == 'T') { Transform child2 = child.GetChild(0); if (child2 != null) { Transform child3 = child2.GetChild(0); if (((child3 != null) ? new bool?(((Component)child3).TryGetComponent<BoxCollider>(ref val2)) : null) == true) { ((Component)val2).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); ((Component)val2).transform.localScale = Vector3.one; val2.center = new Vector3(0f, 17.5f, 0f); val2.size = new Vector3(35f, 12f, 49f); } } } else { Transform child4 = child.GetChild(0); if (child4 != null) { ((Component)child4).gameObject.SetActive(false); } } } } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] internal class EnemiesPatch { public static EnemyType? BarberType { get; internal set; } public static bool EnemiesAdded { get; private set; } [HarmonyPostfix] private static void LoadNewLevelPost(SelectableLevel newLevel) { if (!EnemiesAdded && !((Object)(object)BarberType == (Object)null) && string.CompareOrdinal(newLevel.PlanetName, "Bozoros") == 0) { AddEnemy(newLevel, Object.Instantiate<EnemyType>(BarberType), 85, 2); AddEnemy(newLevel, Object.Instantiate<EnemyType>(BarberType), 45, 2, isOutside: true); EnemiesAdded = true; } } private static void AddEnemy(SelectableLevel level, EnemyType spawnEnemyType, int spawnRarity, int maxCount, bool isOutside = false, bool isDaytime = false) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) //IL_0071: Expected O, but got Unknown spawnEnemyType.MaxCount = maxCount; spawnEnemyType.isOutsideEnemy = isOutside; spawnEnemyType.isDaytimeEnemy = isDaytime; List<SpawnableEnemyWithRarity> list; if (!isOutside && !isDaytime) { list = level.Enemies; } else if (isOutside) { list = level.OutsideEnemies; } else { if (!(isOutside && isDaytime)) { return; } list = level.DaytimeEnemies; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnEnemyType, rarity = spawnRarity }; list.Add(item); } } [HarmonyPatch] internal class LoadPatches { public static Scene BozorosScene { get; internal set; } public static GameObject? BozorosEnvironment { get; private set; } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartPost() { if (VanillaPrefabUtils.GetOutsideEnemyPrefab("ForestGiant", out GameObject enemyPrefab)) { ClownGiantPatch.ForestGiantPrefab = enemyPrefab; } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPriority(800)] [HarmonyPostfix] private static void LoadNewLevelPost(SelectableLevel newLevel) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (string.CompareOrdinal(newLevel.PlanetName, "Bozoros") != 0) { return; } _ = BozorosScene; if (0 == 0) { Scene bozorosScene = BozorosScene; BozorosEnvironment = ((Scene)(ref bozorosScene)).GetRootGameObjects().First((GameObject gameObject) => string.CompareOrdinal(((Object)gameObject).name, "Environment") == 0); } } } }