From 0b4108fb851a0fe0e348eaaa7eba18834d5af179 Mon Sep 17 00:00:00 2001 From: wish Date: Mon, 12 Jun 2023 23:23:53 +1000 Subject: [PATCH] various Conquest changes --- .../msg_mhf_get_break_seibatu_level_reward.go | 19 ++-- ...msg_mhf_get_fixed_seibatu_ranking_table.go | 25 +++-- .../msg_mhf_read_beat_level_all_ranking.go | 21 ++-- .../msg_mhf_read_beat_level_my_ranking.go | 23 +++-- server/channelserver/handlers.go | 30 ------ server/channelserver/handlers_seibattle.go | 98 +++++++++++++++++++ server/channelserver/handlers_tower.go | 30 ------ 7 files changed, 162 insertions(+), 84 deletions(-) create mode 100644 server/channelserver/handlers_seibattle.go diff --git a/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go b/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go index e6f0e9a56..601dd5cb2 100644 --- a/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go +++ b/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go @@ -1,15 +1,19 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfGetBreakSeibatuLevelReward represents the MSG_MHF_GET_BREAK_SEIBATU_LEVEL_REWARD -type MsgMhfGetBreakSeibatuLevelReward struct{} +type MsgMhfGetBreakSeibatuLevelReward struct { + AckHandle uint32 + Unk0 uint32 + Unk1 int32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfGetBreakSeibatuLevelReward) Opcode() network.PacketID { @@ -18,7 +22,10 @@ func (m *MsgMhfGetBreakSeibatuLevelReward) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfGetBreakSeibatuLevelReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint32() + m.Unk1 = bf.ReadInt32() + return nil } // Build builds a binary packet from the current data. diff --git a/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go b/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go index 52651c9d2..2d7cbbac4 100644 --- a/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go +++ b/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go @@ -1,15 +1,22 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfGetFixedSeibatuRankingTable represents the MSG_MHF_GET_FIXED_SEIBATU_RANKING_TABLE -type MsgMhfGetFixedSeibatuRankingTable struct{} +type MsgMhfGetFixedSeibatuRankingTable struct { + AckHandle uint32 + Unk0 uint32 + Unk1 int32 + Unk2 int32 + Unk3 int32 + Unk4 int32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfGetFixedSeibatuRankingTable) Opcode() network.PacketID { @@ -18,7 +25,13 @@ func (m *MsgMhfGetFixedSeibatuRankingTable) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfGetFixedSeibatuRankingTable) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint32() + m.Unk1 = bf.ReadInt32() + m.Unk2 = bf.ReadInt32() + m.Unk3 = bf.ReadInt32() + m.Unk4 = bf.ReadInt32() + return nil } // Build builds a binary packet from the current data. diff --git a/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go b/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go index 4d97df0d5..d9bf48a2c 100644 --- a/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go +++ b/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go @@ -1,15 +1,20 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfReadBeatLevelAllRanking represents the MSG_MHF_READ_BEAT_LEVEL_ALL_RANKING -type MsgMhfReadBeatLevelAllRanking struct{} +type MsgMhfReadBeatLevelAllRanking struct { + AckHandle uint32 + Unk0 uint32 + GuildID int32 + Unk2 int32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfReadBeatLevelAllRanking) Opcode() network.PacketID { @@ -18,7 +23,11 @@ func (m *MsgMhfReadBeatLevelAllRanking) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfReadBeatLevelAllRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint32() + m.GuildID = bf.ReadInt32() + m.Unk2 = bf.ReadInt32() + return nil } // Build builds a binary packet from the current data. diff --git a/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go b/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go index 4b713e8e7..e51bba318 100644 --- a/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go +++ b/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go @@ -1,15 +1,20 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfReadBeatLevelMyRanking represents the MSG_MHF_READ_BEAT_LEVEL_MY_RANKING -type MsgMhfReadBeatLevelMyRanking struct{} +type MsgMhfReadBeatLevelMyRanking struct { + AckHandle uint32 + Unk0 uint32 + Unk1 uint32 + Unk2 []int32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfReadBeatLevelMyRanking) Opcode() network.PacketID { @@ -18,7 +23,13 @@ func (m *MsgMhfReadBeatLevelMyRanking) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfReadBeatLevelMyRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint32() + m.Unk1 = bf.ReadUint32() + for i := 0; i < 16; i++ { + m.Unk2 = append(m.Unk2, bf.ReadInt32()) + } + return nil } // Build builds a binary packet from the current data. diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index ed00f2275..614b98da1 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -1575,36 +1575,6 @@ func handleMsgMhfStampcardPrize(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfUnreserveSrg(s *Session, p mhfpacket.MHFPacket) {} -func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgMhfReadBeatLevel) - - // This response is fixed and will never change on JP, - // but I've left it dynamic for possible other client differences. - resp := byteframe.NewByteFrame() - for i := 0; i < int(pkt.ValidIDCount); i++ { - resp.WriteUint32(pkt.IDs[i]) - resp.WriteUint32(1) - resp.WriteUint32(1) - resp.WriteUint32(1) - } - - doAckBufSucceed(s, pkt.AckHandle, resp.Data()) -} - -func handleMsgMhfUpdateBeatLevel(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgMhfUpdateBeatLevel) - - doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) -} - -func handleMsgMhfReadBeatLevelAllRanking(s *Session, p mhfpacket.MHFPacket) {} - -func handleMsgMhfReadBeatLevelMyRanking(s *Session, p mhfpacket.MHFPacket) {} - -func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {} - -func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket) {} - func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) { diff --git a/server/channelserver/handlers_seibattle.go b/server/channelserver/handlers_seibattle.go new file mode 100644 index 000000000..4df05c67d --- /dev/null +++ b/server/channelserver/handlers_seibattle.go @@ -0,0 +1,98 @@ +package channelserver + +import ( + "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" +) + +func handleMsgMhfGetBreakSeibatuLevelReward(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfGetBreakSeibatuLevelReward) + bf := byteframe.NewByteFrame() + bf.WriteInt32(0) + bf.WriteInt32(0) + bf.WriteInt32(0) + bf.WriteInt32(0) + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) +} + +type WeeklySeibatuRankingReward struct { + Unk0 int32 + Unk1 int32 + Unk2 uint32 + Unk3 int32 + Unk4 int32 + Unk5 int32 +} + +func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfGetWeeklySeibatuRankingReward) + var data []*byteframe.ByteFrame + weeklySeibatuRankingRewards := []WeeklySeibatuRankingReward{ + {0, 0, 0, 0, 0, 0}, + } + for _, reward := range weeklySeibatuRankingRewards { + bf := byteframe.NewByteFrame() + bf.WriteInt32(reward.Unk0) + bf.WriteInt32(reward.Unk1) + bf.WriteUint32(reward.Unk2) + bf.WriteInt32(reward.Unk3) + bf.WriteInt32(reward.Unk4) + bf.WriteInt32(reward.Unk5) + data = append(data, bf) + } + doAckEarthSucceed(s, pkt.AckHandle, data) +} + +func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfGetFixedSeibatuRankingTable) + bf := byteframe.NewByteFrame() + bf.WriteInt32(0) + bf.WriteInt32(0) + bf.WriteBytes(make([]byte, 32)) + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) +} + +func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfReadBeatLevel) + + // This response is fixed and will never change on JP, + // but I've left it dynamic for possible other client differences. + resp := byteframe.NewByteFrame() + for i := 0; i < int(pkt.ValidIDCount); i++ { + resp.WriteUint32(pkt.IDs[i]) + resp.WriteUint32(1) + resp.WriteUint32(1) + resp.WriteUint32(1) + } + + doAckBufSucceed(s, pkt.AckHandle, resp.Data()) +} + +func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {} + +func handleMsgMhfUpdateBeatLevel(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfUpdateBeatLevel) + + doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) +} + +func handleMsgMhfReadBeatLevelAllRanking(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfReadBeatLevelAllRanking) + bf := byteframe.NewByteFrame() + bf.WriteUint32(0) + bf.WriteInt32(0) + bf.WriteInt32(0) + + for i := 0; i < 100; i++ { + bf.WriteUint32(0) + bf.WriteUint32(0) + bf.WriteBytes(make([]byte, 32)) + } + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) +} + +func handleMsgMhfReadBeatLevelMyRanking(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfReadBeatLevelMyRanking) + bf := byteframe.NewByteFrame() + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) +} diff --git a/server/channelserver/handlers_tower.go b/server/channelserver/handlers_tower.go index 3da436370..36e2cf45e 100644 --- a/server/channelserver/handlers_tower.go +++ b/server/channelserver/handlers_tower.go @@ -271,36 +271,6 @@ func handleMsgMhfPostTenrouirai(s *Session, p mhfpacket.MHFPacket) { doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) } -func handleMsgMhfGetBreakSeibatuLevelReward(s *Session, p mhfpacket.MHFPacket) {} - -type WeeklySeibatuRankingReward struct { - Unk0 int32 - Unk1 int32 - Unk2 uint32 - Unk3 int32 - Unk4 int32 - Unk5 int32 -} - -func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgMhfGetWeeklySeibatuRankingReward) - var data []*byteframe.ByteFrame - weeklySeibatuRankingRewards := []WeeklySeibatuRankingReward{ - {0, 0, 0, 0, 0, 0}, - } - for _, reward := range weeklySeibatuRankingRewards { - bf := byteframe.NewByteFrame() - bf.WriteInt32(reward.Unk0) - bf.WriteInt32(reward.Unk1) - bf.WriteUint32(reward.Unk2) - bf.WriteInt32(reward.Unk3) - bf.WriteInt32(reward.Unk4) - bf.WriteInt32(reward.Unk5) - data = append(data, bf) - } - doAckEarthSucceed(s, pkt.AckHandle, data) -} - func handleMsgMhfPresentBox(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfPresentBox) var data []*byteframe.ByteFrame