dongri_task.py 50 KB

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