Skip to content

Commit

Permalink
fix: sell items while wearing an imbued version (#1965)
Browse files Browse the repository at this point in the history
The client filters equipped items locally, so we don't have control over what it's doing, and on retail tibia you can sell imbued items to NPCs, so everything should count as far as the client is concerned.

Here's what this PR does, to fix selling items while having one equipped, but also preventing accidental sale of imbued equipment:
• We'll send the count of all items to the client, imbued or not.
• Client will attempt to sell all the non-equipped ones (assuming
"sell equipped" is unchecked).
• Server will then sell only the non-imbued ones.

This might cause a weird behavior, where you think you can sell 2 crown helmets, but you can only sell 1 (because one of them is imbued), but it's better than the alternative where the user will just simply think they can't sell the thing at all.
  • Loading branch information
luan authored Dec 6, 2023
1 parent 690fe15 commit 1981dac
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3942,9 +3942,7 @@ std::map<uint32_t, uint32_t> &Player::getAllItemTypeCount(std::map<uint32_t, uin

std::map<uint16_t, uint16_t> &Player::getAllSaleItemIdAndCount(std::map<uint16_t, uint16_t> &countMap) const {
for (const auto item : getAllInventoryItems(false, true)) {
if (!item->hasImbuements()) {
countMap[item->getID()] += item->getItemCount();
}
countMap[item->getID()] += item->getItemCount();
}

return countMap;
Expand Down

0 comments on commit 1981dac

Please sign in to comment.