feat: support market emoticon

This commit is contained in:
Il Harper 2024-04-12 04:16:02 +08:00
parent 6f9df7e801
commit 0791221f36
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
4 changed files with 50 additions and 13 deletions

View File

@ -254,20 +254,25 @@ export class Messager {
}
case `${this.ctx.chronocat.platform}:face`: {
const face = (await this.ctx.chronocat.api[
'chronocat.internal.qface.get'
](`${attrs['id']}`))!
if (attrs['unsafeMarketEmoticon']) {
this.children.push(r.marketEmoticon(Number(attrs['id'])))
} else {
const face = (await this.ctx.chronocat.api[
'chronocat.internal.qface.get'
](`${attrs['id']}`))!
this.children.push(
r.face(
face,
attrs['unsafeSuper']
? FaceType.Super
: face.QSid === face.IQLid && face.QSid === face.AQLid
? FaceType.Normal2
: FaceType.Normal1,
),
)
}
this.children.push(
r.face(
face,
attrs['unsafeSuper']
? FaceType.Super
: face.QSid === face.IQLid && face.QSid === face.AQLid
? FaceType.Normal2
: FaceType.Normal1,
),
)
this.isEndLine = false
return
}

View File

@ -103,6 +103,17 @@ const b = () => {
},
},
marketEmoticon: (faceIndex: number): O.Partial<Element, 'deep'> => ({
elementType: 6,
elementId: '',
faceElement: {
faceIndex,
faceText: '\n',
faceType: FaceType.MarketEmoticon,
imageType: 1,
},
}),
pcPoke: (pokeType: number): O.Partial<Element, 'deep'> => ({
elementId: '0',
elementType: 6,

View File

@ -510,6 +510,17 @@ async function parseElements(
)
break
}
case FaceType.MarketEmoticon: {
elements.push(
ctx.chronocat.h(`${ctx.chronocat.platform}:face`, {
id: m.faceElement!.faceIndex,
platform: ctx.chronocat.platform,
'unsafe-market-emoticon': true,
}),
)
break
}
}
break
}

View File

@ -369,6 +369,16 @@ export enum FaceType {
*/
Super = 3,
/**
* MarketEmoticon
*
* faceIndex uint32
*
* - epId (Emoticon Pack ID) : faceIndex >> 16
* - eId (Emoticon ID) : faceIndex & 0xFFFF
*/
MarketEmoticon = 4,
/**
* PC
*/