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 BaitMeBruh v1.0.1
plugins/BaitMeBruh.dll
Decompiled 16 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Net.Http; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BaitMeBruh.Components; using BaitMeBruh.Configuration; using BaitMeBruh.Content; using BaitMeBruh.Content.Factories; using BaitMeBruh.Managers; using BaitMeBruh.UI; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; using Valheim.UI; using Vapok.Common.Abstractions; using Vapok.Common.Managers; using Vapok.Common.Managers.Configuration; using Vapok.Common.Managers.Creature; using Vapok.Common.Managers.LocalizationManager; using Vapok.Common.Managers.Location; using Vapok.Common.Managers.PieceManager; using Vapok.Common.Managers.Skill; using Vapok.Common.Managers.Splash; using Vapok.Common.Managers.StatusEffects; using Vapok.Common.Managers.Telemetry; using Vapok.Common.Shared; using Vapok.Common.Tools; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BaitMeBruh")] [assembly: AssemblyDescription("An entire overhaul of the vanilla fishing system featuring dynamic line tension, primitive rod progression, biome bait crafting, passive harvesting nets, seated seafaring angling, and culinary expansions.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Vapok Gaming")] [assembly: AssemblyProduct("BaitMeBruh")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6E2CB9DD-A201-43AF-B654-61D4BBEDE2C9")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BaitMeBruh { [BepInPlugin("vapok.mods.BaitMeBruh", "BaitMeBruh!", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BaitMeBruh : BaseUnityPlugin, IPluginInfo { public class Waiting { public event EventHandler StatusChanged; public void ValheimIsAwake(bool awakeFlag) { if (awakeFlag) { this.StatusChanged?.Invoke(this, EventArgs.Empty); } } } private const string _pluginId = "vapok.mods.BaitMeBruh"; private const string _displayName = "BaitMeBruh!"; private const string _version = "1.0.1"; public static bool ValheimAwake; public static Waiting Waiter; private static BaitMeBruh _instance; private static ConfigSyncBase _config; private static ILogIt _log; private Harmony _harmony; public static ILogIt Log => _log; public string PluginId => "vapok.mods.BaitMeBruh"; public string DisplayName => "BaitMeBruh!"; public string Version => "1.0.1"; public BaseUnityPlugin Instance => (BaseUnityPlugin)(object)_instance; [UsedImplicitly] private void Awake() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown _instance = this; Waiter = new Waiting(); CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); LogManager.Init(PluginId, out _log); Initializer.LoadManagers(localization); _config = new ConfigRegistry(_instance); ModSplashManager.Register(new ModSplashDossier(_instance) { Tagline = "An immersive fishing overhaul featuring dynamic line tension, rod progression, coastal traps, and deep-sea angling.", ShowOnStartup = ConfigSyncBase.ShowSplashOnStartup }); RodManager.Initialize(); NetKitManager.Initialize(); TrapPieceManager.Initialize(); new BaitFactory(_log, _config).CreateAssets(); new FoodFactory(_log, _config).CreateAssets(); Localizer.Waiter.StatusChanged += InitializeModule; _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); _harmony.PatchAll(Assembly.GetExecutingAssembly()); if (GUIManager.IsHeadless()) { InitializeModule(this, EventArgs.Empty); } } private void OnDestroy() { _instance = null; } public void InitializeModule(object sender, EventArgs args) { if (!ValheimAwake) { ConfigRegistry.Waiter.ConfigurationComplete(configDone: true); ValheimAwake = true; } } } } namespace BaitMeBruh.UI { public class FishingTensionHud : MonoBehaviour { private const float GaugeWidth = 240f; private const float BoxHeight = 22f; private const float Padding = 2.5f; private const float DefaultHorizontalOffset = -300f; private const float DefaultVerticalOffset = -250f; private const float FadeSpeed = 6f; private static readonly Color BackgroundColor = new Color(0.04f, 0.05f, 0.07f, 0.9f); private static readonly Color TrackColor = new Color(0.1f, 0.13f, 0.17f, 0.65f); private static readonly Color SafeTensionColor = new Color(0.29f, 0.87f, 0.5f, 1f); private static readonly Color WarningTensionColor = new Color(0.98f, 0.8f, 0.08f, 1f); private static readonly Color CriticalTensionColor = new Color(0.94f, 0.27f, 0.27f, 1f); private static readonly FieldRef<FishingFloat, Fish> _nibblerRef = AccessTools.FieldRefAccess<FishingFloat, Fish>("m_nibbler"); private static readonly FieldRef<FishingFloat, float> _lineLengthRef = AccessTools.FieldRefAccess<FishingFloat, float>("m_lineLength"); private RectTransform _rootTransform; private CanvasGroup _canvasGroup; private RectTransform _fillTransform; private Image _fillImage; private TextMeshProUGUI _gaugeCenterText; private CanvasGroup _promptCanvasGroup; private TextMeshProUGUI _promptText; private RectTransform _baitTransform; private CanvasGroup _baitCanvasGroup; private Image _baitIcon; private TextMeshProUGUI _baitText; private float _targetAlpha; private float _promptTargetAlpha; private float _baitTargetAlpha; private float _maxWidth; private float _biteAlertTimer; private float _hookedAlertTimer; private float _recentCastTimer; public static FishingTensionHud Instance { get; private set; } public bool IsBiteAlertActive => _biteAlertTimer > 0f; public bool IsHookedAlertActive => _hookedAlertTimer > 0f; public void OnBiteAlert() { _biteAlertTimer = 1.25f; } public void OnHookedAlert() { _hookedAlertTimer = 1f; } public static void EnsureInitialized(Hud hud) { //IL_0047: 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) if ((Object)(object)Instance != (Object)null || (Object)(object)hud == (Object)null || (Object)(object)hud.m_crosshair == (Object)null) { return; } try { Transform parent = ((Component)hud.m_crosshair).transform.parent; if (!((Object)(object)parent == (Object)null)) { GameObject val = new GameObject("FishingTensionGauge"); val.transform.SetParent(parent, false); Instance = val.AddComponent<FishingTensionHud>(); Instance.BuildUi(hud); } } catch (Exception ex) { BaitMeBruh.Log.Error("[FishingTensionHud] Failed to initialize gauge: " + ex.Message); } } private void BuildUi(Hud hud) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Expected O, but got Unknown //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Expected O, but got Unknown //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Expected O, but got Unknown //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Unknown result type (might be due to invalid IL or missing references) _rootTransform = ((Component)this).gameObject.GetComponent<RectTransform>(); if ((Object)(object)_rootTransform == (Object)null) { _rootTransform = ((Component)this).gameObject.AddComponent<RectTransform>(); } _rootTransform.anchorMin = new Vector2(0.5f, 0.5f); _rootTransform.anchorMax = new Vector2(0.5f, 0.5f); _rootTransform.pivot = new Vector2(0.5f, 0.5f); _rootTransform.sizeDelta = new Vector2(240f, 44f); UpdatePosition(); TMP_FontAsset val = null; if ((Object)(object)hud != (Object)null && (Object)(object)hud.m_hoverName != (Object)null && (Object)(object)((TMP_Text)hud.m_hoverName).font != (Object)null) { val = ((TMP_Text)hud.m_hoverName).font; } else if ((Object)(object)hud != (Object)null && (Object)(object)hud.m_actionName != (Object)null && (Object)(object)hud.m_actionName.font != (Object)null) { val = hud.m_actionName.font; } GameObject val2 = new GameObject("BaitContainer"); val2.transform.SetParent(((Component)this).transform, false); _baitTransform = val2.AddComponent<RectTransform>(); _baitTransform.anchorMin = new Vector2(0.5f, 0.5f); _baitTransform.anchorMax = new Vector2(0.5f, 0.5f); _baitTransform.pivot = new Vector2(0.5f, 0.5f); _baitTransform.anchoredPosition = new Vector2(0f, 11f); _baitTransform.sizeDelta = new Vector2(240f, 22f); _baitCanvasGroup = val2.AddComponent<CanvasGroup>(); _baitCanvasGroup.alpha = 0f; _baitCanvasGroup.blocksRaycasts = false; _baitCanvasGroup.interactable = false; ((Graphic)val2.AddComponent<Image>()).color = BackgroundColor; GameObject val3 = new GameObject("BaitTrack"); val3.transform.SetParent(val2.transform, false); RectTransform obj = val3.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = new Vector2(2.5f, 2.5f); obj.offsetMax = new Vector2(-2.5f, -2.5f); ((Graphic)val3.AddComponent<Image>()).color = TrackColor; GameObject val4 = new GameObject("BaitIcon"); val4.transform.SetParent(val2.transform, false); RectTransform obj2 = val4.AddComponent<RectTransform>(); obj2.anchorMin = new Vector2(0f, 0.5f); obj2.anchorMax = new Vector2(0f, 0.5f); obj2.pivot = new Vector2(0f, 0.5f); obj2.anchoredPosition = new Vector2(16f, 0f); obj2.sizeDelta = new Vector2(16f, 16f); _baitIcon = val4.AddComponent<Image>(); _baitIcon.preserveAspect = true; ((Behaviour)_baitIcon).enabled = false; GameObject val5 = new GameObject("BaitText"); val5.transform.SetParent(val2.transform, false); RectTransform obj3 = val5.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0f, 0f); obj3.anchorMax = new Vector2(1f, 1f); obj3.offsetMin = new Vector2(36f, 0f); obj3.offsetMax = new Vector2(-6f, 0f); _baitText = val5.AddComponent<TextMeshProUGUI>(); if ((Object)(object)val != (Object)null) { ((TMP_Text)_baitText).font = val; } ((TMP_Text)_baitText).alignment = (TextAlignmentOptions)4097; ((TMP_Text)_baitText).fontSize = 13f; ((Graphic)_baitText).color = Color.white; GameObject val6 = new GameObject("GaugeContainer"); val6.transform.SetParent(((Component)this).transform, false); RectTransform obj4 = val6.AddComponent<RectTransform>(); obj4.anchorMin = new Vector2(0.5f, 0.5f); obj4.anchorMax = new Vector2(0.5f, 0.5f); obj4.pivot = new Vector2(0.5f, 0.5f); obj4.anchoredPosition = new Vector2(0f, -11f); obj4.sizeDelta = new Vector2(240f, 22f); _canvasGroup = val6.AddComponent<CanvasGroup>(); _canvasGroup.alpha = 0f; _canvasGroup.blocksRaycasts = false; _canvasGroup.interactable = false; ((Graphic)val6.AddComponent<Image>()).color = BackgroundColor; GameObject val7 = new GameObject("Track"); val7.transform.SetParent(val6.transform, false); RectTransform obj5 = val7.AddComponent<RectTransform>(); obj5.anchorMin = Vector2.zero; obj5.anchorMax = Vector2.one; obj5.offsetMin = new Vector2(2.5f, 2.5f); obj5.offsetMax = new Vector2(-2.5f, -2.5f); ((Graphic)val7.AddComponent<Image>()).color = TrackColor; GameObject val8 = new GameObject("Fill"); val8.transform.SetParent(val6.transform, false); _fillTransform = val8.AddComponent<RectTransform>(); _fillTransform.anchorMin = new Vector2(0f, 0.5f); _fillTransform.anchorMax = new Vector2(0f, 0.5f); _fillTransform.pivot = new Vector2(0f, 0.5f); _fillTransform.anchoredPosition = new Vector2(2.5f, 0f); _maxWidth = 235f; float num = 17f; _fillTransform.sizeDelta = new Vector2(0f, num); _fillImage = val8.AddComponent<Image>(); ((Graphic)_fillImage).color = SafeTensionColor; GameObject val9 = new GameObject("CenterText"); val9.transform.SetParent(val6.transform, false); RectTransform obj6 = val9.AddComponent<RectTransform>(); obj6.anchorMin = Vector2.zero; obj6.anchorMax = Vector2.one; obj6.offsetMin = Vector2.zero; obj6.offsetMax = Vector2.zero; _gaugeCenterText = val9.AddComponent<TextMeshProUGUI>(); if ((Object)(object)val != (Object)null) { ((TMP_Text)_gaugeCenterText).font = val; } ((TMP_Text)_gaugeCenterText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_gaugeCenterText).fontSize = 12f; ((TMP_Text)_gaugeCenterText).fontStyle = (FontStyles)1; ((Graphic)_gaugeCenterText).color = new Color(0.72f, 0.82f, 0.92f, 0.85f); ((TMP_Text)_gaugeCenterText).text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_ready_to_cast") : "Ready to Cast"); GameObject val10 = new GameObject("StrikePrompt"); val10.transform.SetParent(((Component)this).transform, false); RectTransform obj7 = val10.AddComponent<RectTransform>(); obj7.anchorMin = new Vector2(0.5f, 0.5f); obj7.anchorMax = new Vector2(0.5f, 0.5f); obj7.pivot = new Vector2(0.5f, 0.5f); obj7.anchoredPosition = new Vector2(0f, -36f); obj7.sizeDelta = new Vector2(320f, 26f); _promptCanvasGroup = val10.AddComponent<CanvasGroup>(); _promptCanvasGroup.alpha = 0f; _promptCanvasGroup.blocksRaycasts = false; _promptCanvasGroup.interactable = false; _promptText = val10.AddComponent<TextMeshProUGUI>(); if ((Object)(object)val != (Object)null) { ((TMP_Text)_promptText).font = val; } ((TMP_Text)_promptText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_promptText).fontSize = 19f; ((TMP_Text)_promptText).fontStyle = (FontStyles)1; ((Graphic)_promptText).color = new Color(1f, 0.84f, 0f, 1f); ((TMP_Text)_promptText).text = "STRIKE!"; } private void UpdatePosition() { //IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rootTransform == (Object)null)) { float num = ((ConfigRegistry.HudHorizontalOffset != null) ? ConfigRegistry.HudHorizontalOffset.Value : (-300f)); float num2 = ((ConfigRegistry.HudVerticalOffset != null) ? ConfigRegistry.HudVerticalOffset.Value : (-250f)); Vector2 anchoredPosition = _rootTransform.anchoredPosition; if (Mathf.Abs(anchoredPosition.x - num) > 0.01f || Mathf.Abs(anchoredPosition.y - num2) > 0.01f) { _rootTransform.anchoredPosition = new Vector2(num, num2); } } } private void Update() { //IL_09c3: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) UpdatePosition(); if (_hookedAlertTimer > 0f) { _hookedAlertTimer -= Time.deltaTime; } if (_biteAlertTimer > 0f) { _biteAlertTimer -= Time.deltaTime; } if (_recentCastTimer > 0f) { _recentCastTimer -= Time.deltaTime; } if (InventoryGui.IsVisible()) { SetAlpha(0f); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { SetAlpha(0f); return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon == null || !((Object)(object)currentWeapon.m_dropPrefab != (Object)null) || !((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { SetAlpha(0f); return; } if (currentWeapon.m_shared != null && currentWeapon.m_shared.m_attack != null) { float num = ((((Object)currentWeapon.m_dropPrefab).name == "FishingRodPrimitive") ? 22f : 26f); if (currentWeapon.m_shared.m_attack.m_projectileVel != num || currentWeapon.m_shared.m_attack.m_drawDurationMin != 2.8f) { currentWeapon.m_shared.m_attack.m_projectileVel = num; currentWeapon.m_shared.m_attack.m_projectileVelMin = 2f; currentWeapon.m_shared.m_attack.m_drawDurationMin = 2.8f; } } FishingFloat val = FishingFloat.FindFloat((Character)(object)localPlayer); float attackDrawPercentage = ((Humanoid)localPlayer).GetAttackDrawPercentage(); if ((Object)(object)val == (Object)null && attackDrawPercentage <= 0.01f) { bool num2 = (Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus(); bool flag = Menu.IsVisible() || TextInput.IsVisible(); if (!num2 && !flag) { bool keyDown = Input.GetKeyDown((KeyCode)((ConfigRegistry.SwitchBaitKey == null) ? 103 : ((int)ConfigRegistry.SwitchBaitKey.Value))); string text = ((ConfigRegistry.SwitchBaitGamepadButton != null) ? ConfigRegistry.SwitchBaitGamepadButton.Value : "JoyRBumper"); bool flag2 = (!string.IsNullOrEmpty(text) && ZInput.GetButtonDown(text)) || Input.GetKeyDown((KeyCode)335); if (keyDown || flag2) { bool reverse = keyDown && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)); BaitSelectionManager.CycleBait(localPlayer, currentWeapon, reverse); } } } UpdateBaitDisplay(localPlayer, currentWeapon, val); float num3 = 17f; if (attackDrawPercentage > 0.01f) { bool num4 = ((Object)currentWeapon.m_dropPrefab).name == "FishingRodPrimitive"; float num5 = 4f; float num6 = (num4 ? 20f : 30f); float num7 = num6 + 10f; float num8 = Mathf.Lerp(num5, num7, attackDrawPercentage); _targetAlpha = 1f; _promptTargetAlpha = 1f; if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = false; } _recentCastTimer = 0.6f; string text2 = (MorningFishManager.IsMorningFishingHour() ? " <color=#FFD700>• MORNING BITE</color>" : ""); int num9 = Mathf.RoundToInt(num8); int num10 = Mathf.RoundToInt(num6); float num11 = Mathf.Clamp01(attackDrawPercentage); _fillTransform.sizeDelta = new Vector2(_maxWidth * num11, num3); if (num8 <= num6) { float num12 = ((num6 - num5 > 0f) ? ((num8 - num5) / (num6 - num5)) : 0f); ((Graphic)_fillImage).color = Color.Lerp(new Color(0.25f, 0.78f, 1f, 1f), new Color(0.2f, 0.95f, 0.6f, 1f), num12); ((TMP_Text)_promptText).text = $"CAST: {num9}m / {num10}m{text2}"; ((Graphic)_promptText).color = Color.white; } else { float num13 = Mathf.Clamp01((num8 - num6) / 10f); Color color = Color.Lerp(new Color(1f, 0.6f, 0f, 1f), new Color(1f, 0.2f, 0.2f, 1f), num13); ((Graphic)_fillImage).color = color; string text3 = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_line_break_risk") : "LINE BREAK RISK!"); ((TMP_Text)_promptText).text = $"CAST: {num9}m / {num10}m (<color=#FF3333><b>{text3}</b></color>){text2}"; ((Graphic)_promptText).color = color; } UpdateFade(); return; } if ((Object)(object)val == (Object)null) { GameObject lastProjectile = currentWeapon.m_lastProjectile; if ((Object)(object)lastProjectile != (Object)null || ((Character)localPlayer).InAttack() || _recentCastTimer > 0f) { _targetAlpha = 1f; _promptTargetAlpha = 1f; if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = true; ((TMP_Text)_gaugeCenterText).text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_casting") : "Casting..."); } if ((Object)(object)lastProjectile != (Object)null) { _recentCastTimer = 0.6f; Transform val2 = Utils.FindChild(((Component)localPlayer).transform, "_RodTop", (IterativeSearchType)0); float num14 = Vector3.Distance(((Object)(object)val2 != (Object)null) ? val2.position : ((Component)localPlayer).transform.position, lastProjectile.transform.position); int num15 = Mathf.RoundToInt(num14); float num16 = ((((Object)currentWeapon.m_dropPrefab).name == "FishingRodPrimitive") ? 20f : 30f); float num17 = num16 + 10f; _fillTransform.sizeDelta = new Vector2(_maxWidth * Mathf.Clamp01(num14 / num17), num3); if (num14 > num16) { ((Graphic)_fillImage).color = new Color(1f, 0.25f, 0.25f, 1f); } else { ((Graphic)_fillImage).color = new Color(0.25f, 0.78f, 1f, 1f); } ((TMP_Text)_promptText).text = $"CASTING • {num15}m"; ((Graphic)_promptText).color = new Color(0.39f, 0.78f, 0.98f, 1f); } else { _fillTransform.sizeDelta = new Vector2(0f, num3); ((TMP_Text)_promptText).text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_casting") : "Casting..."); ((Graphic)_promptText).color = new Color(0.39f, 0.78f, 0.98f, 1f); } UpdateFade(); return; } _targetAlpha = 0.85f; _promptTargetAlpha = 0f; _fillTransform.sizeDelta = new Vector2(0f, num3); if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = true; ((TMP_Text)_gaugeCenterText).text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_ready_to_cast") : "Ready to Cast"); } } else if ((Object)(object)val.GetCatch() != (Object)null) { _targetAlpha = 1f; _promptTargetAlpha = 1f; if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = false; } UpdateGauge(val); if (_hookedAlertTimer > 0f) { ((TMP_Text)_promptText).text = "<color=#FFD700><b><size=22>HOOKED!</size></b></color>"; } else { FishingLineState component = ((Component)val).GetComponent<FishingLineState>(); float num18 = Mathf.Clamp01(((Object)(object)component != (Object)null) ? component.CurrentTension : 0f); float num19 = _lineLengthRef.Invoke(val); int num20 = Mathf.Max(0, Mathf.RoundToInt(num19)); if (num18 >= 0.75f) { ((TMP_Text)_promptText).text = $"RELEASE REEL! • {num20}m"; ((Graphic)_promptText).color = CriticalTensionColor; } else if (num18 >= 0.4f) { ((TMP_Text)_promptText).text = $"REELING • {num20}m"; ((Graphic)_promptText).color = WarningTensionColor; } else { ((TMP_Text)_promptText).text = $"REELING • {num20}m"; ((Graphic)_promptText).color = SafeTensionColor; } } } else if (((Character)localPlayer).IsBlocking()) { float num21 = _lineLengthRef.Invoke(val); int num22 = Mathf.Max(0, Mathf.RoundToInt(num21)); float maxDistance = val.m_maxDistance; float num23 = Mathf.Clamp01(num21 / maxDistance); _targetAlpha = 1f; _promptTargetAlpha = 1f; if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = false; } _fillTransform.sizeDelta = new Vector2(_maxWidth * num23, num3); ((Graphic)_fillImage).color = new Color(0.39f, 0.78f, 0.98f, 1f); ((TMP_Text)_promptText).text = $"RETRIEVING • {num22}m"; ((Graphic)_promptText).color = new Color(0.78f, 0.87f, 0.93f, 1f); } else { _targetAlpha = 0.85f; _fillTransform.sizeDelta = new Vector2(0f, num3); if ((Object)(object)_gaugeCenterText != (Object)null) { ((Behaviour)_gaugeCenterText).enabled = false; } if ((Object)(object)_nibblerRef.Invoke(val) != (Object)null || _biteAlertTimer > 0f) { ((TMP_Text)_promptText).text = "<b><size=22>STRIKE!</size></b>"; ((Graphic)_promptText).color = Color.Lerp(new Color(1f, 0.85f, 0f, 1f), new Color(1f, 0.45f, 0f, 1f), Mathf.PingPong(Time.time * 6f, 1f)); _promptTargetAlpha = 1f; } else { _promptTargetAlpha = 0f; } } UpdateFade(); } private void UpdateBaitDisplay(Player localPlayer, ItemData currentWeapon, FishingFloat activeFloat) { if ((Object)(object)activeFloat != (Object)null) { string bait = activeFloat.GetBait(); string text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_line") : "Line:"); if (!string.IsNullOrEmpty(bait)) { Sprite baitIconByPrefabName = BaitSelectionManager.GetBaitIconByPrefabName(bait); string baitNameByPrefabName = BaitSelectionManager.GetBaitNameByPrefabName(bait); _baitIcon.sprite = baitIconByPrefabName; ((Behaviour)_baitIcon).enabled = (Object)(object)baitIconByPrefabName != (Object)null; ((TMP_Text)_baitText).text = "<color=#70A0C0>" + text + "</color> <color=#FFD700><b>" + baitNameByPrefabName + "</b></color>"; } else { string text2 = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_no_bait") : "No Bait"); ((Behaviour)_baitIcon).enabled = false; ((TMP_Text)_baitText).text = "<color=#70A0C0>" + text + "</color> <color=#A0A0A0>" + text2 + "</color>"; } _baitTargetAlpha = 1f; } else { ItemData currentBait = BaitSelectionManager.GetCurrentBait(localPlayer, currentWeapon); if (currentBait != null) { Sprite icon = currentBait.GetIcon(); string arg = ((Localization.instance != null) ? Localization.instance.Localize(currentBait.m_shared.m_name) : currentBait.m_shared.m_name); int baitTotalCount = BaitSelectionManager.GetBaitTotalCount(localPlayer, currentBait); _baitIcon.sprite = icon; ((Behaviour)_baitIcon).enabled = (Object)(object)icon != (Object)null; ((TMP_Text)_baitText).text = $"<color=#FFD700><b>{arg}</b></color> <color=#D0E0F0>({baitTotalCount})</color>"; } else { string text3 = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_no_bait_in_bags") : "No Bait in Bags"); ((Behaviour)_baitIcon).enabled = false; ((TMP_Text)_baitText).text = "<color=#FF4D4D><b>" + text3 + "</b></color>"; } _baitTargetAlpha = 1f; } } private void UpdateGauge(FishingFloat activeFloat) { //IL_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) FishingLineState component = ((Component)activeFloat).GetComponent<FishingLineState>(); float num = Mathf.Clamp01(((Object)(object)component != (Object)null) ? component.CurrentTension : 0f); float num2 = 17f; _fillTransform.sizeDelta = new Vector2(_maxWidth * num, num2); Color color; if (num < 0.4f) { color = SafeTensionColor; } else if (num < 0.75f) { float num3 = (num - 0.4f) / 0.35f; color = Color.Lerp(SafeTensionColor, WarningTensionColor, num3); } else { float num4 = (num - 0.75f) / 0.25f; color = Color.Lerp(WarningTensionColor, CriticalTensionColor, num4); if (num >= 0.85f) { float a = Mathf.PingPong(Time.time * 8f, 0.4f) + 0.6f; color.a = a; } } ((Graphic)_fillImage).color = color; } private void UpdateFade() { if ((Object)(object)_canvasGroup != (Object)null) { if (Mathf.Abs(_canvasGroup.alpha - _targetAlpha) > 0.01f) { _canvasGroup.alpha = Mathf.MoveTowards(_canvasGroup.alpha, _targetAlpha, Time.deltaTime * 6f); } else { _canvasGroup.alpha = _targetAlpha; } } if ((Object)(object)_promptCanvasGroup != (Object)null) { if (Mathf.Abs(_promptCanvasGroup.alpha - _promptTargetAlpha) > 0.01f) { _promptCanvasGroup.alpha = Mathf.MoveTowards(_promptCanvasGroup.alpha, _promptTargetAlpha, Time.deltaTime * 6f * 2f); } else { _promptCanvasGroup.alpha = _promptTargetAlpha; } } if ((Object)(object)_baitCanvasGroup != (Object)null) { if (Mathf.Abs(_baitCanvasGroup.alpha - _baitTargetAlpha) > 0.01f) { _baitCanvasGroup.alpha = Mathf.MoveTowards(_baitCanvasGroup.alpha, _baitTargetAlpha, Time.deltaTime * 6f); } else { _baitCanvasGroup.alpha = _baitTargetAlpha; } } } private void SetAlpha(float alpha) { _targetAlpha = alpha; _promptTargetAlpha = alpha; _baitTargetAlpha = alpha; if ((Object)(object)_canvasGroup != (Object)null) { _canvasGroup.alpha = alpha; } if ((Object)(object)_promptCanvasGroup != (Object)null) { _promptCanvasGroup.alpha = alpha; } if ((Object)(object)_baitCanvasGroup != (Object)null) { _baitCanvasGroup.alpha = alpha; } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } } namespace BaitMeBruh.Patches { internal class FejdStartupPatches { [HarmonyPatch(typeof(FejdStartup), "Awake")] [HarmonyAfter(new string[] { "org.bepinex.helpers.LocalizationManager" })] [HarmonyBefore(new string[] { "org.bepinex.helpers.ItemManager" })] internal static class FejdStartupAwakePatch { private static void Prefix() { BaitMeBruh.Waiter.ValheimIsAwake(awakeFlag: true); } } } [HarmonyPatch(typeof(Fish), "CustomFixedUpdate")] internal static class FishCustomFixedUpdatePatch { [HarmonyPrefix] private static bool Prefix(Fish __instance) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (InventoryGui.IsVisible()) { FishingFloat val = FishingFloat.FindFloat(__instance); if ((Object)(object)val != (Object)null) { Character owner = val.GetOwner(); if ((Object)(object)owner != (Object)null && owner is Player) { Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.linearVelocity = Vector3.zero; component.angularVelocity = Vector3.zero; } return false; } } } return true; } } [HarmonyPatch(typeof(Fish), "FindFloat")] internal static class FishFindFloatPatch { private const float FogRangeMultiplier = 1.3f; [HarmonyPrefix] private static bool Prefix(Fish __instance, ref FishingFloat __result) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) float num = 1f; if ((Object)(object)EnvMan.instance != (Object)null) { EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment(); if (currentEnvironment != null && (currentEnvironment.m_name.IndexOf("fog", StringComparison.OrdinalIgnoreCase) >= 0 || currentEnvironment.m_fogDensityDay > 0.03f)) { num = 1.3f; } } float detectionRange = MorningFishManager.GetDetectionRange(); float baseHookChance = MorningFishManager.GetBaseHookChance(__instance.m_baseHookChance); foreach (FishingFloat allInstance in FishingFloat.GetAllInstances()) { if (!((Object)(object)allInstance == (Object)null) && allInstance.IsInWater() && !((Object)(object)allInstance.GetCatch() != (Object)null)) { float num2 = Mathf.Max(allInstance.m_range, detectionRange) * num; if (Vector3.Distance(((Component)__instance).transform.position, ((Component)allInstance).transform.position) <= num2 && Random.value < baseHookChance) { __result = allInstance; return false; } } } __result = null; return false; } } [HarmonyPatch(typeof(FishingFloat), "Catch")] internal static class FishingFloatCatchPatch { private const float CatchXpBaseMultiplier = 2f; [HarmonyPostfix] private static void Postfix(FishingFloat __instance, Fish fish, Character owner) { if ((Object)(object)fish == (Object)null || (Object)(object)owner == (Object)null) { return; } ItemDrop component = ((Component)fish).GetComponent<ItemDrop>(); float num = (float)((!((Object)(object)component != (Object)null)) ? 1 : component.m_itemData.m_quality) * 2f; owner.RaiseSkill((SkillType)104, num); Player val = (Player)(object)((owner is Player) ? owner : null); if (val == null) { return; } HuginTutorialManager.TriggerFirstFishCaught(val); if (((Humanoid)val).m_helmetItem == null || !((Object)(object)((Humanoid)val).m_helmetItem.m_dropPrefab != (Object)null) || !(((Object)((Humanoid)val).m_helmetItem.m_dropPrefab).name == "HelmetFishingHat") || !(Random.value < 0.25f) || !((Object)(object)__instance != (Object)null)) { return; } string bait = __instance.GetBait(); if (!string.IsNullOrEmpty(bait) && (Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab(bait); if ((Object)(object)prefab != (Object)null) { ((Humanoid)val).GetInventory().AddItem(prefab, 1); ((Character)val).Message((MessageType)2, "$msg_bait_salvaged", 0, (Sprite)null, false); } } } } [HarmonyPatch(typeof(FishingFloat), "FixedUpdate")] internal static class FishingFloatFixedUpdatePatch { private static readonly MethodInfo _useStaminaMethod = AccessTools.Method(typeof(Character), "UseStamina", new Type[1] { typeof(float) }, (Type[])null); private static readonly MethodInfo _interceptHookedMethod = AccessTools.Method(typeof(FishingFloatFixedUpdatePatch), "InterceptHookedUseStamina", (Type[])null, (Type[])null); private static readonly MethodInfo _interceptReelMethod = AccessTools.Method(typeof(FishingFloatFixedUpdatePatch), "InterceptReelUseStamina", (Type[])null, (Type[])null); private static readonly MethodInfo _raiseSkillMethod = AccessTools.Method(typeof(Character), "RaiseSkill", new Type[2] { typeof(SkillType), typeof(float) }, (Type[])null); private static readonly MethodInfo _interceptRaiseSkillMethod = AccessTools.Method(typeof(FishingFloatFixedUpdatePatch), "InterceptRaiseSkill", (Type[])null, (Type[])null); private static readonly FieldRef<FishingFloat, float> _lineLengthRef = AccessTools.FieldRefAccess<FishingFloat, float>("m_lineLength"); [HarmonyPrefix] private static bool Prefix(FishingFloat __instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) Character owner = __instance.GetOwner(); if ((Object)(object)owner == (Object)null) { return true; } if (owner is Player && InventoryGui.IsVisible()) { Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.linearVelocity = Vector3.zero; component.angularVelocity = Vector3.zero; } return false; } Transform rodTop = __instance.GetRodTop(owner); if ((Object)(object)rodTop != (Object)null) { float num = Vector3.Distance(rodTop.position, ((Component)__instance).transform.position); float num2 = _lineLengthRef.Invoke(__instance); Fish val = __instance.GetCatch(); Vector3 val2; if (!__instance.IsInWater()) { if (num >= __instance.m_maxDistance - 0.25f) { val2 = ((Component)__instance).transform.position - rodTop.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; ((Component)__instance).transform.position = rodTop.position + normalized * (__instance.m_maxDistance - 0.3f); num = __instance.m_maxDistance - 0.3f; _lineLengthRef.Invoke(__instance) = num; Rigidbody component2 = ((Component)__instance).GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.linearVelocity = new Vector3(0f, Mathf.Min(component2.linearVelocity.y, 0f), 0f); } } else if (num > num2) { _lineLengthRef.Invoke(__instance) = num; } } else if (num >= __instance.m_maxDistance - 0.25f) { val2 = ((Component)__instance).transform.position - rodTop.position; Vector3 normalized2 = ((Vector3)(ref val2)).normalized; ((Component)__instance).transform.position = rodTop.position + normalized2 * (__instance.m_maxDistance - 0.3f); num = __instance.m_maxDistance - 0.3f; _lineLengthRef.Invoke(__instance) = num; } else if ((Object)(object)val == (Object)null && !owner.IsBlocking() && (owner.IsAttachedToShip() || (Object)(object)owner.GetStandingOnShip() != (Object)null) && num > num2) { _lineLengthRef.Invoke(__instance) = num; } if (owner.IsBlocking()) { if ((Object)(object)val != (Object)null && owner.HaveStamina(0f)) { float num3 = Vector3.Distance(((Component)val).transform.position, ((Component)owner).transform.position); if (num2 <= 1.8f || num <= 2.2f || num3 <= 2.5f) { string text = FishingFloat.Catch(val, owner); __instance.Message(text, true); __instance.SetCatch((Fish)null); val.OnHooked((FishingFloat)null); ZNetView component3 = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component3 != (Object)null && component3.IsValid()) { component3.Destroy(); } return false; } } else if ((Object)(object)val == (Object)null && (num2 <= 1.5f || num <= 1.8f || (!__instance.IsInWater() && num <= 2.5f))) { MethodInfo methodInfo = AccessTools.Method(typeof(FishingFloat), "ReturnBait", (Type[])null, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(__instance, null); } ZNetView component4 = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component4 != (Object)null && component4.IsValid()) { component4.Destroy(); } return false; } } } Fish val3 = __instance.GetCatch(); FishingLineState fishingLineState = ((Component)__instance).GetComponent<FishingLineState>(); if ((Object)(object)val3 == (Object)null) { if ((Object)(object)fishingLineState != (Object)null) { fishingLineState.ResetTension(); } return true; } if ((Object)(object)fishingLineState == (Object)null) { fishingLineState = ((Component)__instance).gameObject.AddComponent<FishingLineState>(); } bool isStruggling = val3.IsEscaping(); bool isReeling = owner.IsBlocking() && owner.HaveStamina(0f); ItemDrop component5 = ((Component)val3).GetComponent<ItemDrop>(); int fishQuality = ((!((Object)(object)component5 != (Object)null)) ? 1 : component5.m_itemData.m_quality); float skillFactor = owner.GetSkillFactor((SkillType)104); float rodTensionDamping = FishingTensionManager.GetRodTensionDamping(owner); float snapToleranceMultiplier = 1f; Player val4 = (Player)(object)((owner is Player) ? owner : null); if (val4 != null && ((Humanoid)val4).m_helmetItem != null && (Object)(object)((Humanoid)val4).m_helmetItem.m_dropPrefab != (Object)null && ((Object)((Humanoid)val4).m_helmetItem.m_dropPrefab).name == "HelmetFishingHat") { snapToleranceMultiplier = 1.3f; } fishingLineState.UpdateTension(Time.fixedDeltaTime, isStruggling, isReeling, fishQuality, skillFactor, rodTensionDamping, snapToleranceMultiplier); if (fishingLineState.IsSnapped) { __instance.Message("$msg_fishing_linebroke", true); val3.OnHooked((FishingFloat)null); ZNetView component6 = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component6 != (Object)null && component6.IsValid()) { component6.Destroy(); } if (__instance.m_lineBreakEffect != null) { __instance.m_lineBreakEffect.Create(((Component)__instance).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } return false; } return true; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { int useStaminaCount = 0; foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, _useStaminaMethod)) { useStaminaCount++; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); if (useStaminaCount == 1) { yield return new CodeInstruction(OpCodes.Call, (object)_interceptHookedMethod); } else { yield return new CodeInstruction(OpCodes.Call, (object)_interceptReelMethod); } } else if (CodeInstructionExtensions.Calls(instruction, _raiseSkillMethod)) { yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)_interceptRaiseSkillMethod); } else { yield return instruction; } } } public static void InterceptRaiseSkill(Character owner, SkillType skill, float value, FishingFloat floatInstance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)owner == (Object)null) && !((Object)(object)floatInstance == (Object)null) && !((Object)(object)floatInstance.GetCatch() == (Object)null)) { owner.RaiseSkill(skill, value); } } public static void InterceptHookedUseStamina(Character owner, float fallbackStamina, FishingFloat floatInstance) { if ((Object)(object)floatInstance == (Object)null) { owner.UseStamina(fallbackStamina); return; } Fish fish = floatInstance.GetCatch(); FishingTensionManager.ApplyHookedStaminaDrain(owner, fallbackStamina, floatInstance, fish); } public static void InterceptReelUseStamina(Character owner, float fallbackStamina, FishingFloat floatInstance) { if ((Object)(object)floatInstance == (Object)null) { owner.UseStamina(fallbackStamina); return; } Fish fish = floatInstance.GetCatch(); FishingTensionManager.ApplyReelStaminaDrain(owner, fallbackStamina, floatInstance, fish); } } [HarmonyPatch(typeof(FishingFloat), "RPC_Nibble")] internal static class FishingFloatNibblePatch { private static readonly FieldRef<FishingFloat, float> _nibbleTimeRef = AccessTools.FieldRefAccess<FishingFloat, float>("m_nibbleTime"); [HarmonyPostfix] private static void Postfix(FishingFloat __instance, ZDOID fishID, bool correctBait) { if (!correctBait || (Object)(object)__instance == (Object)null || (Object)(object)__instance.GetCatch() != (Object)null) { return; } float num = _nibbleTimeRef.Invoke(__instance); if (!(Mathf.Abs(Time.time - num) > 0.05f)) { Character owner = __instance.GetOwner(); if (!((Object)(object)owner == (Object)null)) { FishingCueManager.TriggerBiteCue(__instance, owner); } } } } [HarmonyPatch(typeof(FishingFloat), "Setup")] internal static class FishingFloatSetupPatch { private static void Postfix(FishingFloat __instance, Character owner, ItemData item) { if ((Object)(object)__instance == (Object)null || (Object)(object)owner == (Object)null) { return; } Humanoid val = (Humanoid)(object)((owner is Humanoid) ? owner : null); ItemData val2 = ((item != null) ? item : (((Object)(object)val != (Object)null) ? val.GetCurrentWeapon() : null)); if (val2 != null && (Object)(object)val2.m_dropPrefab != (Object)null) { if (((Object)val2.m_dropPrefab).name == "FishingRodPrimitive") { __instance.m_maxDistance = 20.5f; } else { __instance.m_maxDistance = 30.5f; } } } } [HarmonyPatch(typeof(FishingFloat), "TryToHook")] internal static class FishingFloatTryToHookPatch { private const float BaseHookWindow = 0.8f; private const float MaxSkillWindowBonus = 0.7f; private const float DawnDuskMultiplier = 1.4f; private const float HookXpAward = 0.5f; private static readonly FieldRef<FishingFloat, Fish> _nibblerRef = AccessTools.FieldRefAccess<FishingFloat, Fish>("m_nibbler"); private static readonly FieldRef<FishingFloat, float> _nibbleTimeRef = AccessTools.FieldRefAccess<FishingFloat, float>("m_nibbleTime"); [HarmonyPrefix] private static bool Prefix(FishingFloat __instance) { Fish val = _nibblerRef.Invoke(__instance); if ((Object)(object)val == (Object)null || (Object)(object)__instance.GetCatch() != (Object)null) { return false; } Character owner = __instance.GetOwner(); float num = (((Object)(object)owner != (Object)null) ? owner.GetSkillFactor((SkillType)104) : 0f); float num2 = 0.8f + num * 0.7f; if ((Object)(object)EnvMan.instance != (Object)null) { float dayFraction = EnvMan.instance.GetDayFraction(); if (1f - Mathf.Abs(Mathf.Abs(dayFraction * 2f - 1f) - 0.5f) * 2f > 0.3f) { num2 *= 1.4f; } } float num3 = _nibbleTimeRef.Invoke(__instance); if (Time.time - num3 < num2) { __instance.SetCatch(val); _nibblerRef.Invoke(__instance) = null; Game.instance.IncrementPlayerStat((PlayerStatType)158, 1f, false); if ((Object)(object)owner != (Object)null) { owner.RaiseSkill((SkillType)104, 0.5f); } FishingCueManager.TriggerHookedCue(__instance, owner, val); } return false; } } [HarmonyPatch(typeof(Fish), "Interact")] internal static class FishInteractPatch { private static readonly FieldRef<Fish, FishingFloat> _fishingFloatRef = AccessTools.FieldRefAccess<Fish, FishingFloat>("m_fishingFloat"); [HarmonyPrefix] private static bool Prefix(Fish __instance, Humanoid character, bool repeat, bool alt, ref bool __result) { if (repeat) { __result = false; return false; } if (!__instance.IsOutOfWater()) { __result = false; return false; } if (!__instance.IsHooked()) { return true; } FishingFloat val = _fishingFloatRef.Invoke(__instance); if ((Object)(object)val == (Object)null) { return true; } string text = FishingFloat.Catch(__instance, (Character)(object)character); ((Character)character).Message((MessageType)2, Localization.instance.Localize(text), 0, (Sprite)null, false); val.SetCatch((Fish)null); __instance.OnHooked((FishingFloat)null); ZNetView component = ((Component)val).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.Destroy(); } __result = true; return false; } } internal class FishSpawnerBackup { public SpawnData Spawner; public float OriginalSpawnChance; public int OriginalMaxSpawned; public int OriginalGroupSizeMin; public int OriginalGroupSizeMax; public float OriginalSpawnInterval; public bool OriginalSpawnAtDay; public bool OriginalSpawnAtNight; } [HarmonyPatch(typeof(Fish), "SwimDirection")] internal static class FishSwimDirectionPatch { private static readonly FieldRef<Fish, FishingFloat> _waypointFFRef = AccessTools.FieldRefAccess<Fish, FishingFloat>("m_waypointFF"); [HarmonyPrefix] private static void Prefix(Fish __instance, ref bool fast) { if (!fast && MorningFishManager.IsMorningFishingHour() && (Object)(object)_waypointFFRef.Invoke(__instance) != (Object)null) { fast = true; } } } [HarmonyPatch(typeof(Fish), "TestBate")] internal static class FishTestBatePatch { private const float RainBiteRateMultiplier = 1.5f; [HarmonyPrefix] private static bool Prefix(Fish __instance, FishingFloat ff, ref bool __result) { if ((Object)(object)ff == (Object)null || (Object)(object)__instance == (Object)null) { return true; } string bait = ff.GetBait(); if (string.IsNullOrEmpty(bait)) { __result = false; return false; } bool flag = MorningFishManager.IsMorningFishingHour(); float num = 1f; if (EnvMan.IsWet()) { num = 1.5f; } foreach (BaitSetting bait2 in __instance.m_baits) { if ((Object)(object)bait2.m_bait != (Object)null && ((Object)bait2.m_bait).name == bait) { if (flag) { __result = true; return false; } float num2 = Mathf.Clamp01(bait2.m_chance * num); if (Random.value < num2) { __result = true; return false; } } } __result = false; return false; } } [HarmonyPatch(typeof(Hud), "Awake")] internal static class HudAwakePatch { [HarmonyPostfix] private static void Postfix(Hud __instance) { FishingTensionHud.EnsureInitialized(__instance); } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] internal static class HumanoidStartAttackPatch { [HarmonyPrefix] private static bool Prefix(Humanoid __instance) { if (__instance is Player && InventoryGui.IsVisible()) { ItemData currentWeapon = __instance.GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { return false; } } return true; } } [HarmonyPatch(typeof(KeyHints), "UpdateHints")] internal static class KeyHintsUpdateHintsPatch { private static readonly FieldRef<FishingFloat, Fish> _nibblerRef = AccessTools.FieldRefAccess<FishingFloat, Fish>("m_nibbler"); private static GameObject _switchBaitHintObjectKB; private static TextMeshProUGUI _switchBaitLabelKB; private static TextMeshProUGUI _switchBaitKeyKB; private static TextMeshProUGUI _pullTextKB; private static GameObject _switchBaitHintObjectGP; private static TextMeshProUGUI _switchBaitLabelGP; private static TextMeshProUGUI _switchBaitKeyGP; private static TextMeshProUGUI _pullTextGP; private static void Postfix(KeyHints __instance) { //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_fishingHints == (Object)null || !__instance.m_fishingHints.activeSelf) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Transform transform = __instance.m_fishingHints.transform; Transform val = transform.Find("BaitMeBruh_SwitchBaitHint"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } Transform val2 = transform.Find("BaitMeBruh_SwitchBaitHintGP"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } Transform val3 = transform.Find("Keyboard"); Transform val4 = transform.Find("Gamepad"); UIInputHint component = __instance.m_fishingHints.GetComponent<UIInputHint>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)val3 == (Object)null && (Object)(object)component.m_mouseKeyboardHint != (Object)null) { val3 = component.m_mouseKeyboardHint.transform; } if ((Object)(object)val4 == (Object)null && (Object)(object)component.m_gamepadHint != (Object)null) { val4 = component.m_gamepadHint.transform; } } FishingFloat val5 = FishingFloat.FindFloat((Character)(object)localPlayer); float attackDrawPercentage = ((Humanoid)localPlayer).GetAttackDrawPercentage(); bool flag = (Object)(object)val5 == (Object)null && attackDrawPercentage <= 0.01f; string text = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_switch_bait") : "Switch Bait"); if ((Object)(object)val3 != (Object)null) { if ((Object)(object)_switchBaitHintObjectKB == (Object)null || (Object)(object)_switchBaitHintObjectKB.transform.parent != (Object)(object)val3) { Transform val6 = val3.Find("BaitMeBruh_SwitchBaitHintKB") ?? val3.Find("BaitMeBruh_SwitchBaitHint"); if ((Object)(object)val6 != (Object)null) { _switchBaitHintObjectKB = ((Component)val6).gameObject; ((Object)_switchBaitHintObjectKB).name = "BaitMeBruh_SwitchBaitHintKB"; } else { Transform val7 = val3.Find("PrimaryAttack"); if ((Object)(object)val7 != (Object)null) { _switchBaitHintObjectKB = Object.Instantiate<GameObject>(((Component)val7).gameObject, val3, false); ((Object)_switchBaitHintObjectKB).name = "BaitMeBruh_SwitchBaitHintKB"; _switchBaitHintObjectKB.transform.SetSiblingIndex(1); } } if ((Object)(object)_switchBaitHintObjectKB != (Object)null) { Transform val8 = _switchBaitHintObjectKB.transform.Find("Text"); if ((Object)(object)val8 != (Object)null) { _switchBaitLabelKB = ((Component)val8).GetComponent<TextMeshProUGUI>(); Localize component2 = ((Component)val8).GetComponent<Localize>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } Transform val9 = _switchBaitHintObjectKB.transform.Find("key_bkg/Key") ?? _switchBaitHintObjectKB.transform.Find("Key"); if ((Object)(object)val9 != (Object)null) { _switchBaitKeyKB = ((Component)val9).GetComponent<TextMeshProUGUI>(); Localize component3 = ((Component)val9).GetComponent<Localize>(); if ((Object)(object)component3 != (Object)null) { Object.Destroy((Object)(object)component3); } } } } if ((Object)(object)_switchBaitLabelKB != (Object)null) { ((TMP_Text)_switchBaitLabelKB).text = text; } if ((Object)(object)_switchBaitKeyKB != (Object)null) { int num = ((ConfigRegistry.SwitchBaitKey == null) ? 103 : ((int)ConfigRegistry.SwitchBaitKey.Value)); ((TMP_Text)_switchBaitKeyKB).text = ((object)(KeyCode)num/*cast due to .constrained prefix*/).ToString(); } if ((Object)(object)_switchBaitHintObjectKB != (Object)null && _switchBaitHintObjectKB.activeSelf != flag) { _switchBaitHintObjectKB.SetActive(flag); RectTransform val10 = (RectTransform)(object)((val3 is RectTransform) ? val3 : null); if (val10 != null) { LayoutRebuilder.ForceRebuildLayoutImmediate(val10); } } if ((Object)(object)_pullTextKB == (Object)null || (Object)(object)((TMP_Text)_pullTextKB).transform.parent == (Object)null) { Transform val11 = val3.Find("Block/Text"); if ((Object)(object)val11 != (Object)null) { _pullTextKB = ((Component)val11).GetComponent<TextMeshProUGUI>(); } } } if ((Object)(object)val4 != (Object)null) { if ((Object)(object)_switchBaitHintObjectGP == (Object)null || (Object)(object)_switchBaitHintObjectGP.transform.parent != (Object)(object)val4) { Transform val12 = val4.Find("BaitMeBruh_SwitchBaitHintGP"); if ((Object)(object)val12 != (Object)null) { _switchBaitHintObjectGP = ((Component)val12).gameObject; } else { Transform val13 = val4.Find("PrimaryAttack"); if ((Object)(object)val13 == (Object)null && val4.childCount > 0) { val13 = val4.GetChild(0); } if ((Object)(object)val13 != (Object)null) { _switchBaitHintObjectGP = Object.Instantiate<GameObject>(((Component)val13).gameObject, val4, false); ((Object)_switchBaitHintObjectGP).name = "BaitMeBruh_SwitchBaitHintGP"; _switchBaitHintObjectGP.transform.SetSiblingIndex(1); } } if ((Object)(object)_switchBaitHintObjectGP != (Object)null) { Transform val14 = _switchBaitHintObjectGP.transform.Find("Text"); if ((Object)(object)val14 != (Object)null) { _switchBaitLabelGP = ((Component)val14).GetComponent<TextMeshProUGUI>(); Localize component4 = ((Component)val14).GetComponent<Localize>(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } } Transform val15 = _switchBaitHintObjectGP.transform.Find("key_bkg/Key") ?? _switchBaitHintObjectGP.transform.Find("Key"); if ((Object)(object)val15 != (Object)null) { _switchBaitKeyGP = ((Component)val15).GetComponent<TextMeshProUGUI>(); Localize component5 = ((Component)val15).GetComponent<Localize>(); if ((Object)(object)component5 != (Object)null) { Object.Destroy((Object)(object)component5); } } if ((Object)(object)_switchBaitKeyGP == (Object)null) { TextMeshProUGUI[] componentsInChildren = _switchBaitHintObjectGP.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val16 in componentsInChildren) { if ((Object)(object)val16 != (Object)(object)_switchBaitLabelGP) { _switchBaitKeyGP = val16; Localize component6 = ((Component)val16).GetComponent<Localize>(); if ((Object)(object)component6 != (Object)null) { Object.Destroy((Object)(object)component6); } break; } } } } } if ((Object)(object)_switchBaitLabelGP != (Object)null) { ((TMP_Text)_switchBaitLabelGP).text = text; } if ((Object)(object)_switchBaitKeyGP != (Object)null) { string text2 = null; string text3 = ((ConfigRegistry.SwitchBaitGamepadButton != null) ? ConfigRegistry.SwitchBaitGamepadButton.Value : "JoyRBumper"); if (ZInput.instance != null && !string.IsNullOrEmpty(text3)) { string boundKeyString = ZInput.instance.GetBoundKeyString(text3, true); if (!string.IsNullOrEmpty(boundKeyString) && !boundKeyString.StartsWith("MISSING")) { text2 = boundKeyString; } } if (string.IsNullOrEmpty(text2)) { text2 = ((Localization.instance != null) ? Localization.instance.Localize("$KEY_RBumper") : "RB"); if (string.IsNullOrEmpty(text2) || text2.StartsWith("[")) { text2 = "RB"; } } ((TMP_Text)_switchBaitKeyGP).text = text2; } if ((Object)(object)_switchBaitHintObjectGP != (Object)null && _switchBaitHintObjectGP.activeSelf != flag) { _switchBaitHintObjectGP.SetActive(flag); RectTransform val17 = (RectTransform)(object)((val4 is RectTransform) ? val4 : null); if (val17 != null) { LayoutRebuilder.ForceRebuildLayoutImmediate(val17); } } if ((Object)(object)_pullTextGP == (Object)null || (Object)(object)((TMP_Text)_pullTextGP).transform.parent == (Object)null) { Transform val18 = val4.Find("Block/Text"); if ((Object)(object)val18 != (Object)null) { _pullTextGP = ((Component)val18).GetComponent<TextMeshProUGUI>(); } } } string text4 = ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_pull") : "Pull"); if ((Object)(object)val5 != (Object)null) { if ((Object)(object)val5.GetCatch() != (Object)null) { FishingLineState component7 = ((Component)val5).GetComponent<FishingLineState>(); text4 = ((!((((Object)(object)component7 != (Object)null) ? component7.CurrentTension : 0f) >= 0.75f)) ? ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_reel") : "Reel") : ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_release") : "Release")); } else { text4 = (((!((Object)(object)FishingTensionHud.Instance != (Object)null) || !FishingTensionHud.Instance.IsBiteAlertActive) && !((Object)(object)_nibblerRef.Invoke(val5) != (Object)null)) ? ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_pull") : "Pull") : ((Localization.instance != null) ? Localization.instance.Localize("$hud_fishing_strike") : "Strike")); } } if ((Object)(object)_pullTextKB != (Object)null) { ((TMP_Text)_pullTextKB).text = text4; } if ((Object)(object)_pullTextGP != (Object)null) { ((TMP_Text)_pullTextGP).text = text4; } } } [HarmonyPatch(typeof(Player), "AttachStart")] internal static class PlayerAttachStartPatch { [HarmonyPrefix] private static void Prefix(Player __instance, bool isBed, ref bool hideWeapons) { if (!isBed && __instance.GetDoodadController() == null) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { hideWeapons = false; } } } } [HarmonyPatch(typeof(Player), "CanMove")] internal static class PlayerCanMovePatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref bool __result) { if (!__result && (((Character)__instance).IsAttached() || ((Character)__instance).InEmote()) && !((Character)__instance).InBed() && __instance.GetDoodadController() == null) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { __result = true; } } } } [HarmonyPatch(typeof(Player), "CheckKeyboardRadialPressed")] internal static class PlayerCheckKeyboardRadialPressedPatch { private static bool Prefix(Player __instance, ref bool __result) { if ((Object)(object)__instance == (Object)null) { return true; } ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Player), "OnInventoryChanged")] internal static class PlayerOnInventoryChangedPatch { [HarmonyPostfix] private static void Postfix(Player __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } Inventory inventory = ((Humanoid)__instance).GetInventory(); if (inventory != null) { if (inventory.HaveItem("$item_fishingrod_primitive", true) && !__instance.HaveSeenTutorial("GC_Tutorial_PrimitiveRod")) { HuginTutorialManager.TriggerPrimitiveRodCrafted(__instance); } PieceUnlockHelper.CheckAndUnlockPiece(__instance, inventory, "$item_fishnet_coastal", "piece_fishnet_coastal", updateList: true); PieceUnlockHelper.CheckAndUnlockPiece(__instance, inventory, "$item_fishnet_deep", "piece_fishnet_deep", updateList: true); } } } [HarmonyPatch(typeof(Player), "SetControls")] internal static class PlayerSetControlsPatch { private static readonly MethodInfo _inEmoteMethod = AccessTools.Method(typeof(Character), "InEmote", (Type[])null, (Type[])null); private static readonly MethodInfo _shouldDetachMethod = AccessTools.Method(typeof(PlayerSetControlsPatch), "ShouldDetachOnInput", (Type[])null, (Type[])null); [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = -1; for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], _inEmoteMethod)) { num = i; break; } } if (num == -1 || num + 2 >= list.Count) { return list; } int num2 = num + 2; int num3 = -1; for (int j = num2; j < list.Count; j++) { if (list[j].opcode == OpCodes.Brfalse || list[j].opcode == OpCodes.Brfalse_S) { num3 = j; break; } } if (num3 == -1) { return list; } List<CodeInstruction> list2 = new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)4), new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)6), new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)7), new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)8), new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)9), new CodeInstruction(OpCodes.Call, (object)_shouldDetachMethod) }; for (int k = num2; k < num3; k++) { if (list[k].labels != null && list[k].labels.Count > 0) { list2[0].labels.AddRange(list[k].labels); } } list.RemoveRange(num2, num3 - num2); list.InsertRange(num2, list2); return list; } public static bool ShouldDetachOnInput(Player player, Vector3 movedir, bool attack, bool secondaryAttack, bool block, bool blockHold, bool jump, bool crouch) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((((Character)player).IsAttached() || ((Character)player).InEmote()) && !((Character)player).InBed() && player.GetDoodadController() == null) { ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { return movedir != Vector3.zero || jump || crouch; } } return movedir != Vector3.zero || attack || secondaryAttack || block || blockHold || jump || crouch; } } [HarmonyPatch(typeof(Player), "UpdateAttach")] internal static class PlayerUpdateAttachPatch { private const float MinStarboardOffset = 0.15f; [HarmonyPostfix] private static void Postfix(Player __instance) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !((Character)__instance).IsAttached() || ((Character)__instance).InBed() || __instance.GetDoodadController() != null) { return; } ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon == null || (Object)(object)currentWeapon.m_dropPrefab == (Object)null || !((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { return; } Transform attachPoint = __instance.GetAttachPoint(); if ((Object)(object)attachPoint == (Object)null) { return; } Ship componentInParent = ((Component)attachPoint).GetComponentInParent<Ship>(); if ((Object)(object)componentInParent == (Object)null) { componentInParent = ((Component)__instance).GetComponentInParent<Ship>(); } if (!((Object)(object)componentInParent == (Object)null)) { Vector3 val = ((Component)componentInParent).transform.InverseTransformPoint(attachPoint.position); Vector3 up = ((Component)componentInParent).transform.up; if (val.x > 0.15f) { Vector3 val2 = -((Component)componentInParent).transform.forward; ((Component)__instance).transform.rotation = Quaternion.LookRotation(val2, up); } else if (val.x < -0.15f) { Vector3 forward = ((Component)componentInParent).transform.forward; ((Component)__instance).transform.rotation = Quaternion.LookRotation(forward, up); } } } } [HarmonyPatch(typeof(Player), "UpdateAttackBowDraw")] internal static class PlayerUpdateAttackBowDrawPatch { private static readonly MethodInfo _isAttachedPlayerMethod = AccessTools.Method(typeof(Player), "IsAttached", (Type[])null, (Type[])null); private static readonly MethodInfo _isAttachedCharacterMethod = AccessTools.Method(typeof(Character), "IsAttached", (Type[])null, (Type[])null); private static readonly MethodInfo _canBowDrawWhenAttachedMethod = AccessTools.Method(typeof(PlayerUpdateAttackBowDrawPatch), "CanBowDrawWhenAttached", (Type[])null, (Type[])null); [HarmonyPrefix] private static bool Prefix(Player __instance, ItemData weapon) { if ((Object)(object)__instance != (Object)null && InventoryGui.IsVisible() && weapon != null && (Object)(object)weapon.m_dropPrefab != (Object)null && ((Object)weapon.m_dropPrefab).name.StartsWith("FishingRod")) { return false; } return true; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, _isAttachedPlayerMethod) || CodeInstructionExtensions.Calls(instruction, _isAttachedCharacterMethod)) { yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)_canBowDrawWhenAttachedMethod); } else { yield return instruction; } } } public static bool CanBowDrawWhenAttached(Player player, ItemData weapon) { if ((Object)(object)player == (Object)null) { return false; } if (((Character)player).InBed() || player.GetDoodadController() != null) { return ((Character)player).IsAttached(); } if (weapon != null && (Object)(object)weapon.m_dropPrefab != (Object)null && ((Object)weapon.m_dropPrefab).name.StartsWith("FishingRod")) { return false; } return ((Character)player).IsAttached(); } } [HarmonyPatch(typeof(Player), "UpdateKnownRecipesList")] internal static class PlayerUpdateKnownRecipesListPatch { [HarmonyPostfix] private static void Postfix(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Inventory inventory = ((Humanoid)__instance).GetInventory(); PieceUnlockHelper.CheckAndUnlockPiece(__instance, inventory, "$item_fishnet_coastal", "piece_fishnet_coastal"); PieceUnlockHelper.CheckAndUnlockPiece(__instance, inventory, "$item_fishnet_deep", "piece_fishnet_deep"); } } } [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] internal static class PlayerUpdatePlacementGhostPatch { private static void Postfix(Player __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.m_placementGhost == (Object)null)) { Piece component = __instance.m_placementGhost.GetComponent<Piece>(); if (!((Object)(object)component == (Object)null) && component.m_waterPiece && (Object)(object)__instance.m_placementGhost.GetComponent<PassiveTrap>() != (Object)null) { Transform transform = __instance.m_placementGhost.transform; transform.position -= new Vector3(0f, 3f, 0f); } } } } [HarmonyPatch(typeof(Projectile), "Setup")] internal static class ProjectileSetupPatch { private static void Postfix(Projectile __instance, Character owner, ItemData item) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)owner == (Object)null) && item != null && !((Object)(object)item.m_dropPrefab == (Object)null) && ((Object)item.m_dropPrefab).name.StartsWith("FishingRod")) { FishingProjectileWatcher fishingProjectileWatcher = ((Component)__instance).gameObject.AddComponent<FishingProjectileWatcher>(); float maxDistance = ((((Object)item.m_dropPrefab).name == "FishingRodPrimitive") ? 20f : 30f); fishingProjectileWatcher.Setup(owner, maxDistance); } } } [HarmonyPatch(typeof(RadialBase), "Open")] internal static class RadialBaseOpenPatch { private static bool Prefix() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return true; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name.StartsWith("FishingRod")) { return false; } return true; } } [HarmonyPatch(typeof(SpawnSystem), "UpdateSpawnList")] internal static class SpawnSystemUpdateSpawnListPatch { [HarmonyPrefix] private static void Prefix(List<SpawnData> spawners, ref List<FishSpawnerBackup> __state) { if (spawners == null || !MorningFishManager.IsMorningFishingHour()) { __state = null; return; } List<FishSpawnerBackup> list = new List<FishSpawnerBackup>(); foreach (SpawnData spawner in spawners) { if (spawner != null && !((Object)(object)spawner.m_prefab == (Object)null) && !((Object)(object)spawner.m_prefab.GetComponent<Fish>() == (Object)null)) { FishSpawnerBackup item = new FishSpawnerBackup { Spawner = spawner, OriginalSpawnChance = spawner.m_spawnChance, OriginalMaxSpawned = spawner.m_maxSpawned, OriginalGroupSizeMin = spawner.m_groupSizeMin, OriginalGroupSizeMax = spawner.m_groupSizeMax, OriginalSpawnInterval = spawner.m_spawnInterval, OriginalSpawnAtDay = spawner.m_spawnAtDay, OriginalSpawnAtNight = spawner.m_spawnAtNight }; list.Add(item); spawner.m_spawnChance = 100f; spawner.m_maxSpawned = Mathf.Max(spawner.m_maxSpawned * 2, 8); spawner.m_groupSizeMin = Mathf.Max(spawner.m_groupSizeMin + 1, 2); spawner.m_groupSizeMax = Mathf.Max(spawner.m_groupSizeMax * 2, 4); spawner.m_spawnInterval = Mathf.Min(spawner.m_spawnInterval * 0.5f, 10f); spawner.m_spawnAtDay = true; spawner.m_spawnAtNight = true; } } __state = list; } [HarmonyPostfix] private static void Postfix(List<FishSpawnerBackup> __state) { if (__state == null) { return; } foreach (FishSpawnerBackup item in __state) { item.Spawner.m_spawnChance = item.OriginalSpawnChance; item.Spawner.m_maxSpawned = item.OriginalMaxSpawned; item.Spawner.m_groupSizeMin = item.OriginalGroupSizeMin; item.Spawner.m_groupSizeMax = item.OriginalGroupSizeMax; item.Spawner.m_spawnInterval = item.OriginalSpawnInterval; item.Spawner.m_spawnAtDay = item.OriginalSpawnAtDay; item.Spawner.m_spawnAtNight = item.OriginalSpawnAtNight; } } } [HarmonyPatch(typeof(Tutorial), "Awake")] internal static class TutorialAwakePatch { [HarmonyPostfix] private static void Postfix(Tutorial __instance) { HuginTutorialManager.RegisterTutorials(__instance); } } } namespace BaitMeBruh.Managers { public static class BaitSelectionManager { public static List<ItemData> GetAvailableBaitTypes(Player player, ItemData weapon) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 List<ItemData> list = new List<ItemData>(); if ((Object)(object)player == (Object)null || weapon == null) { return list; } string ammoType = weapon.m_shared.m_ammoType; if (string.IsNullOrEmpty(ammoType)) { return list; } HashSet<string> hashSet = new HashSet<string>(); List<ItemData> allItems = ((Humanoid)player).GetInventory().GetAllItems(); for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (val != null && !((Object)(object)val.m_dropPrefab == (Object)null) && val.m_shared != null && val.m_shared.m_ammoType == ammoType && ((int)val.m_shared.m_itemType == 9 || (int)val.m_shared.m_itemType == 23) && hashSet.Add(((Object)val.m_dropPrefab).name)) { list.Add(val); } } return list; } public static ItemData GetCurrentBait(Player player, ItemData weapon) { if ((Object)(object)player == (Object)null || weapon == null) { return null; } string ammoType = weapon.m_shared.m_ammoType; if (string.IsNullOrEmpty(ammoType)) { return null; } ItemData ammoItem = ((Humanoid)player).GetAmmoItem(); if (ammoItem != null && ((Humanoid)player).GetInventory().ContainsItem(ammoItem) && ammoItem.m_shared.m_ammoType == ammoType) { return ammoItem; } return ((Humanoid)player).GetInventory().GetAmmoItem(ammoType, (string)null); } public static bool CycleBait(Player player, ItemData weapon, bool reverse = false) { if ((Object)(object)player == (Object)null || weapon == null) { return false; } List<ItemData> availableBaitTypes = GetAvailableBaitTypes(player, weapon); if (availableBaitTypes.Count <= 1) { return false; } ItemData currentBait = GetCurrentBait(player, weapon); int num = -1; if (currentBait != null && (Object)(object)currentBait.m_dropPrefab != (Object)null) { for (int i = 0; i < availableBaitTypes.Count; i++) { if ((Object)(object)availableBaitTypes[i].m_dropPrefab != (Object)null && ((Object)availableBaitTypes[i].m_dropPrefab).name == ((Object)currentBait.m_dropPrefab).name) { num = i; break; } } } int index = ((!reverse) ? ((num + 1) % availableBaitTypes.Count) : ((num <= 0) ? (availableBaitTypes.Count - 1) : (num - 1))); ItemData val = availableBaitTypes[index]; return ((Humanoid)player).EquipItem(val, false); } public static int GetBaitTotalCount(Player player, ItemData bait) { if ((Object)(object)player == (Object)null || bait == null || bait.m_shared == null) { return 0; } return ((Humanoid)player).GetInventory().CountItems(bait.m_shared.m_name, -1, true); } public static Sprite GetBaitIconByPrefabName(string prefabName) { if (string.IsNullOrEmpty(prefabName) || (Object)(object)ObjectDB.instance == (Object)null) { return null; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab == (Object)null) { return null; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { return null; } return component.m_itemData.GetIcon(); } public static string GetBaitNameByPrefabName(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return string.Empty; } if ((Object)(object)ObjectDB.instance != (Object)null) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab != (Object)null) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData.m_shared != null) { if (Localization.instance == null) { return component.m_itemData.m_shared.m_name; } return Localization.instance.Localize(component.m_itemData.m_shared.m_name); } } } return prefabName; } } public static class FishingCueManager { private static readonly Color FlareWarmGold = new Color(1f, 0.85f, 0.35f); private static readonly Color FlareBrightGold = new Color(1f, 0.92f, 0.5f); public static void TriggerBiteCue(FishingFloat fishingFloat, Character owner) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)fishingFloat == (Object)null) && !((Object)(object)owner == (Object)null)) { if (fishingFloat.m_nibbleEffect != null) { fishingFloat.m_nibbleEffect.Create(((Component)owner).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); fishingFloat.m_nibbleEffect.Create(((Component)fishingFloat).transform.position, Quaternion.identity, (Transform)null, 2.5f, -1, default(ZDOID)); } SpawnWaterLightFlare(((Component)fishingFloat).transform.position, 9f, 4.5f, 0.85f, FlareWarmGold); if ((Object)(object)FishingTensionHud.Instance != (Object)null) { FishingTensionHud.Instance.OnBiteAlert(); } } } public static void TriggerHookedCue(FishingFloat fishingFloat, Character owner, Fish fish) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fishingFloat == (Object)null || (Object)(object)owner == (Object)null) { return; } if (fishingFloat.m_nibbleEffect != null) { fishingFloat.m_nibbleEffect.Create(((Component)owner).transform.position, Quaternion.identity, (Transform)null, 2f, -1, default(ZDOID)); } Player val = (Player)(object)((owner is Player) ? owner : null); if (val != null) { if (val.m_perfectDodgeEffects != null) { val.m_perfectDodgeEffects.Create(((Component)owner).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } if (val.m_autopickupEffects != null) { val.m_autopickupEffects.Create(((Component)owner).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } } if ((Object)(object)fish != (Object)null && fish.m_jumpEffects != null) { fish.m_jumpEffects.Create(((Component)fishingFloat).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } SpawnWaterLightFlare(((Component)fishingFloat).transform.position, 12f, 6f, 0.65f, FlareBrightGold); owner.Message((MessageType)2, "<color=#FFD700><b><size=28>$msg_fishing_hooked</size></b></color>", 0, (Sprite)null, false); if ((Object)(object)FishingTensionHud.Instance != (Object)null) { FishingTensionHud.Instance.OnHookedAlert(); } } private static void SpawnWaterLightFlare(Vector3 position, float range, float intensity, float duration, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("FishingCueFlare"); val.transform.position = position + Vector3.up * 0.45f; Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.range = range; obj.intensity = intensity; obj.color = color; obj.shadows = (LightShadows)0; val.AddComponent<TransientLightFader>().Duration = duration; } } public static class FishingTensionManager { private const float BaseReelStamina = 2f; private const float TensionReelStaminaFactor = 2.5f; private const float BaseHookedStamina = 0.3f; private const float TensionHookedStaminaFactor = 0.5f; private const float DefaultRodDamping = 1.3f; private const float PrimitiveRodDamping = 1f; public static float GetRodTensionDamping(Character owner) { Humanoid val = (Humanoid)(object)((owner is Humanoid) ? owner : null); if (val != null) { ItemData rightItem = val.GetRightItem(); if (rightItem != null && (Object)(object)rightItem.m_dropPrefab != (Object)null && ((Object)rightItem.m_dropPrefab).name == "FishingRodPrimitive") { return 1f; } } return 1.3f; } public static float CalculateReelStaminaDrain(float tension, int fishQuality, float skillFactor, float fixedDeltaTime) { return (2f + 2.5f * tension * (float)fishQuality) * (1f - 0.5f * skillFactor) * fixedDeltaTime; } public static float CalculateHookedStaminaDrain(float tension, float skillFactor, float fixedDeltaTime) { return (0.3f + 0.5f * tension) * (1f - 0.5f * skillFactor) * fixedDeltaTime; } public static void ApplyHookedStaminaDrain(Character owner, float fallbackStamina, FishingFloat floatInstance, Fish fish) { if (!((Object)(object)owner == (Object)null) && !((Object)(object)fish == (Object)null) && !owner.IsBlocking()) { FishingLineState fishingLineState = (((Object)(object)floatInstance != (Object)null) ? ((Component)floatInstance).GetComponent<FishingLineState>() : null); if ((Object)(object)fishingLineState == (Object)null) { owner.UseStamina(fallbackStamina); return; } float skillFactor = owner.GetSkillFactor((SkillType)104); float num = Calcul