Skip to content

Commit

Permalink
Merge pull request #335 from Fuynkio/dev_shawn
Browse files Browse the repository at this point in the history
增加仓库可选关闭
  • Loading branch information
ZhaoZuohong authored Oct 10, 2023
2 parents e7bd981 + cf281dd commit 7df94c3
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 40 deletions.
1 change: 1 addition & 0 deletions arknights_mower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def set_maa_options(base_scheduler):
maa_config["touch_option"] = conf["maa_touch_option"]
maa_config["mall_ignore_when_full"] = conf["maa_mall_ignore_blacklist_when_full"]
maa_config["credit_fight"] = conf["maa_credit_fight"]
maa_config["maa_depot_enable"] = conf["maa_depot_enable"]
maa_config["rogue"] = conf["rogue"]
maa_config["stationary_security_service"] = (
conf["maa_rg_enable"] == 1 and conf["maa_long_task_type"] == "sss"
Expand Down
12 changes: 9 additions & 3 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.maa_config = {}
self.free_clue = None
self.credit_fight = None
self.maa_depot_enable = False
self.exit_game_when_idle = False
self.simulator = None
self.close_simulator_when_idle = False
Expand Down Expand Up @@ -120,6 +121,8 @@ def run(self) -> None:
self.free_clue = None
if self.credit_fight is not None and self.credit_fight != get_server_weekday():
self.credit_fight = None
# if self.credit_fight is not None and self.credit_fight != get_server_weekday():
# self.credit_fight = None
self.todo_task = False
self.collect_notification = False
self.planned = False
Expand Down Expand Up @@ -2230,7 +2233,7 @@ def initialize_maa(self):
raise Exception("MAA 连接失败")

def append_maa_task(self, type):
if type in ['StartUp', 'Visit', 'Award','Depot']:
if type in ['StartUp', 'Visit', 'Award']:
self.MAA.append_task(type)
elif type == 'Fight':
_plan = self.maa_config['weekly_plan'][get_server_weekday()]
Expand Down Expand Up @@ -2260,7 +2263,10 @@ def append_maa_task(self, type):
'credit_fight': self.maa_config['credit_fight'] and '' not in self.stages and self.credit_fight is None,
"force_shopping_if_credit_full": self.maa_config['mall_ignore_when_full']
})

