make database seed code less verbose
disable killserver command fix issue with default parser not saving during setup fix issue with unban reason displayed when player is rebanned
This commit is contained in:
parent
599a14b646
commit
2cceb2f3e7
@ -387,7 +387,7 @@ namespace IW4MAdmin.Application
|
|||||||
Commands.Add(new CIP());
|
Commands.Add(new CIP());
|
||||||
Commands.Add(new CMask());
|
Commands.Add(new CMask());
|
||||||
Commands.Add(new CPruneAdmins());
|
Commands.Add(new CPruneAdmins());
|
||||||
Commands.Add(new CKillServer());
|
//Commands.Add(new CKillServer());
|
||||||
Commands.Add(new CSetPassword());
|
Commands.Add(new CSetPassword());
|
||||||
Commands.Add(new CPing());
|
Commands.Add(new CPing());
|
||||||
Commands.Add(new CSetGravatar());
|
Commands.Add(new CSetGravatar());
|
||||||
|
@ -1135,12 +1135,12 @@ namespace SharedLibraryCore.Commands
|
|||||||
|
|
||||||
public override async Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
{
|
{
|
||||||
if (E.Owner.ServerConfig.ManualLogPath != null)
|
if (E.Owner.ServerConfig.GameLogServerUrl != null)
|
||||||
{
|
{
|
||||||
using (var wc = new WebClient())
|
using (var wc = new WebClient())
|
||||||
{
|
{
|
||||||
E.Owner.RestartRequested = true;
|
E.Owner.RestartRequested = true;
|
||||||
var response = await wc.DownloadStringTaskAsync(new Uri($"{E.Owner.ServerConfig.ManualLogPath}/restart"));
|
var response = await wc.DownloadStringTaskAsync(new Uri($"{E.Owner.ServerConfig.GameLogServerUrl}/restart"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ namespace SharedLibraryCore.Configuration
|
|||||||
{
|
{
|
||||||
public class QuickMessageConfiguration
|
public class QuickMessageConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
public Game Game { get; set; }
|
public Game Game { get; set; }
|
||||||
public Dictionary<string, string> Messages { get; set; }
|
public Dictionary<string, string> Messages { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -58,11 +58,11 @@ namespace SharedLibraryCore.Configuration
|
|||||||
var parserVersions = rconParsers.Select(_parser => _parser.Version).ToArray();
|
var parserVersions = rconParsers.Select(_parser => _parser.Version).ToArray();
|
||||||
var selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_RCON_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
var selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_RCON_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
||||||
|
|
||||||
if (selection.Item1 > 0)
|
if (selection.Item1 >= 0)
|
||||||
{
|
{
|
||||||
RConParserVersion = selection.Item2;
|
RConParserVersion = selection.Item2;
|
||||||
|
|
||||||
if (!rconParsers[selection.Item1 - 1].CanGenerateLogPath)
|
if (selection.Item1 > 0 && !rconParsers[selection.Item1 - 1].CanGenerateLogPath)
|
||||||
{
|
{
|
||||||
Console.WriteLine(loc["SETUP_SERVER_NO_LOG"]);
|
Console.WriteLine(loc["SETUP_SERVER_NO_LOG"]);
|
||||||
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_LOG_PATH"]);
|
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_LOG_PATH"]);
|
||||||
@ -72,7 +72,7 @@ namespace SharedLibraryCore.Configuration
|
|||||||
parserVersions = eventParsers.Select(_parser => _parser.Version).ToArray();
|
parserVersions = eventParsers.Select(_parser => _parser.Version).ToArray();
|
||||||
selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_EVENT_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_EVENT_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
||||||
|
|
||||||
if (selection.Item1 > 0)
|
if (selection.Item1 >= 0)
|
||||||
{
|
{
|
||||||
EventParserVersion = selection.Item2;
|
EventParserVersion = selection.Item2;
|
||||||
}
|
}
|
||||||
|
@ -18,27 +18,11 @@ namespace SharedLibraryCore.Database
|
|||||||
|
|
||||||
public async Task Seed()
|
public async Task Seed()
|
||||||
{
|
{
|
||||||
// make sure database exists
|
|
||||||
//context.Database.EnsureCreated();
|
|
||||||
context.Database.Migrate();
|
context.Database.Migrate();
|
||||||
|
|
||||||
if (context.AliasLinks.Count() == 0)
|
if (context.AliasLinks.Count() == 0)
|
||||||
{
|
{
|
||||||
context.AliasLinks.Add(new EFAliasLink()
|
var link = new EFAliasLink();
|
||||||
{
|
|
||||||
AliasLinkId = 1
|
|
||||||
});
|
|
||||||
|
|
||||||
var currentAlias = new EFAlias()
|
|
||||||
{
|
|
||||||
AliasId = 1,
|
|
||||||
Active = true,
|
|
||||||
DateAdded = DateTime.UtcNow,
|
|
||||||
Name = "IW4MAdmin",
|
|
||||||
LinkId = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
context.Aliases.Add(currentAlias);
|
|
||||||
|
|
||||||
context.Clients.Add(new EFClient()
|
context.Clients.Add(new EFClient()
|
||||||
{
|
{
|
||||||
@ -50,8 +34,14 @@ namespace SharedLibraryCore.Database
|
|||||||
Level = Permission.Console,
|
Level = Permission.Console,
|
||||||
Masked = true,
|
Masked = true,
|
||||||
NetworkId = 0,
|
NetworkId = 0,
|
||||||
AliasLinkId = 1,
|
AliasLink = link,
|
||||||
CurrentAliasId = 1,
|
CurrentAlias = new EFAlias()
|
||||||
|
{
|
||||||
|
Link = link,
|
||||||
|
Active = true,
|
||||||
|
DateAdded = DateTime.UtcNow,
|
||||||
|
Name = "IW4MAdmin",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
|
@ -538,7 +538,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
// kick them as their level is banned
|
// kick them as their level is banned
|
||||||
if (Level == Permission.Banned)
|
if (Level == Permission.Banned)
|
||||||
{
|
{
|
||||||
var profileBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Expires == null && _penalty.Active);
|
var profileBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Expires == null && _penalty.Active && _penalty.Type == Penalty.PenaltyType.Ban);
|
||||||
|
|
||||||
if (profileBan == null)
|
if (profileBan == null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user