dongri_task.py 28 KB

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