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 Atgeir Polearm Animation Fix v1.0.0
AtgeirPolearmAnimationFix.dll
Decompiled 2 years agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AtgeirPolearmAnimationFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AtgeirPolearmAnimationFix")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("065c8f74-7d03-4449-8aea-65aac0f35c20")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace AtgeirPolearmAnimationFix; [BepInPlugin("goldenrevolver.AtgeirPolearmAnimationFix", "Atgeir/Polearm Animation Fix", "1.0.0")] public class AtgeirPolearmAnimationFixPlugin : BaseUnityPlugin { public const string GUID = "goldenrevolver.AtgeirPolearmAnimationFix"; public const string NAME = "Atgeir/Polearm Animation Fix"; public const string VERSION = "1.0.0"; internal static AtgeirPolearmAnimationFixPlugin plugin; protected void Awake() { plugin = this; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } [HarmonyPatch] internal class AtgeirPatches { internal static bool IsAtgeirPolearm(SharedData shared) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 return shared != null && (int)shared.m_skillType == 4 && shared.m_attack.m_attackAnimation == "atgeir_attack"; } internal static bool IsHashForAtgeirPolearm(int hash) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); if (!Object.op_Implicit((Object)(object)itemPrefab)) { return false; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if (!Object.op_Implicit((Object)(object)component) || component.m_itemData == null) { return false; } SharedData shared = component.m_itemData.m_shared; return IsAtgeirPolearm(shared); } [HarmonyPatch(typeof(ZSyncAnimation), "RPC_SetTrigger")] [HarmonyPrefix] public static void RevertFlippedThrowInMultiplayer(ZSyncAnimation __instance, long sender, ref string name) { //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (name != "atgeir_attack0") { return; } Humanoid component = ((Component)__instance).GetComponent<Humanoid>(); if (Object.op_Implicit((Object)(object)component)) { GameObject rightItemInstance = component.m_visEquipment.m_rightItemInstance; if (!((Object)(object)rightItemInstance == (Object)null) && IsHashForAtgeirPolearm(component.m_visEquipment.m_currentRightItemHash)) { rightItemInstance.transform.localRotation = Quaternion.Euler(Vector3.zero); rightItemInstance.transform.localPosition = Vector3.zero; rightItemInstance.transform.localRotation = Quaternion.Euler(0f, -5f, 40f); ((MonoBehaviour)AtgeirPolearmAnimationFixPlugin.plugin).StartCoroutine(RevertAtgeirRotation(rightItemInstance.transform, __instance.m_animator.speed)); } } } internal static IEnumerator RevertAtgeirRotation(Transform atgeir, float animatorSpeeed) { float speedMult = 1f / animatorSpeeed; yield return (object)new WaitForSeconds(0.36f * speedMult); if (!((Object)(object)atgeir == (Object)null)) { ((Component)atgeir).transform.localRotation = Quaternion.Euler(Vector3.zero); } } }