mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 11:14:04 +00:00
[General] Add packetOrigin and originClientScript to ObjectList packets
Additionally, add script functions for getting the packetOrigin and originClientScript of received ObjectList packets.
This commit is contained in:
parent
b891acd46e
commit
3dc2d1b214
5 changed files with 43 additions and 0 deletions
|
@ -28,6 +28,7 @@ void ObjectFunctions::ClearObjectList() noexcept
|
||||||
{
|
{
|
||||||
writeObjectList.cell.blank();
|
writeObjectList.cell.blank();
|
||||||
writeObjectList.baseObjects.clear();
|
writeObjectList.baseObjects.clear();
|
||||||
|
writeObjectList.packetOrigin = mwmp::PACKET_ORIGIN::SERVER_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFunctions::SetObjectListPid(unsigned short pid) noexcept
|
void ObjectFunctions::SetObjectListPid(unsigned short pid) noexcept
|
||||||
|
@ -48,6 +49,16 @@ unsigned int ObjectFunctions::GetObjectListSize() noexcept
|
||||||
return readObjectList->baseObjectCount;
|
return readObjectList->baseObjectCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char ObjectFunctions::GetObjectListOrigin() noexcept
|
||||||
|
{
|
||||||
|
return readObjectList->packetOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *ObjectFunctions::GetObjectListClientScript() noexcept
|
||||||
|
{
|
||||||
|
return readObjectList->originClientScript.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char ObjectFunctions::GetObjectListAction() noexcept
|
unsigned char ObjectFunctions::GetObjectListAction() noexcept
|
||||||
{
|
{
|
||||||
return readObjectList->action;
|
return readObjectList->action;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
{"CopyReceivedObjectListToStore", ObjectFunctions::CopyReceivedObjectListToStore},\
|
{"CopyReceivedObjectListToStore", ObjectFunctions::CopyReceivedObjectListToStore},\
|
||||||
\
|
\
|
||||||
{"GetObjectListSize", ObjectFunctions::GetObjectListSize},\
|
{"GetObjectListSize", ObjectFunctions::GetObjectListSize},\
|
||||||
|
{"GetObjectListOrigin", ObjectFunctions::GetObjectListOrigin},\
|
||||||
|
{"GetObjectListClientScript", ObjectFunctions::GetObjectListClientScript},\
|
||||||
{"GetObjectListAction", ObjectFunctions::GetObjectListAction},\
|
{"GetObjectListAction", ObjectFunctions::GetObjectListAction},\
|
||||||
{"GetObjectListContainerSubAction", ObjectFunctions::GetObjectListContainerSubAction},\
|
{"GetObjectListContainerSubAction", ObjectFunctions::GetObjectListContainerSubAction},\
|
||||||
\
|
\
|
||||||
|
@ -170,6 +172,20 @@ public:
|
||||||
*/
|
*/
|
||||||
static unsigned int GetObjectListSize() noexcept;
|
static unsigned int GetObjectListSize() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the origin of the read object list.
|
||||||
|
*
|
||||||
|
* \return The origin (0 for GAMEPLAY, 1 for CONSOLE, 2 for CLIENT_SCRIPT).
|
||||||
|
*/
|
||||||
|
static unsigned char GetObjectListOrigin() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the client script that the read object list originated from.
|
||||||
|
*
|
||||||
|
* \return The ID of the client script.
|
||||||
|
*/
|
||||||
|
static const char *GetObjectListClientScript() noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the action type used in the read object list.
|
* \brief Get the action type used in the read object list.
|
||||||
*
|
*
|
||||||
|
|
|
@ -113,6 +113,9 @@ namespace mwmp
|
||||||
ESM::Cell cell;
|
ESM::Cell cell;
|
||||||
std::string consoleCommand;
|
std::string consoleCommand;
|
||||||
|
|
||||||
|
unsigned char packetOrigin; // 0 - Gameplay, 1 - Console, 2 - Client script, 3 - Server script
|
||||||
|
std::string originClientScript;
|
||||||
|
|
||||||
unsigned char action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item, 3 - Request items
|
unsigned char action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item, 3 - Request items
|
||||||
unsigned char containerSubAction; // 0 - None, 1 - Drag, 2 - Drop, 3 - Take all, 4 - Reply to request
|
unsigned char containerSubAction; // 0 - None, 1 - Drag, 2 - Drop, 3 - Take all, 4 - Reply to request
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
|
enum PACKET_ORIGIN
|
||||||
|
{
|
||||||
|
GAMEPLAY = 0,
|
||||||
|
CONSOLE = 1,
|
||||||
|
CLIENT_SCRIPT = 2,
|
||||||
|
SERVER_SCRIPT = 3
|
||||||
|
};
|
||||||
|
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
std::string refId;
|
std::string refId;
|
||||||
|
|
|
@ -48,6 +48,11 @@ bool ObjectPacket::PacketHeader(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, send);
|
BasePacket::Packet(bs, send);
|
||||||
|
|
||||||
|
RW(objectList->packetOrigin, send);
|
||||||
|
|
||||||
|
if (objectList->packetOrigin == mwmp::CLIENT_SCRIPT)
|
||||||
|
RW(objectList->originClientScript, true);
|
||||||
|
|
||||||
if (send)
|
if (send)
|
||||||
objectList->baseObjectCount = (unsigned int)(objectList->baseObjects.size());
|
objectList->baseObjectCount = (unsigned int)(objectList->baseObjects.size());
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue