update parsing of many packets

This commit is contained in:
wish
2023-11-19 02:34:02 +11:00
parent fc57d63689
commit 85fc76edd5
44 changed files with 272 additions and 278 deletions

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA // MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA
@@ -13,7 +13,7 @@ type MsgMhfAcquireFesta struct {
AckHandle uint32 AckHandle uint32
FestaID uint32 FestaID uint32
GuildID uint32 GuildID uint32
Unk uint16 Unk uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -26,7 +26,8 @@ func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.Unk = bf.ReadUint16() m.Unk = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -11,9 +11,9 @@ import (
// MsgMhfAcquireMonthlyItem represents the MSG_MHF_ACQUIRE_MONTHLY_ITEM // MsgMhfAcquireMonthlyItem represents the MSG_MHF_ACQUIRE_MONTHLY_ITEM
type MsgMhfAcquireMonthlyItem struct { type MsgMhfAcquireMonthlyItem struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 Unk0 uint8
Unk1 uint16 Unk1 uint8
Unk2 uint32 Unk2 uint16
Unk3 uint32 Unk3 uint32
} }
@@ -25,10 +25,11 @@ func (m *MsgMhfAcquireMonthlyItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfAcquireMonthlyItem) 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() m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint32() m.Unk2 = bf.ReadUint16()
m.Unk3 = bf.ReadUint32() m.Unk3 = bf.ReadUint32()
bf.ReadUint32() // Zeroed
return nil return nil
} }

View File

@@ -14,7 +14,7 @@ type MsgMhfAnnounce struct {
IPAddress uint32 IPAddress uint32
Port uint16 Port uint16
StageID []byte StageID []byte
Type uint8 Data *byteframe.ByteFrame
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -31,8 +31,7 @@ func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
_ = bf.ReadUint8() _ = bf.ReadUint8()
_ = bf.ReadUint8() _ = bf.ReadUint8()
m.StageID = bf.ReadBytes(32) m.StageID = bf.ReadBytes(32)
_ = bf.ReadUint32() m.Data = byteframe.NewByteFrameFromBytes(bf.ReadBytes(uint(bf.ReadUint32())))
m.Type = bf.ReadUint8()
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"
) )
// MsgMhfArrangeGuildMember represents the MSG_MHF_ARRANGE_GUILD_MEMBER // MsgMhfArrangeGuildMember represents the MSG_MHF_ARRANGE_GUILD_MEMBER
@@ -22,11 +23,11 @@ func (m *MsgMhfArrangeGuildMember) Opcode() network.PacketID {
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
charCount := bf.ReadUint16() bf.ReadUint8() // Zeroed
charCount := int(bf.ReadUint8())
m.CharIDs = make([]uint32, charCount) m.CharIDs = make([]uint32, charCount)
for i := uint16(0); i < charCount; i++ { for i := 0; i < charCount; i++ {
m.CharIDs[i] = bf.ReadUint32() m.CharIDs[i] = bf.ReadUint32()
} }
@@ -35,13 +36,5 @@ func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle) return errors.New("NOT IMPLEMENTED")
bf.WriteUint32(m.GuildID)
bf.WriteUint16(uint16(len(m.CharIDs)))
for _, charID := range m.CharIDs {
bf.WriteUint32(charID)
}
return nil
} }

View File

