mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-15 09:04:10 +00:00
fix(vendor): keep 27 buyback items and drop the oldest
The buyback inventory grew by 9 slots whenever it was nearly full, so the vendor's buyback page kept resizing. Live kept 27 items: a 2014 capture of 29 sales shows that on the 28th, the server sent RemoveItemFromInventory (buyback inventory) for the first item sold, then added the new one. The buyback inventory now keeps its size. Before a sale needs a new buyback slot and the inventory holds 27 or more items, the oldest items (lowest object ID: each sale gives a new, higher ID) are removed. Sales that fit on an existing buyback stack remove nothing. The removal is not counted again by the economy ledger, which counted the items as gone when they were sold. Fixes issue 1129. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,13 +91,12 @@ void Inventory::SetSize(const uint32_t value) {
|
||||
int32_t Inventory::FindEmptySlot() {
|
||||
if (free <= 6) // Up from 1
|
||||
{
|
||||
if (type != ITEMS && type != VAULT_ITEMS && type != eInventoryType::VAULT_MODELS) {
|
||||
// The buyback inventory keeps its size: selling to a full one drops the oldest item (VendorComponent::SellToVendor)
|
||||
if (type != ITEMS && type != VAULT_ITEMS && type != eInventoryType::VAULT_MODELS && type != eInventoryType::VENDOR_BUYBACK) {
|
||||
uint32_t newSize = size;
|
||||
|
||||
if (type == MODELS) {
|
||||
newSize = 240;
|
||||
} else if (type == eInventoryType::VENDOR_BUYBACK) {
|
||||
newSize += 9u;
|
||||
} else {
|
||||
newSize += 10u;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user