removed old method of displaying stats

This commit is contained in:
0ceanSlim 2024-02-21 11:05:10 -05:00
parent 98ade500f4
commit 3bbc26199b
5 changed files with 0 additions and 119 deletions

1
app.py
View File

@ -26,7 +26,6 @@ app.register_blueprint(get_monster_stats_bp)
app.register_blueprint(serve_img_bp) app.register_blueprint(serve_img_bp)
# Register Other Views Blurprints (HTML Render Templates) # Register Other Views Blurprints (HTML Render Templates)
app.register_blueprint(monster_stats_bp)
app.register_blueprint(breed_info_bp) app.register_blueprint(breed_info_bp)
app.register_blueprint(skills_bp) app.register_blueprint(skills_bp)

View File

@ -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,
},
)

View File

@ -1,16 +1,6 @@
function updateIframes() { function updateIframes() {
const selectedFamily = familyDropdown.value;
const selectedMonster = monsterDropdown.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 // Update breedingIframe src based on the selected monster
const breedingIframeSrc = selectedMonster const breedingIframeSrc = selectedMonster
? `/breed?monster=${selectedMonster}` ? `/breed?monster=${selectedMonster}`

View File

@ -20,14 +20,6 @@
<br /> <br />
<div id="modules" class="flex mt-4"> <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 class="grid-cols-1 p-2 ml-2 border-2 rounded-md border-slate-400">
<div id="monsterNameContainer" class="text-center"> <div id="monsterNameContainer" class="text-center">

View File

@ -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 %}