dongri_task.py 50 KB

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