Fix AutoRelog

This commit is contained in:
BruceChen 2022-10-12 13:03:57 +08:00
parent dee085686f
commit d222d5f683
10 changed files with 16 additions and 16 deletions

View file

@ -129,10 +129,10 @@ namespace MinecraftClient.ChatBots
private void LaunchDelayedReconnection(string? msg) private void LaunchDelayedReconnection(string? msg)
{ {
int delay = random.Next(Settings.DoubleToTick(Config.Delay.min), Settings.DoubleToTick(Config.Delay.max)); double delay = random.NextDouble() * (Config.Delay.max - Config.Delay.min) + Config.Delay.min;
LogDebugToConsoleTranslated(String.IsNullOrEmpty(msg) ? "bot.autoRelog.reconnect_always" : "bot.autoRelog.reconnect", msg); LogDebugToConsoleTranslated(string.IsNullOrEmpty(msg) ? "bot.autoRelog.reconnect_always" : "bot.autoRelog.reconnect", msg);
LogToConsoleTranslated("bot.autoRelog.wait", delay); LogToConsoleTranslated("bot.autoRelog.wait", delay);
System.Threading.Thread.Sleep(delay * 1000); System.Threading.Thread.Sleep((int)Math.Floor(delay * 1000));
ReconnectToTheServer(); ReconnectToTheServer();
} }

View file

@ -18,7 +18,7 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false; public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.FollowPlayer.Update_Limit$")] [TomlInlineComment("$config.ChatBot.FollowPlayer.Update_Limit$")]
public double Update_Limit = 1; public double Update_Limit = 1.5;
[TomlInlineComment("$config.ChatBot.FollowPlayer.Stop_At_Distance$")] [TomlInlineComment("$config.ChatBot.FollowPlayer.Stop_At_Distance$")]
public double Stop_At_Distance = 3.0; public double Stop_At_Distance = 3.0;

View file

@ -21,7 +21,7 @@ namespace MinecraftClient.ChatBots
public bool Enabled = false; public bool Enabled = false;
[TomlInlineComment("$config.ChatBot.ReplayCapture.Backup_Interval$")] [TomlInlineComment("$config.ChatBot.ReplayCapture.Backup_Interval$")]
public int Backup_Interval = 3000; public double Backup_Interval = 300.0;
public void OnSettingUpdate() public void OnSettingUpdate()
{ {
@ -38,7 +38,7 @@ namespace MinecraftClient.ChatBots
SetNetworkPacketEventEnabled(true); SetNetworkPacketEventEnabled(true);
replay = new ReplayHandler(GetProtocolVersion()); replay = new ReplayHandler(GetProtocolVersion());
replay.MetaData.serverName = GetServerHost() + GetServerPort(); replay.MetaData.serverName = GetServerHost() + GetServerPort();
backupCounter = Config.Backup_Interval * 10; backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
RegisterChatBotCommand("replay", Translations.Get("bot.replayCapture.cmd"), "replay <save|stop>", Command); RegisterChatBotCommand("replay", Translations.Get("bot.replayCapture.cmd"), "replay <save|stop>", Command);
} }
@ -55,7 +55,7 @@ namespace MinecraftClient.ChatBots
if (backupCounter <= 0) if (backupCounter <= 0)
{ {
replay.CreateBackupReplay(@"recording_cache\REPLAY_BACKUP.mcpr"); replay.CreateBackupReplay(@"recording_cache\REPLAY_BACKUP.mcpr");
backupCounter = Config.Backup_Interval * 10; backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
} }
else backupCounter--; else backupCounter--;
} }

View file

@ -528,7 +528,7 @@ bot.autoRelog.disconnect_msg=Verbindung wurde mit folgender Nachricht unterbroch
bot.autoRelog.reconnect_always=Ignoriere Kick Nachricht und verbinde erneut. bot.autoRelog.reconnect_always=Ignoriere Kick Nachricht und verbinde erneut.
bot.autoRelog.reconnect=Nachricht enhält '{0}'. Verbinde erneut. bot.autoRelog.reconnect=Nachricht enhält '{0}'. Verbinde erneut.
bot.autoRelog.reconnect_ignore=Kick Nachricht enthält keine Schlüsselwörter. Wird ignoriert! bot.autoRelog.reconnect_ignore=Kick Nachricht enthält keine Schlüsselwörter. Wird ignoriert!
bot.autoRelog.wait=Warte {0} Sekunden vor erneuter Verbindung... bot.autoRelog.wait=Warte {0:0.000} Sekunden vor erneuter Verbindung...
# AutoRespond # AutoRespond
bot.autoRespond.loading=Loading matches from '{0}' bot.autoRespond.loading=Loading matches from '{0}'

