Defer interaction messages after loot reveal and replace Unicode with ASCII
- Collect InteractionTriggeredEvent during box opening and display them after the loot reveal sequence for better context - Replace ★ with * and → with -> for cmd.exe compatibility (CP437) - Remove emoji (🧪📜) from event log entries
This commit is contained in:
parent
83270ed4a0
commit
af13380a26
2 changed files with 34 additions and 13 deletions
|
|
@ -460,6 +460,10 @@ public static class Program
|
|||
|
||||
// Collect all received items to show as a single grouped loot reveal
|
||||
var allLoot = new List<(string name, string rarity, string category)>();
|
||||
// Collect interactions to show after loot reveal with context
|
||||
var deferredInteractions = new List<string>();
|
||||
// Track consumed item names for interaction context
|
||||
var consumedItemNames = new Dictionary<Guid, string>();
|
||||
|
||||
// Show only the primary box opening (not auto-opened intermediaries)
|
||||
bool primaryBoxShown = false;
|
||||
|
|
@ -497,18 +501,28 @@ public static class Program
|
|||
RefreshRenderer();
|
||||
var featureLabel = _loc.Get(GetUIFeatureLocKey(uiEvt.Feature));
|
||||
_renderer.ShowUIFeatureUnlocked(featureLabel);
|
||||
AddEventLog($"★ {featureLabel}");
|
||||
AddEventLog($"* {featureLabel}");
|
||||
_renderer.WaitForKeyPress(_loc.Get("prompt.press_key"));
|
||||
break;
|
||||
|
||||
case ItemConsumedEvent consumedEvt:
|
||||
// Track consumed item names for interaction context
|
||||
consumedItemNames[consumedEvt.InstanceId] = GetLocalizedName(
|
||||
_state.Inventory.FirstOrDefault(i => i.Id == consumedEvt.InstanceId)?.DefinitionId
|
||||
?? events.OfType<ItemReceivedEvent>()
|
||||
.FirstOrDefault(r => r.Item.Id == consumedEvt.InstanceId)?.Item.DefinitionId
|
||||
?? "?");
|
||||
break;
|
||||
|
||||
case InteractionTriggeredEvent interEvt:
|
||||
_renderer.ShowInteraction(_loc.Get(interEvt.DescriptionKey));
|
||||
// Defer interaction display until after loot reveal
|
||||
deferredInteractions.Add(_loc.Get(interEvt.DescriptionKey));
|
||||
break;
|
||||
|
||||
case ResourceChangedEvent resEvt:
|
||||
var resName = _loc.Get($"resource.{resEvt.Type.ToString().ToLower()}");
|
||||
_renderer.ShowMessage($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
|
||||
AddEventLog($"{resName}: {resEvt.OldValue} → {resEvt.NewValue}");
|
||||
AddEventLog($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
|
||||
break;
|
||||
|
||||
case MessageEvent msgEvt:
|
||||
|
|
@ -526,7 +540,7 @@ public static class Program
|
|||
case AdventureUnlockedEvent advUnlockedEvt:
|
||||
var advName = GetAdventureName(advUnlockedEvt.Theme);
|
||||
_renderer.ShowMessage(_loc.Get("adventure.unlocked", advName));
|
||||
AddEventLog($"🗺 {advName}");
|
||||
AddEventLog($">> {advName}");
|
||||
break;
|
||||
|
||||
case AdventureStartedEvent advEvt:
|
||||
|
|
@ -581,6 +595,13 @@ public static class Program
|
|||
}
|
||||
}
|
||||
|
||||
// Show deferred interactions after the loot reveal, with context
|
||||
foreach (var interactionMsg in deferredInteractions)
|
||||
{
|
||||
_renderer.ShowMessage("");
|
||||
_renderer.ShowInteraction(interactionMsg);
|
||||
}
|
||||
|
||||
_renderer.WaitForKeyPress(_loc.Get("prompt.press_key"));
|
||||
}
|
||||
|
||||
|
|
@ -737,8 +758,8 @@ public static class Program
|
|||
? _loc.Get("inventory.item_used_qty", itemName, remaining.ToString())
|
||||
: _loc.Get("inventory.item_used", itemName);
|
||||
_renderer.ShowMessage(usedMsg);
|
||||
_renderer.ShowMessage($"{resName}: {resEvt.OldValue} → {resEvt.NewValue}");
|
||||
AddEventLog($"🧪 {itemName} → {resName} {resEvt.OldValue}→{resEvt.NewValue}");
|
||||
_renderer.ShowMessage($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
|
||||
AddEventLog($"{itemName} -> {resName} {resEvt.OldValue}->{resEvt.NewValue}");
|
||||
break;
|
||||
case MessageEvent msgEvt:
|
||||
_renderer.ShowMessage(_loc.Get(msgEvt.MessageKey, msgEvt.Args ?? []));
|
||||
|
|
@ -787,7 +808,7 @@ public static class Program
|
|||
string loreText = _loc.Get(loreKey);
|
||||
|
||||
var panel = new Panel($"[italic]{Markup.Escape(loreText)}[/]")
|
||||
.Header($"[bold yellow]📜 {Markup.Escape(name)}[/]")
|
||||
.Header($"[bold yellow]{Markup.Escape(name)}[/]")
|
||||
.Border(BoxBorder.Double)
|
||||
.BorderStyle(new Style(Color.Yellow))
|
||||
.Padding(2, 1)
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ public sealed class SpectreRenderer : IRenderer
|
|||
{
|
||||
if (_context.HasColors)
|
||||
{
|
||||
var panel = new Panel($"[bold yellow]★ {Markup.Escape(featureName)} ★[/]")
|
||||
var panel = new Panel($"[bold yellow]* {Markup.Escape(featureName)} *[/]")
|
||||
.Border(BoxBorder.Double)
|
||||
.BorderStyle(new Style(Color.Yellow))
|
||||
.Padding(2, 0)
|
||||
|
|
@ -333,7 +333,7 @@ public sealed class SpectreRenderer : IRenderer
|
|||
else
|
||||
{
|
||||
Console.WriteLine("========================================");
|
||||
Console.WriteLine($" ★ {featureName} ★");
|
||||
Console.WriteLine($" * {featureName} *");
|
||||
Console.WriteLine("========================================");
|
||||
}
|
||||
}
|
||||
|
|
@ -431,10 +431,10 @@ public sealed class SpectreRenderer : IRenderer
|
|||
/// </summary>
|
||||
private static string RarityStars(string rarity) => rarity.ToLowerInvariant() switch
|
||||
{
|
||||
"rare" => "★ ",
|
||||
"epic" => "★★ ",
|
||||
"legendary" => "★★★ ",
|
||||
"mythic" => "★★★★ ",
|
||||
"rare" => "* ",
|
||||
"epic" => "** ",
|
||||
"legendary" => "*** ",
|
||||
"mythic" => "**** ",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue