mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
decode various diva packets
This commit is contained in:
@@ -13,7 +13,7 @@ type MsgMhfAcquireUdItem struct {
|
||||
AckHandle uint32
|
||||
Freeze bool
|
||||
RewardType uint8
|
||||
Count int
|
||||
Count uint8
|
||||
RewardIDs []uint32
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Freeze = bf.ReadBool()
|
||||
m.RewardType = bf.ReadUint8()
|
||||
m.Count = int(bf.ReadUint8())
|
||||
for i := 0; i < m.Count; i++ {
|
||||
m.Count = bf.ReadUint8()
|
||||
for i := uint8(0); i < m.Count; i++ {
|
||||
m.RewardIDs = append(m.RewardIDs, bf.ReadUint32())
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -11,8 +11,10 @@ import (
|
||||
// MsgMhfAddRewardSongCount represents the MSG_MHF_ADD_REWARD_SONG_COUNT
|
||||
type MsgMhfAddRewardSongCount struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint32
|
||||
Unk1 []byte
|
||||
PrayerID uint32
|
||||
Unk1 uint16
|
||||
Unk2 uint8
|
||||
Unk3 []uint16
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -23,8 +25,12 @@ func (m *MsgMhfAddRewardSongCount) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadBytes(5)
|
||||
m.PrayerID = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
m.Unk2 = bf.ReadUint8()
|
||||
for i := uint8(0); i < m.Unk2; i++ {
|
||||
m.Unk3 = append(m.Unk3, bf.ReadUint16())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
)
|
||||
|
||||
// MsgMhfGetUdRanking represents the MSG_MHF_GET_UD_RANKING
|
||||
type MsgMhfGetUdRanking struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint8
|
||||
RankType uint8
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -22,7 +22,7 @@ func (m *MsgMhfGetUdRanking) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfGetUdRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint8()
|
||||
m.RankType = bf.ReadUint8()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,19 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
)
|
||||
|
||||
// MsgMhfSetUdTacticsFollower represents the MSG_MHF_SET_UD_TACTICS_FOLLOWER
|
||||
type MsgMhfSetUdTacticsFollower struct{}
|
||||
type MsgMhfSetUdTacticsFollower struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
func (m *MsgMhfSetUdTacticsFollower) Opcode() network.PacketID {
|
||||
@@ -18,7 +24,12 @@ func (m *MsgMhfSetUdTacticsFollower) Opcode() network.PacketID {
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfSetUdTacticsFollower) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
m.Unk2 = bf.ReadUint16()
|
||||
m.Unk3 = bf.ReadUint16()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
|
||||
@@ -173,12 +173,12 @@ func handleMsgMhfGetKijuInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
func handleMsgMhfSetKiju(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetKiju)
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
}
|
||||
|
||||
func handleMsgMhfAddUdPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAddUdPoint)
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdMyPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -194,7 +194,7 @@ type UdPointTargets struct {
|
||||
func handleMsgMhfGetUdTotalPointInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTotalPointInfo)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(0)
|
||||
bf.WriteUint8(0) // No error
|
||||
targets := make([]UdPointTargets, 64)
|
||||
defaultTargets := []UdPointTargets{
|
||||
{0, 500000},
|
||||
@@ -428,7 +428,10 @@ func handleMsgMhfGetUdRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
// Temporary
|
||||
for i := 0; i < 100; i++ {
|
||||
bf.WriteUint16(uint16(i + 1))
|
||||
stringsupport.PaddedString("", 25, false)
|
||||
bf.WriteBytes(stringsupport.PaddedString("", 25, true))
|
||||
if pkt.RankType == 1 || pkt.RankType == 3 { // "Total" type
|
||||
bf.WriteBytes(stringsupport.PaddedString("", 16, true))
|
||||
}
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
@@ -931,12 +934,12 @@ func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGenerateUdGuildMap)
|
||||
guild, err := GetGuildInfoByCharacterId(s, s.charID)
|
||||
if err != nil || guild == nil {
|
||||
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0xFF})
|
||||
return
|
||||
}
|
||||
isApplicant, _ := guild.HasApplicationForCharID(s, s.charID)
|
||||
if err != nil || isApplicant {
|
||||
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0xFF})
|
||||
return
|
||||
}
|
||||
interceptionMaps := &InterceptionMaps{}
|
||||
@@ -945,5 +948,5 @@ func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.server.logger.Debug("err", zap.Error(err))
|
||||
}
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
)
|
||||
@@ -17,26 +15,40 @@ func handleMsgMhfGetAdditionalBeatReward(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
func handleMsgMhfGetUdRankingRewardList(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdRankingRewardList)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
doAckBufSucceed(s, pkt.AckHandle, data)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(0) // Len
|
||||
// Format
|
||||
// uint8 Unk
|
||||
// uint16 Unk
|
||||
// uint16 Unk
|
||||
// uint8 Unk
|
||||
// uint32 Unk
|
||||
// uint32 Unk
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetRewardSong(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetRewardSong)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
doAckBufSucceed(s, pkt.AckHandle, data)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(0) // No error
|
||||
bf.WriteUint8(0) // Unk
|
||||
bf.WriteUint32(0) // Prayer ID
|
||||
bf.WriteUint32(0xFFFFFFFF) // Prayer end
|
||||
for i := 0; i < 4; i++ {
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint8(0)
|
||||
}
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUseRewardSong(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfUseRewardSong)
|
||||
doAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
}
|
||||
|
||||
func handleMsgMhfAddRewardSongCount(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAddRewardSongCount)
|
||||
doAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireMonthlyReward(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"time"
|
||||
)
|
||||
|
||||
func handleMsgMhfGetUdTacticsPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -19,7 +19,7 @@ func handleMsgMhfGetUdTacticsPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
totalPoints += i
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(0x00) // Unk, some kind of error code?
|
||||
bf.WriteUint8(0) // No error
|
||||
bf.WriteInt32(totalPoints)
|
||||
bf.WriteUint8(uint8(len(personalPoints)))
|
||||
for i := range personalPoints {
|
||||
@@ -83,11 +83,20 @@ type DivaReward struct {
|
||||
Repeatable bool `db:"repeatable"`
|
||||
}
|
||||
|
||||
type DivaRankReward struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
MaxRank uint32
|
||||
MinRank uint32
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTacticsRewardList(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTacticsRewardList)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(0)
|
||||
bf.WriteUint8(0) // No error
|
||||
var personalRewards, guildRewards []DivaReward
|
||||
var rankRewards []DivaRankReward
|
||||
var tempReward DivaReward
|
||||
rows, err := s.server.db.Queryx(`SELECT points_req, item_type, item_id, quantity, gr, repeatable FROM diva_prizes WHERE type='personal'`)
|
||||
if err == nil {
|
||||
@@ -121,21 +130,45 @@ func handleMsgMhfGetUdTacticsRewardList(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(reward.GR)
|
||||
bf.WriteBool(reward.Repeatable)
|
||||
}
|
||||
data, _ := hex.DecodeString("002607000E00C8000000010000000307000F0032000000010000000307001000320000000100000003070011003200000001000000030700120032000000010000000307000E0096000000040000000A07000F0028000000040000000A0700100028000000040000000A0700110028000000040000000A0700120028000000040000000A07000E00640000000B0000001907000F001E0000000B00000019070010001E0000000B00000019070011001E0000000B00000019070012001E0000000B0000001907000E00320000001A0000002807000F00140000001A0000002807001000140000001A0000002807001100140000001A0000002807001200140000001A0000002807000E001E000000290000004607000F000A0000002900000046070010000A000000290000004607001100010000002900000046070012000A000000290000004607000E0019000000470000006407000F0008000000470000006407001000080000004700000064070011000100000047000000640700120008000000470000006407000E000F000000650000009607000F0006000000650000009607001000010000006500000096070011000600000065000000960700120006000000650000009607000E000500000097000001F407000F000500000097000001F4070010000500000097000001F4")
|
||||
bf.WriteBytes(data)
|
||||
bf.WriteUint16(uint16(len(rankRewards)))
|
||||
for _, reward := range rankRewards {
|
||||
bf.WriteUint8(reward.Unk0)
|
||||
bf.WriteUint16(reward.Unk1)
|
||||
bf.WriteUint16(reward.Unk2)
|
||||
bf.WriteUint32(reward.MaxRank)
|
||||
bf.WriteUint32(reward.MinRank)
|
||||
}
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTacticsFollower(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTacticsFollower)
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint32(0)
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTacticsBonusQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTacticsBonusQuest)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("14E2F55DCBFE505DCC1A7003E8E2C55DCC6ED05DCC8AF00258E2CE5DCCDF505DCCFB700279E3075DCD4FD05DCD6BF0041AE2F15DCDC0505DCDDC700258E2C45DCE30D05DCE4CF00258E2F55DCEA1505DCEBD7003E8E2C25DCF11D05DCF2DF00258E2CE5DCF82505DCF9E700279E3075DCFF2D05DD00EF0041AE2CE5DD063505DD07F700279E2F35DD0D3D05DD0EFF0028AE2C35DD144505DD160700258E2F05DD1B4D05DD1D0F00258E2CE5DD225505DD241700279E2F55DD295D05DD2B1F003E8E2F25DD306505DD3227002EEE2CA5DD376D05DD392F00258E3075DD3E7505DD40370041AE2F55DD457D05DD473F003E82027313220686F757273273A3A696E74657276616C29202B2027313220686F757273273A3A696E74657276616C2047524F5550204259206D6170204F52444552204259206D61703B2000C7312B000032")
|
||||
doAckBufSucceed(s, pkt.AckHandle, data)
|
||||
bonusQuests := []struct {
|
||||
QuestFileID uint16
|
||||
Start time.Time
|
||||
End time.Time
|
||||
Points uint16
|
||||
}{}
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(uint8(len(bonusQuests)))
|
||||
for _, quest := range bonusQuests {
|
||||
bf.WriteUint16(quest.QuestFileID)
|
||||
bf.WriteUint32(uint32(quest.Start.Unix()))
|
||||
bf.WriteUint32(uint32(quest.End.Unix()))
|
||||
bf.WriteUint16(quest.Points)
|
||||
}
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTacticsFirstQuestBonus(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -169,17 +202,17 @@ func handleMsgMhfGetUdTacticsRemainingPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
func handleMsgMhfGetUdTacticsRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTacticsRanking)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(0) // ranking
|
||||
bf.WriteUint32(0) // rankingDupe?
|
||||
bf.WriteUint32(0) // guildPoints
|
||||
bf.WriteUint32(0) // unk
|
||||
bf.WriteUint32(0) // unkDupe?
|
||||
bf.WriteUint32(0) // guildPointsDupe?
|
||||
bf.WriteBytes(stringsupport.PaddedString("", 25, true))
|
||||
bf.WriteUint32(0) // Own Rank
|
||||
bf.WriteUint32(0) // Own Score (Areas)
|
||||
bf.WriteBytes(stringsupport.PaddedString("", 32, true))
|
||||
bf.WriteUint8(0) // Num other ranks
|
||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfSetUdTacticsFollower(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfSetUdTacticsFollower(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetUdTacticsFollower)
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTacticsLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTacticsLog)
|
||||
|
||||
Reference in New Issue
Block a user