Add attribute lock (AVA2 ENABLE_LOCK_ATTR port)

Up to two normal attribute slots (addon pair = one group) keep their
type and value through CItem::ChangeAttribute, so scroll rerolls, the
switchbot and GM rerolls all respect it. The mask lives in the new
player.mt_item_attr_lock table (created at boot), cached per CItem and
written synchronously; CopyAttributeTo carries it to refined items.
No item struct, db cache or client packet change. Toggled with
/mt_switchbot 1 lock CELL SLOT; MTSB1 lock line follows attrs_end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-15 23:06:00 +09:00
co-authored by Claude Opus 5.5
parent 400e44fae4
commit dc7159338e
12 changed files with 367 additions and 13 deletions
+3 -1
View File
@@ -27,6 +27,7 @@ Requests (250 ms per-character throttle; tokens <= 10 chars, <= 30 tokens):
/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)
```
Replies:
@@ -36,6 +37,7 @@ 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
```
@@ -87,5 +89,5 @@ Capability: the MTF1 cap mask advertises bit 64 (63 -> 127). Clients that don't
## Open items
- Attribute lock: AVA2 stores it at attribute index 7, which the current 7-slot layout cannot hold. It needs its own storage design (see the client migration plan, phase 6).
- 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.