Skip to content

Commit

Permalink
valentines update & bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wokzy committed Feb 12, 2025
1 parent c697afe commit 25b53d5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 65 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# BlumBot
___
## To enable "valentine's mode" run `main.py --valentines`
A simple autoclicker for blum drop mini-game on python (autoclicker collects **$dogs**)

## Usage
Expand Down
70 changes: 23 additions & 47 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"""On different devices app size is also different,
so i located triggers on mine and devided it by window size on my pc,
in game this coefficients are multiplied by actual window size to get correct coordinates"""
CHRISTMAS_MODE = '--xmas' in sys.argv
HALLOWEEN_MODE = '--halloween' in sys.argv
ELECTIONS_MODE = '--elections' in sys.argv
FOOTBALL_MODE = '--football' in sys.argv
VALENTINES_MODE = '--valentines' in sys.argv
DOGS_DROP_TOGGLE = '--enable-dogs' in sys.argv

CLICK_LIMIT = 1.0
Expand All @@ -17,62 +14,41 @@

DEV_SCREEN_SIZE_CONST = (402, 712)

APPLICATION_NAME = 'TelegramDesktop'
APPLICATION_NAME = 'Blum'
DEFAULT_COLOR_TRIGGER = {
"red":{"min":90, "max":255},
"green":{"min":220, "max":255},
"blue":{"min":5, "max":55}}
APPLICATION_TRIGGER = {"color":(234, 212, 12), "positions":[(60/402, 112/712), (43/402, 110/712),
(102/402, 113/712), (61/402, 106/712)]}
PIXELS_PER_ITERATION = 10 + 5*CHRISTMAS_MODE
PIXELS_PER_ITERATION = 10

NEW_GAME_TRIGGER_POS = (210/402, 615/712)
AVG_GAME_DURATION = 30 + 6*HALLOWEEN_MODE # seconds
AVG_GAME_DURATION = 30 # seconds


#Dogs drop
DOGS_WHITE_COLOR_RANGE = (238, 256)

# X-mas update
CHRISTMAS_COLOR_TRIGGERS = [
{
"red":{"min":240, "max":255},
"green":{"min":0, "max":15},
"blue":{"min":120, "max":200}
},
{
"red":{"min":130, "max":180},
"green":{"min":50, "max":80},
"blue":{"min":0, "max":20}
},
{
"red":{"min":230, "max":240},
"green":{"min":85, "max":160},
"blue":{"min":70, "max":140}
},
{
"red":{"min":90, "max":120},
"green":{"min":35, "max":50},
"blue":{"min":0, "max":5}
}
# ,
# {
# "red":{"min":250, "max":255},
# "green":{"min":130, "max":150},
# "blue":{"min":0, "max":5}
# },
# {
# "red":{"min":50, "max":120},
# "green":{"min":100, "max":210},
# "blue":{"min":5, "max":40}
# },
]
# Valentine's day update

BOMB_COLOR_TRIGGER = {
"red":{"min":240, "max":255},
"green":{"min":170, "max":200},
"blue":{"min":20, "max":80}
}
VALENTINES_COLOR_TRIGGERS = [
{
"red":{"min":190, "max":205},
"green":{"min":0, "max":90},
"blue":{"min":0, "max":90}
},
{
"red":{"min":250, "max":255},
"green":{"min":0, "max":80},
"blue":{"min":150, "max":205}
},
{
"red":{"min":140, "max":205},
"green":{"min":30, "max":90},
"blue":{"min":70, "max":150}
},
]


HELP_STRING = \
Expand All @@ -81,7 +57,7 @@
Options:
--help - show this string
--xmas - enable christmas mode
--valentines - enable \"valentine's day\" mode
--enable-dogs - collect dogs
--click-limit=n - limit clicks (Example: --click-limit=0.05, only 5% of clicks)
Expand Down
26 changes: 10 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
from constants import (
CLICK_LIMIT,
HELP_STRING,
CHRISTMAS_MODE,
VALENTINES_MODE,
DOGS_DROP_TOGGLE,
AVG_GAME_DURATION,
BOMB_COLOR_TRIGGER,
APPLICATION_TRIGGER,
NEW_GAME_TRIGGER_POS,
PIXELS_PER_ITERATION,
DEFAULT_COLOR_TRIGGER,
DOGS_WHITE_COLOR_RANGE,
CHRISTMAS_COLOR_TRIGGERS,
VALENTINES_COLOR_TRIGGERS,
)


Expand Down Expand Up @@ -64,19 +63,14 @@ def _check_color_trigger(color_trigger, check_x=x, check_y=y, limit:bool=True):
return True
return False

if CHRISTMAS_MODE:
for i in range(len(CHRISTMAS_COLOR_TRIGGERS)):
trigger = CHRISTMAS_COLOR_TRIGGERS[i]
if _check_color_trigger(trigger):
for lc_x in range(-45, 50, 3):
for lc_y in range(-50, 25, 3):
if _check_color_trigger(BOMB_COLOR_TRIGGER, x + lc_x, y + lc_y, limit=False):
return False
if VALENTINES_MODE:
for i in range(len(VALENTINES_COLOR_TRIGGERS)):
trigger = VALENTINES_COLOR_TRIGGERS[i]
if _check_color_trigger(VALENTINES_COLOR_TRIGGERS[i]):
return True
return False
else:
if _check_color_trigger(DEFAULT_COLOR_TRIGGER):
return True
elif _check_color_trigger(DEFAULT_COLOR_TRIGGER):
return True

#DOGS DROP
if DOGS_DROP_TOGGLE:
Expand Down Expand Up @@ -126,7 +120,7 @@ def main():
# time.sleep(2)

x_shift = 20
y_shift_top = 150 + 50*CHRISTMAS_MODE
y_shift_top = 150
y_shift_bot = 250

game_counter = 0
Expand All @@ -151,7 +145,7 @@ def main():
mouse.move(x, y, absolute=True)
mouse.click(button='left')

time.sleep(0.28 - .1*CHRISTMAS_MODE)
time.sleep(0.28)
frame = camera.get_latest_frame()
else:
print('Finished')
Expand Down
2 changes: 0 additions & 2 deletions prepare_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def _enum_cb(hwnd, results):
winlist.append((hwnd, win32gui.GetWindowText(hwnd)))
win32gui.EnumWindows(_enum_cb, toplist)

# print(winlist)

application = [(hwnd, title) for hwnd, title in winlist if APPLICATION_NAME in title]
# just grab the hwnd for first window matching firefox
application = application[0]
Expand Down

0 comments on commit 25b53d5

Please sign in to comment.