mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 09:33:02 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user