예제 #1
0
 def handler(self, call):
     bot_methods.err(call.data)
     data = call.data.split('_')
     action = data[3]
     if action == 'map':
         bot_methods.bot.edit_message_reply_markup(
             chat_id=call.from_user.id, message_id=call.message.message_id)
         for member in self.dungeon.party.members:
             member.occupied = False
         self.dungeon.update_map(new=True)
     elif action == 'sneak':
         if engine.roll_chance(50):
             self.state = 'sneaked'
             for member in self.dungeon.party.members:
                 member.delete_message()
             self.dungeon.party.send_message(
                 self.get_lang_tuple('text_1'),
                 image=self.image,
                 reply_markup=self.get_action_keyboard())
         else:
             self.state = 'attacked'
             for member in self.dungeon.party.members:
                 member.delete_message()
             image = create_dungeon_image(
                 './files/images/backgrounds/dark_forest.jpg',
                 self.mobs.get_image_tuples())
             self.fight(first_turn='mobs')
     elif action == 'leave':
         for member in self.dungeon.party.members:
             member.delete_message()
             member.occupied = False
         self.dungeon.party.send_message(self.get_lang_tuple('text_3'),
                                         image=self.image)
         self.dungeon.update_map(new=True)
     elif action == 'attack':
         self.state = 'attacked'
         for member in self.dungeon.party.members:
             member.delete_message()
         image = create_dungeon_image(
             'D:\YandexDisk\Veganwars\Veganwars\\files\images\\backgrounds\dark_forest.jpg',
             self.mobs.get_image_tuples())
         self.dungeon.party.send_message(self.get_lang_tuple('text_2'),
                                         image=image)
         self.fight()
     elif action == 'sneak_attack':
         self.state = 'attacked'
         for member in self.dungeon.party.members:
             member.delete_message()
         image = create_dungeon_image(
             'D:\YandexDisk\Veganwars\Veganwars\\files\images\\backgrounds\dark_forest.jpg',
             self.mobs.get_image_tuples())
         self.dungeon.party.send_message(self.get_lang_tuple('text_2'),
                                         image=image)
         self.fight(first_turn='party')
예제 #2
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])
예제 #3
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()
예제 #4
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()
예제 #5
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
           }])
예제 #6
0
 def handler(self, call):
     bot_methods.err(call.data)
     data = call.data.split('_')
     action = data[3]
     if action == 'map':
         bot_methods.bot.edit_message_reply_markup(
             chat_id=call.from_user.id, message_id=call.message.message_id)
         for member in self.dungeon.party.members:
             member.occupied = False
         self.dungeon.update_map(new=True)
     elif action == 'scout':
         self.state = 'scouted'
         self.reset_message(self.image, 'text_1')
     elif action == 'rush':
         self.state = 'rushed'
         image = create_dungeon_image(
             'D:\YandexDisk\Veganwars\Veganwars\\files\images\\backgrounds\dark_forest.jpg',
             self.mobs.get_image_tuples())
         self.reset_message(image, 'text_2', keyboard_func=None)
         self.fight()
     elif action == 'victory':
         self.state = 'scouted'
         self.reset_message(self.image, 'text_1')
예제 #7
0
 def create_images(self):
     if self.mobs is not None:
         self.mob_image = image_generator.create_dungeon_image(self.image_file, self.mobs.get_image_tuples())