using System; using System.Collections.Generic; namespace IdleSpectator; /// /// Live-seeded interest catalogs: every live library id is authored (Ambient default), /// with curated Signal overlays for spectacle / kingdom-affecting entries. /// public static class LiveLibraryInterest { public static void EnsureSeeded( Dictionary entries, Func> enumerateLive, string category, string labelTemplate, float ambientStrength, HashSet signalIds, float signalStrength, Func signalPredicate = null, bool ambientCreatesInterest = true) { if (entries == null || enumerateLive == null) { return; } List live; try { live = enumerateLive() ?? new List(); } catch { live = new List(); } for (int i = 0; i < live.Count; i++) { string id = live[i]; if (string.IsNullOrEmpty(id) || entries.ContainsKey(id)) { continue; } bool signal = (signalIds != null && signalIds.Contains(id)) || (signalPredicate != null && signalPredicate(id)); entries[id] = new DiscreteEventEntry { Id = id, EventStrength = signal ? signalStrength : ambientStrength, Category = category, CreatesInterest = signal || ambientCreatesInterest, LabelTemplate = labelTemplate }; } } public static DiscreteEventEntry Lookup( Dictionary entries, string id, string category, string labelTemplate, float fallbackStrength = 40f, bool fallbackCreatesInterest = false) { if (!string.IsNullOrEmpty(id) && entries != null && entries.TryGetValue(id.Trim(), out DiscreteEventEntry entry)) { return entry; } string key = string.IsNullOrEmpty(id) ? "unknown" : id.Trim(); return new DiscreteEventEntry { Id = key, EventStrength = fallbackStrength, Category = category, LabelTemplate = labelTemplate, CreatesInterest = fallbackCreatesInterest, IsFallback = true }; } }