Browse Source

Remove obsolete PythonLib

Adam Johnson 12 years ago
parent
commit
e9d94f5f66
  1. 1
      Sources/Plasma/PythonLib/Cypython/PC/placeholder.txt
  2. 1
      Sources/Plasma/PythonLib/Cypython/placeholder.txt
  3. 1
      Sources/Plasma/PythonLib/pyNetClientComm/PythonLib/placeholder.txt
  4. 332
      Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp
  5. 209
      Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h
  6. 336
      Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientCommGlue.cpp
  7. 41
      Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.cpp
  8. 41
      Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.h
  9. 49
      Sources/Plasma/PythonLib/pyPlasma/creatables.cpp
  10. 155
      Sources/Plasma/PythonLib/pyPlasma/dllmain.cpp
  11. 163
      Sources/Plasma/PythonLib/pyPlasma/pyPlasmaTest.py
  12. 55
      Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp
  13. 216
      Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp
  14. 63
      Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h
  15. 503
      Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp
  16. 247
      Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h
  17. 477
      Sources/Plasma/PythonLib/pyVault/pyVNodeMgrGlue.cpp

1
Sources/Plasma/PythonLib/Cypython/PC/placeholder.txt

@ -1 +0,0 @@
What do you see? An empty folder.

1
Sources/Plasma/PythonLib/Cypython/placeholder.txt

@ -1 +0,0 @@
What do you see? An empty folder.

1
Sources/Plasma/PythonLib/pyNetClientComm/PythonLib/placeholder.txt

@ -1 +0,0 @@
What do you see? An empty folder.

332
Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp

