Decompiled source of DynamicDuos v1.0.2

BepInEx/plugins/ImJustBag-DynamicDuos/ChickenBee.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ChickenBee")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a chicken and a bee.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChickenBee")]
[assembly: AssemblyTitle("ChickenBee")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ChickenBee";

		public const string PLUGIN_NAME = "ChickenBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.ChickenBee";

		public const string PLUGIN_NAME = "ChickenBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.ChickenBee", "ChickenBee", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.ChickenBee is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.ChickenBee");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("bee");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get beeFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("chickenweed");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get chickenweedFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 300;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "ChickenBee.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.ChickenBee";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}

BepInEx/plugins/ImJustBag-DynamicDuos/CowBee.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CowBee")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a cow and a bee.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CowBee")]
[assembly: AssemblyTitle("CowBee")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CowBee";

		public const string PLUGIN_NAME = "CowBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.CowBee";

		public const string PLUGIN_NAME = "CowBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.CowBee", "CowBee", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.CowBee is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.CowBee");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("bee");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get beeFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("cow");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get cowFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 600;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "CowBee.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.CowBee";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}

BepInEx/plugins/ImJustBag-DynamicDuos/CowChicken.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CowChicken")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a cow and a chicken.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CowChicken")]
[assembly: AssemblyTitle("CowChicken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CowChicken";

		public const string PLUGIN_NAME = "CowChicken";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.CowChicken";

		public const string PLUGIN_NAME = "CowChicken";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.CowChicken", "CowChicken", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.CowChicken is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.CowChicken");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("chickenweed");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get chickenweedFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("cow");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get cowFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 600;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "CowChicken.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.CowChicken";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}

