Skip to content

Commit

Permalink
feat: support facebubble
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Apr 29, 2024
1 parent 94f5f5d commit 30229d6
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 6 deletions.
12 changes: 12 additions & 0 deletions packages/engine-chronocat-api/src/api/message/create/messager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ export class Messager {
return
}

case `${this.ctx.chronocat.platform}:facebubble`: {
this.children.push(
r.faceBubble(
Number(attrs['id']),
Number(attrs['count']),
attrs['name'] as string,
attrs['content'] as string,
),
)
return
}

case 'quote': {
const [author] = this.ctx.chronocat.h.select(children, 'author')

Expand Down
20 changes: 19 additions & 1 deletion packages/engine-chronocat-api/src/api/message/create/r.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Element, Peer, QFace } from '@chronocat/red'
import type { Element, FaceBubbleType, Peer, QFace } from '@chronocat/red'
import { AtType, FaceType } from '@chronocat/red'
import type { ChronocatContext } from '@chronocat/shell'
import type { O } from 'ts-toolbelt'
Expand Down Expand Up @@ -136,6 +136,24 @@ const b = () => {
},
}),

faceBubble: (
id: FaceBubbleType,
count?: number,
summary?: string,
content?: string,
): O.Partial<Element, 'deep'> => ({
elementType: 27,
elementId: '',
faceBubbleElement: {
faceType: id,
faceCount: count || 1,
faceSummary: summary || '',
faceFlag: 0,
content: content || `[${summary}]x${count}`,
oldVersionStr: '',
},
}),

pcPoke: (pokeType: number): O.Partial<Element, 'deep'> => ({
elementId: '0',
elementType: 6,
Expand Down
12 changes: 12 additions & 0 deletions packages/engine-chronocat-event/src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,18 @@ async function parseElements(
break
}

case 27: {
elements.push(
ctx.chronocat.h(`${ctx.chronocat.platform}:facebubble`, {
id: m.faceBubbleElement!.faceType,
count: m.faceBubbleElement!.faceCount,
name: m.faceBubbleElement!.faceSummary,
content: m.faceBubbleElement!.content,
}),
)
break
}

default:
break
}
Expand Down
43 changes: 38 additions & 5 deletions packages/red/src/redEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ export interface Element {
videoElement?: VideoElement
walletElement?: unknown
yoloGameResultElement?: unknown
structMsgElement: unknown
faceBubbleElement: unknown
shareLocationElement: unknown
tofuRecordElement: unknown
taskTopMsgElement: unknown
structMsgElement?: unknown
faceBubbleElement?: FaceBubbleElement
shareLocationElement?: unknown
tofuRecordElement?: unknown
taskTopMsgElement?: unknown
}

export interface PicElement {
Expand Down Expand Up @@ -400,6 +400,39 @@ export interface QFace {
Input: string[]
}

export interface FaceBubbleElement {
faceType: FaceBubbleType
faceCount: number
faceSummary: string // '平底锅'
faceFlag: number // 0
content: string // '[平底锅]x1'
oldVersionStr: string // ''
others: unknown
yellowFaceInfo: unknown
}

export enum FaceBubbleType {
/**
* 榴莲
*/
Liulian = 9,

/**
* 略略略
*/
LveLveLve = 10,

/**
* 平底锅
*/
Pingdiguo = 11,

/**
* 钞票
*/
Chaopiao = 12,
}

export interface FileElement {
fileMd5: string
fileName: string
Expand Down

0 comments on commit 30229d6

Please sign in to comment.