|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|