mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 08:55:31 +01:00
Add dev options to config
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
"host_ip": "127.0.0.1",
|
"host_ip": "127.0.0.1",
|
||||||
"bin_path": "bin",
|
"bin_path": "bin",
|
||||||
|
|
||||||
|
"devmode": false,
|
||||||
|
"devmodeoptions": {
|
||||||
|
"cleandb": false,
|
||||||
|
"maxlauncherhr": true
|
||||||
|
},
|
||||||
|
|
||||||
"database": {
|
"database": {
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 5432,
|
"port": 5432,
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
HostIP string `mapstructure:"host_ip"`
|
HostIP string `mapstructure:"host_ip"`
|
||||||
BinPath string `mapstructure:"bin_path"`
|
BinPath string `mapstructure:"bin_path"`
|
||||||
|
DevMode bool
|
||||||
|
|
||||||
|
DevModeOptions DevModeOptions
|
||||||
Database Database
|
Database Database
|
||||||
Launcher Launcher
|
Launcher Launcher
|
||||||
Sign Sign
|
Sign Sign
|
||||||
@@ -19,6 +21,12 @@ type Config struct {
|
|||||||
Entrance Entrance
|
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.
|
// Database holds the postgres database config.
|
||||||
type Database struct {
|
type Database struct {
|
||||||
Host string
|
Host string
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -59,9 +59,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
logger.Info("Connected to database")
|
logger.Info("Connected to database")
|
||||||
|
|
||||||
|
// Clean the DB if the option is on.
|
||||||
|
if erupeConfig.DevMode && erupeConfig.DevModeOptions.CleanDB {
|
||||||
logger.Info("Cleaning DB")
|
logger.Info("Cleaning DB")
|
||||||
cleanDB(db)
|
cleanDB(db)
|
||||||
logger.Info("Done cleaning DB")
|
logger.Info("Done cleaning DB")
|
||||||
|
}
|
||||||
|
|
||||||
// Now start our server(s).
|
// Now start our server(s).
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,14 @@ func (s *Session) makeSignInResp(uid int) []byte {
|
|||||||
|
|
||||||
for _, char := range chars {
|
for _, char := range chars {
|
||||||
bf.WriteUint32(char.ID) // character ID 469153291
|
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
|
|
||||||
|
// 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.WriteUint16(char.Weapon) // Weapon, 0-13.
|
||||||
bf.WriteUint32(char.LastLogin) // Last login date, unix timestamp in seconds.
|
bf.WriteUint32(char.LastLogin) // Last login date, unix timestamp in seconds.
|
||||||
bf.WriteBool(char.IsFemale) // Sex, 0=male, 1=female.
|
bf.WriteBool(char.IsFemale) // Sex, 0=male, 1=female.
|
||||||
|
|||||||
Reference in New Issue
Block a user