Update 0.01 G
This commit is contained in:
+37
-18
@@ -6,38 +6,49 @@ namespace Lua
|
||||
{
|
||||
internal static class ConfigLoader
|
||||
{
|
||||
// Basic flags/settings
|
||||
// AA0001
|
||||
public static bool debitFlag1 = false;
|
||||
// AA0002
|
||||
public static bool betaTest = false;
|
||||
// AA0003
|
||||
public static bool ttsEnabled = true;
|
||||
|
||||
// Key codes (default values)
|
||||
public static int nextSetKey = 0x05; // XBUTTON1
|
||||
public static int prevSetKey = 0x06; // XBUTTON2
|
||||
public static int refreshKey = 0x50; // P
|
||||
public static int switchSideKey = 0x4D; // M
|
||||
public static int shootKey = 0x01; // Left mouse button
|
||||
public static int altShootKey = 0x02; // Right mouse button
|
||||
// AA0004
|
||||
public static int nextSetKey = 0x05;
|
||||
// AA0005
|
||||
public static int prevSetKey = 0x06;
|
||||
// AA0006
|
||||
public static int refreshKey = 0x50;
|
||||
// AA0007
|
||||
public static int switchSideKey = 0x4D;
|
||||
// AA0008
|
||||
public static int shootKey = 0x01;
|
||||
// AA0009
|
||||
public static int altShootKey = 0x02;
|
||||
|
||||
// Favorites and user
|
||||
// AA0010
|
||||
public static string favoriteAttackers = null;
|
||||
// AA0011
|
||||
public static string favoriteDefenders = null;
|
||||
// AA0012
|
||||
public static string userName = null;
|
||||
|
||||
// Jitter config
|
||||
// AA0013
|
||||
public static bool jitterEnabled = false;
|
||||
public static int jitterBurstTime = 1800; // milliseconds
|
||||
public static int jitterCooldown = 3000; // milliseconds
|
||||
// AA0014
|
||||
public static int jitterBurstTime = 1800;
|
||||
// AA0015
|
||||
public static int jitterCooldown = 3000;
|
||||
|
||||
// Console text color
|
||||
// AA0016
|
||||
public static ConsoleColor textColor = ConsoleColor.Magenta;
|
||||
|
||||
/// <summary>
|
||||
/// Load defaults and then attempt to read init.config from working directory.
|
||||
// AA0017
|
||||
/// </summary>
|
||||
public static void LoadInitConfig()
|
||||
{
|
||||
// Reset to defaults
|
||||
// AA0018
|
||||
debitFlag1 = false;
|
||||
betaTest = false;
|
||||
ttsEnabled = true;
|
||||
@@ -51,24 +62,28 @@ namespace Lua
|
||||
|
||||
SetConsoleColor();
|
||||
|
||||
// AA0019
|
||||
if (!File.Exists("init.config")) return;
|
||||
|
||||
var lines = Helper.ReadLinesSafe("init.config");
|
||||
|
||||
// AA0020
|
||||
foreach (var raw in lines)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(raw)) continue;
|
||||
var line = raw.Trim();
|
||||
|
||||
// Ignore comments
|
||||
// AA0021
|
||||
if (line.StartsWith("--") || line.StartsWith("#")) continue;
|
||||
|
||||
// AA0022
|
||||
if (Helper.ParseBoolFromAssignment(line, "debitFlag1", out var b1))
|
||||
debitFlag1 = b1;
|
||||
else if (Helper.ParseBoolFromAssignment(line, "betaTest", out var b2))
|
||||
betaTest = b2;
|
||||
else if (Helper.ParseBoolFromAssignment(line, "ttsEnabled", out var b3))
|
||||
ttsEnabled = b3;
|
||||
// AA0023
|
||||
else if (Helper.ParseIntFromAssignment(line, "nextSetKey", out var i1))
|
||||
nextSetKey = i1;
|
||||
else if (Helper.ParseIntFromAssignment(line, "prevSetKey", out var i2))
|
||||
@@ -77,26 +92,30 @@ namespace Lua
|
||||
refreshKey = i3;
|
||||
else if (Helper.ParseIntFromAssignment(line, "switchSideKey", out var i4))
|
||||
switchSideKey = i4;
|
||||
// AA0024
|
||||
else if (Helper.ParseStringFromAssignment(line, "favoriteAttackers", out var s1))
|
||||
favoriteAttackers = s1;
|
||||
else if (Helper.ParseStringFromAssignment(line, "favoriteDefenders", out var s2))
|
||||
favoriteDefenders = s2;
|
||||
else if (Helper.ParseStringFromAssignment(line, "userName", out var s3))
|
||||
userName = s3;
|
||||
// AA0025
|
||||
else if (Helper.ParseBoolFromAssignment(line, "jitterEnabled", out var jb))
|
||||
jitterEnabled = jb;
|
||||
else if (Helper.ParseIntFromAssignment(line, "jitterBurstTime", out var jbT))
|
||||
jitterBurstTime = jbT;
|
||||
else if (Helper.ParseIntFromAssignment(line, "jitterCooldown", out var jbC))
|
||||
jitterCooldown = jbC;
|
||||
// AA0026
|
||||
else if (Helper.ParseConsoleColorFromAssignment(line, "textColor", out var col))
|
||||
textColor = col;
|
||||
}
|
||||
|
||||
// Re-apply color in case it was changed by config
|
||||
// AA0027
|
||||
SetConsoleColor();
|
||||
}
|
||||
|
||||
// AA0028
|
||||
private static void SetConsoleColor()
|
||||
{
|
||||
try
|
||||
@@ -105,7 +124,7 @@ namespace Lua
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore if console doesn't support color
|
||||
// AA0029
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user