Port the AVA2 switchbot (自动洗练) 1:1

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>
This commit is contained in:
shenlei
2026-10-16 20:26:06 +09:00
co-authored by Claude Opus 5.5
parent c6813cd653
commit a28393b16b
39 changed files with 1485 additions and 555 deletions
+4 -11
View File
@@ -1,6 +1,6 @@
# PORT attribute lock
AVA2 `ENABLE_LOCK_ATTR`, rebuilt for this server's item layout. Up to two of the five normal attribute slots keep their type and value when the item is rerolled. Source: `src/server/game/src/port_attr_lock.{h,cpp}`, `CItem::ChangeAttribute` / `CopyAttributeTo` (item_attribute.cpp), the cache fields in item.h/item.cpp, the boot hook in main.cpp, and the `lock` verb of `mt_switchbot` (port_switchbot.h).
AVA2 `ENABLE_LOCK_ATTR`, rebuilt for this server's item layout. Up to two of the five normal attribute slots keep their type and value when the item is rerolled. Source: `src/server/game/src/port_attr_lock.{h,cpp}`, `CItem::ChangeAttribute` / `CopyAttributeTo` (item_attribute.cpp), the cache fields in item.h/item.cpp, and the boot hook in main.cpp. The `lock` verb of the v1 `mt_switchbot` command was removed with the AVA2 switchbot port (FEATURE-SWITCHBOT.md). Locks are now set only by using 50348 (lock) / 50349 (unlock) on the item. `UseItemEx` passes the material to `PortAttrLockUse`, which reads the 1-based slot from the material's socket 0 and consumes one material on success.
## Storage
@@ -24,7 +24,6 @@ CREATE TABLE IF NOT EXISTS mt_item_attr_lock (item_id INT UNSIGNED NOT NULL PRIM
- Only the five normal slots can be locked; the rare slots 5/6 are not affected. The item must sit in the inventory, not be equipped or in an exchange, not be a costume, and have an attribute set. The slot must hold an attribute.
- At most 2 lock groups, and at least one filled slot must stay unlocked. On items with an addon type (`sAddonType`, weapons whose slots 0/1 are the skill / normal hit bonus pair), slots 0 and 1 lock and unlock together and count as one group.
- The bot's own item cannot be locked or unlocked while the bot is rolling it (`running`).
- Locking is free. AVA2 consumes 50348/50349 per lock or unlock; those vnums do not exist in 203 `item_proto`.
- `CItem::ChangeAttribute` (scroll rerolls, the switchbot, the GM command):
1. take the effective mask: stored mask ∩ filled slots, with the addon pair kept whole;
@@ -36,15 +35,9 @@ CREATE TABLE IF NOT EXISTS mt_item_attr_lock (item_id INT UNSIGNED NOT NULL PRIM
With no lock, the effective mask is 0 and the sequence equals the original. The attribute count is kept, and the rare slots are untouched.
- Adding an attribute (71085) and rare-attribute scrolls do not look at the lock.
## Protocol (part of mt_switchbot v1)
## Protocol
```
/mt_switchbot 1 lock CELL SLOT toggle the lock on normal slot SLOT (0..4)
MTSB1 lock CELL VNUM MASK effective mask; also sent after every attrs_end
MTSB1 error lock CODE item equipped no_attr busy running slot max db rate invalid
```
`slot` means out of range or empty. `max` means a third group, or every filled slot locked. `db` means the write failed. Older servers never send a `lock` line, so the client shows no lock buttons there.
No dedicated packet. The v1 `/mt_switchbot 1 lock CELL SLOT` / `MTSB1 lock` lines were removed together with that command. What remains is the item-use path above. AVA2's UI for picking the slot and showing the lock in the tooltip is still open (metin2-client docs/AVA2-PARITY-PLAN.md).
## Verification
@@ -58,7 +51,7 @@ MTSB1 error lock CODE item equipped no_attr busy running slot max
- there is no DB lookup when there are no attributes;
- every toggle, effective-mask and group-count rule holds.
- It also checks the boot hook, the Makefile, the cache initialisation and that `CopyAttributeTo` copies the lock.
- `tests/features/test_switchbot.py` covers the `lock` verb (toggle, `slot`, `max`, `db`, `running`, `no_attr`, `item`, `invalid`, the addon pair) and the lock line after `attrs_end`.
- `tests/features/test_switchbot.py` checks that the v1 command (and with it the `lock` verb) is gone.
- FreeBSD: full rebuild of game in `/root/metin2-features-dev` (log `attrlock-build.log`; `item.h` changed, so every .cpp was touched).
- Live on 2026-10-15, channel-5 test core (13040) with the isolated binary, macOS client, [SA]Admin, armour 11209 (item 20000178, 5 attributes), scroll 71084:
- the first boot created the table;
+3 -3
View File
@@ -94,7 +94,7 @@ AVA2's `ENABLE_SPECIAL_COSTUME_ATTR`, in `game/src/port_costume_attr.cpp`. The i
- at most 3 attributes (`full`);
- no duplicate apply (`has`).
- Then `AddAttribute`, consume one, `ItemLog COSTUME_ENCHANT`, `done`.
- The switchbot does not accept enchants as scrolls, on either the server (`PortSwitchScroll`) or the client.
- The switchbot never uses enchants: it only looks up the switcher vnums in FEATURE-SWITCHBOT.md.
- Client `mt_costume_attr` (`CostumeAttrScript.inc`):
- marks matching costumes as usable drop targets (the 40250 inventory already sends every `USE_CHANGE_ATTRIBUTE` drop);
- adds the attribute and targets to the enchant tooltip;
@@ -113,7 +113,7 @@ AVA2's `ITEM_TALISMAN_EQUIPMENT` + `ELEMENT_NEW_BONUSES`, in `game/src/port_pend
- Damage (battle.cpp `CalcAttBonus`): against a monster with `RACE_FLAG_ATT_<element>`, attack +point %, so a +200 talisman triples the attack on those monsters (×(1+200/100)), which is AVA2's own balance. Each flag is its own `if`, as on AVA2. AVA2 leaves out ICE; we include it, since 203 has 83 ice monsters and an ice talisman chain.
- Attributes:
- The pool is AVA2's item_attr pendant column (20 rows, levels 1–5), kept in a table in `port_pendant.cpp` instead of a new item_attr column (that would change the db boot packet).
- `GetAttributeSetIndex` stays −1. So talismans drop without attributes, and the 40250 switchers, the switchbot and the attribute lock refuse them.
- `GetAttributeSetIndex` stays −1. So talismans drop without attributes, and the 40250 switchers and the attribute lock refuse them. The switchbot rolls them with 71302 only (pseudo attribute set 9).
- 71302 rerolls all attributes (needs at least one; levels 0/10/40/35/15 %). 71301 adds one up to 5, always succeeding (levels 40/50/10 %). No duplicates.
- **Deviation:** AVA2's 53996 / 53997 are generic switcher / adder items, a free 40250 gear reroll. Here they work like 71302 / 71301, as their zh names (护符附魔道具 / 护符加持道具) say.
- Not while worn (`equipped`), like the 40250 switcher. Any other attribute item dropped on a talisman, or a talisman item dropped on anything else, gets `target`.
@@ -133,7 +133,7 @@ AVA2's `ENABLE_NEW_RINGS`, in `game/src/port_rings.cpp`.
- Attributes:
- The pool is AVA2's `item_attr_rings` (20 rows, levels 1–5), kept as a table in `port_rings.cpp`. `GetAttributeSetIndex` stays −1, and `PutAttributeWithLevel` branches to the ring pool.
- The 40250 switchers and adders (`USE_CHANGE_ATTRIBUTE`, `USE_ADD_ATTRIBUTE`, `USE_ADD_ATTRIBUTE2`) accept rings, with the usual not-while-worn rule. 71151 / 71152 (weapon / armor only) refuse them, by design.
- The switchbot and the rare (6th / 7th) attributes skip rings. AVA2's `item_attr_rare_rings` is not ported.
- The switchbot rolls rings from this pool (pseudo attribute set 8). The rare (6th / 7th) attributes skip rings. AVA2's `item_attr_rare_rings` is not ported.
- Rings drop without attributes: `AlterToMagicItem` only handles weapons and armor.
- Client: `ITEM_TYPE_RINGS`, `c_Equipment_Rings1/2` (253 / 254), and `mt_rings` (`RingsScript.inc`). That module adds the two slots beside the shoes, the accessory tooltip (applies, attributes, jewel sockets) and the drop targets for drills, jewels, switchers and adders.
+1 -1
View File
@@ -1,6 +1,6 @@
# PORT batch chest opening, v1
Date: 2026-10-15. AVA2-style batch opening of gift boxes (reference: AVA2 `ENABLE_MULTI_CHEST`, `/chest_drop`, `CHARACTER::OpenChest`). Source: `src/server/game/src/port_chest.h` (header-only, included from `cmd_general.cpp`), command `mt_chest` (cmd.cpp). It reuses the quiet-INFO hook (`m_portQuietInfo` / `m_portLastInfo`) added for the switchbot. No packet header, no DB schema, no char.h/item.h change.
Date: 2026-10-15. AVA2-style batch opening of gift boxes (reference: AVA2 `ENABLE_MULTI_CHEST`, `/chest_drop`, `CHARACTER::OpenChest`). Source: `src/server/game/src/port_chest.h` (header-only, included from `cmd_general.cpp`), command `mt_chest` (cmd.cpp). It reuses the quiet-INFO hook (`m_portQuietInfo` / `m_portLastInfo`) (char.cpp; first added for the v1 switchbot, which no longer uses it). No packet header, no DB schema, no char.h/item.h change.
AVA2 rewrote the drop loop (`GiveItemFromSpecialItemGroupNew`, `AutoGiveItemChest`, cap 1000). That rewrite is not ported. Here every box goes through the original `CHARACTER::UseItem` → `UseItemEx` `ITEM_GIFTBOX` path, one box at a time, so the original checks, the `special_item_group` roll, gold/exp, `ItemLog` and consumption stay exactly as they are.
+1 -1
View File
@@ -1,6 +1,6 @@
# 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`) added for the switchbot. 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.
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
+1 -1
View File
@@ -31,7 +31,7 @@ MTF1 end REQUEST ROW_COUNT
MTF1 error REQUEST ERROR
```
MASK: 1 mob drops, 2 chest preview, 4 own stats, 8 item sources, 16 dungeon snapshots, 32 scheduled calendar, 64 switchbot (separate `/mt_switchbot` / `MTSB1` protocol, see FEATURE-SWITCHBOT.md), 256 world bosses (see FEATURE-BOSS-TRACK.md). The current mask is 511. Unknown capability bits are ignored; unknown versions are rejected. Capability advertises the query implementation; missing quest/config can still return unsupported/schedule_unavailable. The client negotiates before business queries; old servers time out to unsupported, not an empty result.
MASK: 1 mob drops, 2 chest preview, 4 own stats, 8 item sources, 16 dungeon snapshots, 32 scheduled calendar, 64 was the v1 switchbot (`/mt_switchbot` / `MTSB1`) and is no longer advertised, because the AVA2 switchbot uses its own packets (FEATURE-SWITCHBOT.md), 256 world bosses (see FEATURE-BOSS-TRACK.md). The current mask is 959. Unknown capability bits are ignored; unknown versions are rejected. Capability advertises the query implementation; missing quest/config can still return unsupported/schedule_unavailable. The client negotiates before business queries; old servers time out to unsupported, not an empty result.
Each drop/chest/source page contains at most 8 rows, with consecutive absolute indices. TOTAL is capped at 4096; stats are one complete bounded snapshot (currently the named keys in kPortStats, less than 128). Client commits only a complete, matching begin/rows/end sequence. Unknown/stale request IDs cannot overwrite the current selection. Each line is bounded below 512 bytes; rows contain IDs and values, not server-provided script/names/markup.
+48 -78
View File
@@ -1,93 +1,63 @@
# PORT switchbot (automatic attribute change), v1
# PORT switchbot (自动洗练), AVA2 port
AVA2-style automatic rerolling (reference: AVA2 `new_switchbot.cpp` / `uiswitchbot.py`), rebuilt so that the server stays authoritative and the existing reroll path is unchanged. Source: `src/server/game/src/port_switchbot.h`, command `mt_switchbot` (cmd.cpp), quiet-INFO hook in `CHARACTER::ChatPacket` (char.cpp), fields in char.h. No attribute lock, no DB schema, no packet header, no P2P transfer.
AVA2 `ENABLE_SWITCHBOT` ported 1:1 (reference: AVA2 `game/src/new_switchbot.{h,cpp}`, client `PythonSwitchbot.cpp` and `root/uiswitchbot.py`). Classes, API, packets, the window and the 0.1 s roll speed are AVA2's. It replaces the v1 `/mt_switchbot` chat protocol (`MTSB1`, query capability bit 64). That command and its lock verb are gone.
## Rules
Source:
- `src/server/game/src/port_switchbot.{h,cpp}`: `SwitchbotHelper`, `CSwitchbot`, `CSwitchbotManager`, `PortSwitchbotBoot`.
- `common/length.h`: `SWITCHBOT = 7` in `EWindows` (GROUND is now 8), `SWITCHBOT_SLOT_COUNT 6 / _REAL 5 / ALTERNATIVE_COUNT 2 / NORM_ATTR_NUM 5`, `TItemPos::IsSwitchbotPosition`.
- `common/tables.h`: the switchbot tables.
- Each roll calls the original `CHARACTER::UseItem(scroll cell, target cell)`. All checks, probabilities, the addon handling, `ItemLog CHANGE_ATTRIBUTE` and scroll consumption are the manual path's. That includes the 71151/76023 restriction (weapon/body, level limit <= 40) and the GM quest flag. A roll counts only when exactly one scroll of the chosen vnum was consumed. Otherwise the bot stops with `rejected` and resends the original INFO line once.
- The per-roll INFO lines (`属性已变更`) are held back while the bot calls UseItem (`m_portQuietInfo`); all other chat types pass through.
- Only `ITEM_USE / USE_CHANGE_ATTRIBUTE` scrolls are accepted. `USE_CHANGE_ATTRIBUTE2` has no handler in this server's UseItemEx.
- Target item: inventory cell, not costume, attribute set != -1, at least one attribute, not equipped or in an exchange. It is bound by item ID.
- One bot per character. One roll every 250 ms (`PASSES_PER_SEC(1)/4`). Limit 1..1000 rolls.
- Targets: up to 2 alternatives, each 1..5 distinct (apply, minimum). An alternative matches when every target is found among the 5 normal attribute slots with value >= minimum. Any matching alternative stops the bot (AVA2 CheckItem semantics). The bot also checks before it starts, so an item that already matches consumes nothing.
- Allowed targets are the applies the attribute table can roll for this item's set, excluding the item's base proto applies. The maximum is `lValues[min(maxLevelBySet,5)-1]`. Items with an addon type also allow skill damage 30 / normal hit 65, the item_addon bounds.
- Every tick re-checks the state and stops with a reason. This replaces AVA2's hooks into every move/trade path.
- Character gone, VID changed (logout or warp) or descriptor lost: the bot is erased silently.
- `busy`: dead, warping, `!CanHandleItem()`, exchange, own shop, shop, safebox or cube open.
- `item_gone`: the item is missing, has another owner, has left the inventory window or is equipped.
- `no_scroll`, `limit`, `matched`, `rejected`, `stopped`.
- No offline rolling. Rolls stop when the player leaves, and every completed roll has already been saved and logged by the original path.
## Window and items
## Protocol (CHAT_TYPE_COMMAND, version 1)
- Items placed in the `SWITCHBOT` window (cells 0..4) are kept in `m_pointsInstant.pSwitchbotItems` and saved with `window = 'SWITCHBOT'`. The db loads, saves and deletes that window with SAFEBOX and DRAGON_SOUL_INVENTORY (three queries in `ClientManagerPlayer.cpp`).
- At boot (game cores only), `PortSwitchbotBoot` adds `'SWITCHBOT'` to the `player.item.window` enum if it is missing. The deploy SQL carries the same ALTER.
- `MoveItem` only accepts `SwitchbotHelper::IsValidItem` items into the window. That is AVA2's list: weapons, rings, and armour (body, head, shield, wrist, shoes, necklace, earrings, talisman). Cell 5 is rejected. The move hooks send:
- `switchbot_error active` when the item is moved out of a running slot;
- `switchbot_error invalid` when the item is not valid for the switchbot.
- Drop, give, exchange and safebox refuse switchbot cells: the item has to go back to the inventory first. Shops sell only from the inventory.
Requests (250 ms per-character throttle; tokens <= 10 chars, <= 30 tokens):
## Rolling
```
/mt_switchbot 1 attrs CELL
/mt_switchbot 1 start CELL SCROLL_VNUM LIMIT N1 (APPLY MIN)*N1 [N2 (APPLY MIN)*N2]
/mt_switchbot 1 stop
/mt_switchbot 1 status
/mt_switchbot 1 lock CELL SLOT (attribute lock, see FEATURE-ATTR-LOCK.md)
```
- `CSwitchbot::SwitchItems` runs every 0.1 s (`c_fSpeed`). Each active slot takes one switcher per pass.
- A slot finishes when one configured alternative fully matches within the first 5 attributes (AVA2 `CheckItem`). An alternative that isn't configured counts as a match.
- Deviations from AVA2 (also listed at the top of `port_switchbot.cpp`):
- Cell 5 (AVA2's hidden switcher cell) is never used. Switchers come from the inventory, skipping stacks that are being exchanged, locked or sold in the player's shop.
- Which switcher is used follows the manual path:
- a talisman takes only 71302;
- a weapon or body armour with no level limit above 40 takes 71151 / 76023 first;
- everything else takes 71084, then 39028.
- A slot whose item has no attributes stops instead of rolling.
- Every roll is written to ItemLog as `SWITCHBOT`, with the item id as the hint.
- End and stop messages are server commands, which the client turns into localized text:
- `switchbot_end <slot>`
- `switchbot_stop noattr <slot>`
- `switchbot_stop nochanger <slot>`
Replies:
The slot is 0-based. AVA2 sent the locale ids `864` / `865` with slot+1.
- Leaving the core deletes the table once it has been sent on. A logout that unregisters the last active slot also stops the event.
- The attribute list has two pseudo sets after `ATTRIBUTE_SET_MAX_NUM`: 8 = rings (`port_rings.cpp`) and 9 = talismans (`port_pendant.cpp`).
- Warp: `CHARACTER::WarpSet` sends the table over P2P (`HEADER_GG_SWITCHBOT 31`, `TPacketGGSwitchbot`) before `GC_WARP`. The target core keeps it, and `EnterGame` re-registers the slots whose item is still there and restarts the event.
```
MTSB1 attrs CELL VNUM COUNT
MTSB1 attr INDEX APPLY MAX (COUNT rows, INDEX 0..COUNT-1)
MTSB1 attrs_end CELL COUNT
MTSB1 state ACTIVE CELL VNUM ROLLS LIMIT SCROLL SCROLLS REASON
MTSB1 lock CELL VNUM MASK (after every attrs_end, and as the reply to lock)
MTSB1 error VERB CODE
```
## Protocol
`REASON` is one of `running matched limit no_scroll item_gone rejected busy stopped idle`. Error codes:
Header numbers, subheaders and field order are AVA2's. The structs are `pack(1)`, and their sizes are pinned with `static_assert` in `port_switchbot.cpp` and in the client (`Packet.h`, `PythonSwitchbot.h`).
| Code | Meaning |
| --- | --- |
| `rate` | throttled |
| `invalid` | malformed |
| `item` | no item in that cell |
| `equipped` | equipped or in an exchange |
| `no_attr` | the item cannot be rerolled |
| `scroll` | the scroll is missing or the wrong type |
| `target` | the apply is not allowed, above the maximum or a duplicate |
| `running` | this character already has a bot |
| `busy` | see the busy states above |
| Packet | Header | Layout |
| --- | --- | --- |
| CG | 171, dynamic | `BYTE header, int size, BYTE subheader, BYTE slot` (7) + `START`: `TSwitchbotAttributeAlternativeTable[2]` (15 each) / `STOP` |
| GC | 171, dynamic | same 7-byte head + `UPDATE`: `TSwitchbotTable` (220) / `UPDATE_ITEM`: `TSwitchbotUpdateItem` (40: slot, vnum, count, 3 sockets, 7 attributes) / `SEND_ATTRIBUTE_INFORMATION`: `TSwitchbottAttributeTable[n]` (9) |
| GG | 31 | `TPacketGGSwitchbot` (223) |
A state line is pushed after every roll and when the bot stops. When the reason is `item_gone`, CELL and VNUM are 0.
CG is registered in `packet_info.cpp` with `Set(..., true)` and GG with `Set(..., false)`. The 40250 base packets are unchanged.
Capability: the MTF1 cap mask advertises bit 64 (63 -> 127). Clients that don't know it ignore it, and the client also times out to "unsupported" against old servers.
**Version gate.** The new client sends `mt20261016` as the `CG_CLIENT_VERSION` timestamp, in place of `__TIMESTAMP__`. Before `EnterGame` sends anything, it checks `SwitchbotHelper::IsClientSupported`, which requires `mt<date>` with date >= `PORT_SWITCHBOT_CLIENT_VERSION`. An older client gets no GC_SWITCHBOT packet. It can't fill the window either. The EU-branch client timestamp (`1215955205`) doesn't pass the gate.
## Verification
- `tests/features/test_switchbot.py` compiles the production header against stubs of the UseItem/ChatPacket contract. It covers the allowed list (proto exclusion, set filter, level cap, addon), validation, two alternatives, the already-matched start, quiet INFO, limit, `no_scroll`, `rejected` (INFO resent once), `item_gone`, `busy`, stop/status/idle and silent erase on a VID change.
- `tests/features/test_queries.py` was updated for cap mask 127.
- FreeBSD build of the whole game target on 203 in `/root/metin2-features-dev` (BINDIR=GAMEDIR=`/root/metin2-features-dev/bin`), log `/root/metin2-features-dev/switchbot-build.log`, with no warnings from the new code. The live `/usr/metin2` binary was not replaced and no service was restarted.
- Live test on 2026-10-15. 203 ran an extra core (`/usr/metin2/server/channel5/first`: CHANNEL 5, PORT 13040, P2P 14040, MAP_ALLOW 1 21 41) with its `game` symlinked to the isolated binary. The macOS native client (`--live-server 192.168.21.203:11000:13040`) drove [SA]Admin, sword 279, scroll 71084:
- `attrs` returned 14 rows for the sword (18 for armor 12019), received complete.
- limit 10 → `limit` after 10 rolls. State lines arrived about every 0.24 s (about 4 rolls/s); the scroll count fell 200 → 190.
- Two alternatives with minimum 1 → `matched` after 18 rolls.
- Start on an item that already matches → `matched` with 0 rolls and no scroll used.
- Moving the item 33 → 90 mid-run → the run continued, the state line reported cell 90, and `stop` → `stopped`.
- Client exit mid-run (8 rolls) → `log.log` stopped at the exit second. The CHANGE_ATTRIBUTE row count (72 = 10+18+12+12+12+8) stayed the same 20 s later.
- Opening a private shop mid-run → `busy` about 1 s after the shop opened (6 rolls). The character needs a shop bundle (50200 or 71049); without one `OpenMyShop` returns before setting `m_pkMyShop`, so no shop opens and the bot correctly keeps rolling.
- 76014 with 6 scrolls and limit 10 → `no_scroll` after 6 rolls.
- 71151 on the level-90 sword (the original path allows limit level <= 40) → `rejected` with 0 rolls and the scroll kept.
- Every roll wrote one `CHANGE_ATTRIBUTE` row. The core's syserr shows no new errors; the `new_quest_lv52` LUA_ERROR also appears on the live cores.
- Live acceptance on CH1 (13000) after the deploy, sword 279 and scroll 71084:
- two alternatives with minimum 1 → `matched` after 2 rolls;
- three attributes at the maximum with limit 10 → `limit` after 10 rolls, scrolls 157 → 147;
- `stop` after 1 s → `stopped` after 4 rolls.
- Not done yet: Android device validation.
## Production deployment
- 2026-10-15 14:51, approved by the user. The 203 live cores now run main `3b7e158` (`game` sha256 `0d798ec0…`, the binary the channel-5 core was tested with). The db binary is unchanged. Live `/usr/metin2/src` was at `4577d86`, so the deploy also shipped `1a36719` (query protocol and calendar drop gates; the gates stay inert without `port_events.tsv`).
- Package `/root/deploy-features/20261015-features` (`deploy.sh check|go|rollback`, `SHA256SUMS`). The previous `game`/`db` are in `/root/backup-bin/20261015-145122` (recorded in `LAST_BACKUP`), and the replaced `/usr/metin2/src` files are in `src-before/`. `sh deploy.sh rollback` restores both.
- The first `go` stopped at `rebuild.sh stop_server` ("server still running" after about 38 s, cores still exiting) before any backup or copy; the second `go` succeeded. `start.sh` was answered with `1`, which starts only CH1 and game99, so CH2–CH4 were started afterwards with each `run.sh` in the `start.sh` order. 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 existing `new_quest_lv52` LUA_ERROR (present since 2026-09-21).
## Open items
- Attribute lock: done separately in `FEATURE-ATTR-LOCK.md` (table `mt_item_attr_lock`, applied inside `CItem::ChangeAttribute`, so every bot roll keeps the locked slots). The bot's own item cannot be locked or unlocked while it rolls.
- In 203 `player.item_proto`, 71084, 71151, 76014, 76023 and 39028 are USE/USE_CHANGE_ATTRIBUTE (subtype 18); 71302 (the AVA2 talisman scroll) does not exist. The bot accepts any `USE_CHANGE_ATTRIBUTE` scroll and leaves item rules to the original path.
- `tests/features/test_switchbot.py` checks:
- the window enum, headers, subheaders, struct fields and sizes, on both the server and the client;
- the window hooks, the P2P hand-over, the boot ALTER and the switcher choice;
- the version gate;
- that `/mt_switchbot` is gone.
- Client: `metin2-client/tests/wiki/test_switchbot.py` checks that the window script is AVA2 `uiswitchbot.py` verbatim, plus its glue.
- Not yet compiled on 203 and not deployed. The live 203 still runs v1, so the server and client must be deployed together.