Skip to content

Commit

Permalink
code clean up and add emojis to evolution methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fakuzatsu committed Mar 14, 2024
1 parent a410564 commit ef0a96a
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 77 deletions.
30 changes: 23 additions & 7 deletions helpers/pokedexEvolution.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const { EmbedBuilder } = require("discord.js");
const {
getPokemonIdFromDisplayName,
getPokemonInfo,
generateMovesViaLearnset,
getEvolutionTree,
getPokemonDisplayName,
getEvolutionMethodDetail,
Expand Down Expand Up @@ -50,6 +47,25 @@ const wordToEmojiMap = {
"Level": "<:rarecandy:1157320353677328406> Level",
"Male": "<:male:1157322687320965221> Male",
"Female": "<:female:1157322686234640404> Female",
"Auspicious Armor": "<:auspiciousarmor:1215384209397522442> Auspicious Armor",
"Malicious Armor": "<:auspiciousarmor:1215384209397522442> Malicious Armor",
"Linking Cord": "<:linkingcord:1215384218180264007> Linking Cord",
"Galarica Cuff": "<:galaricacuff:1215384213705064499> Galarica Cuff",
"Galarica Twig": "<:galaricatwig:1215384215299035227> Galarica Twig",
"Gimmighoul Coin": "<:gimmighoulcoin:1215384216934555648> Gimmighoul Coin",
"Meltan Candy": "<:meltancandy:1215384455544311820> Meltan Candy",
"Syrupy Apple": "<:syrupyapple:1215384458429997137> Syrupy Apple",
"Sweet Apple": "<:sweetapple:1215384234760478780> Sweet Apple",
"Tart Apple": "<:tartapple:1215384238271238144> Tart Apple",
"Sachet": "<:sachet:1215384457029230642> Sachet",
"Whipped Dream": "<:whippeddream:1215384241513300088> Whipped Dream",
"Unremarkable Teacup": "<:unremarkableteacup:1215384460074160138> Unremarkable Teacup",
"Masterpiece Teacup": "<:masterpieceteacup:1215384221514997770> Masterpiece Teacup",
"Chipped Pot": "<:chippedpot:1215384210626445473> Chipped Pot",
"Cracked Pot": "<:crackedpot:1215384212044255303> Cracked Pot",
"Metal Alloy": "<:metalalloy:1215384224803328072> Metal Alloy",
"Scroll of Darkness": "<:scrollofdarkness:1215384229232386048> Scroll of Darkness",
"Scroll of Waters": "<:scrollofwaters:1215384233187475477> Scroll of Waters",
};

function evolutionMode(pokemonInfo, monsID, imageLnk) {
Expand Down Expand Up @@ -187,14 +203,14 @@ function evolutionMode(pokemonInfo, monsID, imageLnk) {
}
}

if (description.length === 0) {
return "Sorry! This Pokémon is not known to evolve from or into anything.\n...At least not that I know of!\n\nSee more in the [Pokédex](https://luminescent.team/pokedex/${monsID}).";
}

description.push(
`See more in the [Pokédex](https://luminescent.team/pokedex/${monsID}).`,
);

if (description.length === 0) {
return "Sorry! This Pokémon is not known to evolve from or into anything.\n\n...At least not that I know of!";
}

return description.join("\n");
}

Expand Down
109 changes: 54 additions & 55 deletions helpers/pokedexLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const {
getPokemonDisplayName,
getStaticLocations,
} = require("../dex/index.js");
const { botChannelProd, botChannelDev } = require("../config.json");

