using System; using System.Collections.Generic; namespace IdleSpectator; public sealed class WorldLogEventEntry { public string Id = ""; public float EventStrength = 40f; public string Category = "WorldLog"; public bool CreatesInterest = true; public bool ChronicleEligible; public float MinWatch = 6f; public float MaxWatch = 28f; public string LabelTemplate = "{id}"; public bool IsFallback; public string MakeLabel(string special1, string special2) { string a = special1 ?? ""; string b = special2 ?? ""; string template = string.IsNullOrEmpty(LabelTemplate) ? "{id}" : LabelTemplate; return template .Replace("{id}", Id ?? "") .Replace("{a}", a) .Replace("{b}", b) .Replace("{special1}", a) .Replace("{special2}", b); } public string MakeLabel(WorldLogMessage message) { if (message == null) { return MakeLabel("", ""); } return MakeLabel(message.special1, message.special2); } } /// /// Authored policy for every live WorldLog asset. Game library is inventory; this is presentation/scoring only. /// public static partial class EventCatalog { public static class WorldLog { private static readonly Dictionary Entries = new Dictionary(StringComparer.OrdinalIgnoreCase); static WorldLog() { // Kings Add("king_new", 78f, "Politics", true, "New king: {b} ({a})", 6f, 28f); Add("king_left", 65f, "Politics", true, "King left: {b} ({a})", 6f, 28f); Add("king_fled_capital", 70f, "Politics", true, "King fled capital: {b}", 6f, 28f); Add("king_fled_city", 68f, "Politics", true, "King fled city: {b}", 6f, 28f); Add("king_dead", 80f, "Politics", true, "King died: {b} ({a})", 6f, 28f); Add("king_killed", 85f, "Politics", true, "King killed: {b} ({a})", 6f, 28f); // Favorites Add("favorite_dead", 82f, "Politics", true, "Favorite fell: {a}", 6f, 28f); Add("favorite_killed", 85f, "Politics", true, "Favorite fell: {a}", 6f, 28f); // Cities / kingdoms / clans / wars / alliances Add("city_new", 72f, "Settlement", true, "New city: {a}", 6f, 28f); Add("log_city_revolted", 90f, "Politics", true, "Revolt: {a}", 8f, 35f); Add("city_destroyed", 92f, "Settlement", true, "City destroyed: {a}", 8f, 35f); Add("diplomacy_war_ended", 72f, "Politics", true, "War ended: {a}", 6f, 28f); Add("diplomacy_war_started", 100f, "Politics", true, "War: {a} vs {b}", 8f, 35f); Add("total_war_started", 100f, "Politics", true, "Total war: {a}", 8f, 35f); Add("alliance_new", 70f, "Politics", true, "Alliance: {a}", 6f, 28f); Add("alliance_dissolved", 68f, "Politics", true, "Alliance dissolved: {a}", 6f, 28f); Add("kingdom_new", 75f, "Settlement", true, "New kingdom: {a}", 6f, 28f); Add("kingdom_destroyed", 100f, "Politics", true, "Kingdom fell: {a}", 8f, 35f); Add("kingdom_shattered", 98f, "Politics", true, "Kingdom shattered: {a}", 8f, 35f); Add("kingdom_fractured", 95f, "Politics", true, "Kingdom fractured: {a}", 8f, 35f); Add("kingdom_royal_clan_new", 74f, "Politics", true, "Royal clan: {a}", 6f, 28f); Add("kingdom_royal_clan_changed", 72f, "Politics", true, "Royal clan: {a}", 6f, 28f); Add("kingdom_royal_clan_dead", 76f, "Politics", true, "Royal clan ended: {a}", 6f, 28f); // Disasters (WorldLog ids; linked to disasters library by naming) Add("disaster_tornado", 95f, "Disaster", true, "Tornado: {a}", 8f, 35f); Add("disaster_meteorite", 95f, "Disaster", true, "Meteorite: {a}", 8f, 35f); Add("disaster_hellspawn", 96f, "Disaster", true, "Hellspawn: {a}", 8f, 35f); Add("disaster_earthquake", 95f, "Disaster", true, "Earthquake: {a}", 8f, 35f); Add("disaster_greg_abominations", 96f, "Disaster", true, "Greg abominations: {a}", 8f, 35f); Add("disaster_ice_ones", 95f, "Disaster", true, "Ice ones awaken: {a}", 8f, 35f); Add("disaster_sudden_snowman", 90f, "Disaster", true, "Sudden snowman: {a}", 8f, 35f); Add("disaster_garden_surprise", 90f, "Disaster", true, "Garden surprise: {a}", 8f, 35f); Add("disaster_dragon_from_farlands", 98f, "Disaster", true, "Dragon from the farlands: {a}", 8f, 35f); Add("disaster_bandits", 92f, "Disaster", true, "Bandit raid: {a}", 8f, 35f); Add("disaster_alien_invasion", 97f, "Disaster", true, "Alien invasion: {a}", 8f, 35f); Add("disaster_biomass", 96f, "Disaster", true, "Biomass outbreak: {a}", 8f, 35f); Add("disaster_tumor", 96f, "Disaster", true, "Tumor outbreak: {a}", 8f, 35f); Add("disaster_heatwave", 88f, "Disaster", true, "Heatwave: {a}", 8f, 35f); Add("disaster_evil_mage", 94f, "Disaster", true, "Evil mage: {a}", 8f, 35f); Add("disaster_underground_necromancer", 95f, "Disaster", true, "Underground necromancer: {a}", 8f, 35f); Add("disaster_mad_thoughts", 90f, "Disaster", true, "Mad thoughts: {a}", 8f, 35f); // Harness / internal - authored but never owns camera interest Add("auto_tester", 10f, "Harness", false, "Auto tester: {a}", 2f, 6f); } private static void Add( string id, float strength, string category, bool createsInterest, string labelTemplate, float minWatch, float maxWatch) { Entries[id] = new WorldLogEventEntry { Id = id, EventStrength = strength, Category = category, CreatesInterest = createsInterest, ChronicleEligible = createsInterest && strength >= 65f, LabelTemplate = labelTemplate, MinWatch = minWatch, MaxWatch = maxWatch }; } public static IEnumerable AuthoredIds => Entries.Keys; public static bool HasAuthored(string assetId) { return !string.IsNullOrEmpty(assetId) && Entries.ContainsKey(assetId.Trim()); } public static bool TryGet(string assetId, out WorldLogEventEntry entry) { entry = null; if (string.IsNullOrEmpty(assetId)) { return false; } return Entries.TryGetValue(assetId.Trim(), out entry); } public static WorldLogEventEntry GetOrFallback(string assetId) { if (TryGet(assetId, out WorldLogEventEntry entry)) { return entry; } string id = string.IsNullOrEmpty(assetId) ? "unknown" : assetId.Trim(); float strength = 40f; string category = "WorldLog"; if (id.IndexOf("disaster", StringComparison.OrdinalIgnoreCase) >= 0) { strength = 95f; category = "Disaster"; } return new WorldLogEventEntry { Id = id, EventStrength = strength, Category = category, CreatesInterest = true, ChronicleEligible = strength >= 65f, LabelTemplate = "{id}: {a}", MinWatch = strength >= 90f ? 8f : 6f, MaxWatch = strength >= 90f ? 35f : 28f, IsFallback = true }; } public static bool TryGetEventStrength(string assetId, out float eventStrength) { WorldLogEventEntry entry = GetOrFallback(assetId); eventStrength = entry.EventStrength; return !string.IsNullOrEmpty(assetId); } public static string MakeLabel(WorldLogMessage message) { if (message == null) { return "event"; } return GetOrFallback(message.asset_id).MakeLabel(message); } } }