update various packets

This commit is contained in:
wish
2022-07-29 01:39:16 +10:00
parent 4cdea9de03
commit fd061e695f
15 changed files with 144 additions and 149 deletions

View File

@@ -1,9 +1,11 @@
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"
) )
// MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT // MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT
@@ -23,14 +25,10 @@ func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.AchievementID = bf.ReadUint8() m.AchievementID = bf.ReadUint8()
m.Unk1 = bf.ReadUint16() m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16() m.Unk2 = bf.ReadUint16()
// doesn't expect a response
return nil return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint8(m.AchievementID) return errors.New("NOT IMPLEMENTED")
bf.WriteUint16(m.Unk1)
bf.WriteUint16(m.Unk2)
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"
) )
// MsgMhfEnumerateAiroulist represents the MSG_MHF_ENUMERATE_AIROULIST // MsgMhfEnumerateAiroulist represents the MSG_MHF_ENUMERATE_AIROULIST

View File

@@ -1,9 +1,11 @@
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"
) )
// MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT // MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT
@@ -30,9 +32,5 @@ func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateGuacot) 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)
bf.WriteUint16(m.Unk2)
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"
) )
type EnumerateGuildType uint8 type EnumerateGuildType uint8
@@ -43,7 +43,7 @@ func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Type = EnumerateGuildType(bf.ReadUint8()) m.Type = EnumerateGuildType(bf.ReadUint8())
m.RawDataPayload = bf.DataFromCurrent() m.RawDataPayload = bf.DataFromCurrent()
bf.Seek(int64(len(bf.Data()) - 2), 0) bf.Seek(int64(len(bf.Data())-2), 0)
return nil return nil
} }

View File

@@ -3,13 +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"
) )
// MsgMhfMercenaryHuntdata represents the MSG_MHF_MERCENARY_HUNTDATA // MsgMhfMercenaryHuntdata represents the MSG_MHF_MERCENARY_HUNTDATA
type MsgMhfMercenaryHuntdata struct{ type MsgMhfMercenaryHuntdata struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8 Unk0 uint8
} }

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"
) )
// MsgMhfReadMail represents the MSG_MHF_READ_MAIL // MsgMhfReadMail represents the MSG_MHF_READ_MAIL

View File

@@ -3,13 +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"
) )
// MsgMhfReadMercenaryM represents the MSG_MHF_READ_MERCENARY_M // MsgMhfReadMercenaryM represents the MSG_MHF_READ_MERCENARY_M
type MsgMhfReadMercenaryM struct{ type MsgMhfReadMercenaryM struct {
AckHandle uint32 AckHandle uint32
CharID uint32 CharID uint32
Unk0 uint32 Unk0 uint32

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"
) )
type GuildIconMsgPart struct { type GuildIconMsgPart struct {

View File

@@ -3,12 +3,12 @@ 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"
) )
type Item struct{ type Item struct {
Unk0 uint32 Unk0 uint32
ItemId uint16 ItemId uint16
Amount uint16 Amount uint16
@@ -16,7 +16,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
Amount uint16 Amount uint16

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"
) )
// MsgMhfUpdateGuildMessageBoard represents the MSG_MHF_UPDATE_GUILD_MESSAGE_BOARD // MsgMhfUpdateGuildMessageBoard represents the MSG_MHF_UPDATE_GUILD_MESSAGE_BOARD
@@ -26,7 +26,7 @@ func (m *MsgMhfUpdateGuildMessageBoard) Parse(bf *byteframe.ByteFrame, ctx *clie
m.MessageOp = bf.ReadUint32() m.MessageOp = bf.ReadUint32()
if m.MessageOp != 5 { if m.MessageOp != 5 {
m.Request = bf.DataFromCurrent() m.Request = bf.DataFromCurrent()
bf.Seek(int64(len(bf.Data()) - 2), 0) bf.Seek(int64(len(bf.Data())-2), 0)
} }
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"
) )
// MsgMhfUpdateInterior represents the MSG_MHF_UPDATE_INTERIOR // MsgMhfUpdateInterior represents the MSG_MHF_UPDATE_INTERIOR

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"
) )
// MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA // MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA

View File

@@ -3,16 +3,15 @@ package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/common/bfutil"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgSysCheckSemaphore represents the MSG_SYS_CHECK_SEMAPHORE // MsgSysCheckSemaphore represents the MSG_SYS_CHECK_SEMAPHORE
type MsgSysCheckSemaphore struct{ type MsgSysCheckSemaphore struct {
AckHandle uint32 AckHandle uint32
StageID string SemaphoreID string
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.

View File

@@ -134,7 +134,7 @@ func handleMsgSysCheckSemaphore(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysCheckSemaphore) pkt := p.(*mhfpacket.MsgSysCheckSemaphore)
resp := []byte{0x00, 0x00, 0x00, 0x00} resp := []byte{0x00, 0x00, 0x00, 0x00}
s.server.semaphoreLock.Lock() s.server.semaphoreLock.Lock()
if _, exists := s.server.semaphore[pkt.StageID]; exists { if _, exists := s.server.semaphore[pkt.SemaphoreID]; exists {
resp = []byte{0x00, 0x00, 0x00, 0x01} resp = []byte{0x00, 0x00, 0x00, 0x01}
} }
s.server.semaphoreLock.Unlock() s.server.semaphoreLock.Unlock()

View File

@@ -5,8 +5,8 @@ import (
"net" "net"
"sync" "sync"
ps "erupe-ce/common/pascalstring"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
ps "erupe-ce/common/pascalstring"
"erupe-ce/config" "erupe-ce/config"
"erupe-ce/network/binpacket" "erupe-ce/network/binpacket"
"erupe-ce/network/mhfpacket" "erupe-ce/network/mhfpacket"