update parsing of many packets

This commit is contained in:
wish
2023-11-19 00:35:22 +11:00
parent 734b60bee1
commit fc57d63689
32 changed files with 146 additions and 171 deletions

View File

@@ -12,7 +12,7 @@ import (
type MsgMhfAcquireGuildTresure struct { type MsgMhfAcquireGuildTresure struct {
AckHandle uint32 AckHandle uint32
HuntID uint32 HuntID uint32
Unk uint8 Unk bool
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,7 +24,7 @@ func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.HuntID = bf.ReadUint32() m.HuntID = bf.ReadUint32()
m.Unk = bf.ReadUint8() m.Unk = bf.ReadBool()
return nil return nil
} }

View File

@@ -11,9 +11,7 @@ import (
// MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE // MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE
type MsgMhfAcquireTitle struct { type MsgMhfAcquireTitle struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 TitleIDs []uint16
Unk1 uint16
TitleID uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,9 +22,11 @@ func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() titles := int(bf.ReadUint16())
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.TitleID = bf.ReadUint16() for i := 0; i < titles; i++ {
m.TitleIDs = append(m.TitleIDs, bf.ReadUint16())
}
return nil return nil
} }

View File

@@ -1,9 +1,10 @@
package mhfpacket package mhfpacket
import ( import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
) )
// MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT // MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT
@@ -25,7 +26,5 @@ func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientct
} }
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle) return errors.New("NOT IMPLEMENTED")
bf.WriteUint32(m.Unk)
return nil
} }

View File

@@ -12,7 +12,6 @@ import (
type MsgMhfCheckMonthlyItem struct { type MsgMhfCheckMonthlyItem struct {
AckHandle uint32 AckHandle uint32
Type uint8 Type uint8
Unk []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,7 +23,9 @@ func (m *MsgMhfCheckMonthlyItem) Opcode() network.PacketID {
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Type = bf.ReadUint8() m.Type = bf.ReadUint8()
m.Unk = bf.ReadBytes(3) bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -12,7 +12,6 @@ type MsgMhfCheckWeeklyStamp struct {
AckHandle uint32 AckHandle uint32
StampType string StampType string
Unk1 bool Unk1 bool
Unk2 uint16 // Hardcoded 0 in the binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -31,7 +30,7 @@ func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
m.StampType = "ex" m.StampType = "ex"
} }
m.Unk1 = bf.ReadBool() m.Unk1 = bf.ReadBool()
m.Unk2 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -12,8 +12,6 @@ import (
// MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD // MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD
type MsgMhfCreateGuild struct { type MsgMhfCreateGuild struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8
Unk1 uint8
Name string Name string
} }
@@ -25,9 +23,8 @@ func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() bf.ReadUint16() // Zeroed
m.Unk1 = bf.ReadUint8() bf.ReadUint16() // Name length
_ = bf.ReadUint16() // len
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -1,15 +1,14 @@
package mhfpacket package mhfpacket
import ( import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
) )
// MsgMhfDisplayedAchievement represents the MSG_MHF_DISPLAYED_ACHIEVEMENT // MsgMhfDisplayedAchievement represents the MSG_MHF_DISPLAYED_ACHIEVEMENT
type MsgMhfDisplayedAchievement struct { type MsgMhfDisplayedAchievement struct{}
Unk0 uint8
}
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID { func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
@@ -18,12 +17,11 @@ func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.Unk0 = bf.ReadUint8() bf.ReadUint8() // Zeroed
return nil return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint8(m.Unk0) return errors.New("NOT IMPLEMENTED")
return nil
} }

View File

@@ -1,16 +1,15 @@
package mhfpacket package mhfpacket
import ( import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
) )
// MsgMhfEnumerateEvent represents the MSG_MHF_ENUMERATE_EVENT // MsgMhfEnumerateEvent represents the MSG_MHF_ENUMERATE_EVENT
type MsgMhfEnumerateEvent struct { type MsgMhfEnumerateEvent struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -21,15 +20,12 @@ func (m *MsgMhfEnumerateEvent) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle) return errors.New("NOT IMPLEMENTED")
bf.WriteUint16(m.Unk0)
bf.WriteUint16(m.Unk1)
return nil
} }

View File

@@ -3,16 +3,14 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfEnumeratePrice represents the MSG_MHF_ENUMERATE_PRICE // MsgMhfEnumeratePrice represents the MSG_MHF_ENUMERATE_PRICE
type MsgMhfEnumeratePrice struct { type MsgMhfEnumeratePrice struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +21,8 @@ func (m *MsgMhfEnumeratePrice) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumeratePrice) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumeratePrice) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,16 +3,14 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfEnumerateRanking represents the MSG_MHF_ENUMERATE_RANKING // MsgMhfEnumerateRanking represents the MSG_MHF_ENUMERATE_RANKING
type MsgMhfEnumerateRanking struct { type MsgMhfEnumerateRanking struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +21,9 @@ func (m *MsgMhfEnumerateRanking) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.Unk1 = bf.ReadUint16() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -11,7 +11,6 @@ import (
// MsgMhfEnumerateUnionItem represents the MSG_MHF_ENUMERATE_UNION_ITEM // MsgMhfEnumerateUnionItem represents the MSG_MHF_ENUMERATE_UNION_ITEM
type MsgMhfEnumerateUnionItem struct { type MsgMhfEnumerateUnionItem struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -22,8 +21,8 @@ func (m *MsgMhfEnumerateUnionItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateUnionItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateUnionItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -12,7 +12,6 @@ import (
type MsgMhfGetAchievement struct { type MsgMhfGetAchievement struct {
AckHandle uint32 AckHandle uint32
CharID uint32 CharID uint32
Unk1 uint32 // char?
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,7 +23,7 @@ func (m *MsgMhfGetAchievement) Opcode() network.PacketID {
func (m *MsgMhfGetAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfGetAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.CharID = bf.ReadUint32() m.CharID = bf.ReadUint32()
m.Unk1 = bf.ReadUint32() bf.ReadUint32() // Zeroed
return nil return nil
} }

View File

@@ -3,15 +3,14 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfGetRengokuBinary represents the MSG_MHF_GET_RENGOKU_BINARY // MsgMhfGetRengokuBinary represents the MSG_MHF_GET_RENGOKU_BINARY
type MsgMhfGetRengokuBinary struct { type MsgMhfGetRengokuBinary struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8 // Hardcoded 0 in binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -22,7 +21,7 @@ func (m *MsgMhfGetRengokuBinary) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfGetRengokuBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfGetRengokuBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -3,16 +3,15 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfInfoFesta represents the MSG_MHF_INFO_FESTA // MsgMhfInfoFesta represents the MSG_MHF_INFO_FESTA
type MsgMhfInfoFesta struct { type MsgMhfInfoFesta struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary Unk0 uint8
Unk1 uint16 // Hardcoded 0 in the binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +22,10 @@ func (m *MsgMhfInfoFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfInfoFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfInfoFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint16() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -3,15 +3,15 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfListMember represents the MSG_MHF_LIST_MEMBER // MsgMhfListMember represents the MSG_MHF_LIST_MEMBER
type MsgMhfListMember struct { type MsgMhfListMember struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 01 00 in the JP client. Unk0 uint8 // Hardcoded 01 in the JP client.
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -22,7 +22,8 @@ func (m *MsgMhfListMember) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfListMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfListMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() m.Unk0 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -19,7 +19,6 @@ type MsgMhfReadMail struct {
// This is the index within the current mail list // This is the index within the current mail list
Index uint8 Index uint8
Unk0 uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -32,7 +31,7 @@ func (m *MsgMhfReadMail) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.AccIndex = bf.ReadUint8() m.AccIndex = bf.ReadUint8()
m.Index = bf.ReadUint8() m.Index = bf.ReadUint8()
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -12,7 +12,6 @@ import (
type MsgMhfReleaseEvent struct { type MsgMhfReleaseEvent struct {
AckHandle uint32 AckHandle uint32
RaviID uint32 RaviID uint32
Unk1 uint32
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,7 +23,7 @@ func (m *MsgMhfReleaseEvent) Opcode() network.PacketID {
func (m *MsgMhfReleaseEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfReleaseEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.RaviID = bf.ReadUint32() m.RaviID = bf.ReadUint32()
m.Unk1 = bf.ReadUint32() bf.ReadUint32() // Zeroed
return nil return nil
} }

View File

@@ -3,16 +3,14 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfUpdateCafepoint represents the MSG_MHF_UPDATE_CAFEPOINT // MsgMhfUpdateCafepoint represents the MSG_MHF_UPDATE_CAFEPOINT
type MsgMhfUpdateCafepoint struct { type MsgMhfUpdateCafepoint struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 0 in binary
Unk1 uint16 // Hardcoded 0 in binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +21,8 @@ func (m *MsgMhfUpdateCafepoint) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfUpdateCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -30,7 +30,7 @@ func (m *MsgMhfUpdateGuacot) Opcode() network.PacketID {
func (m *MsgMhfUpdateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.EntryCount = bf.ReadUint16() m.EntryCount = bf.ReadUint16()
_ = bf.ReadUint16() // Zero bf.ReadUint16() // Zeroed
var temp Goocoo var temp Goocoo
for i := 0; i < int(m.EntryCount); i++ { for i := 0; i < int(m.EntryCount); i++ {
temp.Index = bf.ReadUint32() temp.Index = bf.ReadUint32()

View File

@@ -25,8 +25,6 @@ type GuildIconMsgPart struct {
type MsgMhfUpdateGuildIcon struct { type MsgMhfUpdateGuildIcon struct {
AckHandle uint32 AckHandle uint32
GuildID uint32 GuildID uint32
PartCount uint16
Unk1 uint16
IconParts []GuildIconMsgPart IconParts []GuildIconMsgPart
} }
@@ -39,12 +37,12 @@ func (m *MsgMhfUpdateGuildIcon) Opcode() network.PacketID {
func (m *MsgMhfUpdateGuildIcon) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateGuildIcon) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.PartCount = bf.ReadUint16() partCount := int(bf.ReadUint16())
m.Unk1 = bf.ReadUint16() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
m.IconParts = make([]GuildIconMsgPart, partCount)
m.IconParts = make([]GuildIconMsgPart, m.PartCount) for i := 0; i < partCount; i++ {
for i := 0; i < int(m.PartCount); i++ {
m.IconParts[i] = GuildIconMsgPart{ m.IconParts[i] = GuildIconMsgPart{
Index: bf.ReadUint16(), Index: bf.ReadUint16(),
ID: bf.ReadUint16(), ID: bf.ReadUint16(),

View File

@@ -10,7 +10,7 @@ import (
type Item struct { type Item struct {
Unk0 uint32 Unk0 uint32
ItemId uint16 ItemID uint16
Amount uint16 Amount uint16
Unk1 uint32 Unk1 uint32
} }
@@ -19,9 +19,7 @@ type Item struct {
type MsgMhfUpdateGuildItem struct { type MsgMhfUpdateGuildItem struct {
AckHandle uint32 AckHandle uint32
GuildId uint32 GuildId uint32
Amount uint16 Items []Item
Unk1 uint16 // 0x00 0x00
Items []Item // Array of updated item IDs
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -33,13 +31,14 @@ func (m *MsgMhfUpdateGuildItem) Opcode() network.PacketID {
func (m *MsgMhfUpdateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GuildId = bf.ReadUint32() m.GuildId = bf.ReadUint32()
m.Amount = bf.ReadUint16() itemCount := int(bf.ReadUint16())
m.Unk1 = bf.ReadUint16() bf.ReadUint8() // Zeroed
m.Items = make([]Item, int(m.Amount)) bf.ReadUint8() // Zeroed
m.Items = make([]Item, itemCount)
for i := 0; i < int(m.Amount); i++ { for i := 0; i < itemCount; i++ {
m.Items[i].Unk0 = bf.ReadUint32() m.Items[i].Unk0 = bf.ReadUint32()
m.Items[i].ItemId = bf.ReadUint16() m.Items[i].ItemID = bf.ReadUint16()
m.Items[i].Amount = bf.ReadUint16() m.Items[i].Amount = bf.ReadUint16()
m.Items[i].Unk1 = bf.ReadUint32() m.Items[i].Unk1 = bf.ReadUint32()
} }

View File

@@ -14,7 +14,6 @@ type MsgMhfUpdateHouse struct {
AckHandle uint32 AckHandle uint32
State uint8 State uint8
Unk1 uint8 // Always 0x01 Unk1 uint8 // Always 0x01
Unk2 uint16 // Always 0x0000
Password string Password string
} }
@@ -28,8 +27,9 @@ func (m *MsgMhfUpdateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.State = bf.ReadUint8() m.State = bf.ReadUint8()
m.Unk1 = bf.ReadUint8() m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16() bf.ReadUint8() // Zeroed
_ = bf.ReadUint8() // Password length bf.ReadUint8() // Zeroed
bf.ReadUint8() // Password length
m.Password = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) m.Password = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -11,9 +11,7 @@ import (
// MsgMhfUpdateUnionItem represents the MSG_MHF_UPDATE_UNION_ITEM // MsgMhfUpdateUnionItem represents the MSG_MHF_UPDATE_UNION_ITEM
type MsgMhfUpdateUnionItem struct { type MsgMhfUpdateUnionItem struct {
AckHandle uint32 AckHandle uint32
Amount uint16 Items []Item
Unk1 uint16 // 0x00 0x00
Items []Item // Array of updated item IDs
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,13 +22,14 @@ func (m *MsgMhfUpdateUnionItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfUpdateUnionItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateUnionItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Amount = bf.ReadUint16() itemCount := int(bf.ReadUint16())
m.Unk1 = bf.ReadUint16() bf.ReadUint8() // Zeroed
m.Items = make([]Item, int(m.Amount)) bf.ReadUint8() // Zeroed
m.Items = make([]Item, itemCount)
for i := 0; i < int(m.Amount); i++ { for i := 0; i < itemCount; i++ {
m.Items[i].Unk0 = bf.ReadUint32() m.Items[i].Unk0 = bf.ReadUint32()
m.Items[i].ItemId = bf.ReadUint16() m.Items[i].ItemID = bf.ReadUint16()
m.Items[i].Amount = bf.ReadUint16() m.Items[i].Amount = bf.ReadUint16()
m.Items[i].Unk1 = bf.ReadUint32() m.Items[i].Unk1 = bf.ReadUint32()
} }

View File

@@ -4,9 +4,9 @@ import (
"errors" "errors"
"erupe-ce/common/bfutil" "erupe-ce/common/bfutil"
"erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
) )
type scenarioFileIdentifer struct { type scenarioFileIdentifer struct {

View File

@@ -3,16 +3,14 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgSysHideClient represents the MSG_SYS_HIDE_CLIENT // MsgSysHideClient represents the MSG_SYS_HIDE_CLIENT
type MsgSysHideClient struct { type MsgSysHideClient struct {
Hide bool Hide bool
Unk0 uint16 // Hardcoded 0 in binary
Unk1 uint8 // Hardcoded 0 in binary
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +21,9 @@ func (m *MsgSysHideClient) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgSysHideClient) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysHideClient) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.Hide = bf.ReadBool() m.Hide = bf.ReadBool()
m.Unk0 = bf.ReadUint16() bf.ReadUint8() // Zeroed
m.Unk1 = bf.ReadUint8() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -3,16 +3,15 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgSysIssueLogkey represents the MSG_SYS_ISSUE_LOGKEY // MsgSysIssueLogkey represents the MSG_SYS_ISSUE_LOGKEY
type MsgSysIssueLogkey struct { type MsgSysIssueLogkey struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 00 01 in binary Unk0 uint16
Unk1 uint16 // Hardcoded 0 in binary.
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -24,7 +23,7 @@ func (m *MsgSysIssueLogkey) Opcode() network.PacketID {
func (m *MsgSysIssueLogkey) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysIssueLogkey) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,15 +3,15 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgSysRightsReload represents the MSG_SYS_RIGHTS_RELOAD // MsgSysRightsReload represents the MSG_SYS_RIGHTS_RELOAD
type MsgSysRightsReload struct{ type MsgSysRightsReload struct {
AckHandle uint32 AckHandle uint32
Unk0 byte Unk0 []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -22,7 +22,7 @@ func (m *MsgSysRightsReload) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgSysRightsReload) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysRightsReload) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() m.Unk0 = bf.ReadBytes(uint(bf.ReadUint8()))
return nil return nil
} }

View File

@@ -3,14 +3,13 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgSysSetStagePass represents the MSG_SYS_SET_STAGE_PASS // MsgSysSetStagePass represents the MSG_SYS_SET_STAGE_PASS
type MsgSysSetStagePass struct { type MsgSysSetStagePass struct {
Unk0 uint8 // Hardcoded 0 in the binary
Password string // NULL-terminated string Password string // NULL-terminated string
} }
@@ -21,8 +20,8 @@ func (m *MsgSysSetStagePass) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgSysSetStagePass) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysSetStagePass) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.Unk0 = bf.ReadUint8() bf.ReadUint8() // Zeroed
_ = bf.ReadUint8() // Password length bf.ReadUint8() // Password length
m.Password = string(bf.ReadNullTerminatedBytes()) m.Password = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -25,9 +25,7 @@ type TerminalLogEntry struct {
type MsgSysTerminalLog struct { type MsgSysTerminalLog struct {
AckHandle uint32 AckHandle uint32
LogID uint32 // 0 on the first packet, and the server sends back a value to use for subsequent requests. LogID uint32 // 0 on the first packet, and the server sends back a value to use for subsequent requests.
EntryCount uint16 Entries []TerminalLogEntry
Unk0 uint16 // Hardcoded 0 in the binary
Entries []*TerminalLogEntry
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -39,11 +37,11 @@ func (m *MsgSysTerminalLog) Opcode() network.PacketID {
func (m *MsgSysTerminalLog) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysTerminalLog) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.LogID = bf.ReadUint32() m.LogID = bf.ReadUint32()
m.EntryCount = bf.ReadUint16() entryCount := int(bf.ReadUint16())
m.Unk0 = bf.ReadUint16() bf.ReadUint16() // Zeroed
for i := 0; i < int(m.EntryCount); i++ { var e TerminalLogEntry
e := &TerminalLogEntry{} for i := 0; i < entryCount; i++ {
e.Index = bf.ReadUint32() e.Index = bf.ReadUint32()
e.Type1 = bf.ReadUint8() e.Type1 = bf.ReadUint8()
e.Type2 = bf.ReadUint8() e.Type2 = bf.ReadUint8()

View File

@@ -705,16 +705,16 @@ func handleMsgMhfUpdateUnionItem(s *Session, p mhfpacket.MHFPacket) {
// Update item stacks // Update item stacks
newItems := make([]Item, len(oldItems)) newItems := make([]Item, len(oldItems))
copy(newItems, oldItems) copy(newItems, oldItems)
for i := 0; i < int(pkt.Amount); i++ { for i := 0; i < len(pkt.Items); i++ {
for j := 0; j <= len(oldItems); j++ { for j := 0; j <= len(oldItems); j++ {
if j == len(oldItems) { if j == len(oldItems) {
var newItem Item var newItem Item
newItem.ItemId = pkt.Items[i].ItemId newItem.ItemId = pkt.Items[i].ItemID
newItem.Amount = pkt.Items[i].Amount newItem.Amount = pkt.Items[i].Amount
newItems = append(newItems, newItem) newItems = append(newItems, newItem)
break break
} }
if pkt.Items[i].ItemId == oldItems[j].ItemId { if pkt.Items[i].ItemID == oldItems[j].ItemId {
newItems[j].Amount = pkt.Items[i].Amount newItems[j].Amount = pkt.Items[i].Amount
break break
} }

View File

@@ -1609,16 +1609,16 @@ func handleMsgMhfUpdateGuildItem(s *Session, p mhfpacket.MHFPacket) {
// Update item stacks // Update item stacks
newItems := make([]Item, len(oldItems)) newItems := make([]Item, len(oldItems))
copy(newItems, oldItems) copy(newItems, oldItems)
for i := 0; i < int(pkt.Amount); i++ { for i := 0; i < len(pkt.Items); i++ {
for j := 0; j <= len(oldItems); j++ { for j := 0; j <= len(oldItems); j++ {
if j == len(oldItems) { if j == len(oldItems) {
var newItem Item var newItem Item
newItem.ItemId = pkt.Items[i].ItemId newItem.ItemId = pkt.Items[i].ItemID
newItem.Amount = pkt.Items[i].Amount newItem.Amount = pkt.Items[i].Amount
newItems = append(newItems, newItem) newItems = append(newItems, newItem)
break break
} }
if pkt.Items[i].ItemId == oldItems[j].ItemId { if pkt.Items[i].ItemID == oldItems[j].ItemId {
newItems[j].Amount = pkt.Items[i].Amount newItems[j].Amount = pkt.Items[i].Amount
break break
} }
@@ -1677,7 +1677,7 @@ func handleMsgMhfUpdateGuildIcon(s *Session, p mhfpacket.MHFPacket) {
icon := &GuildIcon{} icon := &GuildIcon{}
icon.Parts = make([]GuildIconPart, pkt.PartCount) icon.Parts = make([]GuildIconPart, len(pkt.IconParts))
for i, p := range pkt.IconParts { for i, p := range pkt.IconParts {
icon.Parts[i] = GuildIconPart{ icon.Parts[i] = GuildIconPart{

View File

@@ -355,12 +355,14 @@ func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfAcquireTitle) pkt := p.(*mhfpacket.MsgMhfAcquireTitle)
for _, title := range pkt.TitleIDs {
var exists int var exists int
err := s.server.db.QueryRow(`SELECT count(*) FROM titles WHERE id=$1 AND char_id=$2`, pkt.TitleID, s.charID).Scan(&exists) err := s.server.db.QueryRow(`SELECT count(*) FROM titles WHERE id=$1 AND char_id=$2`, title, s.charID).Scan(&exists)
if err != nil || exists == 0 { if err != nil || exists == 0 {
s.server.db.Exec(`INSERT INTO titles VALUES ($1, $2, now(), now())`, pkt.TitleID, s.charID) s.server.db.Exec(`INSERT INTO titles VALUES ($1, $2, now(), now())`, title, s.charID)
} else { } else {
s.server.db.Exec(`UPDATE titles SET updated_at=now() WHERE id=$1 AND char_id=$2`, pkt.TitleID, s.charID) s.server.db.Exec(`UPDATE titles SET updated_at=now() WHERE id=$1 AND char_id=$2`, title, s.charID)
}
} }
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
} }