diff --git a/config.json b/config.json index 28d079a77..280857944 100644 --- a/config.json +++ b/config.json @@ -2,6 +2,12 @@ "host_ip": "127.0.0.1", "bin_path": "bin", + "devmode": false, + "devmodeoptions": { + "cleandb": false, + "maxlauncherhr": true + }, + "database": { "host": "localhost", "port": 5432, diff --git a/config/config.go b/config/config.go index 816a332e1..30a420708 100644 --- a/config/config.go +++ b/config/config.go @@ -9,9 +9,11 @@ import ( // Config holds the global server-wide config. type Config struct { - HostIP string `mapstructure:"host_ip"` + HostIP string `mapstructure:"host_ip"` BinPath string `mapstructure:"bin_path"` + DevMode bool + DevModeOptions DevModeOptions Database Database Launcher Launcher Sign Sign @@ -19,6 +21,12 @@ type Config struct { Entrance Entrance } +// DevModeOptions holds various debug/temporary options for use while developing Erupe. +type DevModeOptions struct { + CleanDB bool // Automatically wipes the DB on server reset. + MaxLauncherHR bool // Sets the HR returned in the launcher to HR9 so that you can join non-beginner worlds. +} + // Database holds the postgres database config. type Database struct { Host string @@ -30,7 +38,7 @@ type Database struct { // Launcher holds the launcher server config. type Launcher struct { - Port int + Port int UseOriginalLauncherFiles bool } diff --git a/main.go b/main.go index 3869b6489..8c3318382 100644 --- a/main.go +++ b/main.go @@ -59,9 +59,12 @@ func main() { } logger.Info("Connected to database") - logger.Info("Cleaning DB") - cleanDB(db) - logger.Info("Done cleaning DB") + // Clean the DB if the option is on. + if erupeConfig.DevMode && erupeConfig.DevModeOptions.CleanDB { + logger.Info("Cleaning DB") + cleanDB(db) + logger.Info("Done cleaning DB") + } // Now start our server(s). diff --git a/server/signserver/dsgn_resp.go b/server/signserver/dsgn_resp.go index c05737ab5..28816825f 100644 --- a/server/signserver/dsgn_resp.go +++ b/server/signserver/dsgn_resp.go @@ -54,8 +54,15 @@ func (s *Session) makeSignInResp(uid int) []byte { uint8PascalString(bf, "mhf-n.capcom.com.tw") for _, char := range chars { - bf.WriteUint32(char.ID) // character ID 469153291 - bf.WriteUint16(char.Exp) // Exp, HR[x] is split by 0, 1, 30, 50, 99, 299, 998, 999 + bf.WriteUint32(char.ID) // character ID 469153291 + + // Exp, HR[x] is split by 0, 1, 30, 50, 99, 299, 998, 999 + if s.server.erupeConfig.DevMode && s.server.erupeConfig.DevModeOptions.MaxLauncherHR { + bf.WriteUint16(999) + } else { + bf.WriteUint16(char.Exp) + } + bf.WriteUint16(char.Weapon) // Weapon, 0-13. bf.WriteUint32(char.LastLogin) // Last login date, unix timestamp in seconds. bf.WriteBool(char.IsFemale) // Sex, 0=male, 1=female.