stage improvements

This commit is contained in:
wish
2022-08-05 16:38:42 +10:00
parent 56841a5ab3
commit 09812fa81b
2 changed files with 23 additions and 21 deletions

View File

@@ -1,19 +1,19 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/common/stringsupport"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgSysEnumerateStage represents the MSG_SYS_ENUMERATE_STAGE
type MsgSysEnumerateStage struct {
AckHandle uint32
Unk0 uint8 // Hardcoded 1 in the binary
StageIDLength uint8
StageID string // NULL terminated string.
AckHandle uint32
Unk0 uint8 // Hardcoded 1 in the binary
StageID string // NULL terminated string.
}
// Opcode returns the ID associated with this packet type.
@@ -25,8 +25,8 @@ func (m *MsgSysEnumerateStage) Opcode() network.PacketID {
func (m *MsgSysEnumerateStage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.StageIDLength = bf.ReadUint8()
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))
bf.ReadUint8()
m.StageID = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}