Skip to content

Commit

Permalink
Dev shawn (#175)
Browse files Browse the repository at this point in the history
* fix: 铅踝 识别错误

* fix: 铅踝 识别错误

* fix:无人机不使用

---------

Co-authored-by: Shawnsdaddy <[email protected]>
  • Loading branch information
Ks-luow and Shawnsdaddy authored Apr 18, 2023
1 parent 4240918 commit b8f7bf2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions arknights_mower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def inialize(tasks, scheduler=None):
base_scheduler.max_resting_count = conf['max_resting_count']
base_scheduler.drone_count_limit = conf['drone_count_limit']
base_scheduler.tasks = tasks
base_scheduler.enable_party = conf['enable_party'] == 1 # 是否使用线索
# 读取心情开关,有菲亚梅塔或者希望全自动换班得设置为 true
base_scheduler.read_mood = conf['run_mode'] == 1
# 干员宿舍回复阈值
Expand Down
3 changes: 2 additions & 1 deletion arknights_mower/data/ocr.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"Castle3": "Castle-3",
"Lancet2": "Lancet-2",
"THRMEX": "THRM-EX",
"U-Officia": "U-Official"
"U-Officia": "U-Official",
"铅跟": "铅踝"
}
13 changes: 7 additions & 6 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.party_time = None
self.drone_time = None
self.run_order_delay=10
self.enable_party = True

def run(self) -> None:
"""
Expand Down Expand Up @@ -346,7 +347,7 @@ def infra_main(self):
self.drone(self.drone_room)
logger.info(f"记录本次无人机使用时间为:{datetime.now()}")
self.drone_time = datetime.now()
if self.party_time is None:
if self.party_time is None and self.enable_party :
self.clue()
if notification is None:
self.sleep(1)
Expand Down Expand Up @@ -536,7 +537,7 @@ def plan_solver(self):
if op.mood > int((op.upper_limit - op.lower_limit) * self.resting_treshhold + op.lower_limit):
continue
if op.name in self.op_data.exhaust_agent:
if op.mood <= 2:
if op.mood <= 0:
if next((e for e in self.tasks if 'type' in e.keys() and op.name in e['type']),
None) is None:
self.enter_room(op.current_room)
Expand Down Expand Up @@ -746,7 +747,7 @@ def read_screen(self, img, type="mood", limit=24, cord=None, change_color=False)
return __str
except Exception as e:
logger.exception(e)
return limit
return limit+1

def read_time(self, cord, upperlimit, error_count=0):
# 刷新图片
Expand Down Expand Up @@ -1064,9 +1065,9 @@ def drone(self, room: str, not_customize=False, not_return=False):
if accelerate:
drone_count = self.read_screen(self.recog.img, type='drone_mood', cord=(
int(self.recog.w * 1150 / 1920), int(self.recog.h * 35 / 1080), int(self.recog.w * 1295 / 1920),
int(self.recog.h * 72 / 1080)), limit=201)
int(self.recog.h * 72 / 1080)), limit=200)
logger.info(f'当前无人机数量为:{drone_count}')
if drone_count< self.drone_count_limit or drone_count == 201:
if drone_count < self.drone_count_limit or drone_count > 200:
logger.info(f"无人机数量小于{self.drone_count_limit}->停止")
return
logger.info('制造站加速')
Expand Down Expand Up @@ -1096,7 +1097,7 @@ def drone(self, room: str, not_customize=False, not_return=False):
if not_customize:
drone_count = self.read_screen(self.recog.img, type='drone_mood', cord=(
int(self.recog.w * 1150 / 1920), int(self.recog.h * 35 / 1080), int(self.recog.w * 1295 / 1920),
int(self.recog.h * 72 / 1080)), limit=201)
int(self.recog.h * 72 / 1080)), limit=200)
logger.info(f'当前无人机数量为:{drone_count}')
self.recog.update()
self.recog.save_screencap('run_order')
Expand Down
2 changes: 2 additions & 0 deletions arknights_mower/utils/character_recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ def agent_name(__img, height,reverse = False, draw: bool = False):
try:
if len(ocr) > 0 and ocr[0][1] in agent_list and ocr[0][1] not in ['砾', '陈']:
name = ocr[0][1]
elif len(ocr) > 0 and ocr[0][1] in ocr_error.keys():
name = ocr_error[ocr[0][1]]
else:
res = sift_recog(__img, height, draw, reverse)
if (res is not None) and res in agent_list:
Expand Down
4 changes: 4 additions & 0 deletions arknights_mower/utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def update_detail(self,name, mood, current_room, current_index,update_time = Fal
if agent.current_room.startswith('dorm') and not current_room.startswith('dorm') and agent.is_high():
self.refresh_dorm_time(agent.current_room,agent.current_index,{'agent':''})
agent.time_stamp = None
if self.get_dorm_by_name(name)[0] is not None and not current_room.startswith('dorm') and agent.is_high():
_dorm = self.get_dorm_by_name(name)[1]
_dorm.name = ''
_dorm.time = None
agent.current_room = current_room
agent.current_index = current_index
agent.mood = mood
Expand Down
8 changes: 7 additions & 1 deletion menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def load_conf():
conf['drone_count_limit'] = conf['drone_count_limit'] if 'drone_count_limit' in conf.keys() else 92 # 无人机阈值
conf['run_order_delay'] = conf['run_order_delay'] if 'run_order_delay' in conf.keys() else 10 # 跑单提前10分钟运行
conf['drone_room'] = conf['drone_room'] if 'drone_room' in conf.keys() else '' # 无人机使用房间
conf['enable_party'] = conf['enable_party'] if 'enable_party' in conf.keys() else 1 # 是否启用收取线索


def write_conf():
Expand Down Expand Up @@ -186,7 +187,11 @@ def menu():
key='radio_ling_xi_2', enable_events=True)
ling_xi_3 = sg.Radio('均衡模式', 'ling_xi', default=conf['ling_xi'] == 3,
key='radio_ling_xi_3', enable_events=True)

enable_party_title = sg.Text('线索收集:', size=25)
enable_party_1 = sg.Radio('启用', 'enable_party', default=conf['enable_party'] == 1,
key='radio_enable_party_1', enable_events=True)
enable_party_0 = sg.Radio('禁用', 'enable_party', default=conf['enable_party'] == 0,
key='radio_enable_party_0', enable_events=True)
max_resting_count_title = sg.Text('最大组人数:', size=25, key='max_resting_count_title')
max_resting_count = sg.InputText(conf['max_resting_count'], size=5,
key='int_max_resting_count', enable_events=True)
Expand Down Expand Up @@ -250,6 +255,7 @@ def menu():
plan_tab = sg.Tab(' 排班表 ', [[left_area, central_area, right_area], [setting_area]], element_justification="center")
setting_tab = sg.Tab(' 高级设置 ',
[[run_mode_title, run_mode_1, run_mode_2], [ling_xi_title, ling_xi_1, ling_xi_2, ling_xi_3],
[enable_party_title,enable_party_1,enable_party_0],
[max_resting_count_title, max_resting_count, sg.Text('', size=16), run_order_delay_title,
run_order_delay],
[drone_room_title, drone_room, sg.Text('', size=7), drone_count_limit_title,
Expand Down

0 comments on commit b8f7bf2

Please sign in to comment.