Skip to content

Commit

Permalink
reworked location function further
Browse files Browse the repository at this point in the history
  • Loading branch information
fakuzatsu committed Mar 18, 2024
1 parent 63b658d commit b0e99be
Show file tree
Hide file tree
Showing 8 changed files with 4,113 additions and 2,637 deletions.
3,140 changes: 1,973 additions & 1,167 deletions __3.0gamedata/static_locations.json

Large diffs are not rendered by default.

3,140 changes: 1,973 additions & 1,167 deletions __gamedata/static_locations.json

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions dex/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,4 @@ function getRoutesFromPokemonId(pokemonId) {
return combineEncounterTypes(locationRates);
}

function getStaticLocations(pokemonName) {
const locations = [];

for (const staticEntry of staticLocations.statics) {
if (staticEntry.filterKey in STATIC_ENCOUNTERS) {
const pokemonList = STATIC_ENCOUNTERS[staticEntry.filterKey];
if (pokemonList.includes(pokemonName)) {
locations.push(staticEntry.location);
}
}
}

return locations;
}

module.exports = { getRoutesFromPokemonId, getStaticLocations };
module.exports = { getRoutesFromPokemonId };
128 changes: 128 additions & 0 deletions helpers/pokedexConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// prettier-ignore
const typeColors = {
Grass: "#09B051",
Fire: "#EE8130",
Water: "#6390F0",
Electric: "#F7D02C",
Ice: "#96D9D6",
Fighting: "#C22E28",
Poison: "#A33EA1",
Ground: "#E2BF65",
Flying: "#A98FF3",
Psychic: "#F95587",
Bug: "#A6B91A",
Rock: "#B6A136",
Ghost: "#735797",
Dragon: "#6F35FC",
Dark: "#705746",
Steel: "#B7B7CE",
Fairy: "#D685AD",
Normal: "#A8A77A",
};

// prettier-ignore
const typeIcons = {
Grass: "<:t_grass:1117063031579488370>",
Fire: "<:t_fire:1117063764487962624>",
Water: "<:t_water:1117063766308298772>",
Electric: "<:t_electric:1117063036268711957>",
Ice: "<:t_ice:1117062636861927505>",
Fighting: "<:t_fighting:1117063035224334426>",
Poison: "<:t_poison:1117062634219524146>",
Ground: "<:t_ground:1117062637566570538>",
Flying: "<:t_flying:1117063032644845680>",
Psychic: "<:t_psychic:1117062633191919657>",
Bug: "<:t_bug:1117062630553702431>",
Rock: "<:t_rock:1117062629282816061>",
Ghost: "<:t_ghost:1117062639420452874>",
Dragon: "<:t_dragon:1117062647439949875>",
Dark: "<:t_dark:1117063037858353162>",
Steel: "<:t_steel:1117062632172683414>",
Fairy: "<:t_fairy:1117062642964635698>",
Normal: "<:t_normal:1117062635817554010>",
};

