using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterBabies.Patches;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("MasterAli2.BetterBabies")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+ee998f0b9b43892a701ea861238182a688e6abe5")]
[assembly: AssemblyProduct("BetterBabies")]
[assembly: AssemblyTitle("MasterAli2.BetterBabies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 BetterBabies
{
[BepInPlugin("MasterAli2.BetterBabies", "BetterBabies", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BetterBabies : BaseUnityPlugin
{
internal static ConfigManager config;
public const int babyItemId = 123984;
public List<CaveDwellerAI> babiesInShip = new List<CaveDwellerAI>();
public List<CaveDwellerPhysicsProp> babyItemsInShip = new List<CaveDwellerPhysicsProp>();
public bool babyInInv;
public static BetterBabies Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
config = new ConfigManager(((BaseUnityPlugin)this).Config);
Patch();
Logger.LogInfo((object)"MasterAli2.BetterBabies v0.1.0 has loaded!");
}
internal static void Patch()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("MasterAli2.BetterBabies");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll(typeof(BabyOutside));
Harmony.PatchAll(typeof(BabyLeave));
Harmony.PatchAll(typeof(BabyGeneral));
Harmony.PatchAll(typeof(BabySell));
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
public void babyInInventory(PlayerControllerB __)
{
GrabbableObject[] itemSlots = __.ItemSlots;
foreach (GrabbableObject val in itemSlots)
{
if (!((Object)(object)val == (Object)null) && val.itemProperties.itemId == 123984)
{
babyInInv = true;
}
}
babyInInv = false;
}
public static bool babyInShipState(CaveDwellerAI __)
{
if (Instance.babiesInShip.Contains(__))
{
return true;
}
return false;
}
public static void setBabyPrice(CaveDwellerPhysicsProp __)
{
Random random = new Random((((EnemyAI)__.caveDwellerScript).thisEnemyIndex + 1) * Object.FindObjectOfType<Terminal>().groupCredits + 123984);
((GrabbableObject)__).scrapValue = random.Next(ConfigManager.BabyPriceMinInclusive.Value, ConfigManager.BabyPriceMaxExclusive.Value);
((GrabbableObject)__).itemProperties.isScrap = true;
}
public static bool shouldBabyPersist(CaveDwellerAI _)
{
if (((GrabbableObject)_.propScript).isHeld && ((GrabbableObject)_.propScript).playerHeldBy.isInHangarShipRoom && ((EnemyAI)_).currentBehaviourStateIndex == 0)
{
return true;
}
return false;
}
[MethodImpl(MethodImplOptions.NoOptimization)]
public static void aaa()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
EnemyAI[] array = null;
bool flag = false;
bool flag2 = false;
int num = 0;
if (array[num] is CaveDwellerAI)
{
CaveDwellerAI val = (CaveDwellerAI)array[num];
if (shouldBabyPersist(val))
{
Instance.babiesInShip.Add(val);
Instance.babyItemsInShip.Add(val.propScript);
aab();
}
}
}
[MethodImpl(MethodImplOptions.NoOptimization)]
public static void aab()
{
}
}
internal class ConfigManager : SyncedConfig<ConfigManager>
{
[DataMember]
public static SyncedEntry<bool> CanBabyGoOutside;
[DataMember]
public static SyncedEntry<bool> CanBabyGoIntoOrbit;
[DataMember]
public static SyncedEntry<bool> CanSellBaby;
[DataMember]
public static SyncedEntry<int> BabyPriceMinInclusive;
[DataMember]
public static SyncedEntry<int> BabyPriceMaxExclusive;
public static ConfigEntry<bool> DisableAgentOnSell;
public ConfigManager(ConfigFile configFile)
: base("MasterAli2.BetterBabies")
{
ConfigManager.Register<ConfigManager>(this);
CreateConfigs(configFile);
}
public void CreateConfigs(ConfigFile cfg)
{
CanBabyGoOutside = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "General", "CanBabyGoOutside", true, "Can the baby go outside without crying?");
CanBabyGoIntoOrbit = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "General", "CanBabyGoIntoOrbit", true, "Can the baby go into orbit? (unstable)");
CanSellBaby = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Selling", "CanSellBaby", true, "Can the Baby be sold at the company");
BabyPriceMinInclusive = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Selling", "BabyPriceMinInclusive", 100, "Minimum baby price when sold. (inclusive");
BabyPriceMaxExclusive = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Selling", "BabyPriceMaxExclusive", 150, "Maximum baby price when sold. (exclusive");
DisableAgentOnSell = cfg.Bind<bool>("Debug", "DisableAgentOnSell", true, "disable baby nav mesh agent on sell? toggle this on or off might fix issues regarding selling");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "MasterAli2.BetterBabies";
public const string PLUGIN_NAME = "BetterBabies";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace BetterBabies.Patches
{
internal class BabyGeneral
{
public static bool wasTwoHanded;
[HarmonyPatch(typeof(CaveDwellerAI), "TransformIntoAdult")]
[HarmonyPrefix]
private static bool DisableTransformOfBaby(CaveDwellerAI __instance)
{
if (BetterBabies.babyInShipState(__instance))
{
return false;
}
DepositItemsDesk val = Object.FindObjectOfType<DepositItemsDesk>();
if ((Object)(object)val == (Object)null)
{
return true;
}
if (val.itemsOnCounter.Contains((GrabbableObject)(object)__instance.propScript))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
[HarmonyPrefix]
private static void enableBabyScrollPrefix(PlayerControllerB __instance)
{
if (((NetworkBehaviour)__instance).IsOwner && !((Object)(object)__instance.currentlyHeldObjectServer == (Object)null) && __instance.currentlyHeldObjectServer.itemProperties.itemId == 123984)
{
__instance.twoHanded = false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
[HarmonyPostfix]
private static void enableBabyScrollPostfix(PlayerControllerB __instance)
{
if (((NetworkBehaviour)__instance).IsOwner && !((Object)(object)__instance.currentlyHeldObjectServer == (Object)null) && __instance.currentlyHeldObjectServer.itemProperties.itemId == 123984)
{
__instance.twoHanded = true;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPrefix]
private static void disable2HandedInteractionsIfHoldingBabyPrefix(PlayerControllerB __instance)
{
if (BetterBabies.Instance.babyInInv && StartOfRound.Instance.shipHasLanded)
{
wasTwoHanded = __instance.twoHanded;
__instance.twoHanded = true;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPostfix]
private static void disable2HandedInteractionsIfHoldingBabyPostfix(PlayerControllerB __instance)
{
if (BetterBabies.Instance.babyInInv && StartOfRound.Instance.shipHasLanded)
{
__instance.twoHanded = wasTwoHanded;
wasTwoHanded = false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")]
[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
[HarmonyPrefix]
private static void updateBabyInInvState(PlayerControllerB __instance)
{
BetterBabies.Logger.LogDebug((object)"Updating baby inventory state");
BetterBabies.Instance.babyInInventory(__instance);
}
}
internal class BabyLeave
{
public static bool wasLeaving;
[HarmonyPatch(typeof(CaveDwellerAI), "BabyUpdate")]
[HarmonyPrefix]
private static void BabyUpdateIsLeavingPrefix()
{
if (ConfigManager.CanBabyGoIntoOrbit.Value)
{
wasLeaving = StartOfRound.Instance.shipIsLeaving;
StartOfRound.Instance.shipIsLeaving = false;
}
}
[HarmonyPatch(typeof(CaveDwellerAI), "BabyUpdate")]
[HarmonyPostfix]
private static void BabyUpdateIsLeavingPostfix()
{
if (ConfigManager.CanBabyGoIntoOrbit.Value)
{
StartOfRound.Instance.shipIsLeaving = wasLeaving;
wasLeaving = false;
}
}
[HarmonyPatch(typeof(RoundManager), "UnloadSceneObjectsEarly")]
[HarmonyPrefix]
private static bool DontDespawnBaby(RoundManager __instance)
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
if (!ConfigManager.CanBabyGoIntoOrbit.Value)
{
return true;
}
if (!((NetworkBehaviour)__instance).IsServer)
{
return false;
}
Debug.Log((object)"Despawning props and enemies #3");
__instance.isSpawningEnemies = false;
EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>();
Debug.Log((object)$"Enemies on map: {array.Length}");
for (int i = 0; i < array.Length; i++)
{
if (((object)array[i]).GetType() == typeof(CaveDwellerAI))
{
CaveDwellerAI val = (CaveDwellerAI)array[i];
BetterBabies.Logger.LogDebug((object)"Found a wild baby!");
if (BetterBabies.shouldBabyPersist(val))
{
BetterBabies.Logger.LogDebug((object)"Kidnaping the wild baby!");
BetterBabies.Instance.babiesInShip.Add(val);
BetterBabies.Instance.babyItemsInShip.Add(val.propScript);
continue;
}
}
if (array[i].thisNetworkObject.IsSpawned)
{
Debug.Log((object)"despawn enemies on map");
array[i].thisNetworkObject.Despawn(true);
}
else
{
Debug.Log((object)$"{array[i].thisNetworkObject} was not spawned on network, so it could not be removed.");
}
}
__instance.SpawnedEnemies.Clear();
EnemyAINestSpawnObject[] array2 = Object.FindObjectsByType<EnemyAINestSpawnObject>((FindObjectsSortMode)0);
for (int j = 0; j < array2.Length; j++)
{
NetworkObject component = ((Component)array2[j]).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null && component.IsSpawned)
{
Debug.Log((object)"despawn nest spawn object");
component.Despawn(true);
}
else
{
Object.Destroy((Object)(object)((Component)array2[j]).gameObject);
}
}
__instance.currentEnemyPower = 0f;
__instance.currentDaytimeEnemyPower = 0f;
__instance.currentOutsideEnemyPower = 0f;
return false;
}
[HarmonyPatch(typeof(StartOfRound), "StartGame")]
[HarmonyPrefix]
private static void RespawnBaby(StartOfRound __instance)
{
if (!ConfigManager.CanBabyGoIntoOrbit.Value || (!((NetworkBehaviour)__instance).IsServer && !__instance.inShipPhase))
{
return;
}
foreach (CaveDwellerAI item in BetterBabies.Instance.babiesInShip.ToList())
{
if (!((Object)(object)item == (Object)null))
{
item.SetCryingLocalClient(false);
item.SetBabyCryingServerRpc(false);
item.growthMeter = 0f;
item.nearTransforming = false;
BetterBabies.Instance.babiesInShip.Remove(item);
}
}
foreach (CaveDwellerPhysicsProp item2 in BetterBabies.Instance.babyItemsInShip.ToList())
{
if (!((Object)(object)item2 == (Object)null))
{
BetterBabies.Instance.babyItemsInShip.Remove(item2);
}
}
}
[HarmonyPatch(typeof(CaveDwellerAI), "IncreaseBabyGrowthMeter")]
[HarmonyPrefix]
private static bool disableBabyGrowth(CaveDwellerAI __instance)
{
if (!ConfigManager.CanBabyGoIntoOrbit.Value)
{
return true;
}
if (BetterBabies.babyInShipState(__instance))
{
__instance.SetCryingLocalClient(false);
__instance.SetBabyCryingServerRpc(false);
__instance.SetBabyRunningServerRpc(false);
__instance.growthMeter = 0f;
return false;
}
return true;
}
}
internal class BabyOutside
{
[HarmonyPatch(typeof(CaveDwellerAI), "BabyUpdate")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> BabyOutsideTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
Label configJumpLabel = il.DefineLabel();
FieldInfo isOutside = AccessTools.Field(typeof(EnemyAI), "isOutside");
FieldInfo config = AccessTools.Field(typeof(ConfigManager), "CanBabyGoOutside");
PropertyInfo configValue = AccessTools.Property(typeof(SyncedEntry<bool>), "Value");
bool foundFirst = false;
bool foundTarget = false;
LocalBuilder wasOutside = il.DeclareLocal(typeof(bool));
foreach (CodeInstruction instruction in instructions)
{
if (instruction.opcode == OpCodes.Ldfld && instruction.operand as FieldInfo == isOutside)
{
if (foundTarget)
{
yield return instruction;
continue;
}
if (foundFirst)
{
foundTarget = true;
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldfld, (object)isOutside);
yield return new CodeInstruction(OpCodes.Stloc, (object)wasOutside);
yield return new CodeInstruction(OpCodes.Ldsfld, (object)config);
yield return new CodeInstruction(OpCodes.Callvirt, (object)configValue.GetGetMethod());
yield return new CodeInstruction(OpCodes.Brfalse, (object)configJumpLabel);
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
yield return new CodeInstruction(OpCodes.Stfld, (object)isOutside);
CodeInstruction val = instruction.Clone();
val.labels.Add(configJumpLabel);
yield return val;
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldloc, (object)wasOutside);
yield return new CodeInstruction(OpCodes.Stfld, (object)isOutside);
continue;
}
foundFirst = true;
}
yield return instruction;
}
}
}
internal class BabySell
{
[HarmonyPatch(typeof(DepositItemsDesk), "PlaceItemOnCounter")]
[HarmonyPrefix]
private static bool disableBabyOnSell(object[] __args)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
PlayerControllerB val = (PlayerControllerB)__args[0];
if (((object)val.currentlyHeldObjectServer).GetType() != typeof(CaveDwellerPhysicsProp))
{
return true;
}
if (!ConfigManager.CanSellBaby.Value)
{
return false;
}
CaveDwellerPhysicsProp val2 = (CaveDwellerPhysicsProp)val.currentlyHeldObjectServer;
CaveDwellerAI caveDwellerScript = val2.caveDwellerScript;
BetterBabies.setBabyPrice(val2);
((Behaviour)val2).enabled = false;
((Behaviour)caveDwellerScript).enabled = false;
((Behaviour)((EnemyAI)caveDwellerScript).agent).enabled = false;
return true;
}
[HarmonyPatch(typeof(CaveDwellerPhysicsProp), "DiscardItem")]
[HarmonyFinalizer]
private static Exception babySellErrorHandle()
{
return null;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}