Decompiled source of ComplementaryPack v1.0.1

BepInEx/plugins/ImJustBag-ComplementaryPack/BunditBatteryItem.dll

Decompiled 2 weeks ago
using System;
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("BunditBatteryItem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BunditBatteryItem")]
[assembly: AssemblyTitle("BunditBatteryItem")]
[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 = "BunditBatteryItem";

		public const string PLUGIN_NAME = "BunditBatteryItem";

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

		public const string PLUGIN_NAME = "BunditBatteryItem";

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

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin pauli.plugin.BunditBatteryItem is loaded!");
			Harmony val = new Harmony("pauli.plugin.BunditBatteryItem");
			val.PatchAll();
		}
	}
	[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 Texture2D texture;

		public static Sprite myCustomSprite;

		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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id != 0)
			{
				return;
			}
			UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>();
			((Object)val).name = "BigSpeed";
			val.UpgradeType = (UpgradeTypeEnum)0;
			val.Disabled = false;
			val.MaxStacks = 1;
			val.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
			val.DoAddDependents = false;
			val.DependentCollection = (LootCollectionIdsEnum)0;
			val.Dependents = new List<UpgradeDef>();
			val.DependentsILoot = new List<SoDb2Item>();
			val.DoInstantApply = false;
			val.InstantApply = null;
			val.InstantApplyAmount = 1;
			val.DoRandomSelectInstantApply = false;
			val.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
			val.DoAddSeeds = false;
			val.AddSeeds = null;
			val.AddSeedsList = new List<CropDef>();
			val.AddSeedsCount = 0;
			val.AddAloeVeraHeals = 0;
			val.DropOnDamage = false;
			val.DropFx = null;
			val.DropSound = null;
			val.IsTomorrowLongerUpgrade = false;
			val.DoAddFriends = false;
			val.AddFriendAroundPlayer = false;
			val.AddFriends = new List<FriendDef>();
			val.DoAddTurrets = false;
			val.Turrets = new List<TurretDef>();
			val.RunFunction = (FunctionEnum)0;
			val.DoAddGardenBed = false;
			val.GardenBeds = new List<GardenBedDef>();
			val.AddPowerSowableSeeds = 0;
			FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				UpgradeParam val2 = new UpgradeParam();
				val2.Path = "Player.TractorJumpStart";
				val2.Value = 0.15f;
				val2.Action = (Operation)0;
				FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field2 != null)
				{
					field2.SetValue(val2, 0.15f);
				}
				FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field3 != null)
				{
					field3.SetValue(val2, 0.15f);
				}
				List<UpgradeParam> value = new List<UpgradeParam> { val2 };
				field.SetValue(val, value);
			}
			LootDefProperties val3 = new LootDefProperties();
			val3.Tag = (TagEnum)0;
			val3.Dlc = (Dlcs)0;
			val3.Build = "";
			val3.DisplayName = "Bundit Battery";
			val3.Description = "+15% jump start";
			val3.DisplayNameLocalizationKey = "";
			val3.DoNameFormatter = false;
			val3.NameFormatterArg1 = "";
			val3.DoLocNameFormatterArg1 = false;
			val3.DescriptionLocalizationKey = "";
			val3.DoDescFormatter = false;
			val3.DescFormatterArg1 = "";
			val3.DoLocDescFormatterArg1 = false;
			val3.DescFormatterArg2 = "";
			val3.DoLocDescFormatterArg2 = false;
			val3.DescFormatterArg3 = "";
			val3.DoLocDescFormatterArg3 = false;
			val3.DoAltDescFormattersForCrow = false;
			val3.AltDescFormattersForCrow = new DescFormatters();
			val3.DoDescComposition = false;
			val3.AppendDescComposition = false;
			val3.DescCompJoinUseComma = false;
			val3.LocElementsForDescComposition = new List<LocElement>();
			val3.Rarity = (Rarity_)1;
			val3.PrimaryBiome = (Biomes)0;
			val3.LuckMult = 0f;
			val3.UseCustomCost = false;
			val3.CustomCost = 100;
			val3.DontSpawnOnLastDay = false;
			val3.DoMutuallyExclusive = false;
			val3.MutuallyExclusive = null;
			val3.InventoryIconAnim = null;
			val3.InventoryIconSelected = null;
			val3.InventoryIconSelectedAnim = null;
			val3.InGameLootSprite = null;
			val3.InGameLootClip = null;
			val3.DoAltIconsIfCrow = false;
			val3.IconsIfCrow = new Icons();
			val3.RevealClip = null;
			val3.LootSpriteColorMult = Color.white;
			val3.InGameLootShadowHeightOffset = 0f;
			val3.SetSortOffset = false;
			val3.SortOffset = 0f;
			val3.SizeForShadow = 1f;
			val3.ShowTooltip = true;
			val3.Stack = false;
			val3.DoHop = true;
			val3.Flash = true;
			val3.NoToolTipRegion = false;
			val3.ToolTipOffset = new Vector2(0f, 0.3f);
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			string path = Path.Combine(directoryName, "BunditBattery.png");
			byte[] array = File.ReadAllBytes(path);
			Texture2D val4 = new Texture2D(2, 2);
			if (ImageConversion.LoadImage(val4, array))
			{
				Rect val5 = default(Rect);
				((Rect)(ref val5))..ctor(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height);
				Vector2 val6 = default(Vector2);
				((Vector2)(ref val6))..ctor(0.5f, 0.5f);
				float num = 33f;
				myCustomSprite = Sprite.Create(val4, val5, val6, num);
			}
			else
			{
				Debug.LogError((object)"Failed to load image.");
			}
			val3.InventoryIcon = myCustomSprite;
			val3.InGameLootSprite = myCustomSprite;
			val3.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
			val3.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
			val.LootProperties = val3;
			FieldInfo field4 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
			Plugin.Log.LogInfo((object)$"{field4}");
			if (field4 != null && field4.GetValue(__instance) is List<ILootDef> list)
			{
				string text = "pauli.plugin.BunditBatteryItem";
				int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
				Random random = new Random(seed2);
				int index = random.Next(list.Count);
				list.Insert(index, (ILootDef)(object)val);
				field4.SetValue(__instance, list);
			}
		}
	}
}

