Ejemplo n.º 1
0
    def perform_action(self):

        players = self.get_game_state().get_players()
        if players:
            friend = players[0]
        else:
            logger.info(u'Нет друзей удовлетворяющих условиям фильтра')
            self.get_game_state().set_remote_stop(True)
            self.get_params().exclude_players = []
            return

        self.location_id = self.get_game_state().get_players_location(friend.id)
        self.get_params().exclude_players.append(friend.id)

        logger.info(u'*' * 56)
        logger.info(u'Осталось: %i игроков' % len(self.get_game_state().get_players()))
        logger.info(u'Страница: vk.com/id%s\t\tИмя:    %s' %
                    (friend.id, friend.name if hasattr(friend, 'name') else u'---'))
        logger.info(u'Уровень:  %s\t\t\tОпыт:   %i' % ((u'%i   ' % friend.level)[:4], friend.exp))
        logger.info(u'Статус:   %s\t\t\tОстров: %s' %
                    (self.get_item_reader().get(friend.playerStatus).name, self.get_location_name(self.location_id)))
        if hasattr(friend, 'accessDate'):
            logger.info(u'Отсутствует: %s' % ' '.join(timestamp_to_str(abs(int(friend.accessDate)))))

        change_location_event = ChangeLocation(user=friend.id, locationId=self.location_id)
        self.send_event([change_location_event])
        self.get_game_state().set_current_user(friend)
        self.get_game_state().clear_pickups()
Ejemplo n.º 2
0
    def show_game_stats(self):

        buyed_brains = 0
        for buyed_brain in self.game_state.get_state().buyedBrains:
            buyed_brains += buyed_brain.count

        logger.info(u'%s КРАТКАЯ ИНФОРМАЦИЯ %s' % (u'*' * 18, u'*' * 18))

        logger.info(u'Аккаунт: %s' % self.account.user_name)
        logger.info(u'Монеты: %i' % self.game_state.get_state().gameMoney)
        logger.info(u'Зомбаксы: %i' % self.game_state.get_state().cashMoney)
        logger.info(u'Опыт: %i' % self.game_state.get_state().experience)
        logger.info(u'Уровень: %i' % self.game_state.get_state().level)
        logger.info(u'Мозги: %i (%i/%i закопанных и %i платных)' %
                    (self.game_state.get_state().brainsCount +
                     len([x for x in self.game_state.get_state().burySlots if x.enabled and
                          hasattr(x, u'user')]) + buyed_brains,
                     len([x for x in self.game_state.get_state().burySlots if x.enabled and
                          hasattr(x, u'user')]),
                     len([x for x in self.game_state.get_state().burySlots if x.enabled]),
                     buyed_brains))

        logger.info(u'Остров: %s' %
                    self.game_item_reader.get(self.game_state.get_state().locationId).name)

        for show_item in self.account.params().show_count_on_start:
            show_item_obj = self.game_item_reader.get(show_item)
            if show_item_obj.type == u'collection':
                logger.info(u'%s: %i шт' %
                            (show_item_obj.name, self.game_state.count_collection(show_item_obj.items)))
            elif show_item_obj.type == u'collectionItem':
                logger.info(u'%s: %i шт' %
                            (show_item_obj.name, self.game_state.count_collection_item(show_item)))
            else:
                logger.info(u'%s: %i шт' % (show_item_obj.name, self.game_state.count_storage(show_item)))
        for buff in self.game_state.get_state().buffs.list:
            buff_obj = self.game_item_reader.get(buff.item)
            if buff.expire.type == u'time' and int(buff.expire.endDate) > 0:
                logger.info(u'%s: %s' % (buff_obj.name, ' '.join(timestamp_to_str(int(buff.expire.endDate)))))

        logger.info(u'*' * 56)