Files
Erupe/network/mhfpacket/msg_sys_update_right.go
stratic-dev 62fe5cf277 moved bin 8 out and removed clientctx
moved crypto bin8 out of entrance server

removed unused clientctx

missed import

fix accidental commit and rename ack_helpers
2024-10-09 18:36:34 +01:00

47 lines
1.3 KiB
Go

package mhfpacket
import (
"errors"
"erupe-ce/network"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/mhfcourse"
ps "erupe-ce/utils/pascalstring"
)
// MsgSysUpdateRight represents the MSG_SYS_UPDATE_RIGHT
type MsgSysUpdateRight struct {
ClientRespAckHandle uint32 // If non-0, requests the client to send back a MSG_SYS_ACK packet with this value.
Bitfield uint32
Rights []mhfcourse.Course
UnkSize uint16 // Count of some buf up to 0x800 bytes following it.
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysUpdateRight) Opcode() network.PacketID {
return network.MSG_SYS_UPDATE_RIGHT
}
// Parse parses the packet from binary
func (m *MsgSysUpdateRight) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgSysUpdateRight) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint32(m.ClientRespAckHandle)
bf.WriteUint32(m.Bitfield)
bf.WriteUint16(uint16(len(m.Rights)))
bf.WriteUint16(0)
for _, v := range m.Rights {
bf.WriteUint16(v.ID)
bf.WriteUint16(0)
if v.Expiry.IsZero() {
bf.WriteUint32(0)
} else {
bf.WriteUint32(uint32(v.Expiry.Unix()))
}
}
ps.Uint16(bf, "", false) // update client login token / password in the game's launcherstate struct
return nil
}