removed old method of displaying stats
This commit is contained in:
parent
98ade500f4
commit
3bbc26199b
1
app.py
1
app.py
@ -26,7 +26,6 @@ app.register_blueprint(get_monster_stats_bp)
|
||||
app.register_blueprint(serve_img_bp)
|
||||
|
||||
# Register Other Views Blurprints (HTML Render Templates)
|
||||
app.register_blueprint(monster_stats_bp)
|
||||
app.register_blueprint(breed_info_bp)
|
||||
app.register_blueprint(skills_bp)
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
from flask import Blueprint, render_template, abort, g
|
||||
|
||||
monster_stats_bp = Blueprint('view_monster_stats', __name__)
|
||||
|
||||
@monster_stats_bp.route("/monster/<monster_name>")
|
||||
def monster_stats(monster_name):
|
||||
cursor = g.db.cursor()
|
||||
|
||||
# Retrieve monster stats from the database based on name
|
||||
cursor.execute(
|
||||
"""
|
||||
SELECT
|
||||
monsters.id, monsters.name, families.name AS family, monsters.in_story,
|
||||
monsters.agl, monsters.int, monsters.maxlvl, monsters.atk, monsters.mp,
|
||||
monsters.exp, monsters.hp, monsters.def
|
||||
FROM
|
||||
monsters
|
||||
JOIN families ON monsters.family_id = families.id
|
||||
WHERE
|
||||
monsters.name = ?
|
||||
""",
|
||||
(monster_name,),
|
||||
)
|
||||
|
||||
monster_stats = cursor.fetchone()
|
||||
|
||||
if monster_stats is None:
|
||||
abort(404)
|
||||
|
||||
# Retrieve skills for the monster
|
||||
cursor.execute("SELECT skill FROM skills WHERE monster_id = ?", (monster_stats[0],))
|
||||
skills = [row[0] for row in cursor.fetchall()]
|
||||
|
||||
# Retrieve spawn locations for the monster
|
||||
cursor.execute(
|
||||
"SELECT map, description FROM spawn_locations WHERE monster_id = ?",
|
||||
(monster_stats[0],),
|
||||
)
|
||||
spawn_locations = [
|
||||
{"map": row[0], "description": row[1]} for row in cursor.fetchall()
|
||||
]
|
||||
|
||||
return render_template(
|
||||
"stats.html",
|
||||
monster={
|
||||
"id": monster_stats[0],
|
||||
"name": monster_stats[1],
|
||||
"family": monster_stats[2],
|
||||
"in_story": "Yes" if monster_stats[3] else "No",
|
||||
"agl": monster_stats[4],
|
||||
"int": monster_stats[5],
|
||||
"maxlvl": monster_stats[6],
|
||||
"atk": monster_stats[7],
|
||||
"mp": monster_stats[8],
|
||||
"exp": monster_stats[9],
|
||||
"hp": monster_stats[10],
|
||||
"def": monster_stats[11],
|
||||
"skills": skills,
|
||||
"spawn_locations": spawn_locations,
|
||||
},
|
||||
)
|
@ -1,16 +1,6 @@
|
||||
function updateIframes() {
|
||||
const selectedFamily = familyDropdown.value;
|
||||
const selectedMonster = monsterDropdown.value;
|
||||
|
||||
// Update monsterIframe src based on selected family and monster
|
||||
const monsterIframeSrc = selectedMonster
|
||||
? `/monster/${selectedMonster}`
|
||||
: selectedFamily
|
||||
? `/monster/${selectedFamily}`
|
||||
: "about:blank";
|
||||
|
||||
monsterIframe.src = monsterIframeSrc;
|
||||
|
||||
// Update breedingIframe src based on the selected monster
|
||||
const breedingIframeSrc = selectedMonster
|
||||
? `/breed?monster=${selectedMonster}`
|
||||
|
@ -20,14 +20,6 @@
|
||||
<br />
|
||||
|
||||
<div id="modules" class="flex mt-4">
|
||||
<iframe
|
||||
id="monsterIframe"
|
||||
src=""
|
||||
class="pl-2 pr-2 ml-4 border-2 rounded-md border-slate-400"
|
||||
height="456"
|
||||
width="280"
|
||||
>
|
||||
</iframe>
|
||||
|
||||
<div class="grid-cols-1 p-2 ml-2 border-2 rounded-md border-slate-400">
|
||||
<div id="monsterNameContainer" class="text-center">
|
||||
|
@ -1,39 +0,0 @@
|
||||
{% extends '.layout.html' %} {% block head %}{% endblock %} {% block body %}
|
||||
<div>
|
||||
<h2>{{ monster.name }}</h2>
|
||||
<p><strong>Family:</strong> {{ monster.family }}</p>
|
||||
<div class="Stats">
|
||||
<p><strong>Stats:</strong></p>
|
||||
<ul>
|
||||
<div class="grid grid-cols-2 gap-1">
|
||||
<li>
|
||||
<label class="font-bold">Max Level:</label> {{ monster.maxlvl }}
|
||||
</li>
|
||||
<li><label class="font-bold">EXP:</label> {{ monster.exp }}</li>
|
||||
<li><label class="font-bold">HP:</label> {{ monster.hp }}</li>
|
||||
<li><label class="font-bold">ATK:</label> {{ monster.atk }}</li>
|
||||
<li><label class="font-bold">MP:</label> {{ monster.mp }}</li>
|
||||
<li><label class="font-bold">DEF:</label> {{ monster.def }}</li>
|
||||
<li><label class="font-bold">AGL:</label> {{ monster.agl }}</li>
|
||||
<li><label class="font-bold">INT:</label> {{ monster.int }}</li>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p><strong>Skills:</strong></p>
|
||||
<ul>
|
||||
{% for skill in monster.skills %}
|
||||
<li>{{ skill }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="grid grid-cols-1 gap-1 mt-2">
|
||||
<p><strong>In Story:</strong> {{ monster.in_story }}</p>
|
||||
<p><strong>Spawn Locations:</strong></p>
|
||||
</div>
|
||||
<ul>
|
||||
{% for location in monster.spawn_locations %}
|
||||
<li>{{ location.map }} - {{ location.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user