mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 14:19:41 +00:00
[Server] Reuse 2 BaseEvents over and over instead of creating new ones
This commit is contained in:
parent
1b59ce8c8f
commit
7065569f9b
3 changed files with 113 additions and 105 deletions
|
@ -22,8 +22,7 @@ using namespace mwmp;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Networking *Networking::sThis = 0;
|
Networking *Networking::sThis = 0;
|
||||||
|
BaseEvent baseEvent = BaseEvent();
|
||||||
static BaseEvent *baseEvent = nullptr;
|
|
||||||
|
|
||||||
Networking::Networking(RakNet::RakPeerInterface *peer)
|
Networking::Networking(RakNet::RakPeerInterface *peer)
|
||||||
{
|
{
|
||||||
|
@ -472,13 +471,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
|
|
||||||
WorldPacket *myPacket = worldController->GetPacket(packet->data[0]);
|
WorldPacket *myPacket = worldController->GetPacket(packet->data[0]);
|
||||||
|
|
||||||
if (baseEvent)
|
// Clear our baseEvent before loading new data in it
|
||||||
{
|
baseEvent.cell.blank();
|
||||||
delete baseEvent;
|
baseEvent.objectChanges.objects.clear();
|
||||||
baseEvent = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
baseEvent = new BaseEvent(player->guid);
|
|
||||||
|
|
||||||
switch (packet->data[0])
|
switch (packet->data[0])
|
||||||
{
|
{
|
||||||
|
@ -488,12 +483,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnObjectPlace")>(
|
Script::Call<Script::CallbackIdentity("OnObjectPlace")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -503,12 +498,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnObjectDelete")>(
|
Script::Call<Script::CallbackIdentity("OnObjectDelete")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -518,12 +513,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnObjectScale")>(
|
Script::Call<Script::CallbackIdentity("OnObjectScale")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -533,12 +528,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnObjectLock")>(
|
Script::Call<Script::CallbackIdentity("OnObjectLock")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -548,12 +543,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnObjectUnlock")>(
|
Script::Call<Script::CallbackIdentity("OnObjectUnlock")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -563,8 +558,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -574,8 +569,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -585,8 +580,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -596,12 +591,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnDoorState")>(
|
Script::Call<Script::CallbackIdentity("OnDoorState")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -611,21 +606,21 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_WARN, "- action: %i", baseEvent->action);
|
LOG_APPEND(Log::LOG_WARN, "- action: %i", baseEvent.action);
|
||||||
|
|
||||||
// Until we have a timestamp-based system, send packets pertaining to more
|
// Until we have a timestamp-based system, send packets pertaining to more
|
||||||
// than one container (i.e. replies to server requests for container contents)
|
// than one container (i.e. replies to server requests for container contents)
|
||||||
// only to players who have the container's cell loaded
|
// only to players who have the container's cell loaded
|
||||||
if (baseEvent->action == BaseEvent::SET && baseEvent->objectChanges.count > 1)
|
if (baseEvent.action == BaseEvent::SET && baseEvent.objectChanges.count > 1)
|
||||||
CellController::get()->getCell(&baseEvent->cell)->sendToLoaded(myPacket, baseEvent);
|
CellController::get()->getCell(&baseEvent.cell)->sendToLoaded(myPacket, &baseEvent);
|
||||||
else
|
else
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnContainer")>(
|
Script::Call<Script::CallbackIdentity("OnContainer")>(
|
||||||
player->getId(),
|
player->getId(),
|
||||||
baseEvent->cell.getDescription().c_str());
|
baseEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -635,8 +630,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -646,8 +641,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -657,8 +652,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -668,8 +663,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -679,8 +674,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -690,8 +685,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s",
|
||||||
player->npc.mName.c_str());
|
player->npc.mName.c_str());
|
||||||
|
|
||||||
myPacket->Read(baseEvent);
|
myPacket->Read(&baseEvent);
|
||||||
myPacket->Send(baseEvent, true);
|
myPacket->Send(&baseEvent, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -804,7 +799,7 @@ WorldPacketController *Networking::getWorldController() const
|
||||||
|
|
||||||
BaseEvent *Networking::getLastEvent()
|
BaseEvent *Networking::getLastEvent()
|
||||||
{
|
{
|
||||||
return baseEvent;
|
return &baseEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Networking &Networking::get()
|
const Networking &Networking::get()
|
||||||
|
|
|
@ -9,24 +9,16 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
static BaseEvent *baseEvent = nullptr;
|
BaseEvent scriptEvent = BaseEvent();
|
||||||
static WorldObject tempWorldObject;
|
WorldObject tempWorldObject;
|
||||||
static ContainerItem tempContainerItem;
|
ContainerItem tempContainerItem;
|
||||||
|
|
||||||
std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
|
std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
|
||||||
|
|
||||||
void WorldFunctions::CreateBaseEvent(unsigned short pid) noexcept
|
void WorldFunctions::ClearScriptEvent() noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
scriptEvent.cell.blank();
|
||||||
GET_PLAYER(pid, player, );
|
scriptEvent.objectChanges.objects.clear();
|
||||||
|
|
||||||
if (baseEvent)
|
|
||||||
{
|
|
||||||
delete baseEvent;
|
|
||||||
baseEvent = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
baseEvent = new BaseEvent(player->guid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WorldFunctions::GetObjectChangesSize() noexcept
|
unsigned int WorldFunctions::GetObjectChangesSize() noexcept
|
||||||
|
@ -34,7 +26,7 @@ unsigned int WorldFunctions::GetObjectChangesSize() noexcept
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.count;
|
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WorldFunctions::GetBaseEventAction() noexcept
|
unsigned int WorldFunctions::GetLastEventAction() noexcept
|
||||||
{
|
{
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->action;
|
return mwmp::Networking::getPtr()->getLastEvent()->action;
|
||||||
}
|
}
|
||||||
|
@ -138,32 +130,32 @@ int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsign
|
||||||
.containerChanges.items.at(itemIndex).actionCount;
|
.containerChanges.items.at(itemIndex).actionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SetBaseEventCell(const char* cellDescription) noexcept
|
void WorldFunctions::SetScriptEventCell(const char* cellDescription) noexcept
|
||||||
{
|
{
|
||||||
std::string description = cellDescription;
|
std::string description = cellDescription;
|
||||||
std::smatch baseMatch;
|
std::smatch baseMatch;
|
||||||
|
|
||||||
if (std::regex_match(description, baseMatch, exteriorCellPattern))
|
if (std::regex_match(description, baseMatch, exteriorCellPattern))
|
||||||
{
|
{
|
||||||
baseEvent->cell.mData.mFlags &= ~ESM::Cell::Interior;
|
scriptEvent.cell.mData.mFlags &= ~ESM::Cell::Interior;
|
||||||
|
|
||||||
// The first sub match is the whole string, so check for a length of 3
|
// The first sub match is the whole string, so check for a length of 3
|
||||||
if (baseMatch.size() == 3)
|
if (baseMatch.size() == 3)
|
||||||
{
|
{
|
||||||
baseEvent->cell.mData.mX = stoi(baseMatch[1].str());
|
scriptEvent.cell.mData.mX = stoi(baseMatch[1].str());
|
||||||
baseEvent->cell.mData.mY = stoi(baseMatch[2].str());
|
scriptEvent.cell.mData.mY = stoi(baseMatch[2].str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
baseEvent->cell.mData.mFlags |= ESM::Cell::Interior;
|
scriptEvent.cell.mData.mFlags |= ESM::Cell::Interior;
|
||||||
baseEvent->cell.mName = description;
|
scriptEvent.cell.mName = description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SetBaseEventAction(int action) noexcept
|
void WorldFunctions::SetScriptEventAction(int action) noexcept
|
||||||
{
|
{
|
||||||
baseEvent->action = action;
|
scriptEvent.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SetObjectRefId(const char* refId) noexcept
|
void WorldFunctions::SetObjectRefId(const char* refId) noexcept
|
||||||
|
@ -249,7 +241,7 @@ void WorldFunctions::AddWorldObject() noexcept
|
||||||
worldObject.pos = tempWorldObject.pos;
|
worldObject.pos = tempWorldObject.pos;
|
||||||
worldObject.containerChanges.items = tempWorldObject.containerChanges.items;
|
worldObject.containerChanges.items = tempWorldObject.containerChanges.items;
|
||||||
|
|
||||||
baseEvent->objectChanges.objects.push_back(worldObject);
|
scriptEvent.objectChanges.objects.push_back(worldObject);
|
||||||
|
|
||||||
tempWorldObject.containerChanges.items.clear();
|
tempWorldObject.containerChanges.items.clear();
|
||||||
}
|
}
|
||||||
|
@ -264,39 +256,60 @@ void WorldFunctions::AddContainerItem() noexcept
|
||||||
tempWorldObject.containerChanges.items.push_back(containerItem);
|
tempWorldObject.containerChanges.items.push_back(containerItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendObjectDelete() noexcept
|
void WorldFunctions::SendObjectDelete(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendObjectPlace() noexcept
|
void WorldFunctions::SendObjectPlace(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendObjectScale() noexcept
|
void WorldFunctions::SendObjectScale(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendObjectLock() noexcept
|
void WorldFunctions::SendObjectLock(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendObjectUnlock() noexcept
|
void WorldFunctions::SendObjectUnlock(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendDoorState() noexcept
|
void WorldFunctions::SendDoorState(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SendContainer() noexcept
|
void WorldFunctions::SendContainer(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(baseEvent, baseEvent->guid);
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(&scriptEvent, player->guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
#define OPENMW_WORLD_HPP
|
#define OPENMW_WORLD_HPP
|
||||||
|
|
||||||
#define WORLDFUNCTIONS \
|
#define WORLDFUNCTIONS \
|
||||||
{"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
|
{"ClearScriptEvent", WorldFunctions::ClearScriptEvent},\
|
||||||
\
|
\
|
||||||
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
|
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
|
||||||
{"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\
|
{"GetLastEventAction", WorldFunctions::GetLastEventAction},\
|
||||||
\
|
\
|
||||||
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
||||||
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
{"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\
|
{"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\
|
||||||
{"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\
|
{"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\
|
||||||
\
|
\
|
||||||
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
|
{"SetScriptEventCell", WorldFunctions::SetScriptEventCell},\
|
||||||
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
|
{"SetScriptEventAction", WorldFunctions::SetScriptEventAction},\
|
||||||
\
|
\
|
||||||
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
|
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
|
||||||
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
|
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
|
||||||
|
@ -65,10 +65,10 @@ class WorldFunctions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void CreateBaseEvent(unsigned short pid) noexcept;
|
static void ClearScriptEvent() noexcept;
|
||||||
|
|
||||||
static unsigned int GetObjectChangesSize() noexcept;
|
static unsigned int GetObjectChangesSize() noexcept;
|
||||||
static unsigned int GetBaseEventAction() noexcept;
|
static unsigned int GetLastEventAction() noexcept;
|
||||||
|
|
||||||
static const char *GetObjectRefId(unsigned int i) noexcept;
|
static const char *GetObjectRefId(unsigned int i) noexcept;
|
||||||
static int GetObjectRefNumIndex(unsigned int i) noexcept;
|
static int GetObjectRefNumIndex(unsigned int i) noexcept;
|
||||||
|
@ -91,8 +91,8 @@ public:
|
||||||
static int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept;
|
static int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept;
|
||||||
static int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept;
|
static int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept;
|
||||||
|
|
||||||
static void SetBaseEventCell(const char* cellDescription) noexcept;
|
static void SetScriptEventCell(const char* cellDescription) noexcept;
|
||||||
static void SetBaseEventAction(int action) noexcept;
|
static void SetScriptEventAction(int action) noexcept;
|
||||||
|
|
||||||
static void SetObjectRefId(const char* refId) noexcept;
|
static void SetObjectRefId(const char* refId) noexcept;
|
||||||
static void SetObjectRefNumIndex(int refNumIndex) noexcept;
|
static void SetObjectRefNumIndex(int refNumIndex) noexcept;
|
||||||
|
@ -112,13 +112,13 @@ public:
|
||||||
static void AddWorldObject() noexcept;
|
static void AddWorldObject() noexcept;
|
||||||
static void AddContainerItem() noexcept;
|
static void AddContainerItem() noexcept;
|
||||||
|
|
||||||
static void SendObjectDelete() noexcept;
|
static void SendObjectDelete(unsigned short pid) noexcept;
|
||||||
static void SendObjectPlace() noexcept;
|
static void SendObjectPlace(unsigned short pid) noexcept;
|
||||||
static void SendObjectScale() noexcept;
|
static void SendObjectScale(unsigned short pid) noexcept;
|
||||||
static void SendObjectLock() noexcept;
|
static void SendObjectLock(unsigned short pid) noexcept;
|
||||||
static void SendObjectUnlock() noexcept;
|
static void SendObjectUnlock(unsigned short pid) noexcept;
|
||||||
static void SendDoorState() noexcept;
|
static void SendDoorState(unsigned short pid) noexcept;
|
||||||
static void SendContainer() noexcept;
|
static void SendContainer(unsigned short pid) noexcept;
|
||||||
|
|
||||||
static void SetHour(unsigned short pid, double hour) noexcept;
|
static void SetHour(unsigned short pid, double hour) noexcept;
|
||||||
static void SetMonth(unsigned short pid, int month) noexcept;
|
static void SetMonth(unsigned short pid, int month) noexcept;
|
||||||
|
|
Loading…
Reference in a new issue