69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
/// <summary>Authored discrete relationship lifecycle events (not a live asset library).</summary>
|
|
public static partial class EventCatalog
|
|
{
|
|
public static class Relationship
|
|
{
|
|
private static readonly Dictionary<string, DiscreteEventEntry> Entries =
|
|
new Dictionary<string, DiscreteEventEntry>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
static Relationship()
|
|
{
|
|
Add("set_lover", 72f, "Relationship", "{a} became lovers with {b}");
|
|
Add("clear_lover", 55f, "Relationship", "{a} parted from a lover");
|
|
Add("add_child", 68f, "Relationship", "{a} and {b} have a new child");
|
|
Add("new_family", 70f, "Relationship", "{a} starts a new family");
|
|
Add("family_removed", 50f, "Relationship", "{a}'s family ends");
|
|
Add("find_lover", 45f, "Relationship", "{a} is seeking a lover");
|
|
Add("family_group_new", 60f, "Relationship", "{a} forms a family pack");
|
|
Add("family_group_join", 36f, "Relationship", "{a} joins a family pack", createsInterest: false);
|
|
Add("family_group_leave", 36f, "Relationship", "{a} leaves a family pack", createsInterest: false);
|
|
Add("baby_created", 70f, "Relationship", "{a} welcomes a baby");
|
|
}
|
|
|
|
private static void Add(
|
|
string id,
|
|
float strength,
|
|
string category,
|
|
string label,
|
|
bool createsInterest = true)
|
|
{
|
|
Entries[id] = new DiscreteEventEntry
|
|
{
|
|
Id = id,
|
|
EventStrength = strength,
|
|
Category = category,
|
|
CreatesInterest = createsInterest,
|
|
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 = 40f,
|
|
Category = "Relationship",
|
|
LabelTemplate = "{a} · {id}",
|
|
CreatesInterest = false,
|
|
IsFallback = true
|
|
};
|
|
}
|
|
}
|
|
}
|