LordKahel
03-04-2008, 05:35 AM
It seem that once a LORE augment get slotted it no longer count when checking for duplicate items.
The problem seem to be in Item.cpp
sint16 Inventory::_HasItem(map<sint16, ItemInst*>& bucket, uint32 item_id, uint8 quantity)
{
iter_inst it;
iter_contents itb;
ItemInst* inst = NULL;
uint8 quantity_found = 0;
// Check item: After failed checks, check bag contents (if bag)
for (it=bucket.begin(); it!=bucket.end(); it++) {
inst = it->second;
if (inst && (inst->GetID() == item_id)) {
quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges();
if (quantity_found >= quantity)
return it->first;
}
// Go through bag, if bag
if (inst && inst->IsType(ItemClassContainer)) {
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
ItemInst* baginst = itb->second;
if (baginst->GetID() == item_id) {
quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges();
if (quantity_found >= quantity)
return Inventory::CalcSlotId(it->first, itb->first);
}
}
}
}
// Not found
return SLOT_INVALID;
}
This method that goes thru the items does not seem to check the augments slots for each item it checks.
It would need somethign like this to check the augments slots:
int i;
for(i = 0; i < MAX_AUGMENT_SLOTS; i++) {
if (inst->GetAugmentItemID(i) == item_id)
quantity_found++; // Only one augment per slot.
}
The only problem i see is what SLOT to return if a augment is found slotted in a item. Maybe a generic constant SLOT_AUGMENT, that would work for CheckLoreConflict but i don't know if it will break anything else.
The problem seem to be in Item.cpp
sint16 Inventory::_HasItem(map<sint16, ItemInst*>& bucket, uint32 item_id, uint8 quantity)
{
iter_inst it;
iter_contents itb;
ItemInst* inst = NULL;
uint8 quantity_found = 0;
// Check item: After failed checks, check bag contents (if bag)
for (it=bucket.begin(); it!=bucket.end(); it++) {
inst = it->second;
if (inst && (inst->GetID() == item_id)) {
quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges();
if (quantity_found >= quantity)
return it->first;
}
// Go through bag, if bag
if (inst && inst->IsType(ItemClassContainer)) {
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
ItemInst* baginst = itb->second;
if (baginst->GetID() == item_id) {
quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges();
if (quantity_found >= quantity)
return Inventory::CalcSlotId(it->first, itb->first);
}
}
}
}
// Not found
return SLOT_INVALID;
}
This method that goes thru the items does not seem to check the augments slots for each item it checks.
It would need somethign like this to check the augments slots:
int i;
for(i = 0; i < MAX_AUGMENT_SLOTS; i++) {
if (inst->GetAugmentItemID(i) == item_id)
quantity_found++; // Only one augment per slot.
}
The only problem i see is what SLOT to return if a augment is found slotted in a item. Maybe a generic constant SLOT_AUGMENT, that would work for CheckLoreConflict but i don't know if it will break anything else.