forked from mirror/openmw-tes3mp
[Client] Add MechanicsHelper::getItem() for getting mwmp::Item from Ptr
This commit is contained in:
parent
799241e8c6
commit
db9c1b9882
2 changed files with 18 additions and 0 deletions
|
@ -125,6 +125,23 @@ MWWorld::Ptr MechanicsHelper::getPlayerPtr(const Target& target)
|
|||
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 target;
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace MechanicsHelper
|
|||
|
||||
MWWorld::Ptr getPlayerPtr(const mwmp::Target& target);
|
||||
|
||||
mwmp::Item getItem(const MWWorld::Ptr& itemPtr, int count);
|
||||
mwmp::Target getTarget(const MWWorld::Ptr& ptr);
|
||||
void clearTarget(mwmp::Target& target);
|
||||
bool isEmptyTarget(const mwmp::Target& target);
|
||||
|
|
Loading…
Reference in a new issue