mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 17:43:21 +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",
|
"bin_path": "bin",
|
||||||
"devmode": true,
|
"devmode": true,
|
||||||
"devmodeoptions": {
|
"devmodeoptions": {
|
||||||
"serverName" : "",
|
"serverName" : "",
|
||||||
"cleandb": false,
|
"cleandb": false,
|
||||||
"maxlauncherhr": true,
|
"maxlauncherhr": true,
|
||||||
|
"LogInboundMessages": false,
|
||||||
"LogOutboundMessages": false,
|
"LogOutboundMessages": false,
|
||||||
"Event": 0,
|
"Event": 0,
|
||||||
"OpcodeMessages": false,
|
"DivaEvent": 0,
|
||||||
|
"FestaEvent": 0,
|
||||||
|
"TournamentEvent": 0,
|
||||||
|
"MezFesEvent": true,
|
||||||
"SaveDumps": {
|
"SaveDumps": {
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"OutputDir": "savedata"
|
"OutputDir": "savedata"
|
||||||
@@ -40,66 +44,38 @@
|
|||||||
"port": 53310,
|
"port": 53310,
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"name": "ANewbie",
|
"name": "Newbie", "description": "", "ip": "", "type": 3, "recommended": 2, "allowedclientflags": 0,
|
||||||
"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,
|
|
||||||
"channels": [
|
"channels": [
|
||||||
|
{ "port": 54001, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 },
|
||||||
{ "port": 54002, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
{ "port": 54002, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
"name": "ACities",
|
"name": "Normal", "description": "", "ip": "", "type": 1, "recommended": 0, "allowedclientflags": 0,
|
||||||
"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,
|
|
||||||
"channels": [
|
"channels": [
|
||||||
|
{ "port": 54003, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 },
|
||||||
{ "port": 54004, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
{ "port": 54004, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
"name": "AReturn",
|
"name": "Cities", "description": "", "ip": "", "type": 2, "recommended": 0, "allowedclientflags": 0,
|
||||||
"ip": "",
|
|
||||||
"type": 5,
|
|
||||||
"recommended": 1,
|
|
||||||
"season": 3,
|
|
||||||
"allowedclientflags": 0,
|
|
||||||
"channels": [
|
"channels": [
|
||||||
{ "port": 54005, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
{ "port": 54005, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
"name": "AMezFes",
|
"name": "Tavern", "description": "", "ip": "", "type": 4, "recommended": 0, "allowedclientflags": 0,
|
||||||
"ip": "",
|
|
||||||
"type": 6,
|
|
||||||
"recommended": 1,
|
|
||||||
"season": 3,
|
|
||||||
"allowedclientflags": 0,
|
|
||||||
"channels": [
|
"channels": [
|
||||||
{ "port": 54006, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }
|
{ "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)))
|
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 {
|
if len(pkt) > 5 {
|
||||||
data = append(data, makeUsrResp(pkt, s)...)
|
data = append(data, makeUsrResp(pkt, s)...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ var season uint8
|
|||||||
// Server Channels
|
// Server Channels
|
||||||
var currentplayers uint16
|
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()
|
bf := byteframe.NewByteFrame()
|
||||||
|
|
||||||
for serverIdx, si := range serverInfos {
|
for serverIdx, si := range serverInfos {
|
||||||
@@ -26,6 +27,9 @@ func encodeServerInfo(serverInfos []config.EntranceServerInfo, s *Server) []byte
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
if si.IP == "" {
|
||||||
|
si.IP = config.HostIP
|
||||||
|
}
|
||||||
bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4()))
|
bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4()))
|
||||||
bf.WriteUint16(16 + uint16(serverIdx))
|
bf.WriteUint16(16 + uint16(serverIdx))
|
||||||
bf.WriteUint16(0x0000)
|
bf.WriteUint16(0x0000)
|
||||||
@@ -81,10 +85,11 @@ func makeHeader(data []byte, respType string, entryCount uint16, key byte) []byt
|
|||||||
return bf.Data()
|
return bf.Data()
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeSv2Resp(servers []config.EntranceServerInfo, s *Server) []byte {
|
func makeSv2Resp(config *config.Config, s *Server) []byte {
|
||||||
rawServerData := encodeServerInfo(servers, s)
|
serverInfos := config.Entrance.Entries
|
||||||
|
rawServerData := encodeServerInfo(config, s)
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteBytes(makeHeader(rawServerData, "SV2", uint16(len(servers)), 0x00))
|
bf.WriteBytes(makeHeader(rawServerData, "SV2", uint16(len(serverInfos)), 0x00))
|
||||||
return bf.Data()
|
return bf.Data()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user