Reflect latest game update
So, now we can handle 10th grade pokememes (and any two-digit grade pokememes in future). Also, /best and /advice commands for 9th-level players respect new pokememes.
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
package pokedexer
|
||||
|
||||
import (
|
||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||
"sort"
|
||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -40,14 +40,16 @@ func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*dbma
|
||||
}
|
||||
|
||||
allPokememes := c.DataCache.GetAllPokememes()
|
||||
neededGrade := 0
|
||||
if profileRaw.LevelID < 10 {
|
||||
neededGrade = profileRaw.LevelID + 1
|
||||
} else {
|
||||
neededGrade = 10
|
||||
}
|
||||
|
||||
c.Log.Debug("This player will search for grade: " + strconv.Itoa(neededGrade))
|
||||
|
||||
for i := range allPokememes {
|
||||
neededGrade := 0
|
||||
if profileRaw.LevelID < 9 {
|
||||
neededGrade = profileRaw.LevelID + 1
|
||||
} else {
|
||||
neededGrade = 9
|
||||
}
|
||||
if allPokememes[i].Pokememe.Grade == neededGrade {
|
||||
matchLeague := false
|
||||
if profileRaw.LevelID < 4 {
|
||||
|
@@ -30,8 +30,17 @@ func (p *Pokedexer) ParsePokememe(update *tgbotapi.Update, playerRaw *dbmapping.
|
||||
c.Log.Debug("Processing string: " + pokememeStringsArray[i])
|
||||
if strings.Contains(pokememeStringsArray[i], "⃣") {
|
||||
// Strings with name and grade
|
||||
pokememeData["grade"] = string(pokememeRunesArray[i][0])
|
||||
pokememeData["name"] = string(pokememeRunesArray[i][3:])
|
||||
splitGradeAndName := strings.Split(string(pokememeRunesArray[i]), " ")
|
||||
gradeNumberRegexp := regexp.MustCompile("[0-9]+")
|
||||
pokememeData["grade"] = strings.Join(gradeNumberRegexp.FindAllString(splitGradeAndName[0], -1), "")
|
||||
pokememeData["name"] = strings.Join(splitGradeAndName[1:], " ")
|
||||
}
|
||||
|
||||
// Special case: "10" emoji
|
||||
if strings.Contains(pokememeStringsArray[i], "🔟") {
|
||||
// Strings with name and grade
|
||||
pokememeData["grade"] = "10"
|
||||
pokememeData["name"] = string(pokememeStringsArray[i][5:])
|
||||
}
|
||||
|
||||
if i == 1 {
|
||||
|
@@ -33,8 +33,8 @@ func (p *Pokedexer) pokememesListing(update *tgbotapi.Update, page int, pokememe
|
||||
if (i+1 > 50*(page-1)) && (i+1 < (50*page)+1) {
|
||||
pk := pokememesArray[i].Pokememe
|
||||
pkE := pokememesArray[i].Elements
|
||||
message += strconv.Itoa(i+1) + ". " + strconv.Itoa(pk.Grade)
|
||||
message += "⃣ *" + pk.Name
|
||||
message += strconv.Itoa(i+1) + ". *[" + strconv.Itoa(pk.Grade)
|
||||
message += "]* *" + pk.Name
|
||||
message += "* (" + c.Statistics.GetPrintablePoints(pk.HP) + "-" + c.Statistics.GetPrintablePoints(pk.MP) + ") ⚔️ *"
|
||||
message += c.Statistics.GetPrintablePoints(pk.Attack) + "* \\["
|
||||
for j := range pkE {
|
||||
|
@@ -42,7 +42,7 @@ func (p *Pokedexer) AdvicePokememesList(update *tgbotapi.Update, playerRaw *dbma
|
||||
pk := pokememes[i].Pokememe
|
||||
pkL := pokememes[i].Locations
|
||||
pkE := pokememes[i].Elements
|
||||
message += strconv.Itoa(pk.Grade) + "⃣ "
|
||||
message += "*[" + strconv.Itoa(pk.Grade) + "]* "
|
||||
message += pk.Name + " (⚔"
|
||||
message += c.Statistics.GetPrintablePoints(pk.Attack)
|
||||
message += ", 🛡" + c.Statistics.GetPrintablePoints(pk.Defence) + ")"
|
||||
@@ -118,7 +118,7 @@ func (p *Pokedexer) PokememeInfo(update *tgbotapi.Update, playerRaw *dbmapping.P
|
||||
|
||||
pk := pokememe.Pokememe
|
||||
|
||||
message := strconv.Itoa(pk.Grade) + "⃣ *" + pk.Name + "*\n"
|
||||
message := "*[" + strconv.Itoa(pk.Grade) + "]* *" + pk.Name + "*\n"
|
||||
message += pk.Description + "\n\n"
|
||||
message += "Элементы:"
|
||||
for i := range pokememe.Elements {
|
||||
|
Reference in New Issue
Block a user