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 Sword Heavy Slash v1.0.0
SwordHeavy.dll
Decompiled a week agousing System.Reflection; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: AssemblyVersion("0.4.0.0")] namespace SwordHeavy; [BepInPlugin("fai.swordheavy", "Sword Heavy Slash", "1.0.0")] public class SwordHeavyPlugin : BaseUnityPlugin { private static float s_restoreAt; private static bool s_shieldHidden; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("fai.swordheavy").PatchAll(); } private void Update() { if (s_shieldHidden && !(Time.unscaledTime < s_restoreAt)) { RestoreShield(); } } internal static void HideShield() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(((object)Player.m_localPlayer).GetType(), "m_leftItem"); if ((object)fieldInfo == null) { return; } ItemData val = (ItemData)fieldInfo.GetValue(Player.m_localPlayer); if ((int)val == 0) { return; } SharedData shared = val.m_shared; if (shared == null || (int)shared.m_itemType != 5) { return; } FieldInfo fieldInfo2 = AccessTools.Field(((object)Player.m_localPlayer).GetType(), "m_visEquipment"); if ((object)fieldInfo2 == null) { return; } VisEquipment val2 = (VisEquipment)fieldInfo2.GetValue(Player.m_localPlayer); if (val2 == null) { return; } FieldInfo fieldInfo3 = AccessTools.Field(((object)val2).GetType(), "m_leftItemInstance"); if ((object)fieldInfo3 != null) { GameObject val3 = (GameObject)fieldInfo3.GetValue(val2); if (val3 != null) { val3.SetActive(false); s_restoreAt = Time.unscaledTime + 1.65f; s_shieldHidden = true; } } } private static void RestoreShield() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (Player.m_localPlayer != null) { VisEquipment val = (VisEquipment)AccessTools.Field(((object)Player.m_localPlayer).GetType(), "m_visEquipment").GetValue(Player.m_localPlayer); if (val != null) { GameObject val2 = (GameObject)AccessTools.Field(((object)val).GetType(), "m_leftItemInstance").GetValue(val); if (val2 != null) { val2.SetActive(true); } } } s_shieldHidden = false; } } [HarmonyPatch(typeof(ZSyncAnimation), "SetTrigger")] internal static class SwordAnimationPatch { private static bool Prefix(object __instance, ref string __0) { if (__0 == "sword_secondary") { __0 = "greatsword2"; SwordHeavyPlugin.HideShield(); } else if (__0 == "swing_longsword0") { __0 = "swing_longsword0"; } else if (__0 == "swing_longsword1") { __0 = "swing_longsword1"; } else if (__0 == "swing_longsword2") { __0 = "dualaxes0"; } return true; } }