mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Client] See when other players use the Take All button with a container
This commit is contained in:
parent
d2c5a3387a
commit
1f03c12d96
2 changed files with 27 additions and 2 deletions
|
@ -299,6 +299,26 @@ namespace MWGui
|
|||
}
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
|
||||
|
||||
// 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);
|
||||
event->containerChanges.action = mwmp::ContainerChanges::SET;
|
||||
|
||||
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());
|
||||
|
||||
delete event;
|
||||
event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,16 +67,21 @@ void LocalEvent::editContainer(MWWorld::CellStore* cellStore)
|
|||
ptrFound.getCellRef().getRefNum());
|
||||
|
||||
MWWorld::ContainerStore& containerStore = ptrFound.getClass().getContainerStore(ptrFound);
|
||||
int action = containerChanges.action;
|
||||
|
||||
// If we are setting the entire contents, clear the current ones
|
||||
if (action == ContainerChanges::SET)
|
||||
containerStore.clear();
|
||||
|
||||
for (unsigned int i = 0; i < containerChanges.count; i++)
|
||||
{
|
||||
ContainerItem item = containerChanges.items.at(i);
|
||||
|
||||
if (containerChanges.action == ContainerChanges::ADD)
|
||||
if (action == ContainerChanges::ADD || action == ContainerChanges::SET)
|
||||
{
|
||||
containerStore.add(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
|
||||
}
|
||||
else if (containerChanges.action == ContainerChanges::REMOVE)
|
||||
else if (action == ContainerChanges::REMOVE)
|
||||
{
|
||||
containerStore.remove(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue