Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Maple2.Server.Game/Manager/Items/InventoryManager.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -200,8 +200,7 @@ public bool Add(Item add, bool notifyNew = false, bool commit = false) {
add.Transfer?.Bind(session.Player.Value.Character);
}

bool stack = !(add.ExpiryTime > 0);
IList<(Item, int Added)> result = items.Add(add, stack);
IList<(Item, int Added)> result = items.Add(add, stack: true);
if (result.Count == 0) {
session.Send(ItemInventoryPacket.Error(s_err_inventory));
return false;
Expand Down
5 changes: 3 additions & 2 deletions Maple2.Server.Game/Manager/Items/ItemCollection.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,7 +143,7 @@ private bool Append(Item insert) {
// Prefer item slot if specified
if (ValidSlot(add.Slot) && this[add.Slot] == null) {
this[add.Slot] = add;
return new[] { (add, add.Amount) };
return [(add, add.Amount)];
}

IList<(Item, int Added)> result = new List<(Item, int)>();
Expand DownExpand Up@@ -318,7 +318,8 @@ private static bool CanStack(Item item, Item stack) {
return item.Id == stack.Id
&& item.Rarity == stack.Rarity
&& item.Amount < item.Metadata.Property.SlotMax
&& Equals(item.Transfer, stack.Transfer);
&& Equals(item.Transfer, stack.Transfer)
&& item.ExpiryTime / 60 == stack.ExpiryTime / 60; // Expiry time is in seconds, convert to minutes
}

private static int SortItem(Item? x, Item? y) {
Expand Down