broadcast raviente jump messages

This commit is contained in:
wishu
2022-07-07 04:27:15 +10:00
parent d44fa5b62d
commit 9ed5b50170
3 changed files with 52 additions and 5 deletions

View File

@@ -9,7 +9,12 @@ import (
)
// MsgMhfAnnounce represents the MSG_MHF_ANNOUNCE
type MsgMhfAnnounce struct{}
type MsgMhfAnnounce struct {
AckHandle uint32
IPAddress uint32
Port uint16
StageID []byte
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAnnounce) Opcode() network.PacketID {
@@ -18,7 +23,20 @@ func (m *MsgMhfAnnounce) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
m.AckHandle = bf.ReadUint32()
m.IPAddress = bf.ReadUint32()
m.Port = bf.ReadUint16()
_ = bf.ReadUint8()
_ = bf.ReadUint16()
m.StageID = bf.ReadNullTerminatedBytes()
for {
byte := bf.ReadUint8()
if byte != 0 {
_ = bf.ReadUint8()
break
}
}
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -344,7 +344,11 @@ func handleMsgMhfPresentBox(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfServerCommand(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfAnnounce(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfAnnounce(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfAnnounce)
s.server.BroadcastRaviente(pkt.IPAddress, pkt.Port, pkt.StageID)
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
}
func handleMsgMhfSetLoginwindow(s *Session, p mhfpacket.MHFPacket) {}

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"net"
"sync"
"encoding/hex"
"github.com/Andoryuuta/byteframe"
"erupe-ce/config"
@@ -308,6 +309,30 @@ func (s *Server) BroadcastChatMessage(message string) {
}, nil)
}
func (s *Server) BroadcastRaviente(ip uint32, port uint16, stage []byte) {
bf := byteframe.NewByteFrame()
bf.SetLE()
bf.WriteUint16(0) // Unk
bf.WriteUint16(0x43) // Data len
bf.WriteUint16(3) // Unk len
bf.WriteUint16(0x29) // String len
d, _ := hex.DecodeString("3C91E593A294B0814696D28BB68AFA81798BC9817A3E82AA8A4A8DC382B382EA82DC82B582BD814900")
bf.WriteBytes(d)
bf.WriteBytes([]byte{0x5F, 0x53, 0x00})
bf.WriteUint32(ip) // IP address
bf.WriteUint16(port) // Port
bf.WriteUint16(0) // Unk
bf.WriteNullTerminatedBytes(stage)
bf.WriteBytes(make([]byte, 17))
s.BroadcastMHF(&mhfpacket.MsgSysCastedBinary{
CharID: 0x00000000,
BroadcastType: BroadcastTypeSemaphore,
MessageType: BinaryMessageTypeChat,
RawDataPayload: bf.Data(),
}, nil)
}
func (s *Server) DiscordChannelSend(charName string, content string) {
if s.erupeConfig.Discord.Enabled && s.discordBot != nil {
message := fmt.Sprintf("**%s** : %s", charName, content)