Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update 自动钓鱼v1.3.1 修复单体召唤物bug,加入了“随机物品”配置项。 #559

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/AutoFish/AutoFish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AutoFish : TerrariaPlugin
#region 插件信息
public override string Name => "自动钓鱼";
public override string Author => "羽学 少司命";
public override Version Version => new Version(1, 3, 0);
public override Version Version => new Version(1, 3, 1);
public override string Description => "涡轮增压不蒸鸭";
#endregion

Expand Down Expand Up @@ -191,6 +191,14 @@ private static void ControlFishing(ProjectileAiUpdateEventArgs args, TSPlayer pl
// 执行钓鱼检查
args.Projectile.FishingCheck();

//随机物品
if (Config.Random)
{
var rm = new Random();
var id = rm.Next(1, ItemID.Count - 1);
args.Projectile.localAI[1] = id;
}

// 将localAI[1]的值复制到ai[1]
args.Projectile.ai[1] = args.Projectile.localAI[1];

Expand Down
10 changes: 8 additions & 2 deletions src/AutoFish/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ namespace AutoFish;
internal class Configuration
{
#region 实例变量
[JsonProperty("插件开关", Order = -12)]
[JsonProperty("插件开关", Order = -13)]
public bool Enabled { get; set; } = true;

[JsonProperty("多钩钓鱼", Order = -11)]
[JsonProperty("多钩钓鱼", Order = -12)]
public bool MoreHook { get; set; } = true;

[JsonProperty("随机物品", Order = -11)]
public bool Random { get; set; } = false;

[JsonProperty("多钩上限", Order = -10)]
public int HookMax { get; set; } = 5;

Expand All @@ -38,6 +41,9 @@ internal class Configuration

[JsonProperty("额外渔获", Order = -1)]
public List<int> DoorItems = new();

[JsonProperty("禁止衍生弹幕", Order = 10)]
public int[] DisableProjectile { get; set; } = new int[] { 623, 625, 626, 627, 628, 831, 832, 833, 834, 835, 963, 970 };
#endregion

#region 预设参数方法
Expand Down
20 changes: 20 additions & 0 deletions src/AutoFish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
## 更新日志

```
v1.3.1
修复了在多钩钓鱼模式下,单体召唤物衍生更多数量BUG
并加了一个配置项来禁止它们"禁止衍生弹幕"。
加入了随机物品配置项,开启时会随机钓到任意物品。

v1.3.0
修复了首选鱼饵不会消失,变成无限饵,或卡线程BUG
修改了额外渔获也能与其他环境已存在的物品一起上钩
Expand Down Expand Up @@ -69,6 +74,7 @@ v1.0.0
{
"插件开关": true, //全局插件开关
"多钩钓鱼": true, //为自动钓鱼开启连发模式,让钓鱼效率更高
"随机物品": false, //随机钓出任意物品
"多钩上限": 5, //定义最多可以多少鱼钩同时自动钓
"广告开关": true, //下面这条字符串的开关
"广告内容": "\n[i:3456][C/F2F2C7:插件开发] [C/BFDFEA:by] [c/00FFFF:羽学] | [c/7CAEDD:少司命][i:3459]", //可自定义的字符串内容
Expand All @@ -91,6 +97,20 @@ v1.0.0
29,
3093,
4345
],
"禁止衍生弹幕": [
623, //用于解决在多线钓鱼的模式下,单体召唤物会衍生更多数量的BUG
625,
626,
627,
628,
831,
832,
833,
834,
835,
963,
970
]
}
```
Expand Down
16 changes: 16 additions & 0 deletions src/AutoFish/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Attempted: Triggering the reel-in effect by changing AI[0] to 1, but unable to o
{
"插件开关": true, // Global plugin switch
"多钩钓鱼": true, // Enable multi-hook mode for automatic fishing to increase efficiency
"随机物品": false, // Randomly fish out any item
"多钩上限": 5, // Define the maximum number of hooks that can fish simultaneously
"广告开关": true, // Switch for the following string
"广告内容": "\n[i:3456][C/F2F2C7:Plugin Development] [C/BFDFEA:by] [c/00FFFF:Yu Xue] | [c/7CAEDD:Shao Siming][i:3459]", // Customizable string content
Expand All @@ -91,7 +92,22 @@ Attempted: Triggering the reel-in effect by changing AI[0] to 1, but unable to o
29,
3093,
4345
],
"禁止衍生弹幕": [
623, // To solve the BUG where single summon creatures spawn more numbers under multi-hook mode
625,
626,
627,
628,
831,
832,
833,
834,
835,
963,
970
]

}
```

Expand Down
11 changes: 11 additions & 0 deletions src/AutoFish/Utils/SpawnProjectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ public static int NewProjectile(IEntitySource spawnSource, float X, float Y, flo
{
projectile.timeLeft = timeLeft;
}

//排除单体召唤物:星尘守卫、星尘龙、沙漠虎、阿比盖尔的弹幕
if (AutoFish.Config.DisableProjectile.Contains(Type))
{
timeLeft = 0;
projectile.frame = 0;
projectile.timeLeft = -1;
projectile.active = false;
return 0;
}

projectile.miscText = uuid;
return num;
}
Expand Down
Loading