types.py
: Sped up LUT parsing with iteration
This commit is contained in:
parent
e126494496
commit
4a8c6d8fb4
@ -353,16 +353,12 @@ class FumenHeader(DefaultObject):
|
|||||||
key = f"{difficulty}-{star_to_key[difficulty][stars]}"
|
key = f"{difficulty}-{star_to_key[difficulty][stars]}"
|
||||||
pkg_dir = os.path.dirname(os.path.realpath(__file__))
|
pkg_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
with open(os.path.join(pkg_dir, "hp_values.csv"), newline='') as fp:
|
with open(os.path.join(pkg_dir, "hp_values.csv"), newline='') as fp:
|
||||||
# Parse row data
|
for num, line in enumerate(csv.DictReader(fp)):
|
||||||
rows = [row for row in csv.reader(fp, delimiter=',')]
|
if num+1 == n_notes:
|
||||||
# Get column numbers by indexing header row
|
self.b444_b447_hp_gain_good = int(line[f"good_{key}"])
|
||||||
column_good = rows[0].index(f"good_{key}")
|
self.b448_b451_hp_gain_ok = int(line[f"ok_{key}"])
|
||||||
column_ok = rows[0].index(f"ok_{key}")
|
self.b452_b455_hp_loss_bad = int(line[f"bad_{key}"])
|
||||||
column_bad = rows[0].index(f"bad_{key}")
|
break
|
||||||
# Fetch values from the row corresponding to the number of notes
|
|
||||||
self.b444_b447_hp_gain_good = int(rows[n_notes][column_good])
|
|
||||||
self.b448_b451_hp_gain_ok = int(rows[n_notes][column_ok])
|
|
||||||
self.b452_b455_hp_loss_bad = int(rows[n_notes][column_bad])
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def raw_bytes(self):
|
def raw_bytes(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user