diff --git a/src/api/get_monster_stats.py b/src/api/get_monster_stats.py index 959630e..9e6e32a 100644 --- a/src/api/get_monster_stats.py +++ b/src/api/get_monster_stats.py @@ -20,6 +20,7 @@ def get_monster_stats(): monsters.maxlvl AS max_level, monsters.exp AS experience, monsters.hp AS health_points, + monsters.mp AS mana_points, monsters.atk AS attack, monsters.def AS defense, families.name AS family, @@ -45,6 +46,7 @@ def get_monster_stats(): "max_level": "Max Level", "experience": "Experience", "health_points": "Health Points", + "mana_points": "Mana Points", "attack": "Attack", "defense": "Defense", "agility": "Agility", @@ -57,7 +59,7 @@ def get_monster_stats(): # Create a new dictionary with descriptive stat names formatted_stats = { "name": monster_stats[0], - **{stat_labels[key]: monster_stats[i + 1] for i, key in enumerate(["agility", "intelligence", "max_level", "experience", "health_points", "attack", "defense", "family", "location", "skills"])} + **{stat_labels[key]: monster_stats[i + 1] for i, key in enumerate(["agility", "intelligence", "max_level", "experience", "health_points", "mana_points", "attack", "defense", "family", "location", "skills"])} } return jsonify(formatted_stats) diff --git a/static/js/updateMonsterLocation.js b/static/js/updateMonsterLocation.js index 3d06dd4..06d871c 100644 --- a/static/js/updateMonsterLocation.js +++ b/static/js/updateMonsterLocation.js @@ -10,7 +10,7 @@ function updateMonsterLocation() { if (data.Location !== null) { // Update the HTML content with the monster location var locationContainer = document.getElementById("monsterLocationContainer"); - locationContainer.innerHTML = `

${data.Location}

`; + locationContainer.innerHTML = `

Known Locations:
${data.Location}

`; } else { // Handle the case when location is null (optional) var locationContainer = document.getElementById("monsterLocationContainer"); diff --git a/static/js/updateMonsterSkills.js b/static/js/updateMonsterSkills.js index f31fcc9..6e4fb1f 100644 --- a/static/js/updateMonsterSkills.js +++ b/static/js/updateMonsterSkills.js @@ -1,16 +1,20 @@ function updateMonsterSkills() { - // Get the selected monster from the dropdown - var selectedMonster = document.getElementById("monsterDropdown").value; + // Get the selected monster from the dropdown + var selectedMonster = document.getElementById("monsterDropdown").value; - // Make an API request to get the stats for the selected monster - fetch(`/api/monster/stats?monster=${selectedMonster}`) + // Make an API request to get the stats for the selected monster + fetch(`/api/monster/stats?monster=${selectedMonster}`) .then(response => response.json()) .then(data => { - // Update the HTML content with the monster skills - var skillsContainer = document.getElementById("monsterSkillsContainer"); - skillsContainer.innerHTML = `

Skills: ${data.Skills}

`; + // Split the skills string into an array and join with line breaks + var skillsArray = data.Skills.split(","); + var formattedSkills = skillsArray.join(",
"); + + // Update the HTML content with the monster skills + var skillsContainer = document.getElementById("monsterSkillsContainer"); + skillsContainer.innerHTML = `

Skills:
${formattedSkills}

`; }) .catch(error => { - console.error("Error fetching monster skills:", error); + console.error("Error fetching monster skills:", error); }); - } \ No newline at end of file +} diff --git a/static/js/updateMonsterStats.js b/static/js/updateMonsterStats.js index 50f96b1..1ad1d92 100644 --- a/static/js/updateMonsterStats.js +++ b/static/js/updateMonsterStats.js @@ -11,6 +11,7 @@ function updateMonsterStats() { statsContainer.innerHTML = `

Max Level: ${data["Max Level"]}

Experience: ${data.Experience}

Health Points: ${data["Health Points"]}

+

Mana Points: ${data["Mana Points"]}

Attack: ${data.Attack}

Defense: ${data.Defense}

Agility: ${data.Agility}