fix EnumerateQuest parsing and limit tuneValue slice length

This commit is contained in:
wish
2023-08-21 22:22:15 +10:00
parent 192e68ba86
commit f680e33f16
2 changed files with 26 additions and 3 deletions

View File

@@ -30,10 +30,12 @@ func (m *MsgMhfEnumerateQuest) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.Unk0 = bf.ReadUint8()
m.World = bf.ReadUint8()
m.Counter = bf.ReadUint16()
m.Offset = bf.ReadUint16()
if _config.ErupeConfig.RealClientMode > _config.Z1 {
m.Unk4 = bf.ReadUint8()
if _config.ErupeConfig.RealClientMode <= _config.Z1 {
m.Offset = uint16(bf.ReadUint8())
} else {
m.Offset = bf.ReadUint16()
}
m.Unk4 = bf.ReadUint8()
return nil
}

View File

@@ -632,6 +632,27 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
offset := uint16(time.Now().Unix())
bf.WriteUint16(offset)
if _config.ErupeConfig.RealClientMode <= _config.F5 {
tuneValues = tuneValues[:256]
} else if _config.ErupeConfig.RealClientMode <= _config.G3 {
tuneValues = tuneValues[:283]
} else if _config.ErupeConfig.RealClientMode <= _config.GG {
tuneValues = tuneValues[:315]
} else if _config.ErupeConfig.RealClientMode <= _config.G61 {
tuneValues = tuneValues[:332]
} else if _config.ErupeConfig.RealClientMode <= _config.G7 {
tuneValues = tuneValues[:339]
} else if _config.ErupeConfig.RealClientMode <= _config.G81 {
tuneValues = tuneValues[:396]
} else if _config.ErupeConfig.RealClientMode <= _config.G91 {
tuneValues = tuneValues[:694]
} else if _config.ErupeConfig.RealClientMode <= _config.G101 {
tuneValues = tuneValues[:704]
} else if _config.ErupeConfig.RealClientMode <= _config.Z2 {
tuneValues = tuneValues[:750]
}
bf.WriteUint16(uint16(len(tuneValues)))
for i := range tuneValues {
bf.WriteUint16(tuneValues[i].ID ^ offset)