diff --git a/config.json b/config.json index 6543a0617..9d8f99dd5 100644 --- a/config.json +++ b/config.json @@ -19,7 +19,7 @@ "MezFesAlt": false, "DisableMailItems": true, "DisableTokenCheck": false, - "PrintQuestCoordinates": false, + "QuestDebugTools": false, "SaveDumps": { "Enabled": true, "OutputDir": "savedata" diff --git a/config/config.go b/config/config.go index 0d6ac7063..6b8bb743f 100644 --- a/config/config.go +++ b/config/config.go @@ -29,23 +29,23 @@ type Config struct { // DevModeOptions holds various debug/temporary options for use while developing Erupe. type DevModeOptions struct { - EnableLauncherServer bool // Enables the launcher server to be served on port 80 - HideLoginNotice bool // Hide the Erupe notice on login - LoginNotice string // MHFML string of the login notice displayed - CleanDB bool // Automatically wipes the DB on server reset. - MaxLauncherHR bool // Sets the HR returned in the launcher to HR7 so that you can join non-beginner worlds. - LogInboundMessages bool // Log all messages sent to the server - LogOutboundMessages bool // Log all messages sent to the clients - MaxHexdumpLength int // Maximum number of bytes printed when logs are enabled - DivaEvent int // Diva Defense event status - FestaEvent int // Hunter's Festa event status - TournamentEvent int // VS Tournament event status - MezFesEvent bool // MezFes status - MezFesAlt bool // Swaps out Volpakkun for Tokotoko - DisableTokenCheck bool // Disables checking login token exists in the DB (security risk!) - DisableMailItems bool // Hack to prevent english versions of MHF from crashing - PrintQuestCoordinates bool // Prints quest coordinates to console - SaveDumps SaveDumpOptions + EnableLauncherServer bool // Enables the launcher server to be served on port 80 + HideLoginNotice bool // Hide the Erupe notice on login + LoginNotice string // MHFML string of the login notice displayed + CleanDB bool // Automatically wipes the DB on server reset. + MaxLauncherHR bool // Sets the HR returned in the launcher to HR7 so that you can join non-beginner worlds. + LogInboundMessages bool // Log all messages sent to the server + LogOutboundMessages bool // Log all messages sent to the clients + MaxHexdumpLength int // Maximum number of bytes printed when logs are enabled + DivaEvent int // Diva Defense event status + FestaEvent int // Hunter's Festa event status + TournamentEvent int // VS Tournament event status + MezFesEvent bool // MezFes status + MezFesAlt bool // Swaps out Volpakkun for Tokotoko + DisableTokenCheck bool // Disables checking login token exists in the DB (security risk!) + DisableMailItems bool // Hack to prevent english versions of MHF from crashing + QuestDebugTools bool // Enable various quest debug logs + SaveDumps SaveDumpOptions } type SaveDumpOptions struct { diff --git a/server/channelserver/handlers_cast_binary.go b/server/channelserver/handlers_cast_binary.go index 867437344..fb0d0331f 100644 --- a/server/channelserver/handlers_cast_binary.go +++ b/server/channelserver/handlers_cast_binary.go @@ -90,8 +90,9 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { } } - if s.server.erupeConfig.DevModeOptions.PrintQuestCoordinates == true && s.server.erupeConfig.DevMode { + if s.server.erupeConfig.DevModeOptions.QuestDebugTools == true && s.server.erupeConfig.DevMode { if pkt.BroadcastType == 0x03 && pkt.MessageType == 0x02 && len(pkt.RawDataPayload) > 32 { + // This is only correct most of the time tmp.ReadBytes(20) tmp.SetLE() x := tmp.ReadFloat32() diff --git a/server/channelserver/handlers_quest.go b/server/channelserver/handlers_quest.go index 7ee552232..5d662b06c 100644 --- a/server/channelserver/handlers_quest.go +++ b/server/channelserver/handlers_quest.go @@ -2,6 +2,7 @@ package channelserver import ( "fmt" + "go.uber.org/zap" "io/ioutil" "os" "path/filepath" @@ -13,9 +14,16 @@ import ( func handleMsgSysGetFile(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysGetFile) - // Debug print the request. if pkt.IsScenario { - fmt.Printf("%+v\n", pkt.ScenarioIdentifer) + if s.server.erupeConfig.DevModeOptions.QuestDebugTools && s.server.erupeConfig.DevMode { + s.logger.Debug( + "Scenario", + zap.Uint8("CategoryID", pkt.ScenarioIdentifer.CategoryID), + zap.Uint32("MainID", pkt.ScenarioIdentifer.MainID), + zap.Uint8("ChapterID", pkt.ScenarioIdentifer.ChapterID), + zap.Uint8("Flags", pkt.ScenarioIdentifer.Flags), + ) + } filename := fmt.Sprintf("%d_0_0_0_S%d_T%d_C%d", pkt.ScenarioIdentifer.CategoryID, pkt.ScenarioIdentifer.MainID, pkt.ScenarioIdentifer.Flags, pkt.ScenarioIdentifer.ChapterID) // Read the scenario file. data, err := ioutil.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("scenarios/%s.bin", filename))) @@ -31,6 +39,12 @@ func handleMsgSysGetFile(s *Session, p mhfpacket.MHFPacket) { } doAckBufSucceed(s, pkt.AckHandle, data) } else { + if s.server.erupeConfig.DevModeOptions.QuestDebugTools && s.server.erupeConfig.DevMode { + s.logger.Debug( + "Quest", + zap.String("Filename", pkt.Filename), + ) + } // Get quest file. data, err := ioutil.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("quests/%s.bin", pkt.Filename))) if err != nil {