mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
stage improvements
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
package mhfpacket
|
package mhfpacket
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"erupe-ce/common/stringsupport"
|
||||||
|
|
||||||
"erupe-ce/network/clientctx"
|
|
||||||
"erupe-ce/network"
|
|
||||||
"erupe-ce/common/byteframe"
|
"erupe-ce/common/byteframe"
|
||||||
|
"erupe-ce/network"
|
||||||
|
"erupe-ce/network/clientctx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MsgSysEnumerateStage represents the MSG_SYS_ENUMERATE_STAGE
|
// MsgSysEnumerateStage represents the MSG_SYS_ENUMERATE_STAGE
|
||||||
type MsgSysEnumerateStage struct {
|
type MsgSysEnumerateStage struct {
|
||||||
AckHandle uint32
|
AckHandle uint32
|
||||||
Unk0 uint8 // Hardcoded 1 in the binary
|
Unk0 uint8 // Hardcoded 1 in the binary
|
||||||
StageIDLength uint8
|
StageID string // NULL terminated string.
|
||||||
StageID string // NULL terminated string.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opcode returns the ID associated with this packet type.
|
// Opcode returns the ID associated with this packet type.
|
||||||
@@ -25,8 +25,8 @@ func (m *MsgSysEnumerateStage) Opcode() network.PacketID {
|
|||||||
func (m *MsgSysEnumerateStage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
func (m *MsgSysEnumerateStage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||||
m.AckHandle = bf.ReadUint32()
|
m.AckHandle = bf.ReadUint32()
|
||||||
m.Unk0 = bf.ReadUint8()
|
m.Unk0 = bf.ReadUint8()
|
||||||
m.StageIDLength = bf.ReadUint8()
|
bf.ReadUint8()
|
||||||
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))
|
m.StageID = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package channelserver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"erupe-ce/common/byteframe"
|
"erupe-ce/common/byteframe"
|
||||||
@@ -198,22 +199,24 @@ func handleMsgSysLeaveStage(s *Session, p mhfpacket.MHFPacket) {}
|
|||||||
func handleMsgSysLockStage(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgSysLockStage(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgSysLockStage)
|
pkt := p.(*mhfpacket.MsgSysLockStage)
|
||||||
// TODO(Andoryuuta): What does this packet _actually_ do?
|
// TODO(Andoryuuta): What does this packet _actually_ do?
|
||||||
|
// I think this is supposed to mark a stage as no longer able to accept client reservations
|
||||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgSysUnlockStage(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgSysUnlockStage(s *Session, p mhfpacket.MHFPacket) {
|
||||||
s.reservationStage.RLock()
|
if s.reservationStage != nil {
|
||||||
defer s.reservationStage.RUnlock()
|
s.reservationStage.RLock()
|
||||||
|
defer s.reservationStage.RUnlock()
|
||||||
|
|
||||||
for charID := range s.reservationStage.reservedClientSlots {
|
for charID := range s.reservationStage.reservedClientSlots {
|
||||||
session := s.server.FindSessionByCharID(charID)
|
session := s.server.FindSessionByCharID(charID)
|
||||||
session.QueueSendMHF(&mhfpacket.MsgSysStageDestruct{})
|
session.QueueSendMHF(&mhfpacket.MsgSysStageDestruct{})
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(s.server.stages, s.reservationStage.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.server.Lock()
|
destructEmptyStages(s)
|
||||||
defer s.server.Unlock()
|
|
||||||
|
|
||||||
delete(s.server.stages, s.reservationStage.id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||||
@@ -366,8 +369,7 @@ func handleMsgSysEnumerateStage(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for valid stage type
|
if !strings.Contains(stage.id, pkt.StageID) {
|
||||||
if sid[3:5] != "Qs" && sid[3:5] != "Ms" && sid[3:5] != "Ls" {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user