BepInEx/plugins/ImJustBag-ComplementaryPack/LeadPipeItem.dll

Decompiled 2 weeks ago
using System;
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("LeadPipeItem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeadPipeItem")]
[assembly: AssemblyTitle("LeadPipeItem")]
[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 = "LeadPipeItem";

		public const string PLUGIN_NAME = "LeadPipeItem";

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

		public const string PLUGIN_NAME = "LeadPipeItem";

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

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin pauli.plugin.LeadPipeItem is loaded!");
			Harmony val = new Harmony("pauli.plugin.LeadPipeItem");
			val.PatchAll();
		}
	}
	[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 Texture2D texture;

		public static Sprite myCustomSprite;

		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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id != 0)
			{
				return;
			}
			UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>();
			((Object)val).name = "LeadPipe";
			val.UpgradeType = (UpgradeTypeEnum)0;
			val.Disabled = false;
			val.MaxStacks = 1;
			val.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
			val.DoAddDependents = false;
			val.DependentCollection = (LootCollectionIdsEnum)0;
			val.Dependents = new List<UpgradeDef>();
			val.DependentsILoot = new List<SoDb2Item>();
			val.DoInstantApply = false;
			val.InstantApply = null;
			val.InstantApplyAmount = 1;
			val.DoRandomSelectInstantApply = false;
			val.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
			val.DoAddSeeds = false;
			val.AddSeeds = null;
			val.AddSeedsList = new List<CropDef>();
			val.AddSeedsCount = 0;
			val.AddAloeVeraHeals = 0;
			val.DropOnDamage = false;
			val.DropFx = null;
			val.DropSound = null;
			val.IsTomorrowLongerUpgrade = false;
			val.DoAddFriends = false;
			val.AddFriendAroundPlayer = false;
			val.AddFriends = new List<FriendDef>();
			val.DoAddTurrets = false;
			val.Turrets = new List<TurretDef>();
			val.RunFunction = (FunctionEnum)0;
			val.DoAddGardenBed = false;
			val.GardenBeds = new List<GardenBedDef>();
			val.AddPowerSowableSeeds = 0;
			FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				UpgradeParam val2 = new UpgradeParam();
				val2.Path = "Player.BarkSkin";
				val2.Value = 0.2f;
				val2.Action = (Operation)0;
				FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field2 != null)
				{
					field2.SetValue(val2, 0.2f);
				}
				FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field3 != null)
				{
					field3.SetValue(val2, 0.2f);
				}
				List<UpgradeParam> value = new List<UpgradeParam> { val2 };
				field.SetValue(val, value);
			}
			LootDefProperties val3 = new LootDefProperties();
			val3.Tag = (TagEnum)0;
			val3.Dlc = (Dlcs)0;
			val3.Build = "";
			val3.DisplayName = "Lead Pipe";
			val3.Description = "+20% bark skin";
			val3.DisplayNameLocalizationKey = "";
			val3.DoNameFormatter = false;
			val3.NameFormatterArg1 = "";
			val3.DoLocNameFormatterArg1 = false;
			val3.DescriptionLocalizationKey = "";
			val3.DoDescFormatter = false;
			val3.DescFormatterArg1 = "";
			val3.DoLocDescFormatterArg1 = false;
			val3.DescFormatterArg2 = "";
			val3.DoLocDescFormatterArg2 = false;
			val3.DescFormatterArg3 = "";
			val3.DoLocDescFormatterArg3 = false;
			val3.DoAltDescFormattersForCrow = false;
			val3.AltDescFormattersForCrow = new DescFormatters();
			val3.DoDescComposition = false;
			val3.AppendDescComposition = false;
			val3.DescCompJoinUseComma = false;
			val3.LocElementsForDescComposition = new List<LocElement>();
			val3.Rarity = (Rarity_)1;
			val3.PrimaryBiome = (Biomes)0;
			val3.LuckMult = 0f;
			val3.UseCustomCost = false;
			val3.CustomCost = 100;
			val3.DontSpawnOnLastDay = false;
			val3.DoMutuallyExclusive = false;
			val3.MutuallyExclusive = null;
			val3.InventoryIconAnim = null;
			val3.InventoryIconSelected = null;
			val3.InventoryIconSelectedAnim = null;
			val3.InGameLootSprite = null;
			val3.InGameLootClip = null;
			val3.DoAltIconsIfCrow = false;
			val3.IconsIfCrow = new Icons();
			val3.RevealClip = null;
			val3.LootSpriteColorMult = Color.white;
			val3.InGameLootShadowHeightOffset = 0f;
			val3.SetSortOffset = false;
			val3.SortOffset = 0f;
			val3.SizeForShadow = 1f;
			val3.ShowTooltip = true;
			val3.Stack = false;
			val3.DoHop = true;
			val3.Flash = true;
			val3.NoToolTipRegion = false;
			val3.ToolTipOffset = new Vector2(0f, 0.3f);
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			string path = Path.Combine(directoryName, "LeadPipe.png");
			byte[] array = File.ReadAllBytes(path);
			Texture2D val4 = new Texture2D(2, 2);
			if (ImageConversion.LoadImage(val4, array))
			{
				Rect val5 = default(Rect);
				((Rect)(ref val5))..ctor(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height);
				Vector2 val6 = default(Vector2);
				((Vector2)(ref val6))..ctor(0.5f, 0.5f);
				float num = 33f;
				myCustomSprite = Sprite.Create(val4, val5, val6, num);
			}
			else
			{
				Debug.LogError((object)"Failed to load image.");
			}
			val3.InventoryIcon = myCustomSprite;
			val3.InGameLootSprite = myCustomSprite;
			val3.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
			val3.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
			val.LootProperties = val3;
			FieldInfo field4 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
			Plugin.Log.LogInfo((object)$"{field4}");
			if (field4 != null && field4.GetValue(__instance) is List<ILootDef> list)
			{
				string text = "pauli.plugin.LeadPipeItem";
				int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
				Random random = new Random(seed2);
				int index = random.Next(list.Count);
				list.Insert(index, (ILootDef)(object)val);
				field4.SetValue(__instance, list);
			}
		}
	}
}

