1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00

[Server] Add script functions for getting container item info

This commit is contained in:
David Cernat 2017-02-17 18:33:20 +02:00
parent 70470e12b4
commit aa1549606f
2 changed files with 95 additions and 46 deletions

View file

@ -48,16 +48,16 @@ int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex;
}
int WorldFunctions::GetObjectCharge(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).charge;
}
int WorldFunctions::GetObjectCount(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count;
}
int WorldFunctions::GetObjectCharge(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).charge;
}
int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).goldValue;
@ -108,6 +108,41 @@ double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[2];
}
unsigned int WorldFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex).containerChanges.count;
}
const char *WorldFunctions::GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).refId.c_str();
}
int WorldFunctions::GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).count;
}
int WorldFunctions::GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).charge;
}
int WorldFunctions::GetContainerItemGoldValue(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).goldValue;
}
const char *WorldFunctions::GetContainerItemOwner(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).owner.c_str();
}
void WorldFunctions::AddWorldObject() noexcept
{
WorldObject worldObject;

View file

@ -2,53 +2,60 @@
#define OPENMW_WORLD_HPP
#define WORLDFUNCTIONS \
{"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
{"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
\
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
{"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
{"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\
\
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
{"GetObjectCharge", WorldFunctions::GetObjectCharge},\
{"GetObjectCount", WorldFunctions::GetObjectCount},\
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
{"GetObjectScale", WorldFunctions::GetObjectScale},\
{"GetObjectDoorState", WorldFunctions::GetObjectDoorState},\
{"GetObjectLockLevel", WorldFunctions::GetObjectLockLevel},\
{"GetObjectPosX", WorldFunctions::GetObjectPosX},\
{"GetObjectPosY", WorldFunctions::GetObjectPosY},\
{"GetObjectPosZ", WorldFunctions::GetObjectPosZ},\
{"GetObjectRotX", WorldFunctions::GetObjectRotX},\
{"GetObjectRotY", WorldFunctions::GetObjectRotY},\
{"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
{"GetObjectCount", WorldFunctions::GetObjectCount},\
{"GetObjectCharge", WorldFunctions::GetObjectCharge},\
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
{"GetObjectScale", WorldFunctions::GetObjectScale},\
{"GetObjectDoorState", WorldFunctions::GetObjectDoorState},\
{"GetObjectLockLevel", WorldFunctions::GetObjectLockLevel},\
{"GetObjectPosX", WorldFunctions::GetObjectPosX},\
{"GetObjectPosY", WorldFunctions::GetObjectPosY},\
{"GetObjectPosZ", WorldFunctions::GetObjectPosZ},\
{"GetObjectRotX", WorldFunctions::GetObjectRotX},\
{"GetObjectRotY", WorldFunctions::GetObjectRotY},\
{"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\
\
{"AddWorldObject", WorldFunctions::AddWorldObject},\
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
{"GetContainerChangesSize", WorldFunctions::GetContainerChangesSize},\
{"GetContainerItemRefId", WorldFunctions::GetContainerItemRefId},\
{"GetContainerItemCount", WorldFunctions::GetContainerItemCount},\
{"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\
{"GetContainerItemGoldValue", WorldFunctions::GetContainerItemGoldValue},\
{"GetContainerItemOwner", WorldFunctions::GetContainerItemOwner},\
\
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
{"SetObjectCharge", WorldFunctions::SetObjectCharge},\
{"SetObjectCount", WorldFunctions::SetObjectCount},\
{"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\
{"SetObjectScale", WorldFunctions::SetObjectScale},\
{"SetObjectDoorState", WorldFunctions::SetObjectDoorState},\
{"SetObjectLockLevel", WorldFunctions::SetObjectLockLevel},\
{"SetObjectPosition", WorldFunctions::SetObjectPosition},\
{"SetObjectRotation", WorldFunctions::SetObjectRotation},\
{"AddWorldObject", WorldFunctions::AddWorldObject},\
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
\
{"SendContainer", WorldFunctions::SendContainer},\
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
{"SetObjectCharge", WorldFunctions::SetObjectCharge},\
{"SetObjectCount", WorldFunctions::SetObjectCount},\
{"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\
{"SetObjectScale", WorldFunctions::SetObjectScale},\
{"SetObjectDoorState", WorldFunctions::SetObjectDoorState},\
{"SetObjectLockLevel", WorldFunctions::SetObjectLockLevel},\
{"SetObjectPosition", WorldFunctions::SetObjectPosition},\
{"SetObjectRotation", WorldFunctions::SetObjectRotation},\
\
{"SendObjectDelete", WorldFunctions::SendObjectDelete},\
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
{"SendObjectScale", WorldFunctions::SendObjectScale},\
{"SendObjectLock", WorldFunctions::SendObjectLock},\
{"SendObjectUnlock", WorldFunctions::SendObjectUnlock},\
{"SendDoorState", WorldFunctions::SendDoorState},\
{"SendContainer", WorldFunctions::SendContainer},\
\
{"SetHour", WorldFunctions::SetHour},\
{"SetMonth", WorldFunctions::SetMonth},\
{"SetDay", WorldFunctions::SetDay}
{"SendObjectDelete", WorldFunctions::SendObjectDelete},\
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
{"SendObjectScale", WorldFunctions::SendObjectScale},\
{"SendObjectLock", WorldFunctions::SendObjectLock},\
{"SendObjectUnlock", WorldFunctions::SendObjectUnlock},\
{"SendDoorState", WorldFunctions::SendDoorState},\
\
{"SetHour", WorldFunctions::SetHour},\
{"SetMonth", WorldFunctions::SetMonth},\
{"SetDay", WorldFunctions::SetDay}
class WorldFunctions
{
@ -61,8 +68,8 @@ public:
static const char *GetObjectRefId(unsigned int i) noexcept;
static int GetObjectRefNumIndex(unsigned int i) noexcept;
static int GetObjectCharge(unsigned int i) noexcept;
static int GetObjectCount(unsigned int i) noexcept;
static int GetObjectCharge(unsigned int i) noexcept;
static int GetObjectGoldValue(unsigned int i) noexcept;
static double GetObjectScale(unsigned int i) noexcept;
static int GetObjectDoorState(unsigned int i) noexcept;
@ -74,6 +81,13 @@ public:
static double GetObjectRotY(unsigned int i) noexcept;
static double GetObjectRotZ(unsigned int i) noexcept;
static unsigned int GetContainerChangesSize(unsigned int objectIndex) noexcept;
static const char *GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static int GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static int GetContainerItemGoldValue(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static const char *GetContainerItemOwner(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static void AddWorldObject() noexcept;
static void SetBaseEventCell(const char* cellDescription) noexcept;
static void SetBaseEventAction(int action) noexcept;