[Server] Add script functions for getting actor dynamic stats

pull/176/merge
David Cernat 8 years ago
parent 3d6b21942c
commit 03c56e01f9

@ -6,6 +6,8 @@
#include <apps/openmw-mp/Utils.hpp>
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <components/esm/creaturestats.hpp>
#include "Actors.hpp"
using namespace mwmp;
@ -88,6 +90,36 @@ double ActorFunctions::GetActorRotZ(unsigned int i) noexcept
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).position.rot[2];
}
double ActorFunctions::GetActorHealthBase(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[0].mBase;
}
double ActorFunctions::GetActorHealthCurrent(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[0].mCurrent;
}
double ActorFunctions::GetActorMagickaBase(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[1].mBase;
}
double ActorFunctions::GetActorMagickaCurrent(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[1].mCurrent;
}
double ActorFunctions::GetActorFatigueBase(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[2].mBase;
}
double ActorFunctions::GetActorFatigueCurrent(unsigned int i) noexcept
{
return mwmp::Networking::getPtr()->getLastActorList()->baseActors.at(i).creatureStats->mDynamic[2].mCurrent;
}
void ActorFunctions::SetScriptActorListCell(const char* cellDescription) noexcept
{
scriptActorList.cell = Utils::getCellFromDescription(cellDescription);

@ -11,6 +11,7 @@
{"GetActorRefId", ActorFunctions::GetActorRefId},\
{"GetActorRefNumIndex", ActorFunctions::GetActorRefNumIndex},\
{"GetActorMpNum", ActorFunctions::GetActorMpNum},\
\
{"GetActorPosX", ActorFunctions::GetActorPosX},\
{"GetActorPosY", ActorFunctions::GetActorPosY},\
{"GetActorPosZ", ActorFunctions::GetActorPosZ},\
@ -18,6 +19,13 @@
{"GetActorRotY", ActorFunctions::GetActorRotY},\
{"GetActorRotZ", ActorFunctions::GetActorRotZ},\
\
{"GetActorHealthBase", ActorFunctions::GetActorHealthBase},\
{"GetActorHealthCurrent", ActorFunctions::GetActorHealthCurrent},\
{"GetActorMagickaBase", ActorFunctions::GetActorMagickaBase},\
{"GetActorMagickaCurrent", ActorFunctions::GetActorMagickaCurrent},\
{"GetActorFatigueBase", ActorFunctions::GetActorFatigueBase},\
{"GetActorFatigueCurrent", ActorFunctions::GetActorFatigueCurrent},\
\
{"SetScriptActorListCell", ActorFunctions::SetScriptActorListCell},\
{"SetScriptActorListAction", ActorFunctions::SetScriptActorListAction},\
\
@ -47,6 +55,7 @@ public:
static const char *GetActorRefId(unsigned int i) noexcept;
static int GetActorRefNumIndex(unsigned int i) noexcept;
static int GetActorMpNum(unsigned int i) noexcept;
static double GetActorPosX(unsigned int i) noexcept;
static double GetActorPosY(unsigned int i) noexcept;
static double GetActorPosZ(unsigned int i) noexcept;
@ -54,6 +63,13 @@ public:
static double GetActorRotY(unsigned int i) noexcept;
static double GetActorRotZ(unsigned int i) noexcept;
static double GetActorHealthBase(unsigned int i) noexcept;
static double GetActorHealthCurrent(unsigned int i) noexcept;
static double GetActorMagickaBase(unsigned int i) noexcept;
static double GetActorMagickaCurrent(unsigned int i) noexcept;
static double GetActorFatigueBase(unsigned int i) noexcept;
static double GetActorFatigueCurrent(unsigned int i) noexcept;
static void SetScriptActorListCell(const char* cellDescription) noexcept;
static void SetScriptActorListAction(unsigned char action) noexcept;

Loading…
Cancel
Save