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 RailgunnerCritChancePassive v1.0.0
plugins/RailgunnerCritChancePassive/Plugin.dll
Decompiled a year agousing System; 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 BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.Skills; 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("Plugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+28c724f615bf726b76d71576724f7b621cfab388")] [assembly: AssemblyProduct("Plugin")] [assembly: AssemblyTitle("Plugin")] [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 Plugin { internal class CustomItems { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients; } public static ItemDef ItemAttackSpeedWithCrit; private const float ATTACK_SPEED_PER_CRIT_CHANCE = 0.005f; public static void Init() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CreateItemAttackSpeedWithCrit(); object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients; if (obj == null) { StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients; <>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } public static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCount = sender.inventory.GetItemCount(ItemAttackSpeedWithCrit); if (itemCount > 0) { args.attackSpeedMultAdd += sender.crit * 0.005f; } } } private static void CreateItemAttackSpeedWithCrit() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001c: 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) //IL_002c: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown ItemDef val = new ItemDef(); ((Object)val).name = "AttackSpeedWithCrit"; val._itemTierDef = null; val.deprecatedTier = (ItemTier)5; val.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); val.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); val.nameToken = "ITEM_ATTACKSPEED_WITH_CRIT_NAME"; val.pickupToken = "ITEM_ATTACKSPEED_WITH_CRIT_PICKUP"; val.descriptionToken = "ITEM_ATTACKSPEED_WITH_CRIT_DESC"; val.loreToken = "ITEM_ATTACKSPEED_WITH_CRIT_LORE"; ItemTag[] array = new ItemTag[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val.tags = (ItemTag[])(object)array; val.canRemove = false; val.hidden = true; ItemAttackSpeedWithCrit = val; ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])null); CustomItem val3 = new CustomItem(ItemAttackSpeedWithCrit, val2); ItemAPI.Add(val3); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("royal.RailgunnerCritChancePassive", "RailgunnerCritChancePassive", "1.0.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "royal.RailgunnerCritChancePassive"; public const string PluginAuthor = "royal"; public const string PluginName = "RailgunnerCritChancePassive"; public const string PluginVersion = "1.0.0"; private Sprite LoadSpriteFromDisk() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0076: 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) string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "AtomStabilizer.png"); if (!File.Exists(text)) { Log.Error("File not found at: " + text); return null; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } Log.Error("Failed to load texture from image data."); return null; } public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); CustomItems.Init(); GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerBody.prefab").WaitForCompletion(); LanguageAPI.Add("RAILGUNNER_PASSIVE_CRITCHANCE_NAME", "Atom Stabilizer"); LanguageAPI.Add("RAILGUNNER_PASSIVE_CRITCHANCE_DESCRIPTION", "Can gain <style=cIsDamage>Critical Strike Chance</style>. Gain <style=cIsDamage>0.5% attack speed</style> for every 1% <style=cIsDamage>Critical Strike Chance</style>."); PassiveItemSkillDef val2 = ScriptableObject.CreateInstance<PassiveItemSkillDef>(); val2.passiveItem = CustomItems.ItemAttackSpeedWithCrit; ((SkillDef)val2).icon = LoadSpriteFromDisk(); ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_PASSIVE_CRITCHANCE_DESCRIPTION"; ((SkillDef)val2).skillName = "RAILGUNNER_PASSIVE_CRITCHANCE_NAME"; ((SkillDef)val2).skillNameToken = "RAILGUNNER_PASSIVE_CRITCHANCE_NAME"; ContentAddition.AddSkillDef((SkillDef)(object)val2); LanguageAPI.Add("RAILGUNNER_PASSIVE_NONE_NAME", "No Passive"); LanguageAPI.Add("RAILGUNNER_PASSIVE_NONE_DESCRIPTION", "Can gain <style=cIsDamage>Critical Strike Chance</style>."); PassiveItemSkillDef val3 = ScriptableObject.CreateInstance<PassiveItemSkillDef>(); val3.passiveItem = null; ((SkillDef)val3).icon = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texGenericSkillIcons.png").WaitForCompletion(); ((SkillDef)val3).skillDescriptionToken = "RAILGUNNER_PASSIVE_NONE_DESCRIPTION"; ((SkillDef)val3).skillName = "RAILGUNNER_PASSIVE_NONE_NAME"; ((SkillDef)val3).skillNameToken = "RAILGUNNER_PASSIVE_NONE_NAME"; ContentAddition.AddSkillDef((SkillDef)(object)val3); GenericSkill[] componentsInChildren = val.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val4 in componentsInChildren) { if (((Object)val4._skillFamily).name.Contains("Passive")) { SkillFamily skillFamily = val4._skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 2); Variant[] variants = skillFamily.variants; int num = variants.Length - 2; Variant val5 = new Variant { skillDef = (SkillDef)(object)val2 }; ((Variant)(ref val5)).viewableNode = new Node(((SkillDef)val2).skillNameToken, false, (Node)null); variants[num] = val5; Variant[] variants2 = skillFamily.variants; int num2 = variants2.Length - 1; val5 = new Variant { skillDef = (SkillDef)(object)val3 }; ((Variant)(ref val5)).viewableNode = new Node(((SkillDef)val3).skillNameToken, false, (Node)null); variants2[num2] = val5; } } } } }