Beispiel #1
0
 def run(self):
     player_1 = list(self.teams[0].items())[0]
     player_2 = list(self.teams[1].items())[0]
     bot_methods.send_image(image_generator.create_duel_image((self.get_image(player_1[0]),
                                                               self.get_image(player_2[0]))),
                            self.chat_id, message=player_1[1]['unit_dict']['name'] + '                 \              ' + player_2[1]['unit_dict']['name'])
     result = self.run_fight(*[{chat_id: team[chat_id]['unit_dict'] for chat_id in team} for team in self.teams])
Beispiel #2
0
 def announce(self, lang_tuple, image=None):
     for listener in [listener for listener in self.listeners]:
         text = lang_tuple.translate(listener.lang)
         if image is None:
             bot_methods.send_message(listener.chat_id, text)
         else:
             bot_methods.send_image(image, listener.chat_id, text)
Beispiel #3
0
 def run(self):
     path = file_manager.my_path + '/files/images/backgrounds/camp.jpg'
     for team in self.teams:
         bot_methods.send_image(
             image_generator.create_dungeon_image(path, (self.get_image(key)
                                                         for key in team)),
             self.chat_id)
     result = self.run_fight(
         *[{chat_id: team[chat_id]['unit_dict']
            for chat_id in team} for team in self.teams])
Beispiel #4
0
 def run(self):
     path = file_manager.my_path + '/files/images/backgrounds/camp.jpg'
     image = image_generator.create_dungeon_image(path,
                                                  (self.get_image(key)
                                                   for key in self.team))
     caption = ', '.join(
         [self[key]['unit_dict']['name'] for key in self.team.keys()])
     bot_methods.send_image(image,
                            self.attack_action.attacker_lobby.chat_id,
                            message=caption)
     bot_methods.send_image(image, self.chat_id, message=caption)
     self.attack_action.attack_ready = True
     if self.attack_action.attack_ready:
         self.attack_action.start()
Beispiel #5
0
def start(message):
    from fight.unit_files import human, red_oak, bloodbug, ogre
    my_unit = human.Human(message.from_user.first_name)
    my_unit.weapon = weapons.Hatchet()
    enemy_class = red_oak.RedOak
    enemy = enemy_class()
    bot_methods.send_image(chat_id=message.chat.id,
                           message='111',
                           image=open(enemy.image, 'rb'))
    fight_main.thread_fight([{
        message.chat.id: my_unit.to_dict()
    }, {
        (enemy_class, 1): enemy.to_dict()
    }],
                            chat_id=message.chat.id)
Beispiel #6
0
 def run(self):
     path = file_manager.my_path + '/files/images/backgrounds/camp.jpg'
     bot_methods.send_image(image_generator.create_dungeon_image(path,
                                                                 (self.get_image(key) for key in self.team)),
                            self.chat_id)
     # len(self.teams)
     self.complexity = 1
     self.create_dungeon_map()
     dynamic_dicts.dungeons[self.id] = self
     self.add_party(player_list=self.team)
     for member in self.party.members:
         dynamic_dicts.dungeons[member.chat_id] = self
     bot_methods.send_message(self.chat_id, localization.LangTuple('utils', 'fight_start')
                              .translate(self.lang))
     del dynamic_dicts.lobby_list[self.id]
     self.map.start()
Beispiel #7
0
 def run(self):
     path = file_manager.my_path + '/files/images/backgrounds/camp.jpg'
     bot_methods.send_image(
         image_generator.create_dungeon_image(path, (self.get_image(key)
                                                     for key in self.team)),
         self.chat_id,
         message=','.join(
             [self[key]['unit_dict']['name'] for key in self.team.keys()]))
     result = self.run_fight(
         *[{
             chat_id: self.team[chat_id]['unit_dict']
             for chat_id in self.team
         },
           {
               units.units_dict[mob]: units.units_dict[mob]().to_dict()
               for mob in self.mob_list
           }])
Beispiel #8
0
 def send_message(self, text, reply_markup=None, image=None):
     if image is None:
         self.message_id = bot_methods.send_message(
             self.chat_id, text, reply_markup=reply_markup).message_id
     else:
         self.message_id = bot_methods.send_image(
             image, self.chat_id, text,
             reply_markup=reply_markup).message_id
     return self.message_id
Beispiel #9
0
 def send_lobby(self):
     if self.image is None:
         message = bot_methods.send_message(self.chat_id,
                                            self.create_lobby(),
                                            reply_markup=self.keyboard())
     else:
         message = bot_methods.send_image(open(self.image, 'rb'),
                                          self.chat_id,
                                          message=self.create_lobby(),
                                          reply_markup=self.keyboard())
     self.message_id = message.message_id