Minecraft-Console-Client/MinecraftClient/ChatBots/AutoFishing.cs

644 lines
24 KiB
C#
Raw Normal View History

using System;
2022-10-17 17:42:00 +08:00
using System.Collections.Generic;
2022-10-21 19:05:49 +08:00
using System.Linq;
using System.Text;
using MinecraftClient.Inventory;
using MinecraftClient.Mapping;
2022-10-05 15:02:30 +08:00
using Tomlet.Attributes;
using static MinecraftClient.ChatBots.AutoFishing.Configs;
namespace MinecraftClient.ChatBots
{
/// <summary>
/// The AutoFishing bot semi-automates fishing.
/// The player needs to have a fishing rod in hand, then manually send it using the UseItem command.
/// </summary>
2022-10-05 15:02:30 +08:00
public class AutoFishing : ChatBot
{
2022-10-05 15:02:30 +08:00
public static Configs Config = new();
[TomlDoNotInlineObject]
public class Configs
{
[NonSerialized]
private const string BotName = "AutoFishing";
public bool Enabled = false;
[TomlInlineComment("$ChatBot.AutoFishing.Antidespawn$")]
2022-10-05 15:02:30 +08:00
public bool Antidespawn = false;
[TomlInlineComment("$ChatBot.AutoFishing.Mainhand$")]
2022-10-05 15:02:30 +08:00
public bool Mainhand = true;
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Start$")]
2022-10-05 15:02:30 +08:00
public bool Auto_Start = true;
[TomlInlineComment("$ChatBot.AutoFishing.Cast_Delay$")]
2022-10-05 15:02:30 +08:00
public double Cast_Delay = 0.4;
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Delay$")]
2022-10-05 15:02:30 +08:00
public double Fishing_Delay = 3.0;
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Timeout$")]
2022-10-05 15:02:30 +08:00
public double Fishing_Timeout = 300.0;
[TomlInlineComment("$ChatBot.AutoFishing.Durability_Limit$")]
2022-10-05 15:02:30 +08:00
public double Durability_Limit = 2;
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Rod_Switch$")]
2022-10-05 15:02:30 +08:00
public bool Auto_Rod_Switch = true;
[TomlInlineComment("$ChatBot.AutoFishing.Stationary_Threshold$")]
2022-10-05 15:02:30 +08:00
public double Stationary_Threshold = 0.001;
[TomlInlineComment("$ChatBot.AutoFishing.Hook_Threshold$")]
2022-10-05 15:02:30 +08:00
public double Hook_Threshold = 0.2;
[TomlInlineComment("$ChatBot.AutoFishing.Log_Fish_Bobber$")]
2022-10-05 15:02:30 +08:00
public bool Log_Fish_Bobber = false;
[TomlInlineComment("$ChatBot.AutoFishing.Enable_Move$")]
2022-10-05 20:00:27 +08:00
public bool Enable_Move = false;
[TomlPrecedingComment("$ChatBot.AutoFishing.Movements$")]
2022-10-05 20:00:27 +08:00
public LocationConfig[] Movements = new LocationConfig[]
{
2022-10-06 18:12:32 +08:00
new LocationConfig(12.34, -23.45),
new LocationConfig(123.45, 64, -654.32, -25.14, 36.25),
2022-10-05 20:00:27 +08:00
new LocationConfig(-1245.63, 63.5, 1.2),
};
2022-10-05 15:02:30 +08:00
public void OnSettingUpdate()
{
if (Cast_Delay < 0)
Cast_Delay = 0;
if (Fishing_Delay < 0)
Fishing_Delay = 0;
if (Fishing_Timeout < 0)
Fishing_Timeout = 0;
if (Durability_Limit < 0)
Durability_Limit = 0;
else if (Durability_Limit > 64)
Durability_Limit = 64;
if (Stationary_Threshold < 0)
Stationary_Threshold = -Stationary_Threshold;
if (Hook_Threshold < 0)
Hook_Threshold = -Hook_Threshold;
}
public struct LocationConfig
{
public Coordination? XYZ;
public Facing? facing;
2022-10-06 18:12:32 +08:00
public LocationConfig(double yaw, double pitch)
2022-10-05 15:02:30 +08:00
{
this.XYZ = null;
this.facing = new(yaw, pitch);
}
public LocationConfig(double x, double y, double z)
{
this.XYZ = new(x, y, z);
this.facing = null;
}
2022-10-06 18:12:32 +08:00
public LocationConfig(double x, double y, double z, double yaw, double pitch)
2022-10-05 15:02:30 +08:00
{
this.XYZ = new(x, y, z);
this.facing = new(yaw, pitch);
}
public struct Coordination
{
public double x, y, z;
public Coordination(double x, double y, double z)
{
this.x = x; this.y = y; this.z = z;
}
}
public struct Facing
{
2022-10-06 18:12:32 +08:00
public double yaw, pitch;
2022-10-05 15:02:30 +08:00
2022-10-06 18:12:32 +08:00
public Facing(double yaw, double pitch)
2022-10-05 15:02:30 +08:00
{
this.yaw = yaw; this.pitch = pitch;
}
}
}
}
2022-09-12 02:10:18 +08:00
private int fishCount = 0;
2020-03-26 15:01:42 +08:00
private bool inventoryEnabled;
private int castTimeout = 12;
2022-09-12 02:10:18 +08:00
2022-09-12 18:02:46 +08:00
private bool isFishing = false, isWaitingRod = false;
2022-09-12 02:10:18 +08:00
private Entity? fishingBobber;
private Location LastPos = Location.Zero;
private DateTime CaughtTime = DateTime.Now;
2022-10-21 19:05:49 +08:00
private int fishItemCounter = 15;
private Dictionary<ItemType, uint> fishItemCnt = new();
2022-10-17 20:00:33 +08:00
private Entity fishItem = new(-1, EntityType.Item, Location.Zero);
2022-09-12 02:10:18 +08:00
private int counter = 0;
private readonly object stateLock = new();
private FishingState state = FishingState.WaitJoinGame;
private int curLocationIdx = 0, moveDir = 1;
float nextYaw = 0, nextPitch = 0;
2022-09-12 02:10:18 +08:00
private enum FishingState
{
WaitJoinGame,
WaitingToCast,
CastingRod,
WaitingFishingBobber,
WaitingFishToBite,
2022-09-12 18:02:46 +08:00
StartMove,
WaitingMovement,
DurabilityCheck,
2022-09-12 02:10:18 +08:00
Stopping,
}
public override void Initialize()
{
if (!GetEntityHandlingEnabled())
{
LogToConsole(Translations.extra_entity_required);
2022-09-13 19:29:17 +08:00
state = FishingState.WaitJoinGame;
}
2020-03-26 15:01:42 +08:00
inventoryEnabled = GetInventoryEnabled();
if (!inventoryEnabled)
LogToConsole(Translations.bot_autoFish_no_inv_handle);
2022-10-17 13:50:56 +08:00
RegisterChatBotCommand("fish", Translations.bot_autoFish_cmd, GetHelp(), CommandHandler);
2022-10-17 13:50:56 +08:00
}
public string CommandHandler(string cmd, string[] args)
{
2022-10-21 19:05:49 +08:00
if (args.Length >= 1)
2022-10-17 13:50:56 +08:00
{
switch (args[0])
{
case "start":
isFishing = false;
lock (stateLock)
{
isFishing = false;
counter = 0;
state = FishingState.StartMove;
}
return Translations.bot_autoFish_start;
2022-10-17 13:50:56 +08:00
case "stop":
isFishing = false;
lock (stateLock)
{
isFishing = false;
if (state == FishingState.WaitingFishToBite)
UseFishRod();
state = FishingState.Stopping;
}
StopFishing();
return Translations.bot_autoFish_stop;
2022-10-21 19:05:49 +08:00
case "status":
if (args.Length >= 2)
{
if (args[1] == "clear")
{
fishItemCnt = new();
return Translations.bot_autoFish_status_clear;
2022-10-21 19:05:49 +08:00
}
else
{
return GetCommandHelp("status");
}
}
else
{
if (fishItemCnt.Count == 0)
return Translations.bot_autoFish_status_info;
2022-10-21 19:05:49 +08:00
List<KeyValuePair<ItemType, uint>> orderedList = fishItemCnt.OrderBy(x => x.Value).ToList();
int maxLen = orderedList[^1].Value.ToString().Length;
StringBuilder sb = new();
sb.Append(Translations.bot_autoFish_status_info);
2022-10-21 19:05:49 +08:00
foreach ((ItemType type, uint cnt) in orderedList)
{
sb.Append(Environment.NewLine);
string cntStr = cnt.ToString();
sb.Append(' ', maxLen - cntStr.Length).Append(cntStr);
sb.Append(" x ");
sb.Append(Item.GetTypeString(type));
}
return sb.ToString();
}
2022-10-17 13:50:56 +08:00
case "help":
return GetCommandHelp(args.Length >= 2 ? args[1] : "");
default:
return GetHelp();
}
}
2022-10-21 19:05:49 +08:00
else
return GetHelp();
}
private void StartFishing()
2022-09-12 02:10:18 +08:00
{
isFishing = false;
2022-10-05 15:02:30 +08:00
if (Config.Auto_Start)
2022-09-12 02:10:18 +08:00
{
2022-10-05 15:02:30 +08:00
double delay = Config.Fishing_Delay;
LogToConsole(string.Format(Translations.bot_autoFish_start_at, delay));
lock (stateLock)
{
2022-10-17 13:50:56 +08:00
isFishing = false;
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(delay);
state = FishingState.StartMove;
}
}
else
{
lock (stateLock)
{
state = FishingState.WaitJoinGame;
}
2022-09-12 02:10:18 +08:00
}
}
private void StopFishing()
{
isFishing = false;
lock (stateLock)
{
2022-10-17 13:50:56 +08:00
isFishing = false;
state = FishingState.Stopping;
}
2022-10-21 19:05:49 +08:00
fishItemCounter = 15;
}
2022-09-12 18:02:46 +08:00
private void UseFishRod()
{
2022-10-05 15:02:30 +08:00
if (Config.Mainhand)
2022-09-12 18:02:46 +08:00
UseItemInHand();
else
UseItemInLeftHand();
}
2020-05-22 08:58:30 +08:00
public override void Update()
{
2022-10-21 19:05:49 +08:00
if (fishItemCounter < 15)
2022-10-17 17:42:00 +08:00
++fishItemCounter;
2022-10-21 19:05:49 +08:00
2022-09-12 02:10:18 +08:00
lock (stateLock)
2020-05-22 08:58:30 +08:00
{
2022-09-12 02:10:18 +08:00
switch (state)
2020-05-22 08:58:30 +08:00
{
2022-09-12 02:10:18 +08:00
case FishingState.WaitJoinGame:
break;
case FishingState.WaitingToCast:
if (AutoEat.Eating)
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
else if (--counter < 0)
2022-09-12 02:10:18 +08:00
state = FishingState.CastingRod;
break;
case FishingState.CastingRod:
UseFishRod();
counter = 0;
state = FishingState.WaitingFishingBobber;
break;
case FishingState.WaitingFishingBobber:
if (++counter > castTimeout)
{
if (castTimeout < 6000)
castTimeout *= 2; // Exponential backoff
LogToConsole(GetShortTimestamp() + ": " + string.Format(Translations.bot_autoFish_cast_timeout, castTimeout / 10.0));
2022-09-12 02:10:18 +08:00
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
2022-09-12 02:10:18 +08:00
state = FishingState.WaitingToCast;
}
break;
case FishingState.WaitingFishToBite:
2022-10-08 17:56:32 +08:00
if (++counter > Settings.DoubleToTick(Config.Fishing_Timeout))
2022-09-12 02:10:18 +08:00
{
LogToConsole(GetShortTimestamp() + ": " + Translations.bot_autoFish_fishing_timeout);
2022-09-12 02:10:18 +08:00
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
2022-09-12 02:10:18 +08:00
state = FishingState.WaitingToCast;
}
break;
2022-09-12 18:02:46 +08:00
case FishingState.StartMove:
if (--counter < 0)
{
2022-10-05 20:00:27 +08:00
if (Config.Enable_Move && Config.Movements.Length > 0)
2022-09-12 18:02:46 +08:00
{
if (GetTerrainEnabled())
{
2022-10-05 15:02:30 +08:00
UpdateLocation(Config.Movements);
state = FishingState.WaitingMovement;
}
else
{
LogToConsole(Translations.extra_terrainandmovement_required);
state = FishingState.WaitJoinGame;
}
2022-09-12 18:02:46 +08:00
}
else
{
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
2022-09-12 18:02:46 +08:00
state = FishingState.DurabilityCheck;
goto case FishingState.DurabilityCheck;
}
}
break;
2022-09-12 18:02:46 +08:00
case FishingState.WaitingMovement:
if (!ClientIsMoving())
{
LookAtLocation(nextYaw, nextPitch);
LogToConsole(string.Format(Translations.bot_autoFish_update_lookat, nextYaw, nextPitch));
2022-09-12 18:02:46 +08:00
state = FishingState.DurabilityCheck;
goto case FishingState.DurabilityCheck;
}
break;
case FishingState.DurabilityCheck:
if (DurabilityCheck())
{
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
state = FishingState.WaitingToCast;
}
2022-09-12 02:10:18 +08:00
break;
case FishingState.Stopping:
break;
2020-05-22 08:58:30 +08:00
}
}
}
public override void OnEntitySpawn(Entity entity)
{
2022-10-21 19:05:49 +08:00
if (fishItemCounter < 15 && entity.Type == EntityType.Item && Math.Abs(entity.Location.Y - LastPos.Y) < 2.2 &&
Math.Abs(entity.Location.X - LastPos.X) < 0.12 && Math.Abs(entity.Location.Z - LastPos.Z) < 0.12)
2022-10-17 17:42:00 +08:00
{
if (Config.Log_Fish_Bobber)
LogToConsole(string.Format("Item ({0}) spawn at {1}, distance = {2:0.00}", entity.ID, entity.Location, entity.Location.Distance(LastPos)));
2022-10-17 20:00:33 +08:00
fishItem = entity;
2022-10-17 17:42:00 +08:00
}
else if (entity.Type == EntityType.FishingBobber && entity.ObjectData == GetPlayerEntityID())
{
2022-10-05 15:02:30 +08:00
if (Config.Log_Fish_Bobber)
2022-09-13 19:25:00 +08:00
LogToConsole(string.Format("FishingBobber spawn at {0}, distance = {1:0.00}", entity.Location, GetCurrentLocation().Distance(entity.Location)));
2022-10-21 19:05:49 +08:00
fishItemCounter = 15;
2022-10-17 17:42:00 +08:00
LogToConsole(GetShortTimestamp() + ": " + Translations.bot_autoFish_throw);
2022-09-12 02:10:18 +08:00
lock (stateLock)
{
2022-09-12 02:10:18 +08:00
fishingBobber = entity;
LastPos = entity.Location;
isFishing = true;
2022-09-12 02:10:18 +08:00
castTimeout = 24;
counter = 0;
state = FishingState.WaitingFishToBite;
}
}
}
public override void OnEntityDespawn(Entity entity)
{
2022-10-21 19:05:49 +08:00
if (entity != null && fishingBobber != null && entity.Type == EntityType.FishingBobber && entity.ID == fishingBobber!.ID)
{
2022-10-05 15:02:30 +08:00
if (Config.Log_Fish_Bobber)
2022-09-13 19:25:00 +08:00
LogToConsole(string.Format("FishingBobber despawn at {0}", entity.Location));
2022-09-12 02:10:18 +08:00
2022-09-13 19:25:00 +08:00
if (isFishing)
{
2022-09-13 19:25:00 +08:00
isFishing = false;
2022-09-12 02:10:18 +08:00
2022-10-05 15:02:30 +08:00
if (Config.Antidespawn)
2020-05-22 08:58:30 +08:00
{
LogToConsole(Translations.bot_autoFish_despawn);
2022-09-13 19:25:00 +08:00
lock (stateLock)
{
2022-10-08 17:56:32 +08:00
counter = Settings.DoubleToTick(Config.Cast_Delay);
2022-09-13 19:25:00 +08:00
state = FishingState.WaitingToCast;
}
2020-05-22 08:58:30 +08:00
}
}
}
}
public override void OnEntityMove(Entity entity)
{
2022-10-17 17:42:00 +08:00
if (isFishing && entity != null && fishingBobber!.ID == entity.ID &&
(state == FishingState.WaitingFishToBite || state == FishingState.WaitingFishingBobber))
{
2022-09-12 02:10:18 +08:00
Location Pos = entity.Location;
double Dx = LastPos.X - Pos.X;
double Dy = LastPos.Y - Pos.Y;
double Dz = LastPos.Z - Pos.Z;
LastPos = Pos;
2022-10-05 15:02:30 +08:00
if (Config.Log_Fish_Bobber)
2022-09-13 19:25:00 +08:00
LogToConsole(string.Format("FishingBobber {0} Dx={1:0.000000} Dy={2:0.000000} Dz={3:0.000000}", Pos, Dx, Math.Abs(Dy), Dz));
2022-10-05 15:02:30 +08:00
if (Math.Abs(Dx) < Math.Abs(Config.Stationary_Threshold) &&
Math.Abs(Dz) < Math.Abs(Config.Stationary_Threshold) &&
Math.Abs(Dy) > Math.Abs(Config.Hook_Threshold))
{
2022-09-13 19:25:00 +08:00
// prevent triggering multiple time
if ((DateTime.Now - CaughtTime).TotalSeconds > 1)
{
2022-09-13 19:25:00 +08:00
isFishing = false;
CaughtTime = DateTime.Now;
OnCaughtFish();
}
}
}
}
2020-12-30 21:43:37 +08:00
2022-10-17 17:42:00 +08:00
public override void OnEntityMetadata(Entity entity, Dictionary<int, object?> metadata)
{
2022-10-21 19:05:49 +08:00
if (fishItemCounter < 15 && entity.ID == fishItem.ID && metadata.TryGetValue(8, out object? itemObj))
2022-10-17 17:42:00 +08:00
{
2022-10-21 19:05:49 +08:00
fishItemCounter = 15;
Item item = (Item)itemObj!;
LogToConsole(string.Format(Translations.bot_autoFish_got, item.ToFullString()));
2022-10-21 19:05:49 +08:00
if (fishItemCnt.ContainsKey(item.Type))
fishItemCnt[item.Type] += (uint)item.Count;
else
fishItemCnt.Add(item.Type, (uint)item.Count);
2022-10-17 17:42:00 +08:00
}
}
2022-09-12 18:02:46 +08:00
public override void AfterGameJoined()
{
StartFishing();
}
public override void OnRespawn()
{
StartFishing();
}
public override void OnDeath()
2020-12-30 21:43:37 +08:00
{
StopFishing();
}
2022-09-12 02:10:18 +08:00
public override bool OnDisconnect(DisconnectReason reason, string message)
{
StopFishing();
2022-09-12 02:10:18 +08:00
fishingBobber = null;
LastPos = Location.Zero;
2020-12-30 21:43:37 +08:00
CaughtTime = DateTime.Now;
2022-09-12 02:10:18 +08:00
2020-12-30 21:43:37 +08:00
return base.OnDisconnect(reason, message);
}
2022-09-12 18:02:46 +08:00
/// <summary>
/// Called when detected a fish is caught
/// </summary>
public void OnCaughtFish()
2022-09-12 02:10:18 +08:00
{
2022-09-12 18:02:46 +08:00
++fishCount;
2022-10-05 20:00:27 +08:00
if (Config.Enable_Move && Config.Movements.Length > 0)
LogToConsole(GetShortTimestamp() + ": " + string.Format(Translations.bot_autoFish_caught_at,
2022-09-12 18:02:46 +08:00
fishingBobber!.Location.X, fishingBobber!.Location.Y, fishingBobber!.Location.Z, fishCount));
2022-09-12 02:19:20 +08:00
else
LogToConsole(GetShortTimestamp() + ": " + string.Format(Translations.bot_autoFish_caught, fishCount));
2022-09-12 18:02:46 +08:00
lock (stateLock)
{
counter = 0;
state = FishingState.StartMove;
2022-10-17 17:42:00 +08:00
fishItemCounter = 0;
UseFishRod();
2022-09-12 18:02:46 +08:00
}
}
2022-10-05 15:02:30 +08:00
private void UpdateLocation(LocationConfig[] locationList)
{
2022-10-05 15:02:30 +08:00
if (curLocationIdx >= locationList.Length)
2022-09-12 02:10:18 +08:00
{
2022-10-05 15:02:30 +08:00
curLocationIdx = Math.Max(0, locationList.Length - 2);
moveDir = -1;
}
else if (curLocationIdx < 0)
{
2022-10-05 15:02:30 +08:00
curLocationIdx = Math.Min(locationList.Length - 1, 1);
moveDir = 1;
2022-09-12 02:10:18 +08:00
}
2022-10-05 15:02:30 +08:00
LocationConfig curConfig = locationList[curLocationIdx];
2022-09-12 02:10:18 +08:00
2022-10-05 15:02:30 +08:00
if (curConfig.facing != null)
2022-10-06 18:12:32 +08:00
(nextYaw, nextPitch) = ((float)curConfig.facing.Value.yaw, (float)curConfig.facing.Value.pitch);
2022-10-05 15:02:30 +08:00
else
(nextYaw, nextPitch) = (GetYaw(), GetPitch());
2022-09-12 02:10:18 +08:00
2022-10-05 15:02:30 +08:00
if (curConfig.XYZ != null)
{
Location current = GetCurrentLocation();
2022-10-05 15:02:30 +08:00
Location goal = new(curConfig.XYZ.Value.x, curConfig.XYZ.Value.y, curConfig.XYZ.Value.z);
bool isMoveSuccessed;
if (!Movement.CheckChunkLoading(GetWorld(), current, goal))
{
isMoveSuccessed = false;
LogToConsole(string.Format(Translations.cmd_move_chunk_not_loaded, goal.X, goal.Y, goal.Z));
}
else
{
isMoveSuccessed = MoveToLocation(goal, allowUnsafe: false, allowDirectTeleport: false);
}
if (!isMoveSuccessed)
{
2022-10-05 15:02:30 +08:00
(nextYaw, nextPitch) = (GetYaw(), GetPitch());
LogToConsole(string.Format(Translations.cmd_move_fail, goal));
}
else
{
LogToConsole(string.Format(Translations.cmd_move_walk, goal, current));
}
}
curLocationIdx += moveDir;
}
2022-09-12 18:02:46 +08:00
private bool DurabilityCheck()
{
2022-09-12 18:02:46 +08:00
if (!inventoryEnabled)
return true;
2022-10-05 15:02:30 +08:00
bool useMainHand = Config.Mainhand;
2022-09-12 18:02:46 +08:00
Container container = GetPlayerInventory();
2022-09-12 18:02:46 +08:00
int itemSolt = useMainHand ? GetCurrentSlot() + 36 : 45;
2022-09-12 02:10:18 +08:00
2022-09-12 18:02:46 +08:00
if (container.Items.TryGetValue(itemSolt, out Item? handItem) &&
2022-10-05 15:02:30 +08:00
handItem.Type == ItemType.FishingRod && (64 - handItem.Damage) >= Config.Durability_Limit)
{
2022-09-12 18:02:46 +08:00
isWaitingRod = false;
return true;
}
else
{
2022-09-12 18:02:46 +08:00
if (!isWaitingRod)
LogToConsole(GetTimestamp() + ": " + Translations.bot_autoFish_no_rod);
2022-09-12 18:02:46 +08:00
2022-10-05 15:02:30 +08:00
if (Config.Auto_Rod_Switch)
{
2022-09-12 18:02:46 +08:00
foreach ((int slot, Item item) in container.Items)
{
2022-10-05 15:02:30 +08:00
if (item.Type == ItemType.FishingRod && (64 - item.Damage) >= Config.Durability_Limit)
2022-09-12 18:02:46 +08:00
{
WindowAction(0, slot, WindowActionType.LeftClick);
WindowAction(0, itemSolt, WindowActionType.LeftClick);
WindowAction(0, slot, WindowActionType.LeftClick);
LogToConsole(GetTimestamp() + ": " + string.Format(Translations.bot_autoFish_switch, slot, (64 - item.Damage)));
2022-09-12 18:02:46 +08:00
isWaitingRod = false;
return true;
}
}
}
2022-09-12 18:02:46 +08:00
isWaitingRod = true;
return false;
2020-03-26 15:01:42 +08:00
}
}
2022-10-17 13:50:56 +08:00
private static string GetHelp()
{
return string.Format(Translations.bot_autoFish_available_cmd, "start, stop, status, help");
2022-10-17 13:50:56 +08:00
}
private string GetCommandHelp(string cmd)
{
return cmd.ToLower() switch
{
#pragma warning disable format // @formatter:off
"start" => Translations.bot_autoFish_help_start,
"stop" => Translations.bot_autoFish_help_stop,
"status" => Translations.bot_autoFish_help_status,
"help" => Translations.bot_autoFish_help_help,
2022-10-21 19:05:49 +08:00
_ => GetHelp(),
2022-10-17 13:50:56 +08:00
#pragma warning restore format // @formatter:on
};
}
}
}