示例#1
0
    async def __call__(self, *args, **kwargs):
        self.session = logged_in_session()

        time_to_next_raid = self.time_of_next_raid - time()

        if time_to_next_raid > 0:
            info_logger_for_future_events('Raid was recently. Next raid in: ',
                                          time_to_next_raid)
            await sleep(time_to_next_raid)
            await self.__call__()

        self.parse_troops_amount()

        # If none of troops are available then wait.
        if not self.what_troops_available():
            info_logger_for_future_events(
                'Troops are not available. Waiting till... ', 3600)
            await sleep(3600)
            await self.__call__()

        self.send_troops()
        self.save_next_raid_time()
        time_to_next_raid = self.time_of_next_raid - time()

        info_logger_for_future_events('Raiding... Next raid in: ',
                                      time_to_next_raid)
        await sleep(time_to_next_raid)
        await self.__call__()
示例#2
0
    async def __call__(self, *args, **kwargs):
        self.session = logged_in_session()
        self.set_parser_of_main_page()
        check_adventure(self.session, self.parser_main_page)
        await self.check_queue()
        self.set_parser_location_to_build()

        successfully_built = await self.build()

        # Trying to build something until success then return True.
        return True if successfully_built else await self.__call__()
示例#3
0
 def __init__(self, barrack_url=None, troops=None, attack_type=None):
     self.barrack_url = barrack_url
     self.session = logged_in_session()
     self.troops = dict(troops)
     self.coords = None
     self.type = dict(attack_type)
示例#4
0
 def __init__(self, dealer_url = None, coords = None):
     self.dealer_url = dealer_url
     self.coords = dict(coords)
     self.session = logged_in_session()
示例#5
0
 def __init__(self, message_url=None):
     self.message_url = message_url
     self.messages_page_parser = None
     self.session = logged_in_session()