Decompiled source of CustomItemPack1 v1.0.0
Clubber.dll
Decompiled a year agousing 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.Data; using Atomicrops.Game.Loot; using Atomicrops.Game.ParamsSystem; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; using HarmonyLib; using Microsoft.CodeAnalysis; using SharedLib; 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("Clubber")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Clubber")] [assembly: AssemblyTitle("Clubber")] [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 = "Clubber"; public const string PLUGIN_NAME = "Clubber"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NewSprite { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.clubber"; public const string PLUGIN_NAME = "clubber"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.clubber", "clubber", "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.clubber is loaded!"); Harmony val = new Harmony("pauli.plugin.clubber"); val.PatchAll(); } } public static class ClubberState { public static int FarmingStat { get; set; } public static int FightingStat { get; set; } public static void BoostLuck() { FarmingStat = SingletonScriptableObject<GameData>.I.FarmingStat.Get(); FightingStat = SingletonScriptableObject<GameData>.I.FightingStat.Get(); PlayerParams player = LiveParams.Player; player.Luck += (float)FarmingStat * 0.02f - (float)FightingStat * 0.01f; } public static void Cleanup() { PlayerParams player = LiveParams.Player; player.Luck -= (float)FarmingStat * 0.02f - (float)FightingStat * 0.01f; FarmingStat = 0; FightingStat = 0; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: 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 = "Clubber"; 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 = "#Clubber"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#Clubber")) { GlobalActions.AddAction("#Clubber", (Action)ClubberState.BoostLuck, (Action)ClubberState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Clubber"; val3.Description = "Feelin' Farmy? +2% Luck for every Farming Stat, -1% for every Fighting Stat.\n(Luck may not update right away)"; 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, "Clubber.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.clubber"; 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); } } } }
DeervilContract.dll
Decompiled a year agousing 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.Data; using Atomicrops.Game.EnemySystem; using Atomicrops.Game.Loot; using Atomicrops.Game.SellableSystem; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; using HarmonyLib; using Microsoft.CodeAnalysis; using SharedLib; 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("DeervilContract")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DeervilContract")] [assembly: AssemblyTitle("DeervilContract")] [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 = "DeervilContract"; public const string PLUGIN_NAME = "DeervilContract"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DeervilContract { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.DeervilContract"; public const string PLUGIN_NAME = "DeervilContract"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.DeervilContract", "DeervilContract", "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.DeervilContract is loaded!"); Harmony val = new Harmony("pauli.plugin.DeervilContract"); val.PatchAll(); } } public static class DeervilContractState { public static bool DoSouls { get; set; } public static void EnableDoSouls() { DoSouls = true; } public static void Cleanup() { DoSouls = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 2) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "DeervilContract"; 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 = "#DeervilContract"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#DeervilContract")) { GlobalActions.AddAction("#DeervilContract", (Action)DeervilContractState.EnableDoSouls, (Action)DeervilContractState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Deervil's Contract"; val3.Description = "10 Cashews on every kill"; 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, "DeervilContract.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.DeervilContract"; 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); } } } [HarmonyPatch(typeof(UpgradeProcs_1_6), "OnOnEnemyKilled")] internal class UpgradeProcs_1_6_OnOnEnemyKilled_Patch { private static void Postfix(UpgradeProcs_1_6 __instance, object arg1, EnemyControllerEventArgs arg2) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (DeervilContractState.DoSouls) { Vector2 anchor = arg2.Enemy.GetAgent().GetAnchor((AgentAnchors)0); SellableModel val = new SellableModel { Def = __instance.GhostSellable, QualityLevel = 0 }; if (!FinalBossUtils.DoCropGun()) { SingletonScriptableObject<GameData>.I.Sellables.Add(val, false, default(Vector2), (CropModel)null); SingletonScriptableObject<GameData>.I.Money.Add(SellableUtils.GetMoneyValue(val)); SimplePool.Spawn(__instance.GhostMediumPrefab, Vector2.op_Implicit(anchor + __instance.GhostMediumSpawnOffset), Quaternion.identity); } else if ((Object)(object)SingletonSceneScope<FinalBossCropGun>.I != (Object)null) { SingletonSceneScope<FinalBossCropGun>.I.Fire(val, (CropModel)null, anchor); } } } } }
Delicacy.dll
Decompiled a year agousing 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.Game.SellableSystem; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; 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("Delicacy")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Delicacy")] [assembly: AssemblyTitle("Delicacy")] [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 = "Delicacy"; public const string PLUGIN_NAME = "Delicacy"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NewSprite { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.Delicacy"; public const string PLUGIN_NAME = "Delicacy"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.Delicacy", "Delicacy", "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.Delicacy is loaded!"); Harmony val = new Harmony("pauli.plugin.Delicacy"); val.PatchAll(); } } public static class DelicacyState { public static bool ActivateOneHealth { get; set; } public static void EnableActivateOneHealth() { ActivateOneHealth = true; } public static void Cleanup() { ActivateOneHealth = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 3) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "Delicacy"; 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 = "#Delicacy"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#Delicacy")) { GlobalActions.AddAction("#Delicacy", (Action)DelicacyState.EnableActivateOneHealth, (Action)DelicacyState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Delicacy"; val3.Description = "Everything will be worth 1.5x Cashews. Every future crop planted will die instantly upon being eaten or burned"; 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, "Delicacy.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.Delicacy"; 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); } } } [HarmonyPatch(typeof(CropModel), "GetMaxHealth")] internal class CropModel_GetMaxHealth_Patch { private static bool Prefix(CropModel __instance, ref float __result) { if (DelicacyState.ActivateOneHealth) { __result = 1f; return false; } return true; } } [HarmonyPatch(typeof(SellableUtils), "GetMoneyValue", new Type[] { typeof(SellableModel) })] internal class SellableUtils_GetMoneyValue_Patch { private static void Postfix(ref int __result, SellableModel model) { if (DelicacyState.ActivateOneHealth) { float num = (float)__result * 1.5f; __result = (int)Math.Floor(num); } } } }
DopeShades.dll
Decompiled a year agousing 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 CustomParams; 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("DopeShades")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DopeShades")] [assembly: AssemblyTitle("DopeShades")] [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 = "DopeShades"; public const string PLUGIN_NAME = "DopeShades"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DopeShades { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.DopeShades"; public const string PLUGIN_NAME = "DopeShades"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.DopeShades", "DopeShades", "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.DopeShades is loaded!"); Harmony val = new Harmony("pauli.plugin.DopeShades"); val.PatchAll(); } } public static class DopeShadesState { public static readonly Vector2 offset = new Vector2(0.0001f, 0.0001f); public static Vector2 lastPos = new Vector2(float.MinValue, float.MinValue); public static readonly float SomeSmallThreshold = 0.1f; public static bool DoDopeShades { get; set; } = false; public static void EnableDoDopeShades() { DoDopeShades = true; } public static void Cleanup() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) lastPos = new Vector2(float.MinValue, float.MinValue); DoDopeShades = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 2) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "DopeShades"; 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 = "#DopeShades"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#DopeShades")) { GlobalActions.AddAction("#DopeShades", (Action)DopeShadesState.EnableDoDopeShades, (Action)DopeShadesState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Dope Shades"; val3.Description = "So chill.\nWhen you get a friend, get two."; 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, "DopeShades.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.DopeShades"; 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); } } } [HarmonyPatch] public static class FriendsCollection_Add_Patch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(FriendsCollection), "_add", new Type[4] { typeof(FriendModel), typeof(bool), typeof(Vector2), typeof(AddParams_) }, (Type[])null); } private static void Postfix(FriendsCollection __instance, FriendModel model, bool doSpawnAtPos, ref Vector2 pos, AddParams_ addParams) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (DopeShadesState.DoDopeShades && Vector2.Distance(pos, DopeShadesState.lastPos) > DopeShadesState.SomeSmallThreshold && pos != DopeShadesState.lastPos) { DopeShadesState.lastPos = pos; MethodInfo methodInfo = AccessTools.Method(typeof(FriendsCollection), "_add", (Type[])null, (Type[])null); methodInfo.Invoke(__instance, new object[4] { (object)new FriendModel(model.Def), doSpawnAtPos, pos + DopeShadesState.offset, addParams }); } else { DopeShadesState.lastPos = pos; } } } }
MushroomMelange.dll
Decompiled a year agousing 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.Data; using Atomicrops.Game.Loot; using Atomicrops.Game.Player; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; using HarmonyLib; using Microsoft.CodeAnalysis; using SharedLib; 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("MushroomMelange")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MushroomMelange")] [assembly: AssemblyTitle("MushroomMelange")] [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 = "MushroomMelange"; public const string PLUGIN_NAME = "MushroomMelange"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MushroomMelange { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.MushroomMelange"; public const string PLUGIN_NAME = "MushroomMelange"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.MushroomMelange", "MushroomMelange", "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.MushroomMelange is loaded!"); Harmony val = new Harmony("pauli.plugin.MushroomMelange"); val.PatchAll(); } } public static class MushroomMelangeState { public static bool DoMushroomMelange { get; set; } public static void EnableMushroomMelange() { DoMushroomMelange = true; } public static void Cleanup() { DoMushroomMelange = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 2) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "MushroomMelange"; 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 = "#MushroomMelange"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#MushroomMelange")) { GlobalActions.AddAction("#MushroomMelange", (Action)MushroomMelangeState.EnableMushroomMelange, (Action)MushroomMelangeState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Mushroom Melange"; val3.Description = "When you eat a Mushroom, get the effects of every mushroom."; 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, "MushroomMelange.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.MushroomMelange"; 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); } } } [HarmonyPatch(typeof(MushroomManager), "CanEat")] internal class MushroomManage_CanEat_Patch { private static bool Prefix(ref bool __result, MushroomDef def) { if (MushroomMelangeState.DoMushroomMelange) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(MushroomManager), "Eat", new Type[] { typeof(MushroomDef) })] internal class MushroomManage_Eat_Patch { private static bool Prefix(MushroomManager __instance, MushroomDef def) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (MushroomMelangeState.DoMushroomMelange) { __instance.EatSound.PlayOneShotAtVolumeAndPitch(Vector2.op_Implicit(((Component)SingletonSceneScope<SoundListener>.I).transform.position), 1f, __instance.EatSoundPitch); def.StartSound.PlayOneShotAtVolumeAndPitch(Vector2.op_Implicit(((Component)SingletonSceneScope<SoundListener>.I).transform.position), 1f, def.StartSoundPitch); InGameText.FloatUpFromPlayer("DELICIOUS!", false, default(Vector2)); if (SingletonScriptableObject<GameData>.I.ActionItems.GetCount() > 0) { __instance.EatRechargeMush(); } __instance.EatBerserkMush(); __instance.EatFertMush(); __instance.EatSpeedMush(); Fx.PlayOnAgent(__instance.TimeFx, ((Component)SingletonSceneScope<PlayerComp>.I).gameObject, __instance.TimeFxOffset, (AgentAnchors)0); __instance.EatTimeMush(); return false; } return true; } } }
Necrootmancy.dll
Decompiled a year agousing 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.EnemySystem; using Atomicrops.Game.Loot; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; 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("Necrootmancy")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Necrootmancy")] [assembly: AssemblyTitle("Necrootmancy")] [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 = "Necrootmancy"; public const string PLUGIN_NAME = "Necrootmancy"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NewSprite { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.Necrootmancy"; public const string PLUGIN_NAME = "Necrootmancy"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.Necrootmancy", "Necrootmancy", "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.Necrootmancy is loaded!"); Harmony val = new Harmony("pauli.plugin.Necrootmancy"); val.PatchAll(); } } public static class NecrootmancyState { public static bool DoNecrootmancy { get; set; } public static GameObject RootFighter { get; set; } public static void EnableDoNecrootmancy() { if ((Object)(object)RootFighter == (Object)null) { GameObject val = GameObject.Find("UpgradesController"); FarmTaskUpgradeProcs component = val.GetComponent<FarmTaskUpgradeProcs>(); RootFighter = component.RootFighter; } DoNecrootmancy = true; } public static void Cleanup() { DoNecrootmancy = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 2) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "Necrootmancy"; 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 = "#Necrootmancy"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#Necrootmancy")) { GlobalActions.AddAction("#Necrootmancy", (Action)NecrootmancyState.EnableDoNecrootmancy, (Action)NecrootmancyState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Necrootmancy"; val3.Description = "Makes enemies soil their pants."; 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, "Necrootmancy.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.Necrootmancy"; 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); } } } [HarmonyPatch(typeof(UpgradeProcs_1_6), "OnOnEnemyKilled")] internal class UpgradeProcs_1_6_OnOnEnemyKilled_Patch { private static void Postfix(UpgradeProcs_1_6 __instance, object arg1, EnemyControllerEventArgs arg2) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0049: Unknown result type (might be due to invalid IL or missing references) if (NecrootmancyState.DoNecrootmancy && (int)arg2.Source == 3) { Vector2 anchor = arg2.Enemy.GetAgent().GetAnchor((AgentAnchors)0); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(anchor.x, anchor.y, 0f); SimplePool.Spawn(NecrootmancyState.RootFighter, val, Quaternion.identity); } } } }
Superabundance.dll
Decompiled a year agousing 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.Game.ParamsSystem; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; 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("Superabundance")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Superabundance")] [assembly: AssemblyTitle("Superabundance")] [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 = "Superabundance"; public const string PLUGIN_NAME = "Superabundance"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Superabundance { public static class MyPluginInfo { public const string PLUGIN_GUID = "pauli.plugin.superabundance"; public const string PLUGIN_NAME = "superabundance"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("pauli.plugin.superabundance", "superabundance", "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.superabundance is loaded!"); Harmony val = new Harmony("pauli.plugin.superabundance"); val.PatchAll(); } } public static class SuperabundanceState { public static void BoostDeervilCurse() { PlayerParams player = LiveParams.Player; player.DeervilCurse += 1f; } public static void Cleanup() { if (LiveParams.Player.DeervilCurse >= 1f) { PlayerParams player = LiveParams.Player; player.DeervilCurse -= 1f; } } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) if ((int)id != 3) { return; } UpgradeDef val = ScriptableObject.CreateInstance<UpgradeDef>(); ((Object)val).name = "Superabundance"; 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 = "#Superabundance"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#Superabundance")) { GlobalActions.AddAction("#Superabundance", (Action)SuperabundanceState.BoostDeervilCurse, (Action)SuperabundanceState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Superabundance"; val3.Description = "To hell with moderation. +100% Deervil Curse chance."; 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, "Superabundance.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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.superabundance"; 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); } } } [HarmonyPatch(typeof(UpgradeProcs_1_6))] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class UpgradeProcs_1_6_OnOnCropAdded_Patch { private static void Postfix(UpgradeProcs_1_6 __instance) { Traverse.Create((object)__instance).Field("_molesSpawned").SetValue((object)0); } } }
Wilderberries.dll
Decompiled a year agousing 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.Game.SellableSystem; using Atomicrops.Global; using BepInEx; using BepInEx.Logging; using CustomParams; 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("Wilderberries")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Wilderberries")] [assembly: AssemblyTitle("Wilderberries")] [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 = "Wilderberries"; public const string PLUGIN_NAME = "Wilderberries"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NewSprite { public static class MyPluginInfo { public const string PLUGIN_GUID = "ImJustBag.plugin.Wilderberries"; public const string PLUGIN_NAME = "Wilderberries"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("ImJustBag.plugin.Wilderberries", "Wilderberries", "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 ImJustBag.plugin.Wilderberries is loaded!"); Harmony val = new Harmony("ImJustBag.plugin.Wilderberries"); val.PatchAll(); } } public static class WilderberriesState { public static bool TimeOnForageable { get; set; } public static void EnableTimeOnForageable() { TimeOnForageable = true; } public static void Cleanup() { TimeOnForageable = false; } } [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; 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_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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03a2: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: 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 = "Wilderberries"; 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 = "#Wilderberries"; val2.Value = 1f; val2.Action = (Operation)2; FieldInfo field2 = typeof(UpgradeParam).GetField("ValueMin", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val2, 1f); } FieldInfo field3 = typeof(UpgradeParam).GetField("ValueMax", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(val2, 1f); } List<UpgradeParam> value = new List<UpgradeParam> { val2 }; field.SetValue(val, value); } if (!GlobalActions.Actions.ContainsKey("#Wilderberries")) { GlobalActions.AddAction("#Wilderberries", (Action)WilderberriesState.EnableTimeOnForageable, (Action)WilderberriesState.Cleanup); } LootDefProperties val3 = new LootDefProperties(); val3.Tag = (TagEnum)0; val3.Dlc = (Dlcs)0; val3.Build = ""; val3.DisplayName = "Wilderberries"; val3.Description = "You'll always have time for berry picking now!"; 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, "Wilderberries.png"); byte[] array = File.ReadAllBytes(path); Texture2D val4 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val4, array)) { ((Texture)val4).filterMode = (FilterMode)0; 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 = 32f; 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 = "ImJustBag.plugin.Wilderberries"; 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); } } } [HarmonyPatch(typeof(PlayerUpgradeActionsHandler), "SellablesOnOnChange")] internal class PlayerUpgradeActionsHandler_SellablesOnOnChange_Patch { private static void Postfix(PlayerUpgradeActionsHandler __instance, SellableEventArgs args) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (WilderberriesState.TimeOnForageable && args.Model.Def.IsForageable) { DayNightUtils.AddTime(10f); InGameText.FloatUpFromPlayer("+10 seconds", false, default(Vector2)); } } } }