diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index c18003dac..f949f6cb2 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -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); } diff --git a/apps/openmw/mwmp/LocalEvent.cpp b/apps/openmw/mwmp/LocalEvent.cpp index e03bd4d18..7aa31eda6 100644 --- a/apps/openmw/mwmp/LocalEvent.cpp +++ b/apps/openmw/mwmp/LocalEvent.cpp @@ -72,7 +72,11 @@ void LocalEvent::editContainer(MWWorld::CellStore* cellStore) { 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()); }