BepInEx/plugins/ImJustBag-DynamicDuos/CowPig.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CowPig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a cow and a pig.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CowPig")]
[assembly: AssemblyTitle("CowPig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CowPig";

		public const string PLUGIN_NAME = "CowPig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.CowPig";

		public const string PLUGIN_NAME = "CowPig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.CowPig", "CowPig", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.CowPig is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.CowPig");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("pig");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get pigFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("cow");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get cowFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 750;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "CowPig.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.CowPig";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}

BepInEx/plugins/ImJustBag-DynamicDuos/PigBee.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PigBee")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a pig and a bee.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PigBee")]
[assembly: AssemblyTitle("PigBee")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PigBee";

		public const string PLUGIN_NAME = "PigBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.PigBee";

		public const string PLUGIN_NAME = "PigBee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.PigBee", "PigBee", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.PigBee is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.PigBee");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("pig");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get pigFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("bee");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get beeFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 600;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "PigBee.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.PigBee";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}

BepInEx/plugins/ImJustBag-DynamicDuos/PigChicken.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Core.Loot;
using Atomicrops.Core.SoDb2;
using Atomicrops.Core.Upgrades;
using Atomicrops.Crops;
using Atomicrops.Game.Loot;
using Atomicrops.Global;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PigChicken")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Dynamic Duo item that adds a pig and a chicken.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PigChicken")]
[assembly: AssemblyTitle("PigChicken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Template
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PigChicken";

		public const string PLUGIN_NAME = "PigChicken";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NewSprite
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ImJustbag.plugin.PigChicken";

		public const string PLUGIN_NAME = "PigChicken";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInPlugin("ImJustbag.plugin.PigChicken", "PigChicken", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static Plugin Instance;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImJustbag.plugin.PigChicken is loaded!");
			Harmony val = new Harmony("ImJustbag.plugin.PigChicken");
			val.PatchAll();
		}

		public IEnumerator WaitForFriendDefLoader()
		{
			FriendDefLoader._init();
			while (FriendDefLoader._map.Count == 0)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			LootCollection_Constructor_Patch.OnFriendDefLoaderInitialized();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(new Type[]
	{
		typeof(LootCollectionDef),
		typeof(LootCollectionIdsEnum),
		typeof(int),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class LootCollection_Constructor_Patch
	{
		public static Sprite myCustomSprite;

		public static UpgradeDef myUpgrade;

		public static void OnFriendDefLoaderInitialized()
		{
			FriendDef val = FriendDefLoader.Get("pig");
			if ((Object)(object)val != (Object)null)
			{
				myUpgrade.AddFriends.Add(val);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get pigFriendDef, it is null.");
			}
			FriendDef val2 = FriendDefLoader.Get("chickenweed");
			if ((Object)(object)val2 != (Object)null)
			{
				myUpgrade.AddFriends.Add(val2);
			}
			else
			{
				Plugin.Log.LogError((object)"Failed to get chickenweedFriendDef, it is null.");
			}
		}

		private static void Postfix(LootCollection __instance, LootCollectionDef collectionDef, LootCollectionIdsEnum id, int seed, bool doDlcCheck, bool isCrow, bool isClassic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id == 0)
			{
				myUpgrade = ScriptableObject.CreateInstance<UpgradeDef>();
				((Object)myUpgrade).name = "Dynamic Duo";
				myUpgrade.UpgradeType = (UpgradeTypeEnum)0;
				myUpgrade.Disabled = false;
				myUpgrade.MaxStacks = 1;
				myUpgrade.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
				myUpgrade.DoAddDependents = false;
				myUpgrade.DependentCollection = (LootCollectionIdsEnum)0;
				myUpgrade.Dependents = new List<UpgradeDef>();
				myUpgrade.DependentsILoot = new List<SoDb2Item>();
				myUpgrade.DoInstantApply = false;
				myUpgrade.InstantApply = null;
				myUpgrade.InstantApplyAmount = 1;
				myUpgrade.DoRandomSelectInstantApply = false;
				myUpgrade.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
				myUpgrade.DoAddSeeds = false;
				myUpgrade.AddSeeds = null;
				myUpgrade.AddSeedsList = new List<CropDef>();
				myUpgrade.AddSeedsCount = 0;
				myUpgrade.AddAloeVeraHeals = 0;
				myUpgrade.DropOnDamage = false;
				myUpgrade.DropFx = null;
				myUpgrade.DropSound = null;
				myUpgrade.IsTomorrowLongerUpgrade = false;
				myUpgrade.DoAddFriends = true;
				myUpgrade.AddFriends = new List<FriendDef>();
				if ((Object)(object)Plugin.Instance != (Object)null)
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.WaitForFriendDefLoader());
				}
				myUpgrade.AddFriendAroundPlayer = true;
				myUpgrade.DoAddTurrets = false;
				myUpgrade.Turrets = new List<TurretDef>();
				myUpgrade.RunFunction = (FunctionEnum)0;
				myUpgrade.DoAddGardenBed = false;
				myUpgrade.GardenBeds = new List<GardenBedDef>();
				myUpgrade.AddPowerSowableSeeds = 0;
				FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					List<UpgradeParam> value = new List<UpgradeParam>();
					field.SetValue(myUpgrade, value);
				}
				LootDefProperties val = new LootDefProperties();
				val.Tag = (TagEnum)0;
				val.Dlc = (Dlcs)0;
				val.Build = "";
				val.DisplayName = "Dynamic Duo";
				val.Description = "Two in one!";
				val.DisplayNameLocalizationKey = "";
				val.DoNameFormatter = false;
				val.NameFormatterArg1 = "";
				val.DoLocNameFormatterArg1 = false;
				val.DescriptionLocalizationKey = "";
				val.DoDescFormatter = false;
				val.DescFormatterArg1 = "";
				val.DoLocDescFormatterArg1 = false;
				val.DescFormatterArg2 = "";
				val.DoLocDescFormatterArg2 = false;
				val.DescFormatterArg3 = "";
				val.DoLocDescFormatterArg3 = false;
				val.DoAltDescFormattersForCrow = false;
				val.AltDescFormattersForCrow = new DescFormatters();
				val.DoDescComposition = false;
				val.AppendDescComposition = false;
				val.DescCompJoinUseComma = false;
				val.LocElementsForDescComposition = new List<LocElement>();
				val.Rarity = (Rarity_)1;
				val.PrimaryBiome = (Biomes)0;
				val.LuckMult = 0f;
				val.UseCustomCost = true;
				val.CustomCost = 600;
				val.DontSpawnOnLastDay = false;
				val.DoMutuallyExclusive = false;
				val.MutuallyExclusive = null;
				val.InventoryIconAnim = null;
				val.InventoryIconSelected = null;
				val.InventoryIconSelectedAnim = null;
				val.InGameLootSprite = null;
				val.InGameLootClip = null;
				val.DoAltIconsIfCrow = false;
				val.IconsIfCrow = new Icons();
				val.RevealClip = null;
				val.LootSpriteColorMult = Color.white;
				val.InGameLootShadowHeightOffset = 0f;
				val.SetSortOffset = false;
				val.SortOffset = 0f;
				val.SizeForShadow = 1f;
				val.ShowTooltip = true;
				val.Stack = false;
				val.DoHop = true;
				val.Flash = true;
				val.NoToolTipRegion = false;
				val.ToolTipOffset = new Vector2(0f, 0.3f);
				string location = Assembly.GetExecutingAssembly().Location;
				string directoryName = Path.GetDirectoryName(location);
				string path = Path.Combine(directoryName, "PigChicken.png");
				byte[] array = File.ReadAllBytes(path);
				Texture2D val2 = new Texture2D(2, 2);
				if (ImageConversion.LoadImage(val2, array))
				{
					((Texture)val2).filterMode = (FilterMode)0;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
					Vector2 val4 = default(Vector2);
					((Vector2)(ref val4))..ctor(0.5f, 0.5f);
					float num = 32f;
					myCustomSprite = Sprite.Create(val2, val3, val4, num);
				}
				else
				{
					Debug.LogError((object)"Failed to load image.");
				}
				val.InventoryIcon = myCustomSprite;
				val.InGameLootSprite = myCustomSprite;
				val.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
				val.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
				myUpgrade.LootProperties = val;
				FieldInfo field2 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
				Plugin.Log.LogInfo((object)$"{field2}");
				if (field2 != null && field2.GetValue(__instance) is List<ILootDef> list)
				{
					string text = "ImJustbag.plugin.PigChicken";
					int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
					Random random = new Random(seed2);
					int index = random.Next(list.Count);
					list.Insert(index, (ILootDef)(object)myUpgrade);
					field2.SetValue(__instance, list);
				}
			}
		}
	}
}