mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
feat: market face parser & dice face support
This commit is contained in:
parent
0ef4c01861
commit
a8e6d4b945
File diff suppressed because it is too large
Load Diff
@ -196,10 +196,10 @@ message Elem {
|
||||
optional OnlineImage onlineImage = 3;
|
||||
optional NotOnlineImage notOnlineImage = 4;
|
||||
optional TransElem transElemInfo = 5;
|
||||
//MarketFace marketFace = 6;
|
||||
optional MarketFace marketFace = 6;
|
||||
//ElemFlags elemFlags = 7;
|
||||
optional CustomFace customFace = 8;
|
||||
//ElemFlags2 elemFlags2 = 9;
|
||||
optional ElemFlags2 elemFlags2 = 9;
|
||||
//FunFace funFace = 10;
|
||||
//SecretFileMsg secretFile = 11;
|
||||
optional RichMsg richMsg = 12;
|
||||
@ -246,6 +246,53 @@ message Elem {
|
||||
optional CommonElem commonElem = 53;
|
||||
}
|
||||
|
||||
message MarketFace {
|
||||
optional bytes faceName = 1;
|
||||
optional uint32 itemType = 2;
|
||||
optional uint32 faceInfo = 3;
|
||||
optional bytes faceId = 4;
|
||||
optional uint32 tabId = 5;
|
||||
optional uint32 subType = 6;
|
||||
optional bytes key = 7;
|
||||
optional bytes param = 8;
|
||||
optional uint32 mediaType = 9;
|
||||
optional uint32 imageWidth = 10;
|
||||
optional uint32 imageHeight = 11;
|
||||
optional bytes mobileparam = 12;
|
||||
optional bytes pbReserve = 13;
|
||||
}
|
||||
|
||||
message ElemFlags2 {
|
||||
optional uint32 colorTextId = 1;
|
||||
optional uint64 msgId = 2;
|
||||
optional uint32 whisperSessionId = 3;
|
||||
optional uint32 pttChangeBit = 4;
|
||||
optional uint32 vipStatus = 5;
|
||||
optional uint32 compatibleId = 6;
|
||||
repeated Inst insts = 7;
|
||||
optional uint32 msgRptCnt = 8;
|
||||
optional Inst srcInst = 9;
|
||||
optional uint32 longtitude = 10;
|
||||
optional uint32 latitude = 11;
|
||||
optional uint32 customFont = 12;
|
||||
optional PcSupportDef pcSupportDef = 13;
|
||||
optional uint32 crmFlags = 14;
|
||||
|
||||
message Inst {
|
||||
optional uint32 appId = 1;
|
||||
optional uint32 instId = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message PcSupportDef {
|
||||
optional uint32 pcPtlBegin = 1;
|
||||
optional uint32 pcPtlEnd = 2;
|
||||
optional uint32 macPtlBegin = 3;
|
||||
optional uint32 macPtlEnd = 4;
|
||||
repeated uint32 ptlsSupport = 5;
|
||||
repeated uint32 ptlsNotSupport = 6;
|
||||
}
|
||||
|
||||
message CommonElem {
|
||||
optional int32 serviceType = 1;
|
||||
optional bytes pbElem = 2;
|
||||
|
@ -38,6 +38,19 @@ type FaceElement struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type MarketFaceElement struct {
|
||||
Name string
|
||||
ItemType int32
|
||||
SubType int32
|
||||
EncryptKey []byte // tea + xor, see EMosmUtils.class::a maybe useful?
|
||||
MagicValue string
|
||||
}
|
||||
|
||||
type DiceElement struct {
|
||||
*MarketFaceElement
|
||||
Value int32
|
||||
}
|
||||
|
||||
type AtElement struct {
|
||||
Target int64
|
||||
Display string
|
||||
@ -224,6 +237,10 @@ func (e *FaceElement) Type() ElementType {
|
||||
return Face
|
||||
}
|
||||
|
||||
func (e *MarketFaceElement) Type() ElementType {
|
||||
return Face
|
||||
}
|
||||
|
||||
func (e *AtElement) Type() ElementType {
|
||||
return At
|
||||
}
|
||||
|
@ -467,6 +467,28 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
||||
Md5: elem.CustomFace.Md5,
|
||||
})
|
||||
}
|
||||
if elem.MarketFace != nil {
|
||||
face := &MarketFaceElement{
|
||||
Name: utils.B2S(elem.MarketFace.GetFaceName()),
|
||||
ItemType: int32(elem.MarketFace.GetItemType()),
|
||||
SubType: int32(elem.MarketFace.GetSubType()),
|
||||
EncryptKey: elem.MarketFace.GetKey(),
|
||||
MagicValue: utils.B2S(elem.MarketFace.Mobileparam),
|
||||
}
|
||||
if face.Name == "[骰子]" {
|
||||
return []IMessageElement{
|
||||
&DiceElement{
|
||||
MarketFaceElement: face,
|
||||
Value: func() int32 {
|
||||
v := strings.SplitN(face.MagicValue, "=", 2)[1]
|
||||
t, _ := strconv.ParseInt(v, 10, 32)
|
||||
return int32(t) + 1
|
||||
}(),
|
||||
},
|
||||
}
|
||||
}
|
||||
return []IMessageElement{face}
|
||||
}
|
||||
if elem.NotOnlineImage != nil {
|
||||
var img string
|
||||
if elem.NotOnlineImage.GetOrigUrl() != "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user