dongri_task.py 29 KB

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