fix(protocol): send super/new faces with the right wire encoding (#168)

A face was always built as a legacy FaceElem (face.index). QQ-NT only renders
classic small faces that way; newer 'super'/animated faces sent as face.index
are silently remapped by the server (e.g. 424→168) or shown as a placeholder.

Classify each face id off QQ's own system-face catalog (0x9154_1, ported from
SLE/Lagrange) and pick the matching wire form:
  - super (animated, aniSticker pack ≠ (1,1)) → CommonElem 37 + QFaceExtra
  - other id ≥ 260                            → CommonElem 33 + QSmallFaceExtra
  - classic id < 260                          → legacy FaceElem

The catalog is fetched once (shared, lazy-warmed off the first face send) and
classify falls back to an id-range guess until it lands. Data-driven so all 66
non-(1,1) super faces encode correctly, not just a hardcoded few.

Verified on a live account: 424→424 (was 168), super 392→392, classic 14→14.
This commit is contained in:
DrSmoothl committed 2026-06-30 16:09:28 +08:00
1 parent f9900053b0
commit c839121fdb
6 files changed
+429 -6

No files matched your search

@@ -0,0 +1,61 @@
// 0x9154_1 — system face / emoji catalog (sysface) protobuf shapes.
//
// Mirrors Lagrange.Core's FetchFullSysFacesService response: one round-trip
// returns every pack — common faces, "big"/super animated faces, and the
// magic-face pack. Each emoji carries its `aniSticker*` metadata, which the
// send path uses to pick the right wire encoding for a face id (classic
// FaceElem vs CommonElem 37/33). See protocol/oidb-services/sys-faces.
import type { pb, pb_repeated, int_32 } from '@snowluma/proton';
export interface OidbFaceResourceUrl {
baseUrl?: pb<1, string>;
advUrl?: pb<2, string>;
}
export interface OidbFaceEmoji {
qSid?: pb<1, string>;
qDes?: pb<2, string>;
emCode?: pb<3, string>;
qCid?: pb<4, int_32>;
aniStickerType?: pb<5, int_32>;
aniStickerPackId?: pb<6, int_32>;
aniStickerId?: pb<7, int_32>;
url?: pb<8, OidbFaceResourceUrl>;
emojiNameAlias?: pb_repeated<9, string>;
unknown10?: pb<10, int_32>;
aniStickerWidth?: pb<13, int_32>;
aniStickerHeight?: pb<14, int_32>;
}
export interface OidbFaceEmojiList {
emojiPackName?: pb<1, string>;
emojiDetail?: pb_repeated<2, OidbFaceEmoji>;
}
export interface OidbFaceContent {
emojiList?: pb_repeated<1, OidbFaceEmojiList>;
resourceUrl?: pb<2, OidbFaceResourceUrl>;
}
export interface OidbFaceMagicContentList {
emojiList?: pb_repeated<2, OidbFaceEmoji>;
}
export interface OidbFaceMagicContent {
field1?: pb<1, OidbFaceMagicContentList>;
resourceUrl?: pb<2, OidbFaceResourceUrl>;
}
export interface OidbFetchSysFacesReq {
field1?: pb<1, int_32>;
field2?: pb<2, int_32>;
field3?: pb<3, string>;
}
export interface OidbFetchSysFacesResp {
field1?: pb<1, int_32>;
commonFace?: pb<2, OidbFaceContent>;
specialBigFace?: pb<3, OidbFaceContent>;
specialMagicFace?: pb<4, OidbFaceMagicContent>;
}