mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 12:42:11 +00:00
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#include "companionitemmodel.hpp"
|
|
|
|
#include "../mwmechanics/npcstats.hpp"
|
|
#include "../mwworld/class.hpp"
|
|
|
|
namespace MWGui
|
|
{
|
|
CompanionItemModel::CompanionItemModel(const MWWorld::Ptr &actor)
|
|
: InventoryItemModel(actor)
|
|
{
|
|
}
|
|
|
|
void CompanionItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner=false)
|
|
{
|
|
if (mActor.getClass().isNpc())
|
|
{
|
|
MWMechanics::NpcStats& stats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
|
stats.modifyProfit(MWWorld::Class::get(item.mBase).getValue(item.mBase) * count);
|
|
}
|
|
|
|
InventoryItemModel::copyItem(item, count, setNewOwner);
|
|
}
|
|
|
|
void CompanionItemModel::removeItem (const ItemStack& item, size_t count)
|
|
{
|
|
if (mActor.getClass().isNpc())
|
|
{
|
|
MWMechanics::NpcStats& stats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
|
stats.modifyProfit(-MWWorld::Class::get(item.mBase).getValue(item.mBase) * count);
|
|
}
|
|
|
|
InventoryItemModel::removeItem(item, count);
|
|
}
|
|
}
|