add missing castbinary messagetype

This commit is contained in:
wish
2022-08-08 22:17:44 +10:00
parent 483490bbd5
commit 032ee1eac7

View File

@@ -16,6 +16,7 @@ import (
const ( const (
BinaryMessageTypeState = 0 BinaryMessageTypeState = 0
BinaryMessageTypeChat = 1 BinaryMessageTypeChat = 1
BinaryMessageTypeData = 3
BinaryMessageTypeMailNotify = 4 BinaryMessageTypeMailNotify = 4
BinaryMessageTypeEmote = 6 BinaryMessageTypeEmote = 6
) )
@@ -164,6 +165,17 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
fmt.Printf("Got chat message: %+v\n", chatMessage) fmt.Printf("Got chat message: %+v\n", chatMessage)
if strings.HasPrefix(chatMessage.Message, "!test ") {
var x uint32
n, err := fmt.Sscanf(chatMessage.Message, "!test %d", &x)
if err != nil || n != 1 {
sendServerChatMessage(s, "Invalid command. Usage:\"!test X\"")
} else {
s.test = x
sendServerChatMessage(s, fmt.Sprintf("Set value to %d", x))
}
}
// Set account rights // Set account rights
if strings.HasPrefix(chatMessage.Message, "!rights") { if strings.HasPrefix(chatMessage.Message, "!rights") {
var v uint32 var v uint32