[Client] Allow multiple WorldObjects to be added to a WorldEvent

pull/249/merge
David Cernat 8 years ago
parent 32284787de
commit dcc61a095a

@ -73,7 +73,9 @@ namespace MWGui
the inventory screen
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectPlace(dropped);
worldEvent->reset();
worldEvent->addObjectPlace(dropped);
worldEvent->sendObjectPlace();
/*
End of tes3mp addition
*/

@ -666,7 +666,9 @@ namespace MWGui
by the player
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectDelete(object);
worldEvent->reset();
worldEvent->addObjectDelete(object);
worldEvent->sendObjectDelete();
mwmp::Main::get().getLocalPlayer()->sendInventory();
/*
End of tes3mp addition

@ -72,7 +72,9 @@ namespace MWMechanics
Send an ID_OBJECT_UNLOCK packet every time an object is unlocked
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectUnlock(lock);
worldEvent->reset();
worldEvent->addObjectUnlock(lock);
worldEvent->sendObjectUnlock();
/*
End of tes3mp addition
*/

@ -45,6 +45,8 @@ osg::Vec3f MechanicsHelper::getLinearInterpolation(osg::Vec3f start, osg::Vec3f
void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
{
MWWorld::CellRefList<ESM::CreatureLevList> *creatureLevList = cellStore->getCreatureLists();
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->reset();
for (typename MWWorld::CellRefList<ESM::CreatureLevList>::List::iterator listIter(creatureLevList->mList.begin());
listIter != creatureLevList->mList.end(); ++listIter)
@ -61,12 +63,12 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
MWWorld::ManualRef manualRef(store, id);
manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition());
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(manualRef.getPtr(), ptr.getCell(), ptr.getCellRef().getPosition());
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectPlace(placed);
worldEvent->addObjectPlace(placed);
MWBase::Environment::get().getWorld()->deleteObject(placed);
}
}
worldEvent->sendObjectPlace();
}
Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr)

