from bezmouse import *
import pyautogui
import time
import random
import importlib.machinery

visitor_lib = importlib.machinery.SourceFileLoader('visitor_lib', 'visitor_lib/visitor_lib.py').load_module()


def faucetclaims():

	captcha_reps = 0

	while True:
		visitor_lib.browser_open_url('https://faucet.claims/claim')

		time.sleep(random.randint(7000, 10000)/1000)

		visitor_lib.move_to_area_relative("faucetclaims/claim.png", -209, 5, 509, 32, True)
		time.sleep(random.randint(4000, 5000)/1000)

		visitor_lib.move_to_area_relative("faucetclaims/claim2.png", -219, 3, 519, 32, True)
		time.sleep(random.randint(4000, 5000)/1000)

		if not visitor_lib.solve_captcha_buster() and captcha_reps < 3:
			captcha_reps += 1
			time.sleep(random.randint(10, 20))
			continue

		success = visitor_lib.move_to_area_relative("faucetclaims/claim3.png", -176, 8, 472, 30, True)


		time.sleep((random.randint(200, 1000)/1000)*60)

		return success



faucetclaims_settings = {
	'collection_amount_usd': 0.0009,
	'collection_interval_minutes': 5,
	'collection_interval_additional_minutes_max': 3,
	'rest_at_hour_min': 8,
	'rest_at_hour_max': 9,
	'hours_rest_min': 0,
	'hours_rest_max': 1,
	'skip_every_min_collections': 15,
	'skip_every_max_collections': 20,
	'skip_by_min_minutes': 2,
	'skip_by_max_minutes': 3
}

