Archived
1

/best for low-levels shows all pokememes of next grade

This commit is contained in:
Vladimir Hodakov 2017-11-29 19:59:51 +04:00
parent 099898d991
commit da8fe3f3e8
2 changed files with 15 additions and 7 deletions

View File

@ -105,11 +105,19 @@ func (p *Pokedexer) getBestPokememes(playerID int) ([]dbmapping.PokememeFull, bo
// TODO: make it more complicated // TODO: make it more complicated
pokememes := []dbmapping.Pokememe{} pokememes := []dbmapping.Pokememe{}
if profileRaw.LevelID < 4 {
err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT * FROM pokememes WHERE grade = ? ORDER BY attack DESC"), profileRaw.LevelID+1)
if err != nil {
c.Log.Error(err)
return pokememesArray, false
}
} else {
err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1) err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1)
if err != nil { if err != nil {
c.Log.Error(err) c.Log.Error(err)
return pokememesArray, false return pokememesArray, false
} }
}
pokememesArray, ok = p.formFullPokememes(pokememes) pokememesArray, ok = p.formFullPokememes(pokememes)
return pokememesArray, ok return pokememesArray, ok

View File

@ -477,12 +477,12 @@ func (s *Squader) ProcessMessage(update *tgbotapi.Update, chatRaw *dbmapping.Cha
} }
if !isChatValid { if !isChatValid {
switch newUsers[i].UserName { switch strings.ToLower(newUsers[i].UserName) {
case "gantz_yaka": case "gantz_yaka":
messageProcessed = true messageProcessed = true
case "@agentpb": case "agentpb":
messageProcessed = true messageProcessed = true
case "@pbhelp": case "pbhelp":
messageProcessed = true messageProcessed = true
default: default:
s.kickUserFromSquadChat(&newUsers[i], chatRaw) s.kickUserFromSquadChat(&newUsers[i], chatRaw)