2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-13 18:17:49 -04:00

Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin

This commit is contained in:
JWPlatt
2011-03-12 12:34:52 -05:00
commit a20a222fc2
3976 changed files with 1301356 additions and 0 deletions

View File

@ -0,0 +1,86 @@
/*==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/>.
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 "pyHeekGame.h"
///////////////////////////////////////////////////////////////////////////////
//
// Base Heek game client class
//
pyHeekGame::pyHeekGame(): pyGameCli() {}
pyHeekGame::pyHeekGame(pfGameCli* client): pyGameCli(client)
{
if (client && (client->GetGameTypeId() != kGameTypeId_Heek))
gameClient = nil; // wrong type, just clear it out
}
bool pyHeekGame::IsHeekGame(std::wstring guid)
{
Uuid gameUuid(guid.c_str());
return gameUuid == kGameTypeId_Heek;
}
void pyHeekGame::JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID)
{
pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_Heek, gameID, 0, NULL);
}
void pyHeekGame::PlayGame(int position, UInt32 points, std::wstring name)
{
if (gameClient)
{
pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient);
heek->PlayGame((unsigned)position, (dword)points, name.c_str());
}
}
void pyHeekGame::LeaveGame()
{
if (gameClient)
{
pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient);
heek->LeaveGame();
}
}
void pyHeekGame::Choose(int choice)
{
if (gameClient)
{
pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient);
heek->Choose((EHeekChoice)choice);
}
}
void pyHeekGame::SequenceFinished(int seq)
{
if (gameClient)
{
pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient);
heek->SequenceFinished((EHeekSeqFinished)seq);
}
}

View File

@ -0,0 +1,69 @@
/*==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/>.
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 pyHeekGame_h
#define pyHeekGame_h
/////////////////////////////////////////////////////////////////////////////
//
// NAME: pyHeekGame
//
// PURPOSE: Class wrapper for the Heek game client
//
#include "../pfGameMgr/pfGameMgr.h"
#include <python.h>
#include "../../pyGlueHelpers.h"
#include "../pyGameCli.h"
#include "../../pyKey.h"
class pyHeekGame : public pyGameCli
{
protected:
pyHeekGame();
pyHeekGame(pfGameCli* client);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekGame);
static PyObject* New(pfGameCli* client);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekGame object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekGame); // converts a PyObject to a pyHeekGame (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 IsHeekGame(std::wstring guid);
static void JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID);
void PlayGame(int position, UInt32 points, std::wstring name);
void LeaveGame();
void Choose(int choice);
void SequenceFinished(int seq);
};
#endif // pyHeekGame_h

View File

@ -0,0 +1,207 @@
/*==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/>.
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 "pyHeekGame.h"
#include <python.h>
#include "../../pyEnum.h"
///////////////////////////////////////////////////////////////////////////////
//
// Base Heek game client class
//
PYTHON_CLASS_DEFINITION(ptHeekGame, pyHeekGame);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekGame, pyHeekGame)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekGame)
PYTHON_NO_INIT_DEFINITION(ptHeekGame)
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsHeekGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a Heek game")
{
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame 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 = pyHeekGame::IsHeekGame(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 = pyHeekGame::IsHeekGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string");
PYTHON_RETURN_ERROR;
}
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtJoinCommonHeekGame, args, "Params: callbackKey, gameID\nJoins a common Heek game with the specified ID. If one doesn't exist, it creates it")
{
PyObject* callbackObj = NULL;
int gameID = 0;
if (!PyArg_ParseTuple(args, "Oi", &callbackObj, &gameID))
{
PyErr_SetString(PyExc_TypeError, "PtJoinCommonHeekGame expects a ptKey and an integer");
PYTHON_RETURN_ERROR;
}
if (!pyKey::Check(callbackObj))
{
PyErr_SetString(PyExc_TypeError, "PtJoinCommonHeekGame expects a ptKey and an integer");
PYTHON_RETURN_ERROR;
}
pyKey* key = pyKey::ConvertFrom(callbackObj);
pyHeekGame::JoinCommonHeekGame(*key, gameID);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptHeekGame, playGame, args)
{
int position = 0;
long points = 0;
PyObject* textObj = NULL;
if (!PyArg_ParseTuple(args,"ilO", &position, &points, &textObj))
{
PyErr_SetString(PyExc_TypeError, "playGame expects an int, a long, and a unicode string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen);
temp[strLen] = L'\0';
self->fThis->PlayGame(position, points, temp);
delete [] temp;
PYTHON_RETURN_NONE;
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* temp = PyString_AsString(textObj);
wchar_t* wTemp = hsStringToWString(temp);
self->fThis->PlayGame(position, points, wTemp);
delete [] wTemp;
PYTHON_RETURN_NONE;
}
else
{
PyErr_SetString(PyExc_TypeError, "playGame expects an int, a long, and a unicode string");
PYTHON_RETURN_ERROR;
}
}
PYTHON_BASIC_METHOD_DEFINITION(ptHeekGame, leaveGame, LeaveGame)
PYTHON_METHOD_DEFINITION(ptHeekGame, choose, args)
{
int choice = 0;
if (!PyArg_ParseTuple(args, "i", &choice))
{
PyErr_SetString(PyExc_TypeError, "choose expects an int");
PYTHON_RETURN_ERROR;
}
self->fThis->Choose(choice);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptHeekGame, sequenceFinished, args)
{
int seq = 0;
if (!PyArg_ParseTuple(args, "i", &seq))
{
PyErr_SetString(PyExc_TypeError, "sequenceFinished expects an int");
PYTHON_RETURN_ERROR;
}
self->fThis->SequenceFinished(seq);
PYTHON_RETURN_NONE;
}
PYTHON_START_METHODS_TABLE(ptHeekGame)
PYTHON_METHOD(ptHeekGame, playGame, "Params: position, points, name\nRequests to start playing the game in the specified position"),
PYTHON_BASIC_METHOD(ptHeekGame, leaveGame, "Leaves this game (puts us into \"observer\" mode"),
PYTHON_METHOD(ptHeekGame, choose, "Params: choice\nMakes the specified move (see PtHeekGameChoice)"),
PYTHON_METHOD(ptHeekGame, sequenceFinished, "Params: sequence\nTells the server that the specified animation finished (see PtHeekGameSeq)"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekGame, pyGameCli, "Game client for the Heek game");
// required functions for PyObject interoperability
PyObject* pyHeekGame::New(pfGameCli* client)
{
ptHeekGame *newObj = (ptHeekGame*)ptHeekGame_type.tp_new(&ptHeekGame_type, NULL, NULL);
if (client && (client->GetGameTypeId() == kGameTypeId_Heek))
newObj->fThis->gameClient = client;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekGame, pyHeekGame)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekGame, pyHeekGame)
// Module and method definitions
void pyHeekGame::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekGame);
PYTHON_CLASS_IMPORT_END(m);
}
void pyHeekGame::AddPlasmaConstantsClasses(PyObject* m)
{
PYTHON_ENUM_START(PtHeekGameChoice);
PYTHON_ENUM_ELEMENT(PtHeekGameChoice, kHeekGameChoiceRock, kHeekRock);
PYTHON_ENUM_ELEMENT(PtHeekGameChoice, kHeekGameChoicePaper, kHeekPaper);
PYTHON_ENUM_ELEMENT(PtHeekGameChoice, kHeekGameChoiceScissors, kHeekScissors);
PYTHON_ENUM_END(m, PtHeekGameChoice);
PYTHON_ENUM_START(PtHeekGameSeq);
PYTHON_ENUM_ELEMENT(PtHeekGameSeq, kHeekGameSeqCountdown, kHeekCountdownSeq);
PYTHON_ENUM_ELEMENT(PtHeekGameSeq, kHeekGameSeqChoiceAnim, kHeekChoiceAnimSeq);
PYTHON_ENUM_ELEMENT(PtHeekGameSeq, kHeekGameSeqGameWinAnim, kHeekGameWinAnimSeq);
PYTHON_ENUM_END(m, PtHeekGameSeq);
}
void pyHeekGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
{
PYTHON_GLOBAL_METHOD(methods, PtIsHeekGame);
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonHeekGame);
}

View File

@ -0,0 +1,386 @@
/*==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/>.
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 "pyHeekMsg.h"
///////////////////////////////////////////////////////////////////////////////
//
// Base Heek msg class
//
pyHeekMsg::pyHeekMsg(): pyGameCliMsg() {}
pyHeekMsg::pyHeekMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
{
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_Heek))
message = nil; // wrong type, just clear it out
}
int pyHeekMsg::GetHeekMsgType() const
{
if (message)
return message->netMsg->messageId;
return -1;
}
PyObject* pyHeekMsg::UpcastToFinalHeekMsg() const
{
if (!message)
PYTHON_RETURN_NONE;
switch (message->netMsg->messageId)
{
case kSrv2Cli_Heek_PlayGame:
return pyHeekPlayGameMsg::New(message);
case kSrv2Cli_Heek_Goodbye:
return pyHeekGoodbyeMsg::New(message);
case kSrv2Cli_Heek_Welcome:
return pyHeekWelcomeMsg::New(message);
case kSrv2Cli_Heek_Drop:
return pyHeekDropMsg::New(message);
case kSrv2Cli_Heek_Setup:
return pyHeekSetupMsg::New(message);
case kSrv2Cli_Heek_LightState:
return pyHeekLightStateMsg::New(message);
case kSrv2Cli_Heek_InterfaceState:
return pyHeekInterfaceStateMsg::New(message);
case kSrv2Cli_Heek_CountdownState:
return pyHeekCountdownStateMsg::New(message);
case kSrv2Cli_Heek_WinLose:
return pyHeekWinLoseMsg::New(message);
case kSrv2Cli_Heek_GameWin:
return pyHeekGameWinMsg::New(message);
case kSrv2Cli_Heek_PointUpdate:
return pyHeekPointUpdateMsg::New(message);
default:
PYTHON_RETURN_NONE;
}
}
///////////////////////////////////////////////////////////////////////////////
//
// The different messages we can receive
//
pyHeekPlayGameMsg::pyHeekPlayGameMsg(): pyHeekMsg() {}
pyHeekPlayGameMsg::pyHeekPlayGameMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_PlayGame))
message = nil; // wrong type, just clear it out
}
bool pyHeekPlayGameMsg::IsPlaying() const
{
if (message)
{
const Srv2Cli_Heek_PlayGame* gmMsg = (const Srv2Cli_Heek_PlayGame*)message->netMsg;
return gmMsg->isPlaying;
}
return false;
}
bool pyHeekPlayGameMsg::IsSinglePlayer() const
{
if (message)
{
const Srv2Cli_Heek_PlayGame* gmMsg = (const Srv2Cli_Heek_PlayGame*)message->netMsg;
return gmMsg->isSinglePlayer;
}
return false;
}
bool pyHeekPlayGameMsg::EnableButtons() const
{
if (message)
{
const Srv2Cli_Heek_PlayGame* gmMsg = (const Srv2Cli_Heek_PlayGame*)message->netMsg;
return gmMsg->enableButtons;
}
return false;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekGoodbyeMsg::pyHeekGoodbyeMsg(): pyHeekMsg() {}
pyHeekGoodbyeMsg::pyHeekGoodbyeMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_Goodbye))
message = nil; // wrong type, just clear it out
}
///////////////////////////////////////////////////////////////////////////////
pyHeekWelcomeMsg::pyHeekWelcomeMsg(): pyHeekMsg() {}
pyHeekWelcomeMsg::pyHeekWelcomeMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_Welcome))
message = nil; // wrong type, just clear it out
}
unsigned long pyHeekWelcomeMsg::Points() const
{
if (message)
{
const Srv2Cli_Heek_Welcome* gmMsg = (const Srv2Cli_Heek_Welcome*)message->netMsg;
return gmMsg->points;
}
return 0;
}
unsigned long pyHeekWelcomeMsg::Rank() const
{
if (message)
{
const Srv2Cli_Heek_Welcome* gmMsg = (const Srv2Cli_Heek_Welcome*)message->netMsg;
return gmMsg->rank;
}
return 0;
}
std::wstring pyHeekWelcomeMsg::Name() const
{
if (message)
{
const Srv2Cli_Heek_Welcome* gmMsg = (const Srv2Cli_Heek_Welcome*)message->netMsg;
return gmMsg->name;
}
return L"";
}
///////////////////////////////////////////////////////////////////////////////
pyHeekDropMsg::pyHeekDropMsg(): pyHeekMsg() {}
pyHeekDropMsg::pyHeekDropMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_Drop))
message = nil; // wrong type, just clear it out
}
int pyHeekDropMsg::Position() const
{
if (message)
{
const Srv2Cli_Heek_Drop* gmMsg = (const Srv2Cli_Heek_Drop*)message->netMsg;
return gmMsg->position;
}
return -1;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekSetupMsg::pyHeekSetupMsg(): pyHeekMsg() {}
pyHeekSetupMsg::pyHeekSetupMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_Welcome))
message = nil; // wrong type, just clear it out
}
int pyHeekSetupMsg::Position() const
{
if (message)
{
const Srv2Cli_Heek_Setup* gmMsg = (const Srv2Cli_Heek_Setup*)message->netMsg;
return gmMsg->position;
}
return -1;
}
bool pyHeekSetupMsg::ButtonState() const
{
if (message)
{
const Srv2Cli_Heek_Setup* gmMsg = (const Srv2Cli_Heek_Setup*)message->netMsg;
return gmMsg->buttonState;
}
return false;
}
std::vector<bool> pyHeekSetupMsg::LightOn() const
{
std::vector<bool> retVal;
if (message)
{
const Srv2Cli_Heek_Setup* gmMsg = (const Srv2Cli_Heek_Setup*)message->netMsg;
int numLights = arrsize(gmMsg->lightOn);
for (int i = 0; i < numLights; ++i)
retVal.push_back(gmMsg->lightOn[i]);
return retVal;
}
return retVal;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekLightStateMsg::pyHeekLightStateMsg(): pyHeekMsg() {}
pyHeekLightStateMsg::pyHeekLightStateMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_LightState))
message = nil; // wrong type, just clear it out
}
int pyHeekLightStateMsg::LightNum() const
{
if (message)
{
const Srv2Cli_Heek_LightState* gmMsg = (const Srv2Cli_Heek_LightState*)message->netMsg;
return gmMsg->lightNum;
}
return -1;
}
int pyHeekLightStateMsg::State() const
{
if (message)
{
const Srv2Cli_Heek_LightState* gmMsg = (const Srv2Cli_Heek_LightState*)message->netMsg;
return gmMsg->state;
}
return -1;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekInterfaceStateMsg::pyHeekInterfaceStateMsg(): pyHeekMsg() {}
pyHeekInterfaceStateMsg::pyHeekInterfaceStateMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_InterfaceState))
message = nil; // wrong type, just clear it out
}
bool pyHeekInterfaceStateMsg::ButtonsEnabled() const
{
if (message)
{
const Srv2Cli_Heek_InterfaceState* gmMsg = (const Srv2Cli_Heek_InterfaceState*)message->netMsg;
return gmMsg->buttonsEnabled;
}
return false;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekCountdownStateMsg::pyHeekCountdownStateMsg(): pyHeekMsg() {}
pyHeekCountdownStateMsg::pyHeekCountdownStateMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_CountdownState))
message = nil; // wrong type, just clear it out
}
int pyHeekCountdownStateMsg::State() const
{
if (message)
{
const Srv2Cli_Heek_CountdownState* gmMsg = (const Srv2Cli_Heek_CountdownState*)message->netMsg;
return gmMsg->state;
}
return false;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekWinLoseMsg::pyHeekWinLoseMsg(): pyHeekMsg() {}
pyHeekWinLoseMsg::pyHeekWinLoseMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_WinLose))
message = nil; // wrong type, just clear it out
}
bool pyHeekWinLoseMsg::Win() const
{
if (message)
{
const Srv2Cli_Heek_WinLose* gmMsg = (const Srv2Cli_Heek_WinLose*)message->netMsg;
return gmMsg->win;
}
return false;
}
int pyHeekWinLoseMsg::Choice() const
{
if (message)
{
const Srv2Cli_Heek_WinLose* gmMsg = (const Srv2Cli_Heek_WinLose*)message->netMsg;
return gmMsg->choice;
}
return -1;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekGameWinMsg::pyHeekGameWinMsg(): pyHeekMsg() {}
pyHeekGameWinMsg::pyHeekGameWinMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_GameWin))
message = nil; // wrong type, just clear it out
}
int pyHeekGameWinMsg::Choice() const
{
if (message)
{
const Srv2Cli_Heek_GameWin* gmMsg = (const Srv2Cli_Heek_GameWin*)message->netMsg;
return gmMsg->choice;
}
return -1;
}
///////////////////////////////////////////////////////////////////////////////
pyHeekPointUpdateMsg::pyHeekPointUpdateMsg(): pyHeekMsg() {}
pyHeekPointUpdateMsg::pyHeekPointUpdateMsg(pfGameCliMsg* msg): pyHeekMsg(msg)
{
if (message && (message->netMsg->messageId != kSrv2Cli_Heek_PointUpdate))
message = nil; // wrong type, just clear it out
}
bool pyHeekPointUpdateMsg::DisplayUpdate() const
{
if (message)
{
const Srv2Cli_Heek_PointUpdate* gmMsg = (const Srv2Cli_Heek_PointUpdate*)message->netMsg;
return gmMsg->displayUpdate;
}
return false;
}
unsigned long pyHeekPointUpdateMsg::Points() const
{
if (message)
{
const Srv2Cli_Heek_PointUpdate* gmMsg = (const Srv2Cli_Heek_PointUpdate*)message->netMsg;
return gmMsg->points;
}
return 0;
}
unsigned long pyHeekPointUpdateMsg::Rank() const
{
if (message)
{
const Srv2Cli_Heek_PointUpdate* gmMsg = (const Srv2Cli_Heek_PointUpdate*)message->netMsg;
return gmMsg->rank;
}
return 0;
}

View File

@ -0,0 +1,283 @@
/*==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/>.
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 pyHeekMsg_h
#define pyHeekMsg_h
/////////////////////////////////////////////////////////////////////////////
//
// NAME: pyHeekMsg
//
// PURPOSE: Class wrapper for Heek game messages
//
#include "../pfGameMgr/pfGameMgr.h"
#include <python.h>
#include "../../pyGlueHelpers.h"
#include "../pyGameCliMsg.h"
class pyHeekMsg : public pyGameCliMsg
{
protected:
pyHeekMsg();
pyHeekMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_EXPOSE_TYPE; // so we can subclass
PYTHON_CLASS_NEW_FRIEND(ptHeekMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekMsg); // converts a PyObject to a pyHeekMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaConstantsClasses(PyObject* m);
int GetHeekMsgType() const;
PyObject* UpcastToFinalHeekMsg() const; // returns the heek message this really is
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekPlayGameMsg : public pyHeekMsg
{
protected:
pyHeekPlayGameMsg();
pyHeekPlayGameMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekPlayGameMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekPlayGameMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekPlayGameMsg); // converts a PyObject to a pyHeekPlayGameMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
bool IsPlaying() const;
bool IsSinglePlayer() const;
bool EnableButtons() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekGoodbyeMsg : public pyHeekMsg
{
protected:
pyHeekGoodbyeMsg();
pyHeekGoodbyeMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekGoodbyeMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekGoodbyeMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekGoodbyeMsg); // converts a PyObject to a pyHeekGoodbyeMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekWelcomeMsg : public pyHeekMsg
{
protected:
pyHeekWelcomeMsg();
pyHeekWelcomeMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekWelcomeMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekWelcomeMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekWelcomeMsg); // converts a PyObject to a pyHeekWelcomeMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
unsigned long Points() const;
unsigned long Rank() const;
std::wstring Name() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekDropMsg : public pyHeekMsg
{
protected:
pyHeekDropMsg();
pyHeekDropMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekDropMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekDropMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekDropMsg); // converts a PyObject to a pyHeekDropMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
int Position() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekSetupMsg : public pyHeekMsg
{
protected:
pyHeekSetupMsg();
pyHeekSetupMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekSetupMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekSetupMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekSetupMsg); // converts a PyObject to a pyHeekSetupMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
int Position() const;
bool ButtonState() const;
std::vector<bool> LightOn() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekLightStateMsg : public pyHeekMsg
{
protected:
pyHeekLightStateMsg();
pyHeekLightStateMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekLightStateMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekLightStateMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekLightStateMsg); // converts a PyObject to a pyHeekLightStateMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaConstantsClasses(PyObject* m);
int LightNum() const;
int State() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekInterfaceStateMsg : public pyHeekMsg
{
protected:
pyHeekInterfaceStateMsg();
pyHeekInterfaceStateMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekInterfaceStateMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekInterfaceStateMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekInterfaceStateMsg); // converts a PyObject to a pyHeekInterfaceStateMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
bool ButtonsEnabled() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekCountdownStateMsg : public pyHeekMsg
{
protected:
pyHeekCountdownStateMsg();
pyHeekCountdownStateMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekCountdownStateMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekCountdownStateMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekCountdownStateMsg); // converts a PyObject to a pyHeekCountdownStateMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaConstantsClasses(PyObject* m);
int State() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekWinLoseMsg : public pyHeekMsg
{
protected:
pyHeekWinLoseMsg();
pyHeekWinLoseMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekWinLoseMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekWinLoseMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekWinLoseMsg); // converts a PyObject to a pyHeekWinLoseMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
bool Win() const;
int Choice() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekGameWinMsg : public pyHeekMsg
{
protected:
pyHeekGameWinMsg();
pyHeekGameWinMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekGameWinMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekGameWinMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekGameWinMsg); // converts a PyObject to a pyHeekGameWinMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
int Choice() const;
};
///////////////////////////////////////////////////////////////////////////////
class pyHeekPointUpdateMsg : public pyHeekMsg
{
protected:
pyHeekPointUpdateMsg();
pyHeekPointUpdateMsg(pfGameCliMsg* msg);
public:
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptHeekPointUpdateMsg);
static PyObject* New(pfGameCliMsg* msg);
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyHeekPointUpdateMsg object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyHeekPointUpdateMsg); // converts a PyObject to a pyHeekPointUpdateMsg (throws error if not correct type)
static void AddPlasmaClasses(PyObject* m);
bool DisplayUpdate() const;
unsigned long Points() const;
unsigned long Rank() const;
};
#endif // pyHeekMsg_h

View File

@ -0,0 +1,618 @@
/*==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/>.
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 "pyHeekMsg.h"
#include "../../pyEnum.h"
#include <python.h>
///////////////////////////////////////////////////////////////////////////////
//
// Base Heek msg class
//
PYTHON_CLASS_DEFINITION(ptHeekMsg, pyHeekMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekMsg, pyHeekMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekMsg, getHeekMsgType)
{
return PyInt_FromLong(self->fThis->GetHeekMsgType());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekMsg, upcastToFinalHeekMsg)
{
return self->fThis->UpcastToFinalHeekMsg();
}
PYTHON_START_METHODS_TABLE(ptHeekMsg)
PYTHON_METHOD_NOARGS(ptHeekMsg, getHeekMsgType, "Returns the type of the Heek message (see PtHeekMsgTypes)"),
PYTHON_METHOD_NOARGS(ptHeekMsg, upcastToFinalHeekMsg, "Returns this message as the Heek message it is"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekMsg, pyGameCliMsg, "Base class for Heek game messages");
PYTHON_EXPOSE_TYPE_DEFINITION(ptHeekMsg, pyHeekMsg);
// required functions for PyObject interoperability
PyObject* pyHeekMsg::New(pfGameCliMsg* msg)
{
ptHeekMsg *newObj = (ptHeekMsg*)ptHeekMsg_type.tp_new(&ptHeekMsg_type, NULL, NULL);
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_Heek))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekMsg, pyHeekMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekMsg, pyHeekMsg)
// Module and method definitions
void pyHeekMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekMsg);
PYTHON_CLASS_IMPORT_END(m);
}
void pyHeekMsg::AddPlasmaConstantsClasses(PyObject* m)
{
PYTHON_ENUM_START(PtHeekMsgTypes);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekPlayGame, kSrv2Cli_Heek_PlayGame);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekGoodbye, kSrv2Cli_Heek_Goodbye);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekWelcome, kSrv2Cli_Heek_Welcome);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekDrop, kSrv2Cli_Heek_Drop);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekSetup, kSrv2Cli_Heek_Setup);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekLightState, kSrv2Cli_Heek_LightState);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekInterfaceState, kSrv2Cli_Heek_InterfaceState);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekCountdownState, kSrv2Cli_Heek_CountdownState);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekWinLose, kSrv2Cli_Heek_WinLose);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekGameWin, kSrv2Cli_Heek_GameWin);
PYTHON_ENUM_ELEMENT(PtHeekMsgTypes, kHeekPointUpdate, kSrv2Cli_Heek_PointUpdate);
PYTHON_ENUM_END(m, PtHeekMsgTypes);
}
///////////////////////////////////////////////////////////////////////////////
//
// Game client message subclasses
//
PYTHON_CLASS_DEFINITION(ptHeekPlayGameMsg, pyHeekPlayGameMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekPlayGameMsg, pyHeekPlayGameMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekPlayGameMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekPlayGameMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPlayGameMsg, isPlaying)
{
PYTHON_RETURN_BOOL(self->fThis->IsPlaying());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPlayGameMsg, isSinglePlayer)
{
PYTHON_RETURN_BOOL(self->fThis->IsSinglePlayer());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPlayGameMsg, enableButtons)
{
PYTHON_RETURN_BOOL(self->fThis->EnableButtons())
}
PYTHON_START_METHODS_TABLE(ptHeekPlayGameMsg)
PYTHON_METHOD_NOARGS(ptHeekPlayGameMsg, isPlaying, "Returns true if the server accepted the play game request"),
PYTHON_METHOD_NOARGS(ptHeekPlayGameMsg, isSinglePlayer, "Returns true if you are the only player at the table"),
PYTHON_METHOD_NOARGS(ptHeekPlayGameMsg, enableButtons, "Returns true if we should enable the buttons at the place we sat down"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekPlayGameMsg, pyHeekMsg, "Heek message received when the server processes your play game request");
// required functions for PyObject interoperability
PyObject* pyHeekPlayGameMsg::New(pfGameCliMsg* msg)
{
ptHeekPlayGameMsg *newObj = (ptHeekPlayGameMsg*)ptHeekPlayGameMsg_type.tp_new(&ptHeekPlayGameMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_PlayGame))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekPlayGameMsg, pyHeekPlayGameMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekPlayGameMsg, pyHeekPlayGameMsg)
// Module and method definitions
void pyHeekPlayGameMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekPlayGameMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekGoodbyeMsg, pyHeekGoodbyeMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekGoodbyeMsg, pyHeekGoodbyeMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekGoodbyeMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekGoodbyeMsg)
PYTHON_START_METHODS_TABLE(ptHeekGoodbyeMsg)
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekGoodbyeMsg, pyHeekMsg, "Heek message received when the server processes leave request");
// required functions for PyObject interoperability
PyObject* pyHeekGoodbyeMsg::New(pfGameCliMsg* msg)
{
ptHeekGoodbyeMsg *newObj = (ptHeekGoodbyeMsg*)ptHeekGoodbyeMsg_type.tp_new(&ptHeekGoodbyeMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_Goodbye))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekGoodbyeMsg, pyHeekGoodbyeMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekGoodbyeMsg, pyHeekGoodbyeMsg)
// Module and method definitions
void pyHeekGoodbyeMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekGoodbyeMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekWelcomeMsg, pyHeekWelcomeMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekWelcomeMsg, pyHeekWelcomeMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekWelcomeMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekWelcomeMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekWelcomeMsg, points)
{
return PyLong_FromUnsignedLong(self->fThis->Points());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekWelcomeMsg, rank)
{
return PyLong_FromUnsignedLong(self->fThis->Rank());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekWelcomeMsg, name)
{
std::wstring retVal = self->fThis->Name();
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
}
PYTHON_START_METHODS_TABLE(ptHeekWelcomeMsg)
PYTHON_METHOD_NOARGS(ptHeekWelcomeMsg, points, "Returns the new player's points"),
PYTHON_METHOD_NOARGS(ptHeekWelcomeMsg, rank, "Returns the new player's rank"),
PYTHON_METHOD_NOARGS(ptHeekWelcomeMsg, name, "Returns the new player's name"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekWelcomeMsg, pyHeekMsg, "Heek message received when a new player sits down");
// required functions for PyObject interoperability
PyObject* pyHeekWelcomeMsg::New(pfGameCliMsg* msg)
{
ptHeekWelcomeMsg *newObj = (ptHeekWelcomeMsg*)ptHeekWelcomeMsg_type.tp_new(&ptHeekWelcomeMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_Welcome))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekWelcomeMsg, pyHeekWelcomeMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekWelcomeMsg, pyHeekWelcomeMsg)
// Module and method definitions
void pyHeekWelcomeMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekWelcomeMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekDropMsg, pyHeekDropMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekDropMsg, pyHeekDropMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekDropMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekDropMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekDropMsg, position)
{
return PyLong_FromUnsignedLong(self->fThis->Position());
}
PYTHON_START_METHODS_TABLE(ptHeekDropMsg)
PYTHON_METHOD_NOARGS(ptHeekDropMsg, position, "Returns player position to cleanup and dump"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekDropMsg, pyHeekMsg, "Heek message received when another player's position needs to be reset/modified");
// required functions for PyObject interoperability
PyObject* pyHeekDropMsg::New(pfGameCliMsg* msg)
{
ptHeekDropMsg *newObj = (ptHeekDropMsg*)ptHeekDropMsg_type.tp_new(&ptHeekDropMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_Drop))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekDropMsg, pyHeekDropMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekDropMsg, pyHeekDropMsg)
// Module and method definitions
void pyHeekDropMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekDropMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekSetupMsg, pyHeekSetupMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekSetupMsg, pyHeekSetupMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekSetupMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekSetupMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekSetupMsg, position)
{
return PyInt_FromLong(self->fThis->Position());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekSetupMsg, buttonState)
{
PYTHON_RETURN_BOOL(self->fThis->ButtonState());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekSetupMsg, lightOn)
{
std::vector<bool> lights = self->fThis->LightOn();
PyObject* retVal = PyList_New(lights.size());
for (unsigned i = 0; i < lights.size(); ++i)
PyList_SetItem(retVal, i, PyInt_FromLong(lights[i] ? 1 : 0));
return retVal;
}
PYTHON_START_METHODS_TABLE(ptHeekSetupMsg)
PYTHON_METHOD_NOARGS(ptHeekSetupMsg, position, "Returns the position this message is for"),
PYTHON_METHOD_NOARGS(ptHeekSetupMsg, buttonState, "Returns whether the buttons are enabled or not"),
PYTHON_METHOD_NOARGS(ptHeekSetupMsg, lightOn, "Returns a list of bools representing lights on or off"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekSetupMsg, pyHeekMsg, "Heek message for setting up each position's state");
// required functions for PyObject interoperability
PyObject* pyHeekSetupMsg::New(pfGameCliMsg* msg)
{
ptHeekSetupMsg *newObj = (ptHeekSetupMsg*)ptHeekSetupMsg_type.tp_new(&ptHeekSetupMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_Setup))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekSetupMsg, pyHeekSetupMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekSetupMsg, pyHeekSetupMsg)
// Module and method definitions
void pyHeekSetupMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekSetupMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekLightStateMsg, pyHeekLightStateMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekLightStateMsg, pyHeekLightStateMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekLightStateMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekLightStateMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekLightStateMsg, lightNum)
{
return PyInt_FromLong(self->fThis->LightNum());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekLightStateMsg, state)
{
return PyInt_FromLong(self->fThis->State());
}
PYTHON_START_METHODS_TABLE(ptHeekLightStateMsg)
PYTHON_METHOD_NOARGS(ptHeekLightStateMsg, lightNum, "Returns the index of the light this refers to"),
PYTHON_METHOD_NOARGS(ptHeekLightStateMsg, state, "Returns state the light should be switched to (see PtHeekLightStates)"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekLightStateMsg, pyHeekMsg, "Heek message received when one of your local lights needs to change state");
// required functions for PyObject interoperability
PyObject* pyHeekLightStateMsg::New(pfGameCliMsg* msg)
{
ptHeekLightStateMsg *newObj = (ptHeekLightStateMsg*)ptHeekLightStateMsg_type.tp_new(&ptHeekLightStateMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_LightState))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekLightStateMsg, pyHeekLightStateMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekLightStateMsg, pyHeekLightStateMsg)
// Module and method definitions
void pyHeekLightStateMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekLightStateMsg);
PYTHON_CLASS_IMPORT_END(m);
}
void pyHeekLightStateMsg::AddPlasmaConstantsClasses(PyObject* m)
{
PYTHON_ENUM_START(PtHeekLightStates);
PYTHON_ENUM_ELEMENT(PtHeekLightStates, kHeekLightOn, kHeekLightOn);
PYTHON_ENUM_ELEMENT(PtHeekLightStates, kHeekLightOff, kHeekLightOff);
PYTHON_ENUM_ELEMENT(PtHeekLightStates, kHeekLightFlash, kHeekLightFlash);
PYTHON_ENUM_END(m, PtHeekLightStates);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekInterfaceStateMsg, pyHeekInterfaceStateMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekInterfaceStateMsg, pyHeekInterfaceStateMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekInterfaceStateMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekInterfaceStateMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekInterfaceStateMsg, buttonsEnabled)
{
PYTHON_RETURN_BOOL(self->fThis->ButtonsEnabled());
}
PYTHON_START_METHODS_TABLE(ptHeekInterfaceStateMsg)
PYTHON_METHOD_NOARGS(ptHeekInterfaceStateMsg, buttonsEnabled, "Returns whether your buttons should be enabled"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekInterfaceStateMsg, pyHeekMsg, "Heek message received when your interface buttons need to enable or disable");
// required functions for PyObject interoperability
PyObject* pyHeekInterfaceStateMsg::New(pfGameCliMsg* msg)
{
ptHeekInterfaceStateMsg *newObj = (ptHeekInterfaceStateMsg*)ptHeekInterfaceStateMsg_type.tp_new(&ptHeekInterfaceStateMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_InterfaceState))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekInterfaceStateMsg, pyHeekInterfaceStateMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekInterfaceStateMsg, pyHeekInterfaceStateMsg)
// Module and method definitions
void pyHeekInterfaceStateMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekInterfaceStateMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekCountdownStateMsg, pyHeekCountdownStateMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekCountdownStateMsg, pyHeekCountdownStateMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekCountdownStateMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekCountdownStateMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekCountdownStateMsg, state)
{
return PyInt_FromLong(self->fThis->State());
}
PYTHON_START_METHODS_TABLE(ptHeekCountdownStateMsg)
PYTHON_METHOD_NOARGS(ptHeekCountdownStateMsg, state, "Returns state the countdown should be switched to (see PtHeekCountdownStates)"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekCountdownStateMsg, pyHeekMsg, "Heek message received by game admin when the countdown state needs to change");
// required functions for PyObject interoperability
PyObject* pyHeekCountdownStateMsg::New(pfGameCliMsg* msg)
{
ptHeekCountdownStateMsg *newObj = (ptHeekCountdownStateMsg*)ptHeekCountdownStateMsg_type.tp_new(&ptHeekCountdownStateMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_CountdownState))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekCountdownStateMsg, pyHeekCountdownStateMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekCountdownStateMsg, pyHeekCountdownStateMsg)
// Module and method definitions
void pyHeekCountdownStateMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekCountdownStateMsg);
PYTHON_CLASS_IMPORT_END(m);
}
void pyHeekCountdownStateMsg::AddPlasmaConstantsClasses(PyObject* m)
{
PYTHON_ENUM_START(PtHeekCountdownStates);
PYTHON_ENUM_ELEMENT(PtHeekCountdownStates, kHeekCountdownStart, kHeekCountdownStart);
PYTHON_ENUM_ELEMENT(PtHeekCountdownStates, kHeekCountdownStop, kHeekCountdownStop);
PYTHON_ENUM_ELEMENT(PtHeekCountdownStates, kHeekCountdownIdle, kHeekCountdownIdle);
PYTHON_ENUM_END(m, PtHeekCountdownStates);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekWinLoseMsg, pyHeekWinLoseMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekWinLoseMsg, pyHeekWinLoseMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekWinLoseMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekWinLoseMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekWinLoseMsg, win)
{
PYTHON_RETURN_BOOL(self->fThis->Win());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekWinLoseMsg, choice)
{
return PyInt_FromLong(self->fThis->Choice());
}
PYTHON_START_METHODS_TABLE(ptHeekWinLoseMsg)
PYTHON_METHOD_NOARGS(ptHeekWinLoseMsg, win, "Returns true if you won"),
PYTHON_METHOD_NOARGS(ptHeekWinLoseMsg, choice, "Returns the choice that won or lost (see PtHeekGameChoice)"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekWinLoseMsg, pyHeekMsg, "Heek message received when the round is over and you won or lost");
// required functions for PyObject interoperability
PyObject* pyHeekWinLoseMsg::New(pfGameCliMsg* msg)
{
ptHeekWinLoseMsg *newObj = (ptHeekWinLoseMsg*)ptHeekWinLoseMsg_type.tp_new(&ptHeekWinLoseMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_WinLose))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekWinLoseMsg, pyHeekWinLoseMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekWinLoseMsg, pyHeekWinLoseMsg)
// Module and method definitions
void pyHeekWinLoseMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekWinLoseMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekGameWinMsg, pyHeekGameWinMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekGameWinMsg, pyHeekGameWinMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekGameWinMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekGameWinMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekGameWinMsg, choice)
{
return PyInt_FromLong(self->fThis->Choice());
}
PYTHON_START_METHODS_TABLE(ptHeekGameWinMsg)
PYTHON_METHOD_NOARGS(ptHeekGameWinMsg, choice, "Returns the choice that won (see PtHeekGameChoice)"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekGameWinMsg, pyHeekMsg, "Heek message received by game admin when a game is won");
// required functions for PyObject interoperability
PyObject* pyHeekGameWinMsg::New(pfGameCliMsg* msg)
{
ptHeekGameWinMsg *newObj = (ptHeekGameWinMsg*)ptHeekGameWinMsg_type.tp_new(&ptHeekGameWinMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_GameWin))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekGameWinMsg, pyHeekGameWinMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekGameWinMsg, pyHeekGameWinMsg)
// Module and method definitions
void pyHeekGameWinMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekGameWinMsg);
PYTHON_CLASS_IMPORT_END(m);
}
///////////////////////////////////////////////////////////////////////////////
PYTHON_CLASS_DEFINITION(ptHeekPointUpdateMsg, pyHeekPointUpdateMsg);
PYTHON_DEFAULT_NEW_DEFINITION(ptHeekPointUpdateMsg, pyHeekPointUpdateMsg)
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptHeekPointUpdateMsg)
PYTHON_NO_INIT_DEFINITION(ptHeekPointUpdateMsg)
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPointUpdateMsg, displayUpdate)
{
PYTHON_RETURN_BOOL(self->fThis->DisplayUpdate());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPointUpdateMsg, points)
{
return PyLong_FromUnsignedLong(self->fThis->Points());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptHeekPointUpdateMsg, rank)
{
return PyLong_FromUnsignedLong(self->fThis->Rank());
}
PYTHON_START_METHODS_TABLE(ptHeekPointUpdateMsg)
PYTHON_METHOD_NOARGS(ptHeekPointUpdateMsg, displayUpdate, "Returns whether you should display a message to the user"),
PYTHON_METHOD_NOARGS(ptHeekPointUpdateMsg, points, "Returns your new amount of points"),
PYTHON_METHOD_NOARGS(ptHeekPointUpdateMsg, rank, "Returns your new rank"),
PYTHON_END_METHODS_TABLE;
// Type structure definition
PLASMA_DEFAULT_TYPE_WBASE(ptHeekPointUpdateMsg, pyHeekMsg, "Heek message received when the number of points you have needs to be changed");
// required functions for PyObject interoperability
PyObject* pyHeekPointUpdateMsg::New(pfGameCliMsg* msg)
{
ptHeekPointUpdateMsg *newObj = (ptHeekPointUpdateMsg*)ptHeekPointUpdateMsg_type.tp_new(&ptHeekPointUpdateMsg_type, NULL, NULL);
if (msg && (msg->netMsg->messageId == kSrv2Cli_Heek_PointUpdate))
newObj->fThis->message = msg;
return (PyObject*)newObj;
}
PYTHON_CLASS_CHECK_IMPL(ptHeekPointUpdateMsg, pyHeekPointUpdateMsg)
PYTHON_CLASS_CONVERT_FROM_IMPL(ptHeekPointUpdateMsg, pyHeekPointUpdateMsg)
// Module and method definitions
void pyHeekPointUpdateMsg::AddPlasmaClasses(PyObject* m)
{
PYTHON_CLASS_IMPORT_START(m);
PYTHON_CLASS_IMPORT(m, ptHeekPointUpdateMsg);
PYTHON_CLASS_IMPORT_END(m);
}