mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 08:55:31 +01:00
Add debug logging and stage entry fixes
This commit is contained in:
@@ -300,20 +300,31 @@ func handleMsgSysEnterStage(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
// Confirm the stage entry.
|
// Confirm the stage entry.
|
||||||
s.QueueAck(pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
s.QueueAck(pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||||
|
|
||||||
// TODO(Andoryuuta): Notify existing stage clients that this new client has entered.
|
// Notify existing stage clients that this new client has entered.
|
||||||
insertUserPkt := &mhfpacket.MsgSysInsertUser{
|
s.logger.Info("Sending MsgSysInsertUser & MsgSysNotifyUserBinary")
|
||||||
|
s.stage.BroadcastMHF(&mhfpacket.MsgSysInsertUser{
|
||||||
CharID: s.charID,
|
CharID: s.charID,
|
||||||
}
|
}, s)
|
||||||
s.stage.BroadcastMHF(insertUserPkt, s)
|
|
||||||
|
|
||||||
// Just the first user binary type (name) for right now.
|
s.stage.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary{
|
||||||
notifyUserBinary1Pkt := &mhfpacket.MsgSysNotifyUserBinary{
|
|
||||||
CharID: s.charID,
|
CharID: s.charID,
|
||||||
BinaryType: 1,
|
BinaryType: 1,
|
||||||
}
|
}, s)
|
||||||
s.stage.BroadcastMHF(notifyUserBinary1Pkt, s)
|
|
||||||
|
// Just the first user binary type (name) for right now.
|
||||||
|
/*
|
||||||
|
s.stage.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary{
|
||||||
|
CharID: s.charID,
|
||||||
|
BinaryType: 2,
|
||||||
|
}, s)
|
||||||
|
s.stage.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary{
|
||||||
|
CharID: s.charID,
|
||||||
|
BinaryType: 3,
|
||||||
|
}, s)
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO(Andoryuuta): Notify this client about all of the existing clients in the stage.
|
// TODO(Andoryuuta): Notify this client about all of the existing clients in the stage.
|
||||||
|
s.logger.Info("Notifying entree about existing stage clients")
|
||||||
s.stage.RLock()
|
s.stage.RLock()
|
||||||
clientNotif := byteframe.NewByteFrame()
|
clientNotif := byteframe.NewByteFrame()
|
||||||
for session := range s.stage.clients {
|
for session := range s.stage.clients {
|
||||||
@@ -328,8 +339,26 @@ func handleMsgSysEnterStage(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
}).Build(clientNotif)
|
}).Build(clientNotif)
|
||||||
}
|
}
|
||||||
s.stage.RUnlock()
|
s.stage.RUnlock()
|
||||||
|
clientNotif.WriteUint16(0x0010) // End it.
|
||||||
s.QueueSend(clientNotif.Data())
|
s.QueueSend(clientNotif.Data())
|
||||||
|
|
||||||
|
// Notify the client to duplicate the existing objects.
|
||||||
|
s.logger.Info("Notifying entree about existing stage objects")
|
||||||
|
clientDupObjNotif := byteframe.NewByteFrame()
|
||||||
|
s.stage.RLock()
|
||||||
|
for _, obj := range s.stage.objects {
|
||||||
|
(&mhfpacket.MsgSysDuplicateObject{
|
||||||
|
ObjID: obj.id,
|
||||||
|
X: obj.x,
|
||||||
|
Y: obj.y,
|
||||||
|
Z: obj.z,
|
||||||
|
Unk0: 0,
|
||||||
|
OwnerCharID: obj.ownerCharID,
|
||||||
|
}).Build(clientDupObjNotif)
|
||||||
|
}
|
||||||
|
s.stage.RUnlock()
|
||||||
|
clientDupObjNotif.WriteUint16(0x0010) // End it.
|
||||||
|
s.QueueSend(clientDupObjNotif.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgSysBackStage(s *Session, p mhfpacket.MHFPacket) {}
|
func handleMsgSysBackStage(s *Session, p mhfpacket.MHFPacket) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user