diff --git a/network/mhfpacket/msg_mhf_info_tournament.go b/network/mhfpacket/msg_mhf_info_tournament.go index d91f2d6f1..9da465add 100644 --- a/network/mhfpacket/msg_mhf_info_tournament.go +++ b/network/mhfpacket/msg_mhf_info_tournament.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" ) // MsgMhfInfoTournament represents the MSG_MHF_INFO_TOURNAMENT -type MsgMhfInfoTournament struct{} +type MsgMhfInfoTournament struct { + AckHandle uint32 + Unk0 uint8 + Unk1 uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfInfoTournament) Opcode() network.PacketID { @@ -18,7 +22,10 @@ func (m *MsgMhfInfoTournament) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfInfoTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint8() + m.Unk1 = bf.ReadUint32() + return nil } // Build builds a binary packet from the current data. diff --git a/server/channelserver/handlers_tournament.go b/server/channelserver/handlers_tournament.go index 4511cfedc..2503bc904 100644 --- a/server/channelserver/handlers_tournament.go +++ b/server/channelserver/handlers_tournament.go @@ -1,8 +1,59 @@ package channelserver -import "erupe-ce/network/mhfpacket" +import ( + "erupe-ce/common/byteframe" + ps "erupe-ce/common/pascalstring" + "erupe-ce/network/mhfpacket" + "time" +) -func handleMsgMhfInfoTournament(s *Session, p mhfpacket.MHFPacket) {} +func handleMsgMhfInfoTournament(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfInfoTournament) + bf := byteframe.NewByteFrame() + + switch pkt.Unk0 { + case 0: + bf.WriteUint32(uint32(Time_Current_Adjusted().Unix())) + bf.WriteUint32(0) // Tied to schedule ID? + case 1: + + bf.WriteBytes(make([]byte, 15)) + ps.Uint8(bf, "", false) + break + + bf.WriteUint32(0xACEDCAFE) + + bf.WriteUint32(5) // Active schedule? + + bf.WriteUint32(1) // Schedule ID? + + bf.WriteUint32(32) // Max players + bf.WriteUint32(0) // Registered players + + bf.WriteUint16(0) + bf.WriteUint16(2) // Color code for schedule item + bf.WriteUint32(0) + + bf.WriteUint32(uint32(time.Now().Add(time.Hour * -10).Unix())) + bf.WriteUint32(uint32(time.Now().Add(time.Hour * 10).Unix())) + bf.WriteUint32(uint32(time.Now().Add(time.Hour * 10).Unix())) + bf.WriteUint32(uint32(time.Now().Add(time.Hour * 10).Unix())) + bf.WriteUint32(uint32(time.Now().Add(time.Hour * 10).Unix())) + bf.WriteUint32(uint32(time.Now().Add(time.Hour * 10).Unix())) + + bf.WriteBool(true) // Unk + bf.WriteBool(false) // Cafe-only + + bf.WriteUint32(0) // Min HR + bf.WriteUint32(0) // Max HR + + ps.Uint8(bf, "Test", false) + + // ... + } + + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) +} func handleMsgMhfEntryTournament(s *Session, p mhfpacket.MHFPacket) {}