Skip to content

Commit

Permalink
momotalk fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Feb 25, 2024
1 parent 97eeeb0 commit fdf9183
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion core/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ def wait_loading(self):
return True


def judge_rgb_range(self, x, y, r_min, r_max, g_min, g_max, b_min, b_max):
def judge_rgb_range(self, x, y, r_min, r_max, g_min, g_max, b_min, b_max, check_nearby=False, nearby_range=1):
if r_min <= self.latest_img_array[int(y * self.ratio)][int(x * self.ratio)][2] <= r_max and \
g_min <= self.latest_img_array[int(y * self.ratio)][int(x * self.ratio)][1] <= g_max and \
b_min <= self.latest_img_array[int(y * self.ratio)][int(x * self.ratio)][0] <= b_max:
return True
if check_nearby:
for i in range(nearby_range * -1, nearby_range + 1):
for j in range(nearby_range * -1, nearby_range + 1):
if r_min <= self.latest_img_array[int(y * self.ratio) + i][int(x * self.ratio) + j][2] <= r_max and \
g_min <= self.latest_img_array[int(y * self.ratio) + i][int(x * self.ratio) + j][1] <= g_max and \
b_min <= self.latest_img_array[int(y * self.ratio) + i][int(x * self.ratio) + j][0] <= b_max:
return True
return False


Expand Down
4 changes: 2 additions & 2 deletions module/momo_talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def common_solve_affection_story_method(self):
def get_reply_position(self):
i = 657
while i > 156:
if color.judge_rgb_range(self, 786, i, 29, 104, 143, 176, 219, 239) and \
color.judge_rgb_range(self, 786, i + 10, 29, 104, 143, 176, 219, 239):
if color.judge_rgb_range(self, 786, i, 29, 49, 143, 163, 219, 239, True, 1) and \
color.judge_rgb_range(self, 786, i + 10, 29, 49, 143, 163, 219, 239, True, 1):
return 'reply', i + 65
elif color.judge_rgb_range(self, 862, i, 245, 255, 227, 247, 230, 250) and \
color.judge_rgb_range(self, 862, i + 10, 245, 255, 125, 155, 145, 175):
Expand Down

0 comments on commit fdf9183

Please sign in to comment.