client: native AVA2 cube_renewal module (ENABLE_CUBE_RENEWAL_WORLDARD=1)

PythonCubeRenewal + PhaseGameCubeRenewal ported verbatim from AVA2: GC 221
fills the recipe list and calls BINARY_CUBE_RENEWAL_OPEN, the XXF
uicuberenewal window sends CG 216 make/close (its 3rd "improve" argument
is accepted and not sent). Replaces the read-only CubeRenewalScript.inc
preview shim. Version mt20261026 so the server picks the new window.
FakeLoginServer: CG 215/216 sizes and a /mt_test_cube_open fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-24 14:06:26 +09:00
co-authored by Claude Opus 5.5
parent d6617e01f7
commit 909fc8f851
15 changed files with 336 additions and 277 deletions
+10 -11
View File
@@ -553,18 +553,17 @@ int main(int argc, char** argv)
" item.SelectItem(_pack_vnum)\n"
" assert item.GetItemType()==_pack_type and item.GetItemSubType()==0, (_pack_vnum,item.GetItemType(),item.GetItemSubType())\n"));
}
CHECK(py("import cube_renewal, app, player\nassert not app.ENABLE_CUBE_RENEWAL_WORLDARD\n_cube_gold=player.GetElk()\n_cube_materials=player.GetItemCountByVnum(30006)\ncube_renewal.LoadCatalogue(20383)"));
// AVA2 cuberenewal: GC 221 fills the list and opens the window, CG 216 carries make/close.
CHECK(py("import cube_renewal, app\nassert app.ENABLE_CUBE_RENEWAL_WORLDARD\nimport net\nnet.SendChatPacket('/mt_test_cube_open')"));
CHECK(pump_until(8,[] {return py_true("cube_renewal.CountDates()==1");}));
CHECK(py("assert cube_renewal.GetDates(0)==(19,1,False,30006,1,0,0,0,0,0,0,0,0,100,50,'WORLDARD')"));
if(std::getenv("MT_TEST_CUBE_LAYOUT")) {
CHECK(py("_stream.curPhaseWindow.BINARY_Cube_Open(20383)"));
CHECK(pump_until(8,[] {return py_true("cube_renewal._window is not None and cube_renewal._window.IsShow() and cube_renewal._readonly");}));
CHECK(py("cube_renewal.CubeRenewalMakeItem(0,3)"));
} else CHECK(py("cube_renewal.CheckBatch(0,3)"));
CHECK(pump_until(8,[] {return py_true("cube_renewal._last_preflight is not None");}));
CHECK(py("assert cube_renewal._last_error is None\nassert cube_renewal._last_preflight['gold_required']==300\nassert cube_renewal._last_preflight['mutation_enabled']==0\nassert player.GetElk()==_cube_gold\nassert player.GetItemCountByVnum(30006)==_cube_materials\nassert cube_renewal.CheckBatch(0,101)==0\ncube_renewal.CubeRenewalClose()\nassert cube_renewal.CountDates()==0\napp.Exit()"));
CHECK(py("assert cube_renewal.GetDates(0)==(19,1,False,30006,1,0,0,0,0,0,0,0,0,100,50,'WORLDARD'), cube_renewal.GetDates(0)\nassert cube_renewal.GetDates(1)[0]==0"));
if(std::getenv("MT_TEST_CUBE_LAYOUT"))
CHECK(pump_until(8,[] {return py_true("_stream.curPhaseWindow.interface.wndCubeRenewal.IsShow()");}));
CHECK(py("cube_renewal.CubeRenewalMakeItem(0,3,-1)\ncube_renewal.CubeRenewalClose()"));
CHECK(pump_until(8,[&server] {bool make=false,close=false;for(const auto& e:server->Events()){make|=e.find(":cube_renewal 4 0 3")!=std::string::npos;close|=e.find(":cube_renewal 5 0 0")!=std::string::npos;}return make&&close;}));
CHECK(py("app.Exit()"));
pump_until(2,[] {return !PythonBoot::IsAppLooping();});PythonBoot::Stop();
std::printf("cube read-only catalogue/preflight fixture: %s\n",g_failures?"FAILED":"PASS");return g_failures?1:0;
std::printf("cube renewal packet fixture: %s\n",g_failures?"FAILED":"PASS");return g_failures?1:0;
}
if (server && std::getenv("MT_TEST_AUTOHUNT_BATCH")) {
CHECK(CPythonPlayer::Instance().NEW_GetMainActorPtr());
@@ -1922,7 +1921,7 @@ int main(int argc, char** argv)
CHECK(py("import cube_renewal"));
CHECK(py_true("cube_renewal.CountDates() == 0"));
CHECK(py_true("cube_renewal.GetDates(0)[0] == 0"));
CHECK(py("try:\n cube_renewal.CubeRenewalMakeItem(0, 1)\nexcept RuntimeError:\n pass\nelse:\n raise AssertionError('unsupported craft silently succeeded')\n"));
CHECK(py_true("app.ENABLE_CUBE_RENEWAL_WORLDARD == 1"));
// F24: Full server ranking system (uirank)
CHECK(py_true("app.ENABLE_RANKING_SYSTEM == 1"));