op
This commit is contained in:
@@ -43,7 +43,7 @@ class Task:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def watch_video(cls, name, rule, device):
|
def watch_video(cls, name, rule, device):
|
||||||
return cls(name, rule, lambda : device.swipe_up(150, 40))
|
return cls(name, rule, lambda : device.swipe_up(120, 40))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def read_book(cls, name, rule, device):
|
def read_book(cls, name, rule, device):
|
||||||
|
|||||||
@@ -32,37 +32,37 @@ class _Action:
|
|||||||
# 上滑
|
# 上滑
|
||||||
def swipe_up(self, dist, speed):
|
def swipe_up(self, dist, speed):
|
||||||
|
|
||||||
x1 = int(self.scr_w * 0.45) + int(random.uniform(-20, 20))
|
x1 = int(self.scr_w * 0.45) + int(random.uniform(-10, 10))
|
||||||
y1 = int(self.scr_h * 0.7) + int(random.uniform(-20, 20))
|
y1 = int(self.scr_h * 0.7) + int(random.uniform(-10, 10))
|
||||||
x2 = x1 + int(random.uniform(-20, 20))
|
x2 = x1 + int(random.uniform(-10, 10))
|
||||||
y2 = y1 - dist + int(random.uniform(-20, 20))
|
y2 = y1 - dist + int(random.uniform(-10, 10))
|
||||||
time = speed - int(random.uniform(-10, 10))
|
time = speed - int(random.uniform(-10, 10))
|
||||||
self.operator.swipe(x1, y1, x2, y2, time)
|
self.operator.swipe(x1, y1, x2, y2, time)
|
||||||
|
|
||||||
# 下滑
|
# 下滑
|
||||||
def swipe_down(self, dist, speed):
|
def swipe_down(self, dist, speed):
|
||||||
x1 = int(self.scr_w * 0.45) + int(random.uniform(-20, 20))
|
x1 = int(self.scr_w * 0.45) + int(random.uniform(-10, 10))
|
||||||
y1 = int(self.scr_h * 0.6) + int(random.uniform(-20, 20))
|
y1 = int(self.scr_h * 0.6) + int(random.uniform(-10, 10))
|
||||||
x2 = x1 + int(random.uniform(-20, 20))
|
x2 = x1 + int(random.uniform(-10, 10))
|
||||||
y2 = y1 + dist + int(random.uniform(-20, 20))
|
y2 = y1 + dist + int(random.uniform(-10, 10))
|
||||||
time = speed + int(random.uniform(-10, 10))
|
time = speed + int(random.uniform(-10, 10))
|
||||||
self.operator.swipe(x1, y1, x2, y2, time)
|
self.operator.swipe(x1, y1, x2, y2, time)
|
||||||
|
|
||||||
# 左滑
|
# 左滑
|
||||||
def swipe_left(self, dist, speed):
|
def swipe_left(self, dist, speed):
|
||||||
x1 = int(self.scr_w * 0.7) + int(random.uniform(-20, 20))
|
x1 = int(self.scr_w * 0.7) + int(random.uniform(-10, 10))
|
||||||
y1 = int(self.scr_h * 0.75) + int(random.uniform(-20, 20))
|
y1 = int(self.scr_h * 0.75) + int(random.uniform(-10, 10))
|
||||||
x2 = x1 - dist + int(random.uniform(-20, 20))
|
x2 = x1 - dist + int(random.uniform(-10, 10))
|
||||||
y2 = y1 + int(random.uniform(-20, 20))
|
y2 = y1 + int(random.uniform(-10, 10))
|
||||||
time = speed + int(random.uniform(-10, 10))
|
time = speed + int(random.uniform(-10, 10))
|
||||||
self.operator.swipe(x1, y1, x2, y2, time)
|
self.operator.swipe(x1, y1, x2, y2, time)
|
||||||
|
|
||||||
# 右滑
|
# 右滑
|
||||||
def swipe_right(self, dist, speed):
|
def swipe_right(self, dist, speed):
|
||||||
x1 = int(self.scr_w * 0.3) + int(random.uniform(-20, 20))
|
x1 = int(self.scr_w * 0.3) + int(random.uniform(-10, 10))
|
||||||
y1 = int(self.scr_h * 0.75) + int(random.uniform(-20, 20))
|
y1 = int(self.scr_h * 0.75) + int(random.uniform(-10, 10))
|
||||||
x2 = x1 + dist + int(random.uniform(-20, 20))
|
x2 = x1 + dist + int(random.uniform(-10, 10))
|
||||||
y2 = y1 + int(random.uniform(-20, 20))
|
y2 = y1 + int(random.uniform(-10, 10))
|
||||||
time = speed + int(random.uniform(-10, 10))
|
time = speed + int(random.uniform(-10, 10))
|
||||||
self.operator.swipe(x1, y1, x2, y2, time)
|
self.operator.swipe(x1, y1, x2, y2, time)
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ def main():
|
|||||||
wikoHi70m = WikoHi70m('3URNU24803102309')
|
wikoHi70m = WikoHi70m('3URNU24803102309')
|
||||||
|
|
||||||
# 普通任务
|
# 普通任务
|
||||||
watchAdTask = apps.Task("看广告", apps.Rule.count(500, 45, 2), lambda : apps.TomatoListen(wikoHi70m).func_ad())
|
watchAdTask = apps.Task("连续看广告", apps.Rule.count(35, 45, 2), lambda : apps.ToutiaoLite(wikoHi70m).func_ad())
|
||||||
watchVideoTask = apps.Task.watch_video("刷视频", apps.Rule.count(500, 8, 2), wikoHi70m)
|
watchVideoTask = apps.Task.watch_video("刷视频", apps.Rule.count(2000, 6, 2), wikoHi70m)
|
||||||
readBookTask = apps.Task.read_book("看书", apps.Rule.count(1000, 5, 2), wikoHi70m)
|
readBookTask = apps.Task.read_book("看书", apps.Rule.count(1000, 5, 2), wikoHi70m)
|
||||||
browseTask = apps.Task.browse("逛街", apps.Rule.time(60, 5, 2), wikoHi70m)
|
browseTask = apps.Task.browse("逛街", apps.Rule.time(60, 4, 2), wikoHi70m)
|
||||||
|
|
||||||
# 窗口任务
|
# 窗口任务
|
||||||
bgWatchVideoTask = apps.Task("后台刷视频", apps.Rule.count(500, 10, 2),
|
bgWatchVideoTask = apps.Task("后台刷视频", apps.Rule.count(500, 10, 2),
|
||||||
@@ -29,19 +29,21 @@ def main():
|
|||||||
lambda : wikoHi70m.swipe(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80))
|
lambda : wikoHi70m.swipe(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80))
|
||||||
|
|
||||||
# 分屏任务
|
# 分屏任务
|
||||||
topTask = apps.Task("刷视频", apps.Rule.count(500, 8, 2),
|
topTask = apps.Task("刷视频", apps.Rule.count(500, 5, 2),
|
||||||
lambda : wikoHi70m.swipe(350 + int(random.uniform(-10, 10)), 1250 + int(random.uniform(-10, 10)), 350 - int(random.uniform(10, 20)), 900 + int(random.uniform(-10, 10)), 20))
|
lambda : wikoHi70m.swipe(350 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 350 - int(random.uniform(10, 20)), 900 + int(random.uniform(-10, 10)), 20))
|
||||||
bottomTask = apps.Task("看书", apps.Rule.count(500, 5, 2),
|
bottomTask = apps.Task("看书", apps.Rule.count(500, 5, 2),
|
||||||
lambda : wikoHi70m.swipe(600 + int(random.uniform(-10, 10)), 350 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 350 + int(random.uniform(-10, 10)), 60))
|
lambda : wikoHi70m.swipe(600 + int(random.uniform(-10, 10)), 350 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 350 + int(random.uniform(-10, 10)), 60))
|
||||||
|
|
||||||
# watchVideoTask.start()
|
watchVideoTask.start()
|
||||||
browseTask.start()
|
# watchAdTask.start()
|
||||||
|
# browseTask.start()
|
||||||
|
# readBookTask.start()
|
||||||
|
|
||||||
# 看视频+小窗看书,同步执行
|
# 看视频+小窗看书,同步执行
|
||||||
# sync_task(topTask, bottomTask)
|
# sync_task(bgWatchVideoTask, minReadBookTask)
|
||||||
|
|
||||||
# 任务完成锁屏
|
# 任务完成锁屏
|
||||||
wikoHi70m.lock()
|
# wikoHi70m.lock()
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("程序被用户中断")
|
print("程序被用户中断")
|
||||||
|
|||||||
Reference in New Issue
Block a user