12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661 |
- # -*- coding: utf-8 -*-
- import threading
- from scriptBase.imgFind import pcacc_img, savePic, set_isDown
- from scriptBase.mouseClick import pcacc_mouse
- from scriptBase.ocr import capture_and_ocr
- import scriptBase.base
- from scriptBase.comon import *
- from scriptBase.ocr import *
- from apscheduler.schedulers.blocking import BlockingScheduler
- import pyautogui
- import random
- import sys
- import math
- import os
- import time
- from dongri_define import *
- from dongri_pic import *
- import subprocess
- import socket
- from dongri_pic import _imported
- from datetime import datetime, timedelta
- import datetime as dt
- '''
- 基础配置说明:
- 600*800(DPI 300)
- 游戏画面:流畅
- 高帧率关闭
- 町中模式:旧版
- '''
- todo_msg = ''
- todo_list = []
- g_task_lineCheck = False
- def set_lineCheck(val):
- global g_task_lineCheck
- g_task_lineCheck = val
- def get_todo_msg():
- global todo_msg
- return todo_msg
- def get_todo_msgList():
- global todo_list
- todo_str = ''
- for item in todo_list:
- todo_str += f'{item["item"]}:{item["time"]}</br>'
- return todo_str
- def get_todo_time(todo_str):
- global todo_list
- for item in todo_list:
- if item['item'] == todo_str:
- return item['time']
- return None
- def is_within_n_minutes(target_time_str, n_minutes_left, n_minutes_right):
- if target_time_str == None:
- return False
- # 获取当前时间
- now = datetime.now()
-
- # 解析目标时间字符串
- try:
- target_time = datetime.strptime(target_time_str, "%H:%M")
- # 将目标时间的日期部分设置为当前日期
- target_time = target_time.replace(year=now.year, month=now.month, day=now.day)
- except ValueError:
- raise ValueError("时间格式应为'HH:MM'")
-
- # 计算时间范围
- start_time = target_time - timedelta(minutes=n_minutes_left)
- end_time = target_time + timedelta(minutes=n_minutes_right)
-
- # 检查当前时间是否在范围内
- return start_time <= now <= end_time
- def fing_todoList_time(taskStr):
- for item in todo_list:
- if item['task'] == taskStr:
- return item['time']
- def task_getComputerName():
- return socket.gethostname()
- def task_acceptTask():
- while True:
- myTimeSleep_big()
- def init():
- global _imported
- if not _imported:
- acceptTask = threading.Thread(target=task_acceptTask)
- acceptTask.daemon = True
- if acceptTask.is_alive() == False:
- acceptTask.start()
- _imported = True
- class basic_operate:
- @staticmethod
- def do_back():
- task_return_game()
- ret = False
- if waitFindImg_withBool([place_img.outside, place_img.town], 0.1, 0) == True:
- return True
- ret |= waitClickImg_noWait_withBool(place_img.back1, 0.6, 0)
- if ret:
- return ret
- ret |= waitClickImg_noWait_withBool([place_img.back2, place_img.back4], 0.6, 0)
- if ret:
- return ret
- ret, pos = waitFindImg(place_img.title, 1, 0)
- if ret:
- pcacc_mouse.click(pos[0] + 20, pos[1] + 80)
- @staticmethod
- def backToGame(preTime = 0):
- tryMaxTimes = 5
- while tryMaxTimes > 0:
- tryMaxTimes -= 1
- if waitFindImg_withBool((place_img.gameIn, place_img.gameIn2), 1, preTime) == False:
- basic_operate.do_back()
- else:
- return True
- return False
-
- @staticmethod
- def go_town(preTime = 0):
- if basic_operate.backToGame(preTime) == False:
- return False
- waitClickImg_noWait_withBool(place_img.outside, 0.6, 0.5)
- waitFindImg_withBool(place_img.town, 2, 0.5)
- return True
-
- @staticmethod
- def go_outside(preTime = 0):
- if basic_operate.backToGame(preTime) == False:
- return False
- waitClickImg_noWait_withBool(place_img.town, 0.6, 0.5)
- waitFindImg_withBool(place_img.outside, 2, 0.5)
- return True
-
- @staticmethod
- def click_outside_search():
- taskListRet, taskListPos = waitFindImg(monster_img.tasklist, 2, 3)
- if taskListRet == False:
- return False
- else:
- pcacc_mouse.click(taskListPos[0], taskListPos[1] - 110)#click search
- myTimeSleep_big()
- return True
-
- @staticmethod
- def enter_auto_supply_resource(enter_pic):
- if waitClickImg_noWait_withBool(enter_pic, 2, 2) == False:
- return False
-
- if waitClickImg_noWait_withBool(train_img.getAll, 2, 1) == False:
- return True
-
- if waitClickImg_noWait_withBool(train_img.enter, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(enter_pic, 2, 1) == False:
- return False
- return True
-
- @staticmethod
- def return_line():
- if waitClickImg_noWait_withBool(monster_img.returnLine, 1, 0.5) == False:
- return False
- if waitClickImg_noWait_withBool(monster_img.enter, 2, 1) == False:
- return False
- return True
- @staticmethod
- def add_strength():
- if waitClickImg_noWait_withBool(check_img.no_strength, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.add_strength, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.add_strength, 2, 1) == False:
- return False
- return True
- @staticmethod
- def get_line_num():
- lineStr = yys_ocrAuto(check_img.line_orc)
- if len(lineStr) == 0:
- return 0
- match = re.search(r'\d', lineStr[0]) # 查找第一个数字
- if match:
- first_digit = match.group()
- print("第一个数字:", first_digit)
- return int(first_digit)
- else:
- print("未找到数字")
- return 0
-
-
- def task_return_game():
- tryTimes = 3
- while tryTimes > 0:
- if False == waitFindImg_withBool([place_img.title], 2, 0):
- waitClickImg_noWait([place_img.ico, place_img.ico2], 1, 0)
- myTimeSleep_big()
- tryTimes -= 1
- if tryTimes == 0:
- return False
- else:
- break
- def task_save_compress_pic():
- # 截取屏幕截图
- screenshot = pyautogui.screenshot()
- compressed_data = compress_image(screenshot)
- # 保存压缩后的图像到文件
- with open('compressed_screenshot.jpg', 'wb') as f:
- f.write(compressed_data)
- def task_close_game():
- subprocess.call(f"taskkill /f /im MuMuPlayer.exe")
- subprocess.call(f"taskkill /f /im MuMuVMMHeadless.exe")
- subprocess.call(f"taskkill /f /im MuMuVMMSVC.exe")
- myTimeSleep_big()
- def task_start_game(type=0):
- isSuccess = True
- path1 = R'C:\\Program Files\\Netease\\MuMuPlayer-12.0\\shell\\MuMuPlayer.exe'
- path2 = R'C:\Program Files\Netease\MuMu Player 12\shell\MuMuPlayer.exe'
- if os.path.exists(path1):
- subprocess.Popen(path1)
- elif os.path.exists(path2):
- subprocess.Popen(path2)
- waitClickImg_withBool(gameStart_img.not_upgrade, 20, 10)
- if type == 0:
- if waitClickImg_withBool(gameStart_img.ico, 100, 0) == False:
- return False
- else:
- waitClickImg_withBool(gameStart_img.second_game, 100, 0)
- if waitClickImg_withBool(gameStart_img.ico, 5, 1) == False:
- return False
-
- waitFindImg_withBool(place_img.gameIn, 10, 20)
- basic_operate.go_town()
- waitFindImg_withBool(place_img.gameIn, 10, 20)
- basic_operate.go_town()
- if waitFindImg_withBool(place_img.gameIn, 10, 20) == False:
- return False
- myTimeSleep_big()
- return isSuccess
- class dongri_task:
- def __init__(self, name):
- self.name = name
- def run(self):
- print(f"Running task: {self.name}")
- class task_fight_yongbing(dongri_task):
- def __init__(self, add_strengh):
- super().__init__("战斗佣兵")
- self.add_strengh = add_strengh
- def run(self):
- basic_operate.go_outside()
- if False == waitFindImg_withBool(monster_img.enough_strengh2, 2, 1):
- if self.add_strengh:
- basic_operate.add_strength()
- basic_operate.go_outside()
- else:
- print("没有足够的体力了")
- return False
-
- if basic_operate.get_line_num() >= 6:
- return False
- if waitClickImg_noWait_withBool(check_img.yongbing, 2, 1) == False:
- return False
-
- waitClickImg_noWait_withBool(check_img.detect, 2, 1)
-
- if waitClickImg_noWait_withBool(check_img.yongbing_fight, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
- return False
- if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
- return False
- if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
- return True
- class task_fight_jina_only(dongri_task):
- def __init__(self):
- super().__init__("战斗召唤的吉娜")
- def run(self):
- basic_operate.go_outside()
- #必须加体力
- if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
- basic_operate.add_strength()
- basic_operate.go_outside()
-
- if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2), 2, 1) == False:
- return False
-
- waitClickImg_noWait_withBool(check_img.talkin_person, 2, 1)
-
-
- if waitClickImg_noWait_withBool(check_img.talkin_jina, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- yys_dragAuto(check_img.move_down)
- yys_dragAuto(check_img.move_down)
- myTimeSleep_big()
-
- if waitClickImg_noWait_withBool(check_img.xiaohao_jina, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool((check_img.jina_pic, check_img.jina_pic2), 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
- if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
- return False
- if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
- return False
- if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
- return True
-
- class task_call_jina(dongri_task):
- def __init__(self):
- super().__init__("召唤吉娜")
-
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.share, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.to_pcacc, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.share_btn, 2, 1) == False:
- return False
- return True
-
- class task_fight_jina(dongri_task):
- def __init__(self, add_strengh):
- super().__init__("战斗吉娜")
- self.add_strengh = add_strengh
- def run(self):
- basic_operate.go_outside()
- if False == waitFindImg_withBool(monster_img.enough_strengh, 2, 1):
- if self.add_strengh:
- basic_operate.add_strength()
- basic_operate.go_outside()
- else:
- print("没有足够的体力了")
- return False
-
- if waitClickImg_noWait_withBool(check_img.pack, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool((check_img.other, check_img.other2), 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.jina_jiao, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.use, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(monster_img.muti_team, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
- if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
- return False
- if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
- return False
- if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
- return True
-
-
- class task_fightMonster(dongri_task):
- def __init__(self, add_strengh, fight_bigMonster, isSimple):
- self.add_strengh = add_strengh
- self.isSimple = isSimple
- if fight_bigMonster == True:
- super().__init__(f"战斗大怪物")
- self.monster = monster_img.bigMonster
- self.attack = monster_img.muti_team
- else:
- super().__init__(f"战斗小怪物")
- self.monster = monster_img.wolf
- self.attack = monster_img.attack
- def run(self):
- global g_task_lineCheck
- now = datetime.now()
- target_time = datetime.combine(now.date(), dt.time(20, 30))
- # 判断当前时间是否超过20:30
- if now > target_time:
- print("当前时间已超过20:30,不执行操作")
- return False
- basic_operate.go_outside()
- if False == waitFindImg_withBool((monster_img.enough_strengh2, monster_img.enough_strengh3), 2, 1):
- if self.add_strengh:
- basic_operate.add_strength()
- basic_operate.go_outside()
- else:
- print("没有足够的体力了")
- return False
-
- maxLineNum = 6
- if basic_operate.get_line_num() >= maxLineNum:
- return False
- if False == basic_operate.click_outside_search():
- return False
-
- if waitFindImg_withBool(monster_img.search, 2, 1):
- myTimeSleep_big()
- yys_dragAuto(monster_img.move_left)
- if waitClickImg_noWait_withBool(self.monster, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(self.attack, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.begin_multi, 2, 1)
- if not self.isSimple:
- if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
- return False
- if waitFindImg_withBool(monster_img.no_hero, 2, 1) == True:
- return False
- if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
- return True
-
- class task_collect(dongri_task):
- def __init__(self, type = 0, isSimple = False, isAddStrenghth = False):
- self.isSimple = isSimple
- self.isAddStrenghth = isAddStrenghth
- if isinstance(type, (list, tuple)):
- typeArr = type
- type = typeArr[random.randint(0, len(typeArr) - 1)]
- elif type == 0:
- typeArr = [4,3,2,1]
- type = typeArr[random.randint(0, len(typeArr) - 1)]
- elif type == 5:
- typeArr = [2,1]
- type = typeArr[random.randint(0, len(typeArr) - 1)]
- if type == 1:
- self.type = monster_img.meat
- self.line = monster_img.line2
- super().__init__(f"采集肉")
- elif type == 2:
- self.type = monster_img.wood
- self.line = monster_img.line3
- super().__init__(f"采集木头")
- elif type == 3:
- self.type = monster_img.mine
- self.line = monster_img.line4
- super().__init__(f"采矿石")
- elif type == 4:
- self.type = monster_img.iron
- self.line = monster_img.line5
- super().__init__(f"采集铁矿石")
- else:
- self.type = None
- self.line = None
- super().__init__(f"采集None")
- if isSimple:
- self.line = None
-
- def run(self):
- global g_task_lineCheck
- if self.type == None:
- return True
- basic_operate.go_outside()
- maxLineNum = 6
- if self.isAddStrenghth or g_task_lineCheck:
- maxLineNum = 5
- else:
- maxLineNum = 6
- if basic_operate.get_line_num() >= maxLineNum:
- return False
- if False == basic_operate.click_outside_search():
- return False
-
- if waitFindImg_withBool(monster_img.search, 2, 1):
- myTimeSleep_big()
- yys_dragAuto(monster_img.move_right)
- if waitClickImg_noWait_withBool(self.type, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(monster_img.search, 2, 1) == False:
- return False
- if waitClickImg_withBool(monster_img.collect, 2, 1) == False:
- return False
-
- if self.line != None:
- waitClickImg_noWait_withBool(self.line, 2, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 2, 1)
-
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
- return True
-
- class task_train(dongri_task):
- def __init__(self, train_type = None):
- super().__init__(f"检查训练{train_type}")
- self.train_type = train_type
- def run(self):
- basic_operate.go_town()
- if self.train_type == 'None':
- return True
-
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(train_img.train_success, 2, 1) == False:
- return False
- tryTimes = 3
- isSuccess = False
- while tryTimes > 0:
- tryTimes -= 1
- waitClickImg_noWait_withBool([train_img.dun, train_img.gong, train_img.mao], 2, 1)
- if waitClickImg_noWait_withBool(train_img.train, 2, 1):
- isSuccess = True
- break
-
- if isSuccess == False:
- pcacc_mouse.quickclick_current()
- myTimeSleep_big()
- pcacc_mouse.quickclick_current()
- if waitClickImg_noWait_withBool(train_img.train, 2, 1) == False:
- return False
-
-
- if self.train_type == 'lv1':
- myTimeSleep_big()
- yys_dragAuto(train_img.move_left)
- yys_dragAuto(train_img.move_left)
- waitClickImg_noWait_withBool(train_img.soilder_lv1, 2, 1)
- elif self.train_type == 'lv8':
- waitClickImg_noWait_withBool(train_img.soilder_lv8, 2, 1)
- elif self.train_type == 'lv9':
- waitClickImg_noWait_withBool(train_img.soilder_lv9, 2, 1)
- elif self.train_type == 'upgrade':
- waitClickImg_noWait_withBool(train_img.upgrade_small, 2, 1)
- waitClickImg_noWait_withBool(train_img.upgrade_big, 2, 1)
- return basic_operate.enter_auto_supply_resource([train_img.begin_train,train_img.begin_train2])
- class task_checkHelp(dongri_task):
- def __init__(self, isOutSide = False):
- super().__init__(f"检查帮助")
- self.isOutSide = isOutSide
- def run(self):
- if self.isOutSide:
- basic_operate.go_outside()
- else:
- basic_operate.go_town()
- waitClickImg_noWait_withBool(place_img.help, 2, 1)
- return True
-
- class task_gotoTree(dongri_task):
- def __init__(self):
- super().__init__(f"查看生命之树")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- yys_dragAuto(check_img.move_down)
- yys_dragAuto(check_img.move_down)
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(check_img.life_tree, 2, 1) == False:
- return False
- myTimeSleep_big()
- pcacc_mouse.quickclick_current()
- myTimeSleep_big()
- waitClickImg_noWait_withBool((check_img.life_jam, check_img.life_jam2), 2, 1)
- waitClickImg_noWait_withBool((check_img.life_jam, check_img.life_jam2), 2, 1)
- return True
-
- class task_getStrength(dongri_task):
- def __init__(self):
- super().__init__(f"获取体力")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.pannel_research, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- yys_dragAuto(change_direction(special_activity_img.champion_move))
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(check_img.store_strength, 3, 1):
- waitClickImg_noWait_withBool((check_img.get,check_img.bigGet), 2, 1)
- return True
-
- class task_checkStoreRoom(dongri_task):
- def __init__(self):
- super().__init__(f"检查仓库或招募")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- yys_dragAuto(check_img.move_down)
- yys_dragAuto(check_img.move_down)
- myTimeSleep_big()
- if waitClickImg_noWait_withBool((train_img.train_success, check_img.needgo), 2, 1) == False:
- return False
- myTimeSleep_big()
- if waitFindImg_withBool(check_img.pet_findtreature, 2, 1) == False:# storeroom
- waitClickImg_noWait_withBool((check_img.bigGet, check_img.chenxi_get2), 2, 1)
- pcacc_mouse.quickclick_current()
- myTimeSleep_big()
- if waitClickImg_noWait_withBool((check_img.detail,check_img.detail2), 2, 1):
- myTimeSleep_big()
- basic_operate.go_town()
- myTimeSleep_big()
- if waitClickImg_noWait_withBool((check_img.storeroom, check_img.storeroom2, check_img.invite_free), 2, 1) == False:
- return False
- myTimeSleep_big()
- pcacc_mouse.quickclick_current()
- myTimeSleep_big()
- waitClickImg_noWait_withBool(check_img.store_strength, 2, 1)
- waitClickImg_noWait_withBool((check_img.get,check_img.bigGet), 2, 1)
- else:
- if waitClickImg_noWait_withBool(check_img.pet_success, 2, 1):
- myTimeSleep_big()
- dstPos = get_yys_random_point(check_img.pet_getRegion)
- pcacc_mouse.click(dstPos[0], dstPos[1])
- myTimeSleep_big()
- elif waitClickImg_noWait_withBool((check_img.pet_advance, check_img.pet_senior, check_img.pet_junior), 2, 1):
- waitClickImg_noWait_withBool(check_img.pet_gotreature, 2, 1)
- waitClickImg_noWait_withBool(check_img.pet_begintreature, 2, 1)
- return True
-
-
- class task_checkConfilits(dongri_task):
- def __init__(self):
- super().__init__(f"检查集结")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.paticipate, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.auto_confilit, 2, 1) == False:
- return False
- return True
- class task_checkDonata(dongri_task):
- def __init__(self):
- super().__init__(f"检查捐献")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.union_technology, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.technology_better, 2, 1) == False:
- return False
- if waitClickImg_withBool([check_img.donate, check_img.donate2], 2, 1) == False:
- return False
- else:
- maxTryTimes = 3
- while waitClickImg_withBool([check_img.donate, check_img.donate2], 1, 0) and maxTryTimes > 0:
- maxTryTimes -= 1
- return True
-
- class task_checkUnionTreasure(dongri_task):
- def __init__(self):
- super().__init__(f"检查联盟宝藏")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.union, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.union_treasure, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(check_img.union_gift, 2, 1)
- while waitClickImg_noWait_withBool((check_img.union_get), 2, 0) == True:
- continue
- waitClickImg_noWait_withBool(check_img.union_gain, 2, 1)
- while waitClickImg_noWait_withBool((check_img.union_get), 2, 0) == True:
- continue
- waitClickImg_noWait_withBool(check_img.union_bigtreasure, 2, 1)
- return True
- class task_checkAdventure(dongri_task):
- def __init__(self):
- super().__init__(f"检查冒险")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.adventure, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.get, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.bigGet, 2, 1) == False:
- return False
- return True
- class task_waitTime(dongri_task):
- def __init__(self):
- super().__init__(f"等待时间")
- def run(self):
- myTimeSleep(300)
- class task_check_Research(dongri_task):
- def __init__(self):
- super().__init__(f"检查研究")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.pannel_research, 2, 1) == False:
- return False
-
- handRet, handPos = waitFindImg(check_img.hand, 2, 1)
- if not handRet:
- return False
-
- detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
- dstPos = [0, 0]
- if not detailRet:
- # 如果找不到详细信息,兵营之类的,需点中间
- dstPos = [handPos[0] - 70, handPos[1] + 120]
- else:
- dstPos = [detailPos[0] + 70, detailPos[1] - 100]
- tryTimes = 3
-
- while tryTimes > 0:
- tryTimes -= 1
- myTimeSleep_big()
- pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
-
- if waitClickImg_noWait_withBool(check_img.research, 2, 1):
- break
-
- if waitFindImg_withBool(check_img.research_speedup, 2, 1) == True:
- return False
- if waitClickImg_withBool([check_img.research_from0, check_img.research_from1, check_img.research_from2, check_img.research_from3, check_img.research_from4], 2, 1) == False:
- return False
- if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
- return False
-
- waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
-
- class check_buildOrResearch(dongri_task):
- def __init__(self):
- super().__init__(f"检查建筑或研究")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.needgo, 2, 1) == False:
- return False
-
- dstType = 'none'
- while True:
- 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):
- dstType = 'build'
- break
- handRet, handPos = waitFindImg(check_img.hand, 2, 1)
- if not handRet:
- return False
-
- detailRet, detailPos = waitFindImg((check_img.detail,check_img.detail2), 2, 1)
- dstPos = [0, 0]
- if not detailRet:
- # 如果找不到详细信息,兵营之类的,需点中间
- dstPos = [handPos[0] - 70, handPos[1] + 120]
- else:
- dstPos = [detailPos[0] + 70, detailPos[1] - 100]
- tryTimes = 5
-
- while tryTimes > 0:
- tryTimes -= 1
- myTimeSleep_big()
- pcacc_mouse.click(dst_x=dstPos[0], dst_y=dstPos[1])
-
- if waitClickImg_noWait_withBool(check_img.research, 2, 1):
- dstType = 'research'
- break
- elif waitClickImg_noWait_withBool(check_img.build_upgrade, 2, 1):
- dstType = 'build'
- break
- break
- if dstType == 'none':
- print('没有找到建筑或研究')
- return False
- elif dstType == 'build':
- buildtimes = 4
- 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]):
- buildtimes -= 1
- if buildtimes == 0:
- break
- continue
- elif dstType == 'research':
- if waitClickImg_withBool([check_img.research_type1, check_img.research_type2], 2, 1) == False:
- return False
- if basic_operate.enter_auto_supply_resource(check_img.research_done) == False:
- return False
-
- waitClickImg_withBool([check_img.help, check_img.help2, check_img.help3], 2, 2)
- return True
-
- class task_information(dongri_task):
- def __init__(self, isAddStrengh = False):
- super().__init__(f"检查情报")
- self.isAddStrengh = isAddStrengh
- def run(self):
- basic_operate.go_outside()
- '''
- if False == waitFindImg_withBool((monster_img.enough_strengh, monster_img.enough_strengh3), 2, 1):
- if self.isAddStrengh:
- basic_operate.add_strength()
- basic_operate.go_outside()
- else:
- print("没有足够的体力了")
- return False
- '''
- if waitClickImg_noWait_withBool(information_img.information, 1, 1) == False:
- return False
-
- waitClickImg_noWait_withBool(information_img.information_suc, 1, 1)
- hero_arr = [information_img.hero0, information_img.hero1, information_img.hero2, information_img.hero3, information_img.hero4]
- camp_arr = [information_img.camp1, information_img.camp2, information_img.camp3, information_img.camp4]
- wolf_arr = [information_img.wolf0, information_img.wolf1, information_img.wolf2, information_img.wolf3, information_img.wolf4, information_img.huojing1]
- total_arr = hero_arr + camp_arr + wolf_arr
-
- if waitFindImg_withBool(total_arr, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(hero_arr, 0.5, 0.5):
- if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.explore, 1, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.hero_fight, 1, 1) == False:
- return False
-
- myTimeSleep_big()
- return True
- elif waitClickImg_noWait_withBool(camp_arr, 0.5, 0.5):
- if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.survive, 1, 1) == False:
- return False
- return True
- elif waitClickImg_noWait_withBool(wolf_arr, 0.5, 0.5):
- if waitClickImg_noWait_withBool(information_img.gotosee, 1, 1) == False:
- return False
- if waitClickImg_noWait_withBool(information_img.fight, 1, 1) == False:
- return False
- if waitClickImg_noWait_withBool(monster_img.line1, 1, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(monster_img.all_select, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.all_select, 0.1, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 1):
- break
-
- return True
- else:
- return False
- class task_returnAllLine(dongri_task):
- def __init__(self):
- super().__init__(f"返回所有路线")
- def run(self):
- basic_operate.go_town()
- basic_operate.go_outside()
- maxTryTimes = 6
- while maxTryTimes > 0:
- maxTryTimes -= 1
- if basic_operate.return_line() == False:
- break
- return True
- class task_paticipateInTeam(dongri_task):
- def __init__(self, checkPower=True):
- typeArr = [1,3,4]
- type = typeArr[random.randint(0, len(typeArr) - 1)]
- if type == 1:
- self.line = monster_img.line1
- elif type == 2:
- self.line = monster_img.line2
- elif type == 3:
- self.line = monster_img.line3
- elif type == 4:
- self.line = monster_img.line4
- self.checkPower = checkPower
- hint = "&检查实力"
- if checkPower == False:
- hint = "&不检查"
- super().__init__(f"参与队伍{type}{hint}")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.conflits, 2, 1) == False:
- return False
- myTimeSleep_big()
- dragTimes = random.randint(1, 3)
- for i in range(dragTimes):
- yys_dragAuto(check_img.move_down)
- myTimeSleep_small()
-
- ret = waitClickImg_noWait_withBool(monster_img.participate, 1, 1, True)
- if ret == False:
- return False
-
- waitClickImg_noWait_withBool(self.line, 0.1, 1)
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- if waitFindImg_withBool(special_activity_img.power0, 1, 0.5) == False:# 实力不为0
- if self.checkPower:
- powerCount = task_checkPower().run()
- if powerCount < 21234567:
- return False
-
- waitClickImg_withBool([monster_img.fight, monster_img.fight2, monster_img.fight3], 1, 0.5)
- return True
- else:
- if False == waitClickImg_noWait_withBool(monster_img.all_select, 1, 0.5):
- break
- myTimeSleep_small()
- return True
- class task_cure(dongri_task):
- def __init__(self, continueCure = False, cureNum = None):
- cureStr = ""
- if continueCure:
- cureStr = f"连续"
- super().__init__(f"{cureStr}治疗{cureNum}")
- self.continueCure = continueCure
- self.cureNum = cureNum
-
- def run(self):
- basic_operate.go_town()
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool([check_img.already_cure,check_img.cure_help], 2, 1) == True:
- if waitClickImg_noWait_withBool(check_img.cancel_cure, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.visit_enter, 2, 1) == False:
- return False
- elif waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
- return False
-
- while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5) == False:
- if waitClickImg_noWait_withBool(special_activity_img.quick_choose, 1, 0.5) == False:
- return False
-
- while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5):
- if waitClickImg_noWait_withBool(special_activity_img.choose_zero, 1, 0.5) == False:
- return False
- else:
- myTimeSleep_big()
- pcacc_mouse.input_string(str(self.cureNum))
-
- if self.continueCure == False:
- if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(check_img.help4, 2, 1) == False:
- return False
- else:
- maxCureSoilder = 50000
- maxTryTimes = int(maxCureSoilder) // int(self.cureNum) * 2
- while waitClickImg_noWait_withBool((check_img.cure, check_img.help4, check_img.help5), 10, 0.2) and maxTryTimes >= 0:
- maxTryTimes -= 1
- continue
-
- waitClickImg_noWait_withBool((check_img.help4, check_img.help5), 1, 1)
- return True
- class task_useAnnimalSkill(dongri_task):
- def __init__(self, isFight = False):
- self.isFight = isFight
- super().__init__(f"使用动物技能")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.annimal_skill, 2, 1) == False:
- return False
- research_skill = [check_img.wolf_skill, check_img.elephant_skill, check_img.lu_skill]
- fight_skill = [check_img.fightWolf_skill, check_img.bird_skill, check_img.bear_skill, check_img.lion_skill]
-
- if self.isFight == False:
- if waitClickImg_noWait_withBool(research_skill, 2, 1) == False:
- return False
- else:
- if waitClickImg_noWait_withBool(fight_skill, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool((check_img.use, check_img.use2), 2, 1) == False:
- return False
- class task_activity_lianmeng(dongri_task):
- def __init__(self):
- super().__init__(f"联盟总动员")
- def run(self):
- basic_operate.go_town()
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(special_activity_img.normal, 1, 0.5) == False:
- return False
- lianmeng_arr = [special_activity_img.lianmeng, special_activity_img.lianmeng2, special_activity_img.lianmeng3]
- while waitClickImg_noWait_withBool(lianmeng_arr, 1, 0.5) == False:
- yys_dragAuto(special_activity_img.move_left)
- myTimeSleep_small()
- if waitClickImg_noWait_withBool(lianmeng_arr, 1, 0.5) == True:
- break
- yys_dragAuto(special_activity_img.move_left)
- myTimeSleep_small()
- if waitClickImg_noWait_withBool(lianmeng_arr, 1, 0.5) == True:
- break
- yys_dragAuto(special_activity_img.move_right_little)
- myTimeSleep_small()
- if waitClickImg_noWait_withBool(lianmeng_arr, 1, 0.5) == True:
- break
- yys_dragAuto(special_activity_img.move_right_little)
- myTimeSleep_small()
- if waitClickImg_noWait_withBool(lianmeng_arr, 1, 0.5) == True:
- break
- return False
-
- doTask_arr = [special_activity_img.shili_120_2, special_activity_img.shili_860_2, special_activity_img.shili_430, special_activity_img.bigMonster_2]
-
- waitClickImg_noWait_withBool(special_activity_img.task_done, 1, 0.5)
-
- if waitFindImg_withBool(special_activity_img.doing_task, 1, 0.5) == False:
- down_tryTimes = 3
- while down_tryTimes > 0:
- down_tryTimes -= 1
- if waitClickImg_noWait_withBool(doTask_arr, 1, 0.5, True) == True:
- if waitClickImg_noWait_withBool(special_activity_img.accept_task, 2, 1) == False:
- return False
- break
- elif waitFindImg_withBool(special_activity_img.shili_2, 1, 0.5) == True:
- save_game_screen("shili")
- yys_dragAuto(special_activity_img.move_down)
-
- up_tryTimes = 5
- while up_tryTimes > 0:
- up_tryTimes -= 1
- myTimeSleep_small()
- yys_dragAuto(change_direction(special_activity_img.move_down))
-
- if waitFindImg_withBool((special_activity_img.shili_120, special_activity_img.shili_860_2), 2, 1, True) == False:
- maxTryTimes = 2
- while waitClickImg_noWait_withBool((special_activity_img.owning2), 2, 1) == True:
- waitClickImg_noWait_withBool(special_activity_img.refresh_task, 2, 1)
- waitClickImg_noWait_withBool(special_activity_img.refresh, 2, 1)
- maxTryTimes -= 1
- if maxTryTimes <= 0:
- break
- return True
-
- class task_checkMaster(dongri_task):
- def __init__(self):
- super().__init__(f"检查统帅")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.master, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.master_get, 2, 1) == False:
- return False
- myTimeSleep_big()
- pcacc_mouse.quickclick_current()
- if waitClickImg_noWait_withBool(check_img.little_treasure, 2, 1) == False:
- return False
- return True
- class task_checkActivities(dongri_task):
- def __init__(self):
- super().__init__(f"检查各种活动时间")
- def find_all_matching_events(self, parts, input_word):
- results = []
- # 查找所有包含输入关键词的项
- matches = [i for i, part in enumerate(parts) if input_word in part]
- for match_index in matches:
- # 从匹配项开始向后查找第一个时间或状态
- for i in range(match_index + 1, len(parts)):
- current_part = parts[i]
- # 检查是否是时间(如 19:30)或状态(如 已结束)
- if re.match(r'^\d{1,2}:\d{2}$', current_part) or current_part in ["已结束"]:
- dst = {"item":parts[match_index], "time":current_part}
- results.append(dst)
- break # 找到第一个匹配就停止
-
- return results
- def run(self):
- global todo_msg, todo_list
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.activity_open, 2, 1) == False:
- return False
- if waitFindImg_withBool(check_img.todoList, 2, 0) == False:
- return False
- myTimeSleep_small()
- yys_dragAuto(check_img.move_down)
- yys_dragAuto(check_img.move_down)
- myTimeSleep_small()
-
- activityStr = yys_ocrAuto(check_img.todo_region)
- if activityStr:
- todo_msg = activityStr
- print(todo_msg)
- date_pattern = r"\d{4}-\d{2}-\d{2}"
- for i, item in enumerate(todo_msg):
- if re.fullmatch(date_pattern, item): # 检查是否完全匹配日期格式
- activityStr = todo_msg[:i] # 保留日期之前的内容
- break
- else:
- activityStr = todo_msg # 如果没有找到日期,保留全部
- print("去掉日期",activityStr)
- result = []
-
- judianArr = self.find_all_matching_events(activityStr, "据点")
- #result.extend(judianArr)
-
- baoleiArr = self.find_all_matching_events(activityStr, "堡垒")
- #result.extend(baoleiArr)
-
- juxiongArr = self.find_all_matching_events(activityStr, "巨熊")
- result.extend(juxiongArr)
- binggongchangArr = self.find_all_matching_events(activityStr, "兵工厂")
- result.extend(binggongchangArr)
- yaosaiArr = self.find_all_matching_events(activityStr, "要塞")
- #result.extend(yaosaiArr)
- todo_list = result
- print(todo_list)
- print(get_todo_time("巨熊行动"))
- return activityStr
- class task_visit_island(dongri_task):
- def __init__(self):
- super().__init__(f"访问岛屿")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(check_img.visit_island_small, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.visit_enter, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.visit_island_big, 2, 1) == False:
- return False
- return True
-
- class task_fight_ranshuang(dongri_task):
- def __init__(self):
- super().__init__(f"打燃霜")
- def run(self):
- basic_operate.backToGame()
- while True:
- if waitClickImg_noWait_withBool(monster_img.ranshuang_search, 0.5, 0.5) == False:
- return False
- if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 0.5, 0.5) == False:
- firstPos = get_yys_random_point(special_activity_img.mid_enemy_region)
- pcacc_mouse.click(firstPos[0], firstPos[1])
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(monster_img.ranshuang_attack, 1, 0.5) == False:
- break
- break
-
-
- if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 1, 0.5) == False:
- return False
- return True
-
- class task_fight_enemy(dongri_task):
- def __init__(self):
- super().__init__(f"打敌人or王城")
- def run(self):
- basic_operate.go_town()
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(special_activity_img.collection, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(special_activity_img.enemy, 2, 1) == False:
- return False
-
- attackArr = [monster_img.attack, monster_img.attack2, monster_img.ranshuang_attack, monster_img.outside_attack, monster_img.defend]
-
- myTimeSleep_big()
- firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
- pcacc_mouse.click(firstPos[0], firstPos[1])
- maxTryTimes = 5
- if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
- return False
- while waitFindImg_withBool(attackArr, 1, 0) == False and maxTryTimes > 0:
- if waitClickImg_noWait_withBool(special_activity_img.outside_soilder, 1, 1) == True:
- break
- #if waitFindImg_withBool(special_activity_img.outside_pcacc, 1, 1) == True:
- # break
- #else:
- # return False
- maxTryTimes -= 1
- myTimeSleep_big()
- mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
- pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
- myTimeSleep_big()
- if waitFindImg_withBool(special_activity_img.visit_island, 1, 1) == True:
- return False
- if waitClickImg_noWait_withBool(attackArr, 1, 0) == False:
- return False
- waitClickImg_noWait_withBool(monster_img.team_go, 2, 1)#派遣队伍
- if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool([monster_img.fight, monster_img.fight2], 2, 1) == False:
- return False
- return True
- class task_get_redPackage(dongri_task):
- def __init__(self):
- super().__init__(f"领取红包")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool((check_img.talk_in,check_img.talk_in2, check_img.talk_in3), 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(check_img.talkin_union, 2, 1)
- oldTime = time.time()
- red_package_pics = [special_activity_img.red_package, special_activity_img.red_package2, special_activity_img.msg_new, special_activity_img.red_package_open]
- while True:
- if time.time() - oldTime > 150:
- break
- if True == waitClickImg_noWait_withBool(red_package_pics, 2, 0):
- save_game_screen("redPackage")
- return True
-
- class task_read_mails(dongri_task):
- def __init__(self):
- super().__init__(f"读邮件")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.mail_btn, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(check_img.mail_collect, 2, 1)
- if waitClickImg_noWait_withBool(check_img.mail_union, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.mail_system, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.mail_reports, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(check_img.mail_read, 2, 1) == False:
- return False
- return True
-
- class task_checkBenifitStatus(dongri_task):
- def __init__(self):
- super().__init__(f"查看增益状态")
- def run(self):
- basic_operate.go_town()
- if waitFindImg_withBool(check_img.benefit_collect, 2, 1) == True:
- return True
- if waitClickImg_noWait_withBool(check_img.add_benefit, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(check_img.benefit_evolve, 2, 1)
- if waitClickImg_noWait_withBool(check_img.benefit_collect_info, 2, 1) == False:
- return False
- myTimeSleep_big()
- dstPos = get_yys_random_point(check_img.benefit_use_region)
- pcacc_mouse.click(dstPos[0], dstPos[1])
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(check_img.benefit_buy, 2, 1) == False:
- return False
- waitClickImg_noWait_withBool(check_img.buy_enter, 2, 1)
-
- return True
-
- class task_checkDiamond(dongri_task):
- def __init__(self):
- super().__init__(f"查看钻石活动")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(check_img.worthy_activity, 2, 1) == False:
- return False
- myTimeSleep_big()
- yys_dragAuto(change_direction(special_activity_img.move_left))
- myTimeSleep_big()
- yys_dragAuto(change_direction(special_activity_img.move_left))
- myTimeSleep_big()
- yys_dragAuto(change_direction(special_activity_img.move_left))
- if waitClickImg_noWait_withBool(check_img.diamond_activity, 2, 1) == False:
- return False
-
- waitClickImg_noWait_withBool(check_img.gain_diamond, 2, 1)
- dstPos = get_yys_random_point(check_img.diamond_save)
- pcacc_mouse.click(dstPos[0], dstPos[1])
- myTimeSleep_big()
- dstPos = get_yys_random_point(check_img.diamond_saveMax)
- pcacc_mouse.click(dstPos[0], dstPos[1])
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(check_img.diamond_save_btn, 2, 1) == False:
- return False
- return True
- class task_fight_campion(dongri_task):
- def __init__(self):
- super().__init__(f"打竞技场")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(special_activity_img.goto_arrow, 2, 1) == False:
- return False
- myTimeSleep_big()
- maxMoveTimes = 2
- while maxMoveTimes > 0:
- maxMoveTimes -= 1
- yys_dragAuto(special_activity_img.champion_move)
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(special_activity_img.enter_champion, 2, 1) == True:
- break
-
- if waitClickImg_noWait_withBool(special_activity_img.champion_fight, 2, 1) == False:
- return False
- myTimeSleep_big()
- dstPos = get_yys_random_point(special_activity_img.fight_last)
- pcacc_mouse.click(dstPos[0], dstPos[1])
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(special_activity_img.champion_fight2, 2, 1) == False:
- return False
- return True
- class check_safe_collect(dongri_task):
- def __init__(self):
- super().__init__(f"检查安全收集")
- def run(self):
- basic_operate.go_outside()
- if waitClickImg_noWait_withBool(special_activity_img.collection, 2, 1) == False:
- return False
- if waitClickImg_noWait_withBool(special_activity_img.collection_friend, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
- pcacc_mouse.click(firstPos[0], firstPos[1])
- maxTryTimes = 2
- while waitClickImg_noWait_withBool(monster_img.collect, 1, 1) == False and maxTryTimes > 0:
- maxTryTimes -= 1
- myTimeSleep_big()
- mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
- pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1]-40)
- myTimeSleep_big()
-
- if waitClickImg_noWait_withBool(special_activity_img.big_collect, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(monster_img.line7, 2, 1) == False:
- return False
-
- maxTryTimes = 3
- while maxTryTimes > 0:
- maxTryTimes -= 1
- waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1)
- waitClickImg_noWait_withBool(monster_img.all_select, 1, 1)
- if waitFindImg_withBool(monster_img.all_select, 1, 1) == False:
- break
-
- return True
- class task_duanwu(dongri_task):
- def __init__(self):
- super().__init__(f"端午")
- def run(self):
- count = 0
- while True:
- if count > 15000:
- waitClickImg_noWait_withBool(special_activity_img.duanwu_auto_attack, 2, 1)
- waitClickImg_noWait_withBool(special_activity_img.duanwu_auto_use, 2, 1)
- else:
- waitClickImg_noWait_withBool(special_activity_img.duanwu_end, 2, 1)
- countStr = yys_ocrAuto(special_activity_img.orc_count)
- print(countStr)
-
- if len(countStr) == 0:
- count = 0
- continue
- cleaned_text = countStr[0].replace('.', '')
- cleaned_text = cleaned_text.replace(',', '')
- try:
- count = int(cleaned_text)
- except:
- continue
- print("current count:", count)
- return True
- class task_checkPower(dongri_task):
- def __init__(self):
- super().__init__(f"检查实力")
- def run(self):
- countStr = yys_ocrAuto(special_activity_img.orc_power2)
- if len(countStr) == 0:
- count = 0
- return 0
- cleaned_text = countStr[0].replace('.', '')
- cleaned_text = cleaned_text.replace(',', '')
- try:
- count = int(cleaned_text)
- except:
- return False
- print("current count:", count)
- return count
-
- class task_get_fire_crystal(dongri_task):
- def __init__(self):
- super().__init__(f"获取火晶")
- def run(self):
- basic_operate.go_town()
- if waitClickImg_noWait_withBool(train_img.quick_panel, 2, 1) == False:
- return False
-
- myTimeSleep_big()
- if waitClickImg_noWait_withBool(special_activity_img.spear, 2, 1) == False:
- return False
-
- if waitClickImg_noWait_withBool(special_activity_img.build_fire_crystal, 2, 1) == False:
- return False
-
- while waitClickImg_noWait_withBool(special_activity_img.fire_crystal_get, 2, 1, True) == True:
- continue
- return True
-
- class task_testFun(dongri_task):
- def __init__(self):
- super().__init__(f"测试功能")
- def run(self):
- #task_checkDiamond().run()
- task_paticipateInTeam().run()
- return True
- if __name__ == '__main__':
- myTimeSleep_big()
- #task_get_fire_crystal().run()
- #task_checkPower().run()
- #task_testFun().run()
- #task_checkActivities().run()
- #print(get_todo_time("巨熊行动"))
- #task_check_Research().run()
- #save_game_screen()
- #basic_operate.get_line_num()
- #task_cure(True, 85).run()
- #task_fight_enemy().run()
- #task_fight_ranshuang().run()
- #task_gotoTree().run()
- #task_fight_jina_only().run()
- task_checkConfilits().run()
- #task_getStrength().run()
- #task_checkActivities().run()
- #task_checkMaster().run()
- #basic_operate.get_line_num()
- #yys_ocrAuto(check_img.line_orc)
- #basic_operate.go_town()
- #basic_operate.add_strength()
- #task_fightMonster(False, True,False).run()
- #task_checkHelp().run()
- #task_checkStoreRoom().run()
- #task_start_game(1)
- #check_safe_collect().run()
- #task_fight_campion().run()
- #task_activity_lianmeng().run()
- #task_fight_yongbing(True).run()
- #task_collect([4,3,2,1]).run()
- #task_train("upgrade").run()
- #task_information(True).run()
- #check_buildOrResearch().run()
- #task_checkDonata().run()
- #task_collect(1).run()
- #task_collect(2).run()
- #task_collect(3).run()
- #task_collect(4).run()
- #task_returnAllLine().run()
- #task_paticipateInTeam().run()
- #task_fight_jina(True).run()
- #task_get_redPackage().run()
- #task_read_mails().run()
- #task_checkBenifitStatus().run()
- #task_checkDiamond().run()
|