Fix offhand handling.

This commit is contained in:
Ottermandias 2023-07-11 16:21:25 +02:00
parent 279a5d6923
commit a310e01296
3 changed files with 5 additions and 7 deletions

View file

@ -190,7 +190,9 @@ public class EquipmentDrawer
return false;
var change = combo.Draw(weapon.Name, weapon.ItemId, 320 * ImGuiHelpers.GlobalScale);
if (!offType.IsOffhandType() && weapon.ModelId.Value != 0)
if (change)
weapon = combo.CurrentSelection;
else if (!offType.IsOffhandType() && weapon.ModelId.Value != 0)
{
ImGuiUtil.HoverTooltip("Right-click to clear.");
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
@ -199,10 +201,6 @@ public class EquipmentDrawer
weapon = ItemManager.NothingItem(offType);
}
}
else if (change)
{
weapon = combo.CurrentSelection;
}
return change;
}

View file

@ -159,7 +159,7 @@ public class ActorPanel
ImGui.SameLine();
var oh = _state.ModelData.Item(EquipSlot.OffHand);
if (_equipmentDrawer.DrawMainhand(oh, false, out var newOh))
if (_equipmentDrawer.DrawOffhand(oh, newMh.Type, out var newOh))
_stateManager.ChangeEquip(_state, EquipSlot.OffHand, newOh, newOhStain, StateChanged.Source.Manual);
}
}

View file

@ -157,7 +157,7 @@ public class DesignPanel
ImGui.SameLine();
var oh = _selector.Selected!.DesignData.Item(EquipSlot.OffHand);
if (_equipmentDrawer.DrawMainhand(oh, false, out var newOh))
if (_equipmentDrawer.DrawOffhand(oh, newMh.Type, out var newOh))
_manager.ChangeWeapon(_selector.Selected!, EquipSlot.OffHand, newOh);
}
}