mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
make ips optional, update config
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
{
|
||||
"host_ip": "",
|
||||
"host_ip": "127.0.0.1",
|
||||
"bin_path": "bin",
|
||||
"devmode": true,
|
||||
"devmodeoptions": {
|
||||
"serverName" : "",
|
||||
"cleandb": false,
|
||||
"maxlauncherhr": true,
|
||||
"LogInboundMessages": false,
|
||||
"LogOutboundMessages": false,
|
||||
"Event": 0,
|
||||
"OpcodeMessages": false,
|
||||
"DivaEvent": 0,
|
||||
"FestaEvent": 0,
|
||||
"TournamentEvent": 0,
|
||||
"MezFesEvent": true,
|
||||
"SaveDumps": {
|
||||
"Enabled": true,
|
||||
"OutputDir": "savedata"
|
||||
@@ -40,66 +44,38 @@
|
||||
"port": 53310,
|
||||
"entries": [
|
||||
{
|
||||
"name": "ANewbie",
|
||||
"ip": "",
|
||||
"type": 3,
|
||||
"recommended": 1,
|
||||
"season": 3,
|
||||
"allowedclientflags": 4096,
|
||||
"channels": [
|
||||
{ "port": 54001, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "ANormal",
|
||||
"ip": "",
|
||||
"type": 1,
|
||||
"recommended": 0,
|
||||
"season": 3,
|
||||
"allowedclientflags": 0,
|
||||
"name": "Newbie", "description": "", "ip": "", "type": 3, "recommended": 2, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54001, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 },
|
||||
{ "port": 54002, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "ACities",
|
||||
"ip": "",
|
||||
"type": 2,
|
||||
"recommended": 1,
|
||||
"season": 3,
|
||||
"allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54003, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "ATavern",
|
||||
"ip": "",
|
||||
"type": 4,
|
||||
"recommended": 1,
|
||||
"season": 3,
|
||||
"allowedclientflags": 0,
|
||||
"name": "Normal", "description": "", "ip": "", "type": 1, "recommended": 0, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54003, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 },
|
||||
{ "port": 54004, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "AReturn",
|
||||
"ip": "",
|
||||
"type": 5,
|
||||
"recommended": 1,
|
||||
"season": 3,
|
||||
"allowedclientflags": 0,
|
||||
"name": "Cities", "description": "", "ip": "", "type": 2, "recommended": 0, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54005, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "AMezFes",
|
||||
"ip": "",
|
||||
"type": 6,
|
||||
"recommended": 1,
|
||||
"season": 3,
|
||||
"allowedclientflags": 0,
|
||||
"name": "Tavern", "description": "", "ip": "", "type": 4, "recommended": 0, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54006, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "Return", "description": "", "ip": "", "type": 5, "recommended": 0, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54007, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}, {
|
||||
"name": "MezFes", "description": "", "ip": "", "type": 6, "recommended": 6, "allowedclientflags": 0,
|
||||
"channels": [
|
||||
{ "port": 54008, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ func (s *Server) handleEntranceServerConnection(conn net.Conn) {
|
||||
|
||||
s.logger.Debug("Got entrance server command:\n", zap.String("raw", hex.Dump(pkt)))
|
||||
|
||||
data := makeSv2Resp(s.erupeConfig.Entrance.Entries, s)
|
||||
data := makeSv2Resp(s.erupeConfig, s)
|
||||
if len(pkt) > 5 {
|
||||
data = append(data, makeUsrResp(pkt, s)...)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ var season uint8
|
||||
// Server Channels
|
||||
var currentplayers uint16
|
||||
|
||||
func encodeServerInfo(serverInfos []config.EntranceServerInfo, s *Server) []byte {
|
||||
func encodeServerInfo(config *config.Config, s *Server) []byte {
|
||||
serverInfos := config.Entrance.Entries
|
||||
bf := byteframe.NewByteFrame()
|
||||
|
||||
for serverIdx, si := range serverInfos {
|
||||
@@ -26,6 +27,9 @@ func encodeServerInfo(serverInfos []config.EntranceServerInfo, s *Server) []byte
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if si.IP == "" {
|
||||
si.IP = config.HostIP
|
||||
}
|
||||
bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4()))
|
||||
bf.WriteUint16(16 + uint16(serverIdx))
|
||||
bf.WriteUint16(0x0000)
|
||||
@@ -81,10 +85,11 @@ func makeHeader(data []byte, respType string, entryCount uint16, key byte) []byt
|
||||
return bf.Data()
|
||||
}
|
||||
|
||||
func makeSv2Resp(servers []config.EntranceServerInfo, s *Server) []byte {
|
||||
rawServerData := encodeServerInfo(servers, s)
|
||||
func makeSv2Resp(config *config.Config, s *Server) []byte {
|
||||
serverInfos := config.Entrance.Entries
|
||||
rawServerData := encodeServerInfo(config, s)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteBytes(makeHeader(rawServerData, "SV2", uint16(len(servers)), 0x00))
|
||||
bf.WriteBytes(makeHeader(rawServerData, "SV2", uint16(len(serverInfos)), 0x00))
|
||||
return bf.Data()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user