2017-10-13 03:52:04 +04:00
|
|
|
|
// i2_bot – Instinct PokememBro Bot
|
|
|
|
|
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
|
|
|
|
|
|
|
|
|
|
package talkers
|
|
|
|
|
|
|
|
|
|
import (
|
2017-10-18 07:03:34 +04:00
|
|
|
|
// stdlib
|
|
|
|
|
"log"
|
|
|
|
|
"strconv"
|
|
|
|
|
// 3rd party
|
|
|
|
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
|
|
|
// local
|
2017-10-26 18:17:58 +04:00
|
|
|
|
"lab.pztrn.name/fat0troll/i2_bot/lib/dbmapping"
|
2017-10-13 03:52:04 +04:00
|
|
|
|
)
|
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
// BestPokememesList shows list for catching based on player league and grade
|
|
|
|
|
func (t *Talkers) BestPokememesList(update tgbotapi.Update, playerRaw dbmapping.Player) string {
|
|
|
|
|
pokememes, ok := c.Getters.GetBestPokememes(playerRaw.ID)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
if !ok {
|
|
|
|
|
log.Printf("Cannot get pokememes from getter!")
|
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-13 03:52:04 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
message := "*Лучшие покемемы для ловли*\n\n"
|
|
|
|
|
for i := range pokememes {
|
|
|
|
|
pk := pokememes[i].Pokememe
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pkL := pokememes[i].Locations
|
|
|
|
|
pkE := pokememes[i].Elements
|
2017-10-18 07:03:34 +04:00
|
|
|
|
message += strconv.Itoa(pk.Grade) + "⃣ "
|
|
|
|
|
message += pk.Name + " (⚔"
|
|
|
|
|
message += c.Parsers.ReturnPoints(pk.Attack)
|
|
|
|
|
message += ", 🛡" + c.Parsers.ReturnPoints(pk.Defence) + ")"
|
2017-10-18 09:39:50 +04:00
|
|
|
|
for i := range pkE {
|
|
|
|
|
message += pkE[i].Symbol
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
message += " /pk" + strconv.Itoa(pk.ID) + "\n"
|
2017-10-18 07:03:34 +04:00
|
|
|
|
message += "Локации: "
|
2017-10-18 09:39:50 +04:00
|
|
|
|
for i := range pkL {
|
|
|
|
|
message += pkL[i].Symbol + pkL[i].Name
|
|
|
|
|
if i+1 < len(pkL) {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
message += ", "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
message += "\nКупить: "
|
|
|
|
|
if pk.Purchaseable {
|
|
|
|
|
message += "💲" + c.Parsers.ReturnPoints(pk.Price*3)
|
|
|
|
|
} else {
|
|
|
|
|
message += "Нельзя"
|
|
|
|
|
}
|
|
|
|
|
message += "\n\n"
|
|
|
|
|
}
|
2017-10-13 03:52:04 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
|
|
|
|
|
msg.ParseMode = "Markdown"
|
2017-10-13 03:52:04 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
c.Bot.Send(msg)
|
2017-10-13 03:52:04 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "ok"
|
2017-10-13 03:52:04 +04:00
|
|
|
|
}
|