diff --git a/data-otservbr-global/npc/perod.lua b/data-otservbr-global/npc/perod.lua index b0bc5e7a57d..7d3f32d6ad3 100644 --- a/data-otservbr-global/npc/perod.lua +++ b/data-otservbr-global/npc/perod.lua @@ -143,7 +143,7 @@ npcConfig.shop = { { itemName = "shiver arrow", clientId = 762, buy = 5 }, { itemName = "shovel", clientId = 3457, buy = 50, sell = 8 }, { itemName = "sniper arrow", clientId = 7364, buy = 5 }, - { itemName = "spear", clientId = 3277, buy = 10, sell = 10 }, + { itemName = "spear", clientId = 3277, buy = 9, sell = 3 }, { itemName = "spectral bolt", clientId = 35902, buy = 70 }, { itemName = "tarsal arrow", clientId = 14251, buy = 6 }, { itemName = "throwing star", clientId = 3287, buy = 42 }, diff --git a/src/creatures/npcs/npc.cpp b/src/creatures/npcs/npc.cpp index 519afaf92f2..fbf08461c00 100644 --- a/src/creatures/npcs/npc.cpp +++ b/src/creatures/npcs/npc.cpp @@ -396,6 +396,10 @@ void Npc::onPlayerSellItem(std::shared_ptr player, uint16_t itemId, uint continue; } + if (!item->hasMarketAttributes()) { + continue; + } + auto removeCount = std::min(toRemove, item->getItemCount()); if (g_game().internalRemoveItem(item, removeCount) != RETURNVALUE_NOERROR) { @@ -410,6 +414,10 @@ void Npc::onPlayerSellItem(std::shared_ptr player, uint16_t itemId, uint } auto totalRemoved = amount - toRemove; + if (totalRemoved == 0) { + return; + } + auto totalCost = static_cast(sellPrice * totalRemoved); g_logger().debug("[Npc::onPlayerSellItem] - Removing items from player {} amount {} of items with id {} on shop for npc {}", player->getName(), toRemove, itemId, getName()); if (totalRemoved > 0 && totalCost > 0) { diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index ee96b5bba24..4470d7431ad 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -4118,6 +4118,10 @@ std::map &Player::getAllItemTypeCount(std::map &Player::getAllSaleItemIdAndCount(std::map &countMap) const { for (const auto &item : getAllInventoryItems(false, true)) { + if (!item->hasMarketAttributes()) { + continue; + } + if (const auto &container = item->getContainer()) { if (container->size() > 0) { continue;