elif type == 'Depot':
self.MAA.append_task('Depot',{
"enable": self.maa_config['maa_depot_enable']
})
def maa_plan_solver(self, tasks='All', one_time=False):
try:
if not one_time and 'last_execution' in self.maa_config and self.maa_config['last_execution'] is not None and datetime.now() - timedelta(
Expand All @@ -2281,7 +2287,7 @@ def maa_plan_solver(self, tasks='All', one_time=False):
# 任务及参数请参考 docs/集成文档.md
self.initialize_maa()
if tasks == 'All':
tasks = ['StartUp', 'Fight', 'Visit', 'Mall', 'Award','Depot']
tasks = ['StartUp','Depot','Fight', 'Visit', 'Mall', 'Award']
# tasks = ['StartUp', 'Fight', 'Recruit', 'Visit', 'Mall', 'Award']
for maa_task in tasks:
if maa_task == 'Recruit':
Expand Down
1 change: 1 addition & 0 deletions arknights_mower/templates/conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ theme: light
maa_conn_preset: General
maa_touch_option: maatouch
maa_credit_fight: true
maa_depot_enable: false
maa_rg_theme: Mizuki
rogue:
squad: ''
Expand Down
1 change: 1 addition & 0 deletions ui/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Clue: typeof import('./src/components/Clue.vue')['default']
Depotpage: typeof import('./src/components/Depotpage.vue')['default']
Email: typeof import('./src/components/Email.vue')['default']
HelpText: typeof import('./src/components/HelpText.vue')['default']
MaaBasic: typeof import('./src/components/MaaBasic.vue')['default']
Expand Down
16 changes: 16 additions & 0 deletions ui/src/components/Depotpage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup>
import { storeToRefs } from 'pinia'
import { useConfigStore } from '@/stores/config'
const store = useConfigStore()
const { maa_depot_enable } = storeToRefs(store)
</script>
<template>
<n-card>
<template #header>
<n-checkbox v-model:checked="maa_depot_enable">
<div class="card-title">MAA仓库扫描 {{ maa_depot_enable ? '开启' : '关闭' }}</div>
</n-checkbox>
</template>
</n-card>
</template>
1 change: 1 addition & 0 deletions ui/src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function render_label(option) {
</n-form>
</n-card>
</div>
<div><depotpage /></div>
<div><maa-basic /></div>
<div><SKLand /></div>
<div><email /></div>
Expand Down
84 changes: 47 additions & 37 deletions ui/src/pages/depot.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
<template>
<div class="card-container">
<n-grid x-gap="10px" y-gap="10px" cols="1" responsive="screen">
<n-gi><n-button @click="copyToClipboard"> 明日方舟工具箱代码</n-button></n-gi>
<n-gi>这次扫描在{{ time }},下次扫描在{{ maa_gap }}小时之后。</n-gi>
<n-gi>注:目前仅限MAA仓库扫描</n-gi>
<n-gi><n-button @click="showModal = true"> 仓库变化 </n-button></n-gi>
</n-grid>
</div>
<div class="card-container">
<n-grid x-gap="10px" y-gap="10px" cols="1" responsive="screen">
<n-gi v-for="(data, title) in cangkuwupin">
<h2>{{ title }}</h2>
<n-grid x-gap="10px" y-gap="10px" cols="2 m:6 l:6 " responsive="screen">
<n-gi v-for="(key, item) in data" content-indented="true">
<n-thing>
<template #avatar>
<n-avatar color="000" size="large" :src="'/depot/' + item + '.png'" />
</template>
<template #header>{{ item }}</template>
<template #description>拥有:{{ key }}</template>
</n-thing>
<div>
<n-card>
<template #header>
<n-checkbox v-model:checked="maa_depot_enable">
<div class="card-title">MAA仓库扫描 {{ maa_depot_enable ? '开启' : '关闭' }}</div>
</n-checkbox>
</template>

<div class="card-container">
<n-grid x-gap="10px" y-gap="10px" cols="1" responsive="screen">
<n-gi><n-button @click="copyToClipboard"> 明日方舟工具箱代码</n-button></n-gi>
<n-gi>这次扫描在{{ time }},下次扫描在{{ maa_gap }}小时之后。</n-gi>
<n-gi>注:目前仅限MAA仓库扫描</n-gi>
<n-gi><n-button @click="showModal = true"> 仓库变化 </n-button></n-gi>
</n-grid>
</div>
<div class="card-container">
<n-grid x-gap="10px" y-gap="10px" cols="1" responsive="screen">
<n-gi v-for="(data, title) in cangkuwupin">
<h2>{{ title }}</h2>
<n-grid x-gap="10px" y-gap="10px" cols="2 m:6 l:6 " responsive="screen">
<n-gi v-for="(key, item) in data" content-indented="true">
<n-thing>
<template #avatar>
<n-avatar color="000" size="large" :src="'/depot/' + item + '.png'" />
</template>
<template #header>{{ item }}</template>
<template #description>拥有:{{ key }}</template>
</n-thing>
</n-gi>
</n-grid>
</n-gi>
</n-grid>
</n-gi>
</n-grid>
</div>
</div>

<n-modal v-model:show="showModal">
<n-card
style="width: 600px"
title="仓库变化:"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
{{ reportData[2] }}
<n-modal v-model:show="showModal">
<n-card
style="width: 600px"
title="仓库变化:"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
{{ reportData[2] }}
</n-card>
</n-modal>
</n-card>
</n-modal>
</div>
</template>

<style>
.card-container {
display: flex;
margin: 0px, 250px, 0px, 50px;
margin: 10px, 0px, 0px, 50px;
flex-wrap: wrap;
}
</style>
Expand All @@ -54,7 +64,7 @@ import { useConfigStore } from '@/stores/config'
const store = useConfigStore()
import { storeToRefs } from 'pinia'
const { maa_gap } = storeToRefs(store)
const { maa_gap, maa_depot_enable } = storeToRefs(store)
//模态框
const showModal = ref(false)
Expand Down
5 changes: 5 additions & 0 deletions ui/src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const useConfigStore = defineStore('config', () => {
const maa_rg_sleep_min = ref('00:00')
const maa_rg_sleep_max = ref('00:00')
const maa_credit_fight = ref(true)
const maa_depot_enable = ref(false)
const maa_rg_theme = ref('Mizuki')
const rogue = ref({})
const sss = ref({})
Expand Down Expand Up @@ -115,6 +116,7 @@ export const useConfigStore = defineStore('config', () => {
maa_rg_sleep_max.value = response.data.maa_rg_sleep_max
maa_rg_sleep_min.value = response.data.maa_rg_sleep_min
maa_credit_fight.value = response.data.maa_credit_fight
maa_depot_enable.value = response.data.maa_depot_enable
maa_rg_theme.value = response.data.maa_rg_theme
rogue.value = response.data.rogue
sss.value = response.data.sss
Expand Down Expand Up @@ -175,6 +177,7 @@ export const useConfigStore = defineStore('config', () => {
maa_rg_sleep_max: maa_rg_sleep_max.value,
maa_rg_sleep_min: maa_rg_sleep_min.value,
maa_credit_fight: maa_credit_fight.value,
maa_depot_enable: maa_depot_enable.value,
maa_rg_theme: maa_rg_theme.value,
rogue: rogue.value,
sss: sss.value,
Expand Down Expand Up @@ -231,6 +234,7 @@ export const useConfigStore = defineStore('config', () => {
maa_rg_sleep_min,
maa_rg_sleep_max,
maa_credit_fight,
maa_depot_enable,
maa_rg_theme,
rogue,
sss,
Expand Down Expand Up @@ -295,6 +299,7 @@ export const useConfigStore = defineStore('config', () => {
maa_rg_sleep_min,
maa_rg_sleep_max,
maa_credit_fight,
maa_depot_enable,
maa_rg_theme,
rogue,
sss,
Expand Down

0 comments on commit 7df94c3

Please sign in to comment.