mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 17:39:40 +00:00
[Server] Add script functions for getting, setting & sending gold pools
This commit is contained in:
parent
23ff7b9610
commit
7833ae9a3f
4 changed files with 53 additions and 2 deletions
|
@ -154,6 +154,11 @@ int ObjectFunctions::GetObjectLockLevel(unsigned int index) noexcept
|
||||||
return readObjectList->baseObjects.at(index).lockLevel;
|
return readObjectList->baseObjects.at(index).lockLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int ObjectFunctions::GetObjectGoldPool(unsigned int index) noexcept
|
||||||
|
{
|
||||||
|
return readObjectList->baseObjects.at(index).goldPool;
|
||||||
|
}
|
||||||
|
|
||||||
bool ObjectFunctions::DoesObjectHavePlayerActivating(unsigned int index) noexcept
|
bool ObjectFunctions::DoesObjectHavePlayerActivating(unsigned int index) noexcept
|
||||||
{
|
{
|
||||||
return readObjectList->baseObjects.at(index).activatingActor.isPlayer;
|
return readObjectList->baseObjects.at(index).activatingActor.isPlayer;
|
||||||
|
@ -460,6 +465,11 @@ void ObjectFunctions::SetObjectLockLevel(int lockLevel) noexcept
|
||||||
tempObject.lockLevel = lockLevel;
|
tempObject.lockLevel = lockLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFunctions::SetObjectGoldPool(int goldPool) noexcept
|
||||||
|
{
|
||||||
|
tempObject.goldPool = goldPool;
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFunctions::SetObjectDisarmState(bool disarmState) noexcept
|
void ObjectFunctions::SetObjectDisarmState(bool disarmState) noexcept
|
||||||
{
|
{
|
||||||
tempObject.isDisarmed = disarmState;
|
tempObject.isDisarmed = disarmState;
|
||||||
|
@ -687,6 +697,17 @@ void ObjectFunctions::SendObjectLock(bool sendToOtherPlayers, bool skipAttachedP
|
||||||
packet->Send(true);
|
packet->Send(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFunctions::SendObjectMiscellaneous(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||||
|
{
|
||||||
|
mwmp::ObjectPacket* packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_MISCELLANEOUS);
|
||||||
|
packet->setObjectList(&writeObjectList);
|
||||||
|
|
||||||
|
if (!skipAttachedPlayer)
|
||||||
|
packet->Send(false);
|
||||||
|
if (sendToOtherPlayers)
|
||||||
|
packet->Send(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFunctions::SendObjectRestock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
void ObjectFunctions::SendObjectRestock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||||
{
|
{
|
||||||
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_RESTOCK);
|
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_RESTOCK);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
{"GetObjectState", ObjectFunctions::GetObjectState},\
|
{"GetObjectState", ObjectFunctions::GetObjectState},\
|
||||||
{"GetObjectDoorState", ObjectFunctions::GetObjectDoorState},\
|
{"GetObjectDoorState", ObjectFunctions::GetObjectDoorState},\
|
||||||
{"GetObjectLockLevel", ObjectFunctions::GetObjectLockLevel},\
|
{"GetObjectLockLevel", ObjectFunctions::GetObjectLockLevel},\
|
||||||
|
{"GetObjectGoldPool", ObjectFunctions::GetObjectGoldPool},\
|
||||||
\
|
\
|
||||||
{"DoesObjectHavePlayerActivating", ObjectFunctions::DoesObjectHavePlayerActivating},\
|
{"DoesObjectHavePlayerActivating", ObjectFunctions::DoesObjectHavePlayerActivating},\
|
||||||
{"GetObjectActivatingPid", ObjectFunctions::GetObjectActivatingPid},\
|
{"GetObjectActivatingPid", ObjectFunctions::GetObjectActivatingPid},\
|
||||||
|
@ -98,6 +99,7 @@
|
||||||
{"SetObjectScale", ObjectFunctions::SetObjectScale},\
|
{"SetObjectScale", ObjectFunctions::SetObjectScale},\
|
||||||
{"SetObjectState", ObjectFunctions::SetObjectState},\
|
{"SetObjectState", ObjectFunctions::SetObjectState},\
|
||||||
{"SetObjectLockLevel", ObjectFunctions::SetObjectLockLevel},\
|
{"SetObjectLockLevel", ObjectFunctions::SetObjectLockLevel},\
|
||||||
|
{"SetObjectGoldPool", ObjectFunctions::SetObjectGoldPool},\
|
||||||
{"SetObjectDisarmState", ObjectFunctions::SetObjectDisarmState},\
|
{"SetObjectDisarmState", ObjectFunctions::SetObjectDisarmState},\
|
||||||
{"SetObjectDroppedByPlayerState", ObjectFunctions::SetObjectDroppedByPlayerState},\
|
{"SetObjectDroppedByPlayerState", ObjectFunctions::SetObjectDroppedByPlayerState},\
|
||||||
{"SetObjectPosition", ObjectFunctions::SetObjectPosition},\
|
{"SetObjectPosition", ObjectFunctions::SetObjectPosition},\
|
||||||
|
@ -141,6 +143,7 @@
|
||||||
{"SendObjectSpawn", ObjectFunctions::SendObjectSpawn},\
|
{"SendObjectSpawn", ObjectFunctions::SendObjectSpawn},\
|
||||||
{"SendObjectDelete", ObjectFunctions::SendObjectDelete},\
|
{"SendObjectDelete", ObjectFunctions::SendObjectDelete},\
|
||||||
{"SendObjectLock", ObjectFunctions::SendObjectLock},\
|
{"SendObjectLock", ObjectFunctions::SendObjectLock},\
|
||||||
|
{"SendObjectMiscellaneous", ObjectFunctions::SendObjectMiscellaneous},\
|
||||||
{"SendObjectRestock", ObjectFunctions::SendObjectRestock},\
|
{"SendObjectRestock", ObjectFunctions::SendObjectRestock},\
|
||||||
{"SendObjectTrap", ObjectFunctions::SendObjectTrap},\
|
{"SendObjectTrap", ObjectFunctions::SendObjectTrap},\
|
||||||
{"SendObjectScale", ObjectFunctions::SendObjectScale},\
|
{"SendObjectScale", ObjectFunctions::SendObjectScale},\
|
||||||
|
@ -381,6 +384,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static int GetObjectLockLevel(unsigned int index) noexcept;
|
static int GetObjectLockLevel(unsigned int index) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the gold pool of the object at a certain index in the read object list.
|
||||||
|
*
|
||||||
|
* \param index The index of the object.
|
||||||
|
* \return The gold pool.
|
||||||
|
*/
|
||||||
|
static unsigned int GetObjectGoldPool(unsigned int index) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Check whether the object at a certain index in the read object list has been
|
* \brief Check whether the object at a certain index in the read object list has been
|
||||||
* activated by a player.
|
* activated by a player.
|
||||||
|
@ -899,6 +910,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static void SetObjectLockLevel(int lockLevel) noexcept;
|
static void SetObjectLockLevel(int lockLevel) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the gold pool of the temporary object stored on the server.
|
||||||
|
*
|
||||||
|
* \param goldPool The gold pool.
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SetObjectGoldPool(int goldPool) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the disarm state of the temporary object stored on the server.
|
* \brief Set the disarm state of the temporary object stored on the server.
|
||||||
*
|
*
|
||||||
|
@ -1202,6 +1221,17 @@ public:
|
||||||
*/
|
*/
|
||||||
static void SendObjectLock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
static void SendObjectLock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Send an ObjectMiscellaneous packet.
|
||||||
|
*
|
||||||
|
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
||||||
|
* player attached to the packet (false by default).
|
||||||
|
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
||||||
|
* to the packet (false by default).
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SendObjectMiscellaneous(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Send an ObjectRestock packet.
|
* \brief Send an ObjectRestock packet.
|
||||||
*
|
*
|
||||||
|
|
|
@ -195,6 +195,7 @@ public:
|
||||||
{"OnObjectSpawn", Callback<unsigned short, const char*>()},
|
{"OnObjectSpawn", Callback<unsigned short, const char*>()},
|
||||||
{"OnObjectDelete", Callback<unsigned short, const char*>()},
|
{"OnObjectDelete", Callback<unsigned short, const char*>()},
|
||||||
{"OnObjectLock", Callback<unsigned short, const char*>()},
|
{"OnObjectLock", Callback<unsigned short, const char*>()},
|
||||||
|
{"OnObjectMiscellaneous", Callback<unsigned short, const char*>()},
|
||||||
{"OnObjectRestock", Callback<unsigned short, const char*>()},
|
{"OnObjectRestock", Callback<unsigned short, const char*>()},
|
||||||
{"OnObjectScale", Callback<unsigned short, const char*>()},
|
{"OnObjectScale", Callback<unsigned short, const char*>()},
|
||||||
{"OnObjectSound", Callback<unsigned short, const char*>()},
|
{"OnObjectSound", Callback<unsigned short, const char*>()},
|
||||||
|
|
|
@ -17,8 +17,7 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||||
|
|
||||||
packet.Send(false);
|
Script::Call<Script::CallbackIdentity("OnObjectMiscellaneous")>(player.getId(), objectList.cell.getDescription().c_str());
|
||||||
packet.Send(true);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue