|
|
|
@ -64,7 +64,19 @@ namespace MWScript
|
|
|
|
|
|| ::Misc::StringUtils::ciEqual(item, "gold_100"))
|
|
|
|
|
item = "gold_001";
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr itemPtr = *ptr.getClass().getContainerStore (ptr).add (item, count, ptr);
|
|
|
|
|
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
|
|
|
|
// Create a Ptr for the first added item to recover the item name later
|
|
|
|
|
MWWorld::Ptr itemPtr = *store.add (item, 1, ptr);
|
|
|
|
|
if (itemPtr.getClass().getScript(itemPtr).empty())
|
|
|
|
|
{
|
|
|
|
|
store.add (item, count-1, ptr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Adding just one item per time to make sure there isn't a stack of scripted items
|
|
|
|
|
for (int i = 1; i < count; i++)
|
|
|
|
|
store.add (item, 1, ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Spawn a messagebox (only for items added to player's inventory and if player is talking to someone)
|
|
|
|
|
if (ptr == MWBase::Environment::get().getWorld ()->getPlayerPtr() )
|
|
|
|
@ -143,8 +155,13 @@ namespace MWScript
|
|
|
|
|
|
|
|
|
|
std::string itemName;
|
|
|
|
|
for (MWWorld::ConstContainerStoreIterator iter(store.cbegin()); iter != store.cend(); ++iter)
|
|
|
|
|
{
|
|
|
|
|
if (::Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), item))
|
|
|
|
|
{
|
|
|
|
|
itemName = iter->getClass().getName(*iter);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int numRemoved = store.remove(item, count, ptr);
|
|
|
|
|
|
|
|
|
|