forked from teamnwah/openmw-tes3coop
[Server] Add script functions for getting container item info
This commit is contained in:
parent
70470e12b4
commit
aa1549606f
2 changed files with 95 additions and 46 deletions
|
@ -48,16 +48,16 @@ int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex;
|
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
|
int WorldFunctions::GetObjectCount(unsigned int i) noexcept
|
||||||
{
|
{
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count;
|
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
|
int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept
|
||||||
{
|
{
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).goldValue;
|
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];
|
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
|
void WorldFunctions::AddWorldObject() noexcept
|
||||||
{
|
{
|
||||||
WorldObject worldObject;
|
WorldObject worldObject;
|
||||||
|
|
|
@ -2,53 +2,60 @@
|
||||||
#define OPENMW_WORLD_HPP
|
#define OPENMW_WORLD_HPP
|
||||||
|
|
||||||
#define WORLDFUNCTIONS \
|
#define WORLDFUNCTIONS \
|
||||||
{"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
|
{"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
|
||||||
\
|
\
|
||||||
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
|
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
|
||||||
{"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\
|
{"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\
|
||||||
\
|
\
|
||||||
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
||||||
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
||||||
{"GetObjectCharge", WorldFunctions::GetObjectCharge},\
|
{"GetObjectCount", WorldFunctions::GetObjectCount},\
|
||||||
{"GetObjectCount", WorldFunctions::GetObjectCount},\
|
{"GetObjectCharge", WorldFunctions::GetObjectCharge},\
|
||||||
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
|
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
|
||||||
{"GetObjectScale", WorldFunctions::GetObjectScale},\
|
{"GetObjectScale", WorldFunctions::GetObjectScale},\
|
||||||
{"GetObjectDoorState", WorldFunctions::GetObjectDoorState},\
|
{"GetObjectDoorState", WorldFunctions::GetObjectDoorState},\
|
||||||
{"GetObjectLockLevel", WorldFunctions::GetObjectLockLevel},\
|
{"GetObjectLockLevel", WorldFunctions::GetObjectLockLevel},\
|
||||||
{"GetObjectPosX", WorldFunctions::GetObjectPosX},\
|
{"GetObjectPosX", WorldFunctions::GetObjectPosX},\
|
||||||
{"GetObjectPosY", WorldFunctions::GetObjectPosY},\
|
{"GetObjectPosY", WorldFunctions::GetObjectPosY},\
|
||||||
{"GetObjectPosZ", WorldFunctions::GetObjectPosZ},\
|
{"GetObjectPosZ", WorldFunctions::GetObjectPosZ},\
|
||||||
{"GetObjectRotX", WorldFunctions::GetObjectRotX},\
|
{"GetObjectRotX", WorldFunctions::GetObjectRotX},\
|
||||||
{"GetObjectRotY", WorldFunctions::GetObjectRotY},\
|
{"GetObjectRotY", WorldFunctions::GetObjectRotY},\
|
||||||
{"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\
|
{"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\
|
||||||
\
|
\
|
||||||
{"AddWorldObject", WorldFunctions::AddWorldObject},\
|
{"GetContainerChangesSize", WorldFunctions::GetContainerChangesSize},\
|
||||||
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
|
{"GetContainerItemRefId", WorldFunctions::GetContainerItemRefId},\
|
||||||
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
|
{"GetContainerItemCount", WorldFunctions::GetContainerItemCount},\
|
||||||
|
{"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\
|
||||||
|
{"GetContainerItemGoldValue", WorldFunctions::GetContainerItemGoldValue},\
|
||||||
|
{"GetContainerItemOwner", WorldFunctions::GetContainerItemOwner},\
|
||||||
\
|
\
|
||||||
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
|
{"AddWorldObject", WorldFunctions::AddWorldObject},\
|
||||||
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
|
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
|
||||||
{"SetObjectCharge", WorldFunctions::SetObjectCharge},\
|
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
|
||||||
{"SetObjectCount", WorldFunctions::SetObjectCount},\
|
|
||||||
{"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\
|
|
||||||
{"SetObjectScale", WorldFunctions::SetObjectScale},\
|
|
||||||
{"SetObjectDoorState", WorldFunctions::SetObjectDoorState},\
|
|
||||||
{"SetObjectLockLevel", WorldFunctions::SetObjectLockLevel},\
|
|
||||||
{"SetObjectPosition", WorldFunctions::SetObjectPosition},\
|
|
||||||
{"SetObjectRotation", WorldFunctions::SetObjectRotation},\
|
|
||||||
\
|
\
|
||||||
{"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},\
|
{"SendContainer", WorldFunctions::SendContainer},\
|
||||||
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
|
|
||||||
{"SendObjectScale", WorldFunctions::SendObjectScale},\
|
|
||||||
{"SendObjectLock", WorldFunctions::SendObjectLock},\
|
|
||||||
{"SendObjectUnlock", WorldFunctions::SendObjectUnlock},\
|
|
||||||
{"SendDoorState", WorldFunctions::SendDoorState},\
|
|
||||||
\
|
\
|
||||||
{"SetHour", WorldFunctions::SetHour},\
|
{"SendObjectDelete", WorldFunctions::SendObjectDelete},\
|
||||||
{"SetMonth", WorldFunctions::SetMonth},\
|
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
|
||||||
{"SetDay", WorldFunctions::SetDay}
|
{"SendObjectScale", WorldFunctions::SendObjectScale},\
|
||||||
|
{"SendObjectLock", WorldFunctions::SendObjectLock},\
|
||||||
|
{"SendObjectUnlock", WorldFunctions::SendObjectUnlock},\
|
||||||
|
{"SendDoorState", WorldFunctions::SendDoorState},\
|
||||||
|
\
|
||||||
|
{"SetHour", WorldFunctions::SetHour},\
|
||||||
|
{"SetMonth", WorldFunctions::SetMonth},\
|
||||||
|
{"SetDay", WorldFunctions::SetDay}
|
||||||
|
|
||||||
class WorldFunctions
|
class WorldFunctions
|
||||||
{
|
{
|
||||||
|
@ -61,8 +68,8 @@ public:
|
||||||
|
|
||||||
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;
|
||||||
static int GetObjectCharge(unsigned int i) noexcept;
|
|
||||||
static int GetObjectCount(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 int GetObjectGoldValue(unsigned int i) noexcept;
|
||||||
static double GetObjectScale(unsigned int i) noexcept;
|
static double GetObjectScale(unsigned int i) noexcept;
|
||||||
static int GetObjectDoorState(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 GetObjectRotY(unsigned int i) noexcept;
|
||||||
static double GetObjectRotZ(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 AddWorldObject() noexcept;
|
||||||
static void SetBaseEventCell(const char* cellDescription) noexcept;
|
static void SetBaseEventCell(const char* cellDescription) noexcept;
|
||||||
static void SetBaseEventAction(int action) noexcept;
|
static void SetBaseEventAction(int action) noexcept;
|
||||||
|
|
Loading…
Reference in a new issue