fixing chapter progression after chapter 2 on SAO

This commit is contained in:
Midorica 2023-06-26 19:30:03 -04:00
parent 03f91d18c9
commit 5155353360
2 changed files with 19 additions and 5 deletions

View File

@ -720,13 +720,19 @@ class SaoBase:
if quest_clear_flag is True: if quest_clear_flag is True:
# Save stage progression - to be revised to avoid saving worse score # Save stage progression - to be revised to avoid saving worse score
# Reference Episode.csv but Chapter 3,4 and 5 reports id 0 # Reference Episode.csv but Chapter 2,3,4 and 5 reports id -1, match using /10 + last digits
if episode_id > 10000 and episode_id < 11000: if episode_id > 10000 and episode_id < 11000:
# Starts at 1001
episode_id = episode_id - 9000 episode_id = episode_id - 9000
elif episode_id > 20000 and episode_id < 21000: elif episode_id > 20000:
episode_id = episode_id - 19000 # Starts at 2001
elif episode_id > 30000 and episode_id < 31000: stage_id = str(episode_id)[-2:]
episode_id = episode_id - 29000 episode_id = episode_id / 10
episode_id = int(episode_id) + int(stage_id)
# Match episode_id with the questSceneId saved in the DB through sortNo
questId = self.game_data.static.get_quests_id(episode_id)
episode_id = questId[2]
self.game_data.item.put_player_quest(user_id, episode_id, quest_clear_flag, clear_time, combo_num, total_damage, concurrent_destroying_num) self.game_data.item.put_player_quest(user_id, episode_id, quest_clear_flag, clear_time, combo_num, total_damage, concurrent_destroying_num)

View File

@ -267,6 +267,14 @@ class SaoStaticData(BaseData):
return None return None
return result.lastrowid return result.lastrowid
def get_quests_id(self, sortNo: int) -> Optional[Dict]:
sql = quest.select(quest.c.sortNo == sortNo)
result = self.execute(sql)
if result is None:
return None
return result.fetchone()
def get_quests_ids(self, version: int, enabled: bool) -> Optional[List[Dict]]: def get_quests_ids(self, version: int, enabled: bool) -> Optional[List[Dict]]:
sql = quest.select(quest.c.version == version and quest.c.enabled == enabled).order_by( sql = quest.select(quest.c.version == version and quest.c.enabled == enabled).order_by(
quest.c.questSceneId.asc() quest.c.questSceneId.asc()