feat(quest): add .json fallback in loadQuestFile for event quest board

JSON-authored quests were serveable via MSG_SYS_GET_FILE but invisible
on the event quest board because loadQuestFile only read .bin files.
CompileQuestJSON already produces the uncompressed binary layout that
the event-board parser expects, so no decompression step is needed.

Also update rengoku priority tests to match the .bin-first convention
fixed in the previous commit.
This commit is contained in:
Houmgaor
2026-03-20 16:39:43 +01:00
parent c8ede52809
commit 73904965ff
2 changed files with 35 additions and 26 deletions

View File

@@ -251,12 +251,22 @@ func loadQuestFile(s *Session, questId int) []byte {
return cached
}
file, err := os.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("quests/%05dd0.bin", questId)))
if err != nil {
base := filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("quests/%05dd0", questId))
var decrypted []byte
if data, err := os.ReadFile(base + ".bin"); err == nil {
decrypted = decryption.UnpackSimple(data)
} else if jsonData, err := os.ReadFile(base + ".json"); err == nil {
compiled, err := CompileQuestJSON(jsonData)
if err != nil {
s.logger.Error("loadQuestFile: failed to compile quest JSON",
zap.Int("questId", questId), zap.Error(err))
return nil
}
decrypted = compiled
} else {
return nil
}
decrypted := decryption.UnpackSimple(file)
if s.server.erupeConfig.RealClientMode <= cfg.Z1 && s.server.erupeConfig.DebugOptions.AutoQuestBackport {
decrypted = BackportQuest(decrypted, s.server.erupeConfig.RealClientMode)
}