dongri_task.py 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  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_yongbing(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.yongbing, 2, 1) == False:
  178. return False
  179. if waitClickImg_noWait_withBool(check_img.detect, 2, 1) == False:
  180. return False
  181. if waitClickImg_noWait_withBool(check_img.yongbing_fight, 2, 1) == False:
  182. return False
  183. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  184. return False
  185. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  186. return False
  187. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  188. return False
  189. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  190. maxTryTimes = 3
  191. while maxTryTimes > 0:
  192. maxTryTimes -= 1
  193. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  194. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  195. if waitClickImg_noWait_withBool(monster_img.all_select, 1, 1) == False:
  196. break
  197. return True
  198. class task_fight_jina(dongri_task):
  199. def __init__(self, add_strengh):
  200. super().__init__("战斗吉娜")
  201. self.add_strengh = add_strengh
  202. def run(self):
  203. basic_operate.go_outside()
  204. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  205. if self.add_strengh:
  206. basic_operate.add_strength()
  207. basic_operate.go_outside()
  208. else:
  209. print("没有足够的体力了")
  210. return False
  211. if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
  212. return False
  213. if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
  214. return False
  215. if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
  216. return False
  217. if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
  218. return False
  219. if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
  220. return False
  221. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  222. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  223. return False
  224. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  225. return False
  226. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  227. return False
  228. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  229. maxTryTimes = 3
  230. while maxTryTimes > 0:
  231. maxTryTimes -= 1
  232. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  233. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  234. if waitClickImg_noWait_withBool(monster_img.all_select, 1, 1) == False:
  235. break
  236. return True
  237. class task_fightMonster(dongri_task):
  238. def __init__(self, add_strengh, fight_bigMonster, isSimple):
  239. self.add_strengh = add_strengh
  240. self.isSimple = isSimple
  241. if fight_bigMonster == True:
  242. super().__init__(f"战斗大怪物")
  243. self.monster = monster_img.bigMonster
  244. self.attack = monster_img.muti_team
  245. else:
  246. super().__init__(f"战斗小怪物")
  247. self.monster = monster_img.wolf
  248. self.attack = monster_img.attack
  249. def run(self):
  250. basic_operate.go_outside()
  251. if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
  252. if self.add_strengh:
  253. basic_operate.add_strength()
  254. basic_operate.go_outside()
  255. else:
  256. print("没有足够的体力了")
  257. return False
  258. if False == basic_operate.click_outside_search():
  259. return False
  260. if waitFindImg_withBool(monster_img.search, 2, 1):
  261. myTimeSleep_big()
  262. yys_dragAuto(monster_img.move_left)
  263. if waitClickImg_noWait_withBool(self.monster, 2, 1) == False:
  264. return False
  265. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  266. return False
  267. if waitClickImg_noWait_withBool(self.attack, 2, 1) == False:
  268. return False
  269. waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
  270. if not self.isSimple:
  271. if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
  272. return False
  273. if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
  274. return False
  275. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  276. return False
  277. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  278. maxTryTimes = 3
  279. while maxTryTimes > 0:
  280. maxTryTimes -= 1
  281. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  282. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  283. if waitClickImg_noWait_withBool(monster_img.all_select, 1, 1) == False:
  284. break
  285. return True
  286. class task_collect(dongri_task):
  287. def __init__(self, type = 0, isSimple = False):
  288. self.isSimple = isSimple
  289. if isinstance(type, (list, tuple)):
  290. typeArr = type
  291. type = typeArr[random.randint(0, len(typeArr) - 1)]
  292. elif type == 0:
  293. typeArr = [4,4,3,3,3,2,2,2,1,1]
  294. type = typeArr[random.randint(0, len(typeArr) - 1)]
  295. elif type == 5:
  296. typeArr = [2,1]
  297. type = typeArr[random.randint(0, len(typeArr) - 1)]
  298. if type == 1:
  299. self.type = monster_img.meat
  300. self.line = monster_img.line2
  301. super().__init__(f"采集肉")
  302. elif type == 2:
  303. self.type = monster_img.wood
  304. self.line = monster_img.line3
  305. super().__init__(f"采集木头")
  306. elif type == 3:
  307. self.type = monster_img.mine
  308. self.line = monster_img.line4
  309. super().__init__(f"采矿石")
  310. elif type == 4:
  311. self.type = monster_img.iron
  312. self.line = monster_img.line5
  313. super().__init__(f"采集铁矿石")
  314. if isSimple:
  315. self.line = None
  316. def run(self):
  317. basic_operate.go_outside()
  318. if False == basic_operate.click_outside_search():
  319. return False
  320. if waitFindImg_withBool(monster_img.search, 2, 1):
  321. myTimeSleep_big()
  322. yys_dragAuto(monster_img.move_right)
  323. if waitClickImg_noWait_withBool(self.type, 2, 1) == False:
  324. return False
  325. if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
  326. return False
  327. if waitClickImg_withBool(monster_img.collect, 2, 1) == False:
  328. return False
  329. if self.line != None:
  330. waitClickImg_noWait_withBool(self.line, 2, 1)
  331. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  332. return False
  333. waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
  334. maxTryTimes = 3
  335. while maxTryTimes > 0:
  336. maxTryTimes -= 1
  337. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  338. waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
  339. if waitClickImg_noWait_withBool(monster_img.all_select, 1, 1) == False:
  340. break
  341. return True
  342. class task_train(dongri_task):
  343. def __init__(self, force_lv1 = False):
  344. super().__init__(f"检查训练")
  345. self.force_lv1 = force_lv1
  346. def run(self):
  347. basic_operate.go_town()
  348. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  349. return False
  350. if waitClickImg_noWait_withBool(train_img.train_success, 2, 1) == False:
  351. return False
  352. tryTimes = 3
  353. while tryTimes > 0:
  354. tryTimes -= 1
  355. waitClickImg_noWait_withBool([train_img.dun, train_img.gong, train_img.mao], 2, 1)
  356. if waitClickImg_noWait_withBool(train_img.train, 2, 1):
  357. break
  358. if self.force_lv1:
  359. myTimeSleep_big()
  360. yys_dragAuto(train_img.move_left)
  361. yys_dragAuto(train_img.move_left)
  362. waitClickImg_noWait_withBool(train_img.soilder_lv1, 2, 1)
  363. return basic_operate.enter_auto_supply_resource(train_img.begin_train)
  364. class task_checkHelp(dongri_task):
  365. def __init__(self, isOutSide = False):
  366. super().__init__(f"检查帮助")
  367. self.isOutSide = isOutSide
  368. def run(self):
  369. if self.isOutSide:
  370. basic_operate.go_outside()
  371. else:
  372. basic_operate.go_town()
  373. waitClickImg_noWait_withBool(place_img.help, 2, 1)
  374. return True
  375. class task_checkStoreRoom(dongri_task):
  376. def __init__(self):
  377. super().__init__(f"检查仓库或招募")
  378. def run(self):
  379. basic_operate.go_town()
  380. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  381. return False
  382. myTimeSleep_big()
  383. yys_dragAuto(check_img.move_down)
  384. yys_dragAuto(check_img.move_down)
  385. myTimeSleep_big()
  386. if waitClickImg_noWait_withBool((train_img.train_success, check_img.needgo), 2, 1) == False:
  387. return False
  388. myTimeSleep_big()
  389. pcacc_mouse.quickclick_current()
  390. if waitClickImg_noWait_withBool((check_img.storeroom, check_img.storeroom2, check_img.invite_free), 2, 1) == False:
  391. return False
  392. pcacc_mouse.quickclick_current()
  393. waitClickImg_noWait_withBool(check_img.store_strength, 2, 1)
  394. waitClickImg_noWait_withBool((check_img.get,check_img.bigGet), 2, 1)
  395. return True
  396. class task_checkConfilits(dongri_task):
  397. def __init__(self):
  398. super().__init__(f"检查集结")
  399. def run(self):
  400. basic_operate.go_outside()
  401. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  402. return False
  403. if waitClickImg_noWait_withBool(check_img.paticipate, 2, 1) == False:
  404. return False
  405. if waitClickImg_noWait_withBool(check_img.auto_confilit, 2, 1) == False:
  406. return False
  407. return True
  408. class task_checkDonata(dongri_task):
  409. def __init__(self):
  410. super().__init__(f"检查捐献")
  411. def run(self):
  412. basic_operate.go_town()
  413. if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
  414. return False
  415. if waitClickImg_noWait_withBool(check_img.union_technology, 2, 1) == False:
  416. return False
  417. if waitClickImg_noWait_withBool(check_img.technology_better, 2, 1) == False:
  418. return False
  419. if waitClickImg_withBool([check_img.donate, check_img.donate2], 2, 1) == False:
  420. return False
  421. else:
  422. maxTryTimes = 3
  423. while waitClickImg_withBool([check_img.donate, check_img.donate2], 1, 0) and maxTryTimes > 0:
  424. maxTryTimes -= 1
  425. return True
  426. class task_checkAdventure(dongri_task):
  427. def __init__(self):
  428. super().__init__(f"检查冒险")
  429. def run(self):
  430. basic_operate.go_town()
  431. if waitClickImg_noWait_withBool(check_img.adventure, 2, 1) == False:
  432. return False
  433. if waitClickImg_noWait_withBool(check_img.get, 2, 1) == False:
  434. return False
  435. if waitClickImg_noWait_withBool(check_img.bigGet, 2, 1) == False:
  436. return False
  437. return True
  438. class task_waitTime(dongri_task):
  439. def __init__(self):
  440. super().__init__(f"等待时间")
  441. def run(self):
  442. myTimeSleep(300)
  443. class check_buildOrResearch(dongri_task):
  444. def __init__(self):
  445. super().__init__(f"检查建筑或研究")
  446. def run(self):
  447. basic_operate.go_town()
  448. if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
  449. return False
  450. if waitClickImg_noWait_withBool(check_img.needgo, 2, 1) == False:
  451. return False
  452. dstType = 'none'
  453. while True:
  454. 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):
  455. dstType = 'build'
  456. break
  457. handRet, handPos = waitFindImg(check_img.hand, 2, 1)
  458. if not handRet:
  459. return False
  460. detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
  461. dstPos = [0, 0]
  462. if not detailRet:
  463. # 如果找不到详细信息,兵营之类的,需点中间
  464. dstPos = [handPos[0] - 70, handPos[1] + 120]
  465. else:
  466. dstPos = [detailPos[0] + 70, detailPos[1] - 100]
  467. tryTimes = 5
  468. while tryTimes > 0:
  469. tryTimes -= 1
  470. myTimeSleep_big()
  471. pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
  472. if waitClickImg_noWait_withBool(check_img.research, 2, 1):
  473. dstType = 'research'
  474. break
  475. elif waitClickImg_noWait_withBool(check_img.build_upgrade, 2, 1):
  476. dstType = 'build'
  477. break
  478. break
  479. if dstType == 'none':
  480. print('没有找到建筑或研究')
  481. return False
  482. elif dstType == 'build':
  483. buildtimes = 4
  484. 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]):
  485. buildtimes -= 1
  486. if buildtimes == 0:
  487. break
  488. continue
  489. elif dstType == 'research':
  490. if waitClickImg_withBool([check_img.research_type1, check_img.research_type2], 2, 1) == False:
  491. return False
  492. if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
  493. return False
  494. waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
  495. return True
  496. class task_information(dongri_task):
  497. def __init__(self):
  498. super().__init__(f"检查情报")
  499. def run(self):
  500. basic_operate.go_outside()
  501. if waitClickImg_noWait_withBool(information_img.information, 1, 1) == False:
  502. return False
  503. if waitClickImg_noWait_withBool([information_img.hero0, information_img.hero1, information_img.hero2], 0.5, 0.5):
  504. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  505. return False
  506. if waitClickImg_noWait_withBool(information_img.explore, 1, 1) == False:
  507. return False
  508. if waitClickImg_noWait_withBool(information_img.hero_fight, 1, 1) == False:
  509. waitClickImg_noWait(information_img.add_strength, 1, 1)
  510. waitClickImg_noWait(information_img.add_strength, 1, 1)
  511. waitClickImg_noWait(information_img.add_strength, 1, 1)
  512. return False
  513. myTimeSleep_big()
  514. return True
  515. elif waitClickImg_noWait_withBool([information_img.camp1, information_img.camp2], 0.5, 0.5):
  516. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  517. return False
  518. if waitClickImg_noWait_withBool(information_img.survive, 1, 1) == False:
  519. return False
  520. waitClickImg_noWait(information_img.add_strength, 1, 1)
  521. waitClickImg_noWait(information_img.add_strength, 1, 1)
  522. waitClickImg_noWait(information_img.add_strength, 1, 1)
  523. return True
  524. elif waitClickImg_noWait_withBool([information_img.wolf0, information_img.wolf1, information_img.wolf2], 0.5, 0.5):
  525. if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
  526. return False
  527. if waitClickImg_noWait_withBool(information_img.fight, 1, 1) == False:
  528. return False
  529. if waitClickImg_noWait_withBool(monster_img.line1, 1, 1) == False:
  530. return False
  531. if waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1) == False:
  532. return False
  533. waitClickImg_noWait(information_img.add_strength, 1, 1)
  534. waitClickImg_noWait(information_img.add_strength, 1, 1)
  535. waitClickImg_noWait(information_img.add_strength, 1, 1)
  536. return True
  537. else:
  538. return False
  539. class task_returnAllLine(dongri_task):
  540. def __init__(self):
  541. super().__init__(f"返回所有路线")
  542. def run(self):
  543. basic_operate.go_outside()
  544. basic_operate.return_line()
  545. basic_operate.return_line()
  546. basic_operate.return_line()
  547. basic_operate.return_line()
  548. basic_operate.return_line()
  549. basic_operate.return_line()
  550. return True
  551. class task_paticipateInTeam(dongri_task):
  552. def __init__(self):
  553. super().__init__(f"参与队伍")
  554. def run(self):
  555. basic_operate.go_outside()
  556. if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
  557. return False
  558. if waitClickImg_noWait_withBool(monster_img.participate, 1, 1) == False:
  559. return False
  560. while True:
  561. if waitClickImg_noWait_withBool(monster_img.line1, 0.1, 1) == False:
  562. break
  563. if waitFindImg_withBool(monster_img.no_hero, 0.1, 1) == False:
  564. break
  565. if waitClickImg_noWait_withBool(monster_img.line4, 0.1, 1) == False:
  566. break
  567. if waitFindImg_withBool(monster_img.no_hero, 0.1, 1) == False:
  568. break
  569. break
  570. if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
  571. return False
  572. waitClickImg_noWait_withBool(monster_img.all_select, 0.1, 1)
  573. maxTryTimes = 3
  574. while maxTryTimes > 0:
  575. maxTryTimes -= 1
  576. waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
  577. if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 1):
  578. break
  579. return True
  580. class task_cure(dongri_task):
  581. def __init__(self):
  582. super().__init__(f"治疗")
  583. def run(self):
  584. basic_operate.go_outside()
  585. if waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
  586. return False
  587. if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
  588. return False
  589. if waitClickImg_noWait_withBool(check_img.help4, 2, 1) == False:
  590. return False
  591. return True
  592. class task_useAnnimalSkill(dongri_task):
  593. def __init__(self):
  594. super().__init__(f"使用动物技能")
  595. def run(self):
  596. basic_operate.go_outside()
  597. if waitClickImg_noWait_withBool(check_img.annimal_skill, 2, 1) == False:
  598. return False
  599. if waitClickImg_noWait_withBool(check_img.wolf_skill, 2, 1) == False:
  600. return False
  601. if waitClickImg_noWait_withBool((check_img.use, check_img.use2), 2, 1) == False:
  602. return False
  603. class task_activity_lianmeng(dongri_task):
  604. def __init__(self):
  605. super().__init__(f"联盟总动员")
  606. def run(self):
  607. basic_operate.go_town()
  608. if waitClickImg_noWait_withBool(special_activity_img.normal, 2, 1) == False:
  609. return False
  610. if waitClickImg_noWait_withBool((special_activity_img.lianmeng,special_activity_img.lianmeng2), 2, 1) == False:
  611. return False
  612. waitClickImg_noWait_withBool(special_activity_img.task_done, 2, 1)
  613. if waitFindImg_withBool(special_activity_img.doing_task, 2, 1) == False:
  614. if waitClickImg_noWait_withBool((special_activity_img.shili, special_activity_img.shili2), 2, 1) == True:
  615. if waitClickImg_noWait_withBool(special_activity_img.accept_task, 2, 1) == False:
  616. return False
  617. if waitFindImg_withBool(special_activity_img.shili, 2, 1) == False:
  618. maxTryTimes = 2
  619. while waitClickImg_noWait_withBool(special_activity_img.owning, 2, 1) == True:
  620. waitClickImg_noWait_withBool(special_activity_img.refresh_task, 2, 1)
  621. waitClickImg_noWait_withBool(special_activity_img.refresh, 2, 1)
  622. maxTryTimes -= 1
  623. if maxTryTimes <= 0:
  624. break
  625. return True
  626. if __name__ == '__main__':
  627. #basic_operate.go_town()
  628. #basic_operate.add_strength()
  629. #task_fightMonster(False, True).run()
  630. #task_checkHelp().run()
  631. #task_checkStoreRoom().run()
  632. task_activity_lianmeng().run()
  633. #task_fight_yongbing(True).run()
  634. #task_collect([4,3,2,1]).run()
  635. #task_train().run()
  636. #task_information().run()
  637. #check_buildOrResearch().run()
  638. #task_checkDonata().run()
  639. #task_collect(1).run()
  640. #task_collect(2).run()
  641. #task_collect(3).run()
  642. #task_collect(4).run()
  643. #task_returnAllLine().run()
  644. #task_paticipateInTeam().run()
  645. #task_fight_jina(True).run()