-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.py
108 lines (92 loc) · 4.01 KB
/
configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import os
import json
# The name of the app, to check if it's running
TARGET_APP_PKG = "com.alibaba.aliexpresshd/com.aliexpress.module.webview"
# If you run the script directly on mobile, set this to True to disable
# incompatible functions, like real-time image view, and configure for this
RUN_ON_MOBILE = False
# If you want to check the energy level, you need Tesseract installed and configured
# When the energy level is under 2, the game will exit
CHECK_ENERGY_LEVEL = True
# Auto-press the generator when no match is found, only if check energy level is enabled
if CHECK_ENERGY_LEVEL:
# Generator positions to press, in a list
GENERATOR_POSITIONS = [1, 2, 3, 4]
# When there's no match, generate objects from each of these generators
# Minimum energy to generate items
MIN_ENERGY_LEVEL = 3
# Get the energy from the 15 seconds product list view
AUTO_FARM_ENERGY = True and CHECK_ENERGY_LEVEL
# Only try to get energy 3 times
MAX_FARM_SESSIONS = 3
# The first 10 squares will be ignored. Adjust to your number of e.g., generators.
IGNORED_MATCH_POSITIONS = 9
# If your ignored position aren't in order then you can add selected ones into a list
ADDITIONAL_IGNORED_POSITIONS = [1,14]
# Define the similarity threshold between items
SIMILARITY_THRESHOLD = 0.85
# If there are a maximum of X matches groups left, press the generators
# You can set to 0 if you want to use the generator when there's no match
MAX_GENERATOR_GROUP_NUMBERS = 1
# Try to automatically delivery the items
AUTOMATIC_DELIVERY = True
# NOTE: you should adjust these based on your phone display resolution.
# These are for 1080x2400 and represent percentages of height or width.
ROI_TOP = 0.355 # 852px height
ROI_BOTTOM = 0.9025 # 2166px height
ROI_PADDING = 0.0287 # 31px width
# Energy left number position
ENG_TOP = 0.05 # 120px height
ENG_BOTTOM = 0.07 # 168px height
ENG_LEFT = 0.484 # 523px width
ENG_RIGHT = 0.566 # 612px width
# Energy browse deals "Go" button position
GO_TOP = 0.6065 # 1455px height
GO_LEFT = 0.276 # 298px width
# Exit "X" button from task list position
EX_TOP = 0.145 # 350px height
EX_LEFT = 0.926 # 1000px width
# Delivery require list position
DEL_TOP = 0.190
# Delivery button position
DEL_BTN_TOP = 0.240
# Delivery button spacing from right to left
DEL_BTN_SPACING = 225
# Padding right of the delivery buttons
DEL_BTN_PADDING_RIGHT = 125
# Space between grid squares, px
GRID_PADDING = 7
# Minimum blank spaces on the grid for bot to run
MIN_SPACES_ON_BOARD = 2
# Check if config file exists file exists and load the parameters
config_path = os.path.join(os.getcwd(), "bot_config.json")
if os.path.exists(config_path):
with open(config_path, "r") as json_file:
loaded_data = json.load(json_file)
RUN_ON_MOBILE = loaded_data["RUN_ON_MOBILE"]
IGNORED_MATCH_POSITIONS = loaded_data["IGNORED_MATCH_POSITIONS"]
ADDITIONAL_IGNORED_POSITIONS = loaded_data["ADDITIONAL_IGNORED_POSITIONS"]
GENERATOR_POSITIONS = loaded_data["GENERATOR_POSITIONS"]
ROI_TOP = loaded_data["ROI_TOP"]
ROI_BOTTOM = loaded_data["ROI_BOTTOM"]
ROI_PADDING = loaded_data["ROI_PADDING"]
ENG_TOP = loaded_data["ENG_TOP"]
ENG_BOTTOM = loaded_data["ENG_BOTTOM"]
ENG_LEFT = loaded_data["ENG_LEFT"]
ENG_RIGHT = loaded_data["ENG_RIGHT"]
GO_TOP = loaded_data["GO_TOP"]
GO_LEFT = loaded_data["GO_LEFT"]
EX_TOP = loaded_data["EX_TOP"]
EX_LEFT = loaded_data["EX_LEFT"]
DEL_TOP = loaded_data["DEL_TOP"]
DEL_BTN_TOP = loaded_data["DEL_BTN_TOP"]
GRID_PADDING = loaded_data["GRID_PADDING"]
MIN_ENERGY_LEVEL = loaded_data["MIN_ENERGY_LEVEL"]
MAX_FARM_SESSIONS = loaded_data["MAX_FARM_SESSIONS"]
SIMILARITY_THRESHOLD = loaded_data["SIMILARITY_THRESHOLD"]
MAX_GENERATOR_GROUP_NUMBERS = loaded_data["MAX_GENERATOR_GROUP_NUMBERS"]
MIN_SPACES_ON_BOARD = loaded_data["MIN_SPACES_ON_BOARD"]
DEL_BTN_SPACING = loaded_data["DEL_BTN_SPACING"]
DEL_BTN_PADDING_RIGHT = loaded_data["DEL_BTN_PADDING_RIGHT"]
else:
print(f"The file {config_path} does not exist. Using default values.")