1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 20:19:57 +00:00

[Client] See when other players add items to containers

This commit is contained in:
David Cernat 2017-02-05 19:33:11 +02:00
parent 75392297b5
commit d2c5a3387a
2 changed files with 32 additions and 1 deletions

View file

@ -154,6 +154,33 @@ namespace MWGui
} }
} }
// Added by tes3mp
mwmp::LocalEvent *event = mwmp::Main::get().getNetworking()->createLocalEvent();
event->cell = *mPtr.getCell()->getCell();
mwmp::WorldObject worldObject;
worldObject.refId = mPtr.getCellRef().getRefId();
worldObject.refNumIndex = mPtr.getCellRef().getRefNum().mIndex;
event->addObject(worldObject);
mwmp::ContainerItem containerItem;
containerItem.refId = mDragAndDrop->mItem.mBase.getCellRef().getRefId();
containerItem.count = mDragAndDrop->mItem.mBase.getRefData().getCount();
event->addContainerItem(containerItem);
event->containerChanges.action = mwmp::ContainerChanges::ADD;
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(event);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i",
worldObject.refId.c_str(),
worldObject.refNumIndex,
event->cell.getDescription().c_str(),
containerItem.refId,
containerItem.count);
delete event;
event = NULL;
mDragAndDrop->drop(mModel, mItemView); mDragAndDrop->drop(mModel, mItemView);
} }

View file

@ -72,7 +72,11 @@ void LocalEvent::editContainer(MWWorld::CellStore* cellStore)
{ {
ContainerItem item = containerChanges.items.at(i); ContainerItem item = containerChanges.items.at(i);
if (containerChanges.action == ContainerChanges::REMOVE) if (containerChanges.action == ContainerChanges::ADD)
{
containerStore.add(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
}
else if (containerChanges.action == ContainerChanges::REMOVE)
{ {
containerStore.remove(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr()); containerStore.remove(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
} }