android-native: auto hunt, in-client account registration, mobile UI polish
- Auto hunt (client-only): PythonPlayerAutoHunt.cpp + AutoHuntScript.inc as the embedded mt_autohunt module, AUTO touch button, F9/F8. - Account registration: tools/40250/register_server.py (rc.d mt_register, :11080) inserts into account.account; net.RegisterAccount/GetRegisterAccountResult (PythonAccountRegister.cpp) and the mt_register login-window dialog (RegisterScript.inc). - --py-exec also runs in --login-screen mode for scripted login-screen tests. - Touch controller, window manager and render command updates for the Android native client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
53d06c3c26
commit
3e3708ef06
@@ -2166,6 +2166,81 @@ PyObject* playerSendDragonSoulRefine(PyObject* poSelf, PyObject* poArgs)
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
// PORT: auto hunt (PythonPlayerAutoHunt.cpp); 40250 has no counterpart.
|
||||
PyObject * playerAutoHuntSetEnabled(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int isEnable;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &isEnable))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonPlayer::Instance().AutoHunt_SetEnabled(isEnable ? true : false);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * playerAutoHuntIsEnabled(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonPlayer::Instance().AutoHunt_IsEnabled());
|
||||
}
|
||||
|
||||
// (state, stop reason, out of HP potions, out of SP potions, gathering, gathered mobs alive)
|
||||
PyObject * playerAutoHuntGetState(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
|
||||
return Py_BuildValue("iiiiii", rkPlayer.AutoHunt_GetState(), rkPlayer.AutoHunt_GetStopReason(),
|
||||
rkPlayer.AutoHunt_HasNoPotion(true), rkPlayer.AutoHunt_HasNoPotion(false),
|
||||
rkPlayer.AutoHunt_IsGathering(), rkPlayer.AutoHunt_GetGatheredCount());
|
||||
}
|
||||
|
||||
// (range, hp %, sp %, pickup, stone, boss, quick-slot skill mask, gather count)
|
||||
PyObject * playerAutoHuntGetConfig(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
const CPythonPlayer::SAutoHuntConfig& c_rkConfig = CPythonPlayer::Instance().AutoHunt_GetConfig();
|
||||
return Py_BuildValue("iiiiiiii", c_rkConfig.iRange, c_rkConfig.iHPPercent, c_rkConfig.iSPPercent, c_rkConfig.iPickup,
|
||||
c_rkConfig.bAttackStone, c_rkConfig.bAttackBoss, int(c_rkConfig.dwSkillSlotMask), c_rkConfig.iGatherCount);
|
||||
}
|
||||
|
||||
PyObject * playerAutoHuntSetConfig(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int aiValue[8];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
if (!PyTuple_GetInteger(poArgs, i, &aiValue[i]))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonPlayer::SAutoHuntConfig kConfig;
|
||||
kConfig.iRange = aiValue[0];
|
||||
kConfig.iHPPercent = aiValue[1];
|
||||
kConfig.iSPPercent = aiValue[2];
|
||||
kConfig.iPickup = aiValue[3];
|
||||
kConfig.bAttackStone = aiValue[4] != 0;
|
||||
kConfig.bAttackBoss = aiValue[5] != 0;
|
||||
kConfig.dwSkillSlotMask = DWORD(aiValue[6]);
|
||||
kConfig.iGatherCount = aiValue[7];
|
||||
CPythonPlayer::Instance().AutoHunt_SetConfig(kConfig);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
// The auto hunt window's UTF-8 source strings in the locale's code page (locale.cfg), as the packed
|
||||
// locale_game.txt strings are.
|
||||
PyObject * playerAutoHuntLocalize(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char* szText;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szText))
|
||||
return Py_BuildException();
|
||||
|
||||
const int iWide = MultiByteToWideChar(CP_UTF8, 0, szText, -1, NULL, 0);
|
||||
if (iWide <= 0)
|
||||
return Py_BuildValue("s", szText);
|
||||
std::vector<WCHAR> kVecWide(iWide);
|
||||
MultiByteToWideChar(CP_UTF8, 0, szText, -1, &kVecWide[0], iWide);
|
||||
|
||||
const int iBytes = WideCharToMultiByte(GetDefaultCodePage(), 0, &kVecWide[0], -1, NULL, 0, NULL, NULL);
|
||||
if (iBytes <= 0)
|
||||
return Py_BuildValue("s", szText);
|
||||
std::vector<char> kVecText(iBytes);
|
||||
WideCharToMultiByte(GetDefaultCodePage(), 0, &kVecWide[0], -1, &kVecText[0], iBytes, NULL, NULL);
|
||||
return Py_BuildValue("s", &kVecText[0]);
|
||||
}
|
||||
|
||||
void initPlayer()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
@@ -2337,6 +2412,13 @@ void initPlayer()
|
||||
{ "SlotTypeToInvenType", playerSlotTypeToInvenType, METH_VARARGS },
|
||||
{ "SendDragonSoulRefine", playerSendDragonSoulRefine, METH_VARARGS },
|
||||
|
||||
{ "AutoHuntSetEnabled", playerAutoHuntSetEnabled, METH_VARARGS },
|
||||
{ "AutoHuntIsEnabled", playerAutoHuntIsEnabled, METH_VARARGS },
|
||||
{ "AutoHuntGetState", playerAutoHuntGetState, METH_VARARGS },
|
||||
{ "AutoHuntGetConfig", playerAutoHuntGetConfig, METH_VARARGS },
|
||||
{ "AutoHuntSetConfig", playerAutoHuntSetConfig, METH_VARARGS },
|
||||
{ "AutoHuntLocalize", playerAutoHuntLocalize, METH_VARARGS },
|
||||
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user