2017-10-11 06:53:50 +04:00
|
|
|
|
// i2_bot – Instinct PokememBro Bot
|
2018-05-02 07:25:39 +04:00
|
|
|
|
// Copyright (c) 2017-2018 Vladimir "fat0troll" Hodakov
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-11-21 06:06:32 +04:00
|
|
|
|
package users
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
|
|
|
|
import (
|
2017-10-18 07:03:34 +04:00
|
|
|
|
"regexp"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
2018-03-31 23:07:05 +04:00
|
|
|
|
|
|
|
|
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
|
|
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
|
|
|
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
2017-10-11 06:53:50 +04:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Internal functions
|
|
|
|
|
|
2017-11-21 06:06:32 +04:00
|
|
|
|
func (u *Users) fillProfilePokememe(profileID int, meme string, attack string, rarity string) {
|
2018-01-29 23:50:25 +04:00
|
|
|
|
spkRaw, err := c.DataCache.GetPokememeByName(meme)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
if err != nil {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error(err.Error())
|
2017-10-18 07:03:34 +04:00
|
|
|
|
} else {
|
2017-11-21 06:06:32 +04:00
|
|
|
|
attackInt := c.Statistics.GetPoints(attack)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
ppk := dbmapping.ProfilePokememe{}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
ppk.ProfileID = profileID
|
2018-01-29 23:50:25 +04:00
|
|
|
|
ppk.PokememeID = spkRaw.Pokememe.ID
|
2017-10-22 13:13:20 +04:00
|
|
|
|
ppk.PokememeAttack = attackInt
|
2017-10-18 09:39:50 +04:00
|
|
|
|
ppk.PokememeRarity = rarity
|
|
|
|
|
ppk.CreatedAt = time.Now().UTC()
|
2017-10-22 13:13:20 +04:00
|
|
|
|
_, err2 := c.Db.NamedExec("INSERT INTO `profiles_pokememes` VALUES(NULL, :profile_id, :pokememe_id, :pokememe_attack, :pokememe_rarity, :created_at)", &ppk)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
if err2 != nil {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error(err2.Error())
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// External functions
|
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
// ParseProfile parses user profile, forwarded from PokememBroBot, to database
|
2017-11-21 06:06:32 +04:00
|
|
|
|
func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Player) string {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
text := update.Message.Text
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Info(text)
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
profileStringsArray := strings.Split(text, "\n")
|
|
|
|
|
profileRunesArray := make([][]rune, 0)
|
|
|
|
|
for i := range profileStringsArray {
|
|
|
|
|
profileRunesArray = append(profileRunesArray, []rune(profileStringsArray[i]))
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2018-03-31 08:34:27 +04:00
|
|
|
|
league := datamapping.League{}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
telegramNickname := update.Message.From.UserName
|
2017-10-18 07:03:34 +04:00
|
|
|
|
nickname := ""
|
|
|
|
|
level := ""
|
2017-10-18 09:39:50 +04:00
|
|
|
|
levelInt := 0
|
2017-10-18 07:03:34 +04:00
|
|
|
|
exp := ""
|
2017-10-18 09:39:50 +04:00
|
|
|
|
expInt := 0
|
|
|
|
|
eggexp := ""
|
|
|
|
|
eggexpInt := 0
|
2017-10-18 07:03:34 +04:00
|
|
|
|
pokeballs := ""
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pokeballsInt := 0
|
2017-10-18 07:03:34 +04:00
|
|
|
|
wealth := ""
|
2017-10-18 09:39:50 +04:00
|
|
|
|
wealthInt := 0
|
2017-10-22 13:13:20 +04:00
|
|
|
|
pokememesWealth := ""
|
|
|
|
|
pokememesWealthInt := 0
|
2018-05-02 07:25:39 +04:00
|
|
|
|
crystals := ""
|
|
|
|
|
crystalsInt := 0
|
2017-10-18 07:03:34 +04:00
|
|
|
|
weapon := ""
|
|
|
|
|
pokememes := make(map[string]string)
|
2018-01-23 20:37:48 +04:00
|
|
|
|
powerInt := 0
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
// Filling information
|
|
|
|
|
// We don't know how many strings we got, so we iterating each other
|
2017-10-18 09:39:50 +04:00
|
|
|
|
for i := range profileRunesArray {
|
|
|
|
|
currentString := string(profileRunesArray[i])
|
|
|
|
|
currentRunes := profileRunesArray[i]
|
|
|
|
|
if strings.HasPrefix(currentString, "🈸") || strings.HasPrefix(currentString, "🈳 ") || strings.HasPrefix(currentString, "🈵") {
|
2018-01-29 23:50:25 +04:00
|
|
|
|
leagueRaw, err := c.DataCache.GetLeagueBySymbol(string(currentRunes[0]))
|
|
|
|
|
if err != nil {
|
|
|
|
|
c.Log.Error(err.Error())
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2018-01-29 23:50:25 +04:00
|
|
|
|
league = *leagueRaw
|
2017-10-18 09:39:50 +04:00
|
|
|
|
for j := range currentRunes {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
if j > 1 {
|
2017-10-18 09:39:50 +04:00
|
|
|
|
nickname += string(currentRunes[j])
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-11-26 15:28:55 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "id: ") {
|
|
|
|
|
realUserID := strings.TrimPrefix(currentString, "id: ")
|
|
|
|
|
c.Log.Debug("Profile user ID: " + realUserID)
|
|
|
|
|
realUID, _ := strconv.Atoi(realUserID)
|
|
|
|
|
if realUID != playerRaw.TelegramID {
|
|
|
|
|
return "fail"
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "👤Уровень:") {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
levelRx := regexp.MustCompile("\\d+")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
levelArray := levelRx.FindAllString(currentString, -1)
|
|
|
|
|
if len(levelArray) < 1 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error("Level string broken")
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
level = levelArray[0]
|
|
|
|
|
levelInt, _ = strconv.Atoi(level)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "🎓Опыт") {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
expRx := regexp.MustCompile("\\d+")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
expArray := expRx.FindAllString(currentString, -1)
|
|
|
|
|
if len(expArray) < 4 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error("Exp string broken")
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
exp = expArray[0]
|
|
|
|
|
expInt, _ = strconv.Atoi(exp)
|
|
|
|
|
eggexp = expArray[2]
|
|
|
|
|
eggexpInt, _ = strconv.Atoi(eggexp)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "⭕Покеболы") {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
pkbRx := regexp.MustCompile("\\d+")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pkbArray := pkbRx.FindAllString(currentString, -1)
|
|
|
|
|
if len(pkbArray) < 2 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error("Pokeballs string broken")
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pokeballs = pkbArray[1]
|
|
|
|
|
pokeballsInt, _ = strconv.Atoi(pokeballs)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "💲") {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
wealthRx := regexp.MustCompile("(\\d|\\.|K|M)+")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
wealthArray := wealthRx.FindAllString(currentString, -1)
|
|
|
|
|
if len(wealthArray) < 2 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error("Wealth string broken")
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
wealth = wealthArray[0]
|
2017-11-21 06:06:32 +04:00
|
|
|
|
wealthInt = c.Statistics.GetPoints(wealth)
|
2018-05-02 07:25:39 +04:00
|
|
|
|
crystals = wealthArray[1]
|
|
|
|
|
crystalsInt = c.Statistics.GetPoints(crystals)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "🔫") {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
// We need NEXT string!
|
2017-10-18 09:39:50 +04:00
|
|
|
|
weaponType := strings.Replace(currentString, "🔫 ", "", 1)
|
2017-11-26 19:38:25 +04:00
|
|
|
|
wnRx := regexp.MustCompile("(.+)(ита|ёры)")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
weapon = wnRx.FindString(weaponType)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if strings.HasPrefix(currentString, "🐱Покемемы: ") {
|
2017-12-06 14:43:05 +04:00
|
|
|
|
pkmnumRx := regexp.MustCompile(`(\d|\.|K|M)+`)
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pkNumArray := pkmnumRx.FindAllString(currentString, -1)
|
2017-10-22 13:13:20 +04:00
|
|
|
|
if len(pkNumArray) < 3 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Error("Pokememes count broken")
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pokememesCount, _ := strconv.Atoi(pkNumArray[0])
|
2017-10-22 13:13:20 +04:00
|
|
|
|
pokememesWealth = pkNumArray[2]
|
2017-11-21 06:06:32 +04:00
|
|
|
|
pokememesWealthInt = c.Statistics.GetPoints(pokememesWealth)
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if pokememesCount > 0 {
|
|
|
|
|
for pi := 0; pi < pokememesCount; pi++ {
|
|
|
|
|
pokememeString := string(profileRunesArray[i+1+pi])
|
2017-10-18 07:03:34 +04:00
|
|
|
|
attackRx := regexp.MustCompile("(\\d|\\.|K|M)+")
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pkPointsArray := attackRx.FindAllString(pokememeString, -1)
|
2018-03-31 14:51:32 +04:00
|
|
|
|
pkAttack := ""
|
|
|
|
|
if strings.Contains(pokememeString, "🔟") {
|
|
|
|
|
pkAttack = pkPointsArray[0]
|
2018-03-31 23:07:05 +04:00
|
|
|
|
} else if strings.Contains(pokememeString, "⃣") {
|
2018-03-31 14:51:32 +04:00
|
|
|
|
pkAttack = pkPointsArray[1]
|
2018-03-31 23:07:05 +04:00
|
|
|
|
} else {
|
|
|
|
|
// Something went wrong
|
|
|
|
|
return c.Talkers.BotError(update)
|
2018-03-31 14:51:32 +04:00
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
pkName := strings.Split(pokememeString, "+")[0]
|
|
|
|
|
pkName = strings.Replace(pkName, " ⭐", "", 1)
|
2018-03-31 10:05:59 +04:00
|
|
|
|
if strings.Contains(pkName, "🔟") {
|
|
|
|
|
pkName = strings.Split(pkName, "🔟 ")[1]
|
|
|
|
|
} else {
|
|
|
|
|
pkName = strings.Split(pkName, "⃣ ")[1]
|
|
|
|
|
}
|
2017-12-02 18:25:24 +04:00
|
|
|
|
pokememes[strconv.Itoa(pi)+"_"+pkName] = pkAttack
|
2017-11-21 06:06:32 +04:00
|
|
|
|
powerInt += c.Statistics.GetPoints(pkAttack)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Debug("Telegram nickname: " + telegramNickname)
|
|
|
|
|
c.Log.Debug("Nickname: " + nickname)
|
|
|
|
|
c.Log.Debug("League: " + league.Name)
|
|
|
|
|
c.Log.Debug("Level: " + level)
|
|
|
|
|
c.Log.Debugln(levelInt)
|
|
|
|
|
c.Log.Debug("Exp: " + exp)
|
|
|
|
|
c.Log.Debugln(expInt)
|
|
|
|
|
c.Log.Debug("Egg exp: " + eggexp)
|
|
|
|
|
c.Log.Debugln(eggexpInt)
|
|
|
|
|
c.Log.Debug("Pokeballs: " + pokeballs)
|
|
|
|
|
c.Log.Debugln(pokeballsInt)
|
|
|
|
|
c.Log.Debug("Wealth: " + wealth)
|
|
|
|
|
c.Log.Debugln(wealthInt)
|
2018-05-02 07:25:39 +04:00
|
|
|
|
c.Log.Debug("crystals: " + crystals)
|
|
|
|
|
c.Log.Debugln(crystalsInt)
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Debug("Weapon: " + weapon)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
if len(pokememes) > 0 {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Debug("Hand cost: " + pokememesWealth)
|
|
|
|
|
c.Log.Debugln(pokememesWealthInt)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
for meme, attack := range pokememes {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Debug(meme + ": " + attack)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2017-11-14 03:44:21 +04:00
|
|
|
|
c.Log.Debug("Hand is empty.")
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 07:03:34 +04:00
|
|
|
|
// Information is gathered, let's create profile in database!
|
2018-01-29 23:50:25 +04:00
|
|
|
|
weaponRaw, err := c.DataCache.GetWeaponTypeByName(weapon)
|
|
|
|
|
if err != nil {
|
|
|
|
|
c.Log.Error(err.Error())
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
if playerRaw.LeagueID == 0 {
|
2017-10-18 07:03:34 +04:00
|
|
|
|
// Updating player with league
|
2017-10-18 09:39:50 +04:00
|
|
|
|
playerRaw.LeagueID = league.ID
|
|
|
|
|
if playerRaw.Status == "nobody" {
|
|
|
|
|
playerRaw.Status = "common"
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2018-01-29 23:50:25 +04:00
|
|
|
|
_, err = c.DataCache.UpdatePlayerFields(playerRaw)
|
|
|
|
|
if err != nil {
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-18 09:39:50 +04:00
|
|
|
|
} else if playerRaw.LeagueID != league.ID {
|
2018-01-29 23:50:25 +04:00
|
|
|
|
// User changed league, beware!
|
2017-10-18 09:39:50 +04:00
|
|
|
|
playerRaw.LeagueID = league.ID
|
|
|
|
|
playerRaw.Status = "league_changed"
|
2018-01-29 23:50:25 +04:00
|
|
|
|
_, err = c.DataCache.UpdatePlayerFields(playerRaw)
|
|
|
|
|
if err != nil {
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-10-18 09:39:50 +04:00
|
|
|
|
profileRaw := dbmapping.Profile{}
|
|
|
|
|
profileRaw.PlayerID = playerRaw.ID
|
|
|
|
|
profileRaw.Nickname = nickname
|
|
|
|
|
profileRaw.TelegramNickname = telegramNickname
|
|
|
|
|
profileRaw.LevelID = levelInt
|
|
|
|
|
profileRaw.Pokeballs = pokeballsInt
|
|
|
|
|
profileRaw.Wealth = wealthInt
|
2017-10-22 13:13:20 +04:00
|
|
|
|
profileRaw.PokememesWealth = pokememesWealthInt
|
2017-10-18 09:39:50 +04:00
|
|
|
|
profileRaw.Exp = expInt
|
|
|
|
|
profileRaw.EggExp = eggexpInt
|
|
|
|
|
profileRaw.Power = powerInt
|
2018-01-30 18:41:23 +04:00
|
|
|
|
if weaponRaw != nil {
|
|
|
|
|
profileRaw.WeaponID = weaponRaw.ID
|
|
|
|
|
} else {
|
|
|
|
|
profileRaw.WeaponID = 0
|
|
|
|
|
}
|
2018-05-02 07:25:39 +04:00
|
|
|
|
profileRaw.Crystals = crystalsInt
|
2017-10-18 09:39:50 +04:00
|
|
|
|
profileRaw.CreatedAt = time.Now().UTC()
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2018-01-29 23:50:25 +04:00
|
|
|
|
newProfileID, err := c.DataCache.AddProfile(&profileRaw)
|
|
|
|
|
if err != nil {
|
|
|
|
|
c.Log.Error(err.Error())
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2018-01-29 23:50:25 +04:00
|
|
|
|
_, err = c.DataCache.GetProfileByID(newProfileID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
c.Log.Error(err.Error())
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2018-01-29 23:50:25 +04:00
|
|
|
|
err = c.DataCache.UpdatePlayerTimestamp(playerRaw.ID)
|
|
|
|
|
if err != nil {
|
2017-11-21 06:06:32 +04:00
|
|
|
|
u.profileAddFailureMessage(update)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "fail"
|
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-12-28 05:57:51 +04:00
|
|
|
|
for nMeme, attack := range pokememes {
|
|
|
|
|
memeAry := strings.Split(nMeme, "_")
|
2017-12-02 18:25:24 +04:00
|
|
|
|
meme := memeAry[1]
|
2017-10-18 07:03:34 +04:00
|
|
|
|
rarity := "common"
|
|
|
|
|
if strings.HasPrefix(meme, "🔸") {
|
|
|
|
|
rarity = "rare"
|
|
|
|
|
meme = strings.Replace(meme, "🔸", "", 1)
|
|
|
|
|
}
|
2017-10-22 13:13:20 +04:00
|
|
|
|
if strings.HasPrefix(meme, "🔶") {
|
|
|
|
|
rarity = "super rare"
|
|
|
|
|
meme = strings.Replace(meme, "🔶", "", 1)
|
|
|
|
|
}
|
|
|
|
|
if strings.HasPrefix(meme, "🔹") {
|
|
|
|
|
rarity = "liber"
|
|
|
|
|
meme = strings.Replace(meme, "🔹", "", 1)
|
|
|
|
|
}
|
|
|
|
|
if strings.HasPrefix(meme, "🔷") {
|
|
|
|
|
rarity = "super liber"
|
|
|
|
|
meme = strings.Replace(meme, "🔷", "", 1)
|
|
|
|
|
}
|
2018-01-29 23:50:25 +04:00
|
|
|
|
if strings.HasPrefix(meme, "❄") {
|
2017-12-28 05:57:51 +04:00
|
|
|
|
rarity = "new year"
|
2018-01-29 23:50:25 +04:00
|
|
|
|
meme = strings.Replace(meme, "❄", "", 1)
|
2017-12-28 05:57:51 +04:00
|
|
|
|
}
|
2018-02-13 23:10:26 +04:00
|
|
|
|
if strings.HasPrefix(meme, "❤") {
|
2018-02-13 22:05:32 +04:00
|
|
|
|
rarity = "valentine"
|
2018-02-13 23:14:14 +04:00
|
|
|
|
meme = strings.Replace(meme, "❤", "", 1)
|
2018-02-13 22:05:32 +04:00
|
|
|
|
}
|
2018-01-29 23:50:25 +04:00
|
|
|
|
u.fillProfilePokememe(newProfileID, meme, attack, rarity)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
}
|
2017-10-11 06:53:50 +04:00
|
|
|
|
|
2017-11-29 10:36:36 +04:00
|
|
|
|
u.profileAddSuccessMessage(update, league.ID, profileRaw.LevelID)
|
2017-10-18 07:03:34 +04:00
|
|
|
|
return "ok"
|
2017-10-11 06:53:50 +04:00
|
|
|
|
}
|