dongri_task.py 46 KB

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