feat: add POINT_GEM (248) player binding and initialization fix (Stage 6)
- Add POINT_GEM = 248 point type constant in Packet.h - Add player.GetGem() and export POINT_GEM/GEM constants in PythonPlayerModule - Fix CPythonPlayer constructor to explicitly call Clear() ensuring clean initial player status - Add test assertions for player.GetGem() and player.POINT_GEM in port_python_ui_modules_test
This commit is contained in:
@@ -1729,6 +1729,7 @@ enum EPointTypes
|
||||
POINT_MAX_MAGIC_WEP,
|
||||
POINT_HIT_RATE,
|
||||
|
||||
POINT_GEM = 248,
|
||||
|
||||
//POINT_MAX_NUM = 255,=>stdafx.h 로/
|
||||
};
|
||||
|
||||
@@ -1836,6 +1836,7 @@ void CPythonPlayer::Clear()
|
||||
|
||||
CPythonPlayer::CPythonPlayer(void)
|
||||
{
|
||||
Clear();
|
||||
SetMovableGroundDistance(40.0f);
|
||||
|
||||
// AffectIndex To SkillIndex
|
||||
|
||||
@@ -605,6 +605,11 @@ PyObject * playerGetStatus(PyObject* poSelf, PyObject* poArgs)
|
||||
return Py_BuildValue("i", iValue);
|
||||
}
|
||||
|
||||
PyObject * playerGetGem(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonPlayer::Instance().GetStatus(POINT_GEM));
|
||||
}
|
||||
|
||||
PyObject * playerSetStatus(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iType;
|
||||
@@ -2438,6 +2443,7 @@ void initPlayer()
|
||||
{ "AffectIndexToSkillIndex", playerAffectIndexToSkillIndex, METH_VARARGS },
|
||||
{ "GetEXP", playerGetEXP, METH_VARARGS },
|
||||
{ "GetStatus", playerGetStatus, METH_VARARGS },
|
||||
{ "GetGem", playerGetGem, METH_VARARGS },
|
||||
{ "SetStatus", playerSetStatus, METH_VARARGS },
|
||||
{ "GetElk", playerGetElk, METH_VARARGS },
|
||||
{ "GetMoney", playerGetElk, METH_VARARGS },
|
||||
@@ -2547,6 +2553,8 @@ void initPlayer()
|
||||
PyModule_AddIntConstant(poModule, "STAMINA", POINT_STAMINA);
|
||||
PyModule_AddIntConstant(poModule, "MAX_STAMINA", POINT_MAX_STAMINA);
|
||||
PyModule_AddIntConstant(poModule, "ELK", POINT_GOLD);
|
||||
PyModule_AddIntConstant(poModule, "POINT_GEM", POINT_GEM);
|
||||
PyModule_AddIntConstant(poModule, "GEM", POINT_GEM);
|
||||
PyModule_AddIntConstant(poModule, "ST", POINT_ST);
|
||||
PyModule_AddIntConstant(poModule, "HT", POINT_HT);
|
||||
PyModule_AddIntConstant(poModule, "DX", POINT_DX);
|
||||
|
||||
@@ -51,11 +51,16 @@ int main(int argc, char** argv)
|
||||
CPythonPlayer::Instance().SetGold64(123456789012345LL);
|
||||
assert(CPythonPlayer::Instance().GetGold64() == 123456789012345LL);
|
||||
assert(CPythonPlayer::Instance().GetStatus(POINT_GOLD) == 2000000000);
|
||||
CPythonPlayer::Instance().SetStatus(POINT_GEM, 1234);
|
||||
assert(CPythonPlayer::Instance().GetStatus(POINT_GEM) == 1234);
|
||||
if (!launcher.RunLine(
|
||||
"import player, item, chrmgr, app\n"
|
||||
"gold = player.GetElk()\n"
|
||||
"assert gold == 123456789012345L, 'GetElk mismatch: %r' % gold\n"
|
||||
"assert player.GetGold64() == 123456789012345L\n"
|
||||
"assert hasattr(player, 'GetGem')\n"
|
||||
"assert player.GetGem() == 1234\n"
|
||||
"assert player.POINT_GEM == 248\n"
|
||||
"def _fmt(v):\n"
|
||||
" if v >= 1000000000000: return '%.2f T' % (float(v)/1000000000000.0)\n"
|
||||
" elif v >= 1000000000: return '%.2f B' % (float(v)/1000000000.0)\n"
|
||||
|
||||
Reference in New Issue
Block a user