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 NetworkedPrayerBeads v1.0.1
NetworkedPrayerBeads.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.Networking; [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("NetworkedPrayerBeads")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ad56d5d6b5628231d49f88be85fdeee48dba8a76")] [assembly: AssemblyProduct("NetworkedPrayerBeads")] [assembly: AssemblyTitle("NetworkedPrayerBeads")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace NetworkedPrayerBeads { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Moffein.NetworkedPrayerBeads", "NetworkedPrayerBeads", "1.0.1")] public class NetworkedPrayerBeadsPlugin : BaseUnityPlugin { public static ItemDef BeadStatItem; private void Awake() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown CreateItem(); CharacterMaster.OnBeadReset += new hook_OnBeadReset(CharacterMaster_OnBeadReset); } private void CreateItem() { //IL_0021: 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_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown BeadStatItem = ScriptableObject.CreateInstance<ItemDef>(); ((Object)BeadStatItem).name = "MoffeinBeadStatItem"; BeadStatItem.deprecatedTier = (ItemTier)5; BeadStatItem.nameToken = "Prayer Beads Internal Stat Item"; BeadStatItem.pickupToken = "Prayer Beads stats."; BeadStatItem.descriptionToken = "Prayer Beads stats."; ItemDef beadStatItem = BeadStatItem; ItemTag[] array = new ItemTag[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); beadStatItem.tags = (ItemTag[])(object)array; BeadStatItem.hidden = true; ItemDisplayRule[] array2 = (ItemDisplayRule[])(object)new ItemDisplayRule[0]; ItemAPI.Add(new CustomItem(BeadStatItem, array2)); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); CharacterBody.RecalculateStats += new Manipulator(CharacterBody_RecalculateStats); } private void CharacterBody_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterBody>(x, "extraStatsOnLevelUpCount_CachedLastApplied") }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterBody>(x, "extraStatsOnLevelUpCount_CachedLastApplied") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<int, CharacterBody, int>>((Func<int, CharacterBody, int>)delegate(int num, CharacterBody self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)self.inventory)) { int num2 = self.extraStatsOnLevelUpCount_CachedLastApplied - self.inventory.GetItemCount(Items.ExtraStatsOnLevelUp); if (num2 > 0) { int num3 = 4; num3 += num2 - 1; num3 *= self.GetBuffCount(Buffs.ExtraStatsOnLevelUpBuff); self.inventory.GiveItem(BeadStatItem, num3); } } return num; }); } else { Debug.LogError((object)"NetworkedPrayerBeads: RecalculateStats IL hook failed."); } } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCount = sender.inventory.GetItemCount(BeadStatItem); if (itemCount > 0) { float num = 0.05f * (float)itemCount; args.baseHealthAdd += num * sender.levelMaxHealth; args.baseRegenAdd += num * sender.levelRegen; args.baseDamageAdd += num * sender.levelDamage; args.baseShieldAdd += num * sender.levelMaxShield; } } } private void CharacterMaster_OnBeadReset(orig_OnBeadReset orig, CharacterMaster self, bool gainedStats) { orig.Invoke(self, gainedStats); if (Object.op_Implicit((Object)(object)self.inventory)) { self.inventory.beadAppliedDamage = 0f; self.inventory.beadAppliedHealth = 0f; self.inventory.beadAppliedRegen = 0f; self.inventory.beadAppliedShield = 0f; } } } }