support for Plutonium IW5 and only show live radar tab if monitoring at least one IW4 serves

This commit is contained in:
RaidMax 2020-04-11 18:05:18 -05:00
parent 36af673fc7
commit 8fb2394130
3 changed files with 56 additions and 2 deletions

View File

@ -14,6 +14,8 @@ namespace IW4MAdmin.Application.RconParsers
{
public class BaseRConParser : IRConParser
{
private const int MAX_FAULTY_STATUS_LINES = 7;
public BaseRConParser(IParserRegexFactory parserRegexFactory)
{
Configuration = new DynamicRConParserConfiguration(parserRegexFactory)
@ -207,7 +209,7 @@ namespace IW4MAdmin.Application.RconParsers
}
// this happens if status is requested while map is rotating
if (Status.Length > 5 && validMatches == 0)
if (Status.Length > MAX_FAULTY_STATUS_LINES && validMatches == 0)
{
throw new ServerException(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_ROTATING_MAP"]);
}

View File

@ -60,7 +60,10 @@ namespace LiveRadar
await _configurationHandler.Save();
}
manager.GetPageList().Pages.Add(Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"], "/Radar/All");
if (manager.GetServers().Any(_server => _server.GameName == Server.Game.IW4))
{
manager.GetPageList().Pages.Add(Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"], "/Radar/All");
}
}
public Task OnTickAsync(Server S)

View File

@ -0,0 +1,49 @@
var rconParser;
var eventParser;
var plugin = {
author: 'RaidMax',
version: 0.1,
name: 'Plutonium IW5 Parser',
isParser: true,
onEventAsync: function (gameEvent, server) {
},
onLoadAsync: function (manager) {
rconParser = manager.GenerateDynamicRConParser(this.name);
eventParser = manager.GenerateDynamicEventParser(this.name);
rconParser.Configuration.CommandPrefixes.Tell = 'tell {0} {1}';
rconParser.Configuration.CommandPrefixes.Say = 'say {0}';
rconParser.Configuration.CommandPrefixes.Kick = 'clientkick {0} "{1}"';
rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0} "{1}"';
rconParser.Configuration.CommandPrefixes.TempBan = 'clientkick {0} "{1}"';
rconParser.Configuration.CommandPrefixes.RConGetDvar = '\xff\xff\xff\xffrcon {0} get {1}';
rconParser.Configuration.Dvar.Pattern = '^received "(.+)"\n(.+) is "(.+)?"';
rconParser.Configuration.Dvar.AddMapping(106, 2);
rconParser.Configuration.Dvar.AddMapping(107, 3);
rconParser.Configuration.WaitForResponse = false;
rconParser.Configuration.CanGenerateLogPath = false;
rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +([0-9]+) +(?:[0-1]{1}) +([0-9]+) +([A-F0-9]+) +(.+?) +(?:[0-9]+) +(\\d+\\.\\d+\\.\\d+\\.\\d+\\:-?\\d{1,5}|0+\\.0+:-?\\d{1,5}|loopback) +(?:-?[0-9]+) +(?:[0-9]+) *$';
rconParser.Configuration.Status.AddMapping(100, 1);
rconParser.Configuration.Status.AddMapping(101, 2);
rconParser.Configuration.Status.AddMapping(102, 3);
rconParser.Configuration.Status.AddMapping(103, 4);
rconParser.Configuration.Status.AddMapping(104, 5);
rconParser.Configuration.Status.AddMapping(105, 6);
rconParser.Version = 'IW5 MP 1.9 build 388110 Fri Sep 14 00:04:28 2012 win-x86';
rconParser.GameName = 3; // T5
eventParser.Version = 'IW5 MP 1.9 build 388110 Fri Sep 14 00:04:28 2012 win-x86';
eventParser.GameName = 3; // T5
},
onUnloadAsync: function () {
},
onTickAsync: function (server) {
}
};