View file

@ -548,7 +548,7 @@ bot.autoRelog.disconnect_msg=Got disconnected with message: {0}
bot.autoRelog.reconnect_always=Ignoring kick message, reconnecting anyway. bot.autoRelog.reconnect_always=Ignoring kick message, reconnecting anyway.
bot.autoRelog.reconnect=Message contains '{0}'. Reconnecting. bot.autoRelog.reconnect=Message contains '{0}'. Reconnecting.
bot.autoRelog.reconnect_ignore=Message not containing any defined keywords. Ignoring. bot.autoRelog.reconnect_ignore=Message not containing any defined keywords. Ignoring.
bot.autoRelog.wait=Waiting {0} seconds before reconnecting... bot.autoRelog.wait=Waiting {0:0.000} seconds before reconnecting...
# AutoRespond # AutoRespond
bot.autoRespond.loading=Loading matches from '{0}' bot.autoRespond.loading=Loading matches from '{0}'

View file

@ -528,7 +528,7 @@ bot.autoRelog.disconnect_msg=Déconnection détectée avec le message : {0}
bot.autoRelog.reconnect_always=Reconnexion quel que soit le contenu du message de kick. bot.autoRelog.reconnect_always=Reconnexion quel que soit le contenu du message de kick.
bot.autoRelog.reconnect=Le message contient '{0}'. Reconnexion. bot.autoRelog.reconnect=Le message contient '{0}'. Reconnexion.
bot.autoRelog.reconnect_ignore=Le message ne contient aucun des mots clés définis. Pas de reconnexion automatique. bot.autoRelog.reconnect_ignore=Le message ne contient aucun des mots clés définis. Pas de reconnexion automatique.
bot.autoRelog.wait=Attente de {0} secondes avant de se reconnecter... bot.autoRelog.wait=Attente de {0:0.000} secondes avant de se reconnecter...
# AutoRespond # AutoRespond
bot.autoRespond.loading=Chargement des règles depuis '{0}' bot.autoRespond.loading=Chargement des règles depuis '{0}'

View file

@ -528,7 +528,7 @@ bot.autoRelog.disconnect_msg=Произошло отключение с сооб
bot.autoRelog.reconnect_always=Игнорирует сообщение о пинке, все равно переподключается. bot.autoRelog.reconnect_always=Игнорирует сообщение о пинке, все равно переподключается.
bot.autoRelog.reconnect=Сообщение содержит '{0}'. Переподключаемся. bot.autoRelog.reconnect=Сообщение содержит '{0}'. Переподключаемся.
bot.autoRelog.reconnect_ignore=Сообщение не содержит определенных ключевых слов. Игнорирование. bot.autoRelog.reconnect_ignore=Сообщение не содержит определенных ключевых слов. Игнорирование.
bot.autoRelog.wait=Ожидание {0} секунд перед переподключением... bot.autoRelog.wait=Ожидание {0:0.000} секунд перед переподключением...
# AutoRespond # AutoRespond
bot.autoRespond.loading=Загрузка совпадений из '{0}' bot.autoRespond.loading=Загрузка совпадений из '{0}'

View file

@ -528,7 +528,7 @@ bot.autoRelog.disconnect_msg=Got disconnected with message: {0}
bot.autoRelog.reconnect_always=Ignoring kick message, reconnecting anyway. bot.autoRelog.reconnect_always=Ignoring kick message, reconnecting anyway.
bot.autoRelog.reconnect=Message contains '{0}'. Reconnecting. bot.autoRelog.reconnect=Message contains '{0}'. Reconnecting.
bot.autoRelog.reconnect_ignore=Message not containing any defined keywords. Ignoring. bot.autoRelog.reconnect_ignore=Message not containing any defined keywords. Ignoring.
bot.autoRelog.wait=Waiting {0} seconds before reconnecting... bot.autoRelog.wait=Waiting {0:0.000} seconds before reconnecting...
# AutoRespond # AutoRespond
bot.autoRespond.loading=Loading matches from '{0}' bot.autoRespond.loading=Loading matches from '{0}'

