namespace PlayerNotes; /// /// The two pools of tracked players. Both are managed identically in the UI. /// public enum Pool { Friends, Blacklist, } /// /// A single tracked player: notes plus any tags that apply to them. /// ContentId is null when the player was added by name only (e.g. typed in manually). /// World disambiguates players who share a name across different worlds; empty when unknown. /// public class PlayerEntry { public string Name { get; set; } = ""; /// The player's home world, e.g. "Phoenix". Empty when it could not be determined. public string World { get; set; } = ""; public ulong? ContentId { get; set; } public string Notes { get; set; } = ""; public List Tags { get; set; } = new(); public DateTime AddedAtUtc { get; set; } = DateTime.UtcNow; } /// /// The sets of tags available for each pool. These are user-editable in the JSON data file: /// see PlayerNotes.json next to this plugin's config directory. /// public class TagSets { public List Friends { get; set; } = new() { "raider", "healer", "tank", "dps", "speedrunner", "lfg friendly", }; public List Blacklist { get; set; } = new() { "toxic behavior", "impatient", "progression point liar", "afk / leaves early", "griefer", "no comms", }; public List ForPool(Pool pool) => pool switch { Pool.Friends => Friends, _ => Blacklist, }; } /// /// Root object of the PlayerNotes.json data file. The same shape is used for /// export/import so a single file can move your lists (and tag definitions) between PCs. /// public class PlayerNotesData { public int Version { get; set; } = 1; public TagSets Tags { get; set; } = new(); public List Friends { get; set; } = new(); public List Blacklist { get; set; } = new(); public List GetPool(Pool pool) => pool switch { Pool.Friends => Friends, _ => Blacklist, }; /// Fills in any collections that were missing from an older/partial file. internal void Normalize() { Tags ??= new TagSets(); Tags.Friends ??= new List(); Tags.Blacklist ??= new List(); Friends ??= new List(); Blacklist ??= new List(); foreach (var entry in Friends.Concat(Blacklist)) { entry.Name ??= ""; entry.World ??= ""; entry.Notes ??= ""; entry.Tags ??= new List(); } } }