mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add setting for overriding attack speed for autoattack (#1512)
* Add setting for overriding attack speed for autoattack * Change cooldown value type to float * Fix minor grammar issue
This commit is contained in:
parent
70d3b6175b
commit
53e2413204
5 changed files with 58 additions and 7 deletions
|
|
@ -173,6 +173,8 @@ namespace MinecraftClient
|
|||
public static bool AutoAttack_Enabled = false;
|
||||
public static string AutoAttack_Mode = "single";
|
||||
public static string AutoAttack_Priority = "distance";
|
||||
public static bool AutoAttack_OverrideAttackSpeed = false;
|
||||
public static double AutoAttack_CooldownSeconds = 1;
|
||||
|
||||
//Auto Fishing
|
||||
public static bool AutoFishing_Enabled = false;
|
||||
|
|
@ -577,6 +579,17 @@ namespace MinecraftClient
|
|||
case "enabled": AutoAttack_Enabled = str2bool(argValue); break;
|
||||
case "mode": AutoAttack_Mode = argValue.ToLower(); break;
|
||||
case "priority": AutoAttack_Priority = argValue.ToLower(); break;
|
||||
case "cooldownseconds":
|
||||
if (argValue.ToLower() == "auto")
|
||||
{
|
||||
AutoAttack_OverrideAttackSpeed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoAttack_OverrideAttackSpeed = true;
|
||||
AutoAttack_CooldownSeconds = str2float(argValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -726,6 +739,23 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the specified string to a float number, defaulting to zero if invalid argument
|
||||
/// </summary>
|
||||
/// <param name="str">String to parse as a float number</param>
|
||||
/// <returns>Float number</returns>
|
||||
public static float str2float(string str)
|
||||
{
|
||||
float f;
|
||||
if (float.TryParse(str.Trim(), out f))
|
||||
return f;
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLogLine(Translations.Get("error.setting.str2int", str));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the specified string to a boolean value, defaulting to false if invalid argument
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue