Browse Source

- Work on the counte tracking in the plan when marking as caught

master
Quildra 1 year ago
parent
commit
7e7476abc8
  1. 38
      Site/templates/index.html

38
Site/templates/index.html

@ -550,7 +550,7 @@
<div class="catch-count-container"> <div class="catch-count-container">
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" <img src="{{ url_for('static', filename='images/pokeball_color.png') }}"
alt="Catch count" alt="Catch count"
class="catch-count-pokeball grayscale" class="catch-count-pokeball"
data-pfic="{{ pokemon.pfic }}"> data-pfic="{{ pokemon.pfic }}">
<span class="catch-count">{{ pokemon.catch_count }}</span> <span class="catch-count">{{ pokemon.catch_count }}</span>
</div> </div>
@ -565,7 +565,7 @@
<div class="pokemon-targets-grid"> <div class="pokemon-targets-grid">
{% if pokemon.evolve_to %} {% if pokemon.evolve_to %}
{% for evolution in pokemon.evolve_to %} {% for evolution in pokemon.evolve_to %}
<div class="target-card"> <div class="target-card" data-pfic="{{ evolution.pfic }}">
<div class="target-name"> <div class="target-name">
{{ evolution.name }} {{ evolution.name }}
{% if evolution.form_name %}({{ evolution.form_name }}){% endif %} {% if evolution.form_name %}({{ evolution.form_name }}){% endif %}
@ -581,7 +581,7 @@
{% if pokemon.breed_for %} {% if pokemon.breed_for %}
{% for breeding in pokemon.breed_for %} {% for breeding in pokemon.breed_for %}
<div class="target-card"> <div class="target-card" data-pfic="{{ breeding.pfic }}">
<div class="target-name"> <div class="target-name">
{{ breeding.name }} {{ breeding.name }}
{% if breeding.form_name %}({{ breeding.form_name }}){% endif %} {% if breeding.form_name %}({{ breeding.form_name }}){% endif %}
@ -742,9 +742,6 @@
count += isCaught ? -1 : 1; count += isCaught ? -1 : 1;
catchCount.textContent = count; catchCount.textContent = count;
const pokeball = entry.querySelector('.catch-count-pokeball');
pokeball.classList.toggle('grayscale', count === 0);
updateGameTotal(entry, isCaught); updateGameTotal(entry, isCaught);
} }
@ -872,15 +869,26 @@
.then(response => response.json()) .then(response => response.json())
.then(caught => { .then(caught => {
caught.forEach(pfic => { caught.forEach(pfic => {
const pokeball = document.querySelector(`.pokeball-icon[data-pfic="${pfic}"]`); // Update efficiency plan counts for caught Pokemon
if (pokeball) { const planTab = document.getElementById('efficiency-tab');
pokeball.classList.remove('grayscale'); planTab.querySelectorAll('.pokemon-entry').forEach(entry => {
} // Check if this Pokemon is part of any evolution/breeding group
const targetCards = entry.querySelectorAll('.target-card');
const planPokeball = document.querySelector(`.catch-count-pokeball[data-pfic="${pfic}"]`); targetCards.forEach(card => {
if (planPokeball) { if (card.dataset.pfic === pfic) {
planPokeball.classList.remove('grayscale'); // Found as an evolution/breeding target - update parent's catch count
} const catchCount = entry.querySelector('.catch-count');
let count = parseInt(catchCount.textContent);
if (count > 0) {
count -= 1;
catchCount.textContent = count;
}
// Update game total
updateGameTotal(entry, true);
}
});
});
}); });
}); });
}); });

Loading…
Cancel
Save