[Client] Send ID_PLAYER_INVENTORY from two more locations

This commit is contained in:
David Cernat 2017-02-05 16:14:26 +02:00
parent c0d67f67fb
commit cdd796aba1
2 changed files with 13 additions and 0 deletions

View file

@ -291,6 +291,8 @@ namespace MWGui
WorldItemModel drop (mouseX, mouseY); WorldItemModel drop (mouseX, mouseY);
mDragAndDrop->drop(&drop, NULL); mDragAndDrop->drop(&drop, NULL);
// Added by tes3mp
//
// LocalPlayer's inventory has changed, so send a packet with it // LocalPlayer's inventory has changed, so send a packet with it
mwmp::Main::get().getLocalPlayer()->sendInventory(); mwmp::Main::get().getLocalPlayer()->sendInventory();
@ -326,6 +328,9 @@ namespace MWGui
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
delete event; delete event;
event = nullptr; event = nullptr;
// LocalPlayer's inventory has changed, so send a packet with it
mwmp::Main::get().getLocalPlayer()->sendInventory();
} }
} }
} }

View file

@ -6,6 +6,9 @@
#include <MyGUI_LanguageManager.h> #include <MyGUI_LanguageManager.h>
#include "../mwmp/Main.hpp"
#include "../mwmp/LocalPlayer.hpp"
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
#include <components/compiler/opcodes.hpp> #include <components/compiler/opcodes.hpp>
@ -67,6 +70,11 @@ namespace MWScript
// Spawn a messagebox (only for items added to player's inventory and if player is talking to someone) // 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() ) if (ptr == MWBase::Environment::get().getWorld ()->getPlayerPtr() )
{ {
// Added by tes3mp
//
// LocalPlayer's inventory has changed, so send a packet with it
mwmp::Main::get().getLocalPlayer()->sendInventory();
// The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory // The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory
std::string msgBox; std::string msgBox;
std::string itemName = itemPtr.getClass().getName(itemPtr); std::string itemName = itemPtr.getClass().getName(itemPtr);