Please disclose if your mod was created primarily 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 Simple Sailing v2.0.0
SimpleSailing/SimpleSailing.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; 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("SimpleSailing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SimpleSailing")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("08801a33-6395-44e1-a854-28476390a72d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace SimpleSailing; [BepInPlugin("nb.wackjob.SimpleSailing", "Simple Sailing", "2.0.0")] public class SimpleSailing : BaseUnityPlugin { public static Harmony harmony = new Harmony("nb.wackjob.SimpleSailing"); private void Awake() { harmony.PatchAll(); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } [HarmonyPatch(typeof(Player), "Update")] public static class PlayerUpdatePatch { private static void Postfix(Player __instance) { if ((Object)(object)Player.m_localPlayer != (Object)null) { ApplyModerBuff(__instance); } } private static void ApplyModerBuff(Player player) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown SEMan sEMan = ((Character)player).GetSEMan(); int stableHashCode = StringExtensionMethods.GetStableHashCode("GP_Moder"); if (sEMan != null && !sEMan.HaveStatusEffect(stableHashCode)) { StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(stableHashCode); statusEffect.m_ttl = 0f; statusEffect.m_startMessage = ""; statusEffect.m_startEffects = new EffectList(); sEMan.AddStatusEffect(statusEffect, false, 0, 0f); } } } [HarmonyPatch(typeof(ItemStand), "IsGuardianPowerActive")] public static class ItemStandIsGuardianPowerActivePatch { private static void Postfix(ItemStand __instance, ref bool __result, Humanoid user) { if (((Object)__instance.m_guardianPower).name == "GP_Moder") { __result = true; } } } public static class PlayerExtensions { public static SEMan GetSEMan(this Player player) { return ((Component)player).GetComponent<SEMan>(); } public static bool HaveStatusEffect(this SEMan seman, int effectHash) { foreach (StatusEffect statusEffect in seman.m_statusEffects) { if (statusEffect.m_nameHash == effectHash) { return true; } } return false; } public static void AddStatusEffect(this SEMan seman, StatusEffect effect) { seman.AddStatusEffect(effect, false, 0, 0f); } }