From 3bbc26199bcf1d1e40d10b35cf6146303966fbfc Mon Sep 17 00:00:00 2001 From: 0ceanSlim Date: Wed, 21 Feb 2024 11:05:10 -0500 Subject: [PATCH] removed old method of displaying stats --- app.py | 1 - src/views/monster_stats.py | 61 -------------------------------------- static/js/updateIFrames.js | 10 ------- templates/app.html | 8 ----- templates/stats.html | 39 ------------------------ 5 files changed, 119 deletions(-) delete mode 100644 src/views/monster_stats.py delete mode 100644 templates/stats.html diff --git a/app.py b/app.py index cd81915..f6c06b1 100644 --- a/app.py +++ b/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) diff --git a/src/views/monster_stats.py b/src/views/monster_stats.py deleted file mode 100644 index 660b0c2..0000000 --- a/src/views/monster_stats.py +++ /dev/null @@ -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/") -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, - }, - ) diff --git a/static/js/updateIFrames.js b/static/js/updateIFrames.js index e5533d0..1e5b810 100644 --- a/static/js/updateIFrames.js +++ b/static/js/updateIFrames.js @@ -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}` diff --git a/templates/app.html b/templates/app.html index dfb25d3..ba2650a 100644 --- a/templates/app.html +++ b/templates/app.html @@ -20,14 +20,6 @@
-
diff --git a/templates/stats.html b/templates/stats.html deleted file mode 100644 index 03adbc1..0000000 --- a/templates/stats.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends '.layout.html' %} {% block head %}{% endblock %} {% block body %} -
-

{{ monster.name }}

-

Family: {{ monster.family }}

-
-

Stats:

-
    -
    -
  • - {{ monster.maxlvl }} -
  • -
  • {{ monster.exp }}
  • -
  • {{ monster.hp }}
  • -
  • {{ monster.atk }}
  • -
  • {{ monster.mp }}
  • -
  • {{ monster.def }}
  • -
  • {{ monster.agl }}
  • -
  • {{ monster.int }}
  • -
    -
-
- -

Skills:

-
    - {% for skill in monster.skills %} -
  • {{ skill }}
  • - {% endfor %} -
-
-

In Story: {{ monster.in_story }}

-

Spawn Locations:

-
-
    - {% for location in monster.spawn_locations %} -
  • {{ location.map }} - {{ location.description }}
  • - {% endfor %} -
-
-{% endblock %}