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.
This commit is contained in:
shen
2026-10-22 01:29:14 -07:00
parent 867633667f
commit 846a993183
345 changed files with 48463 additions and 326 deletions
+29 -7
View File
@@ -698,10 +698,10 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
struct
{
GCMessengerHead head;
GuildInfo35 info;
GuildInfo39 info;
} __attribute__((packed)) guild_info_pkt = {
{HDR_GC_GUILD, static_cast<std::uint16_t>(sizeof(guild_info_pkt)), 8 /* GUILD_GC_INFO */},
zeroed<GuildInfo35>()
zeroed<GuildInfo39>()
};
guild_info_pkt.info.guild_id = kGuildID;
guild_info_pkt.info.master_pid = 1;
@@ -769,6 +769,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
return true;
const std::uint8_t header = packet[0];
size_t size = static_cast<size_t>(packet_size_cg(header));
if (header == 235) size = 5; // AVA2 batch header + count, followed by count VIDs
if (is_dynamic_cg(header) || header == HDR_CG_SYNC_POSITION)
{
if (c.Read(packet + 1, sizeof(DynHead) - 1) != 1)
@@ -784,6 +785,14 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
return Fail(name + ": unknown CG header " + std::to_string(header) + " in the game phase");
else if (size > 1 && c.Read(packet + 1, size - 1) != 1)
return true;
if (header == 235) {
uint32_t count = 0;
std::memcpy(&count, packet + 1, 4);
if (count > 48) return Fail(name + ": autohunt batch exceeds 48");
if (count && c.Read(packet + 5, count * 4) != 1) return true;
size += count * 4;
}
// CInputMain::Shop returns the bytes each subheader carries past TPacketCGShop; the sequence byte follows them.
if (header == HDR_CG_SHOP)
{
@@ -825,6 +834,19 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
return Fail(name + ": mobile move reply");
}
}
if (header == 235) {
uint32_t count = 0;
std::memcpy(&count, packet + 1, 4);
Event(name + ":pickup_batch " + std::to_string(count));
for (uint32_t i = 0; i < count; ++i) {
uint32_t vid = 0;
std::memcpy(&vid, packet + 5 + i * 4, 4);
Event(name + ":batch_vid " + std::to_string(vid));
GCItemGroundDel del = {HDR_GC_ITEM_GROUND_DEL, vid};
if (!c.Send(del)) return Fail(name + ": batch delete reply");
}
}
// CInputMain::ItemPickup → CHARACTER::PickupItem → CItem::RemoveFromGround → EncodeRemovePacket.
if (header == HDR_CG_ITEM_PICKUP)
{
@@ -1048,9 +1070,9 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
DynHead head;
std::uint8_t subheader;
std::uint32_t owner_vid;
ShopItem43 items[SHOP_HOST_ITEM_MAX_NUM];
ShopItem47 items[SHOP_HOST_ITEM_MAX_NUM];
} __attribute__((packed)) start = zeroed<decltype(start)>();
static_assert(sizeof(start) == 4 + 4 + 40 * 43);
static_assert(sizeof(start) == 4 + 4 + 40 * 47);
start.head = {HDR_GC_SHOP, static_cast<std::uint16_t>(sizeof(start))};
start.subheader = SHOP_SUB_START;
start.owner_vid = kShopVID;
@@ -1087,7 +1109,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
{
const std::uint8_t sub = packet[1];
Event(name + ":shop " + std::to_string(sub) +
(sub == SHOP_CG_BUY || sub == SHOP_CG_SELL2 ? " " + std::to_string(packet[2]) + " " + std::to_string(packet[3]) : std::string()));
(sub == SHOP_CG_BUY || sub == SHOP_CG_SELL2 ? " " + std::to_string(packet[sizeof(CGShop)]) + " " + std::to_string(packet[sizeof(CGShop) + 1]) : std::string()));
auto gold_change = [&](std::int32_t amount) {
gold += amount;
GCPointChange change = zeroed<GCPointChange>();
@@ -1109,7 +1131,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
} __attribute__((packed)) end = {{HDR_GC_SHOP, 4}, SHOP_SUB_END};
ok = c.Send(end);
}
else if (sub == SHOP_CG_BUY && shopping && packet[3] == 0 && bag0 == 0)
else if (sub == SHOP_CG_BUY && shopping && packet[sizeof(CGShop) + 1] == 0 && bag0 == 0)
{
bag0 = kShopItemVnum;
potion_cell = 0;
@@ -1120,7 +1142,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
set.count = 1;
ok = gold_change(-static_cast<std::int32_t>(kShopItemPrice)) && c.Send(set);
}
else if (sub == SHOP_CG_SELL2 && shopping && packet[2] == 0 && bag0 != 0)
else if (sub == SHOP_CG_SELL2 && shopping && packet[sizeof(CGShop)] == 0 && bag0 != 0)
{
bag0 = 0;
GCItemDelDeprecated del = zeroed<GCItemDelDeprecated>();