fix copy paste error in penalty loader

start allowing color codes from ingame
This commit is contained in:
RaidMax 2019-08-01 09:37:33 -05:00
parent 9f3f344daa
commit 55fb36863c
7 changed files with 27 additions and 23 deletions

View File

@ -175,7 +175,7 @@ namespace IW4MAdmin.Application.EventParsers
{ {
CurrentAlias = new EFAlias() CurrentAlias = new EFAlias()
{ {
Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString().StripColors(), Name = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginName]].ToString(),
}, },
NetworkId = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(), NetworkId = regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(),
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()), ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Join.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),
@ -199,7 +199,7 @@ namespace IW4MAdmin.Application.EventParsers
{ {
CurrentAlias = new EFAlias() CurrentAlias = new EFAlias()
{ {
Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString().StripColors() Name = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginName]].ToString()
}, },
NetworkId = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(), NetworkId = regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginNetworkId]].ToString().ConvertGuidToLong(),
ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()), ClientNumber = Convert.ToInt32(regexMatch.Groups[Configuration.Quit.GroupMapping[ParserRegex.GroupType.OriginClientNumber]].ToString()),

View File

@ -405,8 +405,6 @@ namespace IW4MAdmin
if (E.Type == GameEvent.EventType.Say) if (E.Type == GameEvent.EventType.Say)
{ {
E.Data = E.Data.StripColors();
if (E.Data?.Length > 0) if (E.Data?.Length > 0)
{ {
string message = E.Data; string message = E.Data;
@ -447,10 +445,10 @@ namespace IW4MAdmin
else else
{ {
Gametype = dict["gametype"].StripColors(); Gametype = dict["gametype"];
Hostname = dict["hostname"]?.StripColors(); Hostname = dict["hostname"];
string mapname = dict["mapname"]?.StripColors() ?? CurrentMap.Name; string mapname = dict["mapname"] ?? CurrentMap.Name;
CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname }; CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname };
} }
} }
@ -458,11 +456,11 @@ namespace IW4MAdmin
else else
{ {
var dict = (Dictionary<string, string>)E.Extra; var dict = (Dictionary<string, string>)E.Extra;
Gametype = dict["g_gametype"].StripColors(); Gametype = dict["g_gametype"];
Hostname = dict["sv_hostname"].StripColors(); Hostname = dict["sv_hostname"];
MaxClients = int.Parse(dict["sv_maxclients"]); MaxClients = int.Parse(dict["sv_maxclients"]);
string mapname = dict["mapname"].StripColors(); string mapname = dict["mapname"];
CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map()
{ {
Alias = mapname, Alias = mapname,
@ -827,7 +825,7 @@ namespace IW4MAdmin
InitializeMaps(); InitializeMaps();
this.Hostname = hostname.StripColors(); this.Hostname = hostname;
this.CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname }; this.CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname };
this.MaxClients = maxplayers; this.MaxClients = maxplayers;
this.FSGame = game; this.FSGame = game;

View File

@ -79,17 +79,24 @@ namespace IW4MAdmin.Application.RconParsers
throw new DvarException(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_DVAR"].FormatExt(dvarName)); throw new DvarException(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_DVAR"].FormatExt(dvarName));
} }
string value = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarValue]].Value.StripColors(); string value = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarValue]].Value;
string defaultValue = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarDefaultValue]].Value.StripColors(); string defaultValue = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarDefaultValue]].Value;
string latchedValue = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarLatchedValue]].Value.StripColors(); string latchedValue = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarLatchedValue]].Value;
string removeTrailingColorCode(string input) => Regex.Replace(input, @"\^7$", "");
value = removeTrailingColorCode(value);
defaultValue = removeTrailingColorCode(defaultValue);
latchedValue = removeTrailingColorCode(latchedValue);
return new Dvar<T>() return new Dvar<T>()
{ {
Name = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarName]].Value.StripColors(), Name = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarName]].Value,
Value = string.IsNullOrEmpty(value) ? default : (T)Convert.ChangeType(value, typeof(T)), Value = string.IsNullOrEmpty(value) ? default : (T)Convert.ChangeType(value, typeof(T)),
DefaultValue = string.IsNullOrEmpty(defaultValue) ? default : (T)Convert.ChangeType(defaultValue, typeof(T)), DefaultValue = string.IsNullOrEmpty(defaultValue) ? default : (T)Convert.ChangeType(defaultValue, typeof(T)),
LatchedValue = string.IsNullOrEmpty(latchedValue) ? default : (T)Convert.ChangeType(latchedValue, typeof(T)), LatchedValue = string.IsNullOrEmpty(latchedValue) ? default : (T)Convert.ChangeType(latchedValue, typeof(T)),
Domain = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarDomain]].Value.StripColors() Domain = match.Groups[Configuration.Dvar.GroupMapping[ParserRegex.GroupType.RConDvarDomain]].Value
}; };
} }
@ -145,7 +152,7 @@ namespace IW4MAdmin.Application.RconParsers
continue; continue;
} }
string name = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConName]].Value.StripColors().Trim(); string name = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConName]].Value.Trim();
int? ip = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConIpAddress]].Value.Split(':')[0].ConvertToIP(); int? ip = regex.Groups[Configuration.Status.GroupMapping[ParserRegex.GroupType.RConIpAddress]].Value.Split(':')[0].ConvertToIP();
var client = new EFClient() var client = new EFClient()

