Skip to content

Commit

Permalink
initial legacy support for DistItem
Browse files Browse the repository at this point in the history
  • Loading branch information
sekaiwish committed Nov 21, 2023
1 parent 43f8cef commit d4ddf7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions network/mhfpacket/msg_mhf_apply_dist_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
_config "erupe-ce/config"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
Expand All @@ -26,8 +27,12 @@ func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
m.AckHandle = bf.ReadUint32()
m.DistributionType = bf.ReadUint8()
m.DistributionID = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint32()
if _config.ErupeConfig.RealClientMode >= _config.G8 {
m.Unk2 = bf.ReadUint32()
}
if _config.ErupeConfig.RealClientMode >= _config.G10 {
m.Unk3 = bf.ReadUint32()
}
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion network/mhfpacket/msg_mhf_enumerate_dist_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
_config "erupe-ce/config"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
Expand All @@ -27,7 +28,9 @@ func (m *MsgMhfEnumerateDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
m.DistType = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16() // Maximum? Hardcoded to 256
m.Unk3 = bf.ReadBytes(uint(bf.ReadUint8()))
if _config.ErupeConfig.RealClientMode >= _config.Z1 {
m.Unk3 = bf.ReadBytes(uint(bf.ReadUint8()))
}
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion server/channelserver/handlers_distitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package channelserver
import (
"erupe-ce/common/byteframe"
ps "erupe-ce/common/pascalstring"
_config "erupe-ce/config"
"erupe-ce/network/mhfpacket"
"time"

Expand Down Expand Up @@ -128,7 +129,9 @@ func handleMsgMhfApplyDistItem(s *Session, p mhfpacket.MHFPacket) {
bf.WriteUint8(item.ItemType)
bf.WriteUint32(item.ItemID)
bf.WriteUint32(item.Quantity)
bf.WriteUint32(item.ID)
if _config.ErupeConfig.RealClientMode >= _config.G8 {
bf.WriteUint32(item.ID)
}
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
Expand Down

0 comments on commit d4ddf7b

Please sign in to comment.