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:
shen
2026-10-20 04:53:37 -07:00
parent 18d9c89af8
commit dd71ee5b61
4 changed files with 15 additions and 0 deletions
@@ -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"