dongri_task.py 49 KB

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