#include "actiontake.hpp" #include #include #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" #include "../mwworld/cellstore.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "class.hpp" #include "containerstore.hpp" namespace MWWorld { ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {} void ActionTake::executeImp (const Ptr& actor) { MWBase::Environment::get().getMechanicsManager()->itemTaken( actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount()); actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor); // Added by tes3mp mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); event->cell = *getTarget().getCell()->getCell(); event->cellRef.mRefID = getTarget().getCellRef().getRefId(); event->cellRef.mRefNum = getTarget().getCellRef().getRefNum(); 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.", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str()); // LocalPlayer's inventory has changed, so send a packet with it mwmp::Main::get().getLocalPlayer()->sendInventory(); MWBase::Environment::get().getWorld()->deleteObject (getTarget()); } }