@ -450,49 +450,8 @@ void WorldEvent::playVideo()
}
}
void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
{
reset();
cell = *cellStore->getCell();
action = BaseEvent::SET;
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
for (typename MWWorld::CellRefList<ESM::Container>::List::iterator listIter(containerList->mList.begin());
listIter != containerList->mList.end(); ++listIter)
{
MWWorld::Ptr container(&*listIter, 0);
mwmp::WorldObject worldObject;
worldObject.refId = container.getCellRef().getRefId();
worldObject.refNumIndex = container.getCellRef().getRefNum().mIndex;
worldObject.mpNum = container.getCellRef().getMpNum();
MWWorld::ContainerStore& containerStore = container.getClass().getContainerStore(container);
for (MWWorld::ContainerStoreIterator storeIter = containerStore.begin(); storeIter != containerStore.end(); ++storeIter)
{
MWWorld::Ptr itemPtr = *storeIter;
mwmp::ContainerItem containerItem;
containerItem.refId = itemPtr.getCellRef().getRefId();
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
worldObject.containerChanges.items.push_back(containerItem);
}
addObject(worldObject);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
}
void WorldEvent::sendObjectPlace(MWWorld::Ptr ptr)
void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -513,17 +472,10 @@ void WorldEvent::sendObjectPlace(MWWorld::Ptr ptr)
worldObject.goldValue = ptr.getCellRef().getGoldValue();
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);
}
void WorldEvent::sendObjectDelete(MWWorld::Ptr ptr)
void WorldEvent::addObjectDelete(const MWWorld::Ptr& ptr)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -531,14 +483,10 @@ void WorldEvent::sendObjectDelete(MWWorld::Ptr ptr)
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldObject.mpNum = ptr.getCellRef().getMpNum();
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
}
void WorldEvent::sendObjectLock(MWWorld::Ptr ptr, int lockLevel)
void WorldEvent::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -547,14 +495,10 @@ void WorldEvent::sendObjectLock(MWWorld::Ptr ptr, int lockLevel)
worldObject.mpNum = ptr.getCellRef().getMpNum();
worldObject.lockLevel = lockLevel;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
}
void WorldEvent::sendObjectUnlock(MWWorld::Ptr ptr)
void WorldEvent::addObjectUnlock(const MWWorld::Ptr& ptr)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -562,14 +506,10 @@ void WorldEvent::sendObjectUnlock(MWWorld::Ptr ptr)
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldObject.mpNum = ptr.getCellRef().getMpNum();
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
}
void WorldEvent::sendObjectScale(MWWorld::Ptr ptr, float scale)
void WorldEvent::addObjectScale(const MWWorld::Ptr& ptr, float scale)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -578,14 +518,10 @@ void WorldEvent::sendObjectScale(MWWorld::Ptr ptr, float scale)
worldObject.mpNum = ptr.getCellRef().getMpNum();
worldObject.scale = scale;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send();
}
void WorldEvent::sendObjectAnimPlay(MWWorld::Ptr ptr, std::string group, int mode)
void WorldEvent::addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -595,14 +531,10 @@ void WorldEvent::sendObjectAnimPlay(MWWorld::Ptr ptr, std::string group, int mod
worldObject.animGroup = group;
worldObject.animMode = mode;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send();
}
void WorldEvent::sendDoorState(MWWorld::Ptr ptr, int state)
void WorldEvent::addDoorState(const MWWorld::Ptr& ptr, int state)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -611,41 +543,25 @@ void WorldEvent::sendDoorState(MWWorld::Ptr ptr, int state)
worldObject.mpNum = ptr.getCellRef().getMpNum();
worldObject.doorState = state;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
worldObject.doorState ? "true" : "false");
}
void WorldEvent::sendMusicPlay(std::string filename)
void WorldEvent::addMusicPlay(std::string filename)
{
reset();
mwmp::WorldObject worldObject;
worldObject.filename = filename;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send();
}
void WorldEvent::sendVideoPlay(std::string filename, bool allowSkipping)
void WorldEvent::addVideoPlay(std::string filename, bool allowSkipping)
{
reset();
mwmp::WorldObject worldObject;
worldObject.filename = filename;
worldObject.allowSkipping = allowSkipping;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send();
}
void WorldEvent::sendScriptLocalShort(MWWorld::Ptr ptr, int index, int shortVal)
void WorldEvent::addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -655,18 +571,10 @@ void WorldEvent::sendScriptLocalShort(MWWorld::Ptr ptr, int index, int shortVal)
worldObject.index = index;
worldObject.shortVal = shortVal;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
worldObject.index, worldObject.shortVal);
}
void WorldEvent::sendScriptLocalFloat(MWWorld::Ptr ptr, int index, float floatVal)
void WorldEvent::addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal)
{
reset();
cell = *ptr.getCell()->getCell();
mwmp::WorldObject worldObject;
@ -676,42 +584,198 @@ void WorldEvent::sendScriptLocalFloat(MWWorld::Ptr ptr, int index, float floatVa
worldObject.index = index;
worldObject.floatVal = floatVal;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f",
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
worldObject.index, worldObject.floatVal);
}
void WorldEvent::sendScriptMemberShort(std::string refId, int index, int shortVal)
void WorldEvent::addScriptMemberShort(std::string refId, int index, int shortVal)
{
reset();
mwmp::WorldObject worldObject;
worldObject.refId = refId;
worldObject.index = index;
worldObject.shortVal = shortVal;
addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i",
worldObject.refId.c_str(), worldObject.index, worldObject.shortVal);
}
void WorldEvent::sendScriptGlobalShort(std::string varName, int shortVal)
void WorldEvent::addScriptGlobalShort(std::string varName, int shortVal)
{
reset();
mwmp::WorldObject worldObject;
worldObject.varName = varName;
worldObject.shortVal = shortVal;
addObject(worldObject);
}
void WorldEvent::sendObjectPlace()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, count: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
}
void WorldEvent::sendObjectDelete()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
}
void WorldEvent::sendObjectLock()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
}
void WorldEvent::sendObjectUnlock()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
}
void WorldEvent::sendObjectScale()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send();
}
void WorldEvent::sendObjectAnimPlay()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send();
}
void WorldEvent::sendDoorState()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.doorState ? "true" : "false");
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
}
void WorldEvent::sendMusicPlay()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send();
}
void WorldEvent::sendVideoPlay()
{
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send();
}
void WorldEvent::sendScriptLocalShort()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.index, worldObject.shortVal);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
}
void WorldEvent::sendScriptLocalFloat()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.index, worldObject.floatVal);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();
}
void WorldEvent::sendScriptMemberShort()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT");
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i",
worldObject.refId.c_str(), worldObject.index, worldObject.shortVal);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send();
}
void WorldEvent::sendScriptGlobalShort()
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT");
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
{
mwmp::WorldObject worldObject = (*it);
LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i",
worldObject.varName.c_str(), worldObject.shortVal);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send();
}
void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
{
reset();
cell = *cellStore->getCell();
action = BaseEvent::SET;
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
for (typename MWWorld::CellRefList<ESM::Container>::List::iterator listIter(containerList->mList.begin());
listIter != containerList->mList.end(); ++listIter)
{
MWWorld::Ptr container(&*listIter, 0);
mwmp::WorldObject worldObject;
worldObject.refId = container.getCellRef().getRefId();
worldObject.refNumIndex = container.getCellRef().getRefNum().mIndex;
worldObject.mpNum = container.getCellRef().getMpNum();
MWWorld::ContainerStore& containerStore = container.getClass().getContainerStore(container);
for (MWWorld::ContainerStoreIterator storeIter = containerStore.begin(); storeIter != containerStore.end(); ++storeIter)
{
MWWorld::Ptr itemPtr = *storeIter;
mwmp::ContainerItem containerItem;
containerItem.refId = itemPtr.getCellRef().getRefId();
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
worldObject.containerChanges.items.push_back(containerItem);
}
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i",
worldObject.varName.c_str(), worldObject.shortVal);
addObject(worldObject);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
}

