7 895
edições
Sem resumo de edição |
Sem resumo de edição |
||
Linha 146: | Linha 146: | ||
<option value="NW">NW</option> | <option value="NW">NW</option> | ||
</select> | </select> | ||
</div> | |||
</div> | |||
<div class="input-group"> | <div class="input-group"> | ||
Linha 190: | Linha 183: | ||
const hunts = { | const hunts = { | ||
"NW": [ | "NW": [ | ||
{ name: "Grimer", difficulty: "Baixa", local: "Cinnabar", classes: ["Orebound", "Psycraft"], imageUrl: "https://wiki.pokexgames.com/images/e/ee/Banner_Hunts_-_NW_Grimer.png", hasType: true, huntTypes: ["Poison"], | { name: "Grimer", difficulty: "Baixa", local: "Cinnabar", classes: ["Orebound", "Psycraft"], imageUrl: "https://wiki.pokexgames.com/images/e/ee/Banner_Hunts_-_NW_Grimer.png", hasType: true, huntTypes: ["Poison"], link: "https://wiki.pokexgames.com/index.php/Cosmic_Quest_-_Boss_Solrock" }, | ||
{ name: "Petilil", difficulty: "ssss", local: "Fuchsia", classes: ["Volcanic", "Naturia", "Malefic", "Seavell", "Wingeon"], imageUrl: "https://wiki.pokexgames.com/images/7/70/Nightmare_Hunt_Petilil.png", hasType: true, huntTypes: ["Grass"] | { name: "Petilil", difficulty: "ssss", local: "Fuchsia", classes: ["Volcanic", "Naturia", "Malefic", "Seavell", "Wingeon"], imageUrl: "https://wiki.pokexgames.com/images/7/70/Nightmare_Hunt_Petilil.png", hasType: true, huntTypes: ["Grass"], link: "https://exemplo.com/hunt2" } | ||
], | ], | ||
}; | }; | ||
Linha 232: | Linha 225: | ||
document.addEventListener("DOMContentLoaded", function () { | document.addEventListener("DOMContentLoaded", function () { | ||
const mapTypeSelect = document.getElementById("mapType | const mapTypeSelect = document.getElementById("mapType"); | ||
const difficultySelect = document.getElementById("difficulty"); | const difficultySelect = document.getElementById("difficulty"); | ||
const tagButtonsContainer = document.getElementById("tagButtons"); | const tagButtonsContainer = document.getElementById("tagButtons"); | ||
Linha 288: | Linha 280: | ||
filterHunts(); | filterHunts(); | ||
}); | }); | ||
mapTypeSelect.addEventListener("change", function () { | |||
const selectedMap = mapTypeSelect.value; | const selectedMap = mapTypeSelect.value; | ||
const huntList = hunts[selectedMap]; | const huntList = hunts[selectedMap]; | ||
difficultySelect.innerHTML = '<option value="">Selecione uma Dificuldade</option>'; | difficultySelect.innerHTML = '<option value="">Selecione uma Dificuldade</option>'; | ||
if (huntList | if (huntList) { | ||
const difficulties = new Set(); | const difficulties = new Set(); | ||
huntList.forEach(hunt => { | huntList.forEach(hunt => { | ||
if (hunt. | if (hunt.mapType === selectedMap && hunt.difficulty) { | ||
difficulties.add(hunt.difficulty); // Pega "Baixa", "Média", etc. | difficulties.add(hunt.difficulty); // Pega "Baixa", "Média", etc. | ||
} | } | ||
Linha 342: | Linha 308: | ||
// Filtra as hunts com base nos critérios selecionados | // Filtra as hunts com base nos critérios selecionados | ||
function filterHunts() { | function filterHunts() { | ||
const selectedMap = mapTypeSelect | const selectedMap = mapTypeSelect.value; | ||
const selectedDifficulty = difficultySelect.value; | const selectedDifficulty = difficultySelect.value; | ||
imageContainer.innerHTML = ""; | imageContainer.innerHTML = ""; | ||
Linha 352: | Linha 317: | ||
huntList.forEach(hunt => { | huntList.forEach(hunt => { | ||
const matchesTags = selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag)); | const matchesTags = selectedTags.length === 0 || selectedTags.some(tag => hunt.classes.includes(tag)); | ||
const matchesTypes = selectedTypes.length === 0 || selectedTypes.some(type => hunt.huntTypes.includes(type)) | const matchesTypes = selectedTypes.length === 0 || selectedTypes.some(type => hunt.huntTypes.includes(type)); | ||
const matchesDifficulty = !selectedDifficulty || hunt.difficulty === selectedDifficulty; | const matchesDifficulty = !selectedDifficulty || hunt.difficulty === selectedDifficulty; | ||
Linha 388: | Linha 352: | ||
filterHunts(); | filterHunts(); | ||
}); | }); | ||
difficultySelect.addEventListener("change", filterHunts); | difficultySelect.addEventListener("change", filterHunts); | ||