// prettier-ignore
const evoToEmojiMap = {
"Friendship": "<:soothebell:1157323348108390411> Friendship",
"Fairy Move": "<:fairytm:1157321780038467645> Fairy Move",
"Day": "<:day:1218005509530189974> Day",
"Night": "<:night:1218005623396892682> Night",
"Level": "<:rarecandy:1157320353677328406> Level",
"Male": "<:male:1218006521477202050> Male",
"Female": "<:female:1218006542293532722> Female",
"in Rain": "<:raining:1218034030293811210> in Rain",
// Evolution Items
"Water Stone": "<:waterstone:1157321781036720249> Water Stone",
"Fire Stone": "<:firestone:1157321773235323001> Fire Stone",
"Thunder Stone": "<:thunderstone:1157321778004238418> Thunder Stone",
"Leaf Stone": "<:leafstone:1157321776045494273> Leaf Stone",
"Ice Stone": "<:icestone:1157321774434885693> Ice Stone",
"Moon Stone": "<:moonstone:1157323732570869850> Moon Stone",
"Sun Stone": "<:sunstone:1157323733149679738> Sun Stone",
"Dawn Stone": "<:dawnstone:1157322508903657622> Dawn Stone",
"Shiny Stone": "<:shinystone:1157321777299603599> Shiny Stone",
"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",
"Deep Sea Scale": "<:deepseascale:1217969243048640652> Deep Sea Scale",
"Deep Sea Tooth": "<:deepseatooth:1217969276548550806> Deep Sea Tooth",
"Peat Block": "<:peatblock:1217968820820381706> Peat Block",
"Dragon Scale": "<:dragonscale:1217969210119032954> Dragon Scale",
"Prism Scale": "<:prismscale:1217969021547188396> Prism Scale",
"Dubious Disc": "<:dubiousdisc:1217969175004319756> Dubious Disc",
"Upgrade": "<:upgrade:1217968860528115844> Upgrade",
"Electrizer": "<:electrizer:1217969152413663242> Electrizer",
"Magmarizer": "<:magmarizer:1217969124647506087> Magmarizer",
"Protector": "<:protector:1217968995978706944> Protector",
"Metal Coat": "<:metalcoat:1217969091000930345> Metal Coat",
"Oval Stone": "<:ovalstone:1217969058822094898> Oval Stone",
"Razor Claw": "<:razorclaw:1217968963007414386> Razor Claw",
"Razor Fang": "<:razorfang:1217968887778246786> Razor Fang",
"Reaper Cloth": "<:reapercloth:1217968922163413002> Reaper Cloth",
"King’s Rock": "<:kingsrock:1217971305102446655> King’s Rock",
};

// prettier-ignore
const reverseEncounterTypeMap = {
"Walking": "<:grass:1218438865476522085> Walking",
"Radar": "<:pokeradar:1136357617074180116> Radar",
"Swarm": "<:swarms:1218005686663778424> Swarm",
"Surfing": "<:surfing:1218440669341945999> Surfing",
"Old Rod": "<:oldrod:1136220484304896001> Old Rod",
"Good Rod": "<:goodrod:1136220559856906400> Good Rod",
"Super Rod": "<:superrod:1136220619432792097> Super Rod",
"Day": "<:day:1218005509530189974> Day",
"Night": "<:night:1218005623396892682> Night",
"Morning": "<:morning:1218005483365859501> Morning",
"Honey Tree": ":honey_pot: Honey Tree",
"Incense": "<:incense:1136358228356243506> Incense",
"Daily Trophy Garden": "<:trophy:1218429965347983391> Daily Trophy Garden",
"Trade": "<:trade:1217991109297307648> Trade",
"Legendaries": "<:legendary:1217991082705686599> Legendary",
"Static": "<:static:1217991097897189386> Static",
"Gifts": "<:mysterygift:1217991122857758740> Gift",
};

module.exports = {
typeColors,
typeIcons,
evoToEmojiMap,
reverseEncounterTypeMap,
};
68 changes: 3 additions & 65 deletions helpers/pokedexEvolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,7 @@ const {
getPokemonDisplayName,
getEvolutionMethodDetail,
} = require("../dex/index.js");

// Get colours for Types
// prettier-ignore
const typeColors = {
Grass: "#09B051",
Fire: "#EE8130",
Water: "#6390F0",
Electric: "#F7D02C",
Ice: "#96D9D6",
Fighting: "#C22E28",
Poison: "#A33EA1",
Ground: "#E2BF65",
Flying: "#A98FF3",
Psychic: "#F95587",
Bug: "#A6B91A",
Rock: "#B6A136",
Ghost: "#735797",
Dragon: "#6F35FC",
Dark: "#705746",
Steel: "#B7B7CE",
Fairy: "#D685AD",
Normal: "#A8A77A",
};

