dongri_task.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. # -*- coding: utf-8 -*-
  2. from scriptBase.imgFind import pcacc_img, savePic
  3. from scriptBase.mouseClick import pcacc_mouse
  4. from scriptBase.ocr import capture_and_ocr
  5. import scriptBase.base
  6. from scriptBase.comon import *
  7. from scriptBase.ocr import *
  8. from apscheduler.schedulers.blocking import BlockingScheduler
  9. import pyautogui
  10. import random
  11. import sys
  12. import math
  13. import os
  14. import time
  15. from dongri_define import *
  16. from dongri_pic import *
  17. import subprocess
  18. import socket
  19. from dongri_pic import _imported
  20. '''
  21. 基础配置说明:
  22. 600*800(DPI 300)
  23. 游戏画面:流畅
  24. 高帧率关闭
  25. 町中模式:旧版
  26. '''
  27. def task_getComputerName():
  28. return socket.gethostname()
  29. def task_acceptTask():
  30. while True:
  31. myTimeSleep_big()
  32. def init():
  33. global _imported
  34. if not _imported:
  35. acceptTask = threading.Thread(target=task_acceptTask)
  36. acceptTask.daemon = True
  37. if acceptTask.is_alive() == False:
  38. acceptTask.start()
  39. _imported = True
  40. class basic_operate:
  41. @staticmethod
  42. def do_back():
  43. task_return_game()
  44. ret = False
  45. ret |= waitClickImg_noWait_withBool(place_img.back1, 0.6, 0)
  46. if ret:
  47. return
  48. ret |= waitClickImg_noWait_withBool(place_img.back2, 0.6, 0)
  49. if ret:
  50. return
  51. ret |= waitClickImg_noWait_withBool(place_img.back3, 0.6, 0)
  52. if ret:
  53. return
  54. ret, pos = waitFindImg(place_img.title, 1, 0)
  55. if ret:
  56. pcacc_mouse.click(pos[0], pos[1] + 80)
  57. def backToGame(preTime = 0):
  58. tryMaxTimes = 5
  59. while tryMaxTimes > 0:
  60. tryMaxTimes -= 1
  61. if waitFindImg_withBool(place_img.gameIn, 1, preTime) == False:
  62. basic_operate.do_back()
  63. else:
  64. return True
  65. return False
  66. @staticmethod
  67. def go_town(preTime = 0):
  68. if basic_operate.backToGame(preTime) == False:
  69. return False
  70. waitClickImg_noWait_withBool(place_img.outside, 0.6, 0)
  71. return True
  72. @staticmethod
  73. def go_outside(preTime = 0):
  74. if basic_operate.backToGame(preTime) == False:
  75. return False
  76. waitClickImg_noWait_withBool(place_img.town, 0.6, 0)
  77. return True
  78. @staticmethod
  79. def click_outside_search():
  80. taskListRet, taskListPos = waitFindImg(monster_img.tasklist, 2, 3)
  81. if taskListRet == False:
  82. return False
  83. else:
  84. pcacc_mouse.click(taskListPos[0], taskListPos[1] - 110)#click search
  85. myTimeSleep_big()
  86. return True
  87. @staticmethod
  88. def enter_auto_supply_resource(enter_pic):
  89. if waitClickImg_noWait_withBool(enter_pic, 2, 2) == False:
  90. return False
  91. if waitClickImg_noWait_withBool(train_img.getAll, 2, 1) == False:
  92. return True
  93. if waitClickImg_noWait_withBool(train_img.enter, 2, 1) == False:
  94. return False
  95. if waitClickImg_noWait_withBool(enter_pic, 2, 1) == False:
  96. return False
  97. return True
  98. @staticmethod
  99. def return_line():
  100. if waitClickImg_noWait_withBool(monster_img.returnLine, 2, 1) == False:
  101. return False
  102. if waitClickImg_noWait_withBool(monster_img.enter, 2, 1) == False:
  103. return False
  104. return True
  105. @staticmethod
  106. def add_strength():
  107. if waitClickImg_noWait_withBool(check_img.no_strength, 2, 1) == False:
  108. return False
  109. if waitClickImg_noWait_withBool(check_img.add_strength, 2, 1) == False:
  110. return False
  111. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  112. return False
  113. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  114. return False
  115. if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
  116. return False
  117. return True
  118. def task_return_game():
  119. tryTimes = 3
  120. while tryTimes > 0:
  121. if False == waitFindImg_withBool([place_img.title], 1, 1):
  122. waitClickImg_noWait([place_img.ico, place_img.ico2], 1, 0)
  123. myTimeSleep_big()
  124. tryTimes -= 1
  125. if tryTimes == 0:
  126. return False
  127. else:
  128. break
  129. def task_save_compress_pic():
  130. # 截取屏幕截图
  131. screenshot = pyautogui.screenshot()
  132. compressed_data = compress_image(screenshot)
  133. # 保存压缩后的图像到文件
  134. with open('compressed_screenshot.jpg', 'wb') as f:
  135. f.write(compressed_data)
  136. def task_close_game():
  137. subprocess.call(f"taskkill /f /im MuMuPlayer.exe")
  138. subprocess.call(f"taskkill /f /im MuMuVMMHeadless.exe")
  139. subprocess.call(f"taskkill /f /im MuMuVMMSVC.exe")
  140. myTimeSleep_big()
  141. def task_start_game():
  142. isSuccess = True
  143. path1 = R'C:\\Program Files\\Netease\\MuMuPlayer-12.0\\shell\\MuMuPlayer.exe'
  144. path2 = R'C:\Program Files\Netease\MuMu Player 12\shell\MuMuPlayer.exe'
  145. if os.path.exists(path1):
  146. subprocess.Popen(path1)
  147. elif os.path.exists(path2):
  148. subprocess.Popen(path2)
  149. if waitClickImg_withBool(gameStart_img.ico, 100, 20) == False:
  150. return False
  151. waitFindImg_withBool(place_img.gameIn, 10, 20)
  152. basic_operate.go_town()
  153. waitFindImg_withBool(place_img.gameIn, 10, 20)
  154. basic_operate.go_town()
  155. if waitFindImg_withBool(place_img.gameIn, 10, 20) == False:
  156. return False
  157. myTimeSleep_big()
  158. return isSuccess
  159. class dongri_task:
  160. def __init__(self, name):
  161. self.name = name
  162. def run(self):
  163. print(f"Running task: {self.name}")
  164. class task_fight_jina(dongri_task):
  165. def __init__(self, add_strengh):
  166. super().__init__("战斗吉娜")
  167. self.add_strengh = add_strengh
  168. def run(self):
  169. basic_operate.go_outside()
  170. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  171. if self.add_strengh:
  172. basic_operate.add_strength()
  173. basic_operate.go_outside()
  174. else:
  175. print("没有足够的体力了")
  176. return False
  177. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  178. return False
  179. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  180. return False
  181. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  182. return False
  183. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  184. return False
  185. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  186. return False
  187. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  188. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  189. return False
  190. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  191. return False
  192. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  193. return False
  194. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  195. maxTryTimes = 3
  196. while maxTryTimes > 0:
  197. maxTryTimes -= 1
  198. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 2, 1)
  199. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  200. return True
  201. class task_fightMonster(dongri_task):
  202. def __init__(self, add_strengh, fight_bigMonster, isSimple):
  203. self.add_strengh = add_strengh
  204. self.isSimple = isSimple
  205. if fight_bigMonster == True:
  206. super().__init__(f"战斗大怪物")
  207. self.monster = monster_img.bigMonster
  208. self.attack = monster_img.muti_team
  209. else:
  210. super().__init__(f"战斗小怪物")
  211. self.monster = monster_img.wolf
  212. self.attack = monster_img.attack
  213. def run(self):
  214. basic_operate.go_outside()
  215. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  216. if self.add_strengh:
  217. basic_operate.add_strength()
  218. basic_operate.go_outside()
  219. else:
  220. print("没有足够的体力了")
  221. return False
  222. if False == basic_operate.click_outside_search():
  223. return False
  224. if waitFindImg_withBool(monster_img.search, 2, 1):
  225. myTimeSleep_big()
  226. yys_dragAuto(monster_img.move_left)
  227. if waitClickImg_noWait_withBool(self.monster, 2, 1) == False:
  228. return False
  229. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  230. return False
  231. if waitClickImg_noWait_withBool(self.attack, 2, 1) == False:
  232. return False
  233. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  234. if not self.isSimple:
  235. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  236. return False
  237. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  238. return False
  239. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  240. return False
  241. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  242. maxTryTimes = 3
  243. while maxTryTimes > 0:
  244. maxTryTimes -= 1
  245. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 2, 1)
  246. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  247. return True
  248. class task_collect(dongri_task):
  249. def __init__(self, type = 0, isSimple = False):
  250. self.isSimple = isSimple
  251. if isinstance(type, (list, tuple)):
  252. typeArr = type
  253. type = typeArr[random.randint(0, len(typeArr) - 1)]
  254. elif type == 0:
  255. typeArr = [4,4,3,3,3,2,2,2,1,1]
  256. type = typeArr[random.randint(0, len(typeArr) - 1)]
  257. elif type == 5:
  258. typeArr = [2,1]
  259. type = typeArr[random.randint(0, len(typeArr) - 1)]
  260. if type == 1:
  261. self.type = monster_img.meat
  262. self.line = monster_img.line2
  263. super().__init__(f"采集肉")
  264. elif type == 2:
  265. self.type = monster_img.wood
  266. self.line = monster_img.line3
  267. super().__init__(f"采集木头")
  268. elif type == 3:
  269. self.type = monster_img.mine
  270. self.line = monster_img.line4
  271. super().__init__(f"采矿石")
  272. elif type == 4:
  273. self.type = monster_img.iron
  274. self.line = monster_img.line5
  275. super().__init__(f"采集铁矿石")
  276. if isSimple:
  277. self.line = None
  278. def run(self):
  279. basic_operate.go_outside()
  280. if False == basic_operate.click_outside_search():
  281. return False
  282. if waitFindImg_withBool(monster_img.search, 2, 1):
  283. myTimeSleep_big()
  284. yys_dragAuto(monster_img.move_right)
  285. if waitClickImg_noWait_withBool(self.type, 2, 1) == False:
  286. return False
  287. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  288. return False
  289. if waitClickImg_withBool(monster_img.collect, 2, 1) == False:
  290. return False
  291. if self.line != None:
  292. waitClickImg_noWait_withBool(self.line, 2, 1)
  293. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  294. return False
  295. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  296. maxTryTimes = 3
  297. while maxTryTimes > 0:
  298. maxTryTimes -= 1
  299. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 2, 1)
  300. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  301. return True
  302. class task_train(dongri_task):
  303. def __init__(self, force_lv1 = False):
  304. super().__init__(f"检查训练")
  305. self.force_lv1 = force_lv1
  306. def run(self):
  307. basic_operate.go_town()
  308. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  309. return False
  310. if waitClickImg_noWait_withBool(train_img.train_success, 2, 1) == False:
  311. return False
  312. tryTimes = 3
  313. while tryTimes > 0:
  314. tryTimes -= 1
  315. waitClickImg_noWait_withBool([train_img.dun, train_img.gong, train_img.mao], 2, 1)
  316. if waitClickImg_noWait_withBool(train_img.train, 2, 1):
  317. break
  318. if self.force_lv1:
  319. myTimeSleep_big()
  320. yys_dragAuto(train_img.move_left)
  321. yys_dragAuto(train_img.move_left)
  322. waitClickImg_noWait_withBool(train_img.soilder_lv1, 2, 1)
  323. return basic_operate.enter_auto_supply_resource(train_img.begin_train)
  324. class task_checkHelp(dongri_task):
  325. def __init__(self, isOutSide = False):
  326. super().__init__(f"检查帮助")
  327. self.isOutSide = isOutSide
  328. def run(self):
  329. if self.isOutSide:
  330. basic_operate.go_outside()
  331. else:
  332. basic_operate.go_town()
  333. waitClickImg_noWait_withBool(place_img.help, 2, 1)
  334. return True
  335. class task_checkStoreRoom(dongri_task):
  336. def __init__(self):
  337. super().__init__(f"检查仓库或招募")
  338. def run(self):
  339. basic_operate.go_town()
  340. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  341. return False
  342. myTimeSleep_big()
  343. yys_dragAuto(check_img.move_down)
  344. myTimeSleep_big()
  345. if waitClickImg_noWait_withBool((train_img.train_success, check_img.needgo), 2, 1) == False:
  346. return False
  347. myTimeSleep_big()
  348. pcacc_mouse.quickclick_current()
  349. if waitClickImg_noWait_withBool((check_img.storeroom, check_img.invite_free), 2, 1) == False:
  350. return False
  351. return True
  352. class task_checkConfilits(dongri_task):
  353. def __init__(self):
  354. super().__init__(f"检查集结")
  355. def run(self):
  356. basic_operate.go_outside()
  357. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  358. return False
  359. if waitClickImg_noWait_withBool(check_img.paticipate, 2, 1) == False:
  360. return False
  361. if waitClickImg_noWait_withBool(check_img.auto_confilit, 2, 1) == False:
  362. return False
  363. return True
  364. class task_checkDonata(dongri_task):
  365. def __init__(self):
  366. super().__init__(f"检查捐献")
  367. def run(self):
  368. basic_operate.go_town()
  369. if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
  370. return False
  371. if waitClickImg_noWait_withBool(check_img.union_technology, 2, 1) == False:
  372. return False
  373. if waitClickImg_noWait_withBool(check_img.technology_better, 2, 1) == False:
  374. return False
  375. if waitClickImg_withBool([check_img.donate, check_img.donate2], 2, 1) == False:
  376. return False
  377. else:
  378. maxTryTimes = 3
  379. while waitClickImg_withBool([check_img.donate, check_img.donate2], 1, 0) and maxTryTimes > 0:
  380. maxTryTimes -= 1
  381. return True
  382. class task_checkAdventure(dongri_task):
  383. def __init__(self):
  384. super().__init__(f"检查冒险")
  385. def run(self):
  386. basic_operate.go_town()
  387. if waitClickImg_noWait_withBool(check_img.adventure, 2, 1) == False:
  388. return False
  389. if waitClickImg_noWait_withBool(check_img.get, 2, 1) == False:
  390. return False
  391. if waitClickImg_noWait_withBool(check_img.bigGet, 2, 1) == False:
  392. return False
  393. return True
  394. class task_waitTime(dongri_task):
  395. def __init__(self):
  396. super().__init__(f"等待时间")
  397. def run(self):
  398. myTimeSleep(300)
  399. class check_buildOrResearch(dongri_task):
  400. def __init__(self):
  401. super().__init__(f"检查建筑或研究")
  402. def run(self):
  403. basic_operate.go_town()
  404. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  405. return False
  406. if waitClickImg_noWait_withBool(check_img.needgo, 2, 1) == False:
  407. return False
  408. dstType = 'none'
  409. while True:
  410. 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):
  411. dstType = 'build'
  412. break
  413. handRet, handPos = waitFindImg(check_img.hand, 2, 1)
  414. if not handRet:
  415. return False
  416. detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
  417. dstPos = [0, 0]
  418. if not detailRet:
  419. # 如果找不到详细信息,兵营之类的,需点中间
  420. dstPos = [handPos[0] - 70, handPos[1] + 120]
  421. else:
  422. dstPos = [detailPos[0] + 70, detailPos[1] - 100]
  423. tryTimes = 5
  424. while tryTimes > 0:
  425. tryTimes -= 1
  426. myTimeSleep_big()
  427. pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
  428. if waitClickImg_noWait_withBool(check_img.research, 2, 1):
  429. dstType = 'research'
  430. break
  431. elif waitClickImg_noWait_withBool(check_img.build_upgrade, 2, 1):
  432. dstType = 'build'
  433. break
  434. break
  435. if dstType == 'none':
  436. print('没有找到建筑或研究')
  437. return False
  438. elif dstType == 'build':
  439. buildtimes = 4
  440. 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]):
  441. buildtimes -= 1
  442. if buildtimes == 0:
  443. break
  444. continue
  445. elif dstType == 'research':
  446. if waitClickImg_withBool([check_img.research_type1, check_img.research_type2], 2, 1) == False:
  447. return False
  448. if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
  449. return False
  450. waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
  451. return True
  452. class task_information(dongri_task):
  453. def __init__(self):
  454. super().__init__(f"检查情报")
  455. def run(self):
  456. basic_operate.go_outside()
  457. if waitClickImg_noWait_withBool(information_img.information, 1, 1) == False:
  458. return False
  459. if waitClickImg_noWait_withBool([information_img.hero0, information_img.hero1, information_img.hero2], 0.5, 0.5):
  460. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  461. return False
  462. if waitClickImg_noWait_withBool(information_img.explore, 1, 1) == False:
  463. return False
  464. if waitClickImg_noWait_withBool(information_img.hero_fight, 1, 1) == False:
  465. waitClickImg_noWait(information_img.add_strength, 1, 1)
  466. waitClickImg_noWait(information_img.add_strength, 1, 1)
  467. waitClickImg_noWait(information_img.add_strength, 1, 1)
  468. return False
  469. myTimeSleep_big()
  470. return True
  471. elif waitClickImg_noWait_withBool([information_img.camp1, information_img.camp2], 0.5, 0.5):
  472. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  473. return False
  474. if waitClickImg_noWait_withBool(information_img.survive, 1, 1) == False:
  475. return False
  476. waitClickImg_noWait(information_img.add_strength, 1, 1)
  477. waitClickImg_noWait(information_img.add_strength, 1, 1)
  478. waitClickImg_noWait(information_img.add_strength, 1, 1)
  479. return True
  480. elif waitClickImg_noWait_withBool([information_img.wolf0, information_img.wolf1, information_img.wolf2], 0.5, 0.5):
  481. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  482. return False
  483. if waitClickImg_noWait_withBool(information_img.fight, 1, 1) == False:
  484. return False
  485. if waitClickImg_noWait_withBool(monster_img.line1, 1, 1) == False:
  486. return False
  487. if waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1) == False:
  488. return False
  489. waitClickImg_noWait(information_img.add_strength, 1, 1)
  490. waitClickImg_noWait(information_img.add_strength, 1, 1)
  491. waitClickImg_noWait(information_img.add_strength, 1, 1)
  492. return True
  493. else:
  494. return False
  495. class task_returnAllLine(dongri_task):
  496. def __init__(self):
  497. super().__init__(f"返回所有路线")
  498. def run(self):
  499. basic_operate.go_outside()
  500. basic_operate.return_line()
  501. basic_operate.return_line()
  502. basic_operate.return_line()
  503. basic_operate.return_line()
  504. basic_operate.return_line()
  505. basic_operate.return_line()
  506. return True
  507. class task_paticipateInTeam(dongri_task):
  508. def __init__(self):
  509. super().__init__(f"参与队伍")
  510. def run(self):
  511. basic_operate.go_outside()
  512. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  513. return False
  514. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1) == False:
  515. return False
  516. while True:
  517. if waitClickImg_noWait_withBool(monster_img.line1, 0.1, 1) == False:
  518. break
  519. if waitFindImg_withBool(monster_img.no_hero, 0.1, 1) == False:
  520. break
  521. if waitClickImg_noWait_withBool(monster_img.line4, 0.1, 1) == False:
  522. break
  523. if waitFindImg_withBool(monster_img.no_hero, 0.1, 1) == False:
  524. break
  525. break
  526. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  527. return False
  528. waitClickImg_noWait_withBool(monster_img.all_select, 0.1, 1)
  529. maxTryTimes = 3
  530. while maxTryTimes > 0:
  531. maxTryTimes -= 1
  532. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  533. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 1):
  534. break
  535. return True
  536. class task_cure(dongri_task):
  537. def __init__(self):
  538. super().__init__(f"治疗")
  539. def run(self):
  540. basic_operate.go_outside()
  541. if waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
  542. return False
  543. if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
  544. return False
  545. if waitClickImg_noWait_withBool(check_img.help4, 2, 1) == False:
  546. return False
  547. return True
  548. class task_useAnnimalSkill(dongri_task):
  549. def __init__(self):
  550. super().__init__(f"使用动物技能")
  551. def run(self):
  552. basic_operate.go_outside()
  553. if waitClickImg_noWait_withBool(check_img.annimal_skill, 2, 1) == False:
  554. return False
  555. if waitClickImg_noWait_withBool(check_img.wolf_skill, 2, 1) == False:
  556. return False
  557. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  558. return False
  559. if __name__ == '__main__':
  560. #basic_operate.go_town()
  561. #basic_operate.add_strength()
  562. #task_fightMonster(False, True).run()
  563. #task_checkHelp().run()
  564. #task_checkStoreRoom().run()
  565. task_collect([4,3,2,1]).run()
  566. #task_train().run()
  567. #task_information().run()
  568. #check_buildOrResearch().run()
  569. #task_checkDonata().run()
  570. #task_collect(1).run()
  571. #task_collect(2).run()
  572. #task_collect(3).run()
  573. #task_collect(4).run()
  574. #task_returnAllLine().run()
  575. #task_paticipateInTeam().run()
  576. #task_fight_jina(True).run()