Improve Mannequin/Bell Retainer treatment.

This commit is contained in:
Ottermandias 2023-07-27 14:39:37 +02:00
parent 749a64aeb3
commit 685e089c68
4 changed files with 27 additions and 14 deletions

View file

@ -234,7 +234,8 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>
}; };
set.Designs.Add(newDesign); set.Designs.Add(newDesign);
Save(); Save();
Glamourer.Log.Debug($"Added new associated design {design?.Identifier.ToString() ?? "Reverter"} as design {set.Designs.Count} to design set."); Glamourer.Log.Debug(
$"Added new associated design {design?.Identifier.ToString() ?? "Reverter"} as design {set.Designs.Count} to design set.");
_event.Invoke(AutomationChanged.Type.AddedDesign, set, set.Designs.Count - 1); _event.Invoke(AutomationChanged.Type.AddedDesign, set, set.Designs.Count - 1);
} }
@ -387,7 +388,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>
continue; continue;
} }
var set = new AutoDesignSet(name, id) var set = new AutoDesignSet(name, group)
{ {
Enabled = obj["Enabled"]?.ToObject<bool>() ?? false, Enabled = obj["Enabled"]?.ToObject<bool>() ?? false,
BaseState = obj["BaseState"]?.ToObject<AutoDesignSet.Base>() ?? AutoDesignSet.Base.Current, BaseState = obj["BaseState"]?.ToObject<AutoDesignSet.Base>() ?? AutoDesignSet.Base.Current,
@ -449,6 +450,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>
return null; return null;
} }
} }
var applicationType = (AutoDesign.Type)(jObj["ApplicationType"]?.ToObject<uint>() ?? 0); var applicationType = (AutoDesign.Type)(jObj["ApplicationType"]?.ToObject<uint>() ?? 0);
var ret = new AutoDesign() var ret = new AutoDesign()
@ -526,7 +528,10 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>
}, },
IdentifierType.Retainer => new[] IdentifierType.Retainer => new[]
{ {
identifier.CreatePermanent(), _actors.AwaitedService.CreateRetainer(identifier.PlayerName,
identifier.Retainer == ActorIdentifier.RetainerType.Mannequin
? ActorIdentifier.RetainerType.Mannequin
: ActorIdentifier.RetainerType.Bell).CreatePermanent(),
}, },
IdentifierType.Npc => CreateNpcs(_actors.AwaitedService, identifier), IdentifierType.Npc => CreateNpcs(_actors.AwaitedService, identifier),
_ => Array.Empty<ActorIdentifier>(), _ => Array.Empty<ActorIdentifier>(),

View file

@ -19,6 +19,7 @@ public class IdentifierDrawer
public ActorIdentifier NpcIdentifier { get; private set; } = ActorIdentifier.Invalid; public ActorIdentifier NpcIdentifier { get; private set; } = ActorIdentifier.Invalid;
public ActorIdentifier PlayerIdentifier { get; private set; } = ActorIdentifier.Invalid; public ActorIdentifier PlayerIdentifier { get; private set; } = ActorIdentifier.Invalid;
public ActorIdentifier RetainerIdentifier { get; private set; } = ActorIdentifier.Invalid; public ActorIdentifier RetainerIdentifier { get; private set; } = ActorIdentifier.Invalid;
public ActorIdentifier MannequinIdentifier { get; private set; } = ActorIdentifier.Invalid;
public IdentifierDrawer(ActorService actors, IdentifierService identifier, HumanModelList humans) public IdentifierDrawer(ActorService actors, IdentifierService identifier, HumanModelList humans)
{ {
@ -52,6 +53,9 @@ public class IdentifierDrawer
public bool CanSetRetainer public bool CanSetRetainer
=> RetainerIdentifier.IsValid; => RetainerIdentifier.IsValid;
public bool CanSetMannequin
=> MannequinIdentifier.IsValid;
public bool CanSetNpc public bool CanSetNpc
=> NpcIdentifier.IsValid; => NpcIdentifier.IsValid;
@ -60,7 +64,8 @@ public class IdentifierDrawer
if (ByteString.FromString(_characterName, out var byteName)) if (ByteString.FromString(_characterName, out var byteName))
{ {
PlayerIdentifier = _actors.AwaitedService.CreatePlayer(byteName, _worldCombo.CurrentSelection.Key); PlayerIdentifier = _actors.AwaitedService.CreatePlayer(byteName, _worldCombo.CurrentSelection.Key);
RetainerIdentifier = _actors.AwaitedService.CreateRetainer(byteName, ActorIdentifier.RetainerType.Both); RetainerIdentifier = _actors.AwaitedService.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell);
MannequinIdentifier = _actors.AwaitedService.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin);
} }
NpcIdentifier = _humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc NpcIdentifier = _humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc

View file

@ -320,14 +320,17 @@ public class SetPanel
_identifierDrawer.DrawWorld(200); _identifierDrawer.DrawWorld(200);
_identifierDrawer.DrawName(300); _identifierDrawer.DrawName(300);
_identifierDrawer.DrawNpcs(300); _identifierDrawer.DrawNpcs(300);
if (ImGuiUtil.DrawDisabledButton("Set to Retainer", new Vector2(100, 0), string.Empty, !_identifierDrawer.CanSetRetainer)) if (ImGuiUtil.DrawDisabledButton("Set to Character", Vector2.Zero, string.Empty, !_identifierDrawer.CanSetPlayer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.RetainerIdentifier);
ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton("Set to Character", new Vector2(100, 0), string.Empty, !_identifierDrawer.CanSetPlayer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.PlayerIdentifier); _manager.ChangeIdentifier(setIndex, _identifierDrawer.PlayerIdentifier);
ImGui.SameLine(); ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton("Set to Npc", new Vector2(100, 0), string.Empty, !_identifierDrawer.CanSetNpc)) if (ImGuiUtil.DrawDisabledButton("Set to Npc", Vector2.Zero, string.Empty, !_identifierDrawer.CanSetNpc))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.NpcIdentifier); _manager.ChangeIdentifier(setIndex, _identifierDrawer.NpcIdentifier);
ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton("Set to Retainer", Vector2.Zero, string.Empty, !_identifierDrawer.CanSetRetainer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.RetainerIdentifier);
ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton("Set to Mannequin", Vector2.Zero, string.Empty, !_identifierDrawer.CanSetRetainer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.MannequinIdentifier);
} }

@ -1 +1 @@
Subproject commit 98bd4e9946ded20cb5d54182883e73f344fe2d26 Subproject commit f306da6f43e8681d3bace45cbd4fd98ef49927ca