add S6 Entrance compatibility

This commit is contained in:
wish
2023-07-21 20:18:14 +10:00
parent 2bcd3eb4f0
commit 123434c374

View File

@@ -3,12 +3,11 @@ package entranceserver
import ( import (
"encoding/binary" "encoding/binary"
"encoding/hex" "encoding/hex"
"erupe-ce/common/stringsupport"
_config "erupe-ce/config" _config "erupe-ce/config"
"fmt" "fmt"
"net" "net"
"erupe-ce/common/stringsupport"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/server/channelserver" "erupe-ce/server/channelserver"
) )
@@ -53,9 +52,15 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
bf.WriteUint16(uint16(len(si.Channels))) bf.WriteUint16(uint16(len(si.Channels)))
bf.WriteUint8(si.Type) bf.WriteUint8(si.Type)
bf.WriteUint8(season) bf.WriteUint8(season)
if s.erupeConfig.RealClientMode >= _config.G1 {
bf.WriteUint8(si.Recommended) bf.WriteUint8(si.Recommended)
}
if s.erupeConfig.RealClientMode <= _config.GG { if s.erupeConfig.RealClientMode <= _config.S6 {
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false))
} else if s.erupeConfig.RealClientMode <= _config.GG {
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...) combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...) combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
bf.WriteUint8(uint8(len(combined))) bf.WriteUint8(uint8(len(combined)))