@@ -3,10 +3,10 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport" "erupe-ce/common/stringsupport"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/network/clientctx"
) )
// MsgMhfCreateJoint represents the MSG_MHF_CREATE_JOINT // MsgMhfCreateJoint represents the MSG_MHF_CREATE_JOINT
@@ -25,7 +25,8 @@ func (m *MsgMhfCreateJoint) Opcode() network.PacketID {
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
_ = bf.ReadUint32() // len bf.ReadUint16() // Zeroed
bf.ReadUint16() // Name length
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA // MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA
@@ -25,7 +25,7 @@ func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientC
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Always 0 bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER // MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER
@@ -25,7 +25,7 @@ func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientc
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Hardcoded 0 in the binary. bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -10,8 +10,7 @@ import (
// MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT // MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT
type MsgMhfEnumerateGuacot struct { type MsgMhfEnumerateGuacot struct {
AckHandle uint32 AckHandle uint32
Unk0 uint32 // Hardcoded 0 in binary Unk0 uint32
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,7 +22,7 @@ func (m *MsgMhfEnumerateGuacot) Opcode() network.PacketID {
func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32() m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -2,9 +2,7 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
) )
@@ -34,8 +32,8 @@ type MsgMhfEnumerateGuild struct {
Type EnumerateGuildType Type EnumerateGuildType
Page uint8 Page uint8
Sorting bool Sorting bool
Data1 []byte Data1 *byteframe.ByteFrame
Data2 string Data2 *byteframe.ByteFrame
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -49,12 +47,12 @@ func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.Type = EnumerateGuildType(bf.ReadUint8()) m.Type = EnumerateGuildType(bf.ReadUint8())
m.Page = bf.ReadUint8() m.Page = bf.ReadUint8()
m.Sorting = bf.ReadBool() m.Sorting = bf.ReadBool()
_ = bf.ReadBytes(1) bf.ReadUint8() // Zeroed
m.Data1 = bf.ReadBytes(4) m.Data1 = byteframe.NewByteFrameFromBytes(bf.ReadBytes(4))
_ = bf.ReadBytes(2) bf.ReadUint16() // Zeroed
lenData2 := uint(bf.ReadUint8()) dataLen := uint(bf.ReadUint8())
_ = bf.ReadBytes(1) bf.ReadUint8() // Zeroed
m.Data2 = stringsupport.SJISToUTF8(bfutil.UpToNull(bf.ReadBytes(lenData2))) m.Data2 = byteframe.NewByteFrameFromBytes(bf.ReadBytes(dataLen))
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"
) )
// MsgMhfEnumerateGuildItem represents the MSG_MHF_ENUMERATE_GUILD_ITEM // MsgMhfEnumerateGuildItem represents the MSG_MHF_ENUMERATE_GUILD_ITEM
type MsgMhfEnumerateGuildItem struct { type MsgMhfEnumerateGuildItem struct {
AckHandle uint32 AckHandle uint32
GuildId uint32 GuildID uint32
Unk0 uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,8 +22,9 @@ func (m *MsgMhfEnumerateGuildItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateGuildItem) 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.Unk0 = bf.ReadUint16() bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -1,16 +1,16 @@
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"
) )
// MsgMhfEnumerateGuildMember represents the MSG_MHF_ENUMERATE_GUILD_MEMBER // MsgMhfEnumerateGuildMember represents the MSG_MHF_ENUMERATE_GUILD_MEMBER
type MsgMhfEnumerateGuildMember struct { type MsgMhfEnumerateGuildMember struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // Hardcoded 00 01 in the binary AllianceID uint32
Unk1 uint32 // Alliance related
GuildID uint32 GuildID uint32
} }
@@ -22,17 +22,14 @@ func (m *MsgMhfEnumerateGuildMember) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16() bf.ReadUint8() // Zeroed
m.Unk1 = bf.ReadUint32() bf.ReadUint8() // Always 1
m.AllianceID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
return nil return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle) return errors.New("NOT IMPLEMENTED")
bf.WriteUint16(m.Unk0)
bf.WriteUint32(m.Unk1)
bf.WriteUint32(m.GuildID)
return nil
} }

View File

