mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-23 20:35:04 +01:00
user binary improvements
This commit is contained in:
@@ -171,6 +171,10 @@ func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysInsertUser {
|
||||
CharID: s.charID,
|
||||
}, s)
|
||||
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,14 @@ func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) {
|
||||
Z: pkt.Z,
|
||||
OwnerCharID: s.charID,
|
||||
}
|
||||
|
||||
for i := 1; i <= 3; i++ {
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: s.charID,
|
||||
BinaryType: uint8(i),
|
||||
}, s)
|
||||
}
|
||||
|
||||
s.logger.Info("Duplicate a new characters to others clients")
|
||||
s.stage.BroadcastMHF(dupObjUpdate, s)
|
||||
}
|
||||
|
||||
@@ -66,69 +66,40 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
|
||||
doAckSimpleSucceed(s, ackHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
|
||||
// Notify existing stage clients that this new client has entered.
|
||||
s.logger.Info("Sending MsgSysInsertUser")
|
||||
if s.stage != nil { // avoids lock up when using bed for dream quests
|
||||
// Add character to everyone elses stage
|
||||
s.stage.BroadcastMHF(&mhfpacket.MsgSysInsertUser {
|
||||
CharID: s.charID,
|
||||
}, s)
|
||||
|
||||
// Update others binary of your session
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary {
|
||||
CharID: s.charID,
|
||||
BinaryType: 1,
|
||||
}, s)
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary {
|
||||
CharID: s.charID,
|
||||
BinaryType: 2,
|
||||
}, s)
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary {
|
||||
CharID: s.charID,
|
||||
BinaryType: 3,
|
||||
}, s)
|
||||
var pkt mhfpacket.MHFPacket
|
||||
|
||||
// Notify the entree client about all of the existing clients in the stage.
|
||||
s.logger.Info("Notifying entree about existing stage clients")
|
||||
s.stage.RLock()
|
||||
|
||||
clientNotif := byteframe.NewByteFrame()
|
||||
s.server.Lock()
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysDeleteUser{
|
||||
CharID: s.charID,
|
||||
}, s)
|
||||
s.server.BroadcastMHF(&mhfpacket.MsgSysInsertUser {
|
||||
CharID: s.charID,
|
||||
}, s)
|
||||
|
||||
// Get other players in the stage
|
||||
for session := range s.stage.clients {
|
||||
var cur mhfpacket.MHFPacket
|
||||
cur = &mhfpacket.MsgSysInsertUser{
|
||||
CharID: session.charID,
|
||||
}
|
||||
clientNotif.WriteUint16(uint16(cur.Opcode()))
|
||||
cur.Build(clientNotif, session.clientContext)
|
||||
}
|
||||
|
||||
// Get every players binary
|
||||
for session := range s.server.sessions {
|
||||
var cur mhfpacket.MHFPacket
|
||||
session := s.server.sessions[session]
|
||||
|
||||
cur = &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: session.charID,
|
||||
BinaryType: 1,
|
||||
// Send existing players back to the client
|
||||
pkt = &mhfpacket.MsgSysInsertUser{
|
||||
CharID: session.charID,
|
||||
}
|
||||
clientNotif.WriteUint16(uint16(cur.Opcode()))
|
||||
cur.Build(clientNotif, session.clientContext)
|
||||
|
||||
cur = &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: session.charID,
|
||||
BinaryType: 2,
|
||||
clientNotif.WriteUint16(uint16(pkt.Opcode()))
|
||||
pkt.Build(clientNotif, session.clientContext)
|
||||
for i := 1; i <= 3; i++ {
|
||||
pkt = &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: session.charID,
|
||||
BinaryType: uint8(i),
|
||||
}
|
||||
clientNotif.WriteUint16(uint16(pkt.Opcode()))
|
||||
pkt.Build(clientNotif, session.clientContext)
|
||||
}
|
||||
clientNotif.WriteUint16(uint16(cur.Opcode()))
|
||||
cur.Build(clientNotif, session.clientContext)
|
||||
|
||||
cur = &mhfpacket.MsgSysNotifyUserBinary{
|
||||
CharID: session.charID,
|
||||
BinaryType: 3,
|
||||
}
|
||||
clientNotif.WriteUint16(uint16(cur.Opcode()))
|
||||
cur.Build(clientNotif, session.clientContext)
|
||||
}
|
||||
s.stage.RUnlock()
|
||||
s.server.Unlock()
|
||||
clientNotif.WriteUint16(0x0010) // End it.
|
||||
s.QueueSend(clientNotif.Data())
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
BinaryType: pkt.BinaryType,
|
||||
}
|
||||
|
||||
s.stage.BroadcastMHF(msg, s)
|
||||
s.server.BroadcastMHF(msg, s)
|
||||
}
|
||||
|
||||
func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
Reference in New Issue
Block a user