71 lines
2.7 KiB
C#
71 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
/// <summary>Authored interest overlay for every live book_types asset.</summary>
|
|
public static partial class EventCatalog
|
|
{
|
|
public static class Book
|
|
{
|
|
private static readonly Dictionary<string, DiscreteEventEntry> Entries =
|
|
new Dictionary<string, DiscreteEventEntry>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
static Book()
|
|
{
|
|
// All authored books are Layer A; EventStrength ranks them.
|
|
Add("family_story", 52f, "Culture", "{a} writes a family story");
|
|
Add("love_story", 58f, "Culture", "{a} writes a love story");
|
|
Add("friendship_story", 50f, "Culture", "{a} writes a friendship story");
|
|
Add("bad_story_about_king", 62f, "Culture", "{a} writes a scandalous book");
|
|
Add("fable", 48f, "Culture", "{a} writes a fable");
|
|
Add("warfare_manual", 60f, "Culture", "{a} writes a warfare manual");
|
|
Add("economy_manual", 48f, "Culture", "{a} writes an economy manual");
|
|
Add("stewardship_manual", 48f, "Culture", "{a} writes a stewardship manual");
|
|
Add("diplomacy_manual", 55f, "Culture", "{a} writes a diplomacy manual");
|
|
Add("mathbook", 45f, "Culture", "{a} writes a math book");
|
|
Add("biology_book", 45f, "Culture", "{a} writes a biology book");
|
|
Add("history_book", 55f, "Culture", "{a} writes a history book");
|
|
}
|
|
|
|
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 = 45f,
|
|
Category = "Culture",
|
|
LabelTemplate = "{a} writes a book",
|
|
CreatesInterest = true,
|
|
IsFallback = true
|
|
};
|
|
}
|
|
}
|
|
}
|