dongri_task.py 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  1. # -*- coding: utf-8 -*-
  2. import threading
  3. from scriptBase.imgFind import pcacc_img, savePic
  4. from scriptBase.mouseClick import pcacc_mouse
  5. from scriptBase.ocr import capture_and_ocr
  6. import scriptBase.base
  7. from scriptBase.comon import *
  8. from scriptBase.ocr import *
  9. from apscheduler.schedulers.blocking import BlockingScheduler
  10. import pyautogui
  11. import random
  12. import sys
  13. import math
  14. import os
  15. import time
  16. from dongri_define import *
  17. from dongri_pic import *
  18. import subprocess
  19. import socket
  20. from dongri_pic import _imported
  21. '''
  22. 基础配置说明:
  23. 600*800(DPI 300)
  24. 游戏画面:流畅
  25. 高帧率关闭
  26. 町中模式:旧版
  27. '''
  28. todo_msg = ''
  29. todo_list = []
  30. g_task_lineCheck = False
  31. def set_lineCheck(val):
  32. global g_task_lineCheck
  33. g_task_lineCheck = val
  34. def get_todo_msg():
  35. global todo_msg
  36. return todo_msg
  37. def get_todo_msgList():
  38. global todo_list
  39. todo_str = ''
  40. for item in todo_list:
  41. todo_str += f'{item["item"]}:{item["time"]}</br>'
  42. return todo_str
  43. def fing_todoList_time(taskStr):
  44. for item in todo_list:
  45. if item['task'] == taskStr:
  46. return item['time']
  47. def task_getComputerName():
  48. return socket.gethostname()
  49. def task_acceptTask():
  50. while True:
  51. myTimeSleep_big()
  52. def init():
  53. global _imported
  54. if not _imported:
  55. acceptTask = threading.Thread(target=task_acceptTask)
  56. acceptTask.daemon = True
  57. if acceptTask.is_alive() == False:
  58. acceptTask.start()
  59. _imported = True
  60. class basic_operate:
  61. @staticmethod
  62. def do_back():
  63. task_return_game()
  64. ret = False
  65. ret |= waitClickImg_noWait_withBool(place_img.back1, 0.6, 0)
  66. if ret:
  67. return
  68. ret |= waitClickImg_noWait_withBool(place_img.back2, 0.6, 0)
  69. if ret:
  70. return
  71. ret |= waitClickImg_noWait_withBool(place_img.back3, 0.6, 0)
  72. if ret:
  73. return
  74. ret, pos = waitFindImg(place_img.title, 1, 0)
  75. if ret:
  76. pcacc_mouse.click(pos[0] + 20, pos[1] + 80)
  77. @staticmethod
  78. def backToGame(preTime = 0):
  79. tryMaxTimes = 5
  80. while tryMaxTimes > 0:
  81. tryMaxTimes -= 1
  82. if waitFindImg_withBool((place_img.gameIn, place_img.gameIn2), 1, preTime) == False:
  83. basic_operate.do_back()
  84. else:
  85. return True
  86. return False
  87. @staticmethod
  88. def go_town(preTime = 0):
  89. if basic_operate.backToGame(preTime) == False:
  90. return False
  91. waitClickImg_noWait_withBool(place_img.outside, 0.6, 0.5)
  92. return True
  93. @staticmethod
  94. def go_outside(preTime = 0):
  95. if basic_operate.backToGame(preTime) == False:
  96. return False
  97. waitClickImg_noWait_withBool(place_img.town, 0.6, 0.5)
  98. return True
  99. @staticmethod
  100. def click_outside_search():
  101. taskListRet, taskListPos = waitFindImg(monster_img.tasklist, 2, 3)
  102. if taskListRet == False:
  103. return False
  104. else:
  105. pcacc_mouse.click(taskListPos[0], taskListPos[1] - 110)#click search
  106. myTimeSleep_big()
  107. return True
  108. @staticmethod
  109. def enter_auto_supply_resource(enter_pic):
  110. if waitClickImg_noWait_withBool(enter_pic, 2, 2) == False:
  111. return False
  112. if waitClickImg_noWait_withBool(train_img.getAll, 2, 1) == False:
  113. return True
  114. if waitClickImg_noWait_withBool(train_img.enter, 2, 1) == False:
  115. return False
  116. if waitClickImg_noWait_withBool(enter_pic, 2, 1) == False:
  117. return False
  118. return True
  119. @staticmethod
  120. def return_line():
  121. if waitClickImg_noWait_withBool(monster_img.returnLine, 2, 1) == False:
  122. return False
  123. if waitClickImg_noWait_withBool(monster_img.enter, 2, 1) == False:
  124. return False
  125. return True
  126. @staticmethod
  127. def add_strength():
  128. if waitClickImg_noWait_withBool(check_img.no_strength, 2, 1) == False:
  129. return False
  130. if waitClickImg_noWait_withBool(check_img.add_strength, 2, 1) == False:
  131. return False
  132. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  133. return False
  134. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  135. return False
  136. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  137. return False
  138. return True
  139. @staticmethod
  140. def get_line_num():
  141. lineStr = yys_ocrAuto(check_img.line_orc)
  142. if len(lineStr) == 0:
  143. return 0
  144. match = re.search(r'\d', lineStr[0]) # 查找第一个数字
  145. if match:
  146. first_digit = match.group()
  147. print("第一个数字:", first_digit)
  148. return int(first_digit)
  149. else:
  150. print("未找到数字")
  151. return 0
  152. def task_return_game():
  153. tryTimes = 3
  154. while tryTimes > 0:
  155. if False == waitFindImg_withBool([place_img.title], 1, 1):
  156. waitClickImg_noWait([place_img.ico, place_img.ico2], 1, 0)
  157. myTimeSleep_big()
  158. tryTimes -= 1
  159. if tryTimes == 0:
  160. return False
  161. else:
  162. break
  163. def task_save_compress_pic():
  164. # 截取屏幕截图
  165. screenshot = pyautogui.screenshot()
  166. compressed_data = compress_image(screenshot)
  167. # 保存压缩后的图像到文件
  168. with open('compressed_screenshot.jpg', 'wb') as f:
  169. f.write(compressed_data)
  170. def task_close_game():
  171. subprocess.call(f"taskkill /f /im MuMuPlayer.exe")
  172. subprocess.call(f"taskkill /f /im MuMuVMMHeadless.exe")
  173. subprocess.call(f"taskkill /f /im MuMuVMMSVC.exe")
  174. myTimeSleep_big()
  175. def task_start_game(type=0):
  176. isSuccess = True
  177. path1 = R'C:\\Program Files\\Netease\\MuMuPlayer-12.0\\shell\\MuMuPlayer.exe'
  178. path2 = R'C:\Program Files\Netease\MuMu Player 12\shell\MuMuPlayer.exe'
  179. if os.path.exists(path1):
  180. subprocess.Popen(path1)
  181. elif os.path.exists(path2):
  182. subprocess.Popen(path2)
  183. waitClickImg_withBool(gameStart_img.not_upgrade, 20, 10)
  184. if type == 0:
  185. if waitClickImg_withBool(gameStart_img.ico, 100, 0) == False:
  186. return False
  187. else:
  188. if waitClickImg_withBool(gameStart_img.second_game, 100, 0) == False:
  189. return False
  190. if waitClickImg_withBool(gameStart_img.ico, 5, 0) == False:
  191. return False
  192. waitFindImg_withBool(place_img.gameIn, 10, 20)
  193. basic_operate.go_town()
  194. waitFindImg_withBool(place_img.gameIn, 10, 20)
  195. basic_operate.go_town()
  196. if waitFindImg_withBool(place_img.gameIn, 10, 20) == False:
  197. return False
  198. myTimeSleep_big()
  199. return isSuccess
  200. class dongri_task:
  201. def __init__(self, name):
  202. self.name = name
  203. def run(self):
  204. print(f"Running task: {self.name}")
  205. class task_fight_yongbing(dongri_task):
  206. def __init__(self, add_strengh):
  207. super().__init__("战斗佣兵")
  208. self.add_strengh = add_strengh
  209. def run(self):
  210. basic_operate.go_outside()
  211. if False == waitFindImg_withBool(monster_img.enough_strengh2, 2, 1):
  212. if self.add_strengh:
  213. basic_operate.add_strength()
  214. basic_operate.go_outside()
  215. else:
  216. print("没有足够的体力了")
  217. return False
  218. if basic_operate.get_line_num() >= 6:
  219. return False
  220. if waitClickImg_noWait_withBool(check_img.yongbing, 2, 1) == False:
  221. return False
  222. waitClickImg_noWait_withBool(check_img.detect, 2, 1)
  223. if waitClickImg_noWait_withBool(check_img.yongbing_fight, 2, 1) == False:
  224. return False
  225. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  226. return False
  227. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  228. return False
  229. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  230. return False
  231. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  232. maxTryTimes = 3
  233. while maxTryTimes > 0:
  234. maxTryTimes -= 1
  235. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  236. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  237. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  238. break
  239. return True
  240. class task_fight_jina_only(dongri_task):
  241. def __init__(self):
  242. super().__init__("战斗召唤的吉娜")
  243. def run(self):
  244. basic_operate.go_outside()
  245. #必须加体力
  246. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  247. basic_operate.add_strength()
  248. basic_operate.go_outside()
  249. if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2), 2, 1) == False:
  250. return False
  251. waitClickImg_noWait_withBool(check_img.talkin_person, 2, 1)
  252. if waitClickImg_noWait_withBool(check_img.talkin_jina, 2, 1) == False:
  253. return False
  254. myTimeSleep_big()
  255. yys_dragAuto(check_img.move_down)
  256. yys_dragAuto(check_img.move_down)
  257. myTimeSleep_big()
  258. if waitClickImg_noWait_withBool(check_img.xiaohao_jina, 2, 1) == False:
  259. return False
  260. if waitClickImg_noWait_withBool((check_img.jina_pic, check_img.jina_pic2), 2, 1) == False:
  261. return False
  262. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  263. return False
  264. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  265. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  266. return False
  267. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  268. return False
  269. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  270. return False
  271. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  272. maxTryTimes = 3
  273. while maxTryTimes > 0:
  274. maxTryTimes -= 1
  275. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  276. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  277. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  278. break
  279. return True
  280. class task_call_jina(dongri_task):
  281. def __init__(self):
  282. super().__init__("召唤吉娜")
  283. def run(self):
  284. basic_operate.go_outside()
  285. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  286. return False
  287. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  288. return False
  289. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  290. return False
  291. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  292. return False
  293. if waitClickImg_noWait_withBool(check_img.share, 2, 1) == False:
  294. return False
  295. if waitClickImg_noWait_withBool(check_img.to_pcacc, 2, 1) == False:
  296. return False
  297. if waitClickImg_noWait_withBool(check_img.share_btn, 2, 1) == False:
  298. return False
  299. return True
  300. class task_fight_jina(dongri_task):
  301. def __init__(self, add_strengh):
  302. super().__init__("战斗吉娜")
  303. self.add_strengh = add_strengh
  304. def run(self):
  305. basic_operate.go_outside()
  306. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  307. if self.add_strengh:
  308. basic_operate.add_strength()
  309. basic_operate.go_outside()
  310. else:
  311. print("没有足够的体力了")
  312. return False
  313. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  314. return False
  315. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  316. return False
  317. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  318. return False
  319. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  320. return False
  321. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  322. return False
  323. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  324. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  325. return False
  326. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  327. return False
  328. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  329. return False
  330. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  331. maxTryTimes = 3
  332. while maxTryTimes > 0:
  333. maxTryTimes -= 1
  334. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  335. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  336. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  337. break
  338. return True
  339. class task_fightMonster(dongri_task):
  340. def __init__(self, add_strengh, fight_bigMonster, isSimple):
  341. self.add_strengh = add_strengh
  342. self.isSimple = isSimple
  343. if fight_bigMonster == True:
  344. super().__init__(f"战斗大怪物")
  345. self.monster = monster_img.bigMonster
  346. self.attack = monster_img.muti_team
  347. else:
  348. super().__init__(f"战斗小怪物")
  349. self.monster = monster_img.wolf
  350. self.attack = monster_img.attack
  351. def run(self):
  352. global g_task_lineCheck
  353. basic_operate.go_outside()
  354. if False == waitFindImg_withBool(monster_img.enough_strengh2, 2, 1):
  355. if self.add_strengh:
  356. basic_operate.add_strength()
  357. basic_operate.go_outside()
  358. else:
  359. print("没有足够的体力了")
  360. return False
  361. maxLineNum = 6
  362. if basic_operate.get_line_num() >= maxLineNum:
  363. return False
  364. if False == basic_operate.click_outside_search():
  365. return False
  366. if waitFindImg_withBool(monster_img.search, 2, 1):
  367. myTimeSleep_big()
  368. yys_dragAuto(monster_img.move_left)
  369. if waitClickImg_noWait_withBool(self.monster, 2, 1) == False:
  370. return False
  371. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  372. return False
  373. if waitClickImg_noWait_withBool(self.attack, 2, 1) == False:
  374. return False
  375. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  376. if not self.isSimple:
  377. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  378. return False
  379. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  380. return False
  381. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  382. return False
  383. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  384. maxTryTimes = 3
  385. while maxTryTimes > 0:
  386. maxTryTimes -= 1
  387. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  388. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  389. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  390. break
  391. return True
  392. class task_collect(dongri_task):
  393. def __init__(self, type = 0, isSimple = False, isAddStrenghth = False):
  394. self.isSimple = isSimple
  395. self.isAddStrenghth = isAddStrenghth
  396. if isinstance(type, (list, tuple)):
  397. typeArr = type
  398. type = typeArr[random.randint(0, len(typeArr) - 1)]
  399. elif type == 0:
  400. typeArr = [4,4,3,3,3,2,2,2,1,1]
  401. type = typeArr[random.randint(0, len(typeArr) - 1)]
  402. elif type == 5:
  403. typeArr = [2,1]
  404. type = typeArr[random.randint(0, len(typeArr) - 1)]
  405. if type == 1:
  406. self.type = monster_img.meat
  407. self.line = monster_img.line2
  408. super().__init__(f"采集肉")
  409. elif type == 2:
  410. self.type = monster_img.wood
  411. self.line = monster_img.line3
  412. super().__init__(f"采集木头")
  413. elif type == 3:
  414. self.type = monster_img.mine
  415. self.line = monster_img.line4
  416. super().__init__(f"采矿石")
  417. elif type == 4:
  418. self.type = monster_img.iron
  419. self.line = monster_img.line5
  420. super().__init__(f"采集铁矿石")
  421. else:
  422. self.type = None
  423. self.line = None
  424. super().__init__(f"采集None")
  425. if isSimple:
  426. self.line = None
  427. def run(self):
  428. global g_task_lineCheck
  429. if self.type == None:
  430. return True
  431. basic_operate.go_outside()
  432. maxLineNum = 6
  433. if self.isAddStrenghth or g_task_lineCheck:
  434. maxLineNum = 5
  435. else:
  436. maxLineNum = 6
  437. if basic_operate.get_line_num() >= maxLineNum:
  438. return False
  439. if False == basic_operate.click_outside_search():
  440. return False
  441. if waitFindImg_withBool(monster_img.search, 2, 1):
  442. myTimeSleep_big()
  443. yys_dragAuto(monster_img.move_right)
  444. if waitClickImg_noWait_withBool(self.type, 2, 1) == False:
  445. return False
  446. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  447. return False
  448. if waitClickImg_withBool(monster_img.collect, 2, 1) == False:
  449. return False
  450. if self.line != None:
  451. waitClickImg_noWait_withBool(self.line, 2, 1)
  452. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  453. return False
  454. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  455. maxTryTimes = 3
  456. while maxTryTimes > 0:
  457. maxTryTimes -= 1
  458. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  459. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  460. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  461. break
  462. return True
  463. class task_train(dongri_task):
  464. def __init__(self, train_type = None):
  465. super().__init__(f"检查训练{train_type}")
  466. self.train_type = train_type
  467. def run(self):
  468. basic_operate.go_town()
  469. if self.train_type == 'None':
  470. return True
  471. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  472. return False
  473. if waitClickImg_noWait_withBool(train_img.train_success, 2, 1) == False:
  474. return False
  475. tryTimes = 3
  476. isSuccess = False
  477. while tryTimes > 0:
  478. tryTimes -= 1
  479. waitClickImg_noWait_withBool([train_img.dun, train_img.gong, train_img.mao], 2, 1)
  480. if waitClickImg_noWait_withBool(train_img.train, 2, 1):
  481. isSuccess = True
  482. break
  483. if isSuccess == False:
  484. pcacc_mouse.quickclick_current()
  485. myTimeSleep_big()
  486. pcacc_mouse.quickclick_current()
  487. if waitClickImg_noWait_withBool(train_img.train, 2, 1) == False:
  488. return False
  489. if self.train_type == 'lv1':
  490. myTimeSleep_big()
  491. yys_dragAuto(train_img.move_left)
  492. yys_dragAuto(train_img.move_left)
  493. waitClickImg_noWait_withBool(train_img.soilder_lv1, 2, 1)
  494. elif self.train_type == 'lv8':
  495. waitClickImg_noWait_withBool(train_img.soilder_lv8, 2, 1)
  496. elif self.train_type == 'lv9':
  497. waitClickImg_noWait_withBool(train_img.soilder_lv9, 2, 1)
  498. elif self.train_type == 'upgrade':
  499. waitClickImg_noWait_withBool(train_img.upgrade_small, 2, 1)
  500. waitClickImg_noWait_withBool(train_img.upgrade_big, 2, 1)
  501. return basic_operate.enter_auto_supply_resource([train_img.begin_train,train_img.begin_train2])
  502. class task_checkHelp(dongri_task):
  503. def __init__(self, isOutSide = False):
  504. super().__init__(f"检查帮助")
  505. self.isOutSide = isOutSide
  506. def run(self):
  507. if self.isOutSide:
  508. basic_operate.go_outside()
  509. else:
  510. basic_operate.go_town()
  511. waitClickImg_noWait_withBool(place_img.help, 2, 1)
  512. return True
  513. class task_gotoTree(dongri_task):
  514. def __init__(self):
  515. super().__init__(f"查看生命之树")
  516. def run(self):
  517. basic_operate.go_town()
  518. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  519. return False
  520. myTimeSleep_big()
  521. yys_dragAuto(check_img.move_down)
  522. yys_dragAuto(check_img.move_down)
  523. myTimeSleep_big()
  524. if waitClickImg_noWait_withBool(check_img.life_tree, 2, 1) == False:
  525. return False
  526. myTimeSleep_big()
  527. pcacc_mouse.quickclick_current()
  528. myTimeSleep_big()
  529. waitClickImg_noWait_withBool(check_img.life_jam, 2, 1)
  530. waitClickImg_noWait_withBool(check_img.life_jam, 2, 1)
  531. return True
  532. class task_checkStoreRoom(dongri_task):
  533. def __init__(self):
  534. super().__init__(f"检查仓库或招募")
  535. def run(self):
  536. basic_operate.go_town()
  537. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  538. return False
  539. myTimeSleep_big()
  540. yys_dragAuto(check_img.move_down)
  541. yys_dragAuto(check_img.move_down)
  542. myTimeSleep_big()
  543. if waitClickImg_noWait_withBool((train_img.train_success, check_img.needgo), 2, 1) == False:
  544. return False
  545. myTimeSleep_big()
  546. if waitFindImg_withBool(check_img.pet_findtreature, 2, 1) == False:
  547. waitClickImg_noWait_withBool(check_img.bigGet, 2, 1)
  548. pcacc_mouse.quickclick_current()
  549. myTimeSleep_big()
  550. if waitClickImg_noWait_withBool((check_img.detail,check_img.detail2), 2, 1):
  551. myTimeSleep_big()
  552. basic_operate.go_town()
  553. myTimeSleep_big()
  554. if waitClickImg_noWait_withBool((check_img.storeroom, check_img.storeroom2, check_img.invite_free), 2, 1) == False:
  555. return False
  556. myTimeSleep_big()
  557. pcacc_mouse.quickclick_current()
  558. myTimeSleep_big()
  559. waitClickImg_noWait_withBool(check_img.store_strength, 2, 1)
  560. waitClickImg_noWait_withBool((check_img.get,check_img.bigGet), 2, 1)
  561. else:
  562. if waitClickImg_noWait_withBool(check_img.pet_success, 2, 1):
  563. myTimeSleep_big()
  564. dstPos = get_yys_random_point(check_img.pet_getRegion)
  565. pcacc_mouse.click(dstPos[0], dstPos[1])
  566. myTimeSleep_big()
  567. elif waitClickImg_noWait_withBool((check_img.pet_advance, check_img.pet_senior, check_img.pet_junior), 2, 1):
  568. waitClickImg_noWait_withBool(check_img.pet_gotreature, 2, 1)
  569. waitClickImg_noWait_withBool(check_img.pet_begintreature, 2, 1)
  570. return True
  571. class task_checkConfilits(dongri_task):
  572. def __init__(self):
  573. super().__init__(f"检查集结")
  574. def run(self):
  575. basic_operate.go_outside()
  576. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  577. return False
  578. if waitClickImg_noWait_withBool(check_img.paticipate, 2, 1) == False:
  579. return False
  580. if waitClickImg_noWait_withBool(check_img.auto_confilit, 2, 1) == False:
  581. return False
  582. return True
  583. class task_checkDonata(dongri_task):
  584. def __init__(self):
  585. super().__init__(f"检查捐献")
  586. def run(self):
  587. basic_operate.go_town()
  588. if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
  589. return False
  590. if waitClickImg_noWait_withBool(check_img.union_technology, 2, 1) == False:
  591. return False
  592. if waitClickImg_noWait_withBool(check_img.technology_better, 2, 1) == False:
  593. return False
  594. if waitClickImg_withBool([check_img.donate, check_img.donate2], 2, 1) == False:
  595. return False
  596. else:
  597. maxTryTimes = 3
  598. while waitClickImg_withBool([check_img.donate, check_img.donate2], 1, 0) and maxTryTimes > 0:
  599. maxTryTimes -= 1
  600. return True
  601. class task_checkAdventure(dongri_task):
  602. def __init__(self):
  603. super().__init__(f"检查冒险")
  604. def run(self):
  605. basic_operate.go_town()
  606. if waitClickImg_noWait_withBool(check_img.adventure, 2, 1) == False:
  607. return False
  608. if waitClickImg_noWait_withBool(check_img.get, 2, 1) == False:
  609. return False
  610. if waitClickImg_noWait_withBool(check_img.bigGet, 2, 1) == False:
  611. return False
  612. return True
  613. class task_waitTime(dongri_task):
  614. def __init__(self):
  615. super().__init__(f"等待时间")
  616. def run(self):
  617. myTimeSleep(300)
  618. class check_buildOrResearch(dongri_task):
  619. def __init__(self):
  620. super().__init__(f"检查建筑或研究")
  621. def run(self):
  622. basic_operate.go_town()
  623. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  624. return False
  625. if waitClickImg_noWait_withBool(check_img.needgo, 2, 1) == False:
  626. return False
  627. dstType = 'none'
  628. while True:
  629. if waitFindImg_withBool([check_img.upgrade_done, check_img.upgrade_done2, check_img.upgrade_done3, check_img.upgrade_next, check_img.upgrade_done4], 2, 1):
  630. dstType = 'build'
  631. break
  632. handRet, handPos = waitFindImg(check_img.hand, 2, 1)
  633. if not handRet:
  634. return False
  635. detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
  636. dstPos = [0, 0]
  637. if not detailRet:
  638. # 如果找不到详细信息,兵营之类的,需点中间
  639. dstPos = [handPos[0] - 70, handPos[1] + 120]
  640. else:
  641. dstPos = [detailPos[0] + 70, detailPos[1] - 100]
  642. tryTimes = 5
  643. while tryTimes > 0:
  644. tryTimes -= 1
  645. myTimeSleep_big()
  646. pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
  647. if waitClickImg_noWait_withBool(check_img.research, 2, 1):
  648. dstType = 'research'
  649. break
  650. elif waitClickImg_noWait_withBool(check_img.build_upgrade, 2, 1):
  651. dstType = 'build'
  652. break
  653. break
  654. if dstType == 'none':
  655. print('没有找到建筑或研究')
  656. return False
  657. elif dstType == 'build':
  658. buildtimes = 4
  659. while basic_operate.enter_auto_supply_resource([check_img.upgrade_done, check_img.upgrade_done2, check_img.upgrade_done3, check_img.upgrade_next, check_img.upgrade_done4]):
  660. buildtimes -= 1
  661. if buildtimes == 0:
  662. break
  663. continue
  664. elif dstType == 'research':
  665. if waitClickImg_withBool([check_img.research_type1, check_img.research_type2], 2, 1) == False:
  666. return False
  667. if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
  668. return False
  669. waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
  670. return True
  671. class task_information(dongri_task):
  672. def __init__(self, isAddStrengh = False):
  673. super().__init__(f"检查情报")
  674. self.isAddStrengh = isAddStrengh
  675. def run(self):
  676. basic_operate.go_outside()
  677. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  678. if self.isAddStrengh:
  679. basic_operate.add_strength()
  680. basic_operate.go_outside()
  681. else:
  682. print("没有足够的体力了")
  683. return False
  684. if waitClickImg_noWait_withBool(information_img.information, 1, 1) == False:
  685. return False
  686. hero_arr = [information_img.hero0, information_img.hero1, information_img.hero2, information_img.hero3, information_img.hero4]
  687. camp_arr = [information_img.camp1, information_img.camp2, information_img.camp3, information_img.camp4]
  688. wolf_arr = [information_img.wolf0, information_img.wolf1, information_img.wolf2, information_img.wolf3, information_img.wolf4]
  689. total_arr = hero_arr + camp_arr + wolf_arr
  690. if waitFindImg_withBool(total_arr, 2, 1) == False:
  691. return False
  692. if waitClickImg_noWait_withBool(hero_arr, 0.5, 0.5):
  693. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  694. return False
  695. if waitClickImg_noWait_withBool(information_img.explore, 1, 1) == False:
  696. return False
  697. if waitClickImg_noWait_withBool(information_img.hero_fight, 1, 1) == False:
  698. return False
  699. myTimeSleep_big()
  700. return True
  701. elif waitClickImg_noWait_withBool(camp_arr, 0.5, 0.5):
  702. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  703. return False
  704. if waitClickImg_noWait_withBool(information_img.survive, 1, 1) == False:
  705. return False
  706. return True
  707. elif waitClickImg_noWait_withBool(wolf_arr, 0.5, 0.5):
  708. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  709. return False
  710. if waitClickImg_noWait_withBool(information_img.fight, 1, 1) == False:
  711. return False
  712. if waitClickImg_noWait_withBool(monster_img.line1, 1, 1) == False:
  713. return False
  714. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  715. return False
  716. waitClickImg_noWait_withBool(monster_img.all_select, 0.1, 1)
  717. maxTryTimes = 3
  718. while maxTryTimes > 0:
  719. maxTryTimes -= 1
  720. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  721. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 1):
  722. break
  723. return True
  724. else:
  725. return False
  726. class task_returnAllLine(dongri_task):
  727. def __init__(self):
  728. super().__init__(f"返回所有路线")
  729. def run(self):
  730. basic_operate.go_outside()
  731. basic_operate.return_line()
  732. basic_operate.return_line()
  733. basic_operate.return_line()
  734. basic_operate.return_line()
  735. basic_operate.return_line()
  736. basic_operate.return_line()
  737. return True
  738. class task_paticipateInTeam(dongri_task):
  739. def __init__(self):
  740. typeArr = [1,4]
  741. type = typeArr[random.randint(0, len(typeArr) - 1)]
  742. if type == 1:
  743. self.line = monster_img.line1
  744. elif type == 4:
  745. self.line = monster_img.line4
  746. super().__init__(f"参与队伍{type}")
  747. def run(self):
  748. basic_operate.go_outside()
  749. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  750. return False
  751. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1, True) == False:
  752. yys_dragAuto(check_img.move_down)
  753. myTimeSleep_big()
  754. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1, True) == False:
  755. return False
  756. waitClickImg_noWait_withBool(self.line, 0.1, 1)
  757. maxTryTimes = 3
  758. while maxTryTimes > 0:
  759. maxTryTimes -= 1
  760. waitClickImg_withBool([monster_img.fight, monster_img.fight2, monster_img.fight3], 1, 0.5)
  761. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 0.5):
  762. break
  763. return True
  764. class task_cure(dongri_task):
  765. def __init__(self, continueCure = False, cureNum = None):
  766. cureStr = ""
  767. if continueCure:
  768. cureStr = f"连续"
  769. super().__init__(f"{cureStr}治疗{cureNum}")
  770. self.continueCure = continueCure
  771. self.cureNum = cureNum
  772. def run(self):
  773. basic_operate.go_town()
  774. basic_operate.go_outside()
  775. if waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
  776. return False
  777. while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5) == False:
  778. if waitClickImg_noWait_withBool(special_activity_img.quick_choose, 1, 0.5) == False:
  779. return False
  780. while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5):
  781. if waitClickImg_noWait_withBool(special_activity_img.choose_zero, 1, 0.5) == False:
  782. return False
  783. else:
  784. myTimeSleep_big()
  785. pcacc_mouse.input_string(str(self.cureNum))
  786. if self.continueCure == False:
  787. if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
  788. return False
  789. if waitClickImg_noWait_withBool(check_img.help4, 2, 1) == False:
  790. return False
  791. else:
  792. maxCureSoilder = 30000
  793. maxTryTimes = int(maxCureSoilder) // int(self.cureNum) * 2
  794. while waitClickImg_noWait_withBool((check_img.cure, check_img.help4, check_img.help5), 30, 0.2) and maxTryTimes >= 0:
  795. maxTryTimes -= 1
  796. continue
  797. waitClickImg_noWait_withBool((check_img.help4, check_img.help5), 1, 1)
  798. return True
  799. class task_useAnnimalSkill(dongri_task):
  800. def __init__(self):
  801. super().__init__(f"使用动物技能")
  802. def run(self):
  803. basic_operate.go_outside()
  804. if waitClickImg_noWait_withBool(check_img.annimal_skill, 2, 1) == False:
  805. return False
  806. if waitClickImg_noWait_withBool((check_img.wolf_skill, check_img.elephant_skill, check_img.lu_skill), 2, 1) == False:
  807. return False
  808. if waitClickImg_noWait_withBool((check_img.use, check_img.use2), 2, 1) == False:
  809. return False
  810. class task_activity_lianmeng(dongri_task):
  811. def __init__(self):
  812. super().__init__(f"联盟总动员")
  813. def run(self):
  814. basic_operate.go_town()
  815. if waitClickImg_noWait_withBool(special_activity_img.normal, 1, 0.5) == False:
  816. return False
  817. if waitClickImg_noWait_withBool((special_activity_img.lianmeng,special_activity_img.lianmeng2), 1, 0.5) == False:
  818. yys_dragAuto(special_activity_img.move_left)
  819. myTimeSleep_small()
  820. yys_dragAuto(special_activity_img.move_left)
  821. myTimeSleep_small()
  822. if waitClickImg_noWait_withBool((special_activity_img.lianmeng,special_activity_img.lianmeng2), 1, 0.5) == False:
  823. return False
  824. waitClickImg_noWait_withBool(special_activity_img.task_done, 1, 0.5)
  825. if waitFindImg_withBool(special_activity_img.doing_task, 1, 0.5) == False:
  826. down_tryTimes = 3
  827. while down_tryTimes > 0:
  828. down_tryTimes -= 1
  829. if waitClickImg_noWait_withBool((special_activity_img.shili_120_2, special_activity_img.shili_860_2, special_activity_img.shili_430), 1, 0.5, True) == True:
  830. if waitClickImg_noWait_withBool(special_activity_img.accept_task, 2, 1) == False:
  831. return False
  832. break
  833. elif waitFindImg_withBool(special_activity_img.shili_2, 1, 0.5) == True:
  834. save_game_screen()
  835. yys_dragAuto(special_activity_img.move_down)
  836. up_tryTimes = 5
  837. while up_tryTimes > 0:
  838. up_tryTimes -= 1
  839. myTimeSleep_small()
  840. yys_dragAuto(change_direction(special_activity_img.move_down))
  841. if waitFindImg_withBool((special_activity_img.shili_120, special_activity_img.shili_860_2), 2, 0.5, True) == False:
  842. maxTryTimes = 2
  843. while waitClickImg_noWait_withBool((special_activity_img.owning2), 2, 1) == True:
  844. waitClickImg_noWait_withBool(special_activity_img.refresh_task, 2, 1)
  845. waitClickImg_noWait_withBool(special_activity_img.refresh, 2, 1)
  846. maxTryTimes -= 1
  847. if maxTryTimes <= 0:
  848. break
  849. return True
  850. class task_checkMaster(dongri_task):
  851. def __init__(self):
  852. super().__init__(f"检查统帅")
  853. def run(self):
  854. basic_operate.go_town()
  855. if waitClickImg_noWait_withBool(check_img.master, 2, 1) == False:
  856. return False
  857. if waitClickImg_noWait_withBool(check_img.master_get, 2, 1) == False:
  858. return False
  859. myTimeSleep_big()
  860. pcacc_mouse.quickclick_current()
  861. if waitClickImg_noWait_withBool(check_img.little_treasure, 2, 1) == False:
  862. return False
  863. return True
  864. class task_checkActivities(dongri_task):
  865. def __init__(self):
  866. super().__init__(f"检查各种活动时间")
  867. def find_all_matching_events(self, parts, input_word):
  868. results = []
  869. # 查找所有包含输入关键词的项
  870. matches = [i for i, part in enumerate(parts) if input_word in part]
  871. for match_index in matches:
  872. # 从匹配项开始向后查找第一个时间或状态
  873. for i in range(match_index + 1, len(parts)):
  874. current_part = parts[i]
  875. # 检查是否是时间(如 19:30)或状态(如 已结束)
  876. if re.match(r'^\d{1,2}:\d{2}$', current_part) or current_part in ["已结束"]:
  877. dst = {"item":parts[match_index], "time":current_part}
  878. results.append(dst)
  879. break # 找到第一个匹配就停止
  880. return results
  881. def run(self):
  882. global todo_msg, todo_list
  883. basic_operate.go_outside()
  884. if waitClickImg_noWait_withBool(check_img.activity_open, 2, 1) == False:
  885. return False
  886. if waitFindImg_withBool(check_img.todoList, 2, 1) == False:
  887. return False
  888. activityStr = yys_ocrAuto(check_img.todo_region)
  889. if activityStr:
  890. todo_msg = activityStr
  891. print(todo_msg)
  892. result = []
  893. judianArr = self.find_all_matching_events(activityStr, "据点")
  894. result.extend(judianArr)
  895. baoleiArr = self.find_all_matching_events(activityStr, "堡垒")
  896. result.extend(baoleiArr)
  897. juxiongArr = self.find_all_matching_events(activityStr, "巨熊")
  898. result.extend(juxiongArr)
  899. yaosaiArr = self.find_all_matching_events(activityStr, "要塞")
  900. result.extend(yaosaiArr)
  901. todo_list = result
  902. print(todo_list)
  903. return activityStr
  904. class task_visit_island(dongri_task):
  905. def __init__(self):
  906. super().__init__(f"访问岛屿")
  907. def run(self):
  908. basic_operate.go_outside()
  909. if waitClickImg_noWait_withBool(check_img.visit_island_small, 2, 1) == False:
  910. return False
  911. if waitClickImg_noWait_withBool(check_img.visit_enter, 2, 1) == False:
  912. return False
  913. if waitClickImg_noWait_withBool(check_img.visit_island_big, 2, 1) == False:
  914. return False
  915. return True
  916. class task_fight_ranshuang(dongri_task):
  917. def __init__(self):
  918. super().__init__(f"打燃霜")
  919. def run(self):
  920. basic_operate.backToGame()
  921. while True:
  922. if waitClickImg_noWait_withBool(monster_img.ranshuang_search, 0.5, 0.5) == False:
  923. return False
  924. if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 0.5, 0.5) == False:
  925. firstPos = get_yys_random_point(special_activity_img.mid_enemy_region)
  926. pcacc_mouse.click(firstPos[0], firstPos[1])
  927. myTimeSleep_big()
  928. if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 1, 0.5) == False:
  929. break
  930. break
  931. if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 1, 0.5) == False:
  932. return False
  933. return True
  934. class task_fight_enemy(dongri_task):
  935. def __init__(self):
  936. super().__init__(f"打敌人or王城")
  937. def run(self):
  938. basic_operate.go_town()
  939. basic_operate.go_outside()
  940. if waitClickImg_noWait_withBool(special_activity_img.collection, 2, 1) == False:
  941. return False
  942. if waitClickImg_noWait_withBool(special_activity_img.enemy, 2, 1) == False:
  943. return False
  944. attackArr = [monster_img.attack, monster_img.attack2, monster_img.ranshuang_attack, monster_img.outside_attack, monster_img.defend]
  945. myTimeSleep_big()
  946. firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
  947. pcacc_mouse.click(firstPos[0], firstPos[1])
  948. maxTryTimes = 5
  949. if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
  950. return False
  951. while waitFindImg_withBool(attackArr, 1, 0) == False and maxTryTimes > 0:
  952. if waitClickImg_noWait_withBool(special_activity_img.outside_soilder, 1, 1) == True:
  953. break
  954. #if waitFindImg_withBool(special_activity_img.outside_pcacc, 1, 1) == True:
  955. # break
  956. #else:
  957. # return False
  958. maxTryTimes -= 1
  959. myTimeSleep_big()
  960. mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
  961. pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
  962. myTimeSleep_big()
  963. if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
  964. return False
  965. if waitClickImg_noWait_withBool(attackArr, 1, 0) == False:
  966. return False
  967. waitClickImg_noWait_withBool(monster_img.team_go, 2, 1)#派遣队伍
  968. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  969. return False
  970. if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 2, 1) == False:
  971. return False
  972. return True
  973. class task_get_redPackage(dongri_task):
  974. def __init__(self):
  975. super().__init__(f"领取红包")
  976. def run(self):
  977. basic_operate.go_outside()
  978. if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2, check_img.talk_in3), 2, 1) == False:
  979. return False
  980. waitClickImg_noWait_withBool(check_img.talkin_person, 2, 1)
  981. oldTime = time.time()
  982. while True:
  983. if time.time() - oldTime > 150:
  984. break
  985. waitClickImg_noWait_withBool((special_activity_img.red_package, special_activity_img.red_package2, special_activity_img.msg_new, special_activity_img.red_package_open), 2, 0)
  986. return True
  987. class task_read_mails(dongri_task):
  988. def __init__(self):
  989. super().__init__(f"读邮件")
  990. def run(self):
  991. basic_operate.go_town()
  992. if waitClickImg_noWait_withBool(check_img.mail_btn, 2, 1) == False:
  993. return False
  994. waitClickImg_noWait_withBool(check_img.mail_collect, 2, 1)
  995. if waitClickImg_noWait_withBool(check_img.mail_union, 2, 1) == False:
  996. return False
  997. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  998. return False
  999. if waitClickImg_noWait_withBool(check_img.mail_system, 2, 1) == False:
  1000. return False
  1001. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  1002. return False
  1003. if waitClickImg_noWait_withBool(check_img.mail_reports, 2, 1) == False:
  1004. return False
  1005. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  1006. return False
  1007. return True
  1008. class task_checkBenifitStatus(dongri_task):
  1009. def __init__(self):
  1010. super().__init__(f"查看增益状态")
  1011. def run(self):
  1012. basic_operate.go_town()
  1013. if waitFindImg_withBool(check_img.benefit_collect, 2, 1) == True:
  1014. return True
  1015. if waitClickImg_noWait_withBool(check_img.add_benefit, 2, 1) == False:
  1016. return False
  1017. waitClickImg_noWait_withBool(check_img.benefit_evolve, 2, 1)
  1018. if waitClickImg_noWait_withBool(check_img.benefit_collect_info, 2, 1) == False:
  1019. return False
  1020. myTimeSleep_big()
  1021. dstPos = get_yys_random_point(check_img.benefit_use_region)
  1022. pcacc_mouse.click(dstPos[0], dstPos[1])
  1023. myTimeSleep_big()
  1024. if waitClickImg_noWait_withBool(check_img.benefit_buy, 2, 1) == False:
  1025. return False
  1026. waitClickImg_noWait_withBool(check_img.buy_enter, 2, 1)
  1027. return True
  1028. class task_checkDiamond(dongri_task):
  1029. def __init__(self):
  1030. super().__init__(f"查看钻石活动")
  1031. def run(self):
  1032. basic_operate.go_town()
  1033. if waitClickImg_noWait_withBool(check_img.worthy_activity, 2, 1) == False:
  1034. return False
  1035. myTimeSleep_big()
  1036. yys_dragAuto(change_direction(special_activity_img.move_left))
  1037. myTimeSleep_big()
  1038. yys_dragAuto(change_direction(special_activity_img.move_left))
  1039. waitClickImg_noWait_withBool(check_img.diamond_activity, 2, 1)
  1040. waitClickImg_noWait_withBool(check_img.gain_diamond, 2, 1)
  1041. dstPos = get_yys_random_point(check_img.diamond_save)
  1042. pcacc_mouse.click(dstPos[0], dstPos[1])
  1043. myTimeSleep_big()
  1044. dstPos = get_yys_random_point(check_img.diamond_saveMax)
  1045. pcacc_mouse.click(dstPos[0], dstPos[1])
  1046. myTimeSleep_big()
  1047. if waitClickImg_noWait_withBool(check_img.diamond_save_btn, 2, 1) == False:
  1048. return False
  1049. return True
  1050. if __name__ == '__main__':
  1051. save_game_screen()
  1052. #basic_operate.get_line_num()
  1053. #task_cure(True, 85).run()
  1054. #task_fight_enemy().run()
  1055. #task_fight_ranshuang().run()
  1056. #task_gotoTree().run()
  1057. #task_fight_jina_only().run()
  1058. #task_checkConfilits().run()
  1059. #task_checkActivities().run()
  1060. #task_checkMaster().run()
  1061. #basic_operate.get_line_num()
  1062. #yys_ocrAuto(check_img.line_orc)
  1063. #basic_operate.go_town()
  1064. #basic_operate.add_strength()
  1065. #task_fightMonster(False, False,False).run()
  1066. #task_checkHelp().run()
  1067. #task_checkStoreRoom().run()
  1068. task_start_game(0)
  1069. #task_activity_lianmeng().run()
  1070. #task_fight_yongbing(True).run()
  1071. #task_collect([4,3,2,1]).run()
  1072. #task_train("upgrade").run()
  1073. #task_information(True).run()
  1074. #check_buildOrResearch().run()
  1075. #task_checkDonata().run()
  1076. #task_collect(1).run()
  1077. #task_collect(2).run()
  1078. #task_collect(3).run()
  1079. #task_collect(4).run()
  1080. #task_returnAllLine().run()
  1081. #task_paticipateInTeam().run()
  1082. #task_fight_jina(True).run()
  1083. #task_get_redPackage().run()
  1084. #task_read_mails().run()
  1085. #task_checkBenifitStatus().run()
  1086. #task_checkDiamond().run()