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
+23
View File
@@ -474,6 +474,21 @@ enum EOnIdleEvents
ON_IDLE_MAX_NUM
};
// PORT: AVA2 ENABLE_SWITCHBOT (port_switchbot.cpp). Slot 5 is AVA2's hidden scroll cell; this port keeps
// the table width but never stores an item there.
enum SwitchbotValues
{
SWITCHBOT_SLOT_COUNT = 6,
SWITCHBOT_SLOT_COUNT_REAL = 5,
SWITCHBOT_ALTERNATIVE_COUNT = 2,
SWITCHBOT_NORM_ATTR_NUM = 5, // AVA2 MAX_NORM_ATTR_NUM
//1 = Switching Item
//2 = Yang
SWITCHBOT_PRICE_TYPE = 1,
//Amount Swtichting Items the Yang-Price
SWITCHBOT_PRICE_AMOUNT = 1,
};
enum EWindows
{
RESERVED_WINDOW,
@@ -483,6 +498,7 @@ enum EWindows
MALL,
DRAGON_SOUL_INVENTORY,
BELT_INVENTORY,
SWITCHBOT, // PORT: 7 = player.item.window enum 'SWITCHBOT' (appended after BELT_INVENTORY)
#ifdef __AUCTION__
AUCTION,
#endif
@@ -757,6 +773,8 @@ typedef struct SItemPos
return cell < INVENTORY_AND_EQUIP_SLOT_MAX;
case DRAGON_SOUL_INVENTORY:
return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM);
case SWITCHBOT:
return cell < SWITCHBOT_SLOT_COUNT;
// 동적으로 크기가 정해지는 window는 valid 체크를 할 수가 없다.
case SAFEBOX:
case MALL:
@@ -796,6 +814,11 @@ typedef struct SItemPos
return INVENTORY == window_type && cell < INVENTORY_MAX_NUM;
}
bool IsSwitchbotPosition() const
{
return SWITCHBOT == window_type && cell < SWITCHBOT_SLOT_COUNT;
}
bool operator==(const struct SItemPos& rhs) const
{
return (window_type == rhs.window_type) && (cell == rhs.cell);
+46
View File
@@ -1484,5 +1484,51 @@ typedef struct SChannelStatus
BYTE bStatus;
} TChannelStatus;
// PORT: AVA2 ENABLE_SWITCHBOT tables (port_switchbot.cpp). TSwitchbotTable goes to the client as is
// (SUBHEADER_GC_SWITCHBOT_UPDATE) and between cores (HEADER_GG_SWITCHBOT): 220 bytes.
struct TSwitchbotAttributeAlternativeTable
{
TPlayerItemAttribute attributes[SWITCHBOT_NORM_ATTR_NUM];
bool IsConfigured() const
{
for (BYTE i = 0; i < SWITCHBOT_NORM_ATTR_NUM; ++i)
{
if (attributes[i].bType && attributes[i].sValue)
{
return true;
}
}
return false;
}
};
struct TSwitchbotTable
{
DWORD player_id;
bool active[SWITCHBOT_SLOT_COUNT];
bool finished[SWITCHBOT_SLOT_COUNT];
DWORD items[SWITCHBOT_SLOT_COUNT];
TSwitchbotAttributeAlternativeTable alternatives[SWITCHBOT_SLOT_COUNT][SWITCHBOT_ALTERNATIVE_COUNT];
TSwitchbotTable() : player_id(0)
{
memset(&items, 0, sizeof(items));
memset(&alternatives, 0, sizeof(alternatives));
memset(&active, false, sizeof(active));
memset(&finished, false, sizeof(finished));
}
};
// PORT: AVA2 declares max_value as long; int keeps the 4-byte wire width the client mirrors with LONG.
struct TSwitchbottAttributeTable
{
BYTE attribute_set;
int apply_num;
int max_value;
};
#pragma pack()
#endif