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 Change Style Of Existing Shield v1.1.0
ChangeShieldStyle.dll
Decompiled 2 years agousing 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("ChangeShieldStyle")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ChangeShieldStyle")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4f1a92ce-f667-4db7-a9f2-36a2bb7c28a1")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] namespace ChangeShieldStyle; [BepInPlugin("goldenrevolver.ChangeShieldStyle", "Change Style Of Existing Shield", "1.1.0")] public class ChangeShieldStylePlugin : BaseUnityPlugin { public const string GUID = "goldenrevolver.ChangeShieldStyle"; public const string NAME = "Change Style Of Existing Shield"; public const string VERSION = "1.1.0"; protected void Awake() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } [HarmonyPatch] internal static class Patches { [HarmonyPatch(typeof(CraftingStation), "UseItem")] [HarmonyPrefix] public static bool UpdateShieldStylePatch(CraftingStation __instance, Humanoid user, ItemData item, ref bool __result) { string prefabName = Utils.GetPrefabName(((Component)__instance).gameObject); if (prefabName != "piece_workbench" && prefabName != "forge") { return true; } return !TryUpdateShieldStyle(user, item, ref __result); } public static bool TryUpdateShieldStyle(Humanoid user, ItemData item, ref bool __result) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 if (!((Character)user).IsPlayer() || (Object)(object)user != (Object)(object)Player.m_localPlayer || !((Character)user).TakeInput()) { return false; } if ((int)item.m_shared.m_itemType != 5 && item.m_shared.m_name != "$item_cape_linen") { return false; } if (item.m_shared.m_icons == null || item.m_shared.m_icons.Length == 0) { return false; } if (item.m_variant < 0 || item.m_variant >= item.m_shared.m_icons.Length) { return false; } item.m_variant = (item.m_variant + 1) % item.m_shared.m_icons.Length; if (item.IsEquipable() && user.IsItemEquiped(item)) { user.UnequipItem(item, true); user.EquipItem(item, true); } __result = true; return true; } }