mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
161
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp
Normal file
161
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
/*==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 "pyMarkerGame.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base Marker game client class
|
||||
//
|
||||
|
||||
pyMarkerGame::pyMarkerGame(): pyGameCli() {}
|
||||
|
||||
pyMarkerGame::pyMarkerGame(pfGameCli* client): pyGameCli(client)
|
||||
{
|
||||
if (client && (client->GetGameTypeId() != kGameTypeId_Marker))
|
||||
gameClient = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyMarkerGame::IsMarkerGame(std::wstring guid)
|
||||
{
|
||||
Uuid gameUuid(guid.c_str());
|
||||
return gameUuid == kGameTypeId_Marker;
|
||||
}
|
||||
|
||||
void pyMarkerGame::CreateMarkerGame(pyKey& callbackKey, unsigned gameType, std::wstring gameName, unsigned long timeLimit, std::wstring templateId)
|
||||
{
|
||||
Marker_CreateParam init;
|
||||
init.gameType = gameType;
|
||||
StrCopy(init.gameName, gameName.c_str(), arrsize(init.gameName));
|
||||
init.timeLimit = timeLimit;
|
||||
StrCopy(init.templateID, templateId.c_str(), arrsize(init.templateID));
|
||||
pfGameMgr::GetInstance()->CreateGame(callbackKey.getKey(), kGameTypeId_Marker, 0, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyMarkerGame::StartGame()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->StartGame();
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::PauseGame()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->PauseGame();
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::ResetGame()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->ResetGame();
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::ChangeGameName(std::wstring newName)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->ChangeGameName(newName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::ChangeTimeLimit(unsigned long timeLimit)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->ChangeTimeLimit(timeLimit);
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::DeleteGame()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->DeleteGame();
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::AddMarker(double x, double y, double z, std::wstring name, std::wstring age)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->AddMarker(x, y, z, name.c_str(), age.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::DeleteMarker(unsigned long markerId)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->DeleteMarker(markerId);
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::ChangeMarkerName(unsigned long markerId, std::wstring newName)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->ChangeMarkerName(markerId, newName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyMarkerGame::CaptureMarker(unsigned long markerId)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
|
||||
marker->CaptureMarker(markerId);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*==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 pyMarkerGame_h
|
||||
#define pyMarkerGame_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyMarkerGame
|
||||
//
|
||||
// PURPOSE: Class wrapper for the Marker game client
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCli.h"
|
||||
#include "../../pyKey.h"
|
||||
|
||||
class pyMarkerGame : public pyGameCli
|
||||
{
|
||||
protected:
|
||||
pyMarkerGame();
|
||||
pyMarkerGame(pfGameCli* client);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGame);
|
||||
static PyObject* New(pfGameCli* client);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a ptMarkerGame object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGame); // converts a PyObject to a pyMarkerGame (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
|
||||
|
||||
static bool IsMarkerGame(std::wstring guid);
|
||||
static void CreateMarkerGame(pyKey& callbackKey, unsigned gameType, std::wstring gameName, unsigned long timeLimit, std::wstring templateId);
|
||||
|
||||
void StartGame();
|
||||
void PauseGame();
|
||||
void ResetGame();
|
||||
void ChangeGameName(std::wstring newName);
|
||||
void ChangeTimeLimit(unsigned long timeLimit);
|
||||
void DeleteGame();
|
||||
void AddMarker(double x, double y, double z, std::wstring name, std::wstring age);
|
||||
void DeleteMarker(unsigned long markerId);
|
||||
void ChangeMarkerName(unsigned long markerId, std::wstring newName);
|
||||
void CaptureMarker(unsigned long markerId);
|
||||
};
|
||||
|
||||
#endif // pyMarkerGame_h
|
@ -0,0 +1,397 @@
|
||||
/*==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 "pyMarkerGame.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT game client class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGame, pyMarkerGame);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGame, pyMarkerGame)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGame)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGame)
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsMarkerGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a Marker game")
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (PyUnicode_Check(textObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(textObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
bool retVal = pyMarkerGame::IsMarkerGame(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(textObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(textObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = pyMarkerGame::IsMarkerGame(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION_WKEY(PtCreateMarkerGame, args, keywords, "Params: callbackKey, gameType, gameName = \"\", timeLimit = 0, templateId = \"\"\n"
|
||||
"Creates a new Marker game with the specified callback key, game type (from PtMarkerGameTypes), time limit (in ms), and template id (guid string)")
|
||||
{
|
||||
char *kwlist[] = {"callbackKey", "gameType", "gameName", "timeLimit", "templateId", NULL};
|
||||
PyObject* callbackObj = NULL;
|
||||
unsigned int gameType = 0;
|
||||
PyObject* gameNameObj = NULL;
|
||||
unsigned long timeLimit = 0;
|
||||
PyObject* templateIdObj = NULL;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywords, "OI|OkO", kwlist, &callbackObj, &gameType, &gameNameObj, &timeLimit, &templateIdObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateMarkerGame expects a ptKey, unsigned int, and optionally a string, an unsigned long, and another string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateMarkerGame expects a ptKey, unsigned int, and optionally a string, an unsigned long, and another string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
std::wstring name = L"";
|
||||
std::wstring templateId = L"";
|
||||
if (gameNameObj != NULL)
|
||||
{
|
||||
if (PyUnicode_Check(gameNameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(gameNameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)gameNameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
name = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(gameNameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(gameNameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
name = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateMarkerGame expects a ptKey, unsigned int, and optionally a string, an unsigned long, and another string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
if (templateIdObj != NULL)
|
||||
{
|
||||
if (PyUnicode_Check(templateIdObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(templateIdObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)templateIdObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
templateId = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(templateIdObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(templateIdObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
templateId = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateMarkerGame expects a ptKey, unsigned int, and optionally a string, an unsigned long, and another string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
pyMarkerGame::CreateMarkerGame(*key, gameType, name, timeLimit, templateId);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptMarkerGame, startGame, StartGame)
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptMarkerGame, pauseGame, PauseGame)
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptMarkerGame, resetGame, ResetGame)
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptMarkerGame, changeGameName, args)
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "changeGameName expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (PyUnicode_Check(textObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(textObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
self->fThis->ChangeGameName(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else if (PyString_Check(textObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(textObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
self->fThis->ChangeGameName(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "changeGameName expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptMarkerGame, changeTimeLimit, args)
|
||||
{
|
||||
unsigned long timeLimit;
|
||||
if (!PyArg_ParseTuple(args, "k", &timeLimit))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "changeTimeLimit expects an unsigned long");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
self->fThis->ChangeTimeLimit(timeLimit);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptMarkerGame, deleteGame, DeleteGame)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_WKEY(ptMarkerGame, addMarker, args, keywords)
|
||||
{
|
||||
char *kwlist[] = {"x", "y", "z", "name", "age", NULL};
|
||||
double x, y, z;
|
||||
PyObject* nameObj = NULL;
|
||||
PyObject* ageObj = NULL;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywords, "ddd|OO", kwlist, &x, &y, &z, &nameObj, &ageObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "addMarker expects three doubles, and optionally two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
std::wstring name = L"";
|
||||
std::wstring age = L"";
|
||||
if (nameObj != NULL)
|
||||
{
|
||||
if (PyUnicode_Check(nameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(nameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
name = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(nameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(nameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
name = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "addMarker expects three doubles, and optionally two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
if (ageObj != NULL)
|
||||
{
|
||||
if (PyUnicode_Check(ageObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(ageObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)ageObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
age = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(ageObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(ageObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
age = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "addMarker expects three doubles, and optionally two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
self->fThis->AddMarker(x, y, z, name, age);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptMarkerGame, deleteMarker, args)
|
||||
{
|
||||
unsigned long markerId;
|
||||
if (!PyArg_ParseTuple(args, "k", &markerId))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "deleteMarker expects an unsigned long");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
self->fThis->DeleteMarker(markerId);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptMarkerGame, changeMarkerName, args)
|
||||
{
|
||||
unsigned long markerId;
|
||||
PyObject* nameObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "kO", &markerId, &nameObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "changeMarkerName expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (PyUnicode_Check(nameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(nameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
self->fThis->ChangeMarkerName(markerId, text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else if (PyString_Check(nameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(nameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
self->fThis->ChangeMarkerName(markerId, wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "changeMarkerName expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptMarkerGame, captureMarker, args)
|
||||
{
|
||||
unsigned long markerId;
|
||||
if (!PyArg_ParseTuple(args, "k", &markerId))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "captureMarker expects an unsigned long");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
self->fThis->CaptureMarker(markerId);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGame)
|
||||
PYTHON_BASIC_METHOD(ptMarkerGame, startGame, "Starts the game. Won't work on MP games if you're not the owner/creator"),
|
||||
PYTHON_BASIC_METHOD(ptMarkerGame, pauseGame, "Pauses the game. Won't work on MP games if you're not the owner/creator"),
|
||||
PYTHON_BASIC_METHOD(ptMarkerGame, resetGame, "Resets the game. Won't work on MP games if you're not the owner/creator"),
|
||||
PYTHON_METHOD(ptMarkerGame, changeGameName, "Params: newName\nChanges the name of the game. Won't work if you're not the game owner/creator"),
|
||||
PYTHON_METHOD(ptMarkerGame, changeTimeLimit, "Params: newTimeLimit\nChanges the time limit on the game (in ms). Won't work if you're not the game owner/creator, or if it's a quest game"),
|
||||
PYTHON_BASIC_METHOD(ptMarkerGame, deleteGame, "Tells the server to delete the game. Won't work if you're not the game owner/creator"),
|
||||
PYTHON_METHOD_WKEY(ptMarkerGame, addMarker, "Params: x, y, z, name = \"\", age = \"\"\nAdds a marker to the game. Age is ignored in a non-quest game. Won't work if you're not the owner/creator"),
|
||||
PYTHON_METHOD(ptMarkerGame, deleteMarker, "Params: markerId\nDeletes the specified marker from the game. Won't work if you're not the game owner/creator"),
|
||||
PYTHON_METHOD(ptMarkerGame, changeMarkerName, "Params: markerId, newName\nChanges the name of the specified marker. Won't work if you're not the game owner/creator"),
|
||||
PYTHON_METHOD(ptMarkerGame, captureMarker, "Params: markerId\nCaptures the specified marker"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGame, pyGameCli, "Game client for the Marker game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGame::New(pfGameCli* client)
|
||||
{
|
||||
ptMarkerGame *newObj = (ptMarkerGame*)ptMarkerGame_type.tp_new(&ptMarkerGame_type, NULL, NULL);
|
||||
if (client && (client->GetGameTypeId() == kGameTypeId_Marker))
|
||||
newObj->fThis->gameClient = client;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGame, pyMarkerGame)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGame, pyMarkerGame)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGame::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGame);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyMarkerGame::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtMarkerGameTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerGameTypes, kMarkerGameQuest, kMarkerGameQuest);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerGameTypes, kMarkerGameCGZ, kMarkerGameCGZ);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerGameTypes, kMarkerGameCapture, kMarkerGameCapture);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerGameTypes, kMarkerGameCaptureAndHold, kMarkerGameCaptureAndHold);
|
||||
PYTHON_ENUM_END(m, PtMarkerGameTypes);
|
||||
}
|
||||
|
||||
void pyMarkerGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, PtIsMarkerGame);
|
||||
PYTHON_GLOBAL_METHOD_WKEY(methods, PtCreateMarkerGame);
|
||||
}
|
424
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerMsg.cpp
Normal file
424
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerMsg.cpp
Normal file
@ -0,0 +1,424 @@
|
||||
/*==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 "pyMarkerMsg.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base Marker msg class
|
||||
//
|
||||
|
||||
pyMarkerMsg::pyMarkerMsg(): pyGameCliMsg() {}
|
||||
|
||||
pyMarkerMsg::pyMarkerMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
|
||||
{
|
||||
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_Marker))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyMarkerMsg::GetMarkerMsgType() const
|
||||
{
|
||||
if (message)
|
||||
return message->netMsg->messageId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* pyMarkerMsg::UpcastToFinalMarkerMsg() const
|
||||
{
|
||||
if (!message)
|
||||
PYTHON_RETURN_NONE;
|
||||
switch (message->netMsg->messageId)
|
||||
{
|
||||
case kSrv2Cli_Marker_TemplateCreated:
|
||||
return pyMarkerTemplateCreatedMsg::New(message);
|
||||
case kSrv2Cli_Marker_TeamAssigned:
|
||||
return pyMarkerTeamAssignedMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameType:
|
||||
return pyMarkerGameTypeMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameStarted:
|
||||
return pyMarkerGameStartedMsg::New(message);
|
||||
case kSrv2Cli_Marker_GamePaused:
|
||||
return pyMarkerGamePausedMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameReset:
|
||||
return pyMarkerGameResetMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameOver:
|
||||
return pyMarkerGameOverMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameNameChanged:
|
||||
return pyMarkerGameNameChangedMsg::New(message);
|
||||
case kSrv2Cli_Marker_TimeLimitChanged:
|
||||
return pyMarkerTimeLimitChangedMsg::New(message);
|
||||
case kSrv2Cli_Marker_GameDeleted:
|
||||
return pyMarkerGameDeletedMsg::New(message);
|
||||
case kSrv2Cli_Marker_MarkerAdded:
|
||||
return pyMarkerMarkerAddedMsg::New(message);
|
||||
case kSrv2Cli_Marker_MarkerDeleted:
|
||||
return pyMarkerMarkerDeletedMsg::New(message);
|
||||
case kSrv2Cli_Marker_MarkerNameChanged:
|
||||
return pyMarkerMarkerNameChangedMsg::New(message);
|
||||
case kSrv2Cli_Marker_MarkerCaptured:
|
||||
return pyMarkerMarkerCapturedMsg::New(message);
|
||||
default:
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The different messages we can receive
|
||||
//
|
||||
|
||||
pyMarkerTemplateCreatedMsg::pyMarkerTemplateCreatedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerTemplateCreatedMsg::pyMarkerTemplateCreatedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_TemplateCreated))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyMarkerTemplateCreatedMsg::TemplateID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_TemplateCreated* gmMsg = (const Srv2Cli_Marker_TemplateCreated*)message->netMsg;
|
||||
return gmMsg->templateID;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerTeamAssignedMsg::pyMarkerTeamAssignedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerTeamAssignedMsg::pyMarkerTeamAssignedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_TeamAssigned))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyMarkerTeamAssignedMsg::TeamNumber() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_TeamAssigned* gmMsg = (const Srv2Cli_Marker_TeamAssigned*)message->netMsg;
|
||||
return gmMsg->teamNumber;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameTypeMsg::pyMarkerGameTypeMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameTypeMsg::pyMarkerGameTypeMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameType))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyMarkerGameTypeMsg::GameType() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_GameType* gmMsg = (const Srv2Cli_Marker_GameType*)message->netMsg;
|
||||
return gmMsg->gameType;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameStartedMsg::pyMarkerGameStartedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameStartedMsg::pyMarkerGameStartedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameStarted))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGamePausedMsg::pyMarkerGamePausedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGamePausedMsg::pyMarkerGamePausedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GamePaused))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyMarkerGamePausedMsg::TimeLeft() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_GamePaused* gmMsg = (const Srv2Cli_Marker_GamePaused*)message->netMsg;
|
||||
return gmMsg->timeLeft;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameResetMsg::pyMarkerGameResetMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameResetMsg::pyMarkerGameResetMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameReset))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameOverMsg::pyMarkerGameOverMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameOverMsg::pyMarkerGameOverMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameOver))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameNameChangedMsg::pyMarkerGameNameChangedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameNameChangedMsg::pyMarkerGameNameChangedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameNameChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyMarkerGameNameChangedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_GameNameChanged* gmMsg = (const Srv2Cli_Marker_GameNameChanged*)message->netMsg;
|
||||
return gmMsg->newName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerTimeLimitChangedMsg::pyMarkerTimeLimitChangedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerTimeLimitChangedMsg::pyMarkerTimeLimitChangedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_TimeLimitChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyMarkerTimeLimitChangedMsg::TimeLimit() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_TimeLimitChanged* gmMsg = (const Srv2Cli_Marker_TimeLimitChanged*)message->netMsg;
|
||||
return gmMsg->newTimeLimit;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerGameDeletedMsg::pyMarkerGameDeletedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerGameDeletedMsg::pyMarkerGameDeletedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_GameDeleted))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyMarkerGameDeletedMsg::Failed() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_GameDeleted* gmMsg = (const Srv2Cli_Marker_GameDeleted*)message->netMsg;
|
||||
return gmMsg->failed;
|
||||
}
|
||||
return true; // assume it failed if we have a problem
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerMarkerAddedMsg::pyMarkerMarkerAddedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerMarkerAddedMsg::pyMarkerMarkerAddedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_MarkerAdded))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
double pyMarkerMarkerAddedMsg::X() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->x;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyMarkerMarkerAddedMsg::Y() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->y;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyMarkerMarkerAddedMsg::Z() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->z;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long pyMarkerMarkerAddedMsg::MarkerId() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->markerID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyMarkerMarkerAddedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->name;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring pyMarkerMarkerAddedMsg::Age() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerAdded* gmMsg = (const Srv2Cli_Marker_MarkerAdded*)message->netMsg;
|
||||
return gmMsg->age;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerMarkerDeletedMsg::pyMarkerMarkerDeletedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerMarkerDeletedMsg::pyMarkerMarkerDeletedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_MarkerDeleted))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyMarkerMarkerDeletedMsg::MarkerId() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerDeleted* gmMsg = (const Srv2Cli_Marker_MarkerDeleted*)message->netMsg;
|
||||
return gmMsg->markerID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerMarkerNameChangedMsg::pyMarkerMarkerNameChangedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerMarkerNameChangedMsg::pyMarkerMarkerNameChangedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_MarkerNameChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyMarkerMarkerNameChangedMsg::MarkerId() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerNameChanged* gmMsg = (const Srv2Cli_Marker_MarkerNameChanged*)message->netMsg;
|
||||
return gmMsg->markerID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyMarkerMarkerNameChangedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerNameChanged* gmMsg = (const Srv2Cli_Marker_MarkerNameChanged*)message->netMsg;
|
||||
return gmMsg->newName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pyMarkerMarkerCapturedMsg::pyMarkerMarkerCapturedMsg(): pyMarkerMsg() {}
|
||||
|
||||
pyMarkerMarkerCapturedMsg::pyMarkerMarkerCapturedMsg(pfGameCliMsg* msg): pyMarkerMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_Marker_MarkerCaptured))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyMarkerMarkerCapturedMsg::MarkerId() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerCaptured* gmMsg = (const Srv2Cli_Marker_MarkerCaptured*)message->netMsg;
|
||||
return gmMsg->markerID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int pyMarkerMarkerCapturedMsg::Team() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_Marker_MarkerCaptured* gmMsg = (const Srv2Cli_Marker_MarkerCaptured*)message->netMsg;
|
||||
return gmMsg->team;
|
||||
}
|
||||
return 0;
|
||||
}
|
347
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerMsg.h
Normal file
347
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerMsg.h
Normal file
@ -0,0 +1,347 @@
|
||||
/*==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 pyMarkerMsg_h
|
||||
#define pyMarkerMsg_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyMarkerMsg
|
||||
//
|
||||
// PURPOSE: Class wrapper for Marker game messages
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCliMsg.h"
|
||||
|
||||
class pyMarkerMsg : public pyGameCliMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerMsg();
|
||||
pyMarkerMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerMsg); // converts a PyObject to a pyMarkerMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
|
||||
int GetMarkerMsgType() const;
|
||||
|
||||
PyObject* UpcastToFinalMarkerMsg() const; // returns this message as the marker message it really is
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerTemplateCreatedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerTemplateCreatedMsg();
|
||||
pyMarkerTemplateCreatedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerTemplateCreatedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerTemplateCreatedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerTemplateCreatedMsg); // converts a PyObject to a pyMarkerTemplateCreatedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring TemplateID() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerTeamAssignedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerTeamAssignedMsg();
|
||||
pyMarkerTeamAssignedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerTeamAssignedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerTeamAssignedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerTeamAssignedMsg); // converts a PyObject to a pyMarkerTeamAssignedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
int TeamNumber() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameTypeMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameTypeMsg();
|
||||
pyMarkerGameTypeMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameTypeMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameTypeMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameTypeMsg); // converts a PyObject to a pyMarkerGameTypeMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
int GameType() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameStartedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameStartedMsg();
|
||||
pyMarkerGameStartedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameStartedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameStartedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameStartedMsg); // converts a PyObject to a pyMarkerGameStartedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGamePausedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGamePausedMsg();
|
||||
pyMarkerGamePausedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGamePausedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGamePausedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGamePausedMsg); // converts a PyObject to a pyMarkerGamePausedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long TimeLeft() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameResetMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameResetMsg();
|
||||
pyMarkerGameResetMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameResetMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameResetMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameResetMsg); // converts a PyObject to a pyMarkerGameResetMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameOverMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameOverMsg();
|
||||
pyMarkerGameOverMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameOverMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameOverMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameOverMsg); // converts a PyObject to a pyMarkerGameOverMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameNameChangedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameNameChangedMsg();
|
||||
pyMarkerGameNameChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameNameChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameNameChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameNameChangedMsg); // converts a PyObject to a pyMarkerGameNameChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring Name() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerTimeLimitChangedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerTimeLimitChangedMsg();
|
||||
pyMarkerTimeLimitChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerTimeLimitChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerTimeLimitChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerTimeLimitChangedMsg); // converts a PyObject to a pyMarkerTimeLimitChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long TimeLimit() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerGameDeletedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerGameDeletedMsg();
|
||||
pyMarkerGameDeletedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerGameDeletedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerGameDeletedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerGameDeletedMsg); // converts a PyObject to a pyMarkerGameDeletedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
bool Failed() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerMarkerAddedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerMarkerAddedMsg();
|
||||
pyMarkerMarkerAddedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerMarkerAddedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerMarkerAddedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerMarkerAddedMsg); // converts a PyObject to a pyMarkerMarkerAddedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
double X() const;
|
||||
double Y() const;
|
||||
double Z() const;
|
||||
unsigned long MarkerId() const;
|
||||
std::wstring Name() const;
|
||||
std::wstring Age() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerMarkerDeletedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerMarkerDeletedMsg();
|
||||
pyMarkerMarkerDeletedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerMarkerDeletedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerMarkerDeletedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerMarkerDeletedMsg); // converts a PyObject to a pyMarkerMarkerDeletedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long MarkerId() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerMarkerNameChangedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerMarkerNameChangedMsg();
|
||||
pyMarkerMarkerNameChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerMarkerNameChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerMarkerNameChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerMarkerNameChangedMsg); // converts a PyObject to a pyMarkerMarkerNameChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long MarkerId() const;
|
||||
std::wstring Name() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyMarkerMarkerCapturedMsg : public pyMarkerMsg
|
||||
{
|
||||
protected:
|
||||
pyMarkerMarkerCapturedMsg();
|
||||
pyMarkerMarkerCapturedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMarkerMarkerCapturedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMarkerMarkerCapturedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMarkerMarkerCapturedMsg); // converts a PyObject to a pyMarkerMarkerCapturedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long MarkerId() const;
|
||||
unsigned int Team() const;
|
||||
};
|
||||
|
||||
#endif // pyMarkerMsg_h
|
@ -0,0 +1,722 @@
|
||||
/*==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 "pyMarkerMsg.h"
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
#include <python.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base Marker msg class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerMsg, pyMarkerMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerMsg, pyMarkerMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMsg, getMarkerMsgType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GetMarkerMsgType());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMsg, upcastToFinalMarkerMsg)
|
||||
{
|
||||
return self->fThis->UpcastToFinalMarkerMsg();
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMsg, getMarkerMsgType, "Returns the type of the Marker message (see PtMarkerMsgTypes)"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMsg, upcastToFinalMarkerMsg, "Returns this message as the Marker message it is"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerMsg, pyGameCliMsg, "Base class for Marker game messages");
|
||||
PYTHON_EXPOSE_TYPE_DEFINITION(ptMarkerMsg, pyMarkerMsg);
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerMsg *newObj = (ptMarkerMsg*)ptMarkerMsg_type.tp_new(&ptMarkerMsg_type, NULL, NULL);
|
||||
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_Marker))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerMsg, pyMarkerMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerMsg, pyMarkerMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyMarkerMsg::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtMarkerMsgTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerTemplateCreated, kSrv2Cli_Marker_TemplateCreated);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerTeamAssigned, kSrv2Cli_Marker_TeamAssigned);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameType, kSrv2Cli_Marker_GameType);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameStarted, kSrv2Cli_Marker_GameStarted);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGamePaused, kSrv2Cli_Marker_GamePaused);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameReset, kSrv2Cli_Marker_GameReset);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameOver, kSrv2Cli_Marker_GameOver);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameNameChanged, kSrv2Cli_Marker_GameNameChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerTimeLimitChanged, kSrv2Cli_Marker_TimeLimitChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerGameDeleted, kSrv2Cli_Marker_GameDeleted);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerMarkerAdded, kSrv2Cli_Marker_MarkerAdded);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerMarkerDeleted, kSrv2Cli_Marker_MarkerDeleted);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerMarkerNameChanged, kSrv2Cli_Marker_MarkerNameChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtMarkerMsgTypes, kMarkerMarkerCaptured, kSrv2Cli_Marker_MarkerCaptured);
|
||||
PYTHON_ENUM_END(m, PtMarkerMsgTypes);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Game client message subclasses
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerTemplateCreatedMsg, pyMarkerTemplateCreatedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerTemplateCreatedMsg, pyMarkerTemplateCreatedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerTemplateCreatedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerTemplateCreatedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerTemplateCreatedMsg, templateID)
|
||||
{
|
||||
std::wstring retVal = self->fThis->TemplateID();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerTemplateCreatedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerTemplateCreatedMsg, templateID, "Returns the ID number of the template that was created"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerTemplateCreatedMsg, pyMarkerMsg, "Marker message received when a quest game template is created");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerTemplateCreatedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerTemplateCreatedMsg *newObj = (ptMarkerTemplateCreatedMsg*)ptMarkerTemplateCreatedMsg_type.tp_new(&ptMarkerTemplateCreatedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_TemplateCreated))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerTemplateCreatedMsg, pyMarkerTemplateCreatedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerTemplateCreatedMsg, pyMarkerTemplateCreatedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerTemplateCreatedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerTemplateCreatedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerTeamAssignedMsg, pyMarkerTeamAssignedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerTeamAssignedMsg, pyMarkerTeamAssignedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerTeamAssignedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerTeamAssignedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerTeamAssignedMsg, teamNumber)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->TeamNumber());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerTeamAssignedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerTeamAssignedMsg, teamNumber, "Returns the number of the team you were assigned to"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerTeamAssignedMsg, pyMarkerMsg, "Marker message received when you are assigned a team number");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerTeamAssignedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerTeamAssignedMsg *newObj = (ptMarkerTeamAssignedMsg*)ptMarkerTeamAssignedMsg_type.tp_new(&ptMarkerTeamAssignedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_TeamAssigned))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerTeamAssignedMsg, pyMarkerTeamAssignedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerTeamAssignedMsg, pyMarkerTeamAssignedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerTeamAssignedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerTeamAssignedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameTypeMsg, pyMarkerGameTypeMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameTypeMsg, pyMarkerGameTypeMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameTypeMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameTypeMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerGameTypeMsg, gameType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GameType());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameTypeMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerGameTypeMsg, gameType, "Returns the type of the game you just joined"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameTypeMsg, pyMarkerMsg, "Marker message received when you are assigned a team number");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameTypeMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameTypeMsg *newObj = (ptMarkerGameTypeMsg*)ptMarkerGameTypeMsg_type.tp_new(&ptMarkerGameTypeMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameType))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameTypeMsg, pyMarkerGameTypeMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameTypeMsg, pyMarkerGameTypeMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameTypeMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameTypeMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameStartedMsg, pyMarkerGameStartedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameStartedMsg, pyMarkerGameStartedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameStartedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameStartedMsg)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameStartedMsg)
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameStartedMsg, pyMarkerMsg, "Marker message received when the game is started by the owner");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameStartedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameStartedMsg *newObj = (ptMarkerGameStartedMsg*)ptMarkerGameStartedMsg_type.tp_new(&ptMarkerGameStartedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameStarted))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameStartedMsg, pyMarkerGameStartedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameStartedMsg, pyMarkerGameStartedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameStartedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameStartedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGamePausedMsg, pyMarkerGamePausedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGamePausedMsg, pyMarkerGamePausedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGamePausedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGamePausedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerGamePausedMsg, timeLeft)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->TimeLeft());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGamePausedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerGamePausedMsg, timeLeft, "Returns the amount of time left on the server clock"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGamePausedMsg, pyMarkerMsg, "Marker message received when the game is paused by the owner");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGamePausedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGamePausedMsg *newObj = (ptMarkerGamePausedMsg*)ptMarkerGamePausedMsg_type.tp_new(&ptMarkerGamePausedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GamePaused))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGamePausedMsg, pyMarkerGamePausedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGamePausedMsg, pyMarkerGamePausedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGamePausedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGamePausedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameResetMsg, pyMarkerGameResetMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameResetMsg, pyMarkerGameResetMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameResetMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameResetMsg)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameResetMsg)
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameResetMsg, pyMarkerMsg, "Marker message received when the game is reset by the owner");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameResetMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameResetMsg *newObj = (ptMarkerGameResetMsg*)ptMarkerGameResetMsg_type.tp_new(&ptMarkerGameResetMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameReset))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameResetMsg, pyMarkerGameResetMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameResetMsg, pyMarkerGameResetMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameResetMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameResetMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameOverMsg, pyMarkerGameOverMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameOverMsg, pyMarkerGameOverMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameOverMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameOverMsg)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameOverMsg)
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameOverMsg, pyMarkerMsg, "Marker message received when the server determines the game is over (usually via timeout)");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameOverMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameOverMsg *newObj = (ptMarkerGameOverMsg*)ptMarkerGameOverMsg_type.tp_new(&ptMarkerGameOverMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameOver))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameOverMsg, pyMarkerGameOverMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameOverMsg, pyMarkerGameOverMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameOverMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameOverMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameNameChangedMsg, pyMarkerGameNameChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameNameChangedMsg, pyMarkerGameNameChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameNameChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameNameChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerGameNameChangedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameNameChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerGameNameChangedMsg, name, "Returns the new game name"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameNameChangedMsg, pyMarkerMsg, "Marker message received when the game name is changed");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameNameChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameNameChangedMsg *newObj = (ptMarkerGameNameChangedMsg*)ptMarkerGameNameChangedMsg_type.tp_new(&ptMarkerGameNameChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameNameChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameNameChangedMsg, pyMarkerGameNameChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameNameChangedMsg, pyMarkerGameNameChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameNameChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameNameChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerTimeLimitChangedMsg, pyMarkerTimeLimitChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerTimeLimitChangedMsg, pyMarkerTimeLimitChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerTimeLimitChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerTimeLimitChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerTimeLimitChangedMsg, timeLimit)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->TimeLimit());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerTimeLimitChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerTimeLimitChangedMsg, timeLimit, "Returns the new time limit (in ms)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerTimeLimitChangedMsg, pyMarkerMsg, "Marker message received when the game name is changed");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerTimeLimitChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerTimeLimitChangedMsg *newObj = (ptMarkerTimeLimitChangedMsg*)ptMarkerTimeLimitChangedMsg_type.tp_new(&ptMarkerTimeLimitChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_TimeLimitChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerTimeLimitChangedMsg, pyMarkerTimeLimitChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerTimeLimitChangedMsg, pyMarkerTimeLimitChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerTimeLimitChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerTimeLimitChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerGameDeletedMsg, pyMarkerGameDeletedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerGameDeletedMsg, pyMarkerGameDeletedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerGameDeletedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerGameDeletedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerGameDeletedMsg, failed)
|
||||
{
|
||||
PYTHON_RETURN_BOOL(self->fThis->Failed());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerGameDeletedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerGameDeletedMsg, failed, "Returns whether the delete succeeded or not"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerGameDeletedMsg, pyMarkerMsg, "Marker message received when the game is deleted");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerGameDeletedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerGameDeletedMsg *newObj = (ptMarkerGameDeletedMsg*)ptMarkerGameDeletedMsg_type.tp_new(&ptMarkerGameDeletedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_GameDeleted))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerGameDeletedMsg, pyMarkerGameDeletedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerGameDeletedMsg, pyMarkerGameDeletedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerGameDeletedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerGameDeletedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerMarkerAddedMsg, pyMarkerMarkerAddedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerMarkerAddedMsg, pyMarkerMarkerAddedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerMarkerAddedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerMarkerAddedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, x)
|
||||
{
|
||||
return PyFloat_FromDouble(self->fThis->X());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, y)
|
||||
{
|
||||
return PyFloat_FromDouble(self->fThis->Y());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, z)
|
||||
{
|
||||
return PyFloat_FromDouble(self->fThis->Z());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, markerId)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->MarkerId());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerAddedMsg, age)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Age();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerMarkerAddedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, x, "Returns x coord of the marker"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, y, "Returns y coord of the marker"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, z, "Returns z coord of the marker"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, markerId, "Returns the id number of the marker"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, name, "Returns the name of the marker"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerAddedMsg, age, "Returns the age the marker was created in"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerMarkerAddedMsg, pyMarkerMsg, "Marker message received when a marker is added to the game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerMarkerAddedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerMarkerAddedMsg *newObj = (ptMarkerMarkerAddedMsg*)ptMarkerMarkerAddedMsg_type.tp_new(&ptMarkerMarkerAddedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_MarkerAdded))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerMarkerAddedMsg, pyMarkerMarkerAddedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerMarkerAddedMsg, pyMarkerMarkerAddedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerMarkerAddedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerMarkerAddedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerMarkerDeletedMsg, pyMarkerMarkerDeletedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerMarkerDeletedMsg, pyMarkerMarkerDeletedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerMarkerDeletedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerMarkerDeletedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerDeletedMsg, markerId)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->MarkerId());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerMarkerDeletedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerDeletedMsg, markerId, "Returns id of the marker that was deleted"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerMarkerDeletedMsg, pyMarkerMsg, "Marker message received when a marker is deleted");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerMarkerDeletedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerMarkerDeletedMsg *newObj = (ptMarkerMarkerDeletedMsg*)ptMarkerMarkerDeletedMsg_type.tp_new(&ptMarkerMarkerDeletedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_MarkerDeleted))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerMarkerDeletedMsg, pyMarkerMarkerDeletedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerMarkerDeletedMsg, pyMarkerMarkerDeletedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerMarkerDeletedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerMarkerDeletedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerMarkerNameChangedMsg, pyMarkerMarkerNameChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerMarkerNameChangedMsg, pyMarkerMarkerNameChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerMarkerNameChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerMarkerNameChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerNameChangedMsg, markerId)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->MarkerId());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerNameChangedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerMarkerNameChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerNameChangedMsg, markerId, "Returns id of the marker who's name was changed"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerNameChangedMsg, name, "Returns the new name"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerMarkerNameChangedMsg, pyMarkerMsg, "Marker message received when the name of a marker is changed");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerMarkerNameChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerMarkerNameChangedMsg *newObj = (ptMarkerMarkerNameChangedMsg*)ptMarkerMarkerNameChangedMsg_type.tp_new(&ptMarkerMarkerNameChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_MarkerNameChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerMarkerNameChangedMsg, pyMarkerMarkerNameChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerMarkerNameChangedMsg, pyMarkerMarkerNameChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerMarkerNameChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerMarkerNameChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptMarkerMarkerCapturedMsg, pyMarkerMarkerCapturedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptMarkerMarkerCapturedMsg, pyMarkerMarkerCapturedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptMarkerMarkerCapturedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptMarkerMarkerCapturedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerCapturedMsg, markerId)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->MarkerId());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMarkerCapturedMsg, team)
|
||||
{
|
||||
return PyInt_FromLong((long)self->fThis->Team());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptMarkerMarkerCapturedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerCapturedMsg, markerId, "Returns id of the marker which was captured"),
|
||||
PYTHON_METHOD_NOARGS(ptMarkerMarkerCapturedMsg, team, "Returns the team number of the team that captured it (0 for no team, or a quest game)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptMarkerMarkerCapturedMsg, pyMarkerMsg, "Marker message received when a marker is captured");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyMarkerMarkerCapturedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptMarkerMarkerCapturedMsg *newObj = (ptMarkerMarkerCapturedMsg*)ptMarkerMarkerCapturedMsg_type.tp_new(&ptMarkerMarkerNameChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_Marker_MarkerCaptured))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptMarkerMarkerCapturedMsg, pyMarkerMarkerCapturedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptMarkerMarkerCapturedMsg, pyMarkerMarkerCapturedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyMarkerMarkerCapturedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptMarkerMarkerCapturedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
Reference in New Issue
Block a user