Merge remote-tracking branch 'origin/codex/bazaar-offline-trading-rework' into copilot/sub-pr-80-again

# Conflicts:
#	zone/inventory.cpp
This commit is contained in:
copilot-swe-agent[bot]
2026-03-20 02:46:49 +00:00
7 changed files with 37 additions and 17 deletions
+30 -9
View File
@@ -4700,8 +4700,9 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst)
int32 quantity;
};
std::vector<temp> queue;
auto quantity = inst->GetCharges();
std::vector<temp> queue;
std::vector<int16> empty_bag_slots;
auto quantity = inst->GetCharges();
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) {
if (quantity == 0) {
@@ -4710,7 +4711,6 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst)
auto inv_inst = GetInv().GetItem(i);
if (!inv_inst) {
// Empty general slot — skip for now; will fall back to free_id after scanning for stacks
continue;
}
@@ -4723,12 +4723,12 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst)
}
auto bag_inst = GetInv().GetItem(base_slot_id + bag_slot);
if (!bag_inst) {
// Empty bag slot — skip for now; will fall back to free_id after scanning for stacks
if (!bag_inst && inv_inst->GetItem()->BagSize >= inst->GetItem()->Size) {
empty_bag_slots.push_back(base_slot_id + bag_slot);
continue;
}
if (bag_inst->IsStackable() && bag_inst->GetID() == inst->GetID()) {
if (bag_inst && bag_inst->IsStackable() && bag_inst->GetID() == inst->GetID()) {
auto stack_size = bag_inst->GetItem()->StackSize;
auto bag_inst_quantity = bag_inst->GetCharges();
int16 temp_slot = base_slot_id + bag_slot;
@@ -4749,15 +4749,30 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst)
}
if (!queue.empty()) {
bool success = true;
database.TransactionBegin();
for (auto const &i: queue) {
auto bag_inst = GetInv().GetItem(i.slot_id);
if (!bag_inst) {
LogError("Client inventory error occurred. Character ID {} Slot_ID {}", CharacterID(), i.slot_id);
continue;
success = false;
break;
}
bag_inst->SetCharges(i.quantity + bag_inst->GetCharges());
PutItemInInventory(i.slot_id, *bag_inst, true);
if (!PutItemInInventory(i.slot_id, *bag_inst, true)) {
LogError(
"Failed to save stacked item to inventory. Character ID {} Slot_ID {}",
CharacterID(),
i.slot_id
);
success = false;
break;
}
}
if (!success) {
database.TransactionRollback();
return false;
}
database.TransactionCommit();
@@ -4768,13 +4783,19 @@ bool Client::PutItemInInventoryWithStacking(EQ::ItemInstance *inst)
}
inst->SetCharges(quantity);
for (auto slot_id : empty_bag_slots) {
if (PutItemInInventory(slot_id, *inst, true)) {
return true;
}
}
if (free_id != INVALID_INDEX &&
!EQ::ValueWithin(free_id, EQ::invslot::EQUIPMENT_BEGIN, EQ::invslot::EQUIPMENT_END) &&
PutItemInInventory(free_id, *inst, true)) {
return true;
}
LogError("Could not find enough room");
LogError("Could not find enough room for item {} (quantity {}) for character {}", inst->GetItem()->Name, quantity, CharacterID());
return false;
}
+1 -1
View File
@@ -1968,7 +1968,7 @@ private:
gender = in.gender;
race = in.race;
base_gender = in.base_gender;
base_race = in.race;
base_race = in.base_race;
use_model = in.use_model;
class_ = in.class_;
bodytype = in.bodytype;
-1
View File
@@ -453,7 +453,6 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1;
cpc.evolve_amount = item->GetEvolveCurrentAmount();
cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1;
all_entries.push_back(cpc);
}
CharacterParcelsContainersRepository::InsertMany(database, all_entries);