Search in sources :

Example 1 with PokemonRaidInfo

use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.

the class PokemonRaidStrategyService method populateRaidInfoForBoss.

private void populateRaidInfoForBoss(PokemonRepository pokemonRepository, String pokemonName, String maxCp, int bossTier) {
    final Pokemon pokemon = pokemonRepository.getByName(pokemonName.toUpperCase());
    if (pokemon == null) {
        LOGGER.warn("Exception when getting pokemon by name " + pokemonName + " - needs to be added to repo data file.");
        return;
    }
    pokemonRaidInfo.put(pokemonName.toUpperCase(), new PokemonRaidInfo(pokemon, maxCp, bossTier));
}
Also used : PokemonRaidInfo(pokeraidbot.domain.pokemon.PokemonRaidInfo) Pokemon(pokeraidbot.domain.pokemon.Pokemon)

Example 2 with PokemonRaidInfo

use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.

the class RaidOverviewCommand method getOverviewMessage.

private static String getOverviewMessage(Config config, LocaleService localeService, RaidRepository raidRepository, ClockService clockService, Locale locale, PokemonRaidStrategyService strategyService) {
    Set<Raid> raids = raidRepository.getAllRaidsForRegion(config.getRegion());
    StringBuilder stringBuilder = new StringBuilder();
    if (raids.size() == 0) {
        stringBuilder.append(localeService.getMessageFor(LocaleService.LIST_NO_RAIDS, locale));
    } else {
        StringBuilder exRaids = new StringBuilder();
        stringBuilder.append("**").append(localeService.getMessageFor(LocaleService.CURRENT_RAIDS, locale));
        stringBuilder.append(":**");
        stringBuilder.append("\n").append(localeService.getMessageFor(LocaleService.RAID_DETAILS, locale)).append("\n");
        Pokemon currentPokemon = null;
        for (Raid raid : raids) {
            final Pokemon raidBoss = raid.getPokemon();
            if (!raid.isExRaid() && (currentPokemon == null || (!currentPokemon.equals(raidBoss)))) {
                currentPokemon = raid.getPokemon();
                final PokemonRaidInfo raidInfo = strategyService.getRaidInfo(currentPokemon);
                stringBuilder.append("\n**").append(currentPokemon.getName()).append("**");
                if (raidInfo != null && raidInfo.getBossTier() > 0) {
                    stringBuilder.append(" (").append(raidInfo.getBossTier()).append(")");
                }
                stringBuilder.append("\n");
            }
            final int numberOfPeople = raid.getNumberOfPeopleSignedUp();
            final Gym raidGym = raid.getGym();
            final Set<RaidGroup> groups = raidRepository.getGroups(raid);
            if (!raid.isExRaid()) {
                if (raidGym.isExGym()) {
                    stringBuilder.append("**").append(raidGym.getName()).append(Emotes.STAR + "**");
                } else {
                    stringBuilder.append("*").append(raidGym.getName()).append("*");
                }
                stringBuilder.append(" ").append(printTimeIfSameDay(getStartOfRaid(raid.getEndOfRaid(), false))).append("-").append(printTime(raid.getEndOfRaid().toLocalTime()));
                if (groups.size() < 1) {
                    stringBuilder.append(" (**").append(numberOfPeople).append("**)");
                } else {
                    stringBuilder.append(raidRepository.listGroupsForRaid(raid, groups));
                }
                stringBuilder.append("\n");
            } else {
                exRaids.append("\n*").append(raidGym.getName());
                exRaids.append("* ").append(localeService.getMessageFor(LocaleService.RAID_BETWEEN, locale, printTimeIfSameDay(getStartOfRaid(raid.getEndOfRaid(), true)), printTime(raid.getEndOfRaid().toLocalTime())));
                if (groups.size() < 1) {
                    exRaids.append(" (**").append(numberOfPeople).append("**)");
                } else {
                    exRaids.append(raidRepository.listGroupsForRaid(raid, groups));
                }
            }
        }
        final String exRaidList = exRaids.toString();
        if (exRaidList.length() > 1) {
            stringBuilder.append("\n**Raid-EX:**").append(exRaidList);
        }
    }
    stringBuilder.append("\n\n").append(localeService.getMessageFor(LocaleService.UPDATED_EVERY_X, locale, LocaleService.asString(TimeUnit.SECONDS, locale), String.valueOf(60))).append(" ").append(localeService.getMessageFor(LocaleService.LAST_UPDATE, locale, printTime(clockService.getCurrentTime())));
    return stringBuilder.toString();
}
Also used : PokemonRaidInfo(pokeraidbot.domain.pokemon.PokemonRaidInfo) Gym(pokeraidbot.domain.gym.Gym) RaidGroup(pokeraidbot.infrastructure.jpa.raid.RaidGroup) Raid(pokeraidbot.domain.raid.Raid) Pokemon(pokeraidbot.domain.pokemon.Pokemon)

