fix(movement): invalidate burden on enchantment changes
This commit is contained in:
parent
2b9dfec9d7
commit
d6e8b60303
13 changed files with 231 additions and 25 deletions
|
|
@ -3,6 +3,7 @@ using System.Numerics;
|
|||
using AcDream.App.UI;
|
||||
using AcDream.Core.Items;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.Core.Spells;
|
||||
|
||||
namespace AcDream.App.UI.Layout;
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ public sealed class InventoryController : IItemListDragHandler, IRetainedPanelCo
|
|||
private readonly Func<ItemType, uint, uint, uint, uint, uint> _iconIds;
|
||||
private readonly Func<ItemType, uint, uint, uint, uint, uint>? _dragIconIds;
|
||||
private readonly Func<int?> _strength;
|
||||
private readonly Spellbook? _burdenSpellbook;
|
||||
private readonly Func<string>? _ownerName;
|
||||
|
||||
private readonly UiItemList? _contentsGrid;
|
||||
|
|
@ -96,13 +98,15 @@ public sealed class InventoryController : IItemListDragHandler, IRetainedPanelCo
|
|||
Action<uint, uint>? notifyMergeAttempt,
|
||||
ItemInteractionController? itemInteraction,
|
||||
Action? onClose,
|
||||
StackSplitQuantityState? stackSplitQuantity)
|
||||
StackSplitQuantityState? stackSplitQuantity,
|
||||
Spellbook? burdenSpellbook)
|
||||
{
|
||||
_objects = objects;
|
||||
_playerGuid = playerGuid;
|
||||
_iconIds = iconIds;
|
||||
_dragIconIds = dragIconIds;
|
||||
_strength = strength;
|
||||
_burdenSpellbook = burdenSpellbook;
|
||||
_ownerName = ownerName;
|
||||
_sendUse = sendUse;
|
||||
_sendPutItemInContainer = sendPutItemInContainer;
|
||||
|
|
@ -195,6 +199,8 @@ public sealed class InventoryController : IItemListDragHandler, IRetainedPanelCo
|
|||
_objects.ObjectUpdated += OnObjectChanged;
|
||||
_objects.Cleared += OnObjectsCleared;
|
||||
_selection.Changed += OnSelectionChanged;
|
||||
if (_burdenSpellbook is not null)
|
||||
_burdenSpellbook.EnchantmentsChanged += RefreshBurden;
|
||||
if (_itemInteraction is not null)
|
||||
{
|
||||
_itemInteraction.StateChanged += OnInteractionStateChanged;
|
||||
|
|
@ -244,14 +250,15 @@ public sealed class InventoryController : IItemListDragHandler, IRetainedPanelCo
|
|||
ItemInteractionController? itemInteraction = null,
|
||||
Action? onClose = null,
|
||||
StackSplitQuantityState? stackSplitQuantity = null,
|
||||
Func<ItemType, uint, uint, uint, uint, uint>? dragIconIds = null)
|
||||
Func<ItemType, uint, uint, uint, uint, uint>? dragIconIds = null,
|
||||
Spellbook? burdenSpellbook = null)
|
||||
=> new InventoryController(layout, objects, playerGuid, iconIds, dragIconIds, strength, selection,
|
||||
ownerName, datFont,
|
||||
contentsEmptySprite, sideBagEmptySprite, mainPackEmptySprite,
|
||||
sendUse, sendPutItemInContainer,
|
||||
sendStackableSplitToContainer, sendStackableMerge,
|
||||
notifyMergeAttempt, itemInteraction,
|
||||
onClose, stackSplitQuantity);
|
||||
onClose, stackSplitQuantity, burdenSpellbook);
|
||||
|
||||
private void OnObjectChanged(ClientObject o)
|
||||
{
|
||||
|
|
@ -944,6 +951,8 @@ public sealed class InventoryController : IItemListDragHandler, IRetainedPanelCo
|
|||
_objects.ObjectUpdated -= OnObjectChanged;
|
||||
_objects.Cleared -= OnObjectsCleared;
|
||||
_selection.Changed -= OnSelectionChanged;
|
||||
if (_burdenSpellbook is not null)
|
||||
_burdenSpellbook.EnchantmentsChanged -= RefreshBurden;
|
||||
if (_contentsGrid is not null)
|
||||
{
|
||||
_contentsGrid.PrimaryItemPressed = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue