Add generic stats window for balancing (#11122)

Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2022-09-29 17:09:29 +10:00
committed by GitHub
parent 0b6df078e9
commit eb560de7c3
2 changed files with 27 additions and 12 deletions

View File

@@ -17,19 +17,19 @@ namespace Content.Server.UserInterface;
public sealed class StatValuesCommand : IConsoleCommand public sealed class StatValuesCommand : IConsoleCommand
{ {
public string Command => "showvalues"; public string Command => "showvalues";
public string Description => "Dumps all stats for a particular category into a table."; public string Description => Loc.GetString("stat-values-desc");
public string Help => $"{Command} <cargosell / lathsell / melee>"; public string Help => $"{Command} <cargosell / lathsell / melee>";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
if (shell.Player is not IPlayerSession pSession) if (shell.Player is not IPlayerSession pSession)
{ {
shell.WriteError($"{Command} can't be run on server!"); shell.WriteError(Loc.GetString("stat-values-server"));
return; return;
} }
if (args.Length != 1) if (args.Length != 1)
{ {
shell.WriteError($"Invalid number of args, need 1"); shell.WriteError(Loc.GetString("stat-values-args"));
return; return;
} }
@@ -47,7 +47,7 @@ public sealed class StatValuesCommand : IConsoleCommand
message = GetMelee(); message = GetMelee();
break; break;
default: default:
shell.WriteError($"{args[0]} is not a valid stat!"); shell.WriteError(Loc.GetString("stat-values-invalid", ("arg", args[0])));
return; return;
} }
@@ -64,7 +64,7 @@ public sealed class StatValuesCommand : IConsoleCommand
var values = new List<string[]>(); var values = new List<string[]>();
var entManager = IoCManager.Resolve<IEntityManager>(); var entManager = IoCManager.Resolve<IEntityManager>();
var priceSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PricingSystem>(); var priceSystem = entManager.System<PricingSystem>();
var metaQuery = entManager.GetEntityQuery<MetaDataComponent>(); var metaQuery = entManager.GetEntityQuery<MetaDataComponent>();
var prices = new HashSet<string>(256); var prices = new HashSet<string>(256);
@@ -93,11 +93,11 @@ public sealed class StatValuesCommand : IConsoleCommand
var state = new StatValuesEuiMessage() var state = new StatValuesEuiMessage()
{ {
Title = "Cargo sell prices", Title = Loc.GetString("stat-cargo-values"),
Headers = new List<string>() Headers = new List<string>()
{ {
"ID", Loc.GetString("stat-cargo-id"),
"Price", Loc.GetString("stat-cargo-price"),
}, },
Values = values, Values = values,
}; };
@@ -179,12 +179,12 @@ public sealed class StatValuesCommand : IConsoleCommand
var state = new StatValuesEuiMessage() var state = new StatValuesEuiMessage()
{ {
Title = "Lathe sell prices", Title = Loc.GetString("stat-lathe-values"),
Headers = new List<string>() Headers = new List<string>()
{ {
"ID", Loc.GetString("stat-lathe-id"),
"Cost", Loc.GetString("stat-lathe-cost"),
"Sell price", Loc.GetString("stat-lathe-sell"),
}, },
Values = values, Values = values,
}; };

View File

@@ -0,0 +1,15 @@
stat-values-desc = Dumps all stats for a particular category into a table.
stat-values-server = Can't be run on the server!
stat-values-args = Invalid number of args, need 1
stat-values-invalid = {$arg} is not a valid stat!
# Cargo
stat-cargo-values = Cargo sell prices
stat-cargo-id = ID
stat-cargo-price = Price
# Lathe
stat-lathe-values = Lathe sell prices
stat-lathe-id = ID
stat-lathe-cost = Cost
stat-lathe-sell = Sell price