using System; using System.Collections.Generic; namespace IdleSpectator; public enum ActivityVoiceSource { Unknown, AuthoredSpecies, TaxonomyFallback, Vehicle } /// /// Complete authored action vocabulary for one verified base mob. /// Contextual clauses such as actor, target, terrain, place, and job stay outside this type. /// public sealed class ActivitySpeciesVoice { public static readonly string[] AuthoredVerbs = { "move", "wait", "play", "eat", "sleep", "hunt", "fight", "social", "laugh", "work", "sing", "lover", "farm", "pollinate", "trade", "fish", "haul", "heal", "fire", "flee", "settle", "warrior", "read", "gather_life", "relieve", "confused", "recharge", "strange_urge", "steal", "possessed", "dream", "ignite", "extinguish", "group", "harvest_life", "loot", "cry", "swear" }; private readonly Dictionary _bags; private readonly Dictionary _liquidBags = new Dictionary(StringComparer.Ordinal); public string Id { get; } internal ActivitySpeciesVoice(string id, Dictionary bags) { Id = id ?? ""; _bags = bags ?? new Dictionary(StringComparer.Ordinal); } public static bool IsAuthoredVerb(string verb) { string key = verb ?? ""; for (int i = 0; i < AuthoredVerbs.Length; i++) { if (AuthoredVerbs[i].Equals(key, StringComparison.Ordinal)) { return true; } } return false; } 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 < AuthoredVerbs.Length; i++) { if (!_bags.TryGetValue(AuthoredVerbs[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; } } internal void SetBag(string verb, string[] bag) { if (!string.IsNullOrEmpty(verb) && bag != null && bag.Length > 0) { _bags[verb] = bag; } } }