Browse Source

add PtGetNPCCount function to python API

Christopher Schmidt 12 years ago
parent
commit
20de71cef8
  1. 5
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  2. 1
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  3. 6
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp

5
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -978,6 +978,11 @@ PyObject* cyMisc::GetNPC(int npcID)
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
PyObject* cyMisc::GetNPCCount()
{
return PyInt_FromLong(plNetClientMgr::GetInstance()->NPCKeys().size());
}
#if 1 #if 1
#include "plStatusLog/plStatusLog.h" #include "plStatusLog/plStatusLog.h"
// //

1
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -447,6 +447,7 @@ public:
// PURPOSE : Returns a pySceneobject of a NPC // PURPOSE : Returns a pySceneobject of a NPC
// //
static PyObject* GetNPC(int npcID); static PyObject* GetNPC(int npcID);
static PyObject* GetNPCCount();
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

6
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp

@ -200,6 +200,11 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetNPCByID, args, "This will return the NPC wi
return cyMisc::GetNPC(npcID); return cyMisc::GetNPC(npcID);
} }
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNPCCount, "Returns the number of NPCs in the current age")
{
return cyMisc::GetNPCCount();
}
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNumRemotePlayers, "Returns the number of remote players in this Age with you.") PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNumRemotePlayers, "Returns the number of remote players in this Age with you.")
{ {
return PyInt_FromLong(cyMisc::GetNumRemotePlayers()); return PyInt_FromLong(cyMisc::GetNumRemotePlayers());
@ -520,6 +525,7 @@ void cyMisc::AddPlasmaMethods(std::vector<PyMethodDef> &methods)
PYTHON_GLOBAL_METHOD(methods, PtGetAvatarKeyFromClientID); PYTHON_GLOBAL_METHOD(methods, PtGetAvatarKeyFromClientID);
PYTHON_GLOBAL_METHOD(methods, PtGetClientIDFromAvatarKey); PYTHON_GLOBAL_METHOD(methods, PtGetClientIDFromAvatarKey);
PYTHON_GLOBAL_METHOD(methods, PtGetNPCByID); PYTHON_GLOBAL_METHOD(methods, PtGetNPCByID);
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetNPCCount);
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetNumRemotePlayers); PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetNumRemotePlayers);
PYTHON_GLOBAL_METHOD(methods, PtValidateKey); PYTHON_GLOBAL_METHOD(methods, PtValidateKey);

Loading…
Cancel
Save