Expeditions rework (#18960)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Client.Stylesheets;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Parallax.Biomes;
|
||||
using Content.Shared.Procedural;
|
||||
using Content.Shared.Salvage;
|
||||
using Content.Shared.Salvage.Expeditions;
|
||||
using Content.Shared.Salvage.Expeditions.Modifiers;
|
||||
@@ -53,8 +54,10 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
for (var i = 0; i < state.Missions.Count; i++)
|
||||
{
|
||||
var missionParams = state.Missions[i];
|
||||
var config = missionParams.MissionType;
|
||||
var mission = _salvage.GetMission(missionParams.MissionType, missionParams.Difficulty, missionParams.Seed);
|
||||
var difficultyId = "Moderate";
|
||||
var difficultyProto = _prototype.Index<SalvageDifficultyPrototype>(difficultyId);
|
||||
// TODO: Selectable difficulty soon.
|
||||
var mission = _salvage.GetMission(difficultyProto, missionParams.Seed);
|
||||
|
||||
// Mission title
|
||||
var missionStripe = new StripeBack()
|
||||
@@ -64,7 +67,7 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
|
||||
missionStripe.AddChild(new Label()
|
||||
{
|
||||
Text = Loc.GetString($"salvage-expedition-type-{config.ToString()}"),
|
||||
Text = Loc.GetString($"salvage-expedition-type"),
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
Margin = new Thickness(0f, 5f, 0f, 5f),
|
||||
});
|
||||
@@ -81,48 +84,25 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
Text = Loc.GetString("salvage-expedition-window-difficulty")
|
||||
});
|
||||
|
||||
Color difficultyColor;
|
||||
|
||||
switch (missionParams.Difficulty)
|
||||
{
|
||||
case DifficultyRating.Minimal:
|
||||
difficultyColor = Color.FromHex("#52B4E996");
|
||||
break;
|
||||
case DifficultyRating.Minor:
|
||||
difficultyColor = Color.FromHex("#9FED5896");
|
||||
break;
|
||||
case DifficultyRating.Moderate:
|
||||
difficultyColor = Color.FromHex("#EFB34196");
|
||||
break;
|
||||
case DifficultyRating.Hazardous:
|
||||
difficultyColor = Color.FromHex("#DE3A3A96");
|
||||
break;
|
||||
case DifficultyRating.Extreme:
|
||||
difficultyColor = Color.FromHex("#D381C996");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
var difficultyColor = difficultyProto.Color;
|
||||
|
||||
lBox.AddChild(new Label
|
||||
{
|
||||
Text = Loc.GetString($"salvage-expedition-difficulty-{missionParams.Difficulty.ToString()}"),
|
||||
Text = Loc.GetString("salvage-expedition-difficulty-Moderate"),
|
||||
FontColorOverride = difficultyColor,
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
Margin = new Thickness(0f, 0f, 0f, 5f),
|
||||
});
|
||||
|
||||
// Details
|
||||
var details = _salvage.GetMissionDescription(mission);
|
||||
|
||||
lBox.AddChild(new Label
|
||||
{
|
||||
Text = Loc.GetString("salvage-expedition-window-details")
|
||||
Text = Loc.GetString("salvage-expedition-difficulty-players"),
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
});
|
||||
|
||||
lBox.AddChild(new Label
|
||||
{
|
||||
Text = details,
|
||||
Text = difficultyProto.RecommendedPlayers.ToString(),
|
||||
FontColorOverride = StyleNano.NanoGold,
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
Margin = new Thickness(0f, 0f, 0f, 5f),
|
||||
@@ -168,7 +148,7 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
|
||||
lBox.AddChild(new Label
|
||||
{
|
||||
Text = Loc.GetString(_prototype.Index<SalvageBiomeMod>(biome).ID),
|
||||
Text = Loc.GetString(_prototype.Index<SalvageBiomeModPrototype>(biome).ID),
|
||||
FontColorOverride = StyleNano.NanoGold,
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
Margin = new Thickness(0f, 0f, 0f, 5f),
|
||||
@@ -190,29 +170,6 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
Margin = new Thickness(0f, 0f, 0f, 5f),
|
||||
});
|
||||
|
||||
lBox.AddChild(new Label()
|
||||
{
|
||||
Text = Loc.GetString("salvage-expedition-window-rewards")
|
||||
});
|
||||
|
||||
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", 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)
|
||||
});
|
||||
|
||||
// Claim
|
||||
var claimButton = new Button()
|
||||
{
|
||||
@@ -289,7 +246,7 @@ public sealed partial class SalvageExpeditionWindow : FancyWindow,
|
||||
else
|
||||
{
|
||||
var cooldown = _cooldown
|
||||
? TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionFailedCooldown))
|
||||
? TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionCooldown))
|
||||
: TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionCooldown));
|
||||
|
||||
NextOfferBar.Value = 1f - (float) (remaining / cooldown);
|
||||
|
||||
Reference in New Issue
Block a user