Skip to content

Commit

Permalink
Fix failed interactions with house / account vaults calling `SendInve…
Browse files Browse the repository at this point in the history
…ntoryItemsUpdate`
  • Loading branch information
bm01 committed Nov 13, 2024
1 parent 2193345 commit aed2c1a
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 53 deletions.
22 changes: 18 additions & 4 deletions GameServer/gameobjects/CustomNPC/ConsignmentMerchant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ public virtual bool MoveItem(GamePlayer player, eInventorySlot fromClientSlot, e
{
// ... consignment merchant.
if (HasPermissionToMove(player))
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count));
{
var updatedItems = GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count);

if (updatedItems.Count > 0)
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, updatedItems);
}
else
return false;
}
Expand All @@ -230,7 +235,10 @@ public virtual bool MoveItem(GamePlayer player, eInventorySlot fromClientSlot, e
{
// Allow a move only if the player with permission is standing in front of the CM.
// This prevents moves if player has owner permission but is viewing from the Market Explorer.
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count));
var updatedItems = GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count);

if (updatedItems.Count > 0)
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, updatedItems);
}
else
{
Expand All @@ -251,7 +259,10 @@ public virtual bool MoveItem(GamePlayer player, eInventorySlot fromClientSlot, e
return false;
}

GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count));
var updatedItems = GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, count);

if (updatedItems.Count > 0)
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, updatedItems);
}
else
return false;
Expand Down Expand Up @@ -483,7 +494,10 @@ protected virtual void BuyItem(GamePlayer player, bool usingMarketExplorer = fal
if (ServerProperties.Properties.MARKET_ENABLE_LOG)
log.Debug($"CM: {player.Name}:{player.Client.Account.Name} purchased '{item.Name}' for {purchasePrice} from consignment merchant on lot {HouseNumber}.");

GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, (ushort) item.Count));
var updatedItems = GameInventoryObjectExtensions.MoveItem(this, player, fromClientSlot, toClientSlot, (ushort) item.Count);

if (updatedItems.Count > 0)
GameInventoryObjectExtensions.NotifyObservers(this, player, _observers, updatedItems);
}
}
}
Expand Down
Loading

0 comments on commit aed2c1a

Please sign in to comment.