mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 08:55:31 +01:00
Fix MsgSysCreateObject stage lookup
This commit is contained in:
@@ -10,7 +10,7 @@ type MsgSysEnumerateStage struct {
|
|||||||
AckHandle uint32
|
AckHandle uint32
|
||||||
Unk0 uint8 // Hardcoded 1 in the binary
|
Unk0 uint8 // Hardcoded 1 in the binary
|
||||||
StageIDLength uint8
|
StageIDLength uint8
|
||||||
StageID string
|
StageID string // NULL terminated string.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opcode returns the ID associated with this packet type.
|
// Opcode returns the ID associated with this packet type.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Andoryuuta/Erupe/network/mhfpacket"
|
"github.com/Andoryuuta/Erupe/network/mhfpacket"
|
||||||
@@ -89,6 +90,11 @@ func fixedSizeShiftJIS(text string, size int) []byte {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Andoryuuta): Fix/move/remove me!
|
||||||
|
func stripNullTerminator(x string) string {
|
||||||
|
return strings.SplitN(x, "\x00", 2)[0]
|
||||||
|
}
|
||||||
|
|
||||||
func handleMsgHead(s *Session, p mhfpacket.MHFPacket) {}
|
func handleMsgHead(s *Session, p mhfpacket.MHFPacket) {}
|
||||||
|
|
||||||
func handleMsgSysReserve01(s *Session, p mhfpacket.MHFPacket) {}
|
func handleMsgSysReserve01(s *Session, p mhfpacket.MHFPacket) {}
|
||||||
@@ -344,7 +350,7 @@ func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
// Get the current stage.
|
// Get the current stage.
|
||||||
s.server.stagesLock.RLock()
|
s.server.stagesLock.RLock()
|
||||||
defer s.server.stagesLock.RUnlock()
|
defer s.server.stagesLock.RUnlock()
|
||||||
stage, ok := s.server.stages[s.stageID]
|
stage, ok := s.server.stages[stripNullTerminator(s.stageID)]
|
||||||
if !ok {
|
if !ok {
|
||||||
s.logger.Fatal("StageID not in the stages map!", zap.String("stageID", s.stageID))
|
s.logger.Fatal("StageID not in the stages map!", zap.String("stageID", s.stageID))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user