Esempio n. 1
0
def comcb(bot, update):
    d = get_database()
    try:
        query = update.callback_query
        data = query.data
        cid = query.from_user.id
        if data.find('box') != -1:
            result = "B O X \n====================\n"
            trainer = Trainer(cid)
            #trainer.load_values(d, "id")
            pokes = trainer.get_all_pkmn(
                d,
                "id, name, level, currenthp, gender, hp_exp, hp_dv, species_id, current_status"
            )  #all_pkmn
            id = 1
            if pokes == []:
                result += "Nothing here...\n"
            for poke in pokes:  #[startval:startval+19]:
                #poke.load_values(d, "name, level, currenthp, gender, hp_exp, hp_dv, species_id, current_status")
                result += """ ({0}) {1} [{5}] Lv. {2} \n    HP: {3}/{4}\n""".format(
                    id, poke.name, poke.level, poke.currenthp,
                    poke.calculate_max_hp(), poke.gender)
                id += 1
            result += """====================\n
/binfo <boxnumber> 
  to get more information 
  about your Pokémon
  in the box
/tinfo <boxnumber> 
  to get more information 
  about your Pokémon
  in tyour team
/box2team <box id>
  move a pokemon from 
  your box to your team
/team2box <team idr>
  move a pokemon from 
  your team to your box
/change <from> <to>
  change the team id 
  of your Pokémon
/release <box id>
  release a pokemon
/trade <box id> <user id>
  trade pokemon"""
            bot.send_message(cid, result)
    finally:
        free_database(d)
Esempio n. 2
0
def binfo(bot, update):
    """

    :param bot:
    :param update:
    :return:
    """
    d = get_database()
    try:
        data = update.message.text
        id = update.message.from_user.id
        trainer = Trainer(id)
        trainer.load_values(d, "menu_id")
        print(data[7:])
        if trainer.menu_id == 3:
            pokes = trainer.get_all_pkmn(
                d,
                "id, name, level, currenthp, gender, hp_exp, hp_dv, species_id, current_status"
            )
            show_poke_info(bot, id, data, pokes)
    finally:
        free_database(d)