mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 23:14:36 +01:00
Add dev proxy config
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"MezFesAlt": false,
|
||||
"DisableTokenCheck": false,
|
||||
"QuestDebugTools": false,
|
||||
"ProxyPort": 0,
|
||||
"EarthStatusOverride": 0,
|
||||
"EarthIDOverride": 0,
|
||||
"EarthMonsterOverride": 0,
|
||||
|
||||
@@ -110,6 +110,7 @@ type DevModeOptions struct {
|
||||
MezFesAlt bool // Swaps out Volpakkun for Tokotoko
|
||||
DisableTokenCheck bool // Disables checking login token exists in the DB (security risk!)
|
||||
QuestDebugTools bool // Enable various quest debug logs
|
||||
ProxyPort uint16 // Forces the game connect to a channel server proxy
|
||||
EarthStatusOverride int32
|
||||
EarthIDOverride int32
|
||||
EarthMonsterOverride int32
|
||||
|
||||
8
main.go
8
main.go
@@ -22,11 +22,13 @@ import (
|
||||
)
|
||||
|
||||
// Temporary DB auto clean on startup for quick development & testing.
|
||||
func cleanDB(db *sqlx.DB) {
|
||||
func cleanDB(db *sqlx.DB, config *_config.Config) {
|
||||
_ = db.MustExec("DELETE FROM guild_characters")
|
||||
_ = db.MustExec("DELETE FROM guilds")
|
||||
_ = db.MustExec("DELETE FROM characters")
|
||||
if !config.DevMode || config.DevModeOptions.ProxyPort == 0 {
|
||||
_ = db.MustExec("DELETE FROM sign_sessions")
|
||||
}
|
||||
_ = db.MustExec("DELETE FROM users")
|
||||
}
|
||||
|
||||
@@ -124,14 +126,16 @@ func main() {
|
||||
logger.Info("Database: Started successfully")
|
||||
|
||||
// Clear stale data
|
||||
if !config.DevMode || config.DevModeOptions.ProxyPort == 0 {
|
||||
_ = db.MustExec("DELETE FROM sign_sessions")
|
||||
}
|
||||
_ = db.MustExec("DELETE FROM servers")
|
||||
_ = db.MustExec(`UPDATE guild_characters SET treasure_hunt=NULL`)
|
||||
|
||||
// Clean the DB if the option is on.
|
||||
if config.DevMode && config.DevModeOptions.CleanDB {
|
||||
logger.Info("Database: Started clearing...")
|
||||
cleanDB(db)
|
||||
cleanDB(db, config)
|
||||
logger.Info("Database: Finished clearing")
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,11 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
|
||||
|
||||
for channelIdx, ci := range si.Channels {
|
||||
sid = (4096 + serverIdx*256) + (16 + channelIdx)
|
||||
if _config.ErupeConfig.DevMode && _config.ErupeConfig.DevModeOptions.ProxyPort != 0 {
|
||||
bf.WriteUint16(_config.ErupeConfig.DevModeOptions.ProxyPort)
|
||||
} else {
|
||||
bf.WriteUint16(ci.Port)
|
||||
}
|
||||
bf.WriteUint16(16 + uint16(channelIdx))
|
||||
bf.WriteUint16(ci.MaxPlayers)
|
||||
var currentPlayers uint16
|
||||
|
||||
Reference in New Issue
Block a user