add patch server option

This commit is contained in:
wish
2022-10-27 13:11:56 +11:00
parent 82eeb79229
commit e943b54df4
3 changed files with 16 additions and 2 deletions

View File

@@ -5,6 +5,8 @@
"FeaturedWeapons": 2, "FeaturedWeapons": 2,
"DevMode": true, "DevMode": true,
"DevModeOptions": { "DevModeOptions": {
"PatchServerManifest": "",
"PatchServerFile": "",
"AutoCreateAccount": true, "AutoCreateAccount": true,
"EnableLauncherServer": false, "EnableLauncherServer": false,
"HideLoginNotice": false, "HideLoginNotice": false,

View File

@@ -30,6 +30,8 @@ type Config struct {
// DevModeOptions holds various debug/temporary options for use while developing Erupe. // DevModeOptions holds various debug/temporary options for use while developing Erupe.
type DevModeOptions struct { type DevModeOptions struct {
PatchServerManifest string // Manifest patch server override
PatchServerFile string // File patch server override
AutoCreateAccount bool // Automatically create accounts if they don't exist AutoCreateAccount bool // Automatically create accounts if they don't exist
HideLoginNotice bool // Hide the Erupe notice on login HideLoginNotice bool // Hide the Erupe notice on login
LoginNotice string // MHFML string of the login notice displayed LoginNotice string // MHFML string of the login notice displayed

View File

@@ -42,13 +42,23 @@ func (s *Session) makeSignInResp(uid int) []byte {
bf := byteframe.NewByteFrame() bf := byteframe.NewByteFrame()
bf.WriteUint8(1) // resp_code bf.WriteUint8(1) // resp_code
bf.WriteUint8(0) // file/patch server count if s.server.erupeConfig.DevMode && s.server.erupeConfig.DevModeOptions.PatchServerManifest != "" && s.server.erupeConfig.DevModeOptions.PatchServerFile != "" {
bf.WriteUint8(2)
} else {
bf.WriteUint8(0)
}
bf.WriteUint8(1) // entrance server count bf.WriteUint8(1) // entrance server count
bf.WriteUint8(uint8(len(chars))) // character count bf.WriteUint8(uint8(len(chars))) // character count
bf.WriteUint32(0xFFFFFFFF) // login_token_number bf.WriteUint32(0xFFFFFFFF) // login_token_number
bf.WriteBytes([]byte(token)) // login_token bf.WriteBytes([]byte(token)) // login_token
bf.WriteUint32(uint32(time.Now().Unix())) // current time bf.WriteUint32(uint32(time.Now().Unix())) // current time
if s.server.erupeConfig.DevMode {
if s.server.erupeConfig.DevModeOptions.PatchServerManifest != "" && s.server.erupeConfig.DevModeOptions.PatchServerFile != "" {
ps.Uint8(bf, s.server.erupeConfig.DevModeOptions.PatchServerManifest, false)
ps.Uint8(bf, s.server.erupeConfig.DevModeOptions.PatchServerFile, false)
}
}
ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.Host, s.server.erupeConfig.Entrance.Port), false) ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.Host, s.server.erupeConfig.Entrance.Port), false)
lastPlayed := uint32(0) lastPlayed := uint32(0)