using System; using System.Collections.Generic; 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 BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Crest; 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("HooksHangMore")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("raddude")] [assembly: AssemblyProduct("HooksHangMore")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7fbc1d41-251b-4cf2-8ee9-13edaafcc6ee")] [assembly: AssemblyFileVersion("1.0.9.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] namespace HooksHangMore; [BepInPlugin("com.raddude82.hookshangmore", "HooksHangMore", "1.0.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class HHM_Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.raddude82.hookshangmore"; public const string PLUGIN_NAME = "HooksHangMore"; public const string PLUGIN_VERSION = "1.0.9"; public const string IDLE_FISHING_GUID = "com.isa_idlefishing.patch"; public const string COOKED_INFO_GUID = "pr0skynesis.cookedinfo"; private static ManualLogSource _logger; internal static HHM_Plugin Instance { get; private set; } internal static bool IdleFishingFound { get; private set; } internal static Dictionary AttachedItems { get; set; } internal static void LogDebug(string message) { _logger.LogDebug((object)message); } internal static void LogInfo(string message) { _logger.LogInfo((object)message); } internal static void LogWarning(string message) { _logger.LogWarning((object)message); } internal static void LogError(string message) { _logger.LogError((object)message); } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; _logger = ((BaseUnityPlugin)this).Logger; AttachedItems = new Dictionary(); foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { BepInPlugin metadata = pluginInfo.Value.Metadata; if (metadata.GUID.Equals("com.isa_idlefishing.patch")) { LogInfo("com.isa_idlefishing.patch found"); IdleFishingFound = true; } if (metadata.GUID.Equals("pr0skynesis.cookedinfo")) { LogInfo("pr0skynesis.cookedinfo found"); FishHangDryPatches.GetNonBurnableDescription(); } } Configs.InitializeConfigs(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.raddude82.hookshangmore"); } } internal class BucketPatches { [HarmonyPatch(typeof(Mug), "Update")] private class MugPatches { public static void Postfix(Mug __instance) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (GameState.playing && ((Object)__instance).name.Contains("bucket")) { HolderAttachable component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsAttached) { __instance.bucketHandle.localRotation = Quaternion.Euler(Vector3.zero); } } } } } internal class FishHangDryPatches { private delegate void NonBurnableDescDelegate(ref string description, float amount); [HarmonyPatch(typeof(FoodState))] private class FoodStatePatches { [HarmonyPostfix] [HarmonyPatch("Update")] public static void HangDry(FoodState __instance, ShipItemFood ___food) { HolderAttachable component = ((Component)__instance).GetComponent(); if (GameState.playing && !__instance.inWater && ((ShipItem)___food).sold && !((Object)(object)component == (Object)null) && component.IsAttached) { float num = Time.deltaTime * Sun.sun.timescale / (30f * ___food.GetEnergyPerBite()); num *= Mathf.Lerp(1f, 10f, __instance.salted); num *= 1.5f; if (((ShipItem)___food).name == "eel") { num *= 1.5f; } if (((Component)__instance).gameObject.layer == 26) { num = 0f; } __instance.dried += num; } } [HarmonyPrefix] [HarmonyPatch("UpdateLookText")] public static bool UpdateDescription(FoodState __instance, ShipItemFood ___food) { if (__instance.spoiled > 0.9f || ((ShipItem)___food).amount >= 1.5f || (__instance.salted >= 0.99f && __instance.smoked >= 0.99f) || __instance.smoked >= 0.99f) { return true; } if (__instance.salted >= 0.99f && __instance.dried >= 0.99f) { ((GoPointerButton)___food).description = "salted dried " + ((ShipItem)___food).name; return false; } return true; } [HarmonyBefore(new string[] { "pr0skynesis.cookedinfo" })] [HarmonyPostfix] [HarmonyPatch("UpdateLookText")] public static void UpdateCookedInfo(FoodState __instance, ShipItemFood ___food) { if (_nonBurnableDescription != null) { HolderAttachable component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsAttached) { string description = ((GoPointerButton)___food).description; _nonBurnableDescription(ref description, __instance.dried / 0.99f); ((GoPointerButton)___food).description = description; } } } } private static NonBurnableDescDelegate _nonBurnableDescription; internal static void GetNonBurnableDescription() { Type type = AccessTools.TypeByName("DescriptionBuilder"); MethodInfo methodInfo = AccessTools.Method(type, "NonBurnableDescription", (Type[])null, (Type[])null); if (!(methodInfo == null)) { _nonBurnableDescription = (NonBurnableDescDelegate)Delegate.CreateDelegate(typeof(NonBurnableDescDelegate), methodInfo); } } } internal class FishingRodPatches { [HarmonyPatch(typeof(FishingRodFish))] private class FishingRodFishPatches { [HarmonyBefore(new string[] { "com.isa_idlefishing.patch" })] [HarmonyPostfix] [HarmonyPatch("Update")] public static void Postfix(FishingRodFish __instance, ShipItemFishingRod ___rod, SimpleFloatingObject ___floater, ConfigurableJoint ___bobberJoint, ref float ___fishTimer) { //IL_0032: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.currentFish != (Object)null || ((ShipItem)___rod).health <= 0f || !HHM_Plugin.AttachedItems.ContainsKey((ShipItem)(object)___rod) || !((FloatingObjectBase)___floater).InWater) { return; } SoftJointLimit linearLimit = ___bobberJoint.linearLimit; if (((SoftJointLimit)(ref linearLimit)).limit <= 1f || ((Component)__instance).gameObject.layer == 16) { return; } float num = ((!(GameState.distanceToLand < 500f)) ? (HHM_Plugin.IdleFishingFound ? 10f : 5.13f) : (HHM_Plugin.IdleFishingFound ? 20f : 6.67f)); ___fishTimer -= Time.deltaTime; float num2 = Vector3.Distance(((Component)__instance).transform.position, ((Component)___rod).transform.position); float num3 = Mathf.InverseLerp(3f, 20f, num2) * 2.5f + 0.5f; if (___fishTimer <= 0f) { ___fishTimer = 1f; num3 /= num; if (Random.Range(0f, 100f) < num3) { __instance.CatchFish(); } } } } } internal class ItemHolderPatches { [HarmonyPatch(typeof(ShipItem))] private class ShipItemPatches { [HarmonyBefore(new string[] { "com.nandbrew.nandfixes" })] [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void OnLoadShipItemHolder(ShipItem __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (__instance is ShipItemLampHook) { ((Component)__instance).gameObject.AddComponent(); } ShipItemBroom val = (ShipItemBroom)(object)((__instance is ShipItemBroom) ? __instance : null); if (val != null) { HolderAttachable holderAttachable = ((Component)val).gameObject.AddComponent(); holderAttachable.PositionOffset = BROOM_POSITION_OFFSET; } if (__instance is ShipItemHammer) { HolderAttachable holderAttachable2 = ((Component)__instance).gameObject.AddComponent(); holderAttachable2.PositionOffset = HAMMER_POSITION_OFFSET; holderAttachable2.RotationOffset = HAMMER_ROTATION_OFFSET; } ShipItemOar val2 = (ShipItemOar)(object)((__instance is ShipItemOar) ? __instance : null); if (val2 != null) { HolderAttachable holderAttachable3 = ((Component)val2).gameObject.AddComponent(); holderAttachable3.PositionOffset = OAR_POSITION_OFFSET; holderAttachable3.RotationOffset = OAR_ROTATION_OFFSET; } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(GoPointerButton lookedAtButton, ShipItem __instance, ref bool __result) { if (!__instance.sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("OnPickup")] public static void OnShipItemPickup(ShipItem __instance) { if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && HHM_Plugin.AttachedItems.ContainsKey(__instance)) { ShipItemHolder shipItemHolder = HHM_Plugin.AttachedItems[__instance]; if ((Object)(object)shipItemHolder != (Object)null && (Object)(object)shipItemHolder.AttachedItem == (Object)(object)__instance) { shipItemHolder.DetachItem(); } } } } [HarmonyPatch(typeof(ShipItemFishingRod), "OnLoad")] private class ShipItemFishingRodPatches { public static void Postfix(ShipItemFishingRod __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = ROD_POSITION_OFFSET; holderAttachable.RotationOffset = ROD_ROTATION_OFFSET; } } [HarmonyPatch(typeof(ShipItemChipLog), "OnLoad")] private class ShipItemChipLogPatches { public static void Postfix(ShipItemChipLog __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = CHIP_LOG_POSITION_OFFSET; } } [HarmonyPatch(typeof(ShipItemQuadrant), "OnLoad")] private class ShipItemQuadrantPatches { public static void Postfix(ShipItemQuadrant __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = QUADRANT_POSITION_OFFSET; holderAttachable.RotationOffset = QUADRANT_ROTATION_OFFSET; } } [HarmonyPatch(typeof(ShipItemFood))] private class ShipItemFoodPatches { [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void AddComponent(ShipItemFood __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (FishPositionOffsets.TryGetValue(((ShipItem)__instance).name, out var value)) { HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = value; holderAttachable.RotationOffset = FISH_ROTATION_OFFSET; } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(GoPointerButton lookedAtButton, ShipItemFood __instance, ref bool __result) { if (!((ShipItem)__instance).sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(ShipItemKnife))] private class ShipItemKnifePatches { [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void AddComponent(ShipItemKnife __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = KNIFE_POSITION_OFFSET; holderAttachable.RotationOffset = KNIFE_ROTATION_OFFSET; if (Configs.flipKnifeRotation.Value) { holderAttachable.PositionOffset = new Vector3(0f - holderAttachable.PositionOffset.x, 0f - holderAttachable.PositionOffset.y, holderAttachable.PositionOffset.z); holderAttachable.RotationOffset = new Vector3(holderAttachable.RotationOffset.x - 180f, holderAttachable.RotationOffset.y, holderAttachable.RotationOffset.z); } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(ShipItemKnife __instance, GoPointerButton lookedAtButton, ref bool __result) { if (!((ShipItem)__instance).sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(ShipItemKettle))] private class ShipItemKettlePatches { [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void AddComponent(ShipItemKettle __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (KettlePositionOffsets.TryGetValue(((Object)((Component)__instance).transform).name, out var value)) { HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = value; holderAttachable.RotationOffset = KETTLE_ROTATION_OFFSET; } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(ShipItemKettle __instance, GoPointerButton lookedAtButton, ref bool __result) { if (!((ShipItem)__instance).sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(ShipItemBottle))] private class ShipItemBottlePatches { [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void AddComponent(ShipItemBottle __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Vector3 value; if (((ShipItem)__instance).name.Contains("bucket")) { HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = BUCKET_POSITION_OFFSET; } else if (MugPositionOffsets.TryGetValue(((Object)((Component)__instance).transform).name, out value)) { HolderAttachable holderAttachable2 = ((Component)__instance).gameObject.AddComponent(); holderAttachable2.PositionOffset = value; holderAttachable2.RotationOffset = (MugRotationOffsets.TryGetValue(((Object)((Component)__instance).transform).name, out var value2) ? value2 : Vector3.zero); } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(ShipItemBottle __instance, GoPointerButton lookedAtButton, ref bool __result) { if ((!((ShipItem)__instance).name.Contains("bucket") && !((ShipItem)__instance).name.Contains("mug")) || !((ShipItem)__instance).sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("OnItemClick")] public static bool OnItemClick(ShipItemSoup __instance, PickupableItem heldItem, ref bool __result) { if ((!((ShipItem)__instance).name.Contains("bucket") && !((ShipItem)__instance).name.Contains("mug")) || !((ShipItem)__instance).sold) { return true; } HolderAttachable component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsAttached && Object.op_Implicit((Object)(object)((Component)heldItem).GetComponent())) { NotificationUi.instance.ShowNotification("Cannot fill\nwhile it is hanging"); __result = false; return false; } return true; } } [HarmonyPatch(typeof(ShipItemSoup))] private class ShipItemSoupPatches { [HarmonyPostfix] [HarmonyPatch("OnLoad")] public static void AddComponent(ShipItemSoup __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (PotPositionOffsets.TryGetValue(((Object)((Component)__instance).transform).name, out var value)) { HolderAttachable holderAttachable = ((Component)__instance).gameObject.AddComponent(); holderAttachable.PositionOffset = value; holderAttachable.RotationOffset = POT_ROTATION_OFFSET; } } [HarmonyPrefix] [HarmonyPatch("AllowOnItemClick")] public static bool AllowOnItemClick(ShipItemSoup __instance, GoPointerButton lookedAtButton, ref bool __result) { if (!((ShipItem)__instance).sold) { return true; } if ((Object)(object)((Component)__instance).GetComponent() != (Object)null && (Object)(object)((Component)lookedAtButton).GetComponent() != (Object)null && !((Component)lookedAtButton).GetComponent().IsOccupied) { __result = true; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("OnItemClick")] public static bool OnItemClick(ShipItemSoup __instance, PickupableItem heldItem, ref bool __result) { if (!((ShipItem)__instance).sold) { return true; } HolderAttachable component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsAttached && Object.op_Implicit((Object)(object)((Component)heldItem).GetComponent())) { NotificationUi.instance.ShowNotification("Cannot fill\nwhile it is hanging"); __result = false; return false; } return true; } } [HarmonyPatch(typeof(ShipItemLampHook))] private class ShipItemLampHookPatches { [HarmonyPostfix] [HarmonyPatch("OnPickup")] public static void OnPickup(ShipItemLampHook __instance) { ShipItemHolder component = ((Component)__instance).GetComponent(); if (component.IsOccupied) { component.DetachItem(); } } [HarmonyPostfix] [HarmonyPatch("OnEnterInventory")] public static void OnEnterInventory(ShipItemLampHook __instance) { ShipItemHolder component = ((Component)__instance).GetComponent(); if (component.IsOccupied) { component.DetachItem(); } } [HarmonyPrefix] [HarmonyPatch("OnItemClick")] public static bool OnItemClick(PickupableItem heldItem, ShipItemLampHook __instance, bool ___occupied, ref bool __result) { ShipItemHolder component = ((Component)__instance).GetComponent(); if (component.IsOccupied || ___occupied) { __result = false; return false; } ShipItem component2 = ((Component)heldItem).GetComponent(); ShipItemSoup val = (ShipItemSoup)(object)((component2 is ShipItemSoup) ? component2 : null); if (val == null || !(val.currentWater > 0f)) { ShipItemBottle val2 = (ShipItemBottle)(object)((component2 is ShipItemBottle) ? component2 : null); if (val2 == null || !(((ShipItem)val2).health > 0f)) { if ((Object)(object)((Component)component2).GetComponent() != (Object)null && component2.sold) { component.AttachItem(component2); ((Component)component2).GetComponent().ShipItemHolder = component; __result = true; return false; } return true; } } NotificationUi.instance.ShowNotification("Cannot hang\nit is not empty"); __result = false; return false; } } [HarmonyPatch(typeof(LookUI))] private class LookUIPatches { [HarmonyPostfix] [HarmonyPatch("ShowLookText")] public static void ShowLookText(GoPointerButton button, TextMesh ___controlsText, GoPointer ___pointer, TextMesh ___textLicon, TextMesh ___textRIcon, ref bool ___showingIcon) { ShipItemLampHook component = ((Component)button).GetComponent(); ShipItemHolder shipItemHolder = (((Object)(object)component != (Object)null) ? ((Component)component).GetComponent() : null); if ((Object)(object)component != (Object)null && Object.op_Implicit((Object)(object)___pointer.GetHeldItem()) && (Object)(object)shipItemHolder != (Object)null && shipItemHolder.IsOccupied) { ((Component)___textLicon).gameObject.SetActive(false); ___showingIcon = false; ___controlsText.text = ""; if (Object.op_Implicit((Object)(object)((Component)___pointer.GetHeldItem()).GetComponent()) && ShipItemHammer.CanNail(((Component)button).GetComponent())) { ___showingIcon = true; if (((Component)button).GetComponent().nailed) { ((Component)___textRIcon).gameObject.SetActive(true); ___controlsText.text = "\nunlock"; } else { ((Component)___textRIcon).gameObject.SetActive(true); ___controlsText.text = "\nlock"; } } } else { if (!((Object)(object)component != (Object)null) || !Object.op_Implicit((Object)(object)___pointer.GetHeldItem()) || !((Object)(object)((Component)___pointer.GetHeldItem()).GetComponent() != (Object)null) || shipItemHolder.IsOccupied) { return; } ((Component)___textLicon).gameObject.SetActive(true); ___showingIcon = true; PickupableItem heldItem = ___pointer.GetHeldItem(); ___controlsText.text = "attach " + ((heldItem == null) ? null : ((Component)heldItem).GetComponent()?.name) + "\n"; if (Object.op_Implicit((Object)(object)((Component)___pointer.GetHeldItem()).GetComponent()) && ShipItemHammer.CanNail(((Component)button).GetComponent())) { if (((Component)button).GetComponent().nailed) { ((Component)___textRIcon).gameObject.SetActive(true); PickupableItem heldItem2 = ___pointer.GetHeldItem(); ___controlsText.text = "attach " + ((heldItem2 == null) ? null : ((Component)heldItem2).GetComponent()?.name) + "\nunlock"; } else { ((Component)___textRIcon).gameObject.SetActive(true); PickupableItem heldItem3 = ___pointer.GetHeldItem(); ___controlsText.text = "attach " + ((heldItem3 == null) ? null : ((Component)heldItem3).GetComponent()?.name) + "\nlock"; } } } } } private static readonly Vector3 ROD_POSITION_OFFSET = new Vector3(0.309f, 1.1f, -0.38f); private static readonly Vector3 ROD_ROTATION_OFFSET = new Vector3(-40f, 180f, 0f); private static readonly Vector3 BROOM_POSITION_OFFSET = new Vector3(0f, -0.25f, -0.11f); private static readonly Vector3 CHIP_LOG_POSITION_OFFSET = new Vector3(0.002f, 0.25f, -0.12f); private static readonly Vector3 BUCKET_POSITION_OFFSET = new Vector3(0f, -0.23f, -0.125f); private static readonly Vector3 OAR_POSITION_OFFSET = new Vector3(0f, -0.65f, -0.11f); private static readonly Vector3 OAR_ROTATION_OFFSET = new Vector3(180f, 0f, 0f); private static readonly Vector3 QUADRANT_POSITION_OFFSET = new Vector3(-0.0155f, 0.164f, -0.115f); private static readonly Vector3 QUADRANT_ROTATION_OFFSET = new Vector3(90f, -90f, 0f); private static readonly Vector3 KNIFE_POSITION_OFFSET = new Vector3(0.05f, -0.115f, -0.182f); private static readonly Vector3 KNIFE_ROTATION_OFFSET = new Vector3(270f, 270f, 0f); private static readonly Vector3 HAMMER_POSITION_OFFSET = new Vector3(0f, -0.3f, -0.22f); private static readonly Vector3 HAMMER_ROTATION_OFFSET = new Vector3(270f, 270f, 0f); private static readonly Dictionary KettlePositionOffsets = new Dictionary { { "382 kettle A(Clone)", new Vector3(0f, -0.28f, -0.165f) }, { "383 kettle E(Clone)", new Vector3(0f, -0.19f, -0.165f) }, { "384 kettle M(Clone)", new Vector3(0f, -0.253f, -0.165f) } }; private static readonly Vector3 KETTLE_ROTATION_OFFSET = new Vector3(10f, 0f, 0f); private static readonly Dictionary PotPositionOffsets = new Dictionary { { "156 pot(Clone)", new Vector3(0f, -0.175f, -0.245f) }, { "157 pot big(Clone)", new Vector3(0f, -0.205f, -0.29f) } }; private static readonly Vector3 POT_ROTATION_OFFSET = new Vector3(0f, 90f, -36f); private static readonly Dictionary MugPositionOffsets = new Dictionary { { "102 mug metal(Clone)", new Vector3(0.035f, -0.115f, -0.185f) }, { "102 mug metal", new Vector3(0.035f, -0.115f, -0.185f) }, { "103 mug metal gold(Clone)", new Vector3(0.035f, -0.115f, -0.185f) }, { "100 mug wood(Clone)", new Vector3(-0.07f, -0.075f, -0.155f) }, { "100 mug wood", new Vector3(-0.07f, -0.075f, -0.155f) } }; private static readonly Dictionary MugRotationOffsets = new Dictionary { { "102 mug metal(Clone)", new Vector3(0f, 50f, -16f) }, { "102 mug metal", new Vector3(0f, 50f, -16f) }, { "103 mug metal gold(Clone)", new Vector3(0f, 50f, -16f) }, { "100 mug wood(Clone)", new Vector3(15f, 0f, 270f) }, { "100 mug wood", new Vector3(15f, 0f, 270f) } }; private static readonly Dictionary FishPositionOffsets = new Dictionary { { "templefish", new Vector3(-0.035f, -0.14f, -0.13f) }, { "sunspot fish", new Vector3(-0.05f, -0.21f, -0.13f) }, { "tuna", new Vector3(0f, -0.27f, -0.13f) }, { "salmon", new Vector3(-0.035f, -0.3f, -0.13f) }, { "eel", new Vector3(-0.006f, -0.65f, -0.12f) }, { "blue shimmertail", new Vector3(-0.05f, -0.27f, -0.13f) }, { "trout", new Vector3(-0.04f, -0.28f, -0.13f) }, { "north fish", new Vector3(-0.03f, -0.2f, -0.13f) }, { "blackfin hunter", new Vector3(-0.035f, -0.245f, -0.13f) }, { "gold albacore", new Vector3(0f, -0.27f, -0.13f) }, { "swamp snapper", new Vector3(-0.035f, -0.265f, -0.13f) }, { "blue bubbler", new Vector3(-0.045f, -0.19f, -0.13f) }, { "fire fish", new Vector3(-0.065f, -0.2f, -0.13f) } }; private static readonly Vector3 FISH_ROTATION_OFFSET = new Vector3(0f, 90f, 270f); } internal class QuadrantPatches { [HarmonyPatch(typeof(ShipItemQuadrant), "ExtraLateUpdate")] private class ShipItemQuadrantPatches { public static void Postfix(ShipItemQuadrant __instance) { if (GameState.playing) { HolderAttachable component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsAttached) { __instance.lockX = false; } else { __instance.lockX = true; } } } } } public class HolderAttachable : MonoBehaviour { private ShipItem _shipItem; private bool _disallowHangingOnTrigger; private float _framesAfterAwake; internal ShipItemHolder ShipItemHolder { private get; set; } public Vector3 PositionOffset { get; set; } public Vector3 RotationOffset { get; set; } public bool IsAttached => (Object)(object)ShipItemHolder != (Object)null; private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) _shipItem = ((Component)this).GetComponent(); ShipItemHolder = null; _disallowHangingOnTrigger = false; _framesAfterAwake = 0f; PositionOffset = Vector3.zero; RotationOffset = Vector3.zero; } private void FixedUpdate() { if (_framesAfterAwake < 3f) { _framesAfterAwake += 1f; } } public void LoadInInventory() { _disallowHangingOnTrigger = true; } public void OnTriggerEnter(Collider other) { ShipItemHolder component = ((Component)other).GetComponent(); if (_framesAfterAwake < 3f && _shipItem.sold && !Object.op_Implicit((Object)(object)((PickupableItem)_shipItem).held) && _shipItem.GetCurrentInventorySlot() == -1 && !_disallowHangingOnTrigger && ((Component)other).CompareTag("Hook") && (Object)(object)component != (Object)null && !component.IsOccupied) { component.AttachItem(_shipItem); ShipItemHolder = component; } } public void DetachHolder() { if ((Object)(object)ShipItemHolder != (Object)null) { ShipItemHolder = null; } } public void OnDestroy() { ShipItemHolder?.DetachItem(); _disallowHangingOnTrigger = false; } } public class ShipItemHolder : MonoBehaviour { private Transform _itemRigidBody; private ShipItem _attachedItem; public bool IsOccupied => (Object)(object)_attachedItem != (Object)null; public ShipItem AttachedItem => _attachedItem; private void Awake() { _itemRigidBody = ((Component)((ShipItem)((Component)((Component)this).transform).GetComponent()).itemRigidbodyC).transform; } internal void AttachItem(ShipItem item) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0077: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { HHM_Plugin.LogError("ShipItem is null, cannot hang item"); return; } HolderAttachable component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null) { HHM_Plugin.LogError("HolderAttachable is null, cannot hang item"); return; } Vector3 positionOffset = component.PositionOffset; Quaternion val = Quaternion.Euler(component.RotationOffset); HHM_Plugin.AttachedItems.Add(item, this); _attachedItem = item; Vector3 position = _itemRigidBody.TransformPoint(positionOffset); ((Component)item.itemRigidbodyC).transform.position = position; Quaternion rotation = _itemRigidBody.rotation * val; ((Component)item.itemRigidbodyC).transform.rotation = rotation; item.itemRigidbodyC.attached = true; HHM_Plugin.LogDebug($"Item localpos: {((Component)item.itemRigidbodyC).transform.localPosition}, Item parent: {((Component)item.itemRigidbodyC).transform.parent}"); } internal void DetachItem() { if (!((Object)(object)_attachedItem == (Object)null)) { _attachedItem.itemRigidbodyC.attached = false; HHM_Plugin.AttachedItems.Remove(_attachedItem); ((Component)_attachedItem).GetComponent().DetachHolder(); _attachedItem = null; } } private void OnDestroy() { if (IsOccupied) { DetachItem(); } } } internal class Configs { internal static ConfigEntry flipKnifeRotation; internal static void InitializeConfigs() { ConfigFile config = ((BaseUnityPlugin)HHM_Plugin.Instance).Config; flipKnifeRotation = config.Bind("Settings", "Knife hangs down", false, "Knife hangs down in the lamp hook instead of pointing up."); } }