[Client] Add MechanicsHelper::getItem() for getting mwmp::Item from Ptr

master
David Cernat 6 years ago
parent 799241e8c6
commit db9c1b9882

@ -125,6 +125,23 @@ MWWorld::Ptr MechanicsHelper::getPlayerPtr(const Target& target)
return nullptr; return nullptr;
} }
mwmp::Item MechanicsHelper::getItem(const MWWorld::Ptr& itemPtr, int count)
{
mwmp::Item item;
if (itemPtr.getClass().isGold(itemPtr))
item.refId = MWWorld::ContainerStore::sGoldId;
else
item.refId = itemPtr.getCellRef().getRefId();
item.count = count;
item.charge = itemPtr.getCellRef().getCharge();
item.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge();
item.soul = itemPtr.getCellRef().getSoul();
return item;
}
mwmp::Target MechanicsHelper::getTarget(const MWWorld::Ptr& ptr) mwmp::Target MechanicsHelper::getTarget(const MWWorld::Ptr& ptr)
{ {
mwmp::Target target; mwmp::Target target;

@ -22,6 +22,7 @@ namespace MechanicsHelper
MWWorld::Ptr getPlayerPtr(const mwmp::Target& target); MWWorld::Ptr getPlayerPtr(const mwmp::Target& target);
mwmp::Item getItem(const MWWorld::Ptr& itemPtr, int count);
mwmp::Target getTarget(const MWWorld::Ptr& ptr); mwmp::Target getTarget(const MWWorld::Ptr& ptr);
void clearTarget(mwmp::Target& target); void clearTarget(mwmp::Target& target);
bool isEmptyTarget(const mwmp::Target& target); bool isEmptyTarget(const mwmp::Target& target);

Loading…
Cancel
Save