limit EnumerateShop responses

This commit is contained in:
wish
2023-11-29 21:37:41 +11:00
parent ea981ca70f
commit e914cf406b
2 changed files with 5 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ type MsgMhfEnumerateShop struct {
AckHandle uint32
ShopType uint8 // 1 running gachas, 10 normal shop extensions, 8 Diva Defense shop
ShopID uint32
Unk2 uint16 // 00 80 running gachas, 00 20 normal shop
Limit uint16
Unk3 uint8
Unk4 uint8
Unk5 uint32
@@ -30,7 +30,7 @@ func (m *MsgMhfEnumerateShop) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
m.AckHandle = bf.ReadUint32()
m.ShopType = bf.ReadUint8()
m.ShopID = bf.ReadUint32()
m.Unk2 = bf.ReadUint16()
m.Limit = bf.ReadUint16()
m.Unk3 = bf.ReadUint8()
if _config.ErupeConfig.RealClientMode >= _config.G2 {
m.Unk4 = bf.ReadUint8()

View File

@@ -241,6 +241,9 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
case 10: // Item shop, 0-8
bf := byteframe.NewByteFrame()
items := getShopItems(s, pkt.ShopType, pkt.ShopID)
if len(items) > int(pkt.Limit) {
items = items[:pkt.Limit]
}
writeShopItems(bf, items)
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}