dongri_task.py 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  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. waitClickImg_withBool(gameStart_img.second_game, 100, 0)
  189. if waitClickImg_withBool(gameStart_img.ico, 5, 0) == False:
  190. return False
  191. waitFindImg_withBool(place_img.gameIn, 10, 20)
  192. basic_operate.go_town()
  193. waitFindImg_withBool(place_img.gameIn, 10, 20)
  194. basic_operate.go_town()
  195. if waitFindImg_withBool(place_img.gameIn, 10, 20) == False:
  196. return False
  197. myTimeSleep_big()
  198. return isSuccess
  199. class dongri_task:
  200. def __init__(self, name):
  201. self.name = name
  202. def run(self):
  203. print(f"Running task: {self.name}")
  204. class task_fight_yongbing(dongri_task):
  205. def __init__(self, add_strengh):
  206. super().__init__("战斗佣兵")
  207. self.add_strengh = add_strengh
  208. def run(self):
  209. basic_operate.go_outside()
  210. if False == waitFindImg_withBool(monster_img.enough_strengh2, 2, 1):
  211. if self.add_strengh:
  212. basic_operate.add_strength()
  213. basic_operate.go_outside()
  214. else:
  215. print("没有足够的体力了")
  216. return False
  217. if basic_operate.get_line_num() >= 6:
  218. return False
  219. if waitClickImg_noWait_withBool(check_img.yongbing, 2, 1) == False:
  220. return False
  221. waitClickImg_noWait_withBool(check_img.detect, 2, 1)
  222. if waitClickImg_noWait_withBool(check_img.yongbing_fight, 2, 1) == False:
  223. return False
  224. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  225. return False
  226. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  227. return False
  228. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  229. return False
  230. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  231. maxTryTimes = 3
  232. while maxTryTimes > 0:
  233. maxTryTimes -= 1
  234. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  235. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  236. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  237. break
  238. return True
  239. class task_fight_jina_only(dongri_task):
  240. def __init__(self):
  241. super().__init__("战斗召唤的吉娜")
  242. def run(self):
  243. basic_operate.go_outside()
  244. #必须加体力
  245. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  246. basic_operate.add_strength()
  247. basic_operate.go_outside()
  248. if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2), 2, 1) == False:
  249. return False
  250. waitClickImg_noWait_withBool(check_img.talkin_person, 2, 1)
  251. if waitClickImg_noWait_withBool(check_img.talkin_jina, 2, 1) == False:
  252. return False
  253. myTimeSleep_big()
  254. yys_dragAuto(check_img.move_down)
  255. yys_dragAuto(check_img.move_down)
  256. myTimeSleep_big()
  257. if waitClickImg_noWait_withBool(check_img.xiaohao_jina, 2, 1) == False:
  258. return False
  259. if waitClickImg_noWait_withBool((check_img.jina_pic, check_img.jina_pic2), 2, 1) == False:
  260. return False
  261. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  262. return False
  263. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  264. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  265. return False
  266. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  267. return False
  268. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  269. return False
  270. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  271. maxTryTimes = 3
  272. while maxTryTimes > 0:
  273. maxTryTimes -= 1
  274. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  275. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  276. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  277. break
  278. return True
  279. class task_call_jina(dongri_task):
  280. def __init__(self):
  281. super().__init__("召唤吉娜")
  282. def run(self):
  283. basic_operate.go_outside()
  284. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  285. return False
  286. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  287. return False
  288. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  289. return False
  290. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  291. return False
  292. if waitClickImg_noWait_withBool(check_img.share, 2, 1) == False:
  293. return False
  294. if waitClickImg_noWait_withBool(check_img.to_pcacc, 2, 1) == False:
  295. return False
  296. if waitClickImg_noWait_withBool(check_img.share_btn, 2, 1) == False:
  297. return False
  298. return True
  299. class task_fight_jina(dongri_task):
  300. def __init__(self, add_strengh):
  301. super().__init__("战斗吉娜")
  302. self.add_strengh = add_strengh
  303. def run(self):
  304. basic_operate.go_outside()
  305. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  306. if self.add_strengh:
  307. basic_operate.add_strength()
  308. basic_operate.go_outside()
  309. else:
  310. print("没有足够的体力了")
  311. return False
  312. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  313. return False
  314. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  315. return False
  316. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  317. return False
  318. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  319. return False
  320. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  321. return False
  322. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  323. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  324. return False
  325. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  326. return False
  327. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  328. return False
  329. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  330. maxTryTimes = 3
  331. while maxTryTimes > 0:
  332. maxTryTimes -= 1
  333. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  334. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  335. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  336. break
  337. return True
  338. class task_fightMonster(dongri_task):
  339. def __init__(self, add_strengh, fight_bigMonster, isSimple):
  340. self.add_strengh = add_strengh
  341. self.isSimple = isSimple
  342. if fight_bigMonster == True:
  343. super().__init__(f"战斗大怪物")
  344. self.monster = monster_img.bigMonster
  345. self.attack = monster_img.muti_team
  346. else:
  347. super().__init__(f"战斗小怪物")
  348. self.monster = monster_img.wolf
  349. self.attack = monster_img.attack
  350. def run(self):
  351. global g_task_lineCheck
  352. basic_operate.go_outside()
  353. if False == waitFindImg_withBool(monster_img.enough_strengh2, 2, 1):
  354. if self.add_strengh:
  355. basic_operate.add_strength()
  356. basic_operate.go_outside()
  357. else:
  358. print("没有足够的体力了")
  359. return False
  360. maxLineNum = 6
  361. if basic_operate.get_line_num() >= maxLineNum:
  362. return False
  363. if False == basic_operate.click_outside_search():
  364. return False
  365. if waitFindImg_withBool(monster_img.search, 2, 1):
  366. myTimeSleep_big()
  367. yys_dragAuto(monster_img.move_left)
  368. if waitClickImg_noWait_withBool(self.monster, 2, 1) == False:
  369. return False
  370. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  371. return False
  372. if waitClickImg_noWait_withBool(self.attack, 2, 1) == False:
  373. return False
  374. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  375. if not self.isSimple:
  376. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  377. return False
  378. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  379. return False
  380. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  381. return False
  382. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  383. maxTryTimes = 3
  384. while maxTryTimes > 0:
  385. maxTryTimes -= 1
  386. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  387. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  388. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  389. break
  390. return True
  391. class task_collect(dongri_task):
  392. def __init__(self, type = 0, isSimple = False, isAddStrenghth = False):
  393. self.isSimple = isSimple
  394. self.isAddStrenghth = isAddStrenghth
  395. if isinstance(type, (list, tuple)):
  396. typeArr = type
  397. type = typeArr[random.randint(0, len(typeArr) - 1)]
  398. elif type == 0:
  399. typeArr = [4,4,3,3,3,2,2,2,1,1]
  400. type = typeArr[random.randint(0, len(typeArr) - 1)]
  401. elif type == 5:
  402. typeArr = [2,1]
  403. type = typeArr[random.randint(0, len(typeArr) - 1)]
  404. if type == 1:
  405. self.type = monster_img.meat
  406. self.line = monster_img.line2
  407. super().__init__(f"采集肉")
  408. elif type == 2:
  409. self.type = monster_img.wood
  410. self.line = monster_img.line3
  411. super().__init__(f"采集木头")
  412. elif type == 3:
  413. self.type = monster_img.mine
  414. self.line = monster_img.line4
  415. super().__init__(f"采矿石")
  416. elif type == 4:
  417. self.type = monster_img.iron
  418. self.line = monster_img.line5
  419. super().__init__(f"采集铁矿石")
  420. else:
  421. self.type = None
  422. self.line = None
  423. super().__init__(f"采集None")
  424. if isSimple:
  425. self.line = None
  426. def run(self):
  427. global g_task_lineCheck
  428. if self.type == None:
  429. return True
  430. basic_operate.go_outside()
  431. maxLineNum = 6
  432. if self.isAddStrenghth or g_task_lineCheck:
  433. maxLineNum = 5
  434. else:
  435. maxLineNum = 6
  436. if basic_operate.get_line_num() >= maxLineNum:
  437. return False
  438. if False == basic_operate.click_outside_search():
  439. return False
  440. if waitFindImg_withBool(monster_img.search, 2, 1):
  441. myTimeSleep_big()
  442. yys_dragAuto(monster_img.move_right)
  443. if waitClickImg_noWait_withBool(self.type, 2, 1) == False:
  444. return False
  445. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  446. return False
  447. if waitClickImg_withBool(monster_img.collect, 2, 1) == False:
  448. return False
  449. if self.line != None:
  450. waitClickImg_noWait_withBool(self.line, 2, 1)
  451. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  452. return False
  453. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  454. maxTryTimes = 3
  455. while maxTryTimes > 0:
  456. maxTryTimes -= 1
  457. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  458. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  459. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  460. break
  461. return True
  462. class task_train(dongri_task):
  463. def __init__(self, train_type = None):
  464. super().__init__(f"检查训练{train_type}")
  465. self.train_type = train_type
  466. def run(self):
  467. basic_operate.go_town()
  468. if self.train_type == 'None':
  469. return True
  470. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  471. return False
  472. if waitClickImg_noWait_withBool(train_img.train_success, 2, 1) == False:
  473. return False
  474. tryTimes = 3
  475. isSuccess = False
  476. while tryTimes > 0:
  477. tryTimes -= 1
  478. waitClickImg_noWait_withBool([train_img.dun, train_img.gong, train_img.mao], 2, 1)
  479. if waitClickImg_noWait_withBool(train_img.train, 2, 1):
  480. isSuccess = True
  481. break
  482. if isSuccess == False:
  483. pcacc_mouse.quickclick_current()
  484. myTimeSleep_big()
  485. pcacc_mouse.quickclick_current()
  486. if waitClickImg_noWait_withBool(train_img.train, 2, 1) == False:
  487. return False
  488. if self.train_type == 'lv1':
  489. myTimeSleep_big()
  490. yys_dragAuto(train_img.move_left)
  491. yys_dragAuto(train_img.move_left)
  492. waitClickImg_noWait_withBool(train_img.soilder_lv1, 2, 1)
  493. elif self.train_type == 'lv8':
  494. waitClickImg_noWait_withBool(train_img.soilder_lv8, 2, 1)
  495. elif self.train_type == 'lv9':
  496. waitClickImg_noWait_withBool(train_img.soilder_lv9, 2, 1)
  497. elif self.train_type == 'upgrade':
  498. waitClickImg_noWait_withBool(train_img.upgrade_small, 2, 1)
  499. waitClickImg_noWait_withBool(train_img.upgrade_big, 2, 1)
  500. return basic_operate.enter_auto_supply_resource([train_img.begin_train,train_img.begin_train2])
  501. class task_checkHelp(dongri_task):
  502. def __init__(self, isOutSide = False):
  503. super().__init__(f"检查帮助")
  504. self.isOutSide = isOutSide
  505. def run(self):
  506. if self.isOutSide:
  507. basic_operate.go_outside()
  508. else:
  509. basic_operate.go_town()
  510. waitClickImg_noWait_withBool(place_img.help, 2, 1)
  511. return True
  512. class task_gotoTree(dongri_task):
  513. def __init__(self):
  514. super().__init__(f"查看生命之树")
  515. def run(self):
  516. basic_operate.go_town()
  517. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  518. return False
  519. myTimeSleep_big()
  520. yys_dragAuto(check_img.move_down)
  521. yys_dragAuto(check_img.move_down)
  522. myTimeSleep_big()
  523. if waitClickImg_noWait_withBool(check_img.life_tree, 2, 1) == False:
  524. return False
  525. myTimeSleep_big()
  526. pcacc_mouse.quickclick_current()
  527. myTimeSleep_big()
  528. waitClickImg_noWait_withBool(check_img.life_jam, 2, 1)
  529. waitClickImg_noWait_withBool(check_img.life_jam, 2, 1)
  530. return True
  531. class task_checkStoreRoom(dongri_task):
  532. def __init__(self):
  533. super().__init__(f"检查仓库或招募")
  534. def run(self):
  535. basic_operate.go_town()
  536. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  537. return False
  538. myTimeSleep_big()
  539. yys_dragAuto(check_img.move_down)
  540. yys_dragAuto(check_img.move_down)
  541. myTimeSleep_big()
  542. if waitClickImg_noWait_withBool((train_img.train_success, check_img.needgo), 2, 1) == False:
  543. return False
  544. myTimeSleep_big()
  545. if waitFindImg_withBool(check_img.pet_findtreature, 2, 1) == False:
  546. waitClickImg_noWait_withBool(check_img.bigGet, 2, 1)
  547. pcacc_mouse.quickclick_current()
  548. myTimeSleep_big()
  549. if waitClickImg_noWait_withBool((check_img.detail,check_img.detail2), 2, 1):
  550. myTimeSleep_big()
  551. basic_operate.go_town()
  552. myTimeSleep_big()
  553. if waitClickImg_noWait_withBool((check_img.storeroom, check_img.storeroom2, check_img.invite_free), 2, 1) == False:
  554. return False
  555. myTimeSleep_big()
  556. pcacc_mouse.quickclick_current()
  557. myTimeSleep_big()
  558. waitClickImg_noWait_withBool(check_img.store_strength, 2, 1)
  559. waitClickImg_noWait_withBool((check_img.get,check_img.bigGet), 2, 1)
  560. else:
  561. if waitClickImg_noWait_withBool(check_img.pet_success, 2, 1):
  562. myTimeSleep_big()
  563. dstPos = get_yys_random_point(check_img.pet_getRegion)
  564. pcacc_mouse.click(dstPos[0], dstPos[1])
  565. myTimeSleep_big()
  566. elif waitClickImg_noWait_withBool((check_img.pet_advance, check_img.pet_senior, check_img.pet_junior), 2, 1):
  567. waitClickImg_noWait_withBool(check_img.pet_gotreature, 2, 1)
  568. waitClickImg_noWait_withBool(check_img.pet_begintreature, 2, 1)
  569. return True
  570. class task_checkConfilits(dongri_task):
  571. def __init__(self):
  572. super().__init__(f"检查集结")
  573. def run(self):
  574. basic_operate.go_outside()
  575. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  576. return False
  577. if waitClickImg_noWait_withBool(check_img.paticipate, 2, 1) == False:
  578. return False
  579. if waitClickImg_noWait_withBool(check_img.auto_confilit, 2, 1) == False:
  580. return False
  581. return True
  582. class task_checkDonata(dongri_task):
  583. def __init__(self):
  584. super().__init__(f"检查捐献")
  585. def run(self):
  586. basic_operate.go_town()
  587. if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
  588. return False
  589. if waitClickImg_noWait_withBool(check_img.union_technology, 2, 1) == False:
  590. return False
  591. if waitClickImg_noWait_withBool(check_img.technology_better, 2, 1) == False:
  592. return False
  593. if waitClickImg_withBool([check_img.donate, check_img.donate2], 2, 1) == False:
  594. return False
  595. else:
  596. maxTryTimes = 3
  597. while waitClickImg_withBool([check_img.donate, check_img.donate2], 1, 0) and maxTryTimes > 0:
  598. maxTryTimes -= 1
  599. return True
  600. class task_checkAdventure(dongri_task):
  601. def __init__(self):
  602. super().__init__(f"检查冒险")
  603. def run(self):
  604. basic_operate.go_town()
  605. if waitClickImg_noWait_withBool(check_img.adventure, 2, 1) == False:
  606. return False
  607. if waitClickImg_noWait_withBool(check_img.get, 2, 1) == False:
  608. return False
  609. if waitClickImg_noWait_withBool(check_img.bigGet, 2, 1) == False:
  610. return False
  611. return True
  612. class task_waitTime(dongri_task):
  613. def __init__(self):
  614. super().__init__(f"等待时间")
  615. def run(self):
  616. myTimeSleep(300)
  617. class check_buildOrResearch(dongri_task):
  618. def __init__(self):
  619. super().__init__(f"检查建筑或研究")
  620. def run(self):
  621. basic_operate.go_town()
  622. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  623. return False
  624. if waitClickImg_noWait_withBool(check_img.needgo, 2, 1) == False:
  625. return False
  626. dstType = 'none'
  627. while True:
  628. 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):
  629. dstType = 'build'
  630. break
  631. handRet, handPos = waitFindImg(check_img.hand, 2, 1)
  632. if not handRet:
  633. return False
  634. detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
  635. dstPos = [0, 0]
  636. if not detailRet:
  637. # 如果找不到详细信息,兵营之类的,需点中间
  638. dstPos = [handPos[0] - 70, handPos[1] + 120]
  639. else:
  640. dstPos = [detailPos[0] + 70, detailPos[1] - 100]
  641. tryTimes = 5
  642. while tryTimes > 0:
  643. tryTimes -= 1
  644. myTimeSleep_big()
  645. pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
  646. if waitClickImg_noWait_withBool(check_img.research, 2, 1):
  647. dstType = 'research'
  648. break
  649. elif waitClickImg_noWait_withBool(check_img.build_upgrade, 2, 1):
  650. dstType = 'build'
  651. break
  652. break
  653. if dstType == 'none':
  654. print('没有找到建筑或研究')
  655. return False
  656. elif dstType == 'build':
  657. buildtimes = 4
  658. 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]):
  659. buildtimes -= 1
  660. if buildtimes == 0:
  661. break
  662. continue
  663. elif dstType == 'research':
  664. if waitClickImg_withBool([check_img.research_type1, check_img.research_type2], 2, 1) == False:
  665. return False
  666. if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
  667. return False
  668. waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
  669. return True
  670. class task_information(dongri_task):
  671. def __init__(self, isAddStrengh = False):
  672. super().__init__(f"检查情报")
  673. self.isAddStrengh = isAddStrengh
  674. def run(self):
  675. basic_operate.go_outside()
  676. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  677. if self.isAddStrengh:
  678. basic_operate.add_strength()
  679. basic_operate.go_outside()
  680. else:
  681. print("没有足够的体力了")
  682. return False
  683. if waitClickImg_noWait_withBool(information_img.information, 1, 1) == False:
  684. return False
  685. hero_arr = [information_img.hero0, information_img.hero1, information_img.hero2, information_img.hero3, information_img.hero4]
  686. camp_arr = [information_img.camp1, information_img.camp2, information_img.camp3, information_img.camp4]
  687. wolf_arr = [information_img.wolf0, information_img.wolf1, information_img.wolf2, information_img.wolf3, information_img.wolf4]
  688. total_arr = hero_arr + camp_arr + wolf_arr
  689. if waitFindImg_withBool(total_arr, 2, 1) == False:
  690. return False
  691. if waitClickImg_noWait_withBool(hero_arr, 0.5, 0.5):
  692. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  693. return False
  694. if waitClickImg_noWait_withBool(information_img.explore, 1, 1) == False:
  695. return False
  696. if waitClickImg_noWait_withBool(information_img.hero_fight, 1, 1) == False:
  697. return False
  698. myTimeSleep_big()
  699. return True
  700. elif waitClickImg_noWait_withBool(camp_arr, 0.5, 0.5):
  701. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  702. return False
  703. if waitClickImg_noWait_withBool(information_img.survive, 1, 1) == False:
  704. return False
  705. return True
  706. elif waitClickImg_noWait_withBool(wolf_arr, 0.5, 0.5):
  707. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  708. return False
  709. if waitClickImg_noWait_withBool(information_img.fight, 1, 1) == False:
  710. return False
  711. if waitClickImg_noWait_withBool(monster_img.line1, 1, 1) == False:
  712. return False
  713. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  714. return False
  715. waitClickImg_noWait_withBool(monster_img.all_select, 0.1, 1)
  716. maxTryTimes = 3
  717. while maxTryTimes > 0:
  718. maxTryTimes -= 1
  719. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  720. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 1):
  721. break
  722. return True
  723. else:
  724. return False
  725. class task_returnAllLine(dongri_task):
  726. def __init__(self):
  727. super().__init__(f"返回所有路线")
  728. def run(self):
  729. basic_operate.go_outside()
  730. basic_operate.return_line()
  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. return True
  737. class task_paticipateInTeam(dongri_task):
  738. def __init__(self):
  739. typeArr = [1,4]
  740. type = typeArr[random.randint(0, len(typeArr) - 1)]
  741. if type == 1:
  742. self.line = monster_img.line1
  743. elif type == 4:
  744. self.line = monster_img.line4
  745. super().__init__(f"参与队伍{type}")
  746. def run(self):
  747. basic_operate.go_outside()
  748. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  749. return False
  750. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1, True) == False:
  751. yys_dragAuto(check_img.move_down)
  752. myTimeSleep_big()
  753. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1, True) == False:
  754. return False
  755. waitClickImg_noWait_withBool(self.line, 0.1, 1)
  756. maxTryTimes = 3
  757. while maxTryTimes > 0:
  758. maxTryTimes -= 1
  759. waitClickImg_withBool([monster_img.fight, monster_img.fight2, monster_img.fight3], 1, 0.5)
  760. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 0.5):
  761. break
  762. return True
  763. class task_cure(dongri_task):
  764. def __init__(self, continueCure = False, cureNum = None):
  765. cureStr = ""
  766. if continueCure:
  767. cureStr = f"连续"
  768. super().__init__(f"{cureStr}治疗{cureNum}")
  769. self.continueCure = continueCure
  770. self.cureNum = cureNum
  771. def run(self):
  772. basic_operate.go_town()
  773. basic_operate.go_outside()
  774. if waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
  775. return False
  776. while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5) == False:
  777. if waitClickImg_noWait_withBool(special_activity_img.quick_choose, 1, 0.5) == False:
  778. return False
  779. while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5):
  780. if waitClickImg_noWait_withBool(special_activity_img.choose_zero, 1, 0.5) == False:
  781. return False
  782. else:
  783. myTimeSleep_big()
  784. pcacc_mouse.input_string(str(self.cureNum))
  785. if self.continueCure == False:
  786. if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
  787. return False
  788. if waitClickImg_noWait_withBool(check_img.help4, 2, 1) == False:
  789. return False
  790. else:
  791. maxCureSoilder = 30000
  792. maxTryTimes = int(maxCureSoilder) // int(self.cureNum) * 2
  793. while waitClickImg_noWait_withBool((check_img.cure, check_img.help4, check_img.help5), 30, 0.2) and maxTryTimes >= 0:
  794. maxTryTimes -= 1
  795. continue
  796. waitClickImg_noWait_withBool((check_img.help4, check_img.help5), 1, 1)
  797. return True
  798. class task_useAnnimalSkill(dongri_task):
  799. def __init__(self):
  800. super().__init__(f"使用动物技能")
  801. def run(self):
  802. basic_operate.go_outside()
  803. if waitClickImg_noWait_withBool(check_img.annimal_skill, 2, 1) == False:
  804. return False
  805. if waitClickImg_noWait_withBool((check_img.wolf_skill, check_img.elephant_skill, check_img.lu_skill), 2, 1) == False:
  806. return False
  807. if waitClickImg_noWait_withBool((check_img.use, check_img.use2), 2, 1) == False:
  808. return False
  809. class task_activity_lianmeng(dongri_task):
  810. def __init__(self):
  811. super().__init__(f"联盟总动员")
  812. def run(self):
  813. basic_operate.go_town()
  814. if waitClickImg_noWait_withBool(special_activity_img.normal, 1, 0.5) == False:
  815. return False
  816. if waitClickImg_noWait_withBool((special_activity_img.lianmeng,special_activity_img.lianmeng2), 1, 0.5) == False:
  817. yys_dragAuto(special_activity_img.move_left)
  818. myTimeSleep_small()
  819. yys_dragAuto(special_activity_img.move_left)
  820. myTimeSleep_small()
  821. if waitClickImg_noWait_withBool((special_activity_img.lianmeng,special_activity_img.lianmeng2), 1, 0.5) == False:
  822. return False
  823. waitClickImg_noWait_withBool(special_activity_img.task_done, 1, 0.5)
  824. if waitFindImg_withBool(special_activity_img.doing_task, 1, 0.5) == False:
  825. down_tryTimes = 3
  826. while down_tryTimes > 0:
  827. down_tryTimes -= 1
  828. 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:
  829. if waitClickImg_noWait_withBool(special_activity_img.accept_task, 2, 1) == False:
  830. return False
  831. break
  832. elif waitFindImg_withBool(special_activity_img.shili_2, 1, 0.5) == True:
  833. save_game_screen()
  834. yys_dragAuto(special_activity_img.move_down)
  835. up_tryTimes = 5
  836. while up_tryTimes > 0:
  837. up_tryTimes -= 1
  838. myTimeSleep_small()
  839. yys_dragAuto(change_direction(special_activity_img.move_down))
  840. if waitFindImg_withBool((special_activity_img.shili_120, special_activity_img.shili_860_2), 2, 0.5, True) == False:
  841. maxTryTimes = 2
  842. while waitClickImg_noWait_withBool((special_activity_img.owning2), 2, 1) == True:
  843. waitClickImg_noWait_withBool(special_activity_img.refresh_task, 2, 1)
  844. waitClickImg_noWait_withBool(special_activity_img.refresh, 2, 1)
  845. maxTryTimes -= 1
  846. if maxTryTimes <= 0:
  847. break
  848. return True
  849. class task_checkMaster(dongri_task):
  850. def __init__(self):
  851. super().__init__(f"检查统帅")
  852. def run(self):
  853. basic_operate.go_town()
  854. if waitClickImg_noWait_withBool(check_img.master, 2, 1) == False:
  855. return False
  856. if waitClickImg_noWait_withBool(check_img.master_get, 2, 1) == False:
  857. return False
  858. myTimeSleep_big()
  859. pcacc_mouse.quickclick_current()
  860. if waitClickImg_noWait_withBool(check_img.little_treasure, 2, 1) == False:
  861. return False
  862. return True
  863. class task_checkActivities(dongri_task):
  864. def __init__(self):
  865. super().__init__(f"检查各种活动时间")
  866. def find_all_matching_events(self, parts, input_word):
  867. results = []
  868. # 查找所有包含输入关键词的项
  869. matches = [i for i, part in enumerate(parts) if input_word in part]
  870. for match_index in matches:
  871. # 从匹配项开始向后查找第一个时间或状态
  872. for i in range(match_index + 1, len(parts)):
  873. current_part = parts[i]
  874. # 检查是否是时间(如 19:30)或状态(如 已结束)
  875. if re.match(r'^\d{1,2}:\d{2}$', current_part) or current_part in ["已结束"]:
  876. dst = {"item":parts[match_index], "time":current_part}
  877. results.append(dst)
  878. break # 找到第一个匹配就停止
  879. return results
  880. def run(self):
  881. global todo_msg, todo_list
  882. basic_operate.go_outside()
  883. if waitClickImg_noWait_withBool(check_img.activity_open, 2, 1) == False:
  884. return False
  885. if waitFindImg_withBool(check_img.todoList, 2, 1) == False:
  886. return False
  887. activityStr = yys_ocrAuto(check_img.todo_region)
  888. if activityStr:
  889. todo_msg = activityStr
  890. print(todo_msg)
  891. result = []
  892. judianArr = self.find_all_matching_events(activityStr, "据点")
  893. result.extend(judianArr)
  894. baoleiArr = self.find_all_matching_events(activityStr, "堡垒")
  895. result.extend(baoleiArr)
  896. juxiongArr = self.find_all_matching_events(activityStr, "巨熊")
  897. result.extend(juxiongArr)
  898. yaosaiArr = self.find_all_matching_events(activityStr, "要塞")
  899. result.extend(yaosaiArr)
  900. todo_list = result
  901. print(todo_list)
  902. return activityStr
  903. class task_visit_island(dongri_task):
  904. def __init__(self):
  905. super().__init__(f"访问岛屿")
  906. def run(self):
  907. basic_operate.go_outside()
  908. if waitClickImg_noWait_withBool(check_img.visit_island_small, 2, 1) == False:
  909. return False
  910. if waitClickImg_noWait_withBool(check_img.visit_enter, 2, 1) == False:
  911. return False
  912. if waitClickImg_noWait_withBool(check_img.visit_island_big, 2, 1) == False:
  913. return False
  914. return True
  915. class task_fight_ranshuang(dongri_task):
  916. def __init__(self):
  917. super().__init__(f"打燃霜")
  918. def run(self):
  919. basic_operate.backToGame()
  920. while True:
  921. if waitClickImg_noWait_withBool(monster_img.ranshuang_search, 0.5, 0.5) == False:
  922. return False
  923. if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 0.5, 0.5) == False:
  924. firstPos = get_yys_random_point(special_activity_img.mid_enemy_region)
  925. pcacc_mouse.click(firstPos[0], firstPos[1])
  926. myTimeSleep_big()
  927. if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 1, 0.5) == False:
  928. break
  929. break
  930. if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 1, 0.5) == False:
  931. return False
  932. return True
  933. class task_fight_enemy(dongri_task):
  934. def __init__(self):
  935. super().__init__(f"打敌人or王城")
  936. def run(self):
  937. basic_operate.go_town()
  938. basic_operate.go_outside()
  939. if waitClickImg_noWait_withBool(special_activity_img.collection, 2, 1) == False:
  940. return False
  941. if waitClickImg_noWait_withBool(special_activity_img.enemy, 2, 1) == False:
  942. return False
  943. attackArr = [monster_img.attack, monster_img.attack2, monster_img.ranshuang_attack, monster_img.outside_attack, monster_img.defend]
  944. myTimeSleep_big()
  945. firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
  946. pcacc_mouse.click(firstPos[0], firstPos[1])
  947. maxTryTimes = 5
  948. if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
  949. return False
  950. while waitFindImg_withBool(attackArr, 1, 0) == False and maxTryTimes > 0:
  951. if waitClickImg_noWait_withBool(special_activity_img.outside_soilder, 1, 1) == True:
  952. break
  953. #if waitFindImg_withBool(special_activity_img.outside_pcacc, 1, 1) == True:
  954. # break
  955. #else:
  956. # return False
  957. maxTryTimes -= 1
  958. myTimeSleep_big()
  959. mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
  960. pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
  961. myTimeSleep_big()
  962. if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
  963. return False
  964. if waitClickImg_noWait_withBool(attackArr, 1, 0) == False:
  965. return False
  966. waitClickImg_noWait_withBool(monster_img.team_go, 2, 1)#派遣队伍
  967. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  968. return False
  969. if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 2, 1) == False:
  970. return False
  971. return True
  972. class task_get_redPackage(dongri_task):
  973. def __init__(self):
  974. super().__init__(f"领取红包")
  975. def run(self):
  976. basic_operate.go_outside()
  977. if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2, check_img.talk_in3), 2, 1) == False:
  978. return False
  979. waitClickImg_noWait_withBool(check_img.talkin_person, 2, 1)
  980. oldTime = time.time()
  981. while True:
  982. if time.time() - oldTime > 150:
  983. break
  984. 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)
  985. return True
  986. class task_read_mails(dongri_task):
  987. def __init__(self):
  988. super().__init__(f"读邮件")
  989. def run(self):
  990. basic_operate.go_town()
  991. if waitClickImg_noWait_withBool(check_img.mail_btn, 2, 1) == False:
  992. return False
  993. waitClickImg_noWait_withBool(check_img.mail_collect, 2, 1)
  994. if waitClickImg_noWait_withBool(check_img.mail_union, 2, 1) == False:
  995. return False
  996. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  997. return False
  998. if waitClickImg_noWait_withBool(check_img.mail_system, 2, 1) == False:
  999. return False
  1000. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  1001. return False
  1002. if waitClickImg_noWait_withBool(check_img.mail_reports, 2, 1) == False:
  1003. return False
  1004. if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
  1005. return False
  1006. return True
  1007. class task_checkBenifitStatus(dongri_task):
  1008. def __init__(self):
  1009. super().__init__(f"查看增益状态")
  1010. def run(self):
  1011. basic_operate.go_town()
  1012. if waitFindImg_withBool(check_img.benefit_collect, 2, 1) == True:
  1013. return True
  1014. if waitClickImg_noWait_withBool(check_img.add_benefit, 2, 1) == False:
  1015. return False
  1016. waitClickImg_noWait_withBool(check_img.benefit_evolve, 2, 1)
  1017. if waitClickImg_noWait_withBool(check_img.benefit_collect_info, 2, 1) == False:
  1018. return False
  1019. myTimeSleep_big()
  1020. dstPos = get_yys_random_point(check_img.benefit_use_region)
  1021. pcacc_mouse.click(dstPos[0], dstPos[1])
  1022. myTimeSleep_big()
  1023. if waitClickImg_noWait_withBool(check_img.benefit_buy, 2, 1) == False:
  1024. return False
  1025. waitClickImg_noWait_withBool(check_img.buy_enter, 2, 1)
  1026. return True
  1027. class task_checkDiamond(dongri_task):
  1028. def __init__(self):
  1029. super().__init__(f"查看钻石活动")
  1030. def run(self):
  1031. basic_operate.go_town()
  1032. if waitClickImg_noWait_withBool(check_img.worthy_activity, 2, 1) == False:
  1033. return False
  1034. myTimeSleep_big()
  1035. yys_dragAuto(change_direction(special_activity_img.move_left))
  1036. myTimeSleep_big()
  1037. yys_dragAuto(change_direction(special_activity_img.move_left))
  1038. waitClickImg_noWait_withBool(check_img.diamond_activity, 2, 1)
  1039. waitClickImg_noWait_withBool(check_img.gain_diamond, 2, 1)
  1040. dstPos = get_yys_random_point(check_img.diamond_save)
  1041. pcacc_mouse.click(dstPos[0], dstPos[1])
  1042. myTimeSleep_big()
  1043. dstPos = get_yys_random_point(check_img.diamond_saveMax)
  1044. pcacc_mouse.click(dstPos[0], dstPos[1])
  1045. myTimeSleep_big()
  1046. if waitClickImg_noWait_withBool(check_img.diamond_save_btn, 2, 1) == False:
  1047. return False
  1048. return True
  1049. class task_fight_campion(dongri_task):
  1050. def __init__(self):
  1051. super().__init__(f"打竞技场")
  1052. def run(self):
  1053. basic_operate.go_town()
  1054. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  1055. return False
  1056. myTimeSleep_big()
  1057. if waitClickImg_noWait_withBool(special_activity_img.goto_arrow, 2, 1) == False:
  1058. return False
  1059. myTimeSleep_big()
  1060. maxMoveTimes = 2
  1061. while maxMoveTimes > 0:
  1062. maxMoveTimes -= 1
  1063. yys_dragAuto(special_activity_img.champion_move)
  1064. myTimeSleep_big()
  1065. if waitClickImg_noWait_withBool(special_activity_img.enter_champion, 2, 1) == True:
  1066. break
  1067. if waitClickImg_noWait_withBool(special_activity_img.champion_fight, 2, 1) == False:
  1068. return False
  1069. myTimeSleep_big()
  1070. dstPos = get_yys_random_point(special_activity_img.fight_last)
  1071. pcacc_mouse.click(dstPos[0], dstPos[1])
  1072. myTimeSleep_big()
  1073. if waitClickImg_noWait_withBool(special_activity_img.champion_fight2, 2, 1) == False:
  1074. return False
  1075. return True
  1076. class check_safe_collect(dongri_task):
  1077. def __init__(self):
  1078. super().__init__(f"检查安全收集")
  1079. def run(self):
  1080. basic_operate.go_outside()
  1081. if waitClickImg_noWait_withBool(special_activity_img.collection, 2, 1) == False:
  1082. return False
  1083. if waitClickImg_noWait_withBool(special_activity_img.collection_friend, 2, 1) == False:
  1084. return False
  1085. myTimeSleep_big()
  1086. firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
  1087. pcacc_mouse.click(firstPos[0], firstPos[1])
  1088. maxTryTimes = 5
  1089. while waitClickImg_noWait_withBool(monster_img.collect, 1, 1) == False and maxTryTimes > 0:
  1090. maxTryTimes -= 1
  1091. myTimeSleep_big()
  1092. mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
  1093. pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
  1094. myTimeSleep_big()
  1095. if waitClickImg_noWait_withBool(special_activity_img.big_collect, 2, 1) == False:
  1096. return False
  1097. if waitClickImg_noWait_withBool(monster_img.line7, 2, 1) == False:
  1098. return False
  1099. maxTryTimes = 3
  1100. while maxTryTimes > 0:
  1101. maxTryTimes -= 1
  1102. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  1103. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  1104. if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
  1105. break
  1106. return True
  1107. if __name__ == '__main__':
  1108. #save_game_screen()
  1109. #basic_operate.get_line_num()
  1110. #task_cure(True, 85).run()
  1111. #task_fight_enemy().run()
  1112. #task_fight_ranshuang().run()
  1113. #task_gotoTree().run()
  1114. #task_fight_jina_only().run()
  1115. #task_checkConfilits().run()
  1116. #task_checkActivities().run()
  1117. #task_checkMaster().run()
  1118. #basic_operate.get_line_num()
  1119. #yys_ocrAuto(check_img.line_orc)
  1120. #basic_operate.go_town()
  1121. #basic_operate.add_strength()
  1122. #task_fightMonster(False, False,False).run()
  1123. #task_checkHelp().run()
  1124. #task_checkStoreRoom().run()
  1125. #task_start_game(0)
  1126. check_safe_collect().run()
  1127. #task_fight_campion().run()
  1128. #task_activity_lianmeng().run()
  1129. #task_fight_yongbing(True).run()
  1130. #task_collect([4,3,2,1]).run()
  1131. #task_train("upgrade").run()
  1132. #task_information(True).run()
  1133. #check_buildOrResearch().run()
  1134. #task_checkDonata().run()
  1135. #task_collect(1).run()
  1136. #task_collect(2).run()
  1137. #task_collect(3).run()
  1138. #task_collect(4).run()
  1139. #task_returnAllLine().run()
  1140. #task_paticipateInTeam().run()
  1141. #task_fight_jina(True).run()
  1142. #task_get_redPackage().run()
  1143. #task_read_mails().run()
  1144. #task_checkBenifitStatus().run()
  1145. #task_checkDiamond().run()