monsters listed in ascending order of potential

This commit is contained in:
Chris kerr 2024-02-05 20:34:36 -05:00
parent 1989920496
commit 3585f06acd

12
app.py
View File

@ -61,13 +61,21 @@ def json_monsters():
if selected_family: if selected_family:
cursor.execute( cursor.execute(
""" """
SELECT name FROM monsters SELECT name
FROM monsters
WHERE family_id = (SELECT id FROM families WHERE name = ?) WHERE family_id = (SELECT id FROM families WHERE name = ?)
ORDER BY (agl + int + atk + mp + exp + hp + def) * maxlvl ASC
""", """,
(selected_family,), (selected_family,),
) )
else: else:
cursor.execute("SELECT DISTINCT name FROM monsters") cursor.execute(
"""
SELECT name
FROM monsters
ORDER BY (agl + int + atk + mp + exp + hp + def) * maxlvl ASC
"""
)
monsters = [row[0] for row in cursor.fetchall()] monsters = [row[0] for row in cursor.fetchall()]
return jsonify(monsters) return jsonify(monsters)