mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-15 23:50:38 +00:00
fix(auctionhouse): don't post from a quiver or soul bag's free slot
The multisell's free-slot search treated a bag as general-purpose when its item record's BagFamily field read 0. A vanilla quiver, ammo pouch or soul bag leaves that field empty (the family comes from its class/subclass), so those bags counted as general and a stack could be split into them. It now asks Item::BagFamily::BitmaskForRecord, the reader Container::Bag and C_Item.GetItemFamily already use. A bag whose record is not cached is still not trusted as general.
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
#include "item/Record.h"
|
||||
#include "item/Swap.h"
|
||||
#include "tick/WorldTick.h"
|
||||
#include "item/BagFamily.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -192,11 +193,13 @@ bool BagIsGeneral(int bag) {
|
||||
const int id = Item::ID::FromCGItem(bagItem);
|
||||
if (id == 0)
|
||||
return false;
|
||||
// An uncached bag's family is unknown, so it is not trusted as general.
|
||||
const uint8_t *rec = Item::PeekRecord(static_cast<uint32_t>(id));
|
||||
if (rec == nullptr)
|
||||
return false;
|
||||
return Game::Read<uint32_t>(
|
||||
rec, Offsets::OFF_ITEMSTATS_BAG_FAMILY) == 0;
|
||||
// BitmaskForRecord, not the raw field: a vanilla quiver or soul bag leaves
|
||||
// the field empty, and would otherwise read as general-purpose.
|
||||
return Item::BagFamily::BitmaskForRecord(rec) == 0;
|
||||
}
|
||||
|
||||
bool FindFreeGeneralSlot(void *L, int *outBag, int *outSlot) {
|
||||
|
||||
Reference in New Issue
Block a user