using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OneClickFishingRod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OneClickFishingRod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("28f32067-7662-4543-92e0-f420a90b3a14")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.lan.OneClickFishingRod", "轮椅钓鱼", "1.1.0")] public class OneClickFishingRod : BaseUnityPlugin { public static ConfigEntry isSetGreyFishProbability; public static ConfigEntry greyFishProbability; public static ConfigEntry isSetGreenFishProbability; public static ConfigEntry greenFishProbability; public static ConfigEntry isSetCrapProbability; public static ConfigEntry crapProbability; public static ConfigEntry isSetOrangeRoughyProbability; public static ConfigEntry orangeRoughyProbability; public static ConfigEntry isSetOctopusProbability; public static ConfigEntry octopusProbability; public static ConfigEntry isSetSwordFishProbability; public static ConfigEntry swordFishProbability; public static ConfigEntry isSetBabySharkProbability; public static ConfigEntry babySharkProbability; public static ConfigEntry isAddStoneInItem; public static ConfigEntry isAddBoneInItem; public static List stoneItem = new List(); public static List boneItem = new List(); public static ConfigEntry minWaitTime; public static ConfigEntry maxWaitTime; public static Dictionary fishZoneProbabilityMap = new Dictionary(); private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.lan.OneClickFishingRod"); val.PatchAll(); Debug.LogWarning((object)"轮椅钓鱼模组加载成功 --作者:她说缝上都不给我"); setFishProbability(); } private void setFishProbability() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Expected O, but got Unknown //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Expected O, but got Unknown //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Expected O, but got Unknown //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Expected O, but got Unknown ConfigDescription val = new ConfigDescription("灰鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetGreyFishProbability = ((BaseUnityPlugin)this).Config.Bind("灰鱼概率修改", "是否开启概率修改", false, val); ConfigDescription val2 = new ConfigDescription("灰鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); greyFishProbability = ((BaseUnityPlugin)this).Config.Bind("灰鱼概率修改", "概率", 40, val2); if (isSetGreyFishProbability.Value) { fishZoneProbabilityMap.Add("grey_fish", greyFishProbability.Value); } ConfigDescription val3 = new ConfigDescription("绿鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetGreenFishProbability = ((BaseUnityPlugin)this).Config.Bind("绿鱼概率修改", "是否开启概率修改", false, val3); ConfigDescription val4 = new ConfigDescription("绿鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); greenFishProbability = ((BaseUnityPlugin)this).Config.Bind("绿鱼概率修改", "概率", 35, val4); if (isSetGreenFishProbability.Value) { fishZoneProbabilityMap.Add("green_fish", greenFishProbability.Value); } ConfigDescription val5 = new ConfigDescription("鲤鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetCrapProbability = ((BaseUnityPlugin)this).Config.Bind("鲤鱼概率修改", "是否开启概率修改", false, val5); ConfigDescription val6 = new ConfigDescription("鲤鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); crapProbability = ((BaseUnityPlugin)this).Config.Bind("鲤鱼概率修改", "概率", 20, val6); if (isSetCrapProbability.Value) { fishZoneProbabilityMap.Add("carp", crapProbability.Value); } ConfigDescription val7 = new ConfigDescription("章鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetOctopusProbability = ((BaseUnityPlugin)this).Config.Bind("章鱼概率修改", "是否开启概率修改", false, val7); ConfigDescription val8 = new ConfigDescription("章鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); octopusProbability = ((BaseUnityPlugin)this).Config.Bind("章鱼概率修改", "概率", 15, val8); if (isSetOctopusProbability.Value) { fishZoneProbabilityMap.Add("octopus", octopusProbability.Value); } ConfigDescription val9 = new ConfigDescription("罗非鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetOrangeRoughyProbability = ((BaseUnityPlugin)this).Config.Bind("罗非鱼概率修改", "是否开启概率修改", false, val9); ConfigDescription val10 = new ConfigDescription("罗非鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); orangeRoughyProbability = ((BaseUnityPlugin)this).Config.Bind("罗非鱼概率修改", "概率", 15, val10); if (isSetOrangeRoughyProbability.Value) { fishZoneProbabilityMap.Add("orange_roughy", orangeRoughyProbability.Value); } ConfigDescription val11 = new ConfigDescription("剑鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetSwordFishProbability = ((BaseUnityPlugin)this).Config.Bind("剑鱼概率修改", "是否开启概率修改", false, val11); ConfigDescription val12 = new ConfigDescription("剑鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); swordFishProbability = ((BaseUnityPlugin)this).Config.Bind("剑鱼概率修改", "概率", 5, val12); if (isSetSwordFishProbability.Value) { fishZoneProbabilityMap.Add("swordfish", swordFishProbability.Value); } ConfigDescription val13 = new ConfigDescription("鲨鱼", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isSetBabySharkProbability = ((BaseUnityPlugin)this).Config.Bind("鲨鱼概率修改", "是否开启概率修改", false, val13); ConfigDescription val14 = new ConfigDescription("鲨鱼", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty()); babySharkProbability = ((BaseUnityPlugin)this).Config.Bind("鲨鱼概率修改", "概率", 4, val14); if (isSetBabySharkProbability.Value) { fishZoneProbabilityMap.Add("baby_shark", babySharkProbability.Value); } ConfigDescription val15 = new ConfigDescription("矿石", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isAddStoneInItem = ((BaseUnityPlugin)this).Config.Bind("石头渔获", "是否开启石头渔获", false, val15); ConfigDescription val16 = new ConfigDescription("其他材料", (AcceptableValueBase)(object)new AcceptableValueList(new bool[2] { true, false }), Array.Empty()); isAddBoneInItem = ((BaseUnityPlugin)this).Config.Bind("动物材料渔获", "是否开启动物材料渔获", false, val16); ConfigDescription val17 = new ConfigDescription("最小钓鱼上钩等待时间(秒)", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 5f), Array.Empty()); ConfigDescription val18 = new ConfigDescription("最大钓鱼上钩等待时间(秒)", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 15f), Array.Empty()); minWaitTime = ((BaseUnityPlugin)this).Config.Bind("钓鱼时间设置", "最小等待时间", 0.8f, val17); maxWaitTime = ((BaseUnityPlugin)this).Config.Bind("钓鱼时间设置", "最大等待时间", 1.5f, val18); } } [HarmonyPatch] public static class FishingRod_Patch { private static readonly FieldInfo _playerInventoryField = AccessTools.Field(typeof(FishingRod), "playerInventory"); private static readonly MethodInfo _checkBaitMethod = AccessTools.Method(typeof(FishingRod), "CheckBait", (Type[])null, (Type[])null); private static readonly FieldInfo _targetBaitPosition = AccessTools.Field(typeof(FishingRod), "targetBaitPosition"); private static readonly FieldInfo _currentSlotField = AccessTools.Field(typeof(PlayerInventory), "currentSlot"); [HarmonyPrefix] [HarmonyPatch(typeof(FishingRod), "PullFish")] private static bool PullFishPatch(FishingRod __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) PlayerInventory val = (PlayerInventory)_playerInventoryField.GetValue(__instance); InventorySlot currentInventorySlot = val.GetCurrentInventorySlot(); int amount = currentInventorySlot.amount; bool flag = false; __instance.PullBait(); currentInventorySlot.amount = 0; val.slots[((NetworkVariable)_currentSlotField.GetValue(val)).Value] = currentInventorySlot; val.ReduceCurrentItemAmount(); SpawnItem spawnItem = new SpawnItem(); List list = NewCheckBait(amount, __instance); float xPoint = 1.5f; float yPoint = 1f; float zPoint = 2f; float xPoint2 = 0f; float yPoint2 = 1f; float zPoint2 = 0.25f; float xPoint3 = -2f; float yPoint3 = 1f; float zPoint3 = -2f; foreach (ItemSO item in list) { if ((Object)(object)item != (Object)null) { int num = Mathf.Max(((ItemSO)__instance.toolSO).basePrice / ((ItemSO)__instance.toolSO).amount, 1); if (item.itemName.Contains("beer") || item.itemName.Contains("whiskey")) { spawnItem.spawnItemUnderYourFeet(xPoint2, yPoint2, zPoint2, item, val); } else if (item.itemName.Contains("junk")) { spawnItem.spawnItemUnderYourFeet(xPoint, yPoint, zPoint, item, val); } else if (item.itemName.Contains("stone")) { val.GiveItemServerRpc(item.id, item.amount, num, 0); } else if (item.basePrice <= 61 && !item.itemName.Contains("fish")) { spawnItem.spawnItemUnderYourFeet(xPoint3, yPoint3, zPoint3, item, val); } else { val.GiveItemServerRpc(item.id, item.amount, num, 0); } if (flag) { GameManager.Instance.TriggerAchievement("catch_fish"); } } } GameManager.Instance.audioSource.PlayOneShot(__instance.audioCatch, 0.2f); return false; } [HarmonyPatch(typeof(FishingRod), "Start")] [HarmonyPostfix] private static void ModifyFishingTimes(FishingRod __instance) { __instance.minFishTime = OneClickFishingRod.minWaitTime.Value; __instance.maxFishTime = OneClickFishingRod.maxWaitTime.Value; } public static List NewCheckBait(int amount, FishingRod fishingRod) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) List list = new List(); Vector3 val = (Vector3)_targetBaitPosition.GetValue(fishingRod); FishingZone val2 = null; Collider[] array = Physics.OverlapSphere(val, 1f); foreach (Collider val3 in array) { if (((Component)val3).CompareTag("FishingZone")) { val2 = ((Component)val3).GetComponent(); break; } } List list2 = new List(); if ((Object)(object)val2 != (Object)null) { list2 = val2.fishes.Where((FishType x) => x.allowFishingRod).ToList(); if (list2.Count > 0) { for (int j = 0; j < list2.Count; j++) { FishType val4 = list2[j]; if (OneClickFishingRod.fishZoneProbabilityMap.ContainsKey(val4.itemSO.itemName)) { val2.probability = OneClickFishingRod.fishZoneProbabilityMap[val4.itemSO.itemName]; } } } } List list3 = new List(); List list4 = new List(); if (OneClickFishingRod.isAddBoneInItem.Value || OneClickFishingRod.isAddStoneInItem.Value) { list3 = Resources.FindObjectsOfTypeAll().ToList(); } if (OneClickFishingRod.isAddStoneInItem.Value && OneClickFishingRod.stoneItem.Count == 0) { foreach (ItemSO item3 in list3) { if (item3.itemName.Contains("stone") && !item3.itemName.Contains("stand")) { ItemSO item = item3; OneClickFishingRod.stoneItem.Add(item); OneClickFishingRod.stoneItem.Add(item); } } list4.AddRange(OneClickFishingRod.stoneItem); } else if (OneClickFishingRod.stoneItem.Count > 0) { list4.AddRange(OneClickFishingRod.stoneItem); } if (OneClickFishingRod.isAddBoneInItem.Value && OneClickFishingRod.boneItem.Count == 0) { foreach (ItemSO item4 in list3) { if (item4.itemName.Contains("bone") || item4.itemName.Contains("leather")) { ItemSO item2 = item4; OneClickFishingRod.boneItem.Add(item2); OneClickFishingRod.boneItem.Add(item2); } } list4.AddRange(OneClickFishingRod.boneItem); } else if (OneClickFishingRod.boneItem.Count > 0) { list4.AddRange(OneClickFishingRod.boneItem); } if (fishingRod.commonItems.Count > 0) { list4.AddRange(fishingRod.commonItems); } list3.Clear(); for (int k = 0; k < amount; k++) { if ((Object)(object)val2 != (Object)null && Random.Range(0f, 100f) <= (float)val2.probability) { if (list2.Count > 0) { int index = Random.Range(0, list2.Count); list.Add(list2[index].itemSO); } } else if (Random.Range(0f, 100f) <= (float)fishingRod.fishProbability) { if (fishingRod.commonFishes.Count > 0) { int index2 = Random.Range(0, fishingRod.commonFishes.Count); list.Add((ItemSO)(object)fishingRod.commonFishes[index2]); } } else if (list4.Count > 0) { int index3 = Random.Range(0, list4.Count); list.Add(list4[index3]); } } return list; } } public class SpawnItem { private static readonly FieldInfo _playerCamera = AccessTools.Field(typeof(PlayerInventory), "playerCamera"); public void spawnItemUnderYourFeet(float xPoint, float yPoint, float zPoint, ItemSO itemSO, PlayerInventory playerInventory) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) //IL_0071: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Camera val = (Camera)_playerCamera.GetValue(playerInventory); Vector3 val2 = ((Component)playerInventory).transform.position + ((Component)val).transform.right * xPoint + ((Component)val).transform.forward * zPoint + new Vector3(0f, yPoint, 0f); Quaternion rotation = ((Component)val).transform.rotation; Quaternion val3 = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f); GameManager.Instance.SpawnItemAtPositionServerRpc(itemSO.id, val2, val3 * itemSO.prefab.transform.rotation, false, ((Component)val).transform.forward, itemSO.amount, -1, -1); } }