Update translations

This commit is contained in:
BruceChen 2022-10-06 18:12:32 +08:00
parent bdcc22b465
commit e44192ab7b
12 changed files with 160 additions and 132 deletions

View file

@ -21,7 +21,7 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.AntiAfk.Delay$")]
public Range Delay = new(600);
public Range Delay = new(60);
[TomlInlineComment("$config.ChatBot.AntiAfk.Command$")]
public string Command = "/ping";
@ -35,6 +35,9 @@ namespace MinecraftClient.ChatBots
[TomlInlineComment("$config.ChatBot.AntiAfk.Walk_Retries$")]
public int Walk_Retries = 20;
[NonSerialized]
public int _DelayMin, _DelayMax;
public void OnSettingUpdate()
{
if (Walk_Range <= 0)
@ -43,8 +46,11 @@ namespace MinecraftClient.ChatBots
LogToConsole(BotName, Translations.TryGet("bot.antiafk.invalid_walk_range"));
}
Delay.min = Math.Max(10, Delay.min);
Delay.max = Math.Max(10, Delay.max);
Delay.min = Math.Max(1.0, Delay.min);
Delay.max = Math.Max(1.0, Delay.max);
Delay.min = Math.Min(int.MaxValue / 10, Delay.min);
Delay.max = Math.Min(int.MaxValue / 10, Delay.max);
if (Delay.min > Delay.max)
{
@ -52,12 +58,15 @@ namespace MinecraftClient.ChatBots
LogToConsole(BotName, Translations.TryGet("bot.antiafk.swapping"));
}
_DelayMin = (int)Math.Round(Delay.min * 10);
_DelayMax = (int)Math.Round(Delay.max * 10);
Command ??= string.Empty;
}
public struct Range
{
public int min, max;
public double min, max;
public Range(int value)
{
@ -99,7 +108,7 @@ namespace MinecraftClient.ChatBots
{
count++;
if (count == random.Next(Config.Delay.min, Config.Delay.max))
if (count == random.Next(Config._DelayMin, Config._DelayMax))
{
DoAntiAfkStuff();
count = 0;

View file

@ -22,7 +22,6 @@ namespace MinecraftClient.ChatBots
[TomlInlineComment("$config.ChatBot.AutoDrop.Mode$")]
public DropMode Mode = DropMode.include;
[TomlInlineComment("$config.ChatBot.AutoDrop.Items$")]
public List<ItemType> Items = new() { ItemType.Cobblestone, ItemType.Dirt };
public void OnSettingUpdate() { }

View file

@ -61,8 +61,8 @@ namespace MinecraftClient.ChatBots
[TomlPrecedingComment("$config.ChatBot.AutoFishing.Movements$")]
public LocationConfig[] Movements = new LocationConfig[]
{
new LocationConfig(12.34f, -23.45f),
new LocationConfig(123.45, 64, -654.32, -25.14f, 36.25f),
new LocationConfig(12.34, -23.45),
new LocationConfig(123.45, 64, -654.32, -25.14, 36.25),
new LocationConfig(-1245.63, 63.5, 1.2),
};
@ -94,7 +94,7 @@ namespace MinecraftClient.ChatBots
public Coordination? XYZ;
public Facing? facing;
public LocationConfig(float yaw, float pitch)
public LocationConfig(double yaw, double pitch)
{
this.XYZ = null;
this.facing = new(yaw, pitch);
@ -106,7 +106,7 @@ namespace MinecraftClient.ChatBots
this.facing = null;
}
public LocationConfig(double x, double y, double z, float yaw, float pitch)
public LocationConfig(double x, double y, double z, double yaw, double pitch)
{
this.XYZ = new(x, y, z);
this.facing = new(yaw, pitch);
@ -124,9 +124,9 @@ namespace MinecraftClient.ChatBots
public struct Facing
{
public float yaw, pitch;
public double yaw, pitch;
public Facing(float yaw, float pitch)
public Facing(double yaw, double pitch)
{
this.yaw = yaw; this.pitch = pitch;
}
@ -437,7 +437,7 @@ namespace MinecraftClient.ChatBots
LocationConfig curConfig = locationList[curLocationIdx];
if (curConfig.facing != null)
(nextYaw, nextPitch) = (curConfig.facing.Value.yaw, curConfig.facing.Value.pitch);
(nextYaw, nextPitch) = ((float)curConfig.facing.Value.yaw, (float)curConfig.facing.Value.pitch);
else
(nextYaw, nextPitch) = (GetYaw(), GetPitch());

View file

@ -19,7 +19,7 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.AutoRelog.Delay$")]
public Range Delay = new(10);
public Range Delay = new(3);
[TomlInlineComment("$config.ChatBot.AutoRelog.Retries$")]
public int Retries = 3;
@ -30,13 +30,23 @@ namespace MinecraftClient.ChatBots
[TomlPrecedingComment("$config.ChatBot.AutoRelog.Kick_Messages$")]
public string[] Kick_Messages = new string[] { "Connection has been lost", "Server is restarting", "Server is full", "Too Many people" };
[NonSerialized]
public int _DelayMin, _DelayMax;
public void OnSettingUpdate()
{
Delay.min = Math.Max(1, Delay.min);
Delay.max = Math.Max(1, Delay.max);
Delay.min = Math.Max(0.1, Delay.min);
Delay.max = Math.Max(0.1, Delay.max);
Delay.min = Math.Min(int.MaxValue / 10, Delay.min);
Delay.max = Math.Min(int.MaxValue / 10, Delay.max);
if (Delay.min > Delay.max)
(Delay.min, Delay.max) = (Delay.max, Delay.min);
_DelayMin = (int)Math.Round(Delay.min * 10);
_DelayMax = (int)Math.Round(Delay.max * 10);
if (Retries == -1)
Retries = int.MaxValue;
@ -47,7 +57,7 @@ namespace MinecraftClient.ChatBots
public struct Range
{
public int min, max;
public double min, max;
public Range(int value)
{
@ -120,7 +130,7 @@ namespace MinecraftClient.ChatBots
private void LaunchDelayedReconnection(string? msg)
{
int delay = random.Next(Config.Delay.min, Config.Delay.max);
int delay = random.Next(Config._DelayMin, Config._DelayMax);
LogDebugToConsoleTranslated(String.IsNullOrEmpty(msg) ? "bot.autoRelog.reconnect_always" : "bot.autoRelog.reconnect", msg);
LogToConsoleTranslated("bot.autoRelog.wait", delay);
System.Threading.Thread.Sleep(delay * 1000);

View file

@ -18,7 +18,7 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.FollowPlayer.Update_Limit$")]
public int Update_Limit = 10;
public double Update_Limit = 1;
[TomlInlineComment("$config.ChatBot.FollowPlayer.Stop_At_Distance$")]
public double Stop_At_Distance = 3.0;
@ -113,7 +113,7 @@ namespace MinecraftClient.ChatBots
public override void OnEntityMove(Entity entity)
{
if (_updateCounter < Config.Update_Limit)
if (_updateCounter < (int)(Config.Update_Limit * 10))
return;
_updateCounter = 0;

View file

@ -23,14 +23,14 @@ namespace MinecraftClient.ChatBots
public string File = "playerlog.txt";
[TomlInlineComment("$config.ChatBot.PlayerListLogger.Delay$")]
public int Delay = 600;
public double Delay = 60;
public void OnSettingUpdate()
{
File ??= string.Empty;
if (Delay < 10)
Delay = 10;
if (Delay < 1.0)
Delay = 1.0;
}
}
@ -39,7 +39,7 @@ namespace MinecraftClient.ChatBots
public override void Update()
{
count++;
if (count == Config.Delay)
if (count == (int)(Config.Delay * 10))
{
DateTime now = DateTime.Now;