View file

@ -325,7 +325,7 @@ cmd.inventory.damage=武器伤害值
cmd.inventory.left= cmd.inventory.left=
cmd.inventory.right= cmd.inventory.right=
cmd.inventory.middle=中间 cmd.inventory.middle=中间
cmd.inventory.clicking={0}正在点击容器#{2}中的栏位{1} cmd.inventory.clicking={0}点击容器#{2}中的栏位{1}
cmd.inventory.shiftclick=按住Shift键点击容器#{1}中的栏位{0} cmd.inventory.shiftclick=按住Shift键点击容器#{1}中的栏位{0}
cmd.inventory.shiftclick_fail=执行Shift点击失败这可能是因为该容器类型目前不被支持。 cmd.inventory.shiftclick_fail=执行Shift点击失败这可能是因为该容器类型目前不被支持。
cmd.inventory.no_item=栏位#{0}中没有物品 cmd.inventory.no_item=栏位#{0}中没有物品
@ -548,7 +548,7 @@ bot.autoRelog.disconnect_msg=连接断开,收到消息:{0}
bot.autoRelog.reconnect_always=忽略kick消息仍要重新连接。 bot.autoRelog.reconnect_always=忽略kick消息仍要重新连接。
bot.autoRelog.reconnect=信息包含 '{0}'。重新连接。 bot.autoRelog.reconnect=信息包含 '{0}'。重新连接。
bot.autoRelog.reconnect_ignore=不包含任何已定义关键字的消息,忽略。 bot.autoRelog.reconnect_ignore=不包含任何已定义关键字的消息,忽略。
bot.autoRelog.wait=等待{0}秒后重新连接... bot.autoRelog.wait=等待{0:0.000}秒后重新连接...
# AutoRespond # AutoRespond
bot.autoRespond.loading=正在从'{0}'加载匹配项 bot.autoRespond.loading=正在从'{0}'加载匹配项

View file

@ -325,7 +325,7 @@ cmd.inventory.damage=武器傷害值
cmd.inventory.left= cmd.inventory.left=
cmd.inventory.right= cmd.inventory.right=
cmd.inventory.middle=中間 cmd.inventory.middle=中間
cmd.inventory.clicking={0}正在點選容器#{2}中的欄位{1} cmd.inventory.clicking={0}點選容器#{2}中的欄位{1}
cmd.inventory.shiftclick=按住Shift鍵點選容器#{1}中的欄位{0} cmd.inventory.shiftclick=按住Shift鍵點選容器#{1}中的欄位{0}
cmd.inventory.shiftclick_fail=執行Shift點選失敗這可能是因為該容器型別目前不被支援。 cmd.inventory.shiftclick_fail=執行Shift點選失敗這可能是因為該容器型別目前不被支援。
cmd.inventory.no_item=欄位#{0}中沒有物品 cmd.inventory.no_item=欄位#{0}中沒有物品
@ -548,7 +548,7 @@ bot.autoRelog.disconnect_msg=連線斷開,收到訊息:{0}
bot.autoRelog.reconnect_always=忽略kick訊息仍要重新連線。 bot.autoRelog.reconnect_always=忽略kick訊息仍要重新連線。
bot.autoRelog.reconnect=資訊包含 '{0}'。重新連線。 bot.autoRelog.reconnect=資訊包含 '{0}'。重新連線。
bot.autoRelog.reconnect_ignore=不包含任何已定義關鍵字的訊息,忽略。 bot.autoRelog.reconnect_ignore=不包含任何已定義關鍵字的訊息,忽略。
bot.autoRelog.wait=等待{0}秒後重新連線... bot.autoRelog.wait=等待{0:0.000}秒後重新連線...
# AutoRespond # AutoRespond
bot.autoRespond.loading=正在從'{0}'載入匹配項 bot.autoRespond.loading=正在從'{0}'載入匹配項