more expedition changes (#17403)

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
deltanedas
2023-06-28 14:01:27 +00:00
committed by GitHub
parent b1f7b15dd7
commit 9cd8d25ae7
16 changed files with 371 additions and 128 deletions

View File

@@ -16,6 +16,7 @@ using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.Salvage.UI;
@@ -194,10 +195,19 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
Text = Loc.GetString("salvage-expedition-window-rewards")
});
// there will always be 3 rewards so no need for 0 check
var rewards = new Dictionary<string, int>();
foreach (var reward in mission.Rewards)
{
var name = _prototype.Index<EntityPrototype>(reward).Name;
var count = rewards.GetOrNew(name);
count++;
rewards[name] = count;
}
// there will always be 3 or more rewards so no need for 0 check
lBox.AddChild(new Label()
{
Text = string.Join("\n", mission.Rewards.Select(id => "- " + _prototype.Index<EntityPrototype>(id).Name)),
Text = string.Join("\n", rewards.Select(o => "- " + o.Key + (o.Value > 1 ? $" x {o.Value}" : ""))).TrimEnd(),
FontColorOverride = StyleNano.ConcerningOrangeFore,
HorizontalAlignment = HAlignment.Left,
Margin = new Thickness(0f, 0f, 0f, 5f)