// Get colours for Types
// prettier-ignore
Expand Down Expand Up @@ -50,55 +49,55 @@ const reverseEncounterTypeMap = {

// prettier-ignore
const staticNameReplacements = {
"Starter": "**Starter**\nGiven to you by Professor Rowan.",
"Twinleaf Town": "**Twinleaf Town**\nGiven to you by Mom.",
"Lake Verity": "**Lake Verity**\nNone.",
"Verity Lakefront - Egg": "**Jubilife Trainer School**\nOne of the random Pokémon from the Breeder's egg.",
"Sandgem Town": "**Sandgem Town**\nObtained from Professor Rowan's Briefcase.",
"Jubilife City": "**Jubilife City**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Oreburgh City": "**Oreburgh City**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Mining Museum": "**Oreburgh City**\nRevived from a Fossil in the Mining Museum.",
"Ravaged Path": "**Ravaged Path**\nHidden in the Ravaged Path (requires Surf).",
"Floaroma Town": "**Floaroma Town**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Eterna City Galactic Building": "**Eterna City**\nFound in the Eterna Galactic Building after defeating Jupiter.",
"Old Chateau": "**Old Chateau**\nFound haunting an object in the Old Chateu.",
"Wayward Cave": "**Wayward Cave**\nFound in the deepest part of Wayward Cave.",
"Hearthome City - Egg": "**Eterna City**\nOne of the random Pokémon from Cynthia's egg.",
"Route 209": "**Route 209**\nPlace the Odd Keystone into the broken stone tower.",
"Solaceon Town": "**Solaceon Town**\nObtained in a trade with the Breeder for a Starter Pokémon.",
"Lost Tower": "**Lost Tower**\nProceed through Lost Tower and defeat the uncatchable Chandelure.",
"Celestic Town": "**Celestic Town**\nProceed to the shrine with a Pichu in your party to encounter a special Pichu.",
"Valor Cavern": "**Lake Valor**\nFound at Valor Cavern after the Distortion World events.",
"Acuity Cavern": "**Lake Acuity**\nFound at Acuity Cavern after the Distortion World events.",
"Spear Pillar": "**Spear Pillar**\nBring a special Orb to Spear Pillar after the events of the main story.",
"Pastoria City": "**Pastoria City**\nListen to the Old Lady's story in her house.",
"Grand Underground": "**Grand Underground**\nFound wandering in the Grand Underground.",
"Pokemon Mansion": "**Pokemon Mansion**\nHatched from the egg given to you by the Head of the Mansion.",
"Mt. Coronet - Articuno": "**Mt. Coronet**\nEncountered after the Distortion World events and speaking to Rowan.",
"Valley Windworks - Zapdos": "**Valley Windworks**\nEncountered after the Distortion World events and speaking to Rowan.",
"Victory Road - Moltres": "**Victory Road**\nEncountered after the Distortion World events and speaking to Rowan.",
"Oreburgh Gate - Mewtwo": "**Oreburgh Gate**\nUse the Odd Invitation from the Resort Area to access the cave in Oreburgh Gate.",
"Route 208 - Raikou": "**Route 208**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 211 - Entei": "**Route 211**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 213 - Suicune": "**Route 213**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 220 - Lugia": "**Route 220**\nSpeak to Oak in Eterna City with the Legendary Birds, then find Lugia.",
"Lost Tower - Ho-Oh": "**Lost Tower**\nSpeak to Oak in Eterna City with the Legendary Dogs, then find Ho-Oh.",
"Eterna Forest - Celebi": "**Eterna Forest**\nTake the GS Ball from the Celestic Shrine to the Eterna Shrine.",
"Snowpoint Temple - Regis": "Snowpoint Temple**\nTake a special item to Snowpoint Temple after the main story.",
"Fullmoon Island - Latis/Cresselia": "**Fullmoon Island**\nTake a special item to Fullmoon Island after speaking to the sleeping boy in Canalave.",
"Route 213 - Kyogre": "**Route 213**\nShow Latias and Latios to Steven, then take the Blue Orb to Route 213.",
"Stark Mountain - Groudon": "**Stark Mountain**\nShow Latias and Latios to Steven, then take the Red Orb to Stark Mountain.",
"Pokemon League - Rayquaza": "**Victory Road**\nShow Latias and Latios to Steven, then take the Jade Orb to Victory Road.",
"Solaceon Ruins - Jirachi": "**Solaceon Ruins**\nGrant three wishes across Sinnoh, then head to Solaceon Ruins with a Jigglypuff.",
"Veilstone City - Deoxys": "**Veilstone City**\nInteract with the meteorites in Veilstone after the main story.",
"Verity Cavern": "**Lake Verity**\nFound at Valor Cavern after the Distortion World events.",
"Stark Mountain - Heatran": "**Stark Mountain**\nSpeak with Buck after completing the Stark Mountain events, then return there.",
"Turnback Cave - Giratina": "**Turnback Cave**\nDefeat Giratina in the Distortion World, then find it again in Turnback Cave.",
"Newmoon Island - Darkrai": "**Newmoon Island**\nTake the Member Card from the dark house on Route 217 to Canalave after the Cresselia events.",
"Flower Paradise - Shaymin": "**Flower Paradise**\nGo to Route 224 with Oak's Letter and write your message on the stone tablet.",
"Hall of Origin - Arceus": "**Hall of Origin**\nDefeat all of the Type Master Trainers to earn their Plates, then take the Azure Flute to Spear Pillar.",
"Amity Square": "**Amity Square**\nEnter Amity Square and proceed through the event.",
"Route 201 - Mew": "**Route 201**\n[Find transformed Mew](https://luminescent.team/docs/special-events/legendaries#kanto-legendaries) in three locations across Sinnoh, then encounter at Route 201.",
"Starter": "\n**Starter**\nGiven to you by Professor Rowan.",
"Twinleaf Town": "\n**Twinleaf Town**\nGiven to you by Mom.",
"Lake Verity": "\n**Lake Verity**\nNone.",
"Verity Lakefront - Egg": "\n**Jubilife Trainer School**\nOne of the random Pokémon from the Breeder's egg.",
"Sandgem Town": "\n**Sandgem Town**\nObtained from Professor Rowan's Briefcase.",
"Jubilife City": "\n**Jubilife City**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Oreburgh City": "\n**Oreburgh City**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Mining Museum": "\n**Oreburgh City**\nRevived from a Fossil in the Mining Museum.",
"Ravaged Path": "\n**Ravaged Path**\nHidden in the Ravaged Path (requires Surf).",
"Floaroma Town": "\n**Floaroma Town**\nReward from the Interviewer in the Pokémon Center for answering her questions.",
"Eterna City Galactic Building": "\n**Eterna City**\nFound in the Eterna Galactic Building after defeating Jupiter.",
"Old Chateau": "\n**Old Chateau**\nFound haunting an object in the Old Chateu.",
"Wayward Cave": "\n**Wayward Cave**\nFound in the deepest part of Wayward Cave.",
"Hearthome City - Egg": "\n**Eterna City**\nOne of the random Pokémon from Cynthia's egg.",
"Route 209": "\n**Route 209**\nPlace the Odd Keystone into the broken stone tower.",
"Solaceon Town": "\n**Solaceon Town**\nObtained in a trade with the Breeder for a Starter Pokémon.",
"Lost Tower": "\n**Lost Tower**\nProceed through Lost Tower and defeat the uncatchable Chandelure.",
"Celestic Town": "\n**Celestic Town**\nProceed to the shrine with a Pichu in your party to encounter a special Pichu.",
"Valor Cavern": "\n**Lake Valor**\nFound at Valor Cavern after the Distortion World events.",
"Acuity Cavern": "\n**Lake Acuity**\nFound at Acuity Cavern after the Distortion World events.",
"Spear Pillar": "\n**Spear Pillar**\nBring a special Orb to Spear Pillar after the events of the main story.",
"Pastoria City": "\n**Pastoria City**\nListen to the Old Lady's story in her house.",
"Grand Underground": "\n**Grand Underground**\nFound wandering in the Grand Underground.",
"Pokemon Mansion": "\n**Pokemon Mansion**\nHatched from the egg given to you by the Head of the Mansion.",
"Mt. Coronet - Articuno": "\n**Mt. Coronet**\nEncountered after the Distortion World events and speaking to Rowan.",
"Valley Windworks - Zapdos": "\n**Valley Windworks**\nEncountered after the Distortion World events and speaking to Rowan.",
"Victory Road - Moltres": "\n**Victory Road**\nEncountered after the Distortion World events and speaking to Rowan.",
"Oreburgh Gate - Mewtwo": "\n**Oreburgh Gate**\nUse the Odd Invitation from the Resort Area to access the cave in Oreburgh Gate.",
"Route 208 - Raikou": "\n**Route 208**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 211 - Entei": "\n**Route 211**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 213 - Suicune": "\n**Route 213**\nEncountered after the Distortion World events and speaking to Rowan.",
"Route 220 - Lugia": "\n**Route 220**\nSpeak to Oak in Eterna City with the Legendary Birds, then find Lugia.",
"Lost Tower - Ho-Oh": "\n**Lost Tower**\nSpeak to Oak in Eterna City with the Legendary Dogs, then find Ho-Oh.",
"Eterna Forest - Celebi": "\n**Eterna Forest**\nTake the GS Ball from the Celestic Shrine to the Eterna Shrine.",
"Snowpoint Temple - Regis": "\n**Snowpoint Temple**\nTake a special item to Snowpoint Temple after the main story.",
"Fullmoon Island - Latis/Cresselia": "\n**Fullmoon Island**\nTake a special item to Fullmoon Island after speaking to the sleeping boy in Canalave.",
"Route 213 - Kyogre": "\n**Route 213**\nShow Latias and Latios to Steven, then take the Blue Orb to Route 213.",
"Stark Mountain - Groudon": "\n**Stark Mountain**\nShow Latias and Latios to Steven, then take the Red Orb to Stark Mountain.",
"Pokemon League - Rayquaza": "\n**Victory Road**\nShow Latias and Latios to Steven, then take the Jade Orb to Victory Road.",
"Solaceon Ruins - Jirachi": "\n**Solaceon Ruins**\nGrant three wishes across Sinnoh, then head to Solaceon Ruins with a Jigglypuff.",
"Veilstone City - Deoxys": "\n**Veilstone City**\nInteract with the meteorites in Veilstone after the main story.",
"Verity Cavern": "\n**Lake Verity**\nFound at Valor Cavern after the Distortion World events.",
"Stark Mountain - Heatran": "\n**Stark Mountain**\nSpeak with Buck after completing the Stark Mountain events, then return there.",
"Turnback Cave - Giratina": "\n**Turnback Cave**\nDefeat Giratina in the Distortion World, then find it again in Turnback Cave.",
"Newmoon Island - Darkrai": "\n**Newmoon Island**\nTake the Member Card from the dark house on Route 217 to Canalave after the Cresselia events.",
"Flower Paradise - Shaymin": "\n**Flower Paradise**\nGo to Route 224 with Oak's Letter and write your message on the stone tablet.",
"Hall of Origin - Arceus": "\n**Hall of Origin**\nDefeat all of the Type Master Trainers to earn their Plates, then take the Azure Flute to Spear Pillar.",
"Amity Square": "\n**Amity Square**\nEnter Amity Square and proceed through the event.",
"Route 201 - Mew": "\n**Route 201**\n[Find transformed Mew](https://luminescent.team/docs/special-events/legendaries#kanto-legendaries) in three locations across Sinnoh, then encounter at Route 201.",
};

function locationMode(pokemonInfo, monsID, imageLnk) {
Expand All @@ -122,15 +121,15 @@ function locationMode(pokemonInfo, monsID, imageLnk) {

let text = "";
for (const [key, routes] of Object.entries(combinedRoutes)) {
text += `**${key}**\n`;
text += `\n**${key}**\n`;
routes.forEach((route) => {
const methodEmoji =
reverseEncounterTypeMap[route.method] || route.method;
text += `${methodEmoji} - ${route.chance}%\n`;
if (route.minLevel === route.maxLevel) {
text += `*Level:* ${route.minLevel}\n\n`;
text += `*Level:* ${route.minLevel}\n`;
} else {
text += `*Level:* ${route.minLevel} - ${route.maxLevel}\n\n`;
text += `*Level:* ${route.minLevel} - ${route.maxLevel}\n`;
}
});
}
Expand Down Expand Up @@ -183,7 +182,7 @@ function locationMode(pokemonInfo, monsID, imageLnk) {
) {
return `Sorry! I couldn't locate that Pokémon as I don't have enough data about it. It might not appear in the wild.`;
} else {
backupText = `**${backupName}** can be found:\n\n`;
backupText = `\n**${backupName}** can be found:\n`;
locations = locationsBackup;
staticEncounters = staticEncountersBackup;
}
Expand All @@ -193,7 +192,7 @@ function locationMode(pokemonInfo, monsID, imageLnk) {
}
const locationText = buildTextFromRoutes(locations);
const formattedStaticEncounters = formatStaticEncounters(staticEncounters);
return `**Encounter information:**\n\nStandard rates assume that incense/radar are not active. For further accuracy, visit [our docs](https://luminescent.team/docs).\n\n${backupText}${locationText}${formattedStaticEncounters} See more in the [Pokédex](https://luminescent.team/pokedex/${monsID}).`;
return `**Encounter information:**\n\nStandard rates assume that incense/radar are not active. For further accuracy, visit [our docs](https://luminescent.team/docs).\n${backupText}${locationText}${formattedStaticEncounters} See more in the [Pokédex](https://luminescent.team/pokedex/${monsID}).`;
}

const backupData = getBackupData(monsID);
Expand Down
2 changes: 1 addition & 1 deletion helpers/pokedexStatistics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { AttachmentBuilder, EmbedBuilder } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const { CanvasRenderService } = require("chartjs-node-canvas");

// Array for pokemon types to set colours.
Expand Down
23 changes: 9 additions & 14 deletions interactions/slash/gameinfo/pokedex.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ module.exports = {
pokemonInfo = getPokemonInfo(monsID);
}

const imagePrefix = `https://luminescent.team`;
const imageLnk = `${imagePrefix}${pokemonInfo.imageSrc}`;

// Ignore pokemon that are still eggs after error catching.
if (pokemonInfo.name === "Egg") {
const embed = new EmbedBuilder()
Expand All @@ -93,6 +90,12 @@ module.exports = {
return interaction.reply({ embeds: [embed] });
}

const imageLnk = `https://luminescent.team${pokemonInfo.imageSrc}`;
const pokedexText = {
name: `BST: ${pokemonInfo.baseStatsTotal}`,
value: `See more in the [Pokédex](https://luminescent.team/pokedex/${monsID})`,
};

switch (mode) {
case "location":
embed = locationMode(pokemonInfo, monsID, imageLnk);
Expand All @@ -111,25 +114,17 @@ module.exports = {
name: "chart.png",
});
embed.setImage("attachment://chart.png");
embed.addFields({
name: `BST: ${pokemonInfo.baseStatsTotal}`,
value: `[See more in Pokédex](https://luminescent.team/pokedex/${monsID})`,
});
interaction.reply({ embeds: [embed], files: [attachment] });
return;
embed.addFields(pokedexText);
return interaction.reply({ embeds: [embed], files: [attachment] });
} else {
const textInfo = createTextVisualization(pokemonInfo);
embed.addFields({
name: "**Base Stats:**",
value: textInfo,
});
}
embed.addFields({
name: `BST: ${pokemonInfo.baseStatsTotal}`,
value: `See more in the [Pokédex](https://luminescent.team/pokedex/${monsID}).`,
});
embed.addFields(pokedexText);
}

interaction.reply({ embeds: [embed] });
},
};

0 comments on commit ef0a96a

Please sign in to comment.