@ -38,21 +38,35 @@ namespace mwmp
void playMusic();
void playVideo();
void sendContainers(MWWorld::CellStore* cellStore);
void addObjectPlace(const MWWorld::Ptr& ptr);
void addObjectDelete(const MWWorld::Ptr& ptr);
void addObjectLock(const MWWorld::Ptr& ptr, int lockLevel);
void addObjectUnlock(const MWWorld::Ptr& ptr);
void addObjectScale(const MWWorld::Ptr& ptr, float scale);
void addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode);
void addDoorState(const MWWorld::Ptr& ptr, int state);
void addMusicPlay(std::string filename);
void addVideoPlay(std::string filename, bool allowSkipping);
void addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal);
void addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal);
void addScriptMemberShort(std::string refId, int index, int shortVal);
void addScriptGlobalShort(std::string varName, int shortVal);
void sendObjectPlace();
void sendObjectDelete();
void sendObjectLock();
void sendObjectUnlock();
void sendObjectScale();
void sendObjectAnimPlay();
void sendDoorState();
void sendMusicPlay();
void sendVideoPlay();
void sendScriptLocalShort();
void sendScriptLocalFloat();
void sendScriptMemberShort();
void sendScriptGlobalShort();
void sendObjectPlace(MWWorld::Ptr ptr);
void sendObjectDelete(MWWorld::Ptr ptr);
void sendObjectLock(MWWorld::Ptr ptr, int lockLevel);
void sendObjectUnlock(MWWorld::Ptr ptr);
void sendObjectScale(MWWorld::Ptr ptr, float scale);
void sendObjectAnimPlay(MWWorld::Ptr ptr, std::string group, int mode);
void sendDoorState(MWWorld::Ptr ptr, int state);
void sendMusicPlay(std::string filename);
void sendVideoPlay(std::string filename, bool allowSkipping);
void sendScriptLocalShort(MWWorld::Ptr ptr, int index, int shortVal);
void sendScriptLocalFloat(MWWorld::Ptr ptr, int index, float floatVal);
void sendScriptMemberShort(std::string refId, int index, int shortVal);
void sendScriptGlobalShort(std::string varName, int shortVal);
void sendContainers(MWWorld::CellStore* cellStore);
private:
Networking *getNetworking();