// Rename the evolution types
// prettier-ignore
const wordToEmojiMap = {
"Water Stone": "<:waterstone:1157321781036720249> Water Stone",
"Fire Stone": "<:firestone:1157321773235323001> Fire Stone",
"Thunder Stone": "<:thunderstone:1157321778004238418> Thunder Stone",
"Leaf Stone": "<:leafstone:1157321776045494273> Leaf Stone",
"Ice Stone": "<:icestone:1157321774434885693> Ice Stone",
"Moon Stone": "<:moonstone:1157323732570869850> Moon Stone",
"Sun Stone": "<:sunstone:1157323733149679738> Sun Stone",
"Dawn Stone": "<:dawnstone:1157322508903657622> Dawn Stone",
"Shiny Stone": "<:shinystone:1157321777299603599> Shiny Stone",
"Friendship": "<:soothebell:1157323348108390411> Friendship",
"Fairy Move": "<:fairytm:1157321780038467645> Fairy Move",
"Day": "<:Sun:1157324258519818332> Day",
"Night": "<:Moon:1157324256988889221> Night",
"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",
};
const { typeColors, evoToEmojiMap } = require("./pokedexConstants.js");

function evolutionMode(pokemonInfo, monsID, imageLnk) {
if (pokemonInfo.name === `Shedinja`) {
Expand Down Expand Up @@ -97,12 +35,12 @@ function evolutionMode(pokemonInfo, monsID, imageLnk) {
);

// Create a regular expression pattern that matches all words to be replaced
const pattern = new RegExp(Object.keys(wordToEmojiMap).join("|"), "gi");
const pattern = new RegExp(Object.keys(evoToEmojiMap).join("|"), "gi");

// Replace the matched words with their corresponding emojis
const methodDescriptionWithEmojis = evoMethodDetail[0].method.replace(
pattern,
(matchedWord) => wordToEmojiMap[matchedWord],
(matchedWord) => evoToEmojiMap[matchedWord],
);

// Handles Ninjask and Nincada
Expand Down
47 changes: 1 addition & 46 deletions helpers/pokedexLearnset.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,6 @@
const { EmbedBuilder } = require("discord.js");
const { generateMovesViaLearnset } = require("../dex/index.js");

// Get colours for Types
// prettier-ignore
const typeColors = {
Grass: "#09B051",
Fire: "#EE8130",
Water: "#6390F0",
Electric: "#F7D02C",
Ice: "#96D9D6",
Fighting: "#C22E28",
Poison: "#A33EA1",
Ground: "#E2BF65",
Flying: "#A98FF3",
Psychic: "#F95587",
Bug: "#A6B91A",
Rock: "#B6A136",
Ghost: "#735797",
Dragon: "#6F35FC",
Dark: "#705746",
Steel: "#B7B7CE",
Fairy: "#D685AD",
Normal: "#A8A77A",
};

// Array for pokemon types to set icons.
// prettier-ignore
const typeIcons = {
Grass: "<:t_grass:1117063031579488370>",
Fire: "<:t_fire:1117063764487962624>",
Water: "<:t_water:1117063766308298772>",
Electric: "<:t_electric:1117063036268711957>",
Ice: "<:t_ice:1117062636861927505>",
Fighting: "<:t_fighting:1117063035224334426>",
Poison: "<:t_poison:1117062634219524146>",
Ground: "<:t_ground:1117062637566570538>",
Flying: "<:t_flying:1117063032644845680>",
Psychic: "<:t_psychic:1117062633191919657>",
Bug: "<:t_bug:1117062630553702431>",
Rock: "<:t_rock:1117062629282816061>",
Ghost: "<:t_ghost:1117062639420452874>",
Dragon: "<:t_dragon:1117062647439949875>",
Dark: "<:t_dark:1117063037858353162>",
Steel: "<:t_steel:1117062632172683414>",
Fairy: "<:t_fairy:1117062642964635698>",
Normal: "<:t_normal:1117062635817554010>",
};
const { typeColors, typeIcons } = require("./pokedexConstants.js");

function learnsetMode(pokemonInfo, monsID, imageLnk) {
// Begin learnset mode.
Expand Down
Loading

0 comments on commit b0e99be

Please sign in to comment.