From ffb9863bf778f139e895870b157c54264d973d85 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sat, 17 Feb 2018 18:17:09 +0400 Subject: [PATCH] Possibilities for all levels for academics --- lib/pokedexer/responders.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/pokedexer/responders.go b/lib/pokedexer/responders.go index 0af44f9..45e141d 100644 --- a/lib/pokedexer/responders.go +++ b/lib/pokedexer/responders.go @@ -4,8 +4,8 @@ package pokedexer import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" ) @@ -147,7 +147,26 @@ func (p *Pokedexer) PokememeInfo(update *tgbotapi.Update, playerRaw *dbmapping.P } } - if calculatePossibilites { + if c.Users.PlayerBetterThan(playerRaw, "academic") { + message += "\nВероятность поимки:" + idx := 1 + for idx < 10 { + levelHeaderPosted := false + for i := range pokememe.Locations { + percentile, pokeballs := c.Statistics.PossibilityRequiredPokeballs(pokememe.Locations[i].ID, pk.Grade, idx) + if pokeballs > 0 { + if !levelHeaderPosted { + message += "\nУровень: " + strconv.Itoa(idx) + levelHeaderPosted = true + } + message += "\n" + pokememe.Locations[i].Name + " – " + message += strconv.FormatFloat(percentile, 'f', 2, 64) + "% или " + message += strconv.Itoa(pokeballs) + "⭕" + } + } + idx++ + } + } else if calculatePossibilites { if (pk.Grade < profileRaw.LevelID+2) && (pk.Grade > profileRaw.LevelID-3) { message += "\nВероятность поимки:" for i := range pokememe.Locations {