Archived
1

Possibilities for all levels for academics

This commit is contained in:
Vladimir Hodakov 2018-02-17 18:17:09 +04:00
parent 8bd11d2494
commit ffb9863bf7

View File

@ -4,8 +4,8 @@
package pokedexer package pokedexer
import ( import (
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
"github.com/go-telegram-bot-api/telegram-bot-api" "github.com/go-telegram-bot-api/telegram-bot-api"
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
"strconv" "strconv"
"strings" "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) { if (pk.Grade < profileRaw.LevelID+2) && (pk.Grade > profileRaw.LevelID-3) {
message += "\nВероятность поимки:" message += "\nВероятность поимки:"
for i := range pokememe.Locations { for i := range pokememe.Locations {