AVA2 new_switchbot ported as port_switchbot.{h,cpp}: SWITCHBOT item window (7),
CG/GC 171 and GG 31 with AVA2 subheaders and field order, pack(1) structs pinned
by static_assert, 0.1 s roll, P2P hand-over on warp, boot ALTER of
player.item.window. Switchers come from the inventory; current checks and
ItemLog are kept. Clients sending "mt20261016" or newer as the version
timestamp get the switchbot; older clients are left alone.
The v1 /mt_switchbot chat command, its lock verb and query capability bit 64
are removed (cap mask 1023 -> 959).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.2 KiB
PORT batch pickup, v1
AVA2-style batch pickup (reference: AVA2 do_pickup_all). One command picks up every ground item the character owns within the normal pickup distance, filtered by category. Source: src/server/game/src/port_pickup.h, command mt_pickup (cmd.cpp), throttle field m_portPickupLastCommand in char.h. It reuses the quiet-INFO hook (m_portQuietInfo) (char.cpp; first added for the v1 switchbot, which no longer uses it). No packet header, no DB schema, no affect. AVA2's HEADER_CG_ITEMS_PICKUP packet and its premium automatic pickup (AFFECT_AUTO_PICK_UP, item 70002) are not ported.
Rules
- Collection walks
ForEachAroundon the character's sectree. An item is taken only when it:- is on the ground (has a sectree);
- passes
DistanceValid(the original 300-unit pickup distance); - passes
IsOwnership(ch)(own or ownerless); - matches the category mask.
- Party loot owned by someone else is excluded.
PickupItem's party branch would hand it to the requester, which is what AVA2 also avoids. - Items are sorted nearest-first and capped at 48 per command. Each one is looked up again by VID and goes through the original
CHARACTER::PickupItem. Distance, stacking, inventory space,ItemLog GETand quest triggers are therefore the original path's. - Each successful pickup still sends its own INFO line. Of the failures (usually a full inventory), only the first INFO line is sent, once.
- Busy: dead, stunned, observer mode, warping, or no sectree.
- Throttle: one command per 500 ms per character.
Protocol (CHAT_TYPE_COMMAND, version 1)
/mt_pickup 1 MASK MASK = 1..255, at most 3 digits
MTPU1 done FOUND PICKED FAILED
MTPU1 error rate|invalid|busy
A request with a version other than 1, a token longer than 10 characters or more than 3 tokens is ignored silently.
| Bit | Category | Item type |
|---|---|---|
| 1 | yang | ITEM_ELK |
| 2 | weapon | ITEM_WEAPON |
| 4 | armor / jewellery | ITEM_ARMOR |
| 8 | skill book | ITEM_SKILLBOOK |
| 16 | stone | ITEM_METIN |
| 32 | material | ITEM_MATERIAL |
| 64 | costume | ITEM_COSTUME |
| 128 | other | every other type |
Capability: the MTF1 cap mask advertises bit 128 (127 -> 255). The client also falls back to single pickup when it gets no reply within 3 s.
Verification
tests/features/test_pickup.pycompiles the production header against stubs of the PickupItem/ChatPacket contract. It covers:- nearest-first order;
- foreign and far items left on the ground;
- per-category masks;
- the yang/INFO pass-through;
- a full inventory (
done 8 3 5, one failure line); - the 48 cap;
- rate, invalid, busy and silently ignored input.
tests/features/test_queries.pywas updated for cap mask 255.test_switchbot.pystill passes.- FreeBSD build of the whole game target on 203 in
/root/metin2-features-dev, log/root/metin2-features-dev/pickup-build.log. The live/usr/metin2binary was not replaced and no live service was restarted. - Live test on 2026-10-15 against the channel-5 test core (
/usr/metin2/server/channel5/first, port 13040, isolated binary) with the macOS native client as [SA]Admin. The test created weapon 19, armor 11209, material 30003, stone 28030 and skill book 50300 with/item, then dropped each one and 1000 yang:- mask 2 →
done 1 1 0(weapon only); - mask 48 →
done 2 2 0(stone + material); - mask 255 →
done 3 3 0(armor, book, yang; the yang balance was restored); - nothing left →
done 0 0 0, and an immediate second command →error rate. log.loghas oneGETrow per item, matching theDROProws. The original path logs no GET for yang.- The core's syserr shows no new errors. The LOCALE_ERROR there comes from the original yang-drop message.
- mask 2 →
- Live acceptance on CH1 (13000) after the deploy, with the same scenario as the channel-5 test: mask 2 →
done 1 1 0, mask 48 →done 2 2 0, mask 255 →done 3 3 0(yang restored), thendone 0 0 0anderror rate. - Not done yet: a live full-inventory run and Android device validation.
Production deployment
- 2026-10-15 14:51, approved by the user. The 203 live cores now run main
3b7e158(gamesha2560d798ec0…, the binary the channel-5 core was tested with). The db binary is unchanged. Live/usr/metin2/srcwas at4577d86, so the deploy also shipped1a36719(query protocol and calendar drop gates; the gates stay inert withoutport_events.tsv). - Package
/root/deploy-features/20261015-features(deploy.sh check|go|rollback,SHA256SUMS). The previousgame/dbare in/root/backup-bin/20261015-145122(recorded inLAST_BACKUP), and the replaced/usr/metin2/srcfiles are insrc-before/.sh deploy.sh rollbackrestores both. - The first
gostopped atrebuild.sh stop_server("server still running" after about 38 s, cores still exiting) before any backup or copy; the secondgosucceeded.start.shwas answered with1, which starts only CH1 and game99, so CH2–CH4 were started afterwards with eachrun.shin thestart.shorder. The channel-5 test core was restarted too, giving the pre-deploy layout of 14 cores plus db and auth. The new syserr entries contain only the existingnew_quest_lv52LUA_ERROR (present since 2026-09-21).