worldbox-observer-mod/IdleSpectator/WorldLogInterestTable.cs
2026-07-14 13:20:49 -05:00

131 lines
4.5 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace IdleSpectator;
/// <summary>
/// Centralized WorldLog asset ids and tier mapping.
/// </summary>
public static class WorldLogInterestTable
{
private static readonly Dictionary<string, InterestTier> Tiers = new Dictionary<string, InterestTier>
{
// Epic - world-shaping (wiki: Wars, Kingdoms fall, Disasters, city destroyed)
["diplomacy_war_started"] = InterestTier.Epic,
["total_war_started"] = InterestTier.Epic,
["kingdom_destroyed"] = InterestTier.Epic,
["kingdom_shattered"] = InterestTier.Epic,
["kingdom_fractured"] = InterestTier.Epic,
["city_destroyed"] = InterestTier.Epic,
["log_city_revolted"] = InterestTier.Epic,
// Story - leadership / politics / favorites / founding
["kingdom_new"] = InterestTier.Story,
["city_new"] = InterestTier.Story,
["king_new"] = InterestTier.Story,
["king_dead"] = InterestTier.Story,
["king_killed"] = InterestTier.Story,
["king_fled_capital"] = InterestTier.Story,
["king_fled_city"] = InterestTier.Story,
["king_left"] = InterestTier.Story,
["alliance_new"] = InterestTier.Story,
["alliance_dissolved"] = InterestTier.Story,
["diplomacy_war_ended"] = InterestTier.Story,
["favorite_dead"] = InterestTier.Story,
["favorite_killed"] = InterestTier.Story,
["kingdom_royal_clan_new"] = InterestTier.Story,
["kingdom_royal_clan_changed"] = InterestTier.Story,
["kingdom_royal_clan_dead"] = InterestTier.Story,
// Curiosity - biosphere footnotes
["race_dead"] = InterestTier.Curiosity
};
public static bool TryGetTier(string assetId, out InterestTier tier)
{
if (string.IsNullOrEmpty(assetId))
{
tier = InterestTier.Ambient;
return false;
}
if (Tiers.TryGetValue(assetId, out tier))
{
return true;
}
if (assetId.Contains("disaster") || assetId.StartsWith("worldlog_disaster"))
{
tier = InterestTier.Epic;
return true;
}
tier = InterestTier.Ambient;
return false;
}
public static string MakeLabel(WorldLogMessage message)
{
string id = message.asset_id ?? "event";
string a = message.special1;
string b = message.special2;
switch (id)
{
case "diplomacy_war_started":
return $"War: {a} vs {b}";
case "total_war_started":
return $"Total war: {a}";
case "kingdom_destroyed":
return $"Kingdom fell: {a}";
case "kingdom_shattered":
return $"Kingdom shattered: {a}";
case "kingdom_fractured":
return $"Kingdom fractured: {a}";
case "city_destroyed":
return $"City destroyed: {a}";
case "log_city_revolted":
return $"Revolt: {a}";
case "kingdom_new":
return $"New kingdom: {a}";
case "city_new":
return $"New city: {a}";
case "king_new":
return $"New king: {b} ({a})";
case "king_dead":
return $"King died: {b} ({a})";
case "king_killed":
return $"King killed: {b} ({a})";
case "king_fled_capital":
return $"King fled capital: {b}";
case "king_fled_city":
return $"King fled city: {b}";
case "alliance_new":
return $"Alliance: {a}";
case "alliance_dissolved":
return $"Alliance dissolved: {a}";
case "diplomacy_war_ended":
return $"War ended: {a}";
case "kingdom_royal_clan_new":
case "kingdom_royal_clan_changed":
return $"Royal clan: {a}";
case "kingdom_royal_clan_dead":
return $"Royal clan ended: {a}";
case "race_dead":
return $"Species extinct: {a}";
case "favorite_dead":
case "favorite_killed":
return $"Favorite fell: {a}";
default:
if (!string.IsNullOrEmpty(a) && !string.IsNullOrEmpty(b))
{
return $"{id}: {a} / {b}";
}
if (!string.IsNullOrEmpty(a))
{
return $"{id}: {a}";
}
return id;
}
}
}