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:
Samuel Bouchet 2026-03-14 20:43:30 +01:00
parent 83270ed4a0
commit af13380a26
2 changed files with 34 additions and 13 deletions

View file

@ -460,6 +460,10 @@ public static class Program
// Collect all received items to show as a single grouped loot reveal // Collect all received items to show as a single grouped loot reveal
var allLoot = new List<(string name, string rarity, string category)>(); 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) // Show only the primary box opening (not auto-opened intermediaries)
bool primaryBoxShown = false; bool primaryBoxShown = false;
@ -497,18 +501,28 @@ public static class Program
RefreshRenderer(); RefreshRenderer();
var featureLabel = _loc.Get(GetUIFeatureLocKey(uiEvt.Feature)); var featureLabel = _loc.Get(GetUIFeatureLocKey(uiEvt.Feature));
_renderer.ShowUIFeatureUnlocked(featureLabel); _renderer.ShowUIFeatureUnlocked(featureLabel);
AddEventLog($" {featureLabel}"); AddEventLog($"* {featureLabel}");
_renderer.WaitForKeyPress(_loc.Get("prompt.press_key")); _renderer.WaitForKeyPress(_loc.Get("prompt.press_key"));
break; 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: case InteractionTriggeredEvent interEvt:
_renderer.ShowInteraction(_loc.Get(interEvt.DescriptionKey)); // Defer interaction display until after loot reveal
deferredInteractions.Add(_loc.Get(interEvt.DescriptionKey));
break; break;
case ResourceChangedEvent resEvt: case ResourceChangedEvent resEvt:
var resName = _loc.Get($"resource.{resEvt.Type.ToString().ToLower()}"); var resName = _loc.Get($"resource.{resEvt.Type.ToString().ToLower()}");
_renderer.ShowMessage($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}"); _renderer.ShowMessage($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
AddEventLog($"{resName}: {resEvt.OldValue} → {resEvt.NewValue}"); AddEventLog($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
break; break;
case MessageEvent msgEvt: case MessageEvent msgEvt:
@ -526,7 +540,7 @@ public static class Program
case AdventureUnlockedEvent advUnlockedEvt: case AdventureUnlockedEvent advUnlockedEvt:
var advName = GetAdventureName(advUnlockedEvt.Theme); var advName = GetAdventureName(advUnlockedEvt.Theme);
_renderer.ShowMessage(_loc.Get("adventure.unlocked", advName)); _renderer.ShowMessage(_loc.Get("adventure.unlocked", advName));
AddEventLog($"🗺 {advName}"); AddEventLog($">> {advName}");
break; break;
case AdventureStartedEvent advEvt: 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")); _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_qty", itemName, remaining.ToString())
: _loc.Get("inventory.item_used", itemName); : _loc.Get("inventory.item_used", itemName);
_renderer.ShowMessage(usedMsg); _renderer.ShowMessage(usedMsg);
_renderer.ShowMessage($"{resName}: {resEvt.OldValue} {resEvt.NewValue}"); _renderer.ShowMessage($"{resName}: {resEvt.OldValue} -> {resEvt.NewValue}");
AddEventLog($"🧪 {itemName} → {resName} {resEvt.OldValue}→{resEvt.NewValue}"); AddEventLog($"{itemName} -> {resName} {resEvt.OldValue}->{resEvt.NewValue}");
break; break;
case MessageEvent msgEvt: case MessageEvent msgEvt:
_renderer.ShowMessage(_loc.Get(msgEvt.MessageKey, msgEvt.Args ?? [])); _renderer.ShowMessage(_loc.Get(msgEvt.MessageKey, msgEvt.Args ?? []));
@ -787,7 +808,7 @@ public static class Program
string loreText = _loc.Get(loreKey); string loreText = _loc.Get(loreKey);
var panel = new Panel($"[italic]{Markup.Escape(loreText)}[/]") var panel = new Panel($"[italic]{Markup.Escape(loreText)}[/]")
.Header($"[bold yellow]📜 {Markup.Escape(name)}[/]") .Header($"[bold yellow]{Markup.Escape(name)}[/]")
.Border(BoxBorder.Double) .Border(BoxBorder.Double)
.BorderStyle(new Style(Color.Yellow)) .BorderStyle(new Style(Color.Yellow))
.Padding(2, 1) .Padding(2, 1)

View file

@ -323,7 +323,7 @@ public sealed class SpectreRenderer : IRenderer
{ {
if (_context.HasColors) if (_context.HasColors)
{ {
var panel = new Panel($"[bold yellow]★ {Markup.Escape(featureName)} ★[/]") var panel = new Panel($"[bold yellow]* {Markup.Escape(featureName)} *[/]")
.Border(BoxBorder.Double) .Border(BoxBorder.Double)
.BorderStyle(new Style(Color.Yellow)) .BorderStyle(new Style(Color.Yellow))
.Padding(2, 0) .Padding(2, 0)
@ -333,7 +333,7 @@ public sealed class SpectreRenderer : IRenderer
else else
{ {
Console.WriteLine("========================================"); Console.WriteLine("========================================");
Console.WriteLine($" ★ {featureName} ★"); Console.WriteLine($" * {featureName} *");
Console.WriteLine("========================================"); Console.WriteLine("========================================");
} }
} }
@ -431,10 +431,10 @@ public sealed class SpectreRenderer : IRenderer
/// </summary> /// </summary>
private static string RarityStars(string rarity) => rarity.ToLowerInvariant() switch private static string RarityStars(string rarity) => rarity.ToLowerInvariant() switch
{ {
"rare" => " ", "rare" => "* ",
"epic" => "★★ ", "epic" => "** ",
"legendary" => "★★★ ", "legendary" => "*** ",
"mythic" => "★★★★ ", "mythic" => "**** ",
_ => "" _ => ""
}; };