ref: remove frequency config and not to judge coins at last day

This commit is contained in:
霞飛 2024-06-18 12:35:08 +08:00 committed by LmeSzinc
parent 86d6c36670
commit 62bc1ed7f7
10 changed files with 22 additions and 68 deletions

View File

@ -1635,7 +1635,6 @@
"ServerUpdate": "00:00"
},
"OpsiShop": {
"ScanFrequencyLimit": "weekly",
"PresetFilter": "max_benefit_meta",
"CustomFilter": "Logger"
},

View File

@ -8420,15 +8420,6 @@
}
},
"OpsiShop": {
"ScanFrequencyLimit": {
"type": "select",
"value": "weekly",
"option": [
"everyday",
"weekly",
"everyday_of_week_before_reset"
]
},
"PresetFilter": {
"type": "select",
"value": "max_benefit_meta",

View File

@ -666,12 +666,6 @@ OpsiExplore:
ForceRun: false
LastZone: 0
OpsiShop:
ScanFrequencyLimit:
value: weekly
option:
- everyday
- weekly
- everyday_of_week_before_reset
PresetFilter:
value: max_benefit_meta
option:

View File

@ -388,7 +388,6 @@ class GeneratedConfig:
OpsiExplore_LastZone = 0
# Group `OpsiShop`
OpsiShop_ScanFrequencyLimit = 'weekly' # everyday, weekly, everyday_of_week_before_reset
OpsiShop_PresetFilter = 'max_benefit_meta' # max_benefit, max_benefit_meta, no_meta, all, custom
OpsiShop_CustomFilter = 'Logger'

View File

@ -2287,13 +2287,6 @@
"name": "OpSi Shop Settings",
"help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story and practice battles must be complete\n- Task OpSi Explore enabled or consuming 5000 oil for special radar in OpSi voucher shop"
},
"ScanFrequencyLimit": {
"name": "Scan Frequency Limit",
"help": "The frequency of scanning the OS shop when all items in the filter have been purchased.",
"everyday": "everyday",
"weekly": "weekly",
"everyday_of_week_before_reset": "everyday of week before reset"
},
"PresetFilter": {
"name": "OpSi Shop Filter",
"help": "Generally does not need to be modified. Use \"High value items and META material\"` if Voucher Coins spilled or \"Without META materials\" if you are newcomer.\nHigh value items include ActionPoint, Logger and T4 or higher items; META materials include METABook and META enhance materials.",

View File

@ -2287,13 +2287,6 @@
"name": "OpsiShop._info.name",
"help": "OpsiShop._info.help"
},
"ScanFrequencyLimit": {
"name": "OpsiShop.ScanFrequencyLimit.name",
"help": "OpsiShop.ScanFrequencyLimit.help",
"everyday": "everyday",
"weekly": "weekly",
"everyday_of_week_before_reset": "everyday of week before reset"
},
"PresetFilter": {
"name": "OpsiShop.PresetFilter.name",
"help": "OpsiShop.PresetFilter.help",

View File

@ -2287,13 +2287,6 @@
"name": "大世界商店",
"help": "使用此功能前必须满足以下条件:\n- 通关大世界主线并完成模拟战+塞壬试验场\n- 启用大世界开荒任务或使用战役信息记录仪5000油道具"
},
"ScanFrequencyLimit": {
"name": "扫描商店频率",
"help": "当认为港口商店已经购买完所有过滤器中的物品后,扫描港口商店的频率。",
"everyday": "每天",
"weekly": "每周",
"everyday_of_week_before_reset": "大世界重置前的一周的每天"
},
"PresetFilter": {
"name": "港口商店过滤器",
"help": "一般默认即可,白票溢出建议选 \"高价值物品与META材料\",萌新建议选 \"不购买META材料\"这会买除了META材料以外的所有东西。\n高价值物品为行动力、坐标和金或者更高级別的商品META材料为META通用战术教材和4种强化材料。",

View File

@ -2287,13 +2287,6 @@
"name": "大世界商店",
"help": "使用此功能前必須滿足以下條件:\n- 通關大世界主線任務+模擬戰\n- 開啟大世界開荒任務或使用戰役信息記錄儀5000油道具"
},
"ScanFrequencyLimit": {
"name": "掃描頻率約束",
"help": "當過濾器中的所有物品都已購買時,掃描港口商店的頻率。",
"everyday": "每天",
"weekly": "每週",
"everyday_of_week_before_reset": "大世界重置前的一周的每天"
},
"PresetFilter": {
"name": "港口商店過濾器",
"help": "一般用預設即可,白票溢出建議選 \"高價值物品與META材料\",新手建議選 \"不購買META材料\"這會買除了META材料以外的所有東西。\n高價值物品為行動點、坐標和金或者更高級別的物品META材料為META通用戰術教材和4種強化材料。",

View File

@ -262,29 +262,22 @@ class OperationSiren(OSMap):
Returns:
datetime: The time of the next shop reset.
"""
frequency = self.config.OpsiShop_ScanFrequencyLimit
next_reset = None
if not_empty or frequency == 'everyday':
if not_empty:
next_reset = get_server_next_update(self.config.Scheduler_ServerUpdate)
else:
remain = get_os_reset_remain()
next_reset = get_os_next_reset()
if frequency == 'weekly':
if remain == 0:
next_reset = get_server_next_update(self.config.Scheduler_ServerUpdate)
elif remain < 7:
next_reset = next_reset - timedelta(days=1)
else:
next_reset = (
get_server_next_update(self.config.Scheduler_ServerUpdate) +
timedelta(days=6)
)
elif frequency == 'week_before_reset':
if remain < 7:
next_reset = get_server_next_update(self.config.Scheduler_ServerUpdate)
else:
next_reset = next_reset - timedelta(days=7)
if remain == 0:
next_reset = get_server_next_update(self.config.Scheduler_ServerUpdate)
elif remain < 7:
next_reset = next_reset - timedelta(days=1)
else:
next_reset = (
get_server_next_update(self.config.Scheduler_ServerUpdate) +
timedelta(days=6)
)
return next_reset
def _os_voucher_enter(self):

View File

@ -3,7 +3,7 @@ from datetime import datetime, timedelta
from module.base.timer import Timer
from module.config.config import Function
from module.config.utils import get_server_next_update
from module.config.utils import get_server_next_update, get_os_reset_remain
from module.logger import logger
from module.map.map_grids import SelectedGrids
from module.ocr.ocr import Digit
@ -92,12 +92,18 @@ class OSStatus(UI):
def get_currency_coins(self, item):
return self._shop_yellow_coins - (
0 if get_os_reset_remain() == 0 else
self.config.OS_CL1_YELLOW_COINS_PRESERVE if self.is_cl1_enabled else
self.config.OS_NORMAL_YELLOW_COINS_PRESERVE
) if item.cost == 'YellowCoins' \
else self._shop_purple_coins - self.config.OS_NORMAL_PURPLE_COINS_PRESERVE
) if item.cost == 'YellowCoins' else \
self._shop_purple_coins - (
0 if get_os_reset_remain() == 0 else
self.config.OS_NORMAL_PURPLE_COINS_PRESERVE
)
def is_coins_both_not_enough(self):
return self._shop_yellow_coins < (self.config.OS_CL1_YELLOW_COINS_PRESERVE if self.is_cl1_enabled else
self.config.OS_NORMAL_YELLOW_COINS_PRESERVE) \
and self._shop_purple_coins < self.config.OS_NORMAL_PURPLE_COINS_PRESERVE
return False if get_os_reset_remain() == 0 else \
self._shop_yellow_coins < (
self.config.OS_CL1_YELLOW_COINS_PRESERVE if self.is_cl1_enabled else
self.config.OS_NORMAL_YELLOW_COINS_PRESERVE
) and self._shop_purple_coins < self.config.OS_NORMAL_PURPLE_COINS_PRESERVE