mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 16:34:51 +01:00
Clients in stage are now notified when player chooses a quest
This commit is contained in:
@@ -16,6 +16,7 @@ const (
|
||||
type MsgBinPlayerJoinedParty struct {
|
||||
CharID uint32
|
||||
PartyJoinType PartyJoinType
|
||||
Unk1 uint16
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -31,9 +32,10 @@ func (m *MsgBinPlayerJoinedParty) Parse(bf *byteframe.ByteFrame) error {
|
||||
func (m *MsgBinPlayerJoinedParty) Build(bf *byteframe.ByteFrame) error {
|
||||
payload := byteframe.NewByteFrame()
|
||||
|
||||
payload.WriteUint16(0x2)
|
||||
payload.WriteUint16(0x02)
|
||||
payload.WriteUint8(uint8(m.PartyJoinType))
|
||||
payload.WriteBytes([]byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
payload.WriteUint16(m.Unk1)
|
||||
payload.WriteBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
|
||||
pkt := &mhfpacket.MsgSysCastedBinary{
|
||||
CharID: m.CharID,
|
||||
|
||||
@@ -498,6 +498,15 @@ func handleMsgSysCreateStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
resp := make([]byte, 8) // Unk resp.
|
||||
s.QueueAck(pkt.AckHandle, resp)
|
||||
|
||||
createdPartyMessage := &mhfpacket.MsgSysCastedBinary{
|
||||
CharID: s.charID,
|
||||
Type0: 0x03,
|
||||
Type1: 0x03,
|
||||
RawDataPayload: []byte{0x00, 0x02, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x5b, 0x27, 0xb3, 0x2e, 0x48, 0xa3, 0x17, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(createdPartyMessage, s)
|
||||
}
|
||||
|
||||
func handleMsgSysStageDestruct(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -694,17 +703,16 @@ func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
0x00, 0x1b, 0x30, 0x15, 0xc2, 0x45, 0x03, 0x03, 0x00, 0x0c, 0x00, 0x02, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
|
||||
})
|
||||
|
||||
notify := &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: s.charID,
|
||||
BinaryType: 0x03,
|
||||
// TODO remove this, temp for testing
|
||||
if s.charID == 0x02 {
|
||||
return
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(notify, s)
|
||||
|
||||
//TODO these messages should be directed to the correct recipients
|
||||
joinedAPartyMessage := &binpacket.MsgBinPlayerJoinedParty{
|
||||
CharID: s.charID,
|
||||
PartyJoinType: binpacket.JoinedLocalParty,
|
||||
Unk1: 0x01,
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(joinedAPartyMessage, s)
|
||||
@@ -712,6 +720,7 @@ func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
joinedYourPartyMessage := &binpacket.MsgBinPlayerJoinedParty{
|
||||
CharID: s.charID,
|
||||
PartyJoinType: binpacket.JoinedYourParty,
|
||||
Unk1: 0x01,
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(joinedYourPartyMessage, s)
|
||||
@@ -1007,6 +1016,13 @@ func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.server.userBinaryPartsLock.Lock()
|
||||
s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload
|
||||
s.server.userBinaryPartsLock.Unlock()
|
||||
|
||||
msg := &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: s.charID,
|
||||
BinaryType: pkt.BinaryType,
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(msg, s)
|
||||
}
|
||||
|
||||
func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
@@ -58,6 +58,9 @@ func (s *Session) Start() {
|
||||
|
||||
// QueueSend queues a packet (raw []byte) to be sent.
|
||||
func (s *Session) QueueSend(data []byte) {
|
||||
fmt.Printf("Sending To CharID: '%x'\n", s.charID)
|
||||
fmt.Printf("Sent Data:\n%s\n", hex.Dump(data))
|
||||
|
||||
s.sendPackets <- data
|
||||
}
|
||||
|
||||
@@ -144,6 +147,7 @@ func (s *Session) handlePacketGroup(pktGroup []byte) {
|
||||
opcode != network.MSG_SYS_NOP &&
|
||||
opcode != network.MSG_SYS_TIME &&
|
||||
opcode != network.MSG_SYS_EXTEND_THRESHOLD {
|
||||
fmt.Printf("CharID: '%x'\n", s.charID)
|
||||
fmt.Printf("Opcode: %s\n", opcode)
|
||||
fmt.Printf("Data:\n%s\n", hex.Dump(pktGroup))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user