View File

@ -498,7 +498,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
AttackerId = attacker.ClientId, AttackerId = attacker.ClientId,
VictimId = victim.ClientId, VictimId = victim.ClientId,
ServerId = serverId, ServerId = serverId,
//Map = ParseEnum<IW4Info.MapName>.Get(map, typeof(IW4Info.MapName)),
DeathOrigin = vDeathOrigin, DeathOrigin = vDeathOrigin,
KillOrigin = vKillOrigin, KillOrigin = vKillOrigin,
DeathType = ParseEnum<IW4Info.MeansOfDeath>.Get(type, typeof(IW4Info.MeansOfDeath)), DeathType = ParseEnum<IW4Info.MeansOfDeath>.Get(type, typeof(IW4Info.MeansOfDeath)),

View File

@ -1032,7 +1032,7 @@ namespace SharedLibraryCore.Commands
var Response = await E.Owner.ExecuteCommandAsync(E.Data.Trim()); var Response = await E.Owner.ExecuteCommandAsync(E.Data.Trim());
foreach (string S in Response) foreach (string S in Response)
{ {
E.Origin.Tell(S.StripColors()); E.Origin.Tell(S);
} }
if (Response.Length == 0) if (Response.Length == 0)

View File

@ -138,7 +138,7 @@ namespace SharedLibraryCore
/// </summary> /// </summary>
/// <param name="str">String containing color codes</param> /// <param name="str">String containing color codes</param>
/// <returns></returns> /// <returns></returns>
public static String StripColors(this string str) public static string StripColors(this string str)
{ {
if (str == null) if (str == null)
{ {
@ -860,7 +860,7 @@ namespace SharedLibraryCore
var queryCompilationContext = databaseDependencies.QueryCompilationContextFactory.Create(false); var queryCompilationContext = databaseDependencies.QueryCompilationContextFactory.Create(false);
var modelVisitor = (RelationalQueryModelVisitor)queryCompilationContext.CreateQueryModelVisitor(); var modelVisitor = (RelationalQueryModelVisitor)queryCompilationContext.CreateQueryModelVisitor();
modelVisitor.CreateQueryExecutor<TEntity>(queryModel); modelVisitor.CreateQueryExecutor<TEntity>(queryModel);
var sql = modelVisitor.Queries.First().ToString().Replace("\"", "`"); var sql = modelVisitor.Queries.First().ToString();
return sql; return sql;
} }

View File

@ -67,8 +67,8 @@ if ($('#penalty_table').length === 1) {
$document.ready(function () { $document.ready(function () {
$window $window
.off('scroll', PenaltyScrollHandle) .off('scroll', PenaltyScrollHandler)
.on('scroll', PenaltyScrollHandle); .on('scroll', PenaltyScrollHandler);
$('#load_penalties_button').click(function () { $('#load_penalties_button').click(function () {
loadMorePenalties(); loadMorePenalties();