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 { func (r *JceReader) ReadMapStrMapStrByte(tag int) map[string]map[string][]byte {
if !r.skipToTag(tag) { if !r.skipToTag(tag) {
return nil return nil

View File

@ -527,6 +527,12 @@ type (
DelType byte `jceId:"2"` DelType byte `jceId:"2"`
Version int32 `jceId:"3"` 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) { func (pkt *RequestPacket) ReadFrom(r *JceReader) {
@ -736,3 +742,9 @@ func (pkt *InstanceInfo) ReadFrom(r *JceReader) {
pkt.ProductType = r.ReadInt64(3) pkt.ProductType = r.ReadInt64(3)
pkt.ClientType = r.ReadInt64(4) 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) w.WriteInt32(pkt.Version, 3)
return w.Bytes() 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 ( import (
"crypto/md5" "crypto/md5"
"fmt"
"net/netip" "net/netip"
"strconv" "strconv"
"strings" "strings"
@ -428,16 +429,25 @@ func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, paylo
return jce.NewJceReader(data.Map["RespSummaryCard"]["SummaryCard_Old.RespSummaryCard"][1:]) return jce.NewJceReader(data.Map["RespSummaryCard"]["SummaryCard_Old.RespSummaryCard"][1:])
}() }()
info := &SummaryCardInfo{ info := &SummaryCardInfo{
Sex: rsp.ReadByte(1), Sex: rsp.ReadByte(1),
Age: rsp.ReadByte(2), Age: rsp.ReadByte(2),
Nickname: rsp.ReadString(3), Nickname: rsp.ReadString(3),
Level: rsp.ReadInt32(5), Level: rsp.ReadInt32(5),
City: rsp.ReadString(7), City: rsp.ReadString(7),
Sign: rsp.ReadString(8), Sign: rsp.ReadString(8),
Mobile: rsp.ReadString(11), Mobile: rsp.ReadString(11),
Uin: rsp.ReadInt64(23), 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) services := rsp.ReadByteArrArr(46)
readService := func(buf []byte) (*profilecard.BusiComm, []byte) { readService := func(buf []byte) (*profilecard.BusiComm, []byte) {
r := binary.NewReader(buf) r := binary.NewReader(buf)

View File

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