76 lines
2 KiB
C#
76 lines
2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
public enum ActivityVoiceSource
|
|
{
|
|
Unknown,
|
|
AuthoredSpecies,
|
|
TaxonomyFallback,
|
|
Vehicle
|
|
}
|
|
|
|
/// <summary>
|
|
/// Complete authored action vocabulary for one verified base mob.
|
|
/// Contextual clauses such as actor, target, terrain, place, and job stay outside this type.
|
|
/// </summary>
|
|
public sealed class ActivitySpeciesVoice
|
|
{
|
|
public static readonly string[] CoreVerbs =
|
|
{
|
|
"move", "wait", "play", "eat", "sleep",
|
|
"hunt", "fight", "social", "laugh", "work"
|
|
};
|
|
|
|
private readonly Dictionary<string, string[]> _bags;
|
|
private readonly Dictionary<string, string[]> _liquidBags =
|
|
new Dictionary<string, string[]>(StringComparer.Ordinal);
|
|
|
|
public string Id { get; }
|
|
|
|
internal ActivitySpeciesVoice(string id, Dictionary<string, string[]> bags)
|
|
{
|
|
Id = id ?? "";
|
|
_bags = bags ?? new Dictionary<string, string[]>(StringComparer.Ordinal);
|
|
}
|
|
|
|
public string[] GetBag(string verb, ActivityTerrain terrain)
|
|
{
|
|
string key = verb ?? "";
|
|
if (terrain == ActivityTerrain.Liquid
|
|
&& _liquidBags.TryGetValue(key, out string[] liquid)
|
|
&& liquid != null
|
|
&& liquid.Length > 0)
|
|
{
|
|
return liquid;
|
|
}
|
|
|
|
return _bags.TryGetValue(key, out string[] bag) ? bag : null;
|
|
}
|
|
|
|
public bool HasCompleteCore()
|
|
{
|
|
for (int i = 0; i < CoreVerbs.Length; i++)
|
|
{
|
|
if (!_bags.TryGetValue(CoreVerbs[i], out string[] bag)
|
|
|| bag == null
|
|
|| bag.Length < 2
|
|
|| string.IsNullOrEmpty(bag[0])
|
|
|| string.IsNullOrEmpty(bag[1]))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
internal void SetLiquidBag(string verb, string[] bag)
|
|
{
|
|
if (!string.IsNullOrEmpty(verb) && bag != null && bag.Length > 0)
|
|
{
|
|
_liquidBags[verb] = bag;
|
|
}
|
|
}
|
|
}
|