Skip to content

Commit

Permalink
Fix Spell Timers Generation
Browse files Browse the repository at this point in the history
- Fix duplicate run bug on first run
- Much faster
  • Loading branch information
mgeitz committed Mar 17, 2024
1 parent 17bfbb4 commit 6ff7d19
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions eqa/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13930,10 +13930,12 @@ def update_spell_timers(data_path, eq_spells_file_path, version):
r"[^a-z\s]", "", spell_name.lower()
).replace(" ", "_")

## If spell is valid with a duration
if (
line_type_spell_name in valid_spells
and spell_buffdurationformula != "0"
):
### Write spell to timer file
spell_timer_json["spells"].update(
{
line_type_spell_name: {
Expand All @@ -13944,13 +13946,14 @@ def update_spell_timers(data_path, eq_spells_file_path, version):
}
)

spell_timer_json.update({"hash": spells_hash})
# Add spell timer version and file hash
spell_timer_json.update({"hash": spells_hash})
spell_timer_json.update({"version": version})

spell_timer_json.update({"version": version})

json_data = open(spell_timer_file, "w")
json.dump(spell_timer_json, json_data, sort_keys=True, indent=2)
json_data.close()
# Write spell timers
json_data = open(spell_timer_file, "w")
json.dump(spell_timer_json, json_data, sort_keys=True, indent=2)
json_data.close()
else:
print("Generating new spell-timers.json. This may take a minute . . .")
# Bootstrap new spell-timers.json
Expand All @@ -13971,7 +13974,11 @@ def update_spell_timers(data_path, eq_spells_file_path, version):
r"[^a-z\s]", "", spell_name.lower()
).replace(" ", "_")

if line_type_spell_name in valid_spells:
## If spell is valid with a duration
if (
line_type_spell_name in valid_spells
and spell_buffdurationformula != "0"
):
spell_timer_json["spells"].update(
{
line_type_spell_name: {
Expand All @@ -13982,9 +13989,14 @@ def update_spell_timers(data_path, eq_spells_file_path, version):
}
)

json_data = open(spell_timer_file, "w")
json.dump(spell_timer_json, json_data, sort_keys=True, indent=2)
json_data.close()
# Add spell timer version and file hash
spell_timer_json.update({"hash": spells_hash})
spell_timer_json.update({"version": version})

# Write spell timers
json_data = open(spell_timer_file, "w")
json.dump(spell_timer_json, json_data, sort_keys=True, indent=2)
json_data.close()

except Exception as e:
eqa_settings.log(
Expand Down Expand Up @@ -14495,7 +14507,7 @@ def build_config(base_path, version):
"speech": {
"expand_lingo": true,
"varied": true,
"local_ai": true,
"local_ai": false,
"gtts_tld": "com",
"lang": "en"
},
Expand Down

0 comments on commit 6ff7d19

Please sign in to comment.