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 LaIncubadabraRevived v1.1.91
LaIncubadabraRevivedd.dll
Decompiled 14 hours 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.Bootstrap; using BepInEx.Logging; using EntityStates; using EntityStates.ParentEgg; using HG.Reflection; using HarmonyLib; using LookingGlass.ItemStatsNameSpace; using Microsoft.CodeAnalysis; using On.EntityStates.ParentEgg; using R2API.Utils; using RiskyMod.Allies; using RoR2; using RoR2.ContentManagement; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LaIncubadabraRevivedd")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LaIncubadabraRevivedd")] [assembly: AssemblyTitle("LaIncubadabraRevivedd")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 LaIncubadabraRevived { [HarmonyPatch(typeof(Hatch), "OnHatchlingSpawned")] internal class HatchPatch { [HarmonyPrefix] private static bool OnHatchlingSpawned(Hatch __instance, SpawnResult spawnResult) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!spawnResult.success || !Object.op_Implicit((Object)(object)spawnResult.spawnedInstance)) { return false; } CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } CharacterBody val = (Object.op_Implicit((Object)(object)((EntityState)__instance).outer) ? ((EntityState)__instance).outer.commonComponents.characterBody : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (Object.op_Implicit((Object)(object)val.teamComponent)) { component.teamIndex = val.teamComponent.teamIndex; } CharacterMaster master = val.master; if (!Object.op_Implicit((Object)(object)master)) { return false; } if (Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)component.inventory)) { component.inventory.CopyItemsFrom(master.inventory); component.inventory.CopyEquipmentFrom(master.inventory); } CharacterMaster val2 = (Object.op_Implicit((Object)(object)master.minionOwnership) ? master.minionOwnership.ownerMaster : null); GameObject bodyObject = component.GetBodyObject(); if (Object.op_Implicit((Object)(object)bodyObject) && Object.op_Implicit((Object)(object)val2)) { Deployable component2 = bodyObject.GetComponent<Deployable>(); if (Object.op_Implicit((Object)(object)component2)) { val2.AddDeployable(component2, (DeployableSlot)8); } } return false; } } [HarmonyPatch(typeof(JunkContent), "GenerateContentPackAsync")] internal class IncubatorContentPatch { [HarmonyPrefix] private static void GenerateContentPackAsync(ContentPack ___contentPack) { ManualLogSource val = Logger.CreateLogSource("LaIncubadabraRevived"); try { AddGameObject(___contentPack.bodyPrefabs, RoR2_Junk_Incubator.ParentPodBody_prefab, val); RemoveDuplicateInputBanks(RoR2_Junk_Incubator.ParentPodBody_prefab, val); AddGameObject(___contentPack.masterPrefabs, RoR2_Junk_Incubator.ParentPodMaster_prefab, val); AddEffect(___contentPack, RoR2_Junk_Incubator.ParentPodDeathEffect_prefab, val); AddEffect(___contentPack, RoR2_Junk_Incubator.ParentPodHatchEffect_prefab, val); AddEffect(___contentPack, RoR2_Junk_Incubator.ParentPodSpawnEffect_prefab, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentEgg_BaseEggState_asset, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentEgg_Death_asset, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentEgg_Hatch_asset, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentEgg_IncubateState_asset, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentEgg_PreHatch_asset, val); AddStateConfig(___contentPack, RoR2_Junk_Incubator.EntityStates_ParentPod_DeathState_asset, val); } finally { ((IDisposable)val)?.Dispose(); } } private static T Load<T>(string key, ManualLogSource logger) where T : Object { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { logger.LogError((object)("Could not load Incubator asset " + key)); } return val; } private static void AddGameObject(NamedAssetCollection<GameObject> collection, string key, ManualLogSource logger) { GameObject val = Load<GameObject>(key, logger); if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)collection.Find(((Object)val).name))) { collection.Add((GameObject[])(object)new GameObject[1] { val }); logger.LogInfo((object)("Registered " + ((Object)val).name)); } } private static void RemoveDuplicateInputBanks(string key, ManualLogSource logger) { GameObject val = Load<GameObject>(key, logger); if (Object.op_Implicit((Object)(object)val)) { InputBankTest[] components = val.GetComponents<InputBankTest>(); for (int i = 1; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i], true); } if (components.Length > 1) { logger.LogInfo((object)$"Removed {components.Length - 1} duplicate InputBankTest from {((Object)val).name}"); } } } private static void AddEffect(ContentPack contentPack, string key, ManualLogSource logger) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown GameObject val = Load<GameObject>(key, logger); if (Object.op_Implicit((Object)(object)val) && contentPack.effectDefs.Find(((Object)val).name) == null) { contentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1] { new EffectDef(val) }); logger.LogInfo((object)("Registered " + ((Object)val).name)); } } private static void AddStateConfig(ContentPack contentPack, string key, ManualLogSource logger) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) EntityStateConfiguration val = Load<EntityStateConfiguration>(key, logger); if (Object.op_Implicit((Object)(object)val)) { if (!Object.op_Implicit((Object)(object)contentPack.entityStateConfigurations.Find(((Object)val).name))) { contentPack.entityStateConfigurations.Add((EntityStateConfiguration[])(object)new EntityStateConfiguration[1] { val }); logger.LogInfo((object)("Registered " + ((Object)val).name)); } Type type = (Type)val.targetType; if (type != null && !contentPack.entityStateTypes.Contains(type)) { contentPack.entityStateTypes.Add(new Type[1] { type }); logger.LogInfo((object)("Registered state " + type.FullName)); } } } } internal static class LookingGlassCompat { public const string GUID = "droppod.lookingglass"; public static bool IsLookingGlassInstalled => Chainloader.PluginInfos.ContainsKey("droppod.lookingglass"); [MethodImpl(MethodImplOptions.NoInlining)] public static void Init() { ((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)RegisterItemStats); } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterItemStats() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected I4, but got Unknown try { ItemDef incubator = Items.Incubator; if (Object.op_Implicit((Object)(object)incubator) && (int)incubator.itemIndex != -1) { ItemStatsDef val = new ItemStatsDef(); val.descriptions.Add("Summon Chance: "); val.valueTypes.Add((ValueType)1); val.measurementUnits.Add((MeasurementUnits)1); val.descriptions.Add("Max Ancestral Pods: "); val.valueTypes.Add((ValueType)2); val.measurementUnits.Add((MeasurementUnits)4); val.descriptions.Add("Parent Bonus Health: "); val.valueTypes.Add((ValueType)0); val.measurementUnits.Add((MeasurementUnits)1); val.descriptions.Add("Parent Bonus Damage: "); val.valueTypes.Add((ValueType)1); val.measurementUnits.Add((MeasurementUnits)1); val.hasChance = true; val.calculateValuesNew = (float luck, int count, float procChance) => new List<float> { ChanceWithLuck((7f + (float)count) * 0.01f, luck), count, (float)(10 * count) * 0.1f, 3f }; ItemDefinitions.allItemDefinitions[(int)incubator.itemIndex] = val; } } catch (Exception ex) { ManualLogSource val2 = Logger.CreateLogSource("LaIncubadabraRevived"); try { val2.LogError((object)("Failed to register LookingGlass item stats: " + ex)); } finally { ((IDisposable)val2)?.Dispose(); } } } private static float ChanceWithLuck(float chance, float luck) { chance = Math.Min(chance, 1f); int num = (int)Math.Ceiling(luck); if (num > 0) { return 1f - (float)Math.Pow(1f - chance, num + 1); } if (num < 0) { return (float)Math.Pow(chance, -num + 1); } return chance; } } [BepInPlugin("com.phreel.LaIncubadabraRevived", "LaIncubadabraRevived", "1.1.91")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class LaIncubadabraRevived : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnHatchlingSpawned <>9__1_0; internal void <RiskyModCompat>b__1_0(orig_OnHatchlingSpawned orig, Hatch self, SpawnResult spawnResult) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 orig.Invoke(self, spawnResult); if (!Object.op_Implicit((Object)(object)spawnResult.spawnedInstance)) { return; } CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)component.inventory)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled) { component.inventory.GiveItemPermanent(Items.UseAmbientLevel, 1); component.inventory.GiveItemPermanent(AllyItems.AllyMarkerItem, 1); component.inventory.GiveItemPermanent(AllyItems.AllyScalingItem, 1); } } } } public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod")) { RiskyModCompat(); } new Harmony("com.phreel.LaIncubadabraRevived").PatchAll(Assembly.GetExecutingAssembly()); bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Compatability: LookingGlass", "Enable Compatability Patches?", true, "Add item stats to LookingGlass (if installed)?").Value; if (LookingGlassCompat.IsLookingGlassInstalled && value) { LookingGlassCompat.Init(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void RiskyModCompat() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__1_0; if (obj == null) { hook_OnHatchlingSpawned val = delegate(orig_OnHatchlingSpawned orig, Hatch self, SpawnResult spawnResult) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 orig.Invoke(self, spawnResult); if (Object.op_Implicit((Object)(object)spawnResult.spawnedInstance)) { CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)component.inventory)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled) { component.inventory.GiveItemPermanent(Items.UseAmbientLevel, 1); component.inventory.GiveItemPermanent(AllyItems.AllyMarkerItem, 1); component.inventory.GiveItemPermanent(AllyItems.AllyScalingItem, 1); } } } }; <>c.<>9__1_0 = val; obj = (object)val; } Hatch.OnHatchlingSpawned += (hook_OnHatchlingSpawned)obj; } } [HarmonyPatch(typeof(ItemCatalog))] internal class ItemCatalogPatch { [HarmonyPrefix] [HarmonyPatch("SetItemDefs")] private static void SetItemDefs(ItemDef[] newItemDefs) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) ManualLogSource val = Logger.CreateLogSource("LaIncubadabraRevived"); try { ItemDef val2 = newItemDefs.First((ItemDef i) => ((Object)i).name == "Incubator"); if (Object.op_Implicit((Object)(object)val2)) { ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val2.tags = (ItemTag[])(object)array; val2.deprecatedTier = (ItemTier)1; val.LogMessage((object)"Ancestral Incubator is now findable"); } else { val.LogMessage((object)"Could not locate Ancestral Incubator item"); } } finally { ((IDisposable)val)?.Dispose(); } } } }