BepInEx/plugins/ImJustBag-ComplementaryPack/TrackerAnkletItem.dll

Decompiled 2 weeks ago
using System;
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("TrackerAnkletItem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TrackerAnkletItem")]
[assembly: AssemblyTitle("TrackerAnkletItem")]
[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 = "TrackerAnkletItem";

		public const string PLUGIN_NAME = "TrackerAnkletItem";

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

		public const string PLUGIN_NAME = "TrackerAnkletItem";

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

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin pauli.plugin.TrackerAnkletItem is loaded!");
			Harmony val = new Harmony("pauli.plugin.TrackerAnkletItem");
			val.PatchAll();
		}
	}
	[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 Texture2D texture;

		public static Sprite myCustomSprite;

		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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			if ((int)id != 0)
			{
				return;
			}
			UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>();
			((Object)val).name = "TrackerAnklet";
			val.UpgradeType = (UpgradeTypeEnum)0;
			val.Disabled = false;
			val.MaxStacks = 1;
			val.RemoveUpgradesWhenPickedUp = new List<UpgradeDef>();
			val.DoAddDependents = false;
			val.DependentCollection = (LootCollectionIdsEnum)0;
			val.Dependents = new List<UpgradeDef>();
			val.DependentsILoot = new List<SoDb2Item>();
			val.DoInstantApply = false;
			val.InstantApply = null;
			val.InstantApplyAmount = 1;
			val.DoRandomSelectInstantApply = false;
			val.InstantApplyRandomSelect = new List<InstantApplyLootDef>();
			val.DoAddSeeds = false;
			val.AddSeeds = null;
			val.AddSeedsList = new List<CropDef>();
			val.AddSeedsCount = 0;
			val.AddAloeVeraHeals = 0;
			val.DropOnDamage = false;
			val.DropFx = null;
			val.DropSound = null;
			val.IsTomorrowLongerUpgrade = false;
			val.DoAddFriends = false;
			val.AddFriendAroundPlayer = false;
			val.AddFriends = new List<FriendDef>();
			val.DoAddTurrets = false;
			val.Turrets = new List<TurretDef>();
			val.RunFunction = (FunctionEnum)0;
			val.DoAddGardenBed = false;
			val.GardenBeds = new List<GardenBedDef>();
			val.AddPowerSowableSeeds = 0;
			FieldInfo field = typeof(UpgradeDef).GetField("Params", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				UpgradeParam val2 = new UpgradeParam();
				val2.Path = "Player.HomingPigeon";
				val2.Value = 0.15f;
				val2.Action = (Operation)0;
				FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field2 != null)
				{
					field2.SetValue(val2, 0.15f);
				}
				FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field3 != null)
				{
					field3.SetValue(val2, 0.15f);
				}
				List<UpgradeParam> value = new List<UpgradeParam> { val2 };
				field.SetValue(val, value);
			}
			LootDefProperties val3 = new LootDefProperties();
			val3.Tag = (TagEnum)0;
			val3.Dlc = (Dlcs)0;
			val3.Build = "";
			val3.DisplayName = "Tracker Anklet";
			val3.Description = "+15% homing pigeon";
			val3.DisplayNameLocalizationKey = "";
			val3.DoNameFormatter = false;
			val3.NameFormatterArg1 = "";
			val3.DoLocNameFormatterArg1 = false;
			val3.DescriptionLocalizationKey = "";
			val3.DoDescFormatter = false;
			val3.DescFormatterArg1 = "";
			val3.DoLocDescFormatterArg1 = false;
			val3.DescFormatterArg2 = "";
			val3.DoLocDescFormatterArg2 = false;
			val3.DescFormatterArg3 = "";
			val3.DoLocDescFormatterArg3 = false;
			val3.DoAltDescFormattersForCrow = false;
			val3.AltDescFormattersForCrow = new DescFormatters();
			val3.DoDescComposition = false;
			val3.AppendDescComposition = false;
			val3.DescCompJoinUseComma = false;
			val3.LocElementsForDescComposition = new List<LocElement>();
			val3.Rarity = (Rarity_)1;
			val3.PrimaryBiome = (Biomes)0;
			val3.LuckMult = 0f;
			val3.UseCustomCost = false;
			val3.CustomCost = 100;
			val3.DontSpawnOnLastDay = false;
			val3.DoMutuallyExclusive = false;
			val3.MutuallyExclusive = null;
			val3.InventoryIconAnim = null;
			val3.InventoryIconSelected = null;
			val3.InventoryIconSelectedAnim = null;
			val3.InGameLootSprite = null;
			val3.InGameLootClip = null;
			val3.DoAltIconsIfCrow = false;
			val3.IconsIfCrow = new Icons();
			val3.RevealClip = null;
			val3.LootSpriteColorMult = Color.white;
			val3.InGameLootShadowHeightOffset = 0f;
			val3.SetSortOffset = false;
			val3.SortOffset = 0f;
			val3.SizeForShadow = 1f;
			val3.ShowTooltip = true;
			val3.Stack = false;
			val3.DoHop = true;
			val3.Flash = true;
			val3.NoToolTipRegion = false;
			val3.ToolTipOffset = new Vector2(0f, 0.3f);
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			string path = Path.Combine(directoryName, "TrackerAnklet.png");
			byte[] array = File.ReadAllBytes(path);
			Texture2D val4 = new Texture2D(2, 2);
			if (ImageConversion.LoadImage(val4, array))
			{
				Rect val5 = default(Rect);
				((Rect)(ref val5))..ctor(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height);
				Vector2 val6 = default(Vector2);
				((Vector2)(ref val6))..ctor(0.5f, 0.5f);
				float num = 50f;
				myCustomSprite = Sprite.Create(val4, val5, val6, num);
			}
			else
			{
				Debug.LogError((object)"Failed to load image.");
			}
			val3.InventoryIcon = myCustomSprite;
			val3.InGameLootSprite = myCustomSprite;
			val3.PickupSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.PickupSoundEvent;
			val3.DropSoundEvent = SoDb2Utils.GetItem<UpgradeDef>(10).LootProperties.DropSoundEvent;
			val.LootProperties = val3;
			FieldInfo field4 = typeof(LootCollection).GetField("_loots", BindingFlags.Instance | BindingFlags.NonPublic);
			Plugin.Log.LogInfo((object)$"{field4}");
			if (field4 != null && field4.GetValue(__instance) is List<ILootDef> list)
			{
				string text = "pauli.plugin.TrackerAnkletItem";
				int seed2 = DateTime.Now.Millisecond + text.GetHashCode();
				Random random = new Random(seed2);
				int index = random.Next(list.Count);
				list.Insert(index, (ILootDef)(object)val);
				field4.SetValue(__instance, list);
			}
		}
	}
}