major rewrite

This commit is contained in:
wish
2024-07-28 22:15:14 +10:00
parent 80e83f656e
commit b6a963b131
9 changed files with 350 additions and 1071 deletions

View File

@@ -2,18 +2,17 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfApplyCampaign represents the MSG_MHF_APPLY_CAMPAIGN
type MsgMhfApplyCampaign struct {
AckHandle uint32
CampaignID uint32
NullPadding uint16 // set as 0 in z2
CodeString string
AckHandle uint32
CampaignID uint32
Code string
}
// Opcode returns the ID associated with this packet type.
@@ -25,9 +24,8 @@ func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.CampaignID = bf.ReadUint32()
m.NullPadding = bf.ReadUint16()
m.CodeString = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
bf.ReadInt8()
bf.ReadUint16() // Zeroed
m.Code = string(bfutil.UpToNull(bf.ReadBytes(16)))
return nil
}