mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
refactor loadQuestFile
This commit is contained in:
@@ -98,8 +98,8 @@ func handleMsgMhfSaveFavoriteQuest(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadQuestFile(s *Session, questFile string) []byte {
|
func loadQuestFile(s *Session, questId int) []byte {
|
||||||
file, err := os.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("quests/%s.bin", questFile)))
|
file, err := os.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("quests/%05dd0.bin", questId)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ func makeEventQuest(s *Session, rows *sql.Rows) ([]byte, error) {
|
|||||||
var maxPlayers, questType, mark uint8
|
var maxPlayers, questType, mark uint8
|
||||||
rows.Scan(&id, &maxPlayers, &questType, &questId, &mark)
|
rows.Scan(&id, &maxPlayers, &questType, &questId, &mark)
|
||||||
|
|
||||||
data := loadQuestFile(s, fmt.Sprintf("%05dd0", questId))
|
data := loadQuestFile(s, questId)
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return nil, fmt.Errorf("failed to load quest file")
|
return nil, fmt.Errorf("failed to load quest file")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user