2013-05-11 16:38:27 +00:00
|
|
|
#include "companionitemmodel.hpp"
|
|
|
|
|
|
|
|
#include "../mwmechanics/npcstats.hpp"
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
CompanionItemModel::CompanionItemModel(const MWWorld::Ptr &actor)
|
|
|
|
: InventoryItemModel(actor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-15 02:41:31 +00:00
|
|
|
MWWorld::Ptr CompanionItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner=false)
|
2013-05-11 16:38:27 +00:00
|
|
|
{
|
2014-01-19 10:42:58 +00:00
|
|
|
if (mActor.getClass().isNpc())
|
2013-05-11 16:38:27 +00:00
|
|
|
{
|
2014-05-15 02:41:31 +00:00
|
|
|
MWMechanics::NpcStats& stats = mActor.getClass().getNpcStats(mActor);
|
|
|
|
stats.modifyProfit(item.mBase.getClass().getValue(item.mBase) * count);
|
2013-05-11 16:38:27 +00:00
|
|
|
}
|
|
|
|
|
2014-05-15 02:41:31 +00:00
|
|
|
return InventoryItemModel::copyItem(item, count, setNewOwner);
|
2013-05-11 16:38:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CompanionItemModel::removeItem (const ItemStack& item, size_t count)
|
|
|
|
{
|
2014-01-19 10:42:58 +00:00
|
|
|
if (mActor.getClass().isNpc())
|
2013-05-11 16:38:27 +00:00
|
|
|
{
|
2014-05-15 02:41:31 +00:00
|
|
|
MWMechanics::NpcStats& stats = mActor.getClass().getNpcStats(mActor);
|
|
|
|
stats.modifyProfit(-item.mBase.getClass().getValue(item.mBase) * count);
|
2013-05-11 16:38:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
InventoryItemModel::removeItem(item, count);
|
|
|
|
}
|
|
|
|
}
|