From ae282c7030945d473f95da249fcda715b5fb66e8 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 25 Aug 2018 19:27:38 +1000 Subject: [PATCH] correctly preserve hq/lq stacks & cap quantity correctly --- src/servers/sapphire_zone/Actor/PlayerInventory.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index 2eb5d6f4..166412cf 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -496,8 +496,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti return nullptr; } - if( itemInfo->isEquippable ) - quantity = 1; + quantity = std::min< uint32_t >( quantity, itemInfo->stackSize ); // used for item obtain notification uint32_t originalQuantity = quantity; @@ -525,6 +524,10 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti if( count >= maxStack ) continue; + // check slot is same quality + if( item->isHq() != isHq ) + continue; + // update stack uint32_t newStackSize = count + quantity; uint32_t overflow = 0;