diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 1e7d9f0bc..c18003dac 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -2,7 +2,11 @@ #include #include + +#include #include "../mwmp/Main.hpp" +#include "../mwmp/Networking.hpp" +#include "../mwmp/LocalEvent.hpp" #include "../mwmp/WorldController.hpp" #include "../mwbase/environment.hpp" @@ -97,6 +101,33 @@ namespace MWGui if (!onTakeItem(mModel->getItem(mSelectedItem), count)) return; + // 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 = mModel->getItem(mSelectedItem).mBase.getCellRef().getRefId(); + containerItem.count = count; + event->addContainerItem(containerItem); + event->containerChanges.action = mwmp::ContainerChanges::REMOVE; + + 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->startDrag(mSelectedItem, mSortModel, mModel, mItemView, count); } diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index b91fbad55..5365a9b6a 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -36,9 +36,9 @@ namespace MWWorld mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event); - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s.", - getTarget().getCellRef().getRefId().c_str(), - getTarget().getCellRef().getRefNum().mIndex, + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s", + worldObject.refId.c_str(), + worldObject.refNumIndex, event->cell.getDescription().c_str()); delete event;