Fix ignoring of human non-zero model ids.

This commit is contained in:
Ottermandias 2023-07-31 18:18:33 +02:00
parent 8c427e49e3
commit d1bb2ddefe
3 changed files with 14 additions and 4 deletions

View file

@ -124,7 +124,10 @@ public class ActorPanel
private void DrawCustomizationsHeader()
{
if (!ImGui.CollapsingHeader("Customization"))
var header = _state!.ModelData.ModelId == 0
? "Customization"
: $"Customization (Model Id #{_state.ModelData.ModelId})###Customization";
if (!ImGui.CollapsingHeader(header))
return;
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _identifier.Type is IdentifierType.Special))

View file

@ -167,7 +167,10 @@ public class DesignPanel
private void DrawCustomize()
{
if (!ImGui.CollapsingHeader("Customization"))
var header = _selector.Selected!.DesignData.ModelId == 0
? "Customization"
: $"Customization (Model Id #{_selector.Selected!.DesignData.ModelId})###Customization";
if (!ImGui.CollapsingHeader(header))
return;
if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.ApplyCustomize,

View file

@ -113,13 +113,16 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
// Model ID is only unambiguously contained in the game object.
// The draw object only has the object type.
// TODO reverse search model data to get model id from model.
if (!_humans.IsHuman((uint)actor.AsCharacter->CharacterData.ModelCharaId))
if (!_humans.IsHuman(ret.ModelId))
{
ret.LoadNonHuman((uint)actor.AsCharacter->CharacterData.ModelCharaId, *(Customize*)&actor.AsCharacter->DrawData.CustomizeData,
(nint)(&actor.AsCharacter->DrawData.Head));
return ret;
}
ret.ModelId = (uint)actor.AsCharacter->CharacterData.ModelCharaId;
ret.IsHuman = true;
CharacterWeapon main;
CharacterWeapon off;
@ -273,7 +276,8 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
var type = slot.ToIndex() < 10 ? StateChanged.Type.Equip : StateChanged.Type.Weapon;
var actors = type is StateChanged.Type.Equip
? _applier.ChangeArmor(state, slot, source is StateChanged.Source.Manual or StateChanged.Source.Ipc)
: _applier.ChangeWeapon(state, slot, source is StateChanged.Source.Manual or StateChanged.Source.Ipc, item.Type != (slot is EquipSlot.MainHand ? state.BaseData.MainhandType : state.BaseData.OffhandType));
: _applier.ChangeWeapon(state, slot, source is StateChanged.Source.Manual or StateChanged.Source.Ipc,
item.Type != (slot is EquipSlot.MainHand ? state.BaseData.MainhandType : state.BaseData.OffhandType));
Glamourer.Log.Verbose(
$"Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.ItemId}) to {item.Name} ({item.ItemId}) and its stain from {oldStain.Id} to {stain.Id}. [Affecting {actors.ToLazyString("nothing")}.]");
_event.Invoke(type, source, state, actors, (old, item, slot));