Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SpikedSatchel v0.0.2
Pikahchew-SpikedSatchel/CustomItem.dll
Decompiled 19 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CustomItem")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CustomItem")] [assembly: AssemblyTitle("CustomItem")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace SpikedSatchel { internal static class Assets { internal static GameObject SpikedSatchelPrefab; internal static Sprite SpikedSatchelIcon; internal static ItemDef SpikedSatchelItemDef; internal static void Init() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "spikedsatchelassets"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[SpikedSatchel] Failed to load AssetBundle from path: " + text)); return; } SpikedSatchelPrefab = val.LoadAsset<GameObject>("Assets/SpikedSatchel.prefab"); SpikedSatchelIcon = val.LoadAsset<Sprite>("Assets/SpikedSatchelSprite.png"); SpikedSatchel(); AddLanguageTokens(); } private static void SpikedSatchel() { //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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown SpikedSatchelItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)SpikedSatchelItemDef).name = "SpikedSatchel"; ItemTierDef value = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion(); FieldInfo field = typeof(ItemDef).GetField("_itemTierDef", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(SpikedSatchelItemDef, value); SpikedSatchelItemDef.pickupModelPrefab = SpikedSatchelPrefab; SpikedSatchelItemDef.pickupIconSprite = SpikedSatchelIcon; SpikedSatchelItemDef.nameToken = "SPIKEDSATCHEL_NAME"; SpikedSatchelItemDef.pickupToken = "SPIKEDSATCHEL_PICKUP"; SpikedSatchelItemDef.descriptionToken = "SPIKEDSATCHEL_DESC"; SpikedSatchelItemDef.loreToken = "SPIKEDSATCHEL_LORE"; SpikedSatchelItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; ItemDisplayRule[] array = (ItemDisplayRule[])(object)new ItemDisplayRule[1]; array[0].followerPrefab = SpikedSatchelPrefab; array[0].childName = "Chest"; array[0].localPos = new Vector3(0.27893f, -0.19498f, 0.02218f); array[0].localAngles = new Vector3(0.31285f, 357.1498f, 16.90189f); array[0].localScale = new Vector3(1f, 1f, 1f); CustomItem val = new CustomItem(SpikedSatchelItemDef, array); ItemAPI.Add(val); } private static void AddLanguageTokens() { LanguageAPI.Add("SPIKEDSATCHEL_NAME", "Spiked Satchel"); LanguageAPI.Add("SPIKEDSATCHEL_PICKUP", "Increases damage by 0.30% per item in inventory."); LanguageAPI.Add("SPIKEDSATCHEL_DESC", "Increases damage by 0.30% per item in inventory."); LanguageAPI.Add("SPIKEDSATCHEL_LORE", "A mysterious satchel that seems to enhance the wearer's combat abilities based on the number of items they carry."); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.pikahchew.SpikedSatchel", "Spiked Satchel", "0.0.1")] public class CustomItem : BaseUnityPlugin { private const string ModVer = "0.0.1"; private const string ModName = "Spiked Satchel"; public const string ModGuid = "com.pikahchew.SpikedSatchel"; internal static ManualLogSource Logger; public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Assets.Init(); Hooks.Init(); } } public class Hooks { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Start <>9__0_0; public static StatHookEventHandler <>9__0_1; internal void <Init>b__0_0(orig_Start orig, Run self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CustomItem.Logger.LogInfo((object)$"[SpikedSatchel] Runtime tier check: {Assets.SpikedSatchelItemDef.tier}, itemIndex={Assets.SpikedSatchelItemDef.itemIndex}"); } internal void <Init>b__0_1(CharacterBody body, StatHookEventArgs args) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !body.isPlayerControlled) { return; } Inventory inventory = body.inventory; if ((Object)(object)inventory == (Object)null) { return; } int itemCountEffective = inventory.GetItemCountEffective(Assets.SpikedSatchelItemDef.itemIndex); if (itemCountEffective <= 0) { return; } int num = 0; foreach (ItemIndex item in inventory.itemAcquisitionOrder) { num += inventory.GetItemCountEffective(item); } float num2 = 0.003f; args.damageMultAdd += (float)num * num2; } } internal static void Init() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { hook_Start val = delegate(orig_Start orig, Run self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CustomItem.Logger.LogInfo((object)$"[SpikedSatchel] Runtime tier check: {Assets.SpikedSatchelItemDef.tier}, itemIndex={Assets.SpikedSatchelItemDef.itemIndex}"); }; <>c.<>9__0_0 = val; obj = (object)val; } Run.Start += (hook_Start)obj; object obj2 = <>c.<>9__0_1; if (obj2 == null) { StatHookEventHandler val2 = delegate(CharacterBody body, StatHookEventArgs args) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled) { Inventory inventory = body.inventory; if (!((Object)(object)inventory == (Object)null)) { int itemCountEffective = inventory.GetItemCountEffective(Assets.SpikedSatchelItemDef.itemIndex); if (itemCountEffective > 0) { int num = 0; foreach (ItemIndex item in inventory.itemAcquisitionOrder) { num += inventory.GetItemCountEffective(item); } float num2 = 0.003f; args.damageMultAdd += (float)num * num2; } } } }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2; } } }