@ -1,332 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyNetClientComm.h"
#include "../pfPython/pyAgeLinkStruct.h"
#include "../pfPython/pyNetServerSessionInfo.h"
#include "../pfPython/pyStatusLog.h"
#include "../plNetCommon/plCreatePlayerFlags.h"
#include "../pnNetCommon/plGenericVar.h"
#include "hsStlUtils.h"
#include "hsTimer.h"
#include <python.h>
////////////////////////////////////////////////////////////////////
class pyNetClientCommCallback : public plNetClientComm::Callback
{
public:
PyObject * fPyObject;
pyNetClientCommCallback( PyObject * pyObject )
: fPyObject( pyObject )
{
Py_XINCREF( fPyObject );
}
~pyNetClientCommCallback()
{
Py_XDECREF( fPyObject );
}
void OperationStarted( uint32_t context )
{
if ( fPyObject )
{
// Call the callback.
PyObject* func = PyObject_GetAttrString( fPyObject, "operationStarted" );
if ( func )
{
if ( PyCallable_Check(func)>0 )
{
PyObject* retVal = PyObject_CallMethod(fPyObject, "operationStarted", "l", context);
Py_XDECREF(retVal);
}
}
}
}
void OperationComplete( uint32_t context, int resultCode )
{
if ( fPyObject )
{
// Pass args.
PyObject* pyArgs = PyObject_GetAttrString( fPyObject, "fCbArgs" );
if ( pyArgs )
{
PyObject* pyDict = PyDict_New();
std::map<uint16_t,plCreatable*> args;
fCbArgs.GetItems( args );
for ( std::map<uint16_t,plCreatable*>::iterator ii=args.begin(); ii!=args.end(); ++ii )
{
uint16_t key = ii->first;
PyObject* keyObj = PyInt_FromLong(key);
char* strTemp = NULL;
plCreatable* arg = ii->second;
plCreatableGenericValue * genValue = plCreatableGenericValue::ConvertNoRef( arg );
if ( genValue )
{
PyObject* valueObj;
plGenericType & value = genValue->Value();
switch ( value.GetType() )
{
case plGenericType::kInt:
valueObj = PyLong_FromLong((int32_t)value);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kUInt:
valueObj = PyLong_FromUnsignedLong((uint32_t)value);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kFloat:
valueObj = PyFloat_FromDouble((float)value);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kDouble:
valueObj = PyFloat_FromDouble((double)value);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kBool:
if ((bool)value)
valueObj = PyInt_FromLong(1);
else
valueObj = PyInt_FromLong(0);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kChar:
strTemp = new char[2];
strTemp[0] = (char)value;
strTemp[1] = 0;
valueObj = PyString_FromString(strTemp);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
delete [] strTemp;
break;
case plGenericType::kString:
valueObj = PyString_FromString((const char*)value);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
break;
case plGenericType::kAny:
break;
case plGenericType::kNone:
break;
}
}
plNetServerSessionInfo * serverInfo = plNetServerSessionInfo::ConvertNoRef( arg );
if ( serverInfo )
{
PyObject* valueObj = pyNetServerSessionInfo::New(*serverInfo);
PyDict_SetItem(pyDict, keyObj, valueObj);
Py_DECREF(valueObj);
}
Py_DECREF(keyObj);
}
PyObject_SetAttrString( fPyObject, "fCbArgs", pyDict );
Py_DECREF(pyDict);
}
// Call the callback.
PyObject* func = PyObject_GetAttrString( fPyObject, "operationComplete" );
if ( func )
{
if ( PyCallable_Check(func)>0 )
{
PyObject* retVal = PyObject_CallMethod(fPyObject, "operationComplete", "li", context, resultCode);
Py_XDECREF(retVal);
}
}
}
delete this;
}
};
////////////////////////////////////////////////////////////////////
// Error handler - throws exception in python script
class pyNetClientCommErrorHandler : public plNetClientComm::ErrorHandler
{
public:
void HandleError( Error err, int result )
{
std::string msg;
xtl::format( msg, "pyNetClientComm: Error: %s", plNetClientComm::ErrorHandler::ErrorStr( err ) );
PyErr_SetString(PyExc_KeyError, msg.c_str());
}
} ThePyNetClientCommErrorHandler;
////////////////////////////////////////////////////////////////////
// pyNetClientComm ----------------------------------------------
pyNetClientComm::pyNetClientComm()
{
fNetClient.SetErrorHandler( &ThePyNetClientCommErrorHandler );
}
// ~pyNetClientComm ----------------------------------------------
pyNetClientComm::~pyNetClientComm()
{
}
// NetAuthenticate ----------------------------------------------
int pyNetClientComm::NetAuthenticate( double maxAuthSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetAuthenticate( maxAuthSecs, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetLeave ----------------------------------------------
int pyNetClientComm::NetLeave( uint8_t reason, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetLeave( reason, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetPing ----------------------------------------------
int pyNetClientComm::NetPing( int serverType, int timeoutSecs/*=0*/, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetPing( serverType, timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetFindAge ----------------------------------------------
int pyNetClientComm::NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetFindAge( linkInfo->GetAgeLink(), new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetGetPlayerList ----------------------------------------------
int pyNetClientComm::NetGetPlayerList( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetGetPlayerList( new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetSetActivePlayer ----------------------------------------------
int pyNetClientComm::NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetSetActivePlayer( playerID, playerName, 0 /*ccrLevel*/, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetCreatePlayer ----------------------------------------------
int pyNetClientComm::NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetCreatePlayer( playerName, avatarShape, createFlags, nil, nil, nil, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetJoinAge ----------------------------------------------
int pyNetClientComm::NetJoinAge( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetJoinAge( true /*tryP2P*/, true /*allowTimeout*/, new pyNetClientCommCallback( cbClass ), cbContext );
}
// NetSetTimeout ----------------------------------------------
int pyNetClientComm::NetSetTimeout( float timeoutSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */)
{
return fNetClient.NetSetTimeout( timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext );
}
// SetLogLevel ----------------------------------------------
void pyNetClientComm::SetLogLevel( int logLevel )
{
fNetClient.SetLogLevel( logLevel );
}
// Startup ----------------------------------------------
int pyNetClientComm::Init( bool threaded/*=true */, int logLevel/*=0 */)
{
return fNetClient.Init( threaded, logLevel );
}
// Shutdown ----------------------------------------------
int pyNetClientComm::Fini( float flushMsgsSecs/*=0.f */)
{
return fNetClient.Fini( flushMsgsSecs );
}
// Update ----------------------------------------------
int pyNetClientComm::Update()
{
return fNetClient.Update( hsTimer::GetSeconds() );
}
// SetActiveServer ----------------------------------------------
int pyNetClientComm::SetActiveServer( pyNetServerSessionInfo* nfo )
{
return fNetClient.SetActiveServer( &nfo->ServerInfo() );
}
// SetActiveServer2 ----------------------------------------------
int pyNetClientComm::SetActiveServer2( const char * addr, int port )
{
plNetServerSessionInfo nfo;
nfo.SetServerAddr( addr );
nfo.SetServerPort( port );
return fNetClient.SetActiveServer( &nfo );
}
// SetAuthInfo ----------------------------------------------
int pyNetClientComm::SetAuthInfo( const char* acctName, const char* password )
{
return fNetClient.SetAuthInfo( acctName, password );
}
// SetLogByName ----------------------------------------------
void pyNetClientComm::SetLogByName( const char * name, uint32_t flags )
{
plStatusLog * log = plStatusLogMgr::GetInstance().CreateStatusLog( 80, name,
flags | plStatusLog::kTimestamp | plStatusLog::kDeleteForMe );
fNetClient.SetLog( log );
}
// GetLog ----------------------------------------------
PyObject* pyNetClientComm::GetLog() const
{
return pyStatusLog::New( fNetClient.GetLog() );
}
// SetServerSilenceTime ----------------------------------------------
void pyNetClientComm::SetServerSilenceTime( float secs )
{
fNetClient.SetServerSilenceTime( secs );
}
////////////////////////////////////////////////////////////////////
// End.

209
Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h

@ -1,209 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
////////////////////////////////////////////////////////////////////
// pyNetClientComm - python wrapper for plNetClientComm class.
#ifndef pyNetClientComm_h_inc
#define pyNetClientComm_h_inc
#include "../plNetClientComm/plNetClientComm.h"
#include "../plStatusLog/plStatusLog.h"
#include "../FeatureLib/pfPython/pyGlueHelpers.h"
#include <python.h>
////////////////////////////////////////////////////////////////////
class pyAgeLinkStruct;
class pyNetServerSessionInfo;
class pyStatusLog;
class pyNetCore;
////////////////////////////////////////////////////////////////
// plNetClientComm Callback Wrappers
// Message handler for unsolicited msgs or registered
// for specific msg types.
class pyNetClientCommMsgHandler : public plNetClientComm::MsgHandler
{
public:
PyObject* fPyObject;
pyNetClientCommMsgHandler( PyObject* pyObject ): fPyObject( pyObject ) {}
int HandleMessage( plNetMessage* msg );
};
// Receipt handler for changed msg receipts.
class pyNetClientCommRcptHandler : public plNetClientComm::RcptHandler
{
public:
PyObject* fPyObject;
pyNetClientCommRcptHandler( PyObject* pyObject ): fPyObject( pyObject ) {}
void HandleMsgReceipt( plNetCoreMsgReceipt* rcpt );
};
////////////////////////////////////////////////////////////////////
class pyNetClientComm
{
// We contain the plNetClientComm we are wrapping.
plNetClientComm fNetClient;
protected:
////////////////////////////////////////////////////////////////
pyNetClientComm();
public:
~pyNetClientComm();
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptNetClientComm);
PYTHON_CLASS_NEW_DEFINITION;
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyNetClientComm object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyNetClientComm); // converts a PyObject to a pyNetClientComm (throws error if not correct type)
static void AddPlasmaClasses(PyObject *m);
plNetClientComm * GetNetClientComm() { return &fNetClient; }
////////////////////////////////////////////////////////////////
// NETWORK OPERATIONS
// Auth with active server using auth info set earlier.
// Will timeout after maxAuthSecs elapsed.
int NetAuthenticate( double maxAuthSecs, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Leave the active server.
int NetLeave( uint8_t reason, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Ping the specified server.
int NetPing( int serverType, int timeoutSecs=0, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Spawn a game for us.
int NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Get player list.
int NetGetPlayerList( PyObject* cbClass=nil, uint32_t cbContext=0 );
// Set the active player.
int NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Create a player
int NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass=nil, uint32_t cbContext=0 );
// Join age
int NetJoinAge( PyObject* cbClass=nil, uint32_t cbContext=0 );
// Set server-side timeout
int NetSetTimeout( float timeoutSecs, PyObject* cbClass=nil, uint32_t cbContext=0 );
////////////////////////////////////////////////////////////////
// Calls ErrorHandler, if set. Returns value of result
// that was passed in (for use in return/compound statements).
int ReportError( int err, int result );
////////////////////////////////////////////////////////////////
// Get/Set Log object
void SetLog( pyStatusLog* log );
void SetLogByName( const char * name, uint32_t flags=0 );
PyObject* GetLog() const; // return pyStatusLog
// NetCore log level
void SetLogLevel( int logLevel );
// Startup/Shutdown this object
int Init( bool threaded=true, int logLevel=0 );
// flushMsgsSecs: time to spend flushing net msgs queued in net core.
// <0 means no time limit. spin until all msgs are flushed.
int Fini( float flushMsgsSecs=0.f );
// Call this in your update loop.
int Update();
// Access to the NetCore object.
pyNetCore* GetNetCore() const;
// Get/Set Authentication info
int SetAuthInfo( const char* acctName, const char* password );
const char* GetAcctName() const;
const char* GetPassword() const;
// Sets the server we want to communicate with.
int SetActiveServer( pyNetServerSessionInfo* nfo );
int SetActiveServer2( const char * addr, int port );
const pyNetServerSessionInfo* GetActiveServer() const;
// Sets/clears receipt tracking for given message class.
void SetReceiptTrackingForType( uint16_t msgClassIdx, bool on );
// Adds a msg handler for a msg that is convertable to specified type.
void AddMsgHandlerForType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler );
// Adds a msg handler for a specific msg type.
void AddMsgHandlerForExactType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler );
void RemoveMsgHandler( pyNetClientCommMsgHandler* handler );
// Msgs not part of a task controlled by this
// object, and doesn't have a handler set for its type
// are sent to this handler (if set).
void SetDefaultHandler( pyNetClientCommMsgHandler* msgHandler );
// Changed message rcpts are sent to this handler if set.
void SetMsgReceiptHandler( pyNetClientCommRcptHandler* rcptHandler );
// Send a message to the server.
int SendMsg( plNetMessage* msg, uint32_t sendFlags=0 );
// Send a message to specified peer
int SendMsg( plNetMessage* msg, plNetCore::PeerID peerID, uint32_t sendFlags=0 );
// Set the alive message send frequency. 0 means don't send periodic alive msgs.
void SetAliveFreq( float secs );
float GetAliveFreq() const;
// Set the amount of time before we declare server-silence.
void SetServerSilenceTime( float secs );
float GetServerSilenceTime() const;
// Set the maximum amount of time to spend processing
// incoming msgs per call to Update().
void SetMaxMsgProcessingTime( float secs );
};
////////////////////////////////////////////////////////////////////
#endif // pyNetClientComm_h_inc

336
Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientCommGlue.cpp

@ -1,336 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyNetClientComm.h"
#include "../FeatureLib/pfPython/pyEnum.h"
#include "../FeatureLib/pfPython/pyNetServerSessionInfo.h"
#include "../FeatureLib/pfPython/pyAgeLinkStruct.h"
#include "../plNetCommon/plCreatePlayerFlags.h"
#include <python.h>
// glue functions
PYTHON_CLASS_DEFINITION(ptNetClientComm, pyNetClientComm);
PYTHON_DEFAULT_NEW_DEFINITION(ptNetClientComm, pyNetClientComm)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptNetClientComm)
PYTHON_INIT_DEFINITION(ptNetClientComm, args, keywords)
{
PYTHON_RETURN_INIT_OK;
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, initObj, args)
{
char threaded = 1;
int logLevel = 0;
if (!PyArg_ParseTuple(args, "bi", &threaded, &logLevel))
{
PyErr_SetString(PyExc_TypeError, "initObj expects a boolean and an int");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->Init(threaded != 0, logLevel));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, fini, args)
{
float flushMsgsSecs = 0;
if (!PyArg_ParseTuple(args, "f", &flushMsgsSecs))
{
PyErr_SetString(PyExc_TypeError, "fini expects a float");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->Fini(flushMsgsSecs));
}
PYTHON_METHOD_DEFINITION_NOARGS(ptNetClientComm, update)
{
return PyInt_FromLong(self->fThis->Update());
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setActiveServer, args)
{
PyObject* arg1;
int port = 0;
if (!PyArg_ParseTuple(args, "O|i", &arg1, &port))
{
PyErr_SetString(PyExc_TypeError, "setActiveServer expects a string and an int, or a ptNetServerSessionInfo");
PYTHON_RETURN_ERROR;
}
if (pyNetServerSessionInfo::Check(arg1))
{
pyNetServerSessionInfo* info = pyNetServerSessionInfo::ConvertFrom(arg1);
return PyInt_FromLong(self->fThis->SetActiveServer(info));
}
else if (PyString_Check(arg1))
{
char* addr = PyString_AsString(arg1);
return PyInt_FromLong(self->fThis->SetActiveServer2(addr, port));
}
PyErr_SetString(PyExc_TypeError, "setActiveServer expects a string and an int, or a ptNetServerSessionInfo");
PYTHON_RETURN_ERROR;
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setAuthInfo, args)
{
char* account;
char* password;
if (!PyArg_ParseTuple(args, "ss", &account, &password))
{
PyErr_SetString(PyExc_TypeError, "setAuthInfo expects two strings");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->SetAuthInfo(account, password));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, authenticate, args)
{
double maxAuthSecs;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "d|Ol", &maxAuthSecs, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "authenticate expects a double, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetAuthenticate(maxAuthSecs, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, getPlayerList, args)
{
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "|Ol", &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "getPlayerList expects an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetGetPlayerList(cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setActivePlayer, args)
{
unsigned long playerID;
char* playerName;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "ls|Ol", &playerID, &playerName, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "setActivePlayer expects a double, a string, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetSetActivePlayer(playerID, playerName, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, createPlayer, args)
{
char* playerName;
char* avatarShape;
unsigned long createFlags;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "ssl|Ol", &playerName, &avatarShape, &createFlags, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "createPlayer expects two strings, a double, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetCreatePlayer(playerName, avatarShape, createFlags, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, findAge, args)
{
PyObject* linkObj = NULL;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "O|Ol", &linkObj, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "findAge expects a ptAgeLinkStruct, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
if (!pyAgeLinkStruct::Check(linkObj))
{
PyErr_SetString(PyExc_TypeError, "findAge expects a ptAgeLinkStruct, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
pyAgeLinkStruct* link = pyAgeLinkStruct::ConvertFrom(linkObj);
return PyInt_FromLong(self->fThis->NetFindAge(link, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, joinAge, args)
{
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "|Ol", &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "joinAge expects an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetJoinAge(cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, leave, args)
{
unsigned char reason;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "b|Ol", &reason, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "leave expects an unsigned 8-bit int, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetLeave(reason, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, ping, args)
{
int serverType;
int timeoutSecs = 0;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "i|iOl", &serverType, &timeoutSecs, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "ping expects an int, and optional int, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetPing(serverType, timeoutSecs, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setTimeout, args)
{
float timeoutSecs;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "f|Ol", &timeoutSecs, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "setTimeout expects a float, an optional object and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->NetSetTimeout(timeoutSecs, cb, context));
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setLog, args)
{
char* name;
unsigned long flags = 0;
if (!PyArg_ParseTuple(args, "s|l", &name, &flags))
{
PyErr_SetString(PyExc_TypeError, "setLog expects a string and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
self->fThis->SetLogByName(name, flags);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION_NOARGS(ptNetClientComm, getLog)
{
return self->fThis->GetLog();
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setLogLevel, args)
{
int level;
if (!PyArg_ParseTuple(args, "i", &level))
{
PyErr_SetString(PyExc_TypeError, "setLogLevel expects an integer");
PYTHON_RETURN_ERROR;
}
self->fThis->SetLogLevel(level);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptNetClientComm, setServerSilenceTime, args)
{
float secs;
if (!PyArg_ParseTuple(args, "f", &secs))
{
PyErr_SetString(PyExc_TypeError, "setServerSilenceTime expects a float");
PYTHON_RETURN_ERROR;
}
self->fThis->SetServerSilenceTime(secs);
PYTHON_RETURN_NONE;
}
PYTHON_START_METHODS_TABLE(ptNetClientComm)
PYTHON_METHOD(ptNetClientComm, initObj, "Params: threaded=1,logLevel=0\nInitialize this object"),
PYTHON_METHOD(ptNetClientComm, fini, "Params: flushMsgsSecs=0\nFinalize this object"),
PYTHON_METHOD_NOARGS(ptNetClientComm, update, "Update this object"),
PYTHON_METHOD(ptNetClientComm, setActiveServer, "Params: addr,port\nAlso accepts a ptNetServerSessionInfo instead of address and port"),
PYTHON_METHOD(ptNetClientComm, setAuthInfo, "Params: accountName,password\nSets the authentication info"),
PYTHON_METHOD(ptNetClientComm, authenticate, "Params: maxAuthSecs,callback=None,cbContext=0\nAuthenticate with the server"),
PYTHON_METHOD(ptNetClientComm, getPlayerList, "Params: callback=None,cbContext=0\nGets a list of players and uses the callback"),
PYTHON_METHOD(ptNetClientComm, setActivePlayer, "Params: playerID,playerName,callback=None,cbContext=0\nSets the current active player"),
PYTHON_METHOD(ptNetClientComm, createPlayer, "Params: playerName,avatarShape,createFlags,callback=None,cbContext=0\nCreates a new player"),
PYTHON_METHOD(ptNetClientComm, findAge, "Params: ageLink,callback=None,cbContext=0\nFinds an age based on a ptAgeLinkStruct"),
PYTHON_METHOD(ptNetClientComm, joinAge, "Params: callback=None,cbContext=0\nUNKNOWN"),
PYTHON_METHOD(ptNetClientComm, leave, "Params: reason,callback=None,cbContext=0\nLeaves the lobby"),
PYTHON_METHOD(ptNetClientComm, ping, "Params: serverType,timeoutSecs=0,callback=None,cbContext=0\nPings a server"),
PYTHON_METHOD(ptNetClientComm, setTimeout, "Params: timeoutSecs,callback=None,cbContext=0\nSets the timeout duration"),
PYTHON_METHOD(ptNetClientComm, setLog, "Params: name,flags=0\nUNKNOWN"),
PYTHON_METHOD_NOARGS(ptNetClientComm, getLog, "UNKNOWN"),
PYTHON_METHOD(ptNetClientComm, setLogLevel, "Params: level\nSets the logging level"),
PYTHON_METHOD(ptNetClientComm, setServerSilenceTime, "Params: secs\nUNKNOWN"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE(ptNetClientComm, "UNKNOWN");
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_IMPL(ptNetClientComm, pyNetClientComm)
PYTHON_CLASS_CHECK_IMPL(ptNetClientComm, pyNetClientComm)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptNetClientComm, pyNetClientComm)
///////////////////////////////////////////////////////////////////////////
//
// AddPlasmaClasses - the python module definitions
//
void pyNetClientComm::AddPlasmaClasses(PyObject *m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptNetClientComm);
PYTHON_CLASS_IMPORT_END(m);
PYTHON_ENUM_START(PtCreatePlayerFlags);
PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kDefaultFlags, plCreatePlayerFlags::kDefaultFlags);
PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kNoNeighborhood, plCreatePlayerFlags::kNoNeighborhood);
PYTHON_ENUM_ELEMENT(PtCreatePlayerFlags, kNoCityLink, plCreatePlayerFlags::kNoCityLink);
PYTHON_ENUM_END(m, PtCreatePlayerFlags);
}

41
Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.cpp

@ -1,41 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/

41
Sources/Plasma/PythonLib/pyNetClientGame/pyNetClientGame.h

@ -1,41 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/

49
Sources/Plasma/PythonLib/pyPlasma/creatables.cpp

@ -1,49 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plNetClientComm/plNetClientCommCreatable.h"
#include "pnKeyedObject/pnKeyedObjectCreatable.h"
#include "pnNetCommon/pnNetCommonCreatable.h"
#include "pnMessage/pnMessageCreatable.h"
#include "plNetMessage/plNetMessageCreatable.h"
#include "plNetCommon/plNetCommonCreatable.h"
#include "plVault/plVaultCreatable.h"
#include "plSDL/plSDLCreatable.h"

155
Sources/Plasma/PythonLib/pyPlasma/dllmain.cpp

@ -1,155 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsConfig.h"
#include "../plSDL/plSDL.h"
#include "../plVault/plVaultCache.h"
#include "../pyNetClientComm/pyNetClientComm.h"
#include "../pyVault/pyVNodeMgr.h"
#include "../pfPython/pyNetServerSessionInfo.h"
#include "../pfPython/pyVault.h"
#include "../pfPython/pyVaultNodeRef.h"
#include "../pfPython/pyVaultAgeInfoListNode.h"
#include "../pfPython/pyVaultAgeInfoNode.h"
#include "../pfPython/pyVaultAgeLinkNode.h"
#include "../pfPython/pyVaultChronicleNode.h"
#include "../pfPython/pyVaultFolderNode.h"
#include "../pfPython/pyVaultImageNode.h"
#include "../pfPython/pyVaultMarkerNode.h"
#include "../pfPython/pyVaultPlayerInfoListNode.h"
#include "../pfPython/pyVaultPlayerInfoNode.h"
#include "../pfPython/pyVaultPlayerNode.h"
#include "../pfPython/pySDL.h"
#include "../pfPython/pyVaultSDLNode.h"
#include "../pfPython/pyVaultTextNoteNode.h"
#include "../pfPython/pySpawnPointInfo.h"
#include "../pfPython/pyAgeInfoStruct.h"
#include "../pfPython/pyAgeLinkStruct.h"
#include "../pfPython/pyDniCoordinates.h"
#include "../pfPython/pyImage.h"
#include "../pfPython/pyNetLinkingMgr.h"
#include "../pfPython/pyStatusLog.h"
#include "../pfPython/pyColor.h"
#include "../pfPython/pyEnum.h"
#include "../pfPython/pyGlueHelpers.h"
#include <python.h>
extern "C" __declspec(dllexport) void PyInit_pyPlasma(void)
{
// If a glue function (AddPlasmaClasses, AddPlasmaMethds, etc) is commented out, it is included
// in the source in this project... but the original version of this function did not call the
// function. So in order to keep the module identical, those specified classes/functions are not
// added, but can be un-commented in the future if needed
std::vector<PyMethodDef> methods; // this is temporary, for easy addition of new methods
//pyImage::AddPlasmaMethods(methods);
pySpawnPointInfo::AddPlasmaMethods(methods);
// now copy the data to our real method definition structure
PyMethodDef* plasmaMethods = new PyMethodDef[methods.size() + 1];
for (int curMethod = 0; curMethod < methods.size(); curMethod++)
plasmaMethods[curMethod] = methods[curMethod];
PyMethodDef terminator = {NULL};
plasmaMethods[methods.size()] = terminator; // add the terminator
// Init the module
PyObject *m = Py_InitModule("pyPlasma", plasmaMethods);
// Inits
plSDLMgr::GetInstance()->Init();
plVaultCache::GetInstance()->SetEnabled( true );
// Enum
pyEnum::AddPlasmaConstantsClasses(m);
// Classes
pyAgeInfoStruct::AddPlasmaClasses(m);
pyAgeInfoStructRef::AddPlasmaClasses(m);
pyAgeLinkStruct::AddPlasmaClasses(m);
pyAgeLinkStructRef::AddPlasmaClasses(m);
pyColor::AddPlasmaClasses(m);
//pyDniCoordinates::AddPlasmaClasses(m);
//pyPoint3::AddPlasmaClasses(m);
//pyVector3::AddPlasmaClasses(m);
//pyImage::AddPlasmaClasses(m);
//pyMatrix44::AddPlasmaClasses(m);
pyNetClientComm::AddPlasmaClasses(m);
pyNetServerSessionInfo::AddPlasmaClasses(m);
pyNetServerSessionInfoRef::AddPlasmaClasses(m);
pySDLStateDataRecord::AddPlasmaClasses(m);
pySimpleStateVariable::AddPlasmaClasses(m);
pySpawnPointInfo::AddPlasmaClasses(m);
pySpawnPointInfoRef::AddPlasmaClasses(m);
pyStatusLog::AddPlasmaClasses(m);
pyVNodeMgr::AddPlasmaClasses(m);
pyAdminVNodeMgr::AddPlasmaClasses(m);
pyAgeVNodeMgr::AddPlasmaClasses(m);
pyPlayerVNodeMgr::AddPlasmaClasses(m);
pyVaultNode::AddPlasmaClasses(m);
pyVaultNodeRef::AddPlasmaClasses(m);
pyVaultFolderNode::AddPlasmaClasses(m);
pyVaultAgeInfoListNode::AddPlasmaClasses(m);
pyVaultAgeInfoNode::AddPlasmaClasses(m);
pyVaultAgeLinkNode::AddPlasmaClasses(m);
pyVaultChronicleNode::AddPlasmaClasses(m);
pyVaultImageNode::AddPlasmaClasses(m);
//pyVaultMarkerListNode::AddPlasmaClasses(m);
pyVaultMarkerNode::AddPlasmaClasses(m);
pyVaultPlayerInfoListNode::AddPlasmaClasses(m);
pyVaultPlayerInfoNode::AddPlasmaClasses(m);
pyVaultPlayerNode::AddPlasmaClasses(m);
pyVaultSDLNode::AddPlasmaClasses(m);
//pyVaultSystemNode::AddPlasmaClasses(m);
pyVaultTextNoteNode::AddPlasmaClasses(m);
// Constants
pyNetLinkingMgr::AddPlasmaConstantsClasses(m);
pySDL::AddPlasmaConstantsClasses(m);
pyStatusLog::AddPlasmaConstantsClasses(m);
pyVault::AddPlasmaConstantsClasses(m);
delete [] plasmaMethods; // cleanup
}

163
Sources/Plasma/PythonLib/pyPlasma/pyPlasmaTest.py

@ -1,163 +0,0 @@
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==* """
from pyPlasma import *
from pyPlasmaHelpers import *
from traceback import print_exc
kLogToDebugger = 32
kPeristentNode = 1
kTransientNode = 0
kQuittingGame = 7
kLinkingOut = 8
kExitingLobby = 9
#-------------------------------------
print "BEGIN"
# create client-side networking
net = ptNetClientComm()
# init log. this must be done before creating the vault manager
net.setLog("pyPlasmaTest.log", kLogToDebugger )
# create vault manager
#vault = ptPlayerVNodeMgr(net)
vault = ptAdminVNodeMgr(net)
vault.setWantGlobalSDL(1)
vault.setWantAllPlayers(1)
# create the NetClientMgr.
nc = NetClientMgr(net)
# create the VaultConnectMgr
vc = VaultConnectMgr(vault)
# startup networking
print "Net: starting up..."
net.init()
print "Net: started"
# point to lobby server
net.setActiveServer('ea1-2k',5000)
# set acct username/password
net.setAuthInfo('reseng0221','tooann42')
# specify the name of player we want to use.
nc.setDesiredPlayer('Scooby5',1)
#------------------
success = 0
while 1:
try:
# login to the lobby server
if nc.login(NetClientMgr.kLobby)<0: break
# connect to vault
if vc.connect()<0: break
# get root node
rootNode = vault.getRootNode()
print rootNode
# create a template node for finding the global sdl folder node
tmpNode = vault.createNode(PtVaultNodeTypes.kFolderNode,kTransientNode).upcastToFolderNode()
tmpNode.setFolderType(PtVaultStandardNodes.kAllAgeGlobalSDLNodesFolder)
# find global SDL folder
globalSDLFolder = vault.findNode(tmpNode)
if globalSDLFolder:
globalSDLFolder = globalSDLFolder.upcastToFolderNode()
print globalSDLFolder
# startup an age or three (forces global sdl nodes to initialize)
ageLink = ptAgeLinkStruct()
# ageLink.getAgeInfo().setAgeFilename('Teledahn')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('city')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Personal')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Garden')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('BaronCityOffice')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Kadish')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Neighborhood')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Cleft')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# ageLink.getAgeInfo().setAgeFilename('Garrison')
# nc.startFindingAge(ageLink) # we don't need to wait around for the operation to complete
# spawn a game
ageLink.getAgeInfo().setAgeFilename('Teledahn')
ageLink.setLinkingRules(PtLinkingRules.kOriginalBook)
if nc.findAge(ageLink)<0: break
serverInfo = nc.fCbArgs[0]
# leave the lobby
nc.logout(kExitingLobby)
# log into the game server
net.setActiveServer(serverInfo)
if nc.login(NetClientMgr.kGame)<0: break
# join the age
if nc.joinAge()<0: break
# done trying things
success = 1
break
except:
print_exc()
break
# disconnect from vault
vc.disconnect()
# leave the server
nc.logout(kQuittingGame)
#------------------
# shutdown networking. only flush msgs if all went well (not required, but speeds up shutdown on error)
print "Net: shutting down..."
net.fini(success)
print "Net: shut down"
print "END"
raw_input("\npress return")

55
Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp

@ -1,55 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyPloticus.h"
#pragma warning(push)
// disable warnings that appear in boost
# pragma warning(disable:4800) // disable int to bool performance warning
# pragma warning(disable:4275) // disable non dll-interface warning
# pragma warning(disable:4251) // similar to above warning
# include <boost/python.hpp>
#pragma warning(pop)
BOOST_PYTHON_MODULE(pyPloticus)
{
pyPloticus::PythonModDef();
}

216
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp

@ -1,216 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyPloticus.h"
#include "../pfPython/pyGlueHelpers.h"
#include <python.h>
#include <vector>
////////////////////////////////////////////////////////////////////
extern "C" {
// Ploticus C API
int ploticus_init(char *, char *);
int ploticus_arg(char *, char *);
int ploticus_begin();
void ploticus_end();
void ploticus_execline(char *);
int ploticus_execscript(char *, int);
int ploticus_getvar(char *, char *);
void ploticus_setvar(char *, char *);
}
////////////////////////////////////////////////////////////////////
void pyPloticus::Init(char* device, char* outfilename)
{
ploticus_init( device, outfilename );
}
void pyPloticus::Arg(char* name, char* value)
{
ploticus_arg( name, value );
}
void pyPloticus::Begin()
{
ploticus_begin();
}
void pyPloticus::End()
{
ploticus_end();
}
void pyPloticus::ExecLine(char* line)
{
ploticus_execline( line );
}
void pyPloticus::ExecScript(char* scriptfile, int prefab)
{
ploticus_execscript( scriptfile, prefab );
}
void pyPloticus::GetVar(char* name, char* value)
{
ploticus_getvar( name, value );
}
void pyPloticus::SetVar(char* name, char* value)
{
ploticus_setvar( name, value );
}
PYTHON_GLOBAL_METHOD_DEFINITION(init, args, "Params: device,outfilename\nUNKNOWN")
{
char* device;
char* outfilename;
if (!PyArg_ParseTuple(args, "ss", &device, &outfilename))
{
PyErr_SetString(PyExc_TypeError, "init expects two strings");
PYTHON_RETURN_ERROR;
}
pyPloticus::Init(device, outfilename);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(arg, args, "Params: name,value\nUNKNOWN")
{
char* name;
char* value;
if (!PyArg_ParseTuple(args, "ss", &name, &value))
{
PyErr_SetString(PyExc_TypeError, "arg expects two strings");
PYTHON_RETURN_ERROR;
}
pyPloticus::Arg(name, value);
PYTHON_RETURN_NONE;
}
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(begin, pyPloticus::Begin, "UNKNOWN")
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(end, pyPloticus::End, "UNKNOWN")
PYTHON_GLOBAL_METHOD_DEFINITION(execLine, args, "Params: line\nUNKNOWN")
{
char* line;
if (!PyArg_ParseTuple(args, "s", &line))
{
PyErr_SetString(PyExc_TypeError, "execLine expects a string");
PYTHON_RETURN_ERROR;
}
pyPloticus::ExecLine(line);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(execScript, args, "Params: file,prefab\nUNKNOWN")
{
char* file;
int prefab;
if (!PyArg_ParseTuple(args, "si", &file, &prefab))
{
PyErr_SetString(PyExc_TypeError, "execScript expects a string and an int");
PYTHON_RETURN_ERROR;
}
pyPloticus::ExecScript(file, prefab);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(getVar, args, "Params: name,value\nUNKNOWN")
{
char* name;
char* value;
if (!PyArg_ParseTuple(args, "ss", &name, &value))
{
PyErr_SetString(PyExc_TypeError, "getVar expects two strings");
PYTHON_RETURN_ERROR;
}
pyPloticus::GetVar(name, value);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(setVar, args, "Params: name,value\nUNKNOWN")
{
char* name;
char* value;
if (!PyArg_ParseTuple(args, "ss", &name, &value))
{
PyErr_SetString(PyExc_TypeError, "setVar expects two strings");
PYTHON_RETURN_ERROR;
}
pyPloticus::SetVar(name, value);
PYTHON_RETURN_NONE;
}
void AddPlasmaMethods(std::vector<PyMethodDef> &methods)
{
PYTHON_GLOBAL_METHOD(methods, init);
PYTHON_GLOBAL_METHOD(methods, arg);
PYTHON_BASIC_GLOBAL_METHOD(methods, begin);
PYTHON_BASIC_GLOBAL_METHOD(methods, end);
PYTHON_GLOBAL_METHOD(methods, execLine);
PYTHON_GLOBAL_METHOD(methods, execScript);
PYTHON_GLOBAL_METHOD(methods, getVar);
PYTHON_GLOBAL_METHOD(methods, setVar);
}
////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) void PyInit_pyPloticus(void)
{
std::vector<PyMethodDef> methods; // this is temporary, for easy addition of new methods
AddPlasmaMethods(methods);
// now copy the data to our real method definition structure
PyMethodDef* plasmaMethods = new PyMethodDef[methods.size() + 1];
for (int curMethod = 0; curMethod < methods.size(); curMethod++)
plasmaMethods[curMethod] = methods[curMethod];
PyMethodDef terminator = {NULL};
plasmaMethods[methods.size()] = terminator; // add the terminator
// Init the module
PyObject *m = Py_InitModule("pyPloticus", plasmaMethods);
delete [] plasmaMethods; // clean up
}
////////////////////////////////////////////////////////////////////

63
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h

@ -1,63 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef pyPloticus_h_inc
#define pyPloticus_h_inc
#include "hsTypes.h"
#include "Python.h"
// Ploticus C API
class pyPloticus
{
public:
static void Init(char* device, char* outfilename);
static void Arg(char* name, char* value);
static void Begin();
static void End();
static void ExecLine(char* line);
static void ExecScript(char* scriptfile, int prefab);
static void GetVar(char* name, char* value);
static void SetVar(char* name, char* value);
};
#endif // pyPloticus_h_inc

503
Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp

@ -1,503 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyVNodeMgr.h"
#include "../plVault/plVaultCallback.h"
#include "../plVault/plVaultInitTasks.h"
#include "../pfPython/pyVaultNode.h"
#include "../pfPython/pyVaultFolderNode.h"
#include "../pyNetClientComm/pyNetClientComm.h"
#include "../plNetMessage/plNetMessage.h"
#include "../plStatusLog/plStatusLog.h"
////////////////////////////////////////////////////////////////////
class pyVaultOperationCallback : public plVaultOperationCallback
{
public:
PyObject * fPyObject;
pyVaultOperationCallback( PyObject * pyObject )
: fPyObject( pyObject )
{
Py_XINCREF( fPyObject );
}
~pyVaultOperationCallback()
{
Py_XDECREF( fPyObject );
}
void VaultOperationStarted( uint32_t context )
{
if ( fPyObject )
{
// Do callback
PyObject* func = PyObject_GetAttrString( fPyObject, "operationStarted" );
if ( func )
{
if ( PyCallable_Check(func)>0 )
{
PyObject* retVal = PyObject_CallMethod(fPyObject, "operationStarted", "l", context);
Py_XDECREF(retVal);
}
}
}
}
void VaultOperationComplete( uint32_t context, int resultCode )
{
if ( fPyObject )
{
// Pass args.
// PyObject* pyArgs = PyObject_GetAttrString( fPyObject, "fCbArgs" );
// if ( pyArgs )
// {
// dict pyDict = dict();
// std::map<uint16_t,plCreatable*> args;
// fCbArgs.GetItems( args );
// for ( std::map<uint16_t,plCreatable*>::iterator ii=args.begin(); ii!=args.end(); ++ii )
// {
// uint16_t key = ii->first;
// plCreatable* arg = ii->second;
// plCreatableGenericValue * genValue = plCreatableGenericValue::ConvertNoRef( arg );
// if ( genValue )
// {
// plGenericType & value = genValue->Value();
// switch ( value.GetType() )
// {
// case plGenericType::kInt:
// pyDict[key] = (int)value;
// break;
// case plGenericType::kUInt:
// pyDict[key] = (unsigned int)value;
// break;
// case plGenericType::kFloat:
// pyDict[key] = (float)value;
// break;
// case plGenericType::kDouble:
// pyDict[key] = (double)value;
// break;
// case plGenericType::kBool:
// pyDict[key] = (bool)value;
// break;
// case plGenericType::kChar:
// pyDict[key] = (char)value;
// break;
// case plGenericType::kString:
// pyDict[key] = (const char *)value;
// break;
// case plGenericType::kAny:
// break;
// case plGenericType::kNone:
// break;
// }
// }
// }
// PyObject_SetAttrString( fPyObject, "fCbArgs", pyDict.ptr() );
// }
// Do callback
PyObject* func = PyObject_GetAttrString( fPyObject, "operationComplete" );
if ( func )
{
if ( PyCallable_Check(func)>0 )
{
PyObject* retVal = PyObject_CallMethod(fPyObject, "operationComplete", "li", context, resultCode);
Py_XDECREF(retVal);
}
}
}
delete this;
}
};
class pyVaultCallback : public plVaultStubbedCallback
{
public:
PyObject * fPyObject;
pyVaultCallback( PyObject * pyObject )
: fPyObject( pyObject )
{
Py_XINCREF( fPyObject );
}
~pyVaultCallback()
{
Py_XDECREF( fPyObject );
}
};
////////////////////////////////////////////////////////////////////
int pyVNodeMgr::VaultMsgHandler::HandleMessage( plNetMessage* msg )
{
plNetMsgVault * vaultMsg = plNetMsgVault::ConvertNoRef( msg );
if ( vaultMsg )
{
plNetCoreMessage * ncmsg = (plNetCoreMessage*)msg->GetNetCoreMsg();
msg->PeekBuffer( ncmsg->GetData(), ncmsg->GetLen() );
fMyVNodeMgr->GetStatusLog()->AddLineF( "\t%s", msg->AsStdString().c_str() );
plVault::ProcessMsg( vaultMsg );
return plNetClientComm::kOK_MsgConsumed;
}
return hsFail;
}
// pyVNodeMgr ----------------------------------------------
pyVNodeMgr::pyVNodeMgr( PyObject* thaComm )
{
if (!pyNetClientComm::Check(thaComm))
{
fMyCommObj = NULL;
return; // screwed!
}
fMsgHandler.setMgr(this);
fMyCommObj = thaComm;
Py_INCREF(fMyCommObj);
fMyComm = pyNetClientComm::ConvertFrom(fMyCommObj);
fMyComm->GetNetClientComm()->AddMsgHandlerForType( plNetMsgVault::Index(), &fMsgHandler );
plVNodeMgr::SetStatusLog( fMyComm->GetNetClientComm()->GetLog(), false );
}
// ~pyVNodeMgr ----------------------------------------------
pyVNodeMgr::~pyVNodeMgr()
{
fMyComm->GetNetClientComm()->RemoveMsgHandler( &fMsgHandler );
Py_DECREF(fMyCommObj);
}
void pyVNodeMgr::setMyComm(PyObject* thaComm)
{
if (fMyComm)
{
fMyComm->GetNetClientComm()->RemoveMsgHandler(&fMsgHandler);
Py_DECREF(fMyCommObj);
fMyCommObj = NULL;
fMyComm = NULL;
}
if (!pyNetClientComm::Check(thaComm))
return; // screwed!
fMyCommObj = thaComm;
Py_INCREF(fMyCommObj);
fMyComm = pyNetClientComm::ConvertFrom(fMyCommObj);
fMyComm->GetNetClientComm()->AddMsgHandlerForType(plNetMsgVault::Index(), &fMsgHandler);
plVNodeMgr::SetStatusLog(fMyComm->GetNetClientComm()->GetLog(), false);
}
// IAmOnline ----------------------------------------------
bool pyVNodeMgr::IAmOnline() const
{
return true;
}
// IIsThisMe ----------------------------------------------
bool pyVNodeMgr::IIsThisMe( plVaultPlayerInfoNode* node ) const
{
return ( fMyComm->GetNetClientComm()->GetPlayerID()==node->GetPlayerID() );
}
// IIsThisMe ----------------------------------------------
bool pyVNodeMgr::IIsThisMe( plVaultPlayerNode * node ) const
{
return ( fMyComm->GetNetClientComm()->GetPlayerID()==node->GetID() );
}
// ISendNetMsg ----------------------------------------------
int pyVNodeMgr::ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags/*=0 */)
{
return fMyComm->GetNetClientComm()->SendMsg( msg, sendFlags );
}
// IGetPlayerID ----------------------------------------------
uint32_t pyVNodeMgr::IGetPlayerID() const
{
return fMyComm->GetNetClientComm()->GetPlayerID();
}
// Update ----------------------------------------------
int pyVNodeMgr::Update( double secs )
{
return plVNodeMgr::Update( secs );
}
// Startup ----------------------------------------------
void pyVNodeMgr::Startup()
{
plVNodeMgr::Startup();
}
// Shutdown ----------------------------------------------
void pyVNodeMgr::Shutdown()
{
plVNodeMgr::Shutdown();
}
// IsConnected ----------------------------------------------
bool pyVNodeMgr::IsConnected()
{
return plVNodeMgr::IsConnected();
}
// Disconnect ----------------------------------------------
void pyVNodeMgr::Disconnect( PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */)
{
// disconnect from allplayers and globalsdl folders
plVaultNodeRef * out;
plVaultNode * root = plVNodeMgr::GetRootNode();
if ( root )
{
plVaultFolderNode tmpGlobalSDL;
tmpGlobalSDL.SetFolderType( plVault::kAllAgeGlobalSDLNodesFolder );
if ( root->FindNode( &tmpGlobalSDL, out ) )
root->RemoveNode( out->GetChildID() );
plVaultFolderNode tmpAllPlayers;
tmpAllPlayers.SetFolderType( plVault::kAllPlayersFolder );
if ( root->FindNode( &tmpAllPlayers, out ) )
root->RemoveNode( out->GetChildID() );
}
plVNodeMgr::Disconnect( new pyVaultOperationCallback( cb ), cbContext );
}
// Connect ----------------------------------------------
void pyVNodeMgr::Connect( int childFetchLevel/*=plVault::kFetchAllChildren*/, PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */)
{
plVNodeMgr::Connect( childFetchLevel, new pyVaultOperationCallback( cb ), cbContext );
}
// FetchNode ----------------------------------------------
bool pyVNodeMgr::FetchNode( uint32_t nodeID,
int childFetchLevel/*=plVault::kFetchAllChildren*/,
PyObject* cb/*=nil*/,
uint32_t cbContext/*=0 */)
{
return plVNodeMgr::FetchNode( nodeID, childFetchLevel, new pyVaultOperationCallback( cb ), cbContext );
}
// GetRootNode ----------------------------------------------
PyObject* pyVNodeMgr::GetRootNode() const
{
return pyVaultNode::New( plVNodeMgr::GetRootNode() );
}
// GetClientID ----------------------------------------------
uint32_t pyVNodeMgr::GetClientID() const
{
return plVNodeMgr::GetClientID();
}
// GetNode ----------------------------------------------
PyObject* pyVNodeMgr::GetNode( uint32_t id ) const
{
plVaultNode * tmp;
if ( plVNodeMgr::GetNode( id, tmp ) )
return pyVaultNode::New( tmp );
PYTHON_RETURN_NONE;
}
// FindNode ----------------------------------------------
PyObject* pyVNodeMgr::FindNode( pyVaultNode* templateNode ) const
{
plVaultNode * node;
if ( plVNodeMgr::FindNode( templateNode->GetNode(), node ) )
return pyVaultNode::New( node );
PYTHON_RETURN_NONE;
}
// EnableCallbacks ----------------------------------------------
bool pyVNodeMgr::EnableCallbacks( bool b )
{
return plVNodeMgr::EnableCallbacks( b );
}
// AddCallback ----------------------------------------------
void pyVNodeMgr::AddCallback( PyObject* cb )
{
pyVaultCallback * pycb = new pyVaultCallback( cb );
fPyCallbacks.push_back( pycb );
plVNodeMgr::AddCallback( pycb );
}
// RemoveCallback ----------------------------------------------
void pyVNodeMgr::RemoveCallback( PyObject* cb )
{
PyCallbackVec tmp;
for ( int i=0; i<fPyCallbacks.size(); i++ )
{
if ( fPyCallbacks[i]->fPyObject==cb )
tmp.push_back( fPyCallbacks[i] );
}
for ( int i=0; i<tmp.size(); i++ )
{
PyCallbackVec::iterator it = std::find( fPyCallbacks.begin(), fPyCallbacks.end(), tmp[i] );
if ( it!=fPyCallbacks.end() )
fPyCallbacks.erase( it );
plVNodeMgr::RemoveCallback( tmp[i] );
delete tmp[i];
}
}
// CreateNode ----------------------------------------------
PyObject* pyVNodeMgr::CreateNode( int nodeType, bool persistent )
{
plVaultNode * node = plVNodeMgr::CreateNode( nodeType, persistent?kNewPersistentNodeOptions( this ):kNilNodeOptions() );
if ( node )
return pyVaultNode::New( node );
PYTHON_RETURN_NONE;
}
// Dump ----------------------------------------------
void pyVNodeMgr::Dump() const
{
plVNodeMgr::Dump();
}
////////////////////////////////////////////////////////////////////////
pyPlayerVNodeMgr::pyPlayerVNodeMgr( PyObject* thaComm )
: pyVNodeMgr( thaComm )
{}
// IAmSuperUser ----------------------------------------------
bool pyPlayerVNodeMgr::IAmSuperUser( void ) const
{
return false;
}
// IFillOutConnectFields ----------------------------------------------
void pyPlayerVNodeMgr::IFillOutConnectFields( plNetMsgVault* msg ) const
{
msg->GetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrPlayer );
msg->GetArgs()->AddInt( plVault::kArg_NodeMgrID, fMyComm->GetNetClientComm()->GetPlayerID() );
}
// IGetNodeInitializationTask ----------------------------------------------
plVNodeInitTask * pyPlayerVNodeMgr::IGetNodeInitializationTask( plVaultNode * node )
{
if ( plVaultPlayerNode::ConvertNoRef( node ) )
return new plVaultPlayerInitializationTask( this, node, true );
return nil;
}
////////////////////////////////////////////////////////////////////////
pyAgeVNodeMgr::pyAgeVNodeMgr( PyObject* thaComm )
: pyVNodeMgr( thaComm )
{}
// IAmSuperUser ----------------------------------------------
bool pyAgeVNodeMgr::IAmSuperUser( void ) const
{
return false;
}
// IFillOutConnectFields ----------------------------------------------
void pyAgeVNodeMgr::IFillOutConnectFields( plNetMsgVault* msg ) const
{
msg->GetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrAge );
msg->GetArgs()->AddString( plVault::kArg_NodeMgrAgeInstanceName, fAgeFilename.c_str() );
msg->GetArgs()->AddItem( plVault::kArg_NodeMgrAgeGuid, &fAgeInstanceGuid );
}
// IGetNodeInitializationTask ----------------------------------------------
plVNodeInitTask * pyAgeVNodeMgr::IGetNodeInitializationTask( plVaultNode * node )
{
if ( plVaultAgeNode::ConvertNoRef( node ) )
return new plVaultAgeInitializationTask( this, node, nil, true );
if ( plVaultAgeInfoNode::ConvertNoRef( node ) )
return new plVaultAgeInfoInitializationTask( this, node );
return nil;
}
// SetAgeInfo ----------------------------------------------
void pyAgeVNodeMgr::SetAgeInfo( const char * ageFilename, const char * ageInstanceGuid )
{
fAgeFilename = ageFilename;
fAgeInstanceGuid.FromString( ageInstanceGuid );
}
////////////////////////////////////////////////////////////////////////
pyAdminVNodeMgr::pyAdminVNodeMgr( PyObject* thaComm )
: pyVNodeMgr( thaComm )
, fWantGlobalSDL( true )
, fWantAllPlayers( false )
{}
// IAmSuperUser ----------------------------------------------
bool pyAdminVNodeMgr::IAmSuperUser( void ) const
{
return true;
}
// IFillOutConnectFields ----------------------------------------------
void pyAdminVNodeMgr::IFillOutConnectFields( plNetMsgVault* msg ) const
{
msg->GetArgs()->AddInt( plVault::kArg_NodeMgrType, plVault::kNodeType_VNodeMgrAdmin );
msg->GetArgs()->AddInt( plVault::kArg_NodeMgrID, fMyComm->GetNetClientComm()->GetPlayerID() );
}
// IGetNodeInitializationTask ----------------------------------------------
plVNodeInitTask * pyAdminVNodeMgr::IGetNodeInitializationTask( plVaultNode * node )
{
if ( plVaultAdminNode::ConvertNoRef( node ) )
return new plVaultAdminInitializationTask( this, node, fWantGlobalSDL, fWantAllPlayers );
return nil;
}
// GetGlobalInbox ----------------------------------------------
PyObject * pyAdminVNodeMgr::GetGlobalInbox() const
{
plVaultFolderNode tmp;
tmp.SetFolderType( plVault::kGlobalInboxFolder );
plVaultNode * node;
if ( plVNodeMgr::FindNode( &tmp, node ) )
{
return pyVaultFolderNode::New( plVaultFolderNode::ConvertNoRef( node ) );
}
PYTHON_RETURN_NONE;
}
////////////////////////////////////////////////////////////////////
// End.

247
Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h

@ -1,247 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
////////////////////////////////////////////////////////////////////
// pyVNodeMgr - python wrapper for plVNodeMgr class.
#ifndef pyVNodeMgr_h_inc
#define pyVNodeMgr_h_inc
#include "../plVault/plVaultClient.h"
#include "../plNetClientComm/plNetClientComm.h"
#include "../FeatureLib/pfPython/pyGlueHelpers.h"
#include <python.h>
////////////////////////////////////////////////////////////////////
class pyVaultNode;
class pyVaultCallback;
class pyStatusLog;
class pyNetClientComm;
class pyVaultFolderNode;
////////////////////////////////////////////////////////////////////
class pyVNodeMgr : public plVNodeMgr
{
private:
typedef std::vector<pyVaultCallback*> PyCallbackVec;
PyCallbackVec fPyCallbacks;
class VaultMsgHandler : public plNetClientComm::MsgHandler
{
private:
pyVNodeMgr * fMyVNodeMgr;
int HandleMessage( plNetMessage* msg );
public:
VaultMsgHandler(): fMyVNodeMgr(nil) {}
void setMgr(pyVNodeMgr * thaNodeMgr) {fMyVNodeMgr = thaNodeMgr;}
};
friend class VaultMsgHandler;
VaultMsgHandler fMsgHandler;
protected:
PyObject* fMyCommObj;
pyNetClientComm* fMyComm; // pointer to object stored in fMyCommObj
bool IAmOnline() const;
bool IIsThisMe( plVaultPlayerInfoNode* node ) const;
bool IIsThisMe( plVaultPlayerNode * node ) const;
int ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags=0 );
uint32_t IGetPlayerID() const;
pyVNodeMgr(): fMyComm(nil) {fMsgHandler.setMgr(this);} // for python glue only, do NOT call
pyVNodeMgr( PyObject* thaComm );
public:
~pyVNodeMgr();
void setMyComm(PyObject* thaComm); // for python glue only, do NOT call
// required functions for PyObject interoperability
PYTHON_EXPOSE_TYPE;
PYTHON_CLASS_NEW_FRIEND(ptVNodeMgr);
static PyObject* New(PyObject* thaComm);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVNodeMgr object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVNodeMgr); // converts a PyObject to a pyVNodeMgr (throws error if not correct type)
static void AddPlasmaClasses(PyObject *m);
PyObject * GetNetClient() const { Py_INCREF(fMyCommObj); return fMyCommObj; } // returns pyNetClientComm
/////////////////////////////////////////////////
// Vault Client API
int Update( double secs );
void Startup();
void Shutdown();
// connect/disconnect
bool IsConnected();
void Disconnect(
PyObject* cb=nil,
uint32_t cbContext=0 );
void Connect(
int childFetchLevel=plVault::kFetchAllChildren,
PyObject* cb=nil,
uint32_t cbContext=0 );
// TODO: Glue this.
// Fetch matching node from server and hold onto it.
// Note: You won't receive notifications about the fetched node or
// it's children until it has been added to your root node or any
// of it's children.
// bool FetchNode(
// pyVaultNode* templateNode,
// int childFetchLevel=plVault::kFetchAllChildren,
// bool allowCreate = false,
// PyObject* cb=nil,
// uint32_t cbContext=0 );
bool FetchNode( uint32_t nodeID,
int childFetchLevel=plVault::kFetchAllChildren,
PyObject* cb=nil,
uint32_t cbContext=0 );
// get our root node
PyObject* GetRootNode() const; // returns pyVaultNode
// get the client node ID returned to us by the server ( if we didn't
// fetch when we connected then we have to use this to identify ourselves ).
uint32_t GetClientID() const;
// search all nodes in client locally
PyObject* GetNode( uint32_t id ) const; // returns pyVaultNode
// TODO: Glue these.
PyObject* FindNode( pyVaultNode* templateNode ) const; // returns pyVaultNode
// bool FindNodes( const pyVaultNode* templateNode, PyObject * out ) const;
// callback management
bool EnableCallbacks( bool b ); // returns previous enabled setting.
void AddCallback( PyObject* cb );
void RemoveCallback( PyObject* cb );
// create a node of the given type.
PyObject* CreateNode( int nodeType, bool persistent ); // returns pyVaultNode
// dump contents to log
void Dump() const;
};
////////////////////////////////////////////////////////////////////
class pyPlayerVNodeMgr : public pyVNodeMgr
{
protected:
bool IAmSuperUser( void ) const;
void IFillOutConnectFields( plNetMsgVault* msg ) const;
plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node );
pyPlayerVNodeMgr(): pyVNodeMgr() {} // for python glue only, do NOT call
pyPlayerVNodeMgr( PyObject* thaComm );
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptPlayerVNodeMgr);
static PyObject* New(PyObject* thaComm);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyPlayerVNodeMgr object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyPlayerVNodeMgr); // converts a PyObject to a pyPlayerVNodeMgr (throws error if not correct type)
static void AddPlasmaClasses(PyObject *m);
};
////////////////////////////////////////////////////////////////////
class pyAgeVNodeMgr : public pyVNodeMgr
{
std::string fAgeFilename;
plServerGuid fAgeInstanceGuid;
protected:
bool IAmSuperUser( void ) const;
void IFillOutConnectFields( plNetMsgVault* msg ) const;
plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node );
pyAgeVNodeMgr(): pyVNodeMgr() {} // for python glue only, do NOT call
pyAgeVNodeMgr( PyObject* thaComm );
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptAgeVNodeMgr);
static PyObject* New(PyObject* thaComm);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyAgeVNodeMgr object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyAgeVNodeMgr); // converts a PyObject to a pyAgeVNodeMgr (throws error if not correct type)
static void AddPlasmaClasses(PyObject *m);
void SetAgeInfo( const char * ageFilename, const char * ageInstanceGuid );
};
////////////////////////////////////////////////////////////////////
class pyAdminVNodeMgr : public pyVNodeMgr
{
private:
bool fWantGlobalSDL;
bool fWantAllPlayers;
protected:
bool IAmSuperUser( void ) const;
void IFillOutConnectFields( plNetMsgVault* msg ) const;
plVNodeInitTask * IGetNodeInitializationTask( plVaultNode * node );
pyAdminVNodeMgr(): pyVNodeMgr(), fWantGlobalSDL(true), fWantAllPlayers(false) {} // for python glue only, do NOT call
pyAdminVNodeMgr( PyObject* thaComm );
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptAdminVNodeMgr);
static PyObject* New(PyObject* thaComm);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyAdminVNodeMgr object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyAdminVNodeMgr); // converts a PyObject to a pyAdminVNodeMgr (throws error if not correct type)
static void AddPlasmaClasses(PyObject *m);
void SetWantGlobalSDL( bool v ) { fWantGlobalSDL=v; }
void SetWantAllPlayers( bool v ) { fWantAllPlayers=v; }
PyObject * GetGlobalInbox() const; // returns pyVaultFolderNode
};
////////////////////////////////////////////////////////////////////
#endif // pyVNodeMgr_h_inc

477
Sources/Plasma/PythonLib/pyVault/pyVNodeMgrGlue.cpp

@ -1,477 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "pyVNodeMgr.h"
#include "../FeatureLib/pfPython/pyVaultNode.h"
#include "../pyNetClientComm/pyNetClientComm.h"
#include <python.h>
// glue functions
PYTHON_CLASS_DEFINITION(ptVNodeMgr, pyVNodeMgr);
PYTHON_DEFAULT_NEW_DEFINITION(ptVNodeMgr, pyVNodeMgr)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVNodeMgr)
PYTHON_NO_INIT_DEFINITION(ptVNodeMgr)
PYTHON_METHOD_DEFINITION(ptVNodeMgr, update, args)
{
double secs;
if (!PyArg_ParseTuple(args, "d", &secs))
{
PyErr_SetString(PyExc_TypeError, "update expects a double");
PYTHON_RETURN_ERROR;
}
return PyInt_FromLong(self->fThis->Update(secs));
}
PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, startup, Startup)
PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, shutdown, Shutdown)
PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, isConnected)
{
PYTHON_RETURN_BOOL(self->fThis->IsConnected());
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, disconnect, args)
{
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "|Ol", &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "disconnect expects an optional object, and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
self->fThis->Disconnect(cb, context);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, connect, args)
{
int childFetchLevel = -1;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "|iOl", &childFetchLevel, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "connect expects an optional int, an optional object, and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
self->fThis->Connect(childFetchLevel, cb, context);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, fetchNode, args)
{
unsigned long nodeID;
int childFetchLevel = -1;
PyObject* cb = NULL;
unsigned long context = 0;
if (!PyArg_ParseTuple(args, "l|iOl", &nodeID, &childFetchLevel, &cb, &context))
{
PyErr_SetString(PyExc_TypeError, "fetchNode expects an unsigned long, an optional int, an optional object, and an optional unsigned long");
PYTHON_RETURN_ERROR;
}
PYTHON_RETURN_BOOL(self->fThis->FetchNode(nodeID, childFetchLevel, cb, context));
}
PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getRootNode)
{
return self->fThis->GetRootNode();
}
PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getClientID)
{
return PyLong_FromUnsignedLong(self->fThis->GetClientID());
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, getNode, args)
{
unsigned long nodeID;
if (!PyArg_ParseTuple(args, "l", &nodeID))
{
PyErr_SetString(PyExc_TypeError, "getNode expects an unsigned long");
PYTHON_RETURN_ERROR;
}
return self->fThis->GetNode(nodeID);
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, findNode, args)
{
PyObject* templateObj = NULL;
if (!PyArg_ParseTuple(args, "O", &templateObj))
{
PyErr_SetString(PyExc_TypeError, "findNode expects a ptVaultNode");
PYTHON_RETURN_ERROR;
}
if (!pyVaultNode::Check(templateObj))
{
PyErr_SetString(PyExc_TypeError, "findNode expects a ptVaultNode");
PYTHON_RETURN_ERROR;
}
pyVaultNode* templateNode = pyVaultNode::ConvertFrom(templateObj);
return self->fThis->FindNode(templateNode);
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, enableCallbacks, args)
{
char enable;
if (!PyArg_ParseTuple(args, "b", &enable))
{
PyErr_SetString(PyExc_TypeError, "enableCallbacks expects a boolean");
PYTHON_RETURN_ERROR;
}
PYTHON_RETURN_BOOL(self->fThis->EnableCallbacks(enable != 0));
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, addCallback, args)
{
PyObject* cb = NULL;
if (!PyArg_ParseTuple(args, "O", &cb))
{
PyErr_SetString(PyExc_TypeError, "addCallback expects an object");
PYTHON_RETURN_ERROR;
}
self->fThis->AddCallback(cb);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, removeCallback, args)
{
PyObject* cb = NULL;
if (!PyArg_ParseTuple(args, "O", &cb))
{
PyErr_SetString(PyExc_TypeError, "removeCallback expects an object");
PYTHON_RETURN_ERROR;
}
self->fThis->RemoveCallback(cb);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptVNodeMgr, createNode, args)
{
int nodeType;
bool persistent;
if (!PyArg_ParseTuple(args, "ib", &nodeType, &persistent))
{
PyErr_SetString(PyExc_TypeError, "createNode expects an int and a boolean");
PYTHON_RETURN_ERROR;
}
return self->fThis->CreateNode(nodeType, persistent != 0);
}
PYTHON_METHOD_DEFINITION_NOARGS(ptVNodeMgr, getNetClient)
{
return self->fThis->GetNetClient();
}
PYTHON_BASIC_METHOD_DEFINITION(ptVNodeMgr, dump, Dump)
PYTHON_START_METHODS_TABLE(ptVNodeMgr)
PYTHON_METHOD(ptVNodeMgr, update, "Params: secs\nUNKNOWN"),
PYTHON_BASIC_METHOD(ptVNodeMgr, startup, "UNKNOWN"),
PYTHON_BASIC_METHOD(ptVNodeMgr, shutdown, "UNKNOWN"),
PYTHON_METHOD_NOARGS(ptVNodeMgr, isConnected, "Are we connected to the vault?"),
PYTHON_METHOD(ptVNodeMgr, disconnect, "Params: callback=None,cbContext=0\nDisconnects us from the vault"),
PYTHON_METHOD(ptVNodeMgr, connect, "Params: childFetchLevel=-1,callback=None,cbContext=0\nConnects us ti the vault"),
PYTHON_METHOD(ptVNodeMgr, fetchNode, "Params: nodeID,childFetchLevel=-1,callback=None,cbContext=0\nFetchs the specified node"),
PYTHON_METHOD_NOARGS(ptVNodeMgr, getRootNode, "Returns the root node"),
PYTHON_METHOD_NOARGS(ptVNodeMgr, getClientID, "Returns the client ID number"),
PYTHON_METHOD(ptVNodeMgr, getNode, "Params: nodeID\nReturns the specified node"),
PYTHON_METHOD(ptVNodeMgr, findNode, "Params: templateNode\nLocates a node matching the template"),
PYTHON_METHOD(ptVNodeMgr, enableCallbacks, "Params: enable\nEnable/disable callbacks"),
PYTHON_METHOD(ptVNodeMgr, addCallback, "Params: callback\nUNKNOWN"),
PYTHON_METHOD(ptVNodeMgr, removeCallback, "Params: callback\nUNKNOWN"),
PYTHON_METHOD(ptVNodeMgr, createNode, "Params: nodeType,persistent\nCreates a new node"),
PYTHON_METHOD(ptVNodeMgr, getNetClient, "Returns our internal ptNetClientComm"),
PYTHON_BASIC_METHOD(ptVNodeMgr, dump, "Dump contents to our log"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE(ptVNodeMgr, "UNKNOWN");
PYTHON_EXPOSE_TYPE_DEFINITION(ptVNodeMgr, pyVNodeMgr);
// required functions for PyObject interoperability
PyObject *pyVNodeMgr::New(PyObject* thaComm)
{
ptVNodeMgr *newObj = (ptVNodeMgr*)ptVNodeMgr_type.tp_new(&ptVNodeMgr_type, NULL, NULL);
if (!pyNetClientComm::Check(thaComm))
{
Py_DECREF(newObj);
return NULL; // bad parameter
}
newObj->fThis->setMyComm(thaComm);
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptVNodeMgr, pyVNodeMgr)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVNodeMgr, pyVNodeMgr)
///////////////////////////////////////////////////////////////////////////
//
// AddPlasmaClasses - the python module definitions
//
void pyVNodeMgr::AddPlasmaClasses(PyObject *m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptVNodeMgr);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
// glue functions
PYTHON_CLASS_DEFINITION(ptPlayerVNodeMgr, pyPlayerVNodeMgr);
PYTHON_DEFAULT_NEW_DEFINITION(ptPlayerVNodeMgr, pyPlayerVNodeMgr)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptPlayerVNodeMgr)
PYTHON_INIT_DEFINITION(ptPlayerVNodeMgr, args, keywords)
{
PyObject* netClientComm = NULL;
if (!PyArg_ParseTuple(args, "O", &netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
if (!pyNetClientComm::Check(netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
self->fThis->setMyComm(netClientComm);
PYTHON_RETURN_INIT_OK;
}
PYTHON_START_METHODS_TABLE(ptPlayerVNodeMgr)
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptPlayerVNodeMgr, pyVNodeMgr, "UNKNOWN");
// required functions for PyObject interoperability
PyObject *pyPlayerVNodeMgr::New(PyObject* thaComm)
{
ptPlayerVNodeMgr *newObj = (ptPlayerVNodeMgr*)ptPlayerVNodeMgr_type.tp_new(&ptPlayerVNodeMgr_type, NULL, NULL);
if (!pyNetClientComm::Check(thaComm))
{
Py_DECREF(newObj);
return NULL; // bad parameter
}
newObj->fThis->setMyComm(thaComm);
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptPlayerVNodeMgr, pyPlayerVNodeMgr)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptPlayerVNodeMgr, pyPlayerVNodeMgr)
///////////////////////////////////////////////////////////////////////////
//
// AddPlasmaClasses - the python module definitions
//
void pyPlayerVNodeMgr::AddPlasmaClasses(PyObject *m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptPlayerVNodeMgr);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
// glue functions
PYTHON_CLASS_DEFINITION(ptAgeVNodeMgr, pyAgeVNodeMgr);
PYTHON_DEFAULT_NEW_DEFINITION(ptAgeVNodeMgr, pyAgeVNodeMgr)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptAgeVNodeMgr)
PYTHON_INIT_DEFINITION(ptAgeVNodeMgr, args, keywords)
{
PyObject* netClientComm = NULL;
if (!PyArg_ParseTuple(args, "O", &netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
if (!pyNetClientComm::Check(netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
self->fThis->setMyComm(netClientComm);
PYTHON_RETURN_INIT_OK;
}
PYTHON_METHOD_DEFINITION(ptAgeVNodeMgr, setAgeInfo, args)
{
char* filename;
char* guid;
if (!PyArg_ParseTuple(args, "ss", &filename, &guid))
{
PyErr_SetString(PyExc_TypeError, "setAgeInfo expects two strings");
PYTHON_RETURN_ERROR;
}
self->fThis->SetAgeInfo(filename, guid);
PYTHON_RETURN_NONE;
}
PYTHON_START_METHODS_TABLE(ptAgeVNodeMgr)
PYTHON_METHOD(ptAgeVNodeMgr, setAgeInfo, "Params: filename,guid\nUNKNOWN"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptAgeVNodeMgr, pyVNodeMgr, "UNKNOWN");
// required functions for PyObject interoperability
PyObject *pyAgeVNodeMgr::New(PyObject* thaComm)
{
ptAgeVNodeMgr *newObj = (ptAgeVNodeMgr*)ptAgeVNodeMgr_type.tp_new(&ptAgeVNodeMgr_type, NULL, NULL);
if (!pyNetClientComm::Check(thaComm))
{
Py_DECREF(newObj);
return NULL; // bad parameter
}
newObj->fThis->setMyComm(thaComm);
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptAgeVNodeMgr, pyAgeVNodeMgr)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptAgeVNodeMgr, pyAgeVNodeMgr)
///////////////////////////////////////////////////////////////////////////
//
// AddPlasmaClasses - the python module definitions
//
void pyAgeVNodeMgr::AddPlasmaClasses(PyObject *m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptAgeVNodeMgr);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
// glue functions
PYTHON_CLASS_DEFINITION(ptAdminVNodeMgr, pyAdminVNodeMgr);
PYTHON_DEFAULT_NEW_DEFINITION(ptAdminVNodeMgr, pyAdminVNodeMgr)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptAdminVNodeMgr)
PYTHON_INIT_DEFINITION(ptAdminVNodeMgr, args, keywords)
{
PyObject* netClientComm = NULL;
if (!PyArg_ParseTuple(args, "O", &netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
if (!pyNetClientComm::Check(netClientComm))
{
PyErr_SetString(PyExc_TypeError, "__init__ expects a ptNetClientComm");
PYTHON_RETURN_INIT_ERROR;
}
self->fThis->setMyComm(netClientComm);
PYTHON_RETURN_INIT_OK;
}
PYTHON_METHOD_DEFINITION(ptAdminVNodeMgr, setWantGlobalSDL, args)
{
bool flag;
if (!PyArg_ParseTuple(args, "b", &flag))
{
PyErr_SetString(PyExc_TypeError, "setWantGlobalSDL expects a boolean");
PYTHON_RETURN_ERROR;
}
self->fThis->SetWantGlobalSDL(flag != 0);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptAdminVNodeMgr, setWantAllPlayers, args)
{
bool flag;
if (!PyArg_ParseTuple(args, "b", &flag))
{
PyErr_SetString(PyExc_TypeError, "setWantAllPlayers expects a boolean");
PYTHON_RETURN_ERROR;
}
self->fThis->SetWantAllPlayers(flag != 0);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION_NOARGS(ptAdminVNodeMgr, getGlobalInbox)
{
return self->fThis->GetGlobalInbox();
}
PYTHON_START_METHODS_TABLE(ptAdminVNodeMgr)
PYTHON_METHOD(ptAdminVNodeMgr, setWantGlobalSDL, "Params: flag\nUNKNOWN"),
PYTHON_METHOD(ptAdminVNodeMgr, setWantAllPlayers, "Params: flag\nUNKNOWN"),
PYTHON_METHOD_NOARGS(ptAdminVNodeMgr, getGlobalInbox, "UNKNOWN"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptAdminVNodeMgr, pyVNodeMgr, "UNKNOWN");
// required functions for PyObject interoperability
PyObject *pyAdminVNodeMgr::New(PyObject* thaComm)
{
ptAdminVNodeMgr *newObj = (ptAdminVNodeMgr*)ptAdminVNodeMgr_type.tp_new(&ptAdminVNodeMgr_type, NULL, NULL);
if (!pyNetClientComm::Check(thaComm))
{
Py_DECREF(newObj);
return NULL; // bad parameter
}
newObj->fThis->setMyComm(thaComm);
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptAdminVNodeMgr, pyAdminVNodeMgr)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptAdminVNodeMgr, pyAdminVNodeMgr)
///////////////////////////////////////////////////////////////////////////
//
// AddPlasmaClasses - the python module definitions
//
void pyAdminVNodeMgr::AddPlasmaClasses(PyObject *m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptAdminVNodeMgr);
PYTHON_CLASS_IMPORT_END(m);
}
Loading…
Cancel
Save