Fix materials not being incremented properly

This commit is contained in:
Melledy
2023-10-05 06:37:16 -07:00
parent 528b1e3dbb
commit 4c976df0a1

View File

@@ -103,7 +103,7 @@ public class Inventory extends BasePlayerManager {
if (result != null) { if (result != null) {
// Send packet (update) // Send packet (update)
getPlayer().sendPacket(new PacketPlayerSyncScNotify(item)); getPlayer().sendPacket(new PacketPlayerSyncScNotify(result));
return true; return true;
} }
@@ -160,19 +160,17 @@ public class Inventory extends BasePlayerManager {
} }
return null; return null;
case Material: case Material:
switch (item.getExcel().getItemSubType()) {
default:
if (tab == null) { if (tab == null) {
return null; return null;
} }
GameItem existingItem = tab.getItemById(item.getItemId()); GameItem existingItem = tab.getItemById(item.getItemId());
if (existingItem == null) { if (existingItem == null) {
// Item type didnt exist before, we will add it to main inventory map if there is enough space // Item type didnt exist before, we will add it to main inventory map if there is enough space
if (tab.getSize() >= tab.getMaxCapacity()) { if (tab.getSize() >= tab.getMaxCapacity()) {
return null; return null;
} }
// Make sure item count doesnt exceed stack limit
item.setCount(Math.min(item.getCount(), item.getExcel().getPileLimit()));
// Put item to inventory // Put item to inventory
this.putItem(item, tab); this.putItem(item, tab);
// Set ownership and save to db // Set ownership and save to db
@@ -184,7 +182,6 @@ public class Inventory extends BasePlayerManager {
existingItem.save(); existingItem.save();
return existingItem; return existingItem;
} }
}
default: default:
return null; return null;
} }