├── CoreKeeperAutoFish ├── CoreKeeperAutoFish.csproj ├── NuGet.Config ├── AutoFishPlugin.cs ├── Properties │ └── AssemblyInfo.cs ├── Directory.Build.targets ├── TestPatch.cs ├── Directory.Build.props ├── AutoFish.cs ├── Strings.cs └── AutoFishPatch.cs ├── README.md ├── CoreKeeperAutoFish.sln └── .gitignore /CoreKeeperAutoFish/CoreKeeperAutoFish.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoreKeeperAutoFish 2 | CoreKeeper AutoFish mod 3 | 4 | 地心护核者 自动钓鱼Mod 5 | 在钓鱼时会喊出鱼的名字并自动和鱼进行拉扯。 6 | 支持自动抛竿,抛竿时也会喊出口号。 7 | 开始钓鱼后,缩小游戏也可以继续钓鱼。 8 | 9 | # 引用 10 | [BeplnEx][1] 11 | 12 | # 下载 13 | [releases][2] 14 | 15 | [Thunderstore][5] 16 | 17 | # 安装 18 | 文字教程: [BepInEx install guide][3] 19 | 20 | 视频教程: [bilibili][4] 21 | 22 | [1]: https://github.com/BepInEx/BepInEx 23 | [2]: https://github.com/xiaoye97/CoreKeeperAutoFish/releases 24 | [3]: https://docs.bepinex.dev/master/articles/user_guide/installation/index.html 25 | [4]: https://space.bilibili.com/1306433 26 | [5]: https://core-keeper.thunderstore.io/package/xiaoye97/AutoFish/ -------------------------------------------------------------------------------- /CoreKeeperAutoFish/AutoFishPlugin.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using BepInEx.Logging; 3 | using BepInEx.Unity.IL2CPP; 4 | using CoreLib; 5 | using CoreLib.Submodules.Localization; 6 | 7 | namespace CoreKeeperAutoFish 8 | { 9 | [BepInPlugin(GUID, NAME, VERSION)] 10 | [CoreLibSubmoduleDependency(nameof(LocalizationModule))] 11 | internal class AutoFishPlugin : BasePlugin 12 | { 13 | public const string GUID = "me.xiaoye97.plugin.CoreKeeperAutoFish"; 14 | public const string NAME = "CoreKeeperAutoFish"; 15 | public const string AUTHOR = "xiaoye97"; 16 | public const string VERSION = "1.8.0"; 17 | 18 | public static AutoFishPlugin Inst { get; private set; } 19 | public static ManualLogSource LogSource => Inst.Log; 20 | 21 | public override void Load() 22 | { 23 | Inst = this; 24 | Strings.Init(Log); 25 | AutoFish.Init(); 26 | //TestPatch.Init(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("CoreKeeperAutoFish")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CoreKeeperAutoFish")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("b99be6e7-3348-4568-a7dc-964e9fba9117")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreKeeperAutoFish", "CoreKeeperAutoFish\CoreKeeperAutoFish.csproj", "{B99BE6E7-3348-4568-A7DC-964E9FBA9117}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B99BE6E7-3348-4568-A7DC-964E9FBA9117}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B99BE6E7-3348-4568-A7DC-964E9FBA9117}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B99BE6E7-3348-4568-A7DC-964E9FBA9117}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B99BE6E7-3348-4568-A7DC-964E9FBA9117}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D3A1B1D6-1184-44DE-B6FE-0329F4CDC33E} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | $(MSBuildThisFileDirectory)/DevEnv.targets 7 | 8 | 9 | 10 | C:\Program Files (x86)\Steam\steamapps\common\Core Keeper\ 11 | $([MSBuild]::EnsureTrailingSlash('$(CKGameDir)')) 12 | $(CKGameDir)BepInEx\unhollowed\ 13 | $(MSBuildThisFileDirectory)\ 14 | 15 | 16 | 20 | 21 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/TestPatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using HarmonyLib; 3 | using Il2CppInterop.Runtime.InteropTypes.Arrays; 4 | using UnityEngine; 5 | 6 | namespace CoreKeeperAutoFish 7 | { 8 | public static class TestPatch 9 | { 10 | public static void Init() 11 | { 12 | Harmony.CreateAndPatchAll(typeof(TestPatch)); 13 | } 14 | 15 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "UpdateFishOnTheHook")] 16 | public static void PlayerBaseState_UpdateFishOnTheHook_Patch(PlayerState.PlayerBaseState __instance) 17 | { 18 | //Debug.Log("XY PlayerBaseState.UpdateFishOnTheHook"); 19 | } 20 | 21 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.Fishing), "OnEnterState")] 22 | public static void Fishing_OnEnterState_Patch() 23 | { 24 | Debug.Log("XY Fishing.OnEnterState"); 25 | } 26 | 27 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "OnExitState")] 28 | public static void PlayerBaseState_OnExitState_Patch(PlayerState.PlayerBaseState __instance) 29 | { 30 | Debug.Log("XY PlayerBaseState.OnExitState"); 31 | } 32 | 33 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "PullUp")] 34 | public static void PlayerBaseState_PullUp_Patch(PlayerState.PlayerBaseState __instance, bool failedThrow) 35 | { 36 | Debug.Log($"XY PlayerBaseState.PullUp {failedThrow}"); 37 | } 38 | 39 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "StartFishing")] 40 | public static void PlayerBaseState_StartFishing_Patch(PlayerState.PlayerBaseState __instance) 41 | { 42 | Debug.Log("XY PlayerBaseState.StartFishing"); 43 | } 44 | 45 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "ExitFishing")] 46 | public static void PlayerBaseState_ExitFishing_Patch(PlayerState.PlayerBaseState __instance, bool wasExitingState) 47 | { 48 | Debug.Log($"XY PlayerBaseState.ExitFishing {wasExitingState}"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)/DevEnv.targets 6 | 7 | 8 | 9 | 10 | 11 | 12 | C:\Program Files (x86)\Steam\steamapps\common\Core Keeper\ 13 | $([MSBuild]::EnsureTrailingSlash('$(CKGameDir)')) 14 | $(CKGameDir)BepInEx\interop\ 15 | $(MSBuildThisFileDirectory)\ 16 | 17 | $([MSBuild]::EnsureTrailingSlash('$(SteamDir)')) 18 | $(CKGameDir)BepInEx\core\ 19 | $(CKGameDir)BepInEx\plugins\ 20 | $(BepPlugins)AutoFish\ 21 | 22 | 23 | 24 | false 25 | false 26 | 27 | $(PluginOutputDirectory) 28 | $(OutputPath) 29 | net6.0 30 | latest 31 | true 32 | true 33 | $(DefaultItemExcludes);*.binlog 34 | true 35 | 36 | portable 37 | true 38 | 39 | $(AssemblyVersion) 40 | 41 | me.xiaoye97.plugin.CoreKeeperAutoFish 42 | CoreKeeperAutoFish 43 | 1.6.0 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /CoreKeeperAutoFish/AutoFish.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using UnityEngine; 3 | using BepInEx.Logging; 4 | using BepInEx.Configuration; 5 | using System.Collections.Generic; 6 | using Il2CppSystem; 7 | 8 | namespace CoreKeeperAutoFish 9 | { 10 | public static class AutoFish 11 | { 12 | public static ManualLogSource Log => AutoFishPlugin.LogSource; 13 | public static ConfigEntry SpawnCoolTextOnFishing; 14 | public static ConfigEntry EnableAutoFish; 15 | public static ConfigEntry EnableAutoThrow; 16 | public static ConfigEntry EnableFishItem; 17 | 18 | private static Manager mgr; 19 | public static Manager Mgr 20 | { 21 | get 22 | { 23 | if (mgr == null) 24 | { 25 | mgr = GameObject.FindObjectOfType(); 26 | } 27 | return mgr; 28 | } 29 | } 30 | 31 | public static void Init() 32 | { 33 | Log.LogInfo("初始化自动钓鱼"); 34 | InitConfig(); 35 | Harmony.CreateAndPatchAll(typeof(AutoFishPatch)); 36 | } 37 | 38 | public static void InitConfig() 39 | { 40 | SpawnCoolTextOnFishing = AutoFishPlugin.Inst.Config.Bind("config", "SpawnCoolTextOnFishing", true, "是否喊出鱼的种类\nSpeak while fishing?"); 41 | EnableAutoFish = AutoFishPlugin.Inst.Config.Bind("config", "EnableAutoFish", true, "是否启用自动钓鱼\nEnable AutoFish?"); 42 | EnableAutoThrow = AutoFishPlugin.Inst.Config.Bind("config", "EnableAutoThrow", true, "是否启用自动抛竿\nEnable Auto-Cast?"); 43 | EnableFishItem = AutoFishPlugin.Inst.Config.Bind("config", "EnableFishItem", true, "是否启用钓物品\nEnable catching items?"); 44 | } 45 | 46 | /// 47 | /// 获取随机的钓鱼喊话文本 48 | /// 49 | /// 鱼的品质 50 | /// 鱼的名字 51 | /// 52 | public static string GetRandomFishSay(Rarity rarity, string fishName) 53 | { 54 | string format = Strings.GetRandomPhrase($"Rarity{rarity}"); 55 | return String.IsNullOrEmpty(format) 56 | ? fishName 57 | : string.Format(format, fishName); 58 | } 59 | 60 | /// 61 | /// 获取随机的抛竿文本 62 | /// 63 | /// 64 | public static string GetRandomAutoThrowSay() 65 | { 66 | string phrase = Strings.GetRandomPhrase("AutoThrow"); 67 | return phrase; 68 | } 69 | 70 | /// 71 | /// 说话 72 | /// 73 | public static void Say(string text, Color color) 74 | { 75 | Vector3 textPos = Mgr.player.RenderPosition + new Vector3(0, 2f, 0); 76 | Mgr._textManager.SpawnCoolText(text, textPos, color, TextManager.FontFace.button, 0.3f, 1, 3, 0.8f, 0.8f); 77 | } 78 | 79 | /// 80 | /// 说话,但是根据稀有度适应颜色 81 | /// 82 | public static void Say(string text, Rarity colorRarity) 83 | { 84 | Color color = Mgr._textManager.GetRarityColor(colorRarity); 85 | Say(text, color); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /CoreKeeperAutoFish/Strings.cs: -------------------------------------------------------------------------------- 1 | using CoreLib.Submodules.Localization; 2 | using Il2CppSystem; 3 | using BepInEx.Logging; 4 | 5 | namespace CoreKeeperAutoFish 6 | { 7 | public static class Strings 8 | { 9 | private static readonly Random Random = new(); 10 | private static ManualLogSource _log; 11 | 12 | public static void Init(ManualLogSource log) 13 | { 14 | _log = log; 15 | LocalizationModule.AddTerm("AutoFish/Say/RarityPoor[0]", "Ugh, {0}", "额,{0}你在逗我吗"); 16 | LocalizationModule.AddTerm("AutoFish/Say/RarityPoor[1]", "I hate {0}", "额,{0}你在逗我吗"); 17 | LocalizationModule.AddTerm("AutoFish/Say/RarityPoor[2]", "How boring - a {0}", "额,{0}你在逗我吗"); 18 | 19 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[0]", "A {0}", "一条{0}"); 20 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[1]", "Ordinary {0}", "{0},普普通通"); 21 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[2]", "It was a {0}", "原来是{0}"); 22 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[3]", "How plain - a {0}", "额,{0}"); 23 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[4]", "A {0}", "随处可见的{0}"); 24 | LocalizationModule.AddTerm("AutoFish/Say/RarityCommon[5]", "A {0}", "希望下次不是你,{0}"); 25 | 26 | LocalizationModule.AddTerm("AutoFish/Say/RarityUncommon[0]", "Oh, a {0}", "咦,{0}"); 27 | LocalizationModule.AddTerm("AutoFish/Say/RarityUncommon[1]", "One {0}", "吼吼,是{0}"); 28 | LocalizationModule.AddTerm("AutoFish/Say/RarityUncommon[2]", "Hey, a {0}", "还行,一条{0}"); 29 | LocalizationModule.AddTerm("AutoFish/Say/RarityUncommon[3]", "{0} makes a nice meal.", "运气不错,是一条{0}"); 30 | 31 | LocalizationModule.AddTerm("AutoFish/Say/RarityRare[0]", "Yay, it's {0}!", "好耶!是{0}|居然是{0}!"); 32 | LocalizationModule.AddTerm("AutoFish/Say/RarityRare[1]", "It's {0}!", "居然是{0}!|走大运了,是{0}!"); 33 | LocalizationModule.AddTerm("AutoFish/Say/RarityRare[2]", "Lucky me, it's a {0}!", "我爱死你了,{0}"); 34 | 35 | LocalizationModule.AddTerm("AutoFish/Say/RarityEpic[0]", "It's {0}!", "卧槽!!!是{0}!!!"); 36 | LocalizationModule.AddTerm("AutoFish/Say/RarityEpic[1]", "Epic! {0}!", "史诗!{0}!"); 37 | LocalizationModule.AddTerm("AutoFish/Say/RarityEpic[2]", "That's a huge {0}!", "太帅了,居然是{0}!"); 38 | 39 | LocalizationModule.AddTerm("AutoFish/Say/RarityLegendary[0]", "A Legendary {0}!", "传说级{0}!!!"); 40 | LocalizationModule.AddTerm("AutoFish/Say/RarityLegendary[1]", "Wow - a {0}!!!", "是真正的鱼之王者!{0}!"); 41 | 42 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[0]", "Come on...", "就决定是你了"); 43 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[1]", "Hey", "Hey"); 44 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[2]", "Fishing is so relaxing", "看我这招如何"); 45 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[3]", "Hoping for a big catch", "吃我一竿"); 46 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[4]", "Casting my line", "大的要来了"); 47 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[5]", "This is fun", "这钓鱼多是一件美事"); 48 | LocalizationModule.AddTerm("AutoFish/Say/AutoThrow[6]", "One more...", "冲呀"); 49 | } 50 | 51 | public static string GetRandomPhrase(string prefix) 52 | { 53 | string phrase; 54 | int max = 8; 55 | do 56 | { 57 | int i = Random.Next(max); 58 | max = i - 1; 59 | string key = $"AutoFish/Say/{prefix}[{i}]"; 60 | phrase = PugText.ProcessText(key, null, true, false); 61 | } while (phrase == "" && max >= 0); 62 | 63 | if (phrase == "") 64 | { 65 | phrase = String.Empty; 66 | _log.LogWarning($"Did not find any phrases for {prefix}"); 67 | } 68 | 69 | return phrase; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /CoreKeeperAutoFish/AutoFishPatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using HarmonyLib; 3 | using Il2CppInterop.Runtime.InteropTypes.Arrays; 4 | using UnityEngine; 5 | 6 | namespace CoreKeeperAutoFish 7 | { 8 | internal class AutoFishPatch 9 | { 10 | private static bool autoFishControlInput, autoFishNeedPress, autoThrowPullUp, waitPressedThrow, isInFishing, canPullUp; 11 | 12 | [HarmonyPostfix, HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })] 13 | public static void AudioSource_Patch(AudioSource __instance) 14 | { 15 | if (isInFishing) 16 | { 17 | if (AutoFish.EnableAutoFish.Value) 18 | { 19 | // 如果播放了冒泡音效,并且位置在玩家位置,说明可以拉杆了 20 | if (__instance.clip.name == "bubble") 21 | { 22 | float distance = Vector3.Distance(__instance.transform.position, AutoFish.Mgr.player.transform.position); 23 | //string log = $"检测到冒泡音效,音效位置:{__instance.transform.position} 玩家位置:{AutoFish.Mgr.player.transform.position} 距离:{distance}"; 24 | //AutoFish.Log.LogInfo(log); 25 | if (distance < 5f) 26 | { 27 | canPullUp = true; 28 | } 29 | } 30 | } 31 | } 32 | } 33 | 34 | [HarmonyPrefix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "UpdateFishOnTheHook")] 35 | public static bool PlayerBaseState_UpdateFishOnTheHook_Patch(PlayerState.PlayerBaseState __instance) 36 | { 37 | // 如果有鱼在钩子上,则开始判断 38 | if (__instance.fishOnTheHook) 39 | { 40 | // 自动钓起 41 | // 如果不在小游戏,则开始拉钩 42 | if (!__instance.isInFishingMiniGame) 43 | { 44 | if (AutoFish.SpawnCoolTextOnFishing.Value) 45 | { 46 | var info = PugDatabase.GetObjectInfo(__instance.fishStruggleInfo.fishID); 47 | // 获取翻译名字 48 | string fishName = PugText.ProcessText($"Items/{info.objectID}", new Il2CppStringArray(new string[] { }), true, false); 49 | string coolText = AutoFish.GetRandomFishSay(info.rarity, fishName); 50 | // 喊出鱼的名字 51 | AutoFish.Say(coolText, info.rarity); 52 | } 53 | if (AutoFish.EnableAutoFish.Value) 54 | { 55 | // 发现鱼,拉杆 56 | __instance.BeginPullUp(); 57 | autoFishControlInput = true; 58 | autoFishNeedPress = false; 59 | } 60 | } 61 | // 如果在小游戏,则根据鱼的状态进行拉钩 62 | else 63 | { 64 | // 根据鱼是否挣扎决定是否按住按键 65 | autoFishNeedPress = !__instance.fishIsStruggling; 66 | } 67 | } 68 | else 69 | { 70 | if (AutoFish.EnableFishItem.Value) 71 | { 72 | if (canPullUp) 73 | { 74 | __instance.BeginPullUp(); 75 | } 76 | } 77 | } 78 | return true; 79 | } 80 | 81 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "StartFishing")] 82 | public static void PlayerBaseState_StartFishing_Patch() 83 | { 84 | isInFishing = true; 85 | canPullUp = false; 86 | autoThrowPullUp = false; 87 | } 88 | 89 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "OnExitFishing")] 90 | public static void PlayerBaseState_ExitFishing_Patch(PlayerState.PlayerBaseState __instance, bool wasExitingState) 91 | { 92 | if (!wasExitingState) return; 93 | isInFishing = false; 94 | canPullUp = false; 95 | autoFishControlInput = false; 96 | // 如果退出钓鱼状态时此值为true,说明需要进行自动抛竿 97 | if (autoThrowPullUp) 98 | { 99 | // 喊出抛竿语 100 | AutoFish.Say(AutoFish.GetRandomAutoThrowSay(), Color.white); 101 | waitPressedThrow = true; 102 | } 103 | } 104 | 105 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerState.PlayerBaseState), "PullUp")] 106 | public static void AutoFish_Fishing_PullUp_Patch(PlayerState.PlayerBaseState __instance,bool failedThrow) 107 | { 108 | if (AutoFish.EnableAutoThrow.Value) 109 | { 110 | if (!failedThrow) 111 | { 112 | // 如果触发了这里,说明钓鱼成功,才可以继续抛竿,如果没触发这里就触发了OnExitState,说明中断 113 | autoThrowPullUp = true; 114 | } 115 | } 116 | } 117 | 118 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerInput), "IsButtonCurrentlyDown")] 119 | public static void AutoFish_PlayerInput_IsButtonCurrentlyDown_Patch(PlayerInput __instance, PlayerInput.InputType inputType, ref bool __result) 120 | { 121 | if (AutoFish.EnableAutoFish.Value) 122 | { 123 | // 如果检测的是SECOND_INTERACT按键,并且现在是钓鱼管控阶段,则根据钓鱼管控返回结果 124 | if (inputType == PlayerInput.InputType.SECOND_INTERACT) 125 | { 126 | if (autoFishControlInput) 127 | { 128 | __result = autoFishNeedPress; 129 | } 130 | } 131 | } 132 | } 133 | 134 | [HarmonyPostfix, HarmonyPatch(typeof(PlayerInput), "WasButtonPressedDownThisFrame")] 135 | public static void AutoFish_PlayerInput_WasButtonPressedDownThisFrame_Patch(PlayerInput __instance, PlayerInput.InputType inputType, ref bool __result) 136 | { 137 | if (AutoFish.EnableAutoThrow.Value) 138 | { 139 | if (waitPressedThrow) 140 | { 141 | if (inputType == PlayerInput.InputType.SECOND_INTERACT) 142 | { 143 | __result = true; 144 | waitPressedThrow = false; 145 | } 146 | } 147 | } 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | --------------------------------------------------------------------------------