mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
auto-unregister from host-less quests
This commit is contained in:
@@ -190,6 +190,18 @@ func logoutPlayer(s *Session) {
|
|||||||
s.server.Unlock()
|
s.server.Unlock()
|
||||||
|
|
||||||
for _, stage := range s.server.stages {
|
for _, stage := range s.server.stages {
|
||||||
|
// Tell sessions registered to disconnecting players quest to unregister
|
||||||
|
if stage.hostCharID == s.charID {
|
||||||
|
if s.stage.id == "sl1Ns200p0a0u0" {
|
||||||
|
for _, sess := range s.server.sessions {
|
||||||
|
for rSlot := range stage.reservedClientSlots {
|
||||||
|
if sess.charID == rSlot {
|
||||||
|
sess.QueueSendMHF(&mhfpacket.MsgSysStageDestruct{})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for session := range stage.clients {
|
for session := range stage.clients {
|
||||||
if session.charID == s.charID {
|
if session.charID == s.charID {
|
||||||
delete(stage.clients, session)
|
delete(stage.clients, session)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ func handleMsgSysCreateStage(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
doAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
doAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||||
} else {
|
} else {
|
||||||
stage := NewStage(pkt.StageID)
|
stage := NewStage(pkt.StageID)
|
||||||
|
stage.hostCharID = s.charID
|
||||||
stage.maxPlayers = uint16(pkt.PlayerCount)
|
stage.maxPlayers = uint16(pkt.PlayerCount)
|
||||||
s.server.stages[stage.id] = stage
|
s.server.stages[stage.id] = stage
|
||||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||||
@@ -42,6 +43,7 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
|
|||||||
stage = s.server.stages[stageID]
|
stage = s.server.stages[stageID]
|
||||||
s.server.Unlock()
|
s.server.Unlock()
|
||||||
stage.Lock()
|
stage.Lock()
|
||||||
|
stage.hostCharID = s.charID
|
||||||
stage.clients[s] = s.charID
|
stage.clients[s] = s.charID
|
||||||
stage.Unlock()
|
stage.Unlock()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ type Stage struct {
|
|||||||
// other clients expect the server to echo them back in the exact same format.
|
// other clients expect the server to echo them back in the exact same format.
|
||||||
rawBinaryData map[stageBinaryKey][]byte
|
rawBinaryData map[stageBinaryKey][]byte
|
||||||
|
|
||||||
|
hostCharID uint32
|
||||||
maxPlayers uint16
|
maxPlayers uint16
|
||||||
password string
|
password string
|
||||||
createdAt string
|
createdAt string
|
||||||
|
|||||||
Reference in New Issue
Block a user