private void GetEntities() { try { this.lockSelection = true; Actor.Modes mode = this.selection.GetMode(); ActorTableOffset actorTableOffset; BaseOffset targetOffset; // clear the entity list this.Entities.Clear(); if (mode == Actor.Modes.GPose) { actorTableOffset = Offsets.Main.GposeActorTable; targetOffset = Offsets.Main.Gpose; } else if (mode == Actor.Modes.Overworld) { actorTableOffset = Offsets.Main.ActorTable; targetOffset = Offsets.Main.Target; } else { throw new Exception("Unknown selection mode: " + mode); } byte count = actorTableOffset.GetCount(); HashSet <string> ids = new HashSet <string>(); for (byte i = 0; i < count; i++) { ActorTypes type = actorTableOffset.GetActorValue(i, Offsets.Main.ActorType); string name = actorTableOffset.GetActorValue(i, Offsets.Main.Name); string id = SelectionService.GetActorId(mode, type, name); if (ids.Contains(id)) { continue; } ids.Add(id); if (string.IsNullOrEmpty(name)) { name = "Unknown"; } PossibleSelection selection = new PossibleSelection(type, actorTableOffset.GetBaseOffset(i), id, name, mode); this.Entities.Add(selection); } if (this.selection.CurrentGameTarget != null) { this.InGameSelection = this.selection.CurrentGameTarget.Name; this.InGameIcon = this.selection.CurrentGameTarget.Type.GetIcon(); } else { this.InGameSelection = null; this.InGameIcon = IconChar.None; } this.lockSelection = false; } catch (Exception ex) { Log.Write(ex); } }
public static string GetActorId(Actor.Modes mode, ActorTypes type, string name) { return(mode.ToString() + "_" + type + "_" + name); }