properly pass game name to game string config finder.
add weapon prefix to weapon name parser for (iw5). add some iw3 game strings
This commit is contained in:
parent
1f9c80e23b
commit
e777a68105
@ -1069,6 +1069,52 @@
|
|||||||
"artillery": "Precision Airstrike",
|
"artillery": "Precision Airstrike",
|
||||||
"player": "",
|
"player": "",
|
||||||
"attach": ""
|
"attach": ""
|
||||||
|
},
|
||||||
|
"IW3": {
|
||||||
|
"torso_upper": "Upper Torso",
|
||||||
|
"torso_lower": "Lower Torso",
|
||||||
|
"right_leg_upper": "Upper Right Leg",
|
||||||
|
"right_leg_lower": "Lower Right Leg",
|
||||||
|
"right_hand": "Right Hand",
|
||||||
|
"right_foot": "Right Foot",
|
||||||
|
"right_arm_upper": "Upper Right Arm",
|
||||||
|
"right_arm_lower": "Lower Right Arm",
|
||||||
|
"left_leg_upper": "Upper Left Leg",
|
||||||
|
"left_leg_lower": "Lower Left Leg",
|
||||||
|
"left_hand": "Left Hand",
|
||||||
|
"left_foot": "Left Foot",
|
||||||
|
"left_arm_upper": "Upper Left Arm",
|
||||||
|
"left_arm_lower": "Lower Left Arm",
|
||||||
|
"acog": "ACOG Sight",
|
||||||
|
"gl": "Grenade Launcher",
|
||||||
|
"reflex": "Red Dot Sight",
|
||||||
|
"grip": "Grip",
|
||||||
|
"m4": "M4 Carbine",
|
||||||
|
"m40a3": "M40A3",
|
||||||
|
"ak47": "AK-47",
|
||||||
|
"ak74u": "AK-74u",
|
||||||
|
"rpg": "RPG-7",
|
||||||
|
"deserteagle": "Desert Eagle",
|
||||||
|
"deserteaglegold": "Desert Eagle Gold",
|
||||||
|
"m16": "M16A4",
|
||||||
|
"g36c": "G36C",
|
||||||
|
"uzi": "Mini-Uzi",
|
||||||
|
"m60e4": "M60E4",
|
||||||
|
"mp5": "MP5",
|
||||||
|
"barrett": "Barrett .50cal",
|
||||||
|
"mp44": "MP44",
|
||||||
|
"remington700": "R700",
|
||||||
|
"rpd": "RDP",
|
||||||
|
"saw": " M249 SAW",
|
||||||
|
"usp": "USP .45",
|
||||||
|
"winchester1200": "W1200",
|
||||||
|
"concussion": "Stun",
|
||||||
|
"melee": "Knife",
|
||||||
|
"Frag" : "Grenade",
|
||||||
|
"airstrike": "Airstrike",
|
||||||
|
"helicopter": "Attack Helicopter",
|
||||||
|
"player": "",
|
||||||
|
"attach": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ namespace Stats.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove the _mp suffix
|
// remove the _mp suffix
|
||||||
var filtered = splitWeaponName.Where(part => part != configForGame.WeaponSuffix);
|
var filtered = splitWeaponName
|
||||||
|
.Where(part => part != configForGame.WeaponSuffix && part != configForGame.WeaponPrefix);
|
||||||
var baseName = splitWeaponName.First();
|
var baseName = splitWeaponName.First();
|
||||||
var attachments = new List<string>();
|
var attachments = new List<string>();
|
||||||
|
|
||||||
@ -67,8 +68,6 @@ namespace Stats.Client
|
|||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
// _logger.LogDebug("Parsed weapon info {@info}", weaponInfo);
|
|
||||||
|
|
||||||
return weaponInfo;
|
return weaponInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,12 @@ namespace IW4MAdmin.Plugins.Stats.Config
|
|||||||
|
|
||||||
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = new[]
|
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = new[]
|
||||||
{
|
{
|
||||||
|
new WeaponNameParserConfiguration()
|
||||||
|
{
|
||||||
|
Game = Server.Game.IW3,
|
||||||
|
WeaponSuffix = "mp",
|
||||||
|
Delimiters = new[] {'_'}
|
||||||
|
},
|
||||||
new WeaponNameParserConfiguration()
|
new WeaponNameParserConfiguration()
|
||||||
{
|
{
|
||||||
Game = Server.Game.IW4,
|
Game = Server.Game.IW4,
|
||||||
@ -27,6 +33,13 @@ namespace IW4MAdmin.Plugins.Stats.Config
|
|||||||
Delimiters = new[] {'_'}
|
Delimiters = new[] {'_'}
|
||||||
},
|
},
|
||||||
new WeaponNameParserConfiguration()
|
new WeaponNameParserConfiguration()
|
||||||
|
{
|
||||||
|
Game = Server.Game.IW5,
|
||||||
|
WeaponSuffix = "mp",
|
||||||
|
WeaponPrefix = "iw5",
|
||||||
|
Delimiters = new[] {'_'}
|
||||||
|
},
|
||||||
|
new WeaponNameParserConfiguration()
|
||||||
{
|
{
|
||||||
Game = Server.Game.T6,
|
Game = Server.Game.T6,
|
||||||
WeaponSuffix = "mp",
|
WeaponSuffix = "mp",
|
||||||
|
@ -7,5 +7,6 @@ namespace Stats.Config
|
|||||||
public Server.Game Game { get; set; }
|
public Server.Game Game { get; set; }
|
||||||
public char[] Delimiters { get; set; }
|
public char[] Delimiters { get; set; }
|
||||||
public string WeaponSuffix { get; set; }
|
public string WeaponSuffix { get; set; }
|
||||||
|
public string WeaponPrefix { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,23 +1,24 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Data.Models;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
|
|
||||||
namespace SharedLibraryCore.Configuration
|
namespace SharedLibraryCore.Configuration
|
||||||
{
|
{
|
||||||
public class GameStringConfiguration : Dictionary<Server.Game, Dictionary<string, string>>
|
public class GameStringConfiguration : Dictionary<Reference.Game, Dictionary<string, string>>
|
||||||
{
|
{
|
||||||
public string GetStringForGame(string key, Server.Game game = Server.Game.IW4)
|
public string GetStringForGame(string key, Reference.Game? game = Reference.Game.IW4)
|
||||||
{
|
{
|
||||||
if (key == null)
|
if (key == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContainsKey(game))
|
if (!ContainsKey(game.Value))
|
||||||
{
|
{
|
||||||
return key.Transform(To.TitleCase);
|
return key.Transform(To.TitleCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
var strings = this[game];
|
var strings = this[game.Value];
|
||||||
return !strings.ContainsKey(key) ? key.Transform(To.TitleCase) : strings[key];
|
return !strings.ContainsKey(key) ? key.Transform(To.TitleCase) : strings[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var rebuiltName = stat.RebuildWeaponName();
|
var rebuiltName = stat.RebuildWeaponName();
|
||||||
var name = config.GetStringForGame(rebuiltName);
|
var name = config.GetStringForGame(rebuiltName, stat.Weapon?.Game);
|
||||||
return !rebuiltName.Equals(name, StringComparison.InvariantCultureIgnoreCase)
|
return !rebuiltName.Equals(name, StringComparison.InvariantCultureIgnoreCase)
|
||||||
? name
|
? name
|
||||||
: config.GetStringForGame(stat.Weapon.Name);
|
: config.GetStringForGame(stat.Weapon.Name, stat.Weapon.Game);
|
||||||
}
|
}
|
||||||
|
|
||||||
string GetWeaponAttachmentName(EFWeaponAttachmentCombo attachment)
|
string GetWeaponAttachmentName(EFWeaponAttachmentCombo attachment)
|
||||||
@ -47,9 +47,9 @@
|
|||||||
|
|
||||||
var attachmentText = string.Join('+', new[]
|
var attachmentText = string.Join('+', new[]
|
||||||
{
|
{
|
||||||
config.GetStringForGame(attachment.Attachment1.Name),
|
config.GetStringForGame(attachment.Attachment1.Name, attachment.Attachment1.Game),
|
||||||
config.GetStringForGame(attachment.Attachment2?.Name),
|
config.GetStringForGame(attachment.Attachment2?.Name, attachment.Attachment2?.Game),
|
||||||
config.GetStringForGame(attachment.Attachment3?.Name)
|
config.GetStringForGame(attachment.Attachment3?.Name, attachment.Attachment3?.Game)
|
||||||
}.Where(attach => !string.IsNullOrWhiteSpace(attach)));
|
}.Where(attach => !string.IsNullOrWhiteSpace(attach)));
|
||||||
|
|
||||||
return attachmentText;
|
return attachmentText;
|
||||||
@ -404,7 +404,7 @@
|
|||||||
@foreach (var hitLocation in filteredHitLocations.Take(8))
|
@foreach (var hitLocation in filteredHitLocations.Take(8))
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name)</td>
|
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td>
|
||||||
<td class="text-success text-force-break">@hitLocation.HitCount</td>
|
<td class="text-success text-force-break">@hitLocation.HitCount</td>
|
||||||
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
|
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
|
||||||
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
|
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
|
||||||
@ -414,7 +414,7 @@
|
|||||||
@foreach (var hitLocation in filteredHitLocations.Skip(8))
|
@foreach (var hitLocation in filteredHitLocations.Skip(8))
|
||||||
{
|
{
|
||||||
<tr class="bg-dark hidden-row" style="display:none;">
|
<tr class="bg-dark hidden-row" style="display:none;">
|
||||||
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name)</td>
|
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td>
|
||||||
<td class="text-success text-force-break">@hitLocation.HitCount</td>
|
<td class="text-success text-force-break">@hitLocation.HitCount</td>
|
||||||
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
|
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
|
||||||
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
|
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user