All code formatted with gofmt
This commit is contained in:
parent
df58e25adc
commit
6f374e560e
@ -5,8 +5,8 @@ package appcontext
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
// 3rd-party
|
// 3rd-party
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
// local
|
// local
|
||||||
"../config"
|
"../config"
|
||||||
"../connections"
|
"../connections"
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
// stdlib
|
// stdlib
|
||||||
"log"
|
"log"
|
||||||
// 3rd-party
|
// 3rd-party
|
||||||
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
|
||||||
// local
|
// local
|
||||||
"../config"
|
"../config"
|
||||||
)
|
)
|
||||||
|
@ -16,38 +16,38 @@ import (
|
|||||||
func (g *Getters) formFullPokememes(pokememes []dbmapping.Pokememe) ([]dbmapping.PokememeFull, bool) {
|
func (g *Getters) formFullPokememes(pokememes []dbmapping.Pokememe) ([]dbmapping.PokememeFull, bool) {
|
||||||
pokememes_full := []dbmapping.PokememeFull{}
|
pokememes_full := []dbmapping.PokememeFull{}
|
||||||
elements := []dbmapping.Element{}
|
elements := []dbmapping.Element{}
|
||||||
err := c.Db.Select(&elements, "SELECT * FROM elements");
|
err := c.Db.Select(&elements, "SELECT * FROM elements")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememes_full, false
|
return pokememes_full, false
|
||||||
}
|
}
|
||||||
locations := []dbmapping.Location{}
|
locations := []dbmapping.Location{}
|
||||||
err = c.Db.Select(&locations, "SELECT * FROM locations");
|
err = c.Db.Select(&locations, "SELECT * FROM locations")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememes_full, false
|
return pokememes_full, false
|
||||||
}
|
}
|
||||||
pokememes_elements := []dbmapping.PokememeElement{}
|
pokememes_elements := []dbmapping.PokememeElement{}
|
||||||
err = c.Db.Select(&pokememes_elements, "SELECT * FROM pokememes_elements");
|
err = c.Db.Select(&pokememes_elements, "SELECT * FROM pokememes_elements")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememes_full, false
|
return pokememes_full, false
|
||||||
}
|
}
|
||||||
pokememes_locations := []dbmapping.PokememeLocation{}
|
pokememes_locations := []dbmapping.PokememeLocation{}
|
||||||
err = c.Db.Select(&pokememes_locations, "SELECT * FROM pokememes_locations");
|
err = c.Db.Select(&pokememes_locations, "SELECT * FROM pokememes_locations")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememes_full, false
|
return pokememes_full, false
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range(pokememes) {
|
for i := range pokememes {
|
||||||
full_pokememe := dbmapping.PokememeFull{}
|
full_pokememe := dbmapping.PokememeFull{}
|
||||||
elements_listed := []dbmapping.Element{}
|
elements_listed := []dbmapping.Element{}
|
||||||
locations_listed := []dbmapping.Location{}
|
locations_listed := []dbmapping.Location{}
|
||||||
|
|
||||||
for j := range(pokememes_locations) {
|
for j := range pokememes_locations {
|
||||||
if pokememes_locations[j].Pokememe_id == pokememes[i].Id {
|
if pokememes_locations[j].Pokememe_id == pokememes[i].Id {
|
||||||
for l := range(locations) {
|
for l := range locations {
|
||||||
if pokememes_locations[j].Location_id == locations[l].Id {
|
if pokememes_locations[j].Location_id == locations[l].Id {
|
||||||
locations_listed = append(locations_listed, locations[l])
|
locations_listed = append(locations_listed, locations[l])
|
||||||
}
|
}
|
||||||
@ -55,9 +55,9 @@ func (g *Getters) formFullPokememes(pokememes []dbmapping.Pokememe) ([]dbmapping
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for k := range(pokememes_elements) {
|
for k := range pokememes_elements {
|
||||||
if pokememes_elements[k].Pokememe_id == pokememes[i].Id {
|
if pokememes_elements[k].Pokememe_id == pokememes[i].Id {
|
||||||
for e := range(elements) {
|
for e := range elements {
|
||||||
if pokememes_elements[k].Element_id == elements[e].Id {
|
if pokememes_elements[k].Element_id == elements[e].Id {
|
||||||
elements_listed = append(elements_listed, elements[e])
|
elements_listed = append(elements_listed, elements[e])
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ func (g *Getters) formFullPokememes(pokememes []dbmapping.Pokememe) ([]dbmapping
|
|||||||
func (g *Getters) GetPokememes() ([]dbmapping.PokememeFull, bool) {
|
func (g *Getters) GetPokememes() ([]dbmapping.PokememeFull, bool) {
|
||||||
pokememes_full := []dbmapping.PokememeFull{}
|
pokememes_full := []dbmapping.PokememeFull{}
|
||||||
pokememes := []dbmapping.Pokememe{}
|
pokememes := []dbmapping.Pokememe{}
|
||||||
err := c.Db.Select(&pokememes, "SELECT * FROM pokememes ORDER BY grade asc, name asc");
|
err := c.Db.Select(&pokememes, "SELECT * FROM pokememes ORDER BY grade asc, name asc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememes_full, false
|
return pokememes_full, false
|
||||||
@ -126,25 +126,25 @@ func (g *Getters) GetPokememeByID(pokememe_id string) (dbmapping.PokememeFull, b
|
|||||||
return pokememe_full, false
|
return pokememe_full, false
|
||||||
}
|
}
|
||||||
elements := []dbmapping.Element{}
|
elements := []dbmapping.Element{}
|
||||||
err = c.Db.Select(&elements, "SELECT * FROM elements");
|
err = c.Db.Select(&elements, "SELECT * FROM elements")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememe_full, false
|
return pokememe_full, false
|
||||||
}
|
}
|
||||||
locations := []dbmapping.Location{}
|
locations := []dbmapping.Location{}
|
||||||
err = c.Db.Select(&locations, "SELECT * FROM locations");
|
err = c.Db.Select(&locations, "SELECT * FROM locations")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememe_full, false
|
return pokememe_full, false
|
||||||
}
|
}
|
||||||
pokememes_elements := []dbmapping.PokememeElement{}
|
pokememes_elements := []dbmapping.PokememeElement{}
|
||||||
err = c.Db.Select(&pokememes_elements, "SELECT * FROM pokememes_elements WHERE pokememe_id='" + strconv.Itoa(pokememe.Id) + "'");
|
err = c.Db.Select(&pokememes_elements, "SELECT * FROM pokememes_elements WHERE pokememe_id='"+strconv.Itoa(pokememe.Id)+"'")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememe_full, false
|
return pokememe_full, false
|
||||||
}
|
}
|
||||||
pokememes_locations := []dbmapping.PokememeLocation{}
|
pokememes_locations := []dbmapping.PokememeLocation{}
|
||||||
err = c.Db.Select(&pokememes_locations, "SELECT * FROM pokememes_locations WHERE pokememe_id='" + strconv.Itoa(pokememe.Id) + "'");
|
err = c.Db.Select(&pokememes_locations, "SELECT * FROM pokememes_locations WHERE pokememe_id='"+strconv.Itoa(pokememe.Id)+"'")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return pokememe_full, false
|
return pokememe_full, false
|
||||||
@ -153,9 +153,9 @@ func (g *Getters) GetPokememeByID(pokememe_id string) (dbmapping.PokememeFull, b
|
|||||||
elements_listed := []dbmapping.Element{}
|
elements_listed := []dbmapping.Element{}
|
||||||
locations_listed := []dbmapping.Location{}
|
locations_listed := []dbmapping.Location{}
|
||||||
|
|
||||||
for j := range(pokememes_locations) {
|
for j := range pokememes_locations {
|
||||||
if pokememes_locations[j].Pokememe_id == pokememe.Id {
|
if pokememes_locations[j].Pokememe_id == pokememe.Id {
|
||||||
for l := range(locations) {
|
for l := range locations {
|
||||||
if pokememes_locations[j].Location_id == locations[l].Id {
|
if pokememes_locations[j].Location_id == locations[l].Id {
|
||||||
locations_listed = append(locations_listed, locations[l])
|
locations_listed = append(locations_listed, locations[l])
|
||||||
}
|
}
|
||||||
@ -163,9 +163,9 @@ func (g *Getters) GetPokememeByID(pokememe_id string) (dbmapping.PokememeFull, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for k := range(pokememes_elements) {
|
for k := range pokememes_elements {
|
||||||
if pokememes_elements[k].Pokememe_id == pokememe.Id {
|
if pokememes_elements[k].Pokememe_id == pokememe.Id {
|
||||||
for e := range(elements) {
|
for e := range elements {
|
||||||
if pokememes_elements[k].Element_id == elements[e].Id {
|
if pokememes_elements[k].Element_id == elements[e].Id {
|
||||||
elements_listed = append(elements_listed, elements[e])
|
elements_listed = append(elements_listed, elements[e])
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"../../dbmapping"
|
"../../dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type ParsersInterface interface {
|
type ParsersInterface interface {
|
||||||
ParsePokememe(text string, player_raw dbmapping.Player) string
|
ParsePokememe(text string, player_raw dbmapping.Player) string
|
||||||
ParseProfile(update tgbotapi.Update, player_raw dbmapping.Player) string
|
ParseProfile(update tgbotapi.Update, player_raw dbmapping.Player) string
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
// stdlib
|
// stdlib
|
||||||
"log"
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
// local
|
// local
|
||||||
"../dbmapping"
|
"../dbmapping"
|
||||||
@ -38,7 +38,7 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
var defendable_pokememe bool = false
|
var defendable_pokememe bool = false
|
||||||
pokememe_info_strings := strings.Split(text, "\n")
|
pokememe_info_strings := strings.Split(text, "\n")
|
||||||
pokememe_info_runed_strings := make([][]rune, 0)
|
pokememe_info_runed_strings := make([][]rune, 0)
|
||||||
for i := range(pokememe_info_strings) {
|
for i := range pokememe_info_strings {
|
||||||
pokememe_info_runed_strings = append(pokememe_info_runed_strings, []rune(pokememe_info_strings[i]))
|
pokememe_info_runed_strings = append(pokememe_info_runed_strings, []rune(pokememe_info_strings[i]))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,6 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
image = strings.Replace(string(pokememe_info_runed_strings[11]), " ", "", -1)
|
image = strings.Replace(string(pokememe_info_runed_strings[11]), " ", "", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
grade := string(pokememe_info_runed_strings[0][0])
|
grade := string(pokememe_info_runed_strings[0][0])
|
||||||
name := string(pokememe_info_runed_strings[0][3:])
|
name := string(pokememe_info_runed_strings[0][3:])
|
||||||
description := string(pokememe_info_runed_strings[1])
|
description := string(pokememe_info_runed_strings[1])
|
||||||
@ -160,7 +159,7 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
log.Printf("Pokememe name: " + name)
|
log.Printf("Pokememe name: " + name)
|
||||||
log.Printf("Pokememe description: " + description)
|
log.Printf("Pokememe description: " + description)
|
||||||
log.Printf("Elements:")
|
log.Printf("Elements:")
|
||||||
for i := range(elements) {
|
for i := range elements {
|
||||||
log.Printf(elements[i].Symbol + " " + elements[i].Name)
|
log.Printf(elements[i].Symbol + " " + elements[i].Name)
|
||||||
}
|
}
|
||||||
log.Printf("Attack: " + hitPoints[0])
|
log.Printf("Attack: " + hitPoints[0])
|
||||||
@ -169,7 +168,7 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
log.Printf("Defence: " + defence)
|
log.Printf("Defence: " + defence)
|
||||||
log.Printf("Price: " + price)
|
log.Printf("Price: " + price)
|
||||||
log.Printf("Locations:")
|
log.Printf("Locations:")
|
||||||
for i := range(locations) {
|
for i := range locations {
|
||||||
log.Printf(locations[i].Symbol + " " + locations[i].Name)
|
log.Printf(locations[i].Symbol + " " + locations[i].Name)
|
||||||
}
|
}
|
||||||
if purchaseable {
|
if purchaseable {
|
||||||
@ -226,7 +225,7 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
log.Printf("Pokememe isn't added!")
|
log.Printf("Pokememe isn't added!")
|
||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
for i := range(elements) {
|
for i := range elements {
|
||||||
link := dbmapping.PokememeElement{}
|
link := dbmapping.PokememeElement{}
|
||||||
link.Pokememe_id = pokememe.Id
|
link.Pokememe_id = pokememe.Id
|
||||||
link.Element_id = elements[i].Id
|
link.Element_id = elements[i].Id
|
||||||
@ -238,7 +237,7 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := range(locations) {
|
for i := range locations {
|
||||||
link := dbmapping.PokememeLocation{}
|
link := dbmapping.PokememeLocation{}
|
||||||
link.Pokememe_id = pokememe.Id
|
link.Pokememe_id = pokememe.Id
|
||||||
link.Location_id = locations[i].Id
|
link.Location_id = locations[i].Id
|
||||||
@ -251,7 +250,6 @@ func (p *Parsers) ParsePokememe(text string, player_raw dbmapping.Player) string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
// stdlib
|
// stdlib
|
||||||
"log"
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
// 3rd party
|
// 3rd party
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
@ -53,7 +53,7 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
|
|
||||||
profile_info_strings := strings.Split(text, "\n")
|
profile_info_strings := strings.Split(text, "\n")
|
||||||
profile_info_runed_strings := make([][]rune, 0)
|
profile_info_runed_strings := make([][]rune, 0)
|
||||||
for i := range(profile_info_strings) {
|
for i := range profile_info_strings {
|
||||||
profile_info_runed_strings = append(profile_info_runed_strings, []rune(profile_info_strings[i]))
|
profile_info_runed_strings = append(profile_info_runed_strings, []rune(profile_info_strings[i]))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
|
|
||||||
// Filling information
|
// Filling information
|
||||||
// We don't know how many strings we got, so we iterating each other
|
// We don't know how many strings we got, so we iterating each other
|
||||||
for i := range(profile_info_runed_strings) {
|
for i := range profile_info_runed_strings {
|
||||||
current_string := string(profile_info_runed_strings[i])
|
current_string := string(profile_info_runed_strings[i])
|
||||||
current_runes := profile_info_runed_strings[i]
|
current_runes := profile_info_runed_strings[i]
|
||||||
if strings.HasPrefix(current_string, "🈸") || strings.HasPrefix(current_string, "🈳 ") || strings.HasPrefix(current_string, "🈵") {
|
if strings.HasPrefix(current_string, "🈸") || strings.HasPrefix(current_string, "🈳 ") || strings.HasPrefix(current_string, "🈵") {
|
||||||
@ -88,7 +88,7 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
log.Println(err1)
|
log.Println(err1)
|
||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
for j := range(current_runes) {
|
for j := range current_runes {
|
||||||
if j > 1 {
|
if j > 1 {
|
||||||
nickname += string(current_runes[j])
|
nickname += string(current_runes[j])
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
log.Println(crystalls_int)
|
log.Println(crystalls_int)
|
||||||
log.Printf("Weapon: " + weapon)
|
log.Printf("Weapon: " + weapon)
|
||||||
if len(pokememes) > 0 {
|
if len(pokememes) > 0 {
|
||||||
for meme, attack := range(pokememes) {
|
for meme, attack := range pokememes {
|
||||||
log.Printf(meme + ": " + attack)
|
log.Printf(meme + ": " + attack)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -268,8 +268,7 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for meme, attack := range pokememes {
|
||||||
for meme, attack := range(pokememes) {
|
|
||||||
rarity := "common"
|
rarity := "common"
|
||||||
if strings.HasPrefix(meme, "🔸") {
|
if strings.HasPrefix(meme, "🔸") {
|
||||||
rarity = "rare"
|
rarity = "rare"
|
||||||
|
@ -5,8 +5,8 @@ package talkers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
// stdlib
|
// stdlib
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
// 3rd party
|
// 3rd party
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
// local
|
// local
|
||||||
@ -28,7 +28,7 @@ func (t *Talkers) pokememesListing(update tgbotapi.Update, page int, pokememes_f
|
|||||||
}
|
}
|
||||||
message += "\n\n"
|
message += "\n\n"
|
||||||
|
|
||||||
for i := range(pokememes_full) {
|
for i := range pokememes_full {
|
||||||
if (i+1 > 50*(page-1)) && (i+1 < (50*page)+1) {
|
if (i+1 > 50*(page-1)) && (i+1 < (50*page)+1) {
|
||||||
pk := pokememes_full[i].Pokememe
|
pk := pokememes_full[i].Pokememe
|
||||||
pk_e := pokememes_full[i].Elements
|
pk_e := pokememes_full[i].Elements
|
||||||
@ -36,7 +36,7 @@ func (t *Talkers) pokememesListing(update tgbotapi.Update, page int, pokememes_f
|
|||||||
message += "⃣ *" + pk.Name
|
message += "⃣ *" + pk.Name
|
||||||
message += "* (" + c.Parsers.ReturnPoints(pk.HP) + "-" + c.Parsers.ReturnPoints(pk.MP) + ") ⚔️ *"
|
message += "* (" + c.Parsers.ReturnPoints(pk.HP) + "-" + c.Parsers.ReturnPoints(pk.MP) + ") ⚔️ *"
|
||||||
message += c.Parsers.ReturnPoints(pk.Attack) + "* \\["
|
message += c.Parsers.ReturnPoints(pk.Attack) + "* \\["
|
||||||
for j := range(pk_e) {
|
for j := range pk_e {
|
||||||
message += pk_e[j].Symbol
|
message += pk_e[j].Symbol
|
||||||
}
|
}
|
||||||
message += "] " + c.Parsers.ReturnPoints(pk.Price) + "$ /pk" + strconv.Itoa(pk.Id)
|
message += "] " + c.Parsers.ReturnPoints(pk.Price) + "$ /pk" + strconv.Itoa(pk.Id)
|
||||||
@ -80,13 +80,13 @@ func (t *Talkers) PokememeInfo(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
message := strconv.Itoa(pk.Grade) + "⃣ *" + pk.Name + "*\n"
|
message := strconv.Itoa(pk.Grade) + "⃣ *" + pk.Name + "*\n"
|
||||||
message += pk.Description + "\n\n"
|
message += pk.Description + "\n\n"
|
||||||
message += "Элементы:"
|
message += "Элементы:"
|
||||||
for i := range(pokememe.Elements) {
|
for i := range pokememe.Elements {
|
||||||
message += " " + pokememe.Elements[i].Symbol
|
message += " " + pokememe.Elements[i].Symbol
|
||||||
}
|
}
|
||||||
message += "\n⚔ Атака: *" + c.Parsers.ReturnPoints(pk.Attack)
|
message += "\n⚔ Атака: *" + c.Parsers.ReturnPoints(pk.Attack)
|
||||||
message += "*\n❤️ HP: *" + c.Parsers.ReturnPoints(pk.HP)
|
message += "*\n❤️ HP: *" + c.Parsers.ReturnPoints(pk.HP)
|
||||||
message += "*\n💙 MP: *" + c.Parsers.ReturnPoints(pk.MP)
|
message += "*\n💙 MP: *" + c.Parsers.ReturnPoints(pk.MP)
|
||||||
if (pk.Defence != pk.Attack) {
|
if pk.Defence != pk.Attack {
|
||||||
message += "*\n🛡Защита: *" + c.Parsers.ReturnPoints(pk.Defence) + "* _(сопротивляемость покемема к поимке)_"
|
message += "*\n🛡Защита: *" + c.Parsers.ReturnPoints(pk.Defence) + "* _(сопротивляемость покемема к поимке)_"
|
||||||
} else {
|
} else {
|
||||||
message += "*"
|
message += "*"
|
||||||
@ -99,7 +99,7 @@ func (t *Talkers) PokememeInfo(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
message += "Нельзя"
|
message += "Нельзя"
|
||||||
}
|
}
|
||||||
message += "*\nОбитает:"
|
message += "*\nОбитает:"
|
||||||
for i := range(pokememe.Locations) {
|
for i := range pokememe.Locations {
|
||||||
message += " *" + pokememe.Locations[i].Name + "*"
|
message += " *" + pokememe.Locations[i].Name + "*"
|
||||||
if (i + 1) < len(pokememe.Locations) {
|
if (i + 1) < len(pokememe.Locations) {
|
||||||
message += ","
|
message += ","
|
||||||
@ -109,7 +109,7 @@ func (t *Talkers) PokememeInfo(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
if calculate_possibilites {
|
if calculate_possibilites {
|
||||||
if (pk.Grade < profile_raw.Level_id+2) && (pk.Grade > profile_raw.Level_id-3) {
|
if (pk.Grade < profile_raw.Level_id+2) && (pk.Grade > profile_raw.Level_id-3) {
|
||||||
message += "\nВероятность поимки:"
|
message += "\nВероятность поимки:"
|
||||||
for i := range(pokememe.Locations) {
|
for i := range pokememe.Locations {
|
||||||
percentile, pokeballs := c.Getters.PossibilityRequiredPokeballs(pokememe.Locations[i].Id, pk.Grade, profile_raw.Level_id)
|
percentile, pokeballs := c.Getters.PossibilityRequiredPokeballs(pokememe.Locations[i].Id, pk.Grade, profile_raw.Level_id)
|
||||||
message += "\n" + pokememe.Locations[i].Name + " – "
|
message += "\n" + pokememe.Locations[i].Name + " – "
|
||||||
message += strconv.FormatFloat(percentile, 'f', 2, 64) + "% или "
|
message += strconv.FormatFloat(percentile, 'f', 2, 64) + "% или "
|
||||||
@ -122,7 +122,7 @@ func (t *Talkers) PokememeInfo(update tgbotapi.Update, player_raw dbmapping.Play
|
|||||||
|
|
||||||
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
|
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
|
||||||
keyboard := tgbotapi.InlineKeyboardMarkup{}
|
keyboard := tgbotapi.InlineKeyboardMarkup{}
|
||||||
for i := range(pokememe.Locations) {
|
for i := range pokememe.Locations {
|
||||||
var row []tgbotapi.InlineKeyboardButton
|
var row []tgbotapi.InlineKeyboardButton
|
||||||
btn := tgbotapi.NewInlineKeyboardButtonSwitch(pokememe.Locations[i].Symbol+pokememe.Locations[i].Name, pokememe.Locations[i].Symbol+pokememe.Locations[i].Name)
|
btn := tgbotapi.NewInlineKeyboardButtonSwitch(pokememe.Locations[i].Symbol+pokememe.Locations[i].Name, pokememe.Locations[i].Symbol+pokememe.Locations[i].Name)
|
||||||
row = append(row, btn)
|
row = append(row, btn)
|
||||||
|
@ -48,8 +48,8 @@ func (t *Talkers) ProfileMessage(update tgbotapi.Update, player_raw dbmapping.Pl
|
|||||||
}
|
}
|
||||||
|
|
||||||
attack_pm := 0
|
attack_pm := 0
|
||||||
for i := range(p_pk) {
|
for i := range p_pk {
|
||||||
for j := range(pokememes) {
|
for j := range pokememes {
|
||||||
if p_pk[i].Pokememe_id == pokememes[j].Id {
|
if p_pk[i].Pokememe_id == pokememes[j].Id {
|
||||||
single_attack := float64(pokememes[j].Attack)
|
single_attack := float64(pokememes[j].Attack)
|
||||||
single_attack = single_attack * float64(p_pk[i].Pokememe_lvl)
|
single_attack = single_attack * float64(p_pk[i].Pokememe_lvl)
|
||||||
@ -61,7 +61,6 @@ func (t *Talkers) ProfileMessage(update tgbotapi.Update, player_raw dbmapping.Pl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message := "*Профиль игрока "
|
message := "*Профиль игрока "
|
||||||
message += profile_raw.Nickname + "* (@" + profile_raw.TelegramNickname + ")\n"
|
message += profile_raw.Nickname + "* (@" + profile_raw.TelegramNickname + ")\n"
|
||||||
message += "\nЛига: " + league.Symbol + league.Name
|
message += "\nЛига: " + league.Symbol + league.Name
|
||||||
@ -78,8 +77,8 @@ func (t *Talkers) ProfileMessage(update tgbotapi.Update, player_raw dbmapping.Pl
|
|||||||
}
|
}
|
||||||
|
|
||||||
message += "\n🐱Покемемы:"
|
message += "\n🐱Покемемы:"
|
||||||
for i := range(p_pk) {
|
for i := range p_pk {
|
||||||
for j := range(pokememes) {
|
for j := range pokememes {
|
||||||
if p_pk[i].Pokememe_id == pokememes[j].Id {
|
if p_pk[i].Pokememe_id == pokememes[j].Id {
|
||||||
single_attack := float64(pokememes[j].Attack)
|
single_attack := float64(pokememes[j].Attack)
|
||||||
single_attack = single_attack * float64(p_pk[i].Pokememe_lvl)
|
single_attack = single_attack * float64(p_pk[i].Pokememe_lvl)
|
||||||
|
@ -21,7 +21,7 @@ func (t *Talkers) BestPokememesList(update tgbotapi.Update, player_raw dbmapping
|
|||||||
}
|
}
|
||||||
|
|
||||||
message := "*Лучшие покемемы для ловли*\n\n"
|
message := "*Лучшие покемемы для ловли*\n\n"
|
||||||
for i := range(pokememes) {
|
for i := range pokememes {
|
||||||
pk := pokememes[i].Pokememe
|
pk := pokememes[i].Pokememe
|
||||||
pk_l := pokememes[i].Locations
|
pk_l := pokememes[i].Locations
|
||||||
pk_e := pokememes[i].Elements
|
pk_e := pokememes[i].Elements
|
||||||
@ -29,12 +29,12 @@ func (t *Talkers) BestPokememesList(update tgbotapi.Update, player_raw dbmapping
|
|||||||
message += pk.Name + " (⚔"
|
message += pk.Name + " (⚔"
|
||||||
message += c.Parsers.ReturnPoints(pk.Attack)
|
message += c.Parsers.ReturnPoints(pk.Attack)
|
||||||
message += ", 🛡" + c.Parsers.ReturnPoints(pk.Defence) + ")"
|
message += ", 🛡" + c.Parsers.ReturnPoints(pk.Defence) + ")"
|
||||||
for i := range(pk_e) {
|
for i := range pk_e {
|
||||||
message += pk_e[i].Symbol
|
message += pk_e[i].Symbol
|
||||||
}
|
}
|
||||||
message += " /pk" + strconv.Itoa(pk.Id) + "\n"
|
message += " /pk" + strconv.Itoa(pk.Id) + "\n"
|
||||||
message += "Локации: "
|
message += "Локации: "
|
||||||
for i := range(pk_l) {
|
for i := range pk_l {
|
||||||
message += pk_l[i].Symbol + pk_l[i].Name
|
message += pk_l[i].Symbol + pk_l[i].Name
|
||||||
if i+1 < len(pk_l) {
|
if i+1 < len(pk_l) {
|
||||||
message += ", "
|
message += ", "
|
||||||
|
Reference in New Issue
Block a user