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 RailgunnerExtendedRifle v1.0.0
RailgunnerExtendedRifle.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using EntityStates.Railgunner.Scope; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RailgunnerExtendedRifle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RailgunnerExtendedRifle")] [assembly: AssemblyTitle("RailgunnerExtendedRifle")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 RailgunnerExtendedRifle { [BepInPlugin("com.you.railgunner.extendedrifle", "RailgunnerExtendedRifle", "0.3.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.you.railgunner.extendedrifle").PatchAll(); } } [HarmonyPatch] internal static class AttachHelperPatch { private static MethodBase FindTarget() { return AccessTools.DeclaredMethod(typeof(CharacterModel), "Awake", (Type[])null, (Type[])null) ?? AccessTools.DeclaredMethod(typeof(CharacterModel), "Start", (Type[])null, (Type[])null); } private static bool Prepare() { MethodBase methodBase = FindTarget(); if (methodBase == null) { Plugin.Log.LogError((object)"CharacterModel declares neither Awake nor Start; helper will not be attached."); } else { Plugin.Log.LogInfo((object)("Patching CharacterModel." + methodBase.Name)); } return methodBase != null; } private static MethodBase TargetMethod() { return FindTarget(); } private static void Postfix(CharacterModel __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<ForceScopedPose>())) { ((Component)__instance).gameObject.AddComponent<ForceScopedPose>(); } } } public class ForceScopedPose : MonoBehaviour { private CharacterModel model; private Animator anim; private bool bodyConfirmed; private bool paramChecked; private int boolHash; private void Awake() { model = ((Component)this).GetComponent<CharacterModel>(); anim = ((Component)this).GetComponent<Animator>() ?? ((Component)this).GetComponentInChildren<Animator>(); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)model) || !Object.op_Implicit((Object)(object)anim)) { return; } if (!bodyConfirmed) { CharacterBody body = model.body; if (!Object.op_Implicit((Object)(object)body)) { return; } if (body.baseNameToken != "RAILGUNNER_BODY_NAME") { Object.Destroy((Object)(object)this); return; } bodyConfirmed = true; } string mecanimBoolName = BaseScopeState.mecanimBoolName; if (string.IsNullOrEmpty(mecanimBoolName)) { return; } if (!paramChecked) { paramChecked = true; boolHash = Animator.StringToHash(mecanimBoolName); Plugin.Log.LogInfo((object)("Scope mecanim bool = " + mecanimBoolName)); if (!anim.parameters.Any((AnimatorControllerParameter p) => p.nameHash == boolHash && (int)p.type == 4)) { Plugin.Log.LogWarning((object)("Animator has no bool param '" + mecanimBoolName + "'; disabling helper.")); ((Behaviour)this).enabled = false; return; } } anim.SetBool(boolHash, true); } } }