worldbox-observer-mod/IdleSpectator/Events/Catalogs/EventCatalog.Era.cs
2026-07-16 00:40:53 -05:00

68 lines
2 KiB
C#

using System;
using System.Collections.Generic;
namespace IdleSpectator;
/// <summary>Authored interest overlay for every live era_library asset.</summary>
public static partial class EventCatalog
{
public static class Era
{
private static readonly Dictionary<string, DiscreteEventEntry> Entries =
new Dictionary<string, DiscreteEventEntry>(StringComparer.OrdinalIgnoreCase);
static Era()
{
Add("age_hope", 78f, "World", "Age of Hope");
Add("age_sun", 80f, "World", "Age of Sun");
Add("age_dark", 88f, "World", "Age of Dark");
Add("age_tears", 86f, "World", "Age of Tears");
Add("age_moon", 82f, "World", "Age of Moon");
Add("age_chaos", 92f, "World", "Age of Chaos");
Add("age_wonders", 84f, "World", "Age of Wonders");
Add("age_ice", 87f, "World", "Age of Ice");
Add("age_ash", 90f, "World", "Age of Ash");
Add("age_despair", 91f, "World", "Age of Despair");
Add("age_unknown", 70f, "World", "Unknown age");
}
private static void Add(
string id,
float strength,
string category,
string label)
{
Entries[id] = new DiscreteEventEntry
{
Id = id,
EventStrength = strength,
Category = category,
CreatesInterest = true,
LabelTemplate = label
};
}
public static IEnumerable<string> AuthoredIds => Entries.Keys;
public static bool HasAuthored(string id) =>
!string.IsNullOrEmpty(id) && Entries.ContainsKey(id.Trim());
public static DiscreteEventEntry GetOrFallback(string id)
{
if (!string.IsNullOrEmpty(id) && Entries.TryGetValue(id.Trim(), out DiscreteEventEntry entry))
{
return entry;
}
string key = string.IsNullOrEmpty(id) ? "unknown" : id.Trim();
return new DiscreteEventEntry
{
Id = key,
EventStrength = 70f,
Category = "World",
LabelTemplate = "Era ({id})",
IsFallback = true
};
}
}
}