namespace XFEEDToolBox.Core.Galaxy; public enum GalaxyThargoidTargetKind { Signal, Recommended } public sealed record GalaxyThargoidTarget(GalaxyThargoidTargetKind Kind,int Id,long SystemAddress,int? State, string Label,string Detail,string? SystemName=null) { public string Title=>string.IsNullOrWhiteSpace(SystemName)?Label:Label+" · "+SystemName; } public sealed record GalaxyThargoidCountDisplay(int State,string Label,uint? Count) { public string Text=>Label+":"+(Count?.ToString("N0")??"未知"); } /// Presentation of the original published cache, without inferring world completeness. public static class GalaxyThargoidPresentation { public static string? StateKey(int? state)=>state switch{33=>"alert",34=>"invasion",35=>"controlled",36=>"titan",37=>"recovery",_=>null}; public static IReadOnlyDictionary ObservedStates(GalaxyThargoidSnapshot snapshot) { var states=snapshot.Signals.Select(s=>(Address:s.SystemAddress,State:s.Stronghold?(int?)36:null)).Concat(snapshot.Recommended.Select(s=>(Address:s.SystemAddress,State:(int?)s.State))); return states.GroupBy(s=>s.Address).ToDictionary(g=>g.Key,g=>g.Where(s=>s.State is not null).Select(s=>s.State).Distinct().ToArray() is {Length:1} unique?unique[0]:null); } // FactionStates.as 33..38 and the original Chinese localization tokens. // 38 is retained by its source name: the original war panel does not present // this pseudo state as a seventh war category. public static string StateName(int state)=>state switch {33=>"Thargoid 警戒",34=>"Thargoid 入侵",35=>"Thargoid 控制",36=>"Thargoid Titan",37=>"Thargoid 战后恢复",38=>"Pseudo_HumanControlled",_=>"原状态 "+state}; // Exact Maps_AntiXeno_Panel_Signal_System{address} labels, rather than an // assumed relationship between current position, signal index and a Titan. private static readonly IReadOnlyDictionary SignalLabels=new Dictionary { [216618994011]="Titan Leigong",[5031923290818]="Titan Cocijo",[10477373803]="Titan Cocijo", [13866167510393]="Titan Taranis",[1458443260610]="Titan Thor",[1659744799067]="Titan Indra", [9465705473417]="Titan Oya",[79247165795]="泰坦 Hadad",[7265876583833]="泰坦 Raijin" }; public static IReadOnlyList Counts(GalaxyThargoidSnapshot snapshot)=>snapshot.States .Select(s=>new GalaxyThargoidCountDisplay(s.State,StateName(s.State),snapshot.Ready?s.Count:null)).ToArray(); public static IReadOnlyList Signals(GalaxyThargoidSnapshot snapshot)=>snapshot.Signals.Select(s=> new GalaxyThargoidTarget(GalaxyThargoidTargetKind.Signal,s.Id,s.SystemAddress,null, (SignalLabels.GetValueOrDefault(s.SystemAddress)??"原信号 #"+s.Id)+(s.Stronghold?"":" (已摧毁)"), "受影响星系:"+(s.AffectedSystemsCount?.ToString("N0")??"未知")+" · 地址 "+s.SystemAddress)).ToArray(); public static IReadOnlyList Recommendations(GalaxyThargoidSnapshot snapshot)=>snapshot.Recommended.Select(s=> new GalaxyThargoidTarget(GalaxyThargoidTargetKind.Recommended,s.Id,s.SystemAddress,s.State, StateName(s.State)+" #"+(s.Rank+1),"原进度 "+s.Progress.ToString("P1")+" · 地址 "+s.SystemAddress)).ToArray(); }