public static async Task PinActor(ActorTableActor actor) { foreach (ActorTableActor otherActor in Instance.PinnedActors) { if (actor.Pointer == otherActor.Pointer) { return; } } // Mannequins and housing NPC's get actor type changed, but squadron members do not. if (actor.Kind == ActorTypes.EventNpc) { bool?result = await GenericDialog.Show(LocalizationService.GetStringFormatted("Target_ConvertHousingNpcToPlayerMessage", actor.Name), LocalizationService.GetString("Target_ConvertToPlayerTitle"), MessageBoxButton.YesNo); if (result == true) { ActorViewModel?vm = actor.GetViewModel(); if (vm == null) { return; } await vm.ConvertToPlayer(); actor.Model = (Actor)vm.Model !; } } // Carbuncles get model type set to player (but not actor type!) if (actor.Kind == ActorTypes.BattleNpc && (actor.ModelType == 409 || actor.ModelType == 410 || actor.ModelType == 412)) { bool?result = await GenericDialog.Show(LocalizationService.GetStringFormatted("Target_ConvertCarbuncleToPlayerMessage", actor.Name), LocalizationService.GetString("Target_ConvertToPlayerTitle"), MessageBoxButton.YesNo); if (result == true) { ActorViewModel?vm = actor.GetViewModel(); if (vm == null) { return; } await vm.ConvertToPlayer(); actor.Model = (Actor)vm.Model !; } } await Dispatch.MainThread(); Instance.PinnedActors.Add(actor); if (Instance.SelectedActor == null) { Instance.SelectActor(actor); } }
public void SelectActor(ActorTableActor actor) { this.SelectActorViewModel(actor.GetViewModel()); foreach (ActorTableActor ac in this.PinnedActors) { ac.SelectionChanged(); } }
public static void UnpinActor(ActorTableActor actor) { Instance.PinnedActors.Remove(actor); if (actor.GetViewModel() == Instance.SelectedActor) { if (Instance.PinnedActors.Count > 0) { Instance.SelectActor(Instance.PinnedActors[0]); } else { Instance.SelectActorViewModel(null); } } }
/// <summary> /// Compares actor identity, does not compare pointers. /// </summary> public bool Is(ActorTableActor other) { // TODO: Handle cases where multiple actors share a name, but are different actors // perhaps compare modelType and customize values? return(this.Id == other.Id); }
public static async Task PinActor(ActorTableActor actor) { foreach (ActorTableActor otherActor in Instance.PinnedActors) { if (actor.Pointer == otherActor.Pointer) { return; } } // Mannequins and housing NPC's get actor type changed, but squadron members do not. if (!TerritoryService.GetIsBarracks() && actor.Kind == ActorTypes.EventNpc) { bool?result = await GenericDialog.Show($"The Actor: \"{actor.Name}\" appears to be a humanoid NPC. Do you want to change them to a player to allow for posing and appearance changes?", "Actor Selection", MessageBoxButton.YesNo); if (result == true) { ActorViewModel?vm = actor.GetViewModel(); if (vm == null) { return; } vm.Nickname = vm.Name + " (" + vm.ObjectKind + ")"; vm.ObjectKind = ActorTypes.Player; await vm.RefreshAsync(); if (vm.ModelType != 0) { vm.ModelType = 0; await vm.RefreshAsync(); } actor.Model = (Actor)vm.Model !; } } // Carbuncles get model type set to player (but not actor type!) if (actor.Kind == ActorTypes.BattleNpc) { if (actor.ModelType == 409 || actor.ModelType == 410 || actor.ModelType == 412) { bool?result = await GenericDialog.Show($"The Actor: \"{actor.Name}\" appears to be a Carbuncle. Do you want to change them to a player to allow for posing and appearance changes?", "Actor Selection", MessageBoxButton.YesNo); if (result == true) { ActorViewModel?vm = actor.GetViewModel(); if (vm == null) { return; } vm.ModelType = 0; await vm.RefreshAsync(); actor.Model = (Actor)vm.Model !; } } } App.Current.Dispatcher.Invoke(() => Instance.PinnedActors.Add(actor)); if (Instance.SelectedActor == null) { Instance.SelectActor(actor); } }