From 4b0a0f0a32c5afd614da2e1c57b785a1c528cae8 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Fri, 10 Jan 2025 15:23:40 +0800 Subject: [PATCH] feat: #702 --- src/core/packet/message/element.ts | 8 +++++- .../transformer/highway/UploadGroupImage.ts | 7 +++-- .../transformer/highway/UploadPrivateImage.ts | 7 +++-- .../proto/oidb/common/Ntv2.RichMediaReq.ts | 28 +++++++++++++++++-- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/core/packet/message/element.ts b/src/core/packet/message/element.ts index a45b5236..cedcf44e 100644 --- a/src/core/packet/message/element.ts +++ b/src/core/packet/message/element.ts @@ -256,6 +256,8 @@ export class PacketMsgPicElement extends IPacketMsgElement { width: number; height: number; picType: PicType; + picSubType: number; + summary: string; sha1: string | null = null; msgInfo: NapProtoEncodeStructType | null = null; groupPicExt: NapProtoEncodeStructType | null = null; @@ -270,6 +272,10 @@ export class PacketMsgPicElement extends IPacketMsgElement { this.width = element.picElement.picWidth; this.height = element.picElement.picHeight; this.picType = element.picElement.picType; + this.picSubType = element.picElement.picSubType ?? 0; + this.summary = element.picElement.summary === '' ? ( + element.picElement.picSubType === 0 ? '[图片]' : '[动画表情]' + ) : element.picElement.summary; } get valid(): boolean { @@ -288,7 +294,7 @@ export class PacketMsgPicElement extends IPacketMsgElement { } toPreview(): string { - return "[图片]"; + return this.summary; } } diff --git a/src/core/packet/transformer/highway/UploadGroupImage.ts b/src/core/packet/transformer/highway/UploadGroupImage.ts index 6c38cfbd..15d2f715 100644 --- a/src/core/packet/transformer/highway/UploadGroupImage.ts +++ b/src/core/packet/transformer/highway/UploadGroupImage.ts @@ -58,8 +58,11 @@ class UploadGroupImage extends PacketTransformer compatQMsgSceneType: 2, extBizInfo: { pic: { - bytesPbReserveTroop: Buffer.from("0800180020004200500062009201009a0100a2010c080012001800200028003a00", 'hex'), - textSummary: "Nya~", // TODO: + bizType: img.picSubType, + bytesPbReserveTroop: { + subType: img.picSubType, + }, + textSummary: img.summary, }, video: { bytesPbReserve: Buffer.alloc(0), diff --git a/src/core/packet/transformer/highway/UploadPrivateImage.ts b/src/core/packet/transformer/highway/UploadPrivateImage.ts index 9b9b708c..61d7ebf6 100644 --- a/src/core/packet/transformer/highway/UploadPrivateImage.ts +++ b/src/core/packet/transformer/highway/UploadPrivateImage.ts @@ -58,8 +58,11 @@ class UploadPrivateImage extends PacketTransformer BytesPbReserveC2c), + BytesPbReserveTroop: ProtoField(12, () => BytesPbReserveTroop), FromScene: ProtoField(1001, ScalarType.UINT32), ToScene: ProtoField(1002, ScalarType.UINT32), OldFileId: ProtoField(1003, ScalarType.UINT32), @@ -211,3 +211,27 @@ export const UploadInfo = { FileInfo: ProtoField(1, () => FileInfo), SubFileType: ProtoField(2, ScalarType.UINT32), }; + +export const BytesPbReserveC2c = { + subType: ProtoField(1, ScalarType.UINT32), + field3: ProtoField(3, ScalarType.UINT32), + field4: ProtoField(4, ScalarType.UINT32), + field8: ProtoField(8, ScalarType.STRING), + field10: ProtoField(10, ScalarType.UINT32), + field12: ProtoField(12, ScalarType.STRING), + field18: ProtoField(18, ScalarType.STRING), + field19: ProtoField(19, ScalarType.STRING), + field20: ProtoField(20, ScalarType.BYTES), +}; + +export const BytesPbReserveTroop = { + subType: ProtoField(1, ScalarType.UINT32), + field3: ProtoField(3, ScalarType.UINT32), + field4: ProtoField(4, ScalarType.UINT32), + field9: ProtoField(9, ScalarType.STRING), + field10: ProtoField(10, ScalarType.UINT32), + field12: ProtoField(12, ScalarType.STRING), + field18: ProtoField(18, ScalarType.STRING), + field19: ProtoField(19, ScalarType.STRING), + field21: ProtoField(21, ScalarType.BYTES), +};