fix item exploits

Update VendorComponent.cpp

Update Mail.cpp
This commit is contained in:
David Markowitz
2025-09-01 13:15:46 -07:00
parent f9e74e6994
commit 6d2a21450b
25 changed files with 44 additions and 38 deletions

View File

@@ -106,7 +106,7 @@ namespace Mail {
// Remove coins and items from the sender
player->GetCharacter()->SetCoins(player->GetCharacter()->GetCoins() - mailCost, eLootSourceType::MAIL);
if (inventoryComponent && hasAttachment && item) {
removeSuccess = inventoryComponent->RemoveItem(mailInfo.itemLOT, mailInfo.itemCount, INVALID, true);
removeSuccess = inventoryComponent->RemoveItem(mailInfo.itemLOT, mailInfo.itemCount, ALL, true);
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent && removeSuccess) missionComponent->Progress(eMissionTaskType::GATHER, mailInfo.itemLOT, LWOOBJID_EMPTY, "", -mailInfo.itemCount);
}

View File

@@ -130,9 +130,7 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluat
case PreconditionType::HasItem:
if (evaluateCosts) // As far as I know this is only used for quickbuilds, and removal shouldn't actually be handled here.
{
inventoryComponent->RemoveItem(value, count);
return true;
return inventoryComponent->RemoveItem(value, count, eInventoryType::ALL);
}
return inventoryComponent->GetLotCount(value) >= count;