@ -83,7 +83,9 @@ namespace MWScript
if (mwmp::Main::isValidPacketScript(ptr.getClass().getScript(ptr)))
{
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectAnimPlay(ptr, group, mode);
worldEvent->reset();
worldEvent->addObjectAnimPlay(ptr, group, mode);
worldEvent->sendObjectAnimPlay();
}
/*
End of tes3mp addition

@ -211,7 +211,9 @@ namespace MWScript
if (sendPackets)
{
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendScriptLocalShort(mReference, index, value);
worldEvent->reset();
worldEvent->addScriptLocalShort(mReference, index, value);
worldEvent->sendScriptLocalShort();
}
/*
End of tes3mp addition
@ -243,7 +245,9 @@ namespace MWScript
if (sendPackets && value == (int) value)
{
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendScriptLocalFloat(mReference, index, value);
worldEvent->reset();
worldEvent->addScriptLocalFloat(mReference, index, value);
worldEvent->sendScriptLocalFloat();
}
/*
End of tes3mp addition
@ -300,7 +304,9 @@ namespace MWScript
if (sendPackets)
{
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendScriptGlobalShort(name, value);
worldEvent->reset();
worldEvent->addScriptGlobalShort(name, value);
worldEvent->sendScriptGlobalShort();
}
/*
End of tes3mp addition
@ -635,7 +641,9 @@ namespace MWScript
if (sendPackets && !global)
{
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendScriptMemberShort(id, index, value);
worldEvent->reset();
worldEvent->addScriptMemberShort(id, index, value);
worldEvent->sendScriptMemberShort();
}
/*
End of tes3mp addition

@ -104,7 +104,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendVideoPlay(name, allowSkipping);
worldEvent->reset();
worldEvent->addVideoPlay(name, allowSkipping);
worldEvent->sendVideoPlay();
/*
End of tes3mp addition
*/
@ -214,7 +216,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectLock(ptr, lockLevel);
worldEvent->reset();
worldEvent->addObjectLock(ptr, lockLevel);
worldEvent->sendObjectLock();
/*
End of tes3mp addition
*/
@ -252,7 +256,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectUnlock(ptr);
worldEvent->reset();
worldEvent->addObjectUnlock(ptr);
worldEvent->sendObjectUnlock();
/*
End of tes3mp addition
*/
@ -724,7 +730,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectDelete(ptr);
worldEvent->reset();
worldEvent->addObjectDelete(ptr);
worldEvent->sendObjectDelete();
/*
End of tes3mp addition
*/

@ -88,7 +88,9 @@ namespace MWScript
a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendMusicPlay(sound);
worldEvent->reset();
worldEvent->addMusicPlay(sound);
worldEvent->sendMusicPlay();
/*
End of tes3mp addition
*/

@ -61,7 +61,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectScale(ptr, scale);
worldEvent->reset();
worldEvent->addObjectScale(ptr, scale);
worldEvent->sendObjectScale();
/*
End of tes3mp addition
*/
@ -556,7 +558,9 @@ namespace MWScript
through a script
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectPlace(ptr);
worldEvent->reset();
worldEvent->addObjectPlace(ptr);
worldEvent->sendObjectPlace();
/*
End of tes3mp addition
*/

@ -43,7 +43,9 @@ namespace MWWorld
by the player
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendObjectDelete(getTarget());
worldEvent->reset();
worldEvent->addObjectDelete(getTarget());
worldEvent->sendObjectDelete();
mwmp::Main::get().getLocalPlayer()->sendInventory();
/*
End of tes3mp addition

@ -2383,7 +2383,9 @@ namespace MWWorld
Send an ID_DOOR_STATE packet every time a door is activated
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendDoorState(door, state);
worldEvent->reset();
worldEvent->addDoorState(door, state);
worldEvent->sendDoorState();
/*
End of tes3mp addition
*/
@ -2400,7 +2402,9 @@ namespace MWWorld
Send an ID_DOOR_STATE packet every time a door is activated
*/
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
worldEvent->sendDoorState(door, state);
worldEvent->reset();
worldEvent->addDoorState(door, state);
worldEvent->sendDoorState();
/*
End of tes3mp addition
*/

Loading…
Cancel
Save