1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

client: add VipLevel in SummaryCard

This commit is contained in:
wdvxdr 2022-06-22 09:56:50 +08:00
parent ae8c187aa5
commit 24ee0103e7
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6
5 changed files with 66 additions and 9 deletions

View File

@ -417,6 +417,32 @@ func (r *JceReader) ReadMapStrByte(tag int) map[string][]byte {
}
}
func (r *JceReader) ReadMapIntVipInfo(tag int) map[int]*VipInfo {
if !r.skipToTag(tag) {
return nil
}
r.skipHead()
hd, _ := r.readHead()
switch hd.Type {
case 8:
s := r.ReadInt32(0)
m := make(map[int]*VipInfo, s)
for i := 0; i < int(s); i++ {
k := r.ReadInt64(0)
v := new(VipInfo)
r.readHead()
v.ReadFrom(r)
r.skipToStructEnd()
m[int(k)] = v
}
r.skipToStructEnd()
return m
default:
r.skipToStructEnd()
return nil
}
}
func (r *JceReader) ReadMapStrMapStrByte(tag int) map[string]map[string][]byte {
if !r.skipToTag(tag) {
return nil

View File

@ -527,6 +527,12 @@ type (
DelType byte `jceId:"2"`
Version int32 `jceId:"3"`
}
VipInfo struct {
Open byte `jceId:"0"` // 1 为开通
Type int32 `jceId:"1"` // 1 为年费
Level int32 `jceId:"2"`
}
)
func (pkt *RequestPacket) ReadFrom(r *JceReader) {
@ -736,3 +742,9 @@ func (pkt *InstanceInfo) ReadFrom(r *JceReader) {
pkt.ProductType = r.ReadInt64(3)
pkt.ClientType = r.ReadInt64(4)
}
func (pkt *VipInfo) ReadFrom(r *JceReader) {
pkt.Open = r.ReadByte(0)
pkt.Type = r.ReadInt32(1)
pkt.Level = r.ReadInt32(2)
}

View File

@ -750,3 +750,11 @@ func (pkt *DelFriendReq) ToBytes() []byte {
w.WriteInt32(pkt.Version, 3)
return w.Bytes()
}
func (pkt *VipInfo) ToBytes() []byte {
w := NewJceWriter()
w.WriteByte(pkt.Open, 0)
w.WriteInt32(pkt.Type, 1)
w.WriteInt32(pkt.Level, 2)
return w.Bytes()
}

View File

@ -2,6 +2,7 @@ package client
import (
"crypto/md5"
"fmt"
"net/netip"
"strconv"
"strings"
@ -436,8 +437,17 @@ func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, paylo
Sign: rsp.ReadString(8),
Mobile: rsp.ReadString(11),
Uin: rsp.ReadInt64(23),
LoginDays: rsp.ReadInt64(36),
}
vipInfo := rsp.ReadMapIntVipInfo(29) // 1 -> vip, 3 -> svip
if v1, v3 := vipInfo[1], vipInfo[3]; v1 != nil || v3 != nil {
if v1.Open != 0 {
info.VipLevel = fmt.Sprintf("vip%d", v1.Level)
}
if v3.Open != 0 {
info.VipLevel = fmt.Sprintf("svip%d", v3.Level)
}
}
info.LoginDays = rsp.ReadInt64(36)
services := rsp.ReadByteArrArr(46)
readService := func(buf []byte) (*profilecard.BusiComm, []byte) {
r := binary.NewReader(buf)

View File

@ -77,6 +77,7 @@ type (
Mobile string
LoginDays int64
Qid string
VipLevel string
}
OtherClientInfo struct {