Example 3 with PokemonRaidInfo

use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.

the class RaidPokemonsTest method verifyAllLegendaryPokemonsAreTier5.

@Test
public void verifyAllLegendaryPokemonsAreTier5() {
    final PokemonRaidInfo raikou = strategyService.getRaidInfo(pokemonRepository.search("raikou", null));
    assertNotNull(raikou);
    assertThat(raikou.getBossTier(), is(5));
    final PokemonRaidInfo hooh = strategyService.getRaidInfo(pokemonRepository.search("ho-oh", null));
    assertNotNull(hooh);
    assertThat(hooh.getBossTier(), is(5));
}
Also used : PokemonRaidInfo(pokeraidbot.domain.pokemon.PokemonRaidInfo) Test(org.junit.Test)

Example 4 with PokemonRaidInfo

use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.

the class RaidPokemonsTest method verifyRaidbosses.

@Test
public void verifyRaidbosses() {
    RaidBossCounters counters;
    PokemonRaidInfo raidInfo = strategyService.getRaidInfo(pokemonRepository.search("machamp", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(3));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(7));
    assertThat(counters.getSupremeCounters().size(), is(2));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("wailmer", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(1));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters == null, is(true));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("kyogre", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(4));
    assertThat(counters.getSupremeCounters().size(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("latias", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(0));
    assertThat(counters.getSupremeCounters().size(), is(5));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("latios", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(0));
    assertThat(counters.getSupremeCounters().size(), is(5));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("rayquaza", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(3));
    assertThat(counters.getSupremeCounters().size(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("registeel", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(4));
    assertThat(counters.getSupremeCounters().size(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("aggron", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(4));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(4));
    assertThat(counters.getSupremeCounters().size(), is(1));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("celebi", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getMaxCp(), is(1766));
    assertThat(raidInfo.getBossTier(), is(5));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(6));
    assertThat(counters.getSupremeCounters().size(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("mew", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(5));
    assertThat(raidInfo.getMaxCp(), is(1766));
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(counters.getGoodCounters().size(), is(7));
    assertThat(counters.getSupremeCounters().size(), is(1));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("snorunt", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(1));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("swablu", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(1));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("dewgong", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(2));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("azumarill", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("jynx", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("piloswine", null));
    assertNotNull(raidInfo);
    assertThat(raidInfo.getBossTier(), is(3));
    raidInfo = strategyService.getRaidInfo(pokemonRepository.search("feraligatr", null));
    assertNotNull(raidInfo);
    counters = strategyService.getCounters(raidInfo.getPokemon());
    assertThat(raidInfo.getBossTier(), is(4));
    assertThat(counters.getGoodCounters().size(), is(4));
    assertThat(counters.getSupremeCounters().size(), is(3));
}
Also used : PokemonRaidInfo(pokeraidbot.domain.pokemon.PokemonRaidInfo) Test(org.junit.Test)

Example 5 with PokemonRaidInfo

use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.

the class PokemonRaidStrategyService method getMaxCp.

public String getMaxCp(Pokemon pokemon) {
    final PokemonRaidInfo pokemonRaidInfo = this.pokemonRaidInfo.get(pokemon.getName().toUpperCase());
    if (pokemonRaidInfo == null) {
        return null;
    }
    final String maxCp = String.valueOf(pokemonRaidInfo.getMaxCp());
    if (maxCp != null && (!maxCp.isEmpty())) {
        return maxCp;
    } else {
        return null;
    }
}
Also used : PokemonRaidInfo(pokeraidbot.domain.pokemon.PokemonRaidInfo)

Aggregations

PokemonRaidInfo (pokeraidbot.domain.pokemon.PokemonRaidInfo)7 Pokemon (pokeraidbot.domain.pokemon.Pokemon)4 Gym (pokeraidbot.domain.gym.Gym)3 User (net.dv8tion.jda.core.entities.User)2 Test (org.junit.Test)2 Raid (pokeraidbot.domain.raid.Raid)2 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)1 SelfUser (net.dv8tion.jda.core.entities.SelfUser)1 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)1 UserMessedUpException (pokeraidbot.domain.errors.UserMessedUpException)1 Config (pokeraidbot.infrastructure.jpa.config.Config)1 RaidGroup (pokeraidbot.infrastructure.jpa.raid.RaidGroup)1