1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-09 23:00:57 -05:00

cleaned up some namespace discrepancies

fixed the coloring for custom groups translation
add reserved slots
add webhook project to show notifications in discord
This commit is contained in:
RaidMax
2018-08-07 13:43:09 -05:00
parent 9d79a8e090
commit a8f29407b8
27 changed files with 301 additions and 63 deletions

View File

@ -14,6 +14,7 @@ namespace SharedLibraryCore.Configuration
public bool UseT6MParser { get; set; }
public bool UseIW5MParser { get; set; }
public string ManualLogPath { get; set; }
public int ReservedSlotNumber { get; set; }
public IBaseConfiguration Generate()
{
@ -46,6 +47,8 @@ namespace SharedLibraryCore.Configuration
if (UseIW5MParser)
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_MANUALLOG"]);
ReservedSlotNumber = loc["SETUP_SERVER_RESERVEDSLOT"].PromptInt(0, 32);
return this;
}

View File

@ -13,6 +13,7 @@ namespace SharedLibraryCore.Dtos
public string PunisherName { get; set; }
public int PunisherId { get; set; }
public string PunisherLevel { get; set; }
public int PunisherLevelId { get; set; }
public string Offense { get; set; }
public string AutomatedOffense { get; set; }
public string Type { get; set; }

View File

@ -199,7 +199,8 @@ namespace SharedLibraryCore
return id;
var bot = Regex.Match(str, @"bot[0-9]+").Value;
if (!string.IsNullOrEmpty(bot))
return -1;//Convert.ToInt64(bot.Substring(3)) + 1;
// should set their GUID to the negation of their 1 based index (-1 - -18)
return -(Convert.ToInt64(bot.Substring(3)) + 1);
return 0;
}
@ -365,7 +366,7 @@ namespace SharedLibraryCore
CurrentAlias = client.CurrentAlias,
CurrentAliasId = client.CurrentAlias.AliasId,
// todo: make sure this is up to date
IsBot = client.NetworkId == -1,
IsBot = client.IPAddress == int.MinValue,
Password = client.Password,
PasswordSalt = client.PasswordSalt
};
@ -379,6 +380,33 @@ namespace SharedLibraryCore
return (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
}
/// <summary>
/// prompt user to enter a number
/// </summary>
/// <param name="question">question to prompt with</param>
/// <param name="maxValue">maximum value to allow</param>
/// <param name="minValue">minimum value to allow</param>
/// <returns>integer from user's input</returns>
public static int PromptInt(this string question, int minValue = 0, int maxValue = int.MaxValue)
{
Console.Write($"{question}: ");
int response;
while (!int.TryParse(Console.ReadLine(), out response) ||
response < minValue ||
response > maxValue)
{
string range = "";
if (minValue != 0 || maxValue != int.MaxValue)
{
range = $" [{minValue}-{maxValue}]";
}
Console.Write($"Please enter a valid number{range}: ");
}
return response;
}
public static string PromptString(string question)
{
string response;
@ -455,6 +483,5 @@ namespace SharedLibraryCore
var response = await server.RemoteConnection.SendQueryAsync(RCon.StaticHelpers.QueryType.GET_INFO);
return response.FirstOrDefault(r => r[0] == '\\')?.DictionaryFromKeyValue();
}
}
}