Implement MagicItems flag for vendors (Fixes #1861)

deque
scrawl 10 years ago
parent 0da4757ee6
commit 59720b7dc6

@ -380,7 +380,8 @@ namespace MWClass
bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const
{ {
return npcServices & ESM::NPC::Armor; return (npcServices & ESM::NPC::Armor)
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
} }
float Armor::getWeight(const MWWorld::Ptr &ptr) const float Armor::getWeight(const MWWorld::Ptr &ptr) const

@ -202,7 +202,8 @@ namespace MWClass
bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const
{ {
return npcServices & ESM::NPC::Books; return (npcServices & ESM::NPC::Books)
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
} }
float Book::getWeight(const MWWorld::Ptr &ptr) const float Book::getWeight(const MWWorld::Ptr &ptr) const

@ -292,7 +292,8 @@ namespace MWClass
bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const
{ {
return npcServices & ESM::NPC::Clothing; return (npcServices & ESM::NPC::Clothing)
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
} }
float Clothing::getWeight(const MWWorld::Ptr &ptr) const float Clothing::getWeight(const MWWorld::Ptr &ptr) const

@ -434,7 +434,8 @@ namespace MWClass
bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const
{ {
return npcServices & ESM::NPC::Weapon; return (npcServices & ESM::NPC::Weapon)
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
} }
float Weapon::getWeight(const MWWorld::Ptr &ptr) const float Weapon::getWeight(const MWWorld::Ptr &ptr) const

Loading…
Cancel
Save