This commit is contained in:
Kinglykrab 2024-10-25 21:49:12 -04:00 committed by Akkadius
parent 96979ac332
commit 9ec98d2b89
4 changed files with 60 additions and 36 deletions

View File

@ -1103,13 +1103,13 @@ int16 EQ::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx)
if (bagslot_id == invslot::slotCursor) { if (bagslot_id == invslot::slotCursor) {
slot_id = invbag::CURSOR_BAG_BEGIN + bagidx; slot_id = invbag::CURSOR_BAG_BEGIN + bagidx;
} else if (EQ::ValueWithin(bagslot_id, invslot::GENERAL_BEGIN, invslot::GENERAL_END)) { } else if (EQ::ValueWithin(bagslot_id, invslot::GENERAL_BEGIN, invslot::GENERAL_END)) {
slot_id = invbag::GENERAL_BAGS_BEGIN + (bagslot_id - invbag::GENERAL_BAGS_BEGIN) * invbag::SLOT_COUNT + bagidx; slot_id = invbag::GENERAL_BAGS_BEGIN + (bagslot_id - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT + bagidx;
} else if (EQ::ValueWithin(bagslot_id, invslot::BANK_BEGIN, invslot::BANK_END)) { } else if (EQ::ValueWithin(bagslot_id, invslot::BANK_BEGIN, invslot::BANK_END)) {
slot_id = invbag::BANK_BAGS_BEGIN + (bagslot_id - invbag::BANK_BAGS_BEGIN) * invbag::SLOT_COUNT + bagidx; slot_id = invbag::BANK_BAGS_BEGIN + (bagslot_id - invslot::BANK_BEGIN) * invbag::SLOT_COUNT + bagidx;
} else if (EQ::ValueWithin(bagslot_id, invslot::SHARED_BANK_BEGIN, invslot::SHARED_BANK_END)) { } else if (EQ::ValueWithin(bagslot_id, invslot::SHARED_BANK_BEGIN, invslot::SHARED_BANK_END)) {
slot_id = invbag::SHARED_BANK_BAGS_BEGIN + (bagslot_id - invbag::SHARED_BANK_BAGS_BEGIN) * invbag::SLOT_COUNT + bagidx; slot_id = invbag::SHARED_BANK_BAGS_BEGIN + (bagslot_id - invslot::SHARED_BANK_BEGIN) * invbag::SLOT_COUNT + bagidx;
} else if (EQ::ValueWithin(bagslot_id, invslot::TRADE_BEGIN, invslot::TRADE_END)) { } else if (EQ::ValueWithin(bagslot_id, invslot::TRADE_BEGIN, invslot::TRADE_END)) {
slot_id = invbag::TRADE_BAGS_BEGIN + (bagslot_id - invbag::TRADE_BAGS_BEGIN) * invbag::SLOT_COUNT + bagidx; slot_id = invbag::TRADE_BAGS_BEGIN + (bagslot_id - invslot::TRADE_BEGIN) * invbag::SLOT_COUNT + bagidx;
} }
return slot_id; return slot_id;

View File

@ -852,7 +852,8 @@ bool SharedDatabase::GetInventory(Client *c)
} }
int16 put_slot_id; int16 put_slot_id;
if (EQ::ValueWithin(slot_id, EQ::invbag::CURSOR_BAG_BEGIN, EQ::invbag::CURSOR_BAG_END) || slot_id == EQ::invslot::slotCursor) { // this had || slot_id == EQ::invslot::slotCursor ??s
if (EQ::ValueWithin(slot_id, EQ::invbag::CURSOR_BAG_BEGIN, EQ::invbag::CURSOR_BAG_END)) {
put_slot_id = inv.PushCursor(*inst); put_slot_id = inv.PushCursor(*inst);
} else { } else {
put_slot_id = inv.PutItem(slot_id, *inst); put_slot_id = inv.PutItem(slot_id, *inst);

View File

@ -779,47 +779,70 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id); inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos) if (ob.tellp() == last_pos) {
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id); LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
}
last_pos = ob.tellp();
}
// General items
for (int16 slot_id = EQ::invslot::GENERAL_BEGIN; slot_id <= EQ::invslot::GENERAL_END; slot_id++) {
const EQ::ItemInstance* inst = m_inv[slot_id];
if (!inst) {
continue;
}
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos) {
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
}
last_pos = ob.tellp(); last_pos = ob.tellp();
} }
if (!RuleB(Inventory, LazyLoadBank)) { if (!RuleB(Inventory, LazyLoadBank)) {
// Bank items // Bank items
for (int16 slot_id = EQ::invslot::BANK_BEGIN; slot_id <= EQ::invslot::BANK_END; slot_id++) { for (int16 slot_id = EQ::invslot::BANK_BEGIN; slot_id <= EQ::invslot::BANK_END; slot_id++) {
const EQ::ItemInstance* inst = m_inv[slot_id]; const EQ::ItemInstance* inst = m_inv[slot_id];
if (!inst) if (!inst) {
continue; continue;
}
inst->Serialize(ob, slot_id); inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos) if (ob.tellp() == last_pos) {
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id); LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
}
last_pos = ob.tellp(); last_pos = ob.tellp();
} }
// SharedBank items // SharedBank items
for (int16 slot_id = EQ::invslot::SHARED_BANK_BEGIN; slot_id <= EQ::invslot::SHARED_BANK_END; slot_id++) { for (int16 slot_id = EQ::invslot::SHARED_BANK_BEGIN; slot_id <= EQ::invslot::SHARED_BANK_END; slot_id++) {
const EQ::ItemInstance* inst = m_inv[slot_id]; const EQ::ItemInstance* inst = m_inv[slot_id];
if (!inst) if (!inst) {
continue; continue;
}
inst->Serialize(ob, slot_id); inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos) if (ob.tellp() == last_pos) {
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id); LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
}
last_pos = ob.tellp(); last_pos = ob.tellp();
} }
} }
auto outapp = new EQApplicationPacket(OP_CharInventory); auto outapp = new EQApplicationPacket(OP_CharInventory);
outapp->size = ob.size();
outapp->pBuffer = ob.detach(); outapp->size = ob.size();
QueuePacket(outapp); outapp->pBuffer = ob.detach();
safe_delete(outapp);
QueuePacket(outapp);
safe_delete(outapp);
} }
void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {

View File

@ -310,7 +310,7 @@ void ShowInventory(Client *c, const Seperator *sep)
Chat::White, Chat::White,
fmt::format( fmt::format(
"Slot {} | {} ({}){}", "Slot {} | {} ({}){}",
(EQ::invbag::CURSOR_BAG_BEGIN + limboIndex), (14000 + limboIndex),
item_data->ID, item_data->ID,
linker.GenerateLink(), linker.GenerateLink(),
( (
@ -339,7 +339,7 @@ void ShowInventory(Client *c, const Seperator *sep)
Chat::White, Chat::White,
fmt::format( fmt::format(
"Slot {} (Augment Slot {}) | {} ({}){}", "Slot {} (Augment Slot {}) | {} ({}){}",
(EQ::invbag::CURSOR_BAG_BEGIN + limboIndex), (14000 + limboIndex),
augment_index, augment_index,
linker.GenerateLink(), linker.GenerateLink(),
item_data->ID, item_data->ID,
@ -375,7 +375,7 @@ void ShowInventory(Client *c, const Seperator *sep)
Chat::White, Chat::White,
fmt::format( fmt::format(
"Slot {} Bag Slot {} | {} ({}){}", "Slot {} Bag Slot {} | {} ({}){}",
(EQ::invbag::CURSOR_BAG_BEGIN + limboIndex), (14000 + limboIndex),
sub_index, sub_index,
linker.GenerateLink(), linker.GenerateLink(),
item_data->ID, item_data->ID,
@ -407,7 +407,7 @@ void ShowInventory(Client *c, const Seperator *sep)
Chat::White, Chat::White,
fmt::format( fmt::format(
"Slot {} Bag Slot {} (Augment Slot {}) | {} ({}){}", "Slot {} Bag Slot {} (Augment Slot {}) | {} ({}){}",
(EQ::invbag::CURSOR_BAG_BEGIN + limboIndex), (14000 + limboIndex),
sub_index, sub_index,
augment_index, augment_index,
linker.GenerateLink(), linker.GenerateLink(),