Files
metin2-client/tests/port/autohunt_pickup_checks.inc
T
shenandshen 846a993183 feat: complete xxf-ch5 35 features migration, protocol bindings, and gate validation
- S1: Chinese locale pack, target HP/drop preview, elemental icons, exchange level display, item highlight, FOV settings, advanced skybox, GM warp.
- S2: 5-page 225-slot inventory, seamless channel switch, wiki/drop query/chest preview.
- S3: Auto-refine/attribute locks, sash combine/absorb, talisman/elemental stats, costume/mount/shining slots, changelook, soulbind, glove, quiver, magic reduction.
- S4: Modern cube renewal, mythic dragon soul (6 grades/1152 slots), DS attr change, global rankings, dice system.
- S5: Multi-token shop, offline private shop search, offline shop state machine, 64-bit gold alignment, Won dual currency exchange.
- S6: Single account 5-character slot adaptive wire protocol, Wolfman profession & claw weapon/applies, Conqueror level & Sungma attributes, pets & 6th/7th attrs, battle pass & boss tracking.
- Pass 42/42 platform gate test suites in scripts/port_gate.sh macos.
2026-10-22 01:29:14 -07:00

51 lines
2.9 KiB
C++

// PORT: actual autohunt frame loop -> CG235 -> fake peer deletion acknowledgments.
if (server && CPythonPlayer::Instance().NEW_GetMainActorPtr()) {
auto& player = CPythonPlayer::Instance();
auto* main = player.NEW_GetMainActorPtr();
auto& items = CPythonItem::Instance();
auto* mob = CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kMobVID);
const auto saved = player.AutoHunt_GetConfig();
TPixelPosition savedMain, savedMob;
main->NEW_GetPixelPosition(&savedMain); mob->NEW_GetPixelPosition(&savedMob);
TPixelPosition origin = savedMob; origin.x += 1000;
TPixelPosition far = origin; far.x += 20000;
mob->NEW_Stop(); mob->NEW_SetPixelPosition(far);
main->NEW_Stop(); main->NEW_SetPixelPosition(origin);
auto config = saved;
config.iGatherCount = 0; config.iPickup = CPythonPlayer::AUTO_HUNT_PICKUP_GOLD_EQUIP;
config.iHPPercent = 0; config.iSPPercent = 0;
config.vecSkillIndices.clear();
player.AutoHunt_SetConfig(config);
const DWORD base = 0x720000;
for (DWORD i=0; i<50; ++i)
items.CreateItem(base+i, 1, origin.x+30+(i%5), origin.y, origin.z, false);
items.CreateItem(base+50, 1, origin.x+40, origin.y, origin.z, false);
items.SetOwnership(base+50, "OtherPlayer");
items.CreateItem(base+51, 30006, origin.x+45, origin.y, origin.z, false);
player.AutoHunt_SetEnabled(true);
TPixelPosition pos;
CHECK(pump_until(4, [&] { return !items.GetGroundItemPosition(base+49, &pos); }));
CHECK(server->Has("game2:pickup_batch 48"));
CHECK(server->Has("game2:pickup_batch 2"));
for (DWORD i=0; i<50; ++i) CHECK(!items.GetGroundItemPosition(base+i, &pos));
CHECK(items.GetGroundItemPosition(base+50, &pos)); // another player's drop
CHECK(items.GetGroundItemPosition(base+51, &pos)); // gold/equipment excludes materials
player.AutoHunt_SetEnabled(false);
items.DeleteItem(base+50); items.DeleteItem(base+51);
// Begin outside pickup distance: the navigation arrival must also batch both drops.
main->NEW_Stop(); main->NEW_SetPixelPosition(origin);
items.CreateItem(base+52, 1, origin.x+550, origin.y, origin.z, false);
items.CreateItem(base+53, 1, origin.x+570, origin.y, origin.z, false);
player.AutoHunt_SetEnabled(true);
CHECK(pump_until(7, [&] { return !items.GetGroundItemPosition(base+52, &pos) &&
!items.GetGroundItemPosition(base+53, &pos); }));
CHECK(server->Has("game2:batch_vid " + std::to_string(base+52)));
CHECK(server->Has("game2:batch_vid " + std::to_string(base+53)));
player.AutoHunt_SetEnabled(false);
for (DWORD i=0; i<54; ++i) if (items.GetGroundItemPosition(base+i, &pos)) items.DeleteItem(base+i);
player.AutoHunt_SetConfig(saved);
main->NEW_Stop(); main->NEW_SetPixelPosition(savedMain);
mob->NEW_Stop(); mob->NEW_SetPixelPosition(savedMob);
pump_frames(30);
}