mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
update branch, handle EnumerateOrder
This commit is contained in:
@@ -10,9 +10,9 @@ import (
|
|||||||
|
|
||||||
// MsgMhfEnumerateOrder represents the MSG_MHF_ENUMERATE_ORDER
|
// MsgMhfEnumerateOrder represents the MSG_MHF_ENUMERATE_ORDER
|
||||||
type MsgMhfEnumerateOrder struct {
|
type MsgMhfEnumerateOrder struct {
|
||||||
AckHandle uint32
|
AckHandle uint32
|
||||||
EventID uint32
|
CupID uint32
|
||||||
Unk1 uint32
|
TournamentID uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opcode returns the ID associated with this packet type.
|
// Opcode returns the ID associated with this packet type.
|
||||||
@@ -23,8 +23,8 @@ func (m *MsgMhfEnumerateOrder) Opcode() network.PacketID {
|
|||||||
// Parse parses the packet from binary
|
// Parse parses the packet from binary
|
||||||
func (m *MsgMhfEnumerateOrder) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
func (m *MsgMhfEnumerateOrder) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||||
m.AckHandle = bf.ReadUint32()
|
m.AckHandle = bf.ReadUint32()
|
||||||
m.EventID = bf.ReadUint32()
|
m.CupID = bf.ReadUint32()
|
||||||
m.Unk1 = bf.ReadUint32()
|
m.TournamentID = bf.ReadUint32()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package channelserver
|
|||||||
import (
|
import (
|
||||||
"erupe-ce/common/byteframe"
|
"erupe-ce/common/byteframe"
|
||||||
ps "erupe-ce/common/pascalstring"
|
ps "erupe-ce/common/pascalstring"
|
||||||
|
"erupe-ce/common/stringsupport"
|
||||||
"erupe-ce/common/token"
|
"erupe-ce/common/token"
|
||||||
_config "erupe-ce/config"
|
_config "erupe-ce/config"
|
||||||
"erupe-ce/network/mhfpacket"
|
"erupe-ce/network/mhfpacket"
|
||||||
@@ -65,18 +66,18 @@ func generateTournamentTimestamps(start uint32, debug bool) []uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TournamentEvent struct {
|
type TournamentEvent struct {
|
||||||
ID uint32
|
ID uint32
|
||||||
CupGroup uint16
|
CupGroup uint16
|
||||||
Limit int16
|
Limit int16
|
||||||
QuestFile uint32
|
QuestFileID uint32
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
type TournamentCup struct {
|
type TournamentCup struct {
|
||||||
ID uint32
|
ID uint32
|
||||||
CupGroup uint16
|
CupGroup uint16
|
||||||
Type uint16
|
Type uint16
|
||||||
Unk2 uint16
|
Unk uint16
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
}
|
}
|
||||||
@@ -158,7 +159,7 @@ func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.WriteUint32(event.ID)
|
bf.WriteUint32(event.ID)
|
||||||
bf.WriteUint16(event.CupGroup)
|
bf.WriteUint16(event.CupGroup)
|
||||||
bf.WriteInt16(event.Limit)
|
bf.WriteInt16(event.Limit)
|
||||||
bf.WriteUint32(event.QuestFile)
|
bf.WriteUint32(event.QuestFileID)
|
||||||
ps.Uint8(bf, event.Name, true)
|
ps.Uint8(bf, event.Name, true)
|
||||||
}
|
}
|
||||||
bf.WriteUint8(uint8(len(tournamentCups)))
|
bf.WriteUint8(uint8(len(tournamentCups)))
|
||||||
@@ -166,33 +167,43 @@ func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.WriteUint32(cup.ID)
|
bf.WriteUint32(cup.ID)
|
||||||
bf.WriteUint16(cup.CupGroup)
|
bf.WriteUint16(cup.CupGroup)
|
||||||
bf.WriteUint16(cup.Type)
|
bf.WriteUint16(cup.Type)
|
||||||
bf.WriteUint16(cup.Unk2)
|
bf.WriteUint16(cup.Unk)
|
||||||
ps.Uint8(bf, cup.Name, true)
|
ps.Uint8(bf, cup.Name, true)
|
||||||
ps.Uint16(bf, cup.Description, true)
|
ps.Uint16(bf, cup.Description, true)
|
||||||
}
|
}
|
||||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
type TournamentRanking struct {
|
type TournamentRank struct {
|
||||||
Unk0 uint32
|
CID uint32
|
||||||
Unk1 uint32
|
Rank uint32
|
||||||
Unk2 uint16
|
Grade uint16
|
||||||
Unk3 uint16 // Unused
|
HR uint16
|
||||||
Unk4 uint16
|
GR uint16
|
||||||
Unk5 uint16
|
CharName string
|
||||||
Unk6 uint16
|
GuildName string
|
||||||
Unk7 uint8
|
|
||||||
Unk8 string
|
|
||||||
Unk9 string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgMhfEnumerateOrder)
|
pkt := p.(*mhfpacket.MsgMhfEnumerateOrder)
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteUint32(0)
|
bf.WriteUint32(pkt.CupID)
|
||||||
bf.WriteUint32(0)
|
bf.WriteUint32(uint32(TimeAdjusted().Unix()))
|
||||||
bf.WriteUint16(0)
|
|
||||||
bf.WriteUint16(0)
|
tournamentRanks := []TournamentRank{}
|
||||||
|
for _, rank := range tournamentRanks {
|
||||||
|
bf.WriteUint32(rank.CID)
|
||||||
|
bf.WriteUint32(rank.Rank)
|
||||||
|
bf.WriteUint16(rank.Grade)
|
||||||
|
bf.WriteUint16(0)
|
||||||
|
bf.WriteUint16(rank.HR)
|
||||||
|
bf.WriteUint16(rank.GR)
|
||||||
|
bf.WriteUint16(0)
|
||||||
|
bf.WriteUint8(uint8(len(rank.CharName) + 1))
|
||||||
|
bf.WriteUint8(uint8(len(rank.GuildName) + 1))
|
||||||
|
bf.WriteNullTerminatedBytes(stringsupport.UTF8ToSJIS(rank.CharName))
|
||||||
|
bf.WriteNullTerminatedBytes(stringsupport.UTF8ToSJIS(rank.GuildName))
|
||||||
|
}
|
||||||
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user