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-04-27 03:40:07 +00:00
|
|
|
void 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
|
|
|
{
|
|
|
|
MWMechanics::NpcStats& stats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
|
|
|
stats.modifyProfit(MWWorld::Class::get(item.mBase).getValue(item.mBase) * count);
|
|
|
|
}
|
|
|
|
|
2014-04-27 03:40:07 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
MWMechanics::NpcStats& stats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
|
|
|
stats.modifyProfit(-MWWorld::Class::get(item.mBase).getValue(item.mBase) * count);
|
|
|
|
}
|
|
|
|
|
|
|
|
InventoryItemModel::removeItem(item, count);
|
|
|
|
}
|
|
|
|
}
|