@@ -14,7 +14,6 @@ type MsgMhfEnumerateHouse struct {
AckHandle uint32 AckHandle uint32
CharID uint32 CharID uint32
Method uint8 Method uint8
Unk uint16
Name string Name string
} }
@@ -28,7 +27,7 @@ func (m *MsgMhfEnumerateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.CharID = bf.ReadUint32() m.CharID = bf.ReadUint32()
m.Method = bf.ReadUint8() m.Method = bf.ReadUint8()
m.Unk = bf.ReadUint16() bf.ReadUint16() // Zeroed
lenName := bf.ReadUint8() lenName := bf.ReadUint8()
if lenName > 0 { if lenName > 0 {
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())

View File

@@ -11,7 +11,12 @@ import (
// MsgMhfEnumerateInvGuild represents the MSG_MHF_ENUMERATE_INV_GUILD // MsgMhfEnumerateInvGuild represents the MSG_MHF_ENUMERATE_INV_GUILD
type MsgMhfEnumerateInvGuild struct { type MsgMhfEnumerateInvGuild struct {
AckHandle uint32 AckHandle uint32
Unk []byte Unk uint32
Operation uint8
ActiveHours uint8
DaysActive uint8
PlayStyle uint8
GuildRequest uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -22,7 +27,12 @@ func (m *MsgMhfEnumerateInvGuild) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateInvGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateInvGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk = bf.ReadBytes(9) m.Unk = bf.ReadUint32()
m.Operation = bf.ReadUint8()
m.ActiveHours = bf.ReadUint8()
m.DaysActive = bf.ReadUint8()
m.PlayStyle = bf.ReadUint8()
m.GuildRequest = bf.ReadUint8()
return nil return nil
} }

View File

@@ -13,7 +13,6 @@ type MsgMhfExchangeWeeklyStamp struct {
AckHandle uint32 AckHandle uint32
StampType string StampType string
Unk1 uint8 Unk1 uint8
Unk2 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 *MsgMhfExchangeWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientct
m.StampType = "ex" m.StampType = "ex"
} }
m.Unk1 = bf.ReadUint8() m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -12,7 +12,6 @@ import (
type MsgMhfInfoJoint struct { type MsgMhfInfoJoint struct {
AckHandle uint32 AckHandle uint32
AllianceID uint32 AllianceID uint32
Unk 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 *MsgMhfInfoJoint) Opcode() network.PacketID {
func (m *MsgMhfInfoJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfInfoJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.AllianceID = bf.ReadUint32() m.AllianceID = bf.ReadUint32()
m.Unk = bf.ReadUint32() bf.ReadUint32() // Zeroed
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfLoadGuildCooking represents the MSG_MHF_LOAD_GUILD_COOKING // MsgMhfLoadGuildCooking represents the MSG_MHF_LOAD_GUILD_COOKING
@@ -22,7 +22,7 @@ func (m *MsgMhfLoadGuildCooking) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfLoadGuildCooking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfLoadGuildCooking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
_ = bf.ReadUint8() m.MaxMeals = bf.ReadUint8()
return nil return nil
} }

View File

@@ -16,7 +16,6 @@ type MsgMhfLoadHouse struct {
Destination uint8 Destination uint8
// False if already in hosts My Series, in case host updates PW // False if already in hosts My Series, in case host updates PW
CheckPass bool CheckPass bool
Unk3 uint16 // Hardcoded 0 in binary
Password string Password string
} }
@@ -31,8 +30,8 @@ func (m *MsgMhfLoadHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCo
m.CharID = bf.ReadUint32() m.CharID = bf.ReadUint32()
m.Destination = bf.ReadUint8() m.Destination = bf.ReadUint8()
m.CheckPass = bf.ReadBool() m.CheckPass = bf.ReadBool()
_ = bf.ReadUint16() bf.ReadUint16() // Zeroed
_ = bf.ReadUint8() // Password length bf.ReadUint8() // Password length
m.Password = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) m.Password = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -23,7 +23,6 @@ type MsgMhfOperateGuildMember struct {
GuildID uint32 GuildID uint32
CharID uint32 CharID uint32
Action uint8 Action uint8
Unk []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -37,7 +36,8 @@ func (m *MsgMhfOperateGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.CharID = bf.ReadUint32() m.CharID = bf.ReadUint32()
m.Action = bf.ReadUint8() m.Action = bf.ReadUint8()
m.Unk = bf.ReadBytes(3) bf.ReadUint8() // Zeroed
bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -22,7 +22,8 @@ type MsgMhfOperateJoint struct {
AllianceID uint32 AllianceID uint32
GuildID uint32 GuildID uint32
Action OperateJointAction Action OperateJointAction
UnkData *byteframe.ByteFrame Data1 *byteframe.ByteFrame
Data2 *byteframe.ByteFrame
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -36,8 +37,9 @@ func (m *MsgMhfOperateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
m.AllianceID = bf.ReadUint32() m.AllianceID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.Action = OperateJointAction(bf.ReadUint8()) m.Action = OperateJointAction(bf.ReadUint8())
m.UnkData = byteframe.NewByteFrameFromBytes(bf.DataFromCurrent()) dataLen := uint(bf.ReadUint8())
bf.Seek(int64(len(bf.Data())-2), 0) m.Data1 = byteframe.NewByteFrameFromBytes(bf.ReadBytes(4))
m.Data2 = byteframe.NewByteFrameFromBytes(bf.ReadBytes(dataLen))
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfOprMember represents the MSG_MHF_OPR_MEMBER // MsgMhfOprMember represents the MSG_MHF_OPR_MEMBER
@@ -14,7 +14,7 @@ type MsgMhfOprMember struct {
Blacklist bool Blacklist bool
Operation bool Operation bool
Unk uint16 Unk uint16
CharID uint32 CharIDs []uint32
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -27,8 +27,11 @@ func (m *MsgMhfOprMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCo
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Blacklist = bf.ReadBool() m.Blacklist = bf.ReadBool()
m.Operation = bf.ReadBool() m.Operation = bf.ReadBool()
m.Unk = bf.ReadUint16() bf.ReadUint8()
m.CharID = bf.ReadUint32() chars := int(bf.ReadUint8())
for i := 0; i < chars; i++ {
m.CharIDs = append(m.CharIDs, bf.ReadUint32())
}
return nil return nil
} }

View File

@@ -12,8 +12,7 @@ type MsgMhfRegisterEvent struct {
Unk0 uint16 Unk0 uint16
WorldID uint16 WorldID uint16
LandID uint16 LandID uint16
Unk3 uint8 Unk1 bool
Unk4 uint8
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -27,8 +26,8 @@ func (m *MsgMhfRegisterEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
m.Unk0 = bf.ReadUint16() m.Unk0 = bf.ReadUint16()
m.WorldID = bf.ReadUint16() m.WorldID = bf.ReadUint16()
m.LandID = bf.ReadUint16() m.LandID = bf.ReadUint16()
m.Unk3 = bf.ReadUint8() m.Unk1 = bf.ReadBool()
m.Unk4 = bf.ReadUint8() bf.ReadUint8() // Zeroed
return nil return nil
} }

View File

@@ -13,7 +13,6 @@ type MsgMhfSetGuildManageRight struct {
AckHandle uint32 AckHandle uint32
CharID uint32 CharID uint32
Allowed bool Allowed bool
Unk []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -26,7 +25,7 @@ func (m *MsgMhfSetGuildManageRight) Parse(bf *byteframe.ByteFrame, ctx *clientct
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.CharID = bf.ReadUint32() m.CharID = bf.ReadUint32()
m.Allowed = bf.ReadBool() m.Allowed = bf.ReadBool()
m.Unk = bf.ReadBytes(3) bf.ReadBytes(3) // Zeroed
return nil return nil
} }

View File

@@ -34,7 +34,7 @@ func (m *MsgMhfStampcardStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.HR = bf.ReadUint16() m.HR = bf.ReadUint16()
m.GR = bf.ReadUint16() m.GR = bf.ReadUint16()
m.Stamps = bf.ReadUint16() m.Stamps = bf.ReadUint16()
_ = bf.ReadUint16() bf.ReadUint16() // Zeroed
if _config.ErupeConfig.RealClientMode > _config.Z1 { if _config.ErupeConfig.RealClientMode > _config.Z1 {
m.Reward1 = uint16(bf.ReadUint32()) m.Reward1 = uint16(bf.ReadUint32())
m.Reward2 = uint16(bf.ReadUint32()) m.Reward2 = uint16(bf.ReadUint32())

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfStateFestaG represents the MSG_MHF_STATE_FESTA_G // MsgMhfStateFestaG represents the MSG_MHF_STATE_FESTA_G
@@ -25,7 +25,7 @@ func (m *MsgMhfStateFestaG) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Hardcoded 0 in the binary. bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfStateFestaU represents the MSG_MHF_STATE_FESTA_U // MsgMhfStateFestaU represents the MSG_MHF_STATE_FESTA_U
@@ -25,7 +25,7 @@ func (m *MsgMhfStateFestaU) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Hardcoded 0 in the binary. bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgMhfTransferItem represents the MSG_MHF_TRANSFER_ITEM // MsgMhfTransferItem represents the MSG_MHF_TRANSFER_ITEM
@@ -15,8 +15,8 @@ type MsgMhfTransferItem struct {
// correlate with any item IDs that would make sense to get after quests so // correlate with any item IDs that would make sense to get after quests so
// I have no idea what this actually does // I have no idea what this actually does
Unk0 uint32 Unk0 uint32
Unk1 uint16 // Hardcoded Unk1 uint8
Unk2 uint16 // Hardcoded Unk2 uint16
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -28,7 +28,8 @@ func (m *MsgMhfTransferItem) Opcode() network.PacketID {
func (m *MsgMhfTransferItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfTransferItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32() m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16() m.Unk1 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
m.Unk2 = bf.ReadUint16() m.Unk2 = bf.ReadUint16()
return nil return nil
} }

View File

@@ -12,7 +12,6 @@ import (
type MsgMhfTransitMessage struct { type MsgMhfTransitMessage struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8 Unk0 uint8
Unk1 uint8
SearchType uint16 SearchType uint16
MessageData []byte MessageData []byte
} }
@@ -26,7 +25,7 @@ func (m *MsgMhfTransitMessage) Opcode() network.PacketID {
func (m *MsgMhfTransitMessage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfTransitMessage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8() bf.ReadUint8() // Zeroed
m.SearchType = bf.ReadUint16() m.SearchType = bf.ReadUint16()
m.MessageData = bf.ReadBytes(uint(bf.ReadUint16())) m.MessageData = bf.ReadBytes(uint(bf.ReadUint16()))
return nil return nil

View File

@@ -18,7 +18,7 @@ type Item struct {
// MsgMhfUpdateGuildItem represents the MSG_MHF_UPDATE_GUILD_ITEM // MsgMhfUpdateGuildItem represents the MSG_MHF_UPDATE_GUILD_ITEM
type MsgMhfUpdateGuildItem struct { type MsgMhfUpdateGuildItem struct {
AckHandle uint32 AckHandle uint32
GuildId uint32 GuildID uint32
Items []Item Items []Item
} }
@@ -30,7 +30,7 @@ func (m *MsgMhfUpdateGuildItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
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()
itemCount := int(bf.ReadUint16()) itemCount := int(bf.ReadUint16())
bf.ReadUint8() // Zeroed bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed bf.ReadUint8() // Zeroed

View File

@@ -3,15 +3,16 @@ 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"
) )
// MsgMhfUseGachaPoint represents the MSG_MHF_USE_GACHA_POINT // MsgMhfUseGachaPoint represents the MSG_MHF_USE_GACHA_POINT
type MsgMhfUseGachaPoint struct { type MsgMhfUseGachaPoint struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 // padding? Unk0 uint8
Unk1 uint8
TrialCoins uint32 TrialCoins uint32
PremiumCoins uint32 PremiumCoins uint32
} }
@@ -24,7 +25,8 @@ func (m *MsgMhfUseGachaPoint) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfUseGachaPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUseGachaPoint) 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.ReadUint8()
m.TrialCoins = bf.ReadUint32() m.TrialCoins = bf.ReadUint32()
m.PremiumCoins = bf.ReadUint32() m.PremiumCoins = bf.ReadUint32()
return nil return nil

View File

@@ -11,7 +11,7 @@ import (
// MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA // MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA
type MsgMhfVoteFesta struct { type MsgMhfVoteFesta struct {
AckHandle uint32 AckHandle uint32
Unk uint32 FestaID uint32
GuildID uint32 GuildID uint32
TrialID uint32 TrialID uint32
} }
@@ -24,7 +24,7 @@ func (m *MsgMhfVoteFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfVoteFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfVoteFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.TrialID = bf.ReadUint32() m.TrialID = bf.ReadUint32()
return nil return nil

View File

@@ -2,7 +2,6 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
_config "erupe-ce/config" _config "erupe-ce/config"
"erupe-ce/network" "erupe-ce/network"
@@ -29,8 +28,8 @@ func (m *MsgSysCreateAcquireSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clien
if _config.ErupeConfig.RealClientMode >= _config.S7 { // Assuming this was added with Ravi? if _config.ErupeConfig.RealClientMode >= _config.S7 { // Assuming this was added with Ravi?
m.PlayerCount = bf.ReadUint8() m.PlayerCount = bf.ReadUint8()
} }
SemaphoreIDLength := bf.ReadUint8() bf.ReadUint8() // SemaphoreID length
m.SemaphoreID = string(bfutil.UpToNull(bf.ReadBytes(uint(SemaphoreIDLength)))) m.SemaphoreID = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -2,6 +2,7 @@ package mhfpacket
import ( import (
"errors" "errors"
_config "erupe-ce/config"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
@@ -12,8 +13,8 @@ import (
type MsgSysCreateSemaphore struct { type MsgSysCreateSemaphore struct {
AckHandle uint32 AckHandle uint32
Unk0 uint16 Unk0 uint16
DataSize uint16 PlayerCount uint8
RawDataPayload []byte SemaphoreID string
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -25,8 +26,11 @@ func (m *MsgSysCreateSemaphore) Opcode() network.PacketID {
func (m *MsgSysCreateSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysCreateSemaphore) 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.DataSize = bf.ReadUint16() if _config.ErupeConfig.RealClientMode >= _config.S7 { // Assuming this was added with Ravi?
m.RawDataPayload = bf.ReadBytes(uint(m.DataSize)) m.PlayerCount = bf.ReadUint8()
}
bf.ReadUint8() // SemaphoreID length
m.SemaphoreID = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -3,7 +3,6 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
@@ -27,8 +26,8 @@ func (m *MsgSysEnumerateClient) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() m.Unk0 = bf.ReadUint8()
m.Get = bf.ReadUint8() m.Get = bf.ReadUint8()
stageIDLength := bf.ReadUint8() bf.ReadUint8() // StageID length
m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) m.StageID = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -2,7 +2,6 @@ package mhfpacket
import ( import (
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/common/bfutil"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
) )
@@ -27,8 +26,8 @@ func (m *MsgSysGetStageBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.BinaryType0 = bf.ReadUint8() m.BinaryType0 = bf.ReadUint8()
m.BinaryType1 = bf.ReadUint8() m.BinaryType1 = bf.ReadUint8()
m.Unk0 = bf.ReadUint32() m.Unk0 = bf.ReadUint32()
stageIDLength := bf.ReadUint8() bf.ReadUint8() // StageID length
m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) m.StageID = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -24,8 +24,8 @@ func (m *MsgSysLoadRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.RegisterID = bf.ReadUint32() m.RegisterID = bf.ReadUint32()
m.Values = bf.ReadUint8() m.Values = bf.ReadUint8()
_ = bf.ReadUint8() bf.ReadUint8() // Zeroed
_ = bf.ReadUint16() bf.ReadUint16() // Zeroed
return nil return nil
} }

View File

@@ -3,9 +3,9 @@ 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"
) )
// MsgSysLogin represents the MSG_SYS_LOGIN // MsgSysLogin represents the MSG_SYS_LOGIN
@@ -16,8 +16,6 @@ type MsgSysLogin struct {
HardcodedZero0 uint16 HardcodedZero0 uint16
RequestVersion uint16 RequestVersion uint16
CharID1 uint32 CharID1 uint32
HardcodedZero1 uint16
LoginTokenStringLength uint16 // Hardcoded to 0x11
LoginTokenString string LoginTokenString string
} }
@@ -34,8 +32,8 @@ func (m *MsgSysLogin) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContex
m.HardcodedZero0 = bf.ReadUint16() m.HardcodedZero0 = bf.ReadUint16()
m.RequestVersion = bf.ReadUint16() m.RequestVersion = bf.ReadUint16()
m.CharID1 = bf.ReadUint32() m.CharID1 = bf.ReadUint32()
m.HardcodedZero1 = bf.ReadUint16() bf.ReadUint16() // Zeroed
m.LoginTokenStringLength = bf.ReadUint16() bf.ReadUint16() // Always 11
m.LoginTokenString = string(bf.ReadNullTerminatedBytes()) m.LoginTokenString = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -23,7 +23,7 @@ func (m *MsgSysOperateRegister) Opcode() network.PacketID {
func (m *MsgSysOperateRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysOperateRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.SemaphoreID = bf.ReadUint32() m.SemaphoreID = bf.ReadUint32()
_ = bf.ReadUint16() bf.ReadUint16() // Zeroed
dataSize := bf.ReadUint16() dataSize := bf.ReadUint16()
m.RawDataPayload = bf.ReadBytes(uint(dataSize)) m.RawDataPayload = bf.ReadBytes(uint(dataSize))
return nil return nil

View File

@@ -2,7 +2,6 @@ package mhfpacket
import ( import (
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/common/bfutil"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
) )
@@ -24,9 +23,9 @@ func (m *MsgSysSetStageBinary) Opcode() network.PacketID {
func (m *MsgSysSetStageBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysSetStageBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.BinaryType0 = bf.ReadUint8() m.BinaryType0 = bf.ReadUint8()
m.BinaryType1 = bf.ReadUint8() m.BinaryType1 = bf.ReadUint8()
stageIDLength := bf.ReadUint8() // <= 0x20 bf.ReadUint8() // StageID length <= 0x20
dataSize := bf.ReadUint16() // <= 0x400 dataSize := bf.ReadUint16() // <= 0x400
m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) m.StageID = string(bf.ReadNullTerminatedBytes())
m.RawDataPayload = bf.ReadBytes(uint(dataSize)) m.RawDataPayload = bf.ReadBytes(uint(dataSize))
return nil return nil
} }

View File

@@ -2,7 +2,6 @@ package mhfpacket
import ( import (
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/common/bfutil"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
) )
@@ -27,8 +26,8 @@ func (m *MsgSysWaitStageBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
m.BinaryType0 = bf.ReadUint8() m.BinaryType0 = bf.ReadUint8()
m.BinaryType1 = bf.ReadUint8() m.BinaryType1 = bf.ReadUint8()
m.Unk0 = bf.ReadUint32() m.Unk0 = bf.ReadUint32()
stageIDLength := bf.ReadUint8() bf.ReadUint8() // StageID length
m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) m.StageID = string(bf.ReadNullTerminatedBytes())
return nil return nil
} }

View File

@@ -611,7 +611,7 @@ func handleMsgMhfServerCommand(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfAnnounce(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfAnnounce(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfAnnounce) pkt := p.(*mhfpacket.MsgMhfAnnounce)
s.server.BroadcastRaviente(pkt.IPAddress, pkt.Port, pkt.StageID, pkt.Type) s.server.BroadcastRaviente(pkt.IPAddress, pkt.Port, pkt.StageID, pkt.Data.ReadUint8())
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
} }

View File

@@ -60,9 +60,7 @@ func handleMsgMhfListMember(s *Session, p mhfpacket.MHFPacket) {
resp := byteframe.NewByteFrame() resp := byteframe.NewByteFrame()
resp.WriteUint32(0) // Blacklist count resp.WriteUint32(0) // Blacklist count
err := s.server.db.QueryRow("SELECT blocked FROM characters WHERE id=$1", s.charID).Scan(&csv) err := s.server.db.QueryRow("SELECT blocked FROM characters WHERE id=$1", s.charID).Scan(&csv)
if err != nil { if err == nil {
panic(err)
}
cids := stringsupport.CSVElems(csv) cids := stringsupport.CSVElems(csv)
for _, cid := range cids { for _, cid := range cids {
var name string var name string
@@ -75,6 +73,7 @@ func handleMsgMhfListMember(s *Session, p mhfpacket.MHFPacket) {
resp.WriteUint32(16) resp.WriteUint32(16)
resp.WriteBytes(stringsupport.PaddedString(name, 16, true)) resp.WriteBytes(stringsupport.PaddedString(name, 16, true))
} }
}
resp.Seek(0, 0) resp.Seek(0, 0)
resp.WriteUint32(count) resp.WriteUint32(count)
doAckBufSucceed(s, pkt.AckHandle, resp.Data()) doAckBufSucceed(s, pkt.AckHandle, resp.Data())
@@ -83,29 +82,29 @@ func handleMsgMhfListMember(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfOprMember(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfOprMember(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfOprMember) pkt := p.(*mhfpacket.MsgMhfOprMember)
var csv string var csv string
for _, cid := range pkt.CharIDs {
if pkt.Blacklist { if pkt.Blacklist {
err := s.server.db.QueryRow("SELECT blocked FROM characters WHERE id=$1", s.charID).Scan(&csv) err := s.server.db.QueryRow("SELECT blocked FROM characters WHERE id=$1", s.charID).Scan(&csv)
if err != nil { if err == nil {
panic(err)
}
if pkt.Operation { if pkt.Operation {
csv = stringsupport.CSVRemove(csv, int(pkt.CharID)) csv = stringsupport.CSVRemove(csv, int(cid))
} else { } else {
csv = stringsupport.CSVAdd(csv, int(pkt.CharID)) csv = stringsupport.CSVAdd(csv, int(cid))
} }
s.server.db.Exec("UPDATE characters SET blocked=$1 WHERE id=$2", csv, s.charID) s.server.db.Exec("UPDATE characters SET blocked=$1 WHERE id=$2", csv, s.charID)
}
} else { // Friendlist } else { // Friendlist
err := s.server.db.QueryRow("SELECT friends FROM characters WHERE id=$1", s.charID).Scan(&csv) err := s.server.db.QueryRow("SELECT friends FROM characters WHERE id=$1", s.charID).Scan(&csv)
if err != nil { if err == nil {
panic(err)
}
if pkt.Operation { if pkt.Operation {
csv = stringsupport.CSVRemove(csv, int(pkt.CharID)) csv = stringsupport.CSVRemove(csv, int(cid))
} else { } else {
csv = stringsupport.CSVAdd(csv, int(pkt.CharID)) csv = stringsupport.CSVAdd(csv, int(cid))
} }
s.server.db.Exec("UPDATE characters SET friends=$1 WHERE id=$2", csv, s.charID) s.server.db.Exec("UPDATE characters SET friends=$1 WHERE id=$2", csv, s.charID)
} }
}
}
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
} }

View File

@@ -1147,7 +1147,6 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
var alliances []*GuildAlliance var alliances []*GuildAlliance
var rows *sqlx.Rows var rows *sqlx.Rows
var err error var err error
bf := byteframe.NewByteFrameFromBytes(pkt.Data1)
if pkt.Type <= 8 { if pkt.Type <= 8 {
var tempGuilds []*Guild var tempGuilds []*Guild
@@ -1164,20 +1163,20 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
switch pkt.Type { switch pkt.Type {
case mhfpacket.ENUMERATE_GUILD_TYPE_GUILD_NAME: case mhfpacket.ENUMERATE_GUILD_TYPE_GUILD_NAME:
for _, guild := range tempGuilds { for _, guild := range tempGuilds {
if strings.Contains(guild.Name, pkt.Data2) { if strings.Contains(guild.Name, stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())) {
guilds = append(guilds, guild) guilds = append(guilds, guild)
} }
} }
case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_NAME: case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_NAME:
for _, guild := range tempGuilds { for _, guild := range tempGuilds {
if strings.Contains(guild.LeaderName, pkt.Data2) { if strings.Contains(guild.LeaderName, stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())) {
guilds = append(guilds, guild) guilds = append(guilds, guild)
} }
} }
case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_ID: case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_ID:
ID := bf.ReadUint32() CID := pkt.Data1.ReadUint32()
for _, guild := range tempGuilds { for _, guild := range tempGuilds {
if guild.LeaderCharID == ID { if guild.LeaderCharID == CID {
guilds = append(guilds, guild) guilds = append(guilds, guild)
} }
} }
@@ -1215,15 +1214,15 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
} }
guilds = tempGuilds guilds = tempGuilds
case mhfpacket.ENUMERATE_GUILD_TYPE_MOTTO: case mhfpacket.ENUMERATE_GUILD_TYPE_MOTTO:
mainMotto := uint8(bf.ReadUint16()) mainMotto := uint8(pkt.Data1.ReadUint16())
subMotto := uint8(bf.ReadUint16()) subMotto := uint8(pkt.Data1.ReadUint16())
for _, guild := range tempGuilds { for _, guild := range tempGuilds {
if guild.MainMotto == mainMotto && guild.SubMotto == subMotto { if guild.MainMotto == mainMotto && guild.SubMotto == subMotto {
guilds = append(guilds, guild) guilds = append(guilds, guild)
} }
} }
case mhfpacket.ENUMERATE_GUILD_TYPE_RECRUITING: case mhfpacket.ENUMERATE_GUILD_TYPE_RECRUITING:
recruitingMotto := uint8(bf.ReadUint16()) recruitingMotto := uint8(pkt.Data1.ReadUint16())
for _, guild := range tempGuilds { for _, guild := range tempGuilds {
if guild.MainMotto == recruitingMotto { if guild.MainMotto == recruitingMotto {
guilds = append(guilds, guild) guilds = append(guilds, guild)
@@ -1244,20 +1243,20 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
switch pkt.Type { switch pkt.Type {
case mhfpacket.ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME: case mhfpacket.ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME:
for _, alliance := range tempAlliances { for _, alliance := range tempAlliances {
if strings.Contains(alliance.Name, pkt.Data2) { if strings.Contains(alliance.Name, stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())) {
alliances = append(alliances, alliance) alliances = append(alliances, alliance)
} }
} }
case mhfpacket.ENUMERATE_ALLIANCE_TYPE_LEADER_NAME: case mhfpacket.ENUMERATE_ALLIANCE_TYPE_LEADER_NAME:
for _, alliance := range tempAlliances { for _, alliance := range tempAlliances {
if strings.Contains(alliance.ParentGuild.LeaderName, pkt.Data2) { if strings.Contains(alliance.ParentGuild.LeaderName, stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())) {
alliances = append(alliances, alliance) alliances = append(alliances, alliance)
} }
} }
case mhfpacket.ENUMERATE_ALLIANCE_TYPE_LEADER_ID: case mhfpacket.ENUMERATE_ALLIANCE_TYPE_LEADER_ID:
ID := bf.ReadUint32() CID := pkt.Data1.ReadUint32()
for _, alliance := range tempAlliances { for _, alliance := range tempAlliances {
if alliance.ParentGuild.LeaderCharID == ID { if alliance.ParentGuild.LeaderCharID == CID {
alliances = append(alliances, alliance) alliances = append(alliances, alliance)
} }
} }
@@ -1291,7 +1290,7 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
return return
} }
bf = byteframe.NewByteFrame() bf := byteframe.NewByteFrame()
if pkt.Type > 8 { if pkt.Type > 8 {
hasNextPage := false hasNextPage := false
@@ -1436,7 +1435,7 @@ func handleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) {
for _, member := range guildMembers { for _, member := range guildMembers {
bf.WriteUint32(member.CharID) bf.WriteUint32(member.CharID)
bf.WriteUint16(member.HRP) bf.WriteUint16(member.HRP)
if s.server.erupeConfig.RealClientMode > _config.G7 { if s.server.erupeConfig.RealClientMode >= _config.G10 {
bf.WriteUint16(member.GR) bf.WriteUint16(member.GR)
} }
if s.server.erupeConfig.RealClientMode < _config.ZZ { if s.server.erupeConfig.RealClientMode < _config.ZZ {
@@ -1558,7 +1557,7 @@ func handleMsgMhfEnumerateGuildItem(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateGuildItem) pkt := p.(*mhfpacket.MsgMhfEnumerateGuildItem)
var boxContents []byte var boxContents []byte
bf := byteframe.NewByteFrame() bf := byteframe.NewByteFrame()
err := s.server.db.QueryRow("SELECT item_box FROM guilds WHERE id = $1", int(pkt.GuildId)).Scan(&boxContents) err := s.server.db.QueryRow("SELECT item_box FROM guilds WHERE id = $1", pkt.GuildID).Scan(&boxContents)
if err != nil { if err != nil {
s.logger.Error("Failed to get guild item box contents from db", zap.Error(err)) s.logger.Error("Failed to get guild item box contents from db", zap.Error(err))
bf.WriteBytes(make([]byte, 4)) bf.WriteBytes(make([]byte, 4))
@@ -1592,7 +1591,7 @@ func handleMsgMhfUpdateGuildItem(s *Session, p mhfpacket.MHFPacket) {
// Get item cache from DB // Get item cache from DB
var boxContents []byte var boxContents []byte
var oldItems []Item var oldItems []Item
err := s.server.db.QueryRow("SELECT item_box FROM guilds WHERE id = $1", int(pkt.GuildId)).Scan(&boxContents) err := s.server.db.QueryRow("SELECT item_box FROM guilds WHERE id = $1", pkt.GuildID).Scan(&boxContents)
if err != nil { if err != nil {
s.logger.Error("Failed to get guild item box contents from db", zap.Error(err)) s.logger.Error("Failed to get guild item box contents from db", zap.Error(err))
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
@@ -1642,7 +1641,7 @@ func handleMsgMhfUpdateGuildItem(s *Session, p mhfpacket.MHFPacket) {
} }
// Upload new item cache // Upload new item cache
_, err = s.server.db.Exec("UPDATE guilds SET item_box = $1 WHERE id = $2", bf.Data(), int(pkt.GuildId)) _, err = s.server.db.Exec("UPDATE guilds SET item_box = $1 WHERE id = $2", bf.Data(), pkt.GuildID)
if err != nil { if err != nil {
s.logger.Error("Failed to update guild item box contents in db", zap.Error(err)) s.logger.Error("Failed to update guild item box contents in db", zap.Error(err))
} }

View File

@@ -162,8 +162,7 @@ func handleMsgMhfOperateJoint(s *Session, p mhfpacket.MHFPacket) {
} }
case mhfpacket.OPERATE_JOINT_KICK: case mhfpacket.OPERATE_JOINT_KICK:
if alliance.ParentGuild.LeaderCharID == s.charID { if alliance.ParentGuild.LeaderCharID == s.charID {
_ = pkt.UnkData.ReadUint8() kickedGuildID := pkt.Data1.ReadUint32()
kickedGuildID := pkt.UnkData.ReadUint32()
if kickedGuildID == alliance.SubGuild1ID && alliance.SubGuild2ID > 0 { if kickedGuildID == alliance.SubGuild1ID && alliance.SubGuild2ID > 0 {
s.server.db.Exec(`UPDATE guild_alliances SET sub1_id = sub2_id, sub2_id = NULL WHERE id = $1`, alliance.ID) s.server.db.Exec(`UPDATE guild_alliances SET sub1_id = sub2_id, sub2_id = NULL WHERE id = $1`, alliance.ID)
} else if kickedGuildID == alliance.SubGuild1ID && alliance.SubGuild2ID == 0 { } else if kickedGuildID == alliance.SubGuild1ID && alliance.SubGuild2ID == 0 {

View File

@@ -10,7 +10,7 @@ func handleMsgMhfRegisterEvent(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfRegisterEvent) pkt := p.(*mhfpacket.MsgMhfRegisterEvent)
bf := byteframe.NewByteFrame() bf := byteframe.NewByteFrame()
// Some kind of check if there's already a session // Some kind of check if there's already a session
if pkt.Unk3 > 0 && s.server.getRaviSemaphore() == nil { if pkt.Unk1 && s.server.getRaviSemaphore() == nil {
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
return return
} }