Add: Opsi voucher monthly task support

This commit is contained in:
nEEtdo0d 2022-11-26 23:44:38 -05:00
parent 3b37e4afa0
commit 629addada4
18 changed files with 136 additions and 24 deletions

View File

@ -288,6 +288,10 @@ class AzurLaneAutoScript:
from module.campaign.os_run import OSCampaignRun
OSCampaignRun(config=self.config, device=self.device).opsi_shop()
def opsi_voucher(self):
from module.campaign.os_run import OSCampaignRun
OSCampaignRun(config=self.config, device=self.device).opsi_voucher()
def opsi_daily(self):
from module.campaign.os_run import OSCampaignRun
OSCampaignRun(config=self.config, device=self.device).opsi_daily()

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1508,6 +1508,19 @@
"BuySupply": true
}
},
"OpsiVoucher": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "OpsiVoucher",
"SuccessInterval": 0,
"FailureInterval": 0,
"ServerUpdate": "00:00"
},
"OpsiVoucher": {
"Filter": "LoggerAbyssal > LoggerObscure > HECombatPlan > Book > Coin"
}
},
"OpsiDaily": {
"Scheduler": {
"Enable": false,

View File

@ -35,6 +35,13 @@ class OSCampaignRun(OSMapOperation):
except ActionPointLimit:
self.config.opsi_task_delay(ap_limit=True)
def opsi_voucher(self):
self.load_campaign()
try:
self.campaign.os_voucher()
except ActionPointLimit:
self.config.opsi_task_delay(ap_limit=True)
def opsi_daily(self):
self.load_campaign()
try:

View File

@ -559,6 +559,9 @@ OpsiExplore:
LastZone: 0
OpsiShop:
BuySupply: true
OpsiVoucher:
Filter: |-
LoggerAbyssal > LoggerObscure > HECombatPlan > Book > Coin
OpsiDaily:
DoMission: true
UseTuningSample: true

View File

@ -53,6 +53,7 @@
"OpsiAshAssist",
"OpsiExplore",
"OpsiShop",
"OpsiVoucher",
"OpsiDaily",
"OpsiObscure",
"OpsiAbyssal",

View File

@ -336,6 +336,11 @@ OpsiShop:
SuccessInterval: 30
FailureInterval: 30
ServerUpdate: 00:00
OpsiVoucher:
Scheduler:
SuccessInterval: 0
FailureInterval: 0
ServerUpdate: 00:00
OpsiDaily:
Scheduler:
SuccessInterval: 30

View File

@ -243,6 +243,9 @@ OpsiExplore:
OpsiShop:
- Scheduler
- OpsiShop
OpsiVoucher:
- Scheduler
- OpsiVoucher
OpsiDaily:
- Scheduler
- OpsiDaily

View File

@ -365,6 +365,9 @@ class GeneratedConfig:
# Group `OpsiShop`
OpsiShop_BuySupply = True
# Group `OpsiVoucher`
OpsiVoucher_Filter = 'LoggerAbyssal > LoggerObscure > HECombatPlan > Book > Coin'
# Group `OpsiDaily`
OpsiDaily_DoMission = True
OpsiDaily_UseTuningSample = True

View File

@ -17,7 +17,7 @@ class ManualConfig:
> ShopFrequent > ShopOnce > Shipyard > Freebies
> OpsiExplore
> OpsiAshBeacon
> OpsiDaily > OpsiShop
> OpsiDaily > OpsiShop > OpsiVoucher
> OpsiAbyssal > OpsiStronghold > OpsiObscure
> Daily > Hard > OpsiAshBeacon > OpsiAshAssist
> Sos > EventSp > EventA > EventB > EventC > EventD > RaidDaily > WarArchives > MaritimeEscort

View File

@ -195,7 +195,11 @@
"help": ""
},
"OpsiShop": {
"name": "Opsi Shop",
"name": "OpSi Shop",
"help": ""
},
"OpsiVoucher": {
"name": "OpSi Voucher",
"help": ""
},
"OpsiDaily": {
@ -2022,7 +2026,7 @@
"OpsiExplore": {
"_info": {
"name": "OpSi Explore Settings",
"help": "At the beginning of each month OpSi is reset\nThe following must be satisfied:\n- Manually confirm fleet deployment into OpSi\n- OpSi story must be complete\nEach zone will be visited in a clockwise direction every 27 minutes until world has been been completely opened\nNo need to consume 5000 oil for special radar in OpSi shop"
"help": "At the beginning of each month OpSi is reset\nThe following must be satisfied:\n- Manually confirm fleet deployment into OpSi\n- OpSi story must be complete\nEach zone will be visited in a clockwise direction every 27 minutes until world has been been completely opened\nNo need to consume 5000 oil for special radar in OpSi Exchange shop"
},
"SpecialRadar": {
"name": "SpecialRadar Bought",
@ -2040,17 +2044,27 @@
"OpsiShop": {
"_info": {
"name": "OpSi Shop Settings",
"help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"BuySupply": {
"name": "Buy From Port Shops",
"help": "Buy all items from port shops\nShop inventory consists of a fixed pool that is reset monthly, items not bought during a cycle has the chance of re-appearing and blocking preferable high value items"
}
},
"OpsiVoucher": {
"_info": {
"name": "OpSi Voucher Settings",
"help": "Buy monthly items from the OpSi Exchange shop\nThe following must be satisfied:\n- OpSi story must be complete"
},
"Filter": {
"name": "Item Filter",
"help": "All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string>"
}
},
"OpsiDaily": {
"_info": {
"name": "OpSi Daily Settings",
"help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"DoMission": {
"name": "Do Port Mission(s)",
@ -2064,7 +2078,7 @@
"OpsiObscure": {
"_info": {
"name": "OpSi Obscure Settings",
"help": "Clear obscure zones every 27 minutes\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Clear obscure zones every 27 minutes\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"ForceRun": {
"name": "Force Run",
@ -2074,7 +2088,7 @@
"OpsiAbyssal": {
"_info": {
"name": "Abyssal Zones",
"help": "Clear abyssal zones.\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Clear abyssal zones.\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"ForceRun": {
"name": "Force Run",
@ -2084,7 +2098,7 @@
"OpsiStronghold": {
"_info": {
"name": "Siren Strongholds",
"help": "Clear the weekly siren strongholds.\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Clear the weekly siren strongholds.\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"ForceRun": {
"name": "Force Run",
@ -2094,7 +2108,7 @@
"OpsiMeowfficerFarming": {
"_info": {
"name": "OpSi Meowfficer Farm Settings",
"help": "Attack target zones of the specified hazard level in a clockwise direction\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi shop"
"help": "Attack target zones of the specified hazard level in a clockwise direction\nThe following must be satisfied:\n- OpSi story must be complete\n- Zones must be unlocked either by OpSi explore or consuming 5000 oil for special radar in OpSi Exchange shop"
},
"ActionPointPreserve": {
"name": "Keep X Amount of AP",

View File

@ -198,6 +198,10 @@
"name": "Task.OpsiShop.name",
"help": "Task.OpsiShop.help"
},
"OpsiVoucher": {
"name": "Task.OpsiVoucher.name",
"help": "Task.OpsiVoucher.help"
},
"OpsiDaily": {
"name": "Task.OpsiDaily.name",
"help": "Task.OpsiDaily.help"
@ -585,7 +589,7 @@
"name": "Campaign.Event.name",
"help": "Campaign.Event.help",
"campaign_main": "campaign_main",
"event_20201229_cn": "虚畳なりし限象(復刻)",
"event_20221110_cn": "虚畳なりし限象(復刻)",
"event_20211111_cn": "燈火のシニエ",
"raid_20221027": "戦えロイヤルメイド隊3rd",
"event_20210121_cn": "悲歎せし焔海の詩(復刻)",
@ -615,6 +619,7 @@
"event_20210225_cn": "暁射す氷華の嵐",
"event_20220210_cn": "凍絶の北海(復刻)",
"raid_20220127": "秘密事件調査",
"event_20201229_cn": "虚畳なりし限象",
"event_20211229_cn": "遡望せし虹彩の塔",
"event_20211125_cn": "弧光は交わる世界にて",
"event_20211028_tw": "復刻光與影的鳶尾之華",
@ -2047,6 +2052,16 @@
"help": "OpsiShop.BuySupply.help"
}
},
"OpsiVoucher": {
"_info": {
"name": "OpsiVoucher._info.name",
"help": "OpsiVoucher._info.help"
},
"Filter": {
"name": "OpsiVoucher.Filter.name",
"help": "OpsiVoucher.Filter.help"
}
},
"OpsiDaily": {
"_info": {
"name": "OpsiDaily._info.name",

View File

@ -198,6 +198,10 @@
"name": "大世界商店",
"help": ""
},
"OpsiVoucher": {
"name": "Task.OpsiVoucher.name",
"help": "Task.OpsiVoucher.help"
},
"OpsiDaily": {
"name": "大世界每日",
"help": ""
@ -585,7 +589,7 @@
"name": "活动名称",
"help": "自动选择至最新的活动",
"campaign_main": "主线图",
"event_20201229_cn": "复刻负象限作战",
"event_20221110_cn": "复刻负象限作战",
"event_20211111_cn": "杰诺瓦的焰火",
"raid_20221027": "战斗皇家女仆队3rd",
"event_20210121_cn": "复刻神圣的悲喜剧",
@ -615,6 +619,7 @@
"event_20210225_cn": "破晓冰华",
"event_20220210_cn": "复刻北境序曲",
"raid_20220127": "演习神秘事件调查",
"event_20201229_cn": "负象限作战",
"event_20211229_cn": "逆转彩虹之塔",
"event_20211125_cn": "交汇世界的弧光",
"event_20211028_tw": "復刻光與影的鳶尾之華",
@ -2047,6 +2052,16 @@
"help": "每月港口商店可购买商品是固定的,未购买的物品下次仍会出现,并阻塞高价值物品,因此需要购买全部"
}
},
"OpsiVoucher": {
"_info": {
"name": "OpsiVoucher._info.name",
"help": "OpsiVoucher._info.help"
},
"Filter": {
"name": "OpsiVoucher.Filter.name",
"help": "OpsiVoucher.Filter.help"
}
},
"OpsiDaily": {
"_info": {
"name": "大世界每日",

View File

@ -198,6 +198,10 @@
"name": "大世界商店",
"help": ""
},
"OpsiVoucher": {
"name": "Task.OpsiVoucher.name",
"help": "Task.OpsiVoucher.help"
},
"OpsiDaily": {
"name": "大世界每日",
"help": ""
@ -585,7 +589,7 @@
"name": "活動名稱",
"help": "自動選擇至最新的活動圖",
"campaign_main": "主線圖",
"event_20201229_cn": "Inverted Orthant Rerun",
"event_20221110_cn": "Inverted Orthant Rerun",
"event_20211111_cn": "杰諾瓦的焰火",
"raid_20221027": "Fight On Royal Maids!(Part 3)",
"event_20210121_cn": "復刻神聖的悲喜劇",
@ -615,6 +619,7 @@
"event_20210225_cn": "破曉冰華",
"event_20220210_cn": "Northern Overture Rerun",
"raid_20220127": "Mystery Investigation",
"event_20201229_cn": "負象限作戰",
"event_20211229_cn": "Tower of Transcendence",
"event_20211125_cn": "交匯世界的弧光",
"event_20211028_tw": "復刻光與影的鳶尾之華",
@ -2047,6 +2052,16 @@
"help": "每月港口商店可購買商品是固定的,未購買的物品下次仍會出現,並阻擋高價值物品,因此需要購買全部"
}
},
"OpsiVoucher": {
"_info": {
"name": "OpsiVoucher._info.name",
"help": "OpsiVoucher._info.help"
},
"Filter": {
"name": "OpsiVoucher.Filter.name",
"help": "OpsiVoucher.Filter.help"
}
},
"OpsiDaily": {
"_info": {
"name": "大世界每日",

View File

@ -6,8 +6,10 @@ from module.config.utils import (get_os_next_reset,
from module.exception import RequestHumanTakeover, GameStuckError, ScriptError
from module.logger import logger
from module.map.map_grids import SelectedGrids
from module.shop.shop_voucher import VoucherShop
from module.os.fleet import BossFleet
from module.os.globe_operation import OSExploreError
from module.os_handler.assets import EXCHANGE_CHECK, EXCHANGE_ENTER
from module.os.map import OSMap
@ -125,6 +127,27 @@ class OperationSiren(OSMap):
self.os_port_daily(mission=False, supply=self.config.OpsiShop_BuySupply)
self.config.task_delay(server_update=True)
def _os_voucher_enter(self):
self.os_map_goto_globe(unpin=False)
self.ui_click(click_button=EXCHANGE_ENTER, check_button=EXCHANGE_CHECK,
offset=(200, 20), retry_wait=3, skip_first_screenshot=True)
def _os_voucher_exit(self):
self.ui_back(check_button=EXCHANGE_ENTER, appear_button=EXCHANGE_CHECK,
offset=(200, 20), retry_wait=3, skip_first_screenshot=True)
self.os_globe_goto_map()
def os_voucher(self):
logger.hr('OS voucher', level=1)
self._os_voucher_enter()
VoucherShop(self.config, self.device).run()
self._os_voucher_exit()
next_reset = get_os_next_reset()
logger.info('OS voucher finished, delay to next reset')
logger.attr('OpsiNextReset', next_reset)
self.config.task_delay(target=next_reset)
def os_meowfficer_farming(self):
"""
Recommend 3 or 5 for higher meowfficer searching point per action points ratio.

View File

@ -14,6 +14,7 @@ AUTO_SEARCH_OS_MAP_OPTION_ON = Button(area={'cn': (1205, 549, 1275, 566), 'en':
AUTO_SEARCH_REWARD = Button(area={'cn': (575, 598, 721, 646), 'en': (574, 597, 722, 648), 'jp': (577, 597, 722, 645), 'tw': (576, 598, 720, 647)}, color={'cn': (169, 168, 170), 'en': (168, 171, 174), 'jp': (165, 170, 175), 'tw': (171, 174, 179)}, button={'cn': (575, 598, 721, 646), 'en': (574, 597, 722, 648), 'jp': (577, 597, 722, 645), 'tw': (576, 598, 720, 647)}, file={'cn': './assets/cn/os_handler/AUTO_SEARCH_REWARD.png', 'en': './assets/en/os_handler/AUTO_SEARCH_REWARD.png', 'jp': './assets/jp/os_handler/AUTO_SEARCH_REWARD.png', 'tw': './assets/tw/os_handler/AUTO_SEARCH_REWARD.png'})
CLICK_SAFE_AREA = Button(area={'cn': (1104, 169, 1214, 284), 'en': (1104, 169, 1214, 284), 'jp': (1104, 169, 1214, 284), 'tw': (1104, 169, 1214, 284)}, color={'cn': (96, 114, 142), 'en': (96, 114, 142), 'jp': (96, 114, 142), 'tw': (96, 114, 142)}, button={'cn': (1104, 169, 1214, 284), 'en': (1104, 169, 1214, 284), 'jp': (1104, 169, 1214, 284), 'tw': (1104, 169, 1214, 284)}, file={'cn': './assets/cn/os_handler/CLICK_SAFE_AREA.png', 'en': './assets/en/os_handler/CLICK_SAFE_AREA.png', 'jp': './assets/jp/os_handler/CLICK_SAFE_AREA.png', 'tw': './assets/tw/os_handler/CLICK_SAFE_AREA.png'})
EXCHANGE_CHECK = Button(area={'cn': (144, 17, 249, 41), 'en': (143, 16, 240, 37), 'jp': (141, 16, 250, 42), 'tw': (144, 17, 249, 41)}, color={'cn': (153, 170, 209), 'en': (117, 133, 171), 'jp': (86, 98, 127), 'tw': (153, 170, 209)}, button={'cn': (144, 17, 249, 41), 'en': (143, 16, 240, 37), 'jp': (141, 16, 250, 42), 'tw': (144, 17, 249, 41)}, file={'cn': './assets/cn/os_handler/EXCHANGE_CHECK.png', 'en': './assets/en/os_handler/EXCHANGE_CHECK.png', 'jp': './assets/jp/os_handler/EXCHANGE_CHECK.png', 'tw': './assets/cn/os_handler/EXCHANGE_CHECK.png'})
EXCHANGE_ENTER = Button(area={'cn': (202, 640, 332, 690), 'en': (202, 640, 332, 690), 'jp': (202, 640, 332, 690), 'tw': (202, 640, 332, 690)}, color={'cn': (64, 61, 59), 'en': (64, 61, 59), 'jp': (64, 61, 59), 'tw': (64, 61, 59)}, button={'cn': (202, 640, 332, 690), 'en': (202, 640, 332, 690), 'jp': (202, 640, 332, 690), 'tw': (202, 640, 332, 690)}, file={'cn': './assets/cn/os_handler/EXCHANGE_ENTER.png', 'en': './assets/en/os_handler/EXCHANGE_ENTER.png', 'jp': './assets/cn/os_handler/EXCHANGE_ENTER.png', 'tw': './assets/cn/os_handler/EXCHANGE_ENTER.png'})
GET_ADAPTABILITY = Button(area={'cn': (538, 191, 742, 227), 'en': (527, 194, 659, 215), 'jp': (538, 191, 743, 227), 'tw': (539, 191, 741, 227)}, color={'cn': (166, 195, 246), 'en': (198, 207, 230), 'jp': (158, 190, 245), 'tw': (164, 195, 246)}, button={'cn': (538, 191, 742, 227), 'en': (527, 194, 659, 215), 'jp': (538, 191, 743, 227), 'tw': (539, 191, 741, 227)}, file={'cn': './assets/cn/os_handler/GET_ADAPTABILITY.png', 'en': './assets/en/os_handler/GET_ADAPTABILITY.png', 'jp': './assets/jp/os_handler/GET_ADAPTABILITY.png', 'tw': './assets/tw/os_handler/GET_ADAPTABILITY.png'})
GET_MEOWFFICER_ITEMS_1 = Button(area={'cn': (558, 211, 730, 242), 'en': (550, 211, 723, 247), 'jp': (538, 217, 732, 253), 'tw': (558, 211, 730, 242)}, color={'cn': (186, 200, 231), 'en': (165, 191, 241), 'jp': (143, 180, 249), 'tw': (186, 200, 231)}, button={'cn': (558, 211, 730, 242), 'en': (550, 211, 723, 247), 'jp': (538, 217, 732, 253), 'tw': (558, 211, 730, 242)}, file={'cn': './assets/cn/os_handler/GET_MEOWFFICER_ITEMS_1.png', 'en': './assets/en/os_handler/GET_MEOWFFICER_ITEMS_1.png', 'jp': './assets/jp/os_handler/GET_MEOWFFICER_ITEMS_1.png', 'tw': './assets/tw/os_handler/GET_MEOWFFICER_ITEMS_1.png'})
GET_MEOWFFICER_ITEMS_2 = Button(area={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, color={'cn': (186, 200, 231), 'en': (165, 191, 242), 'jp': (143, 179, 249), 'tw': (186, 200, 231)}, button={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, file={'cn': './assets/cn/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'en': './assets/en/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'jp': './assets/jp/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'tw': './assets/tw/os_handler/GET_MEOWFFICER_ITEMS_2.png'})

View File

@ -8,21 +8,11 @@ from module.ocr.ocr import Digit, Ocr
from module.shop.assets import *
from module.shop.base import ShopItemGrid
from module.shop.clerk import ShopClerk
from module.shop.shop_medal import ShopPriceOcr
from module.ui.scroll import Scroll
OCR_SHOP_VOUCHER = Digit(SHOP_VOUCHER, letter=(255, 255, 255), name='OCR_SHOP_VOUCHER')
VOUCHER_SHOP_SCROLL = Scroll(VOUCHER_SHOP_SCROLL_AREA, color=(255, 255, 255))
class ShopPriceOcr(Digit):
def after_process(self, result):
result = Ocr.after_process(self, result)
# '100' detected as '00' on occasion
if result == '00':
result = '100'
return Digit.after_process(self, result)
PRICE_OCR = ShopPriceOcr([], letter=(255, 223, 57), threshold=32, name='Price_ocr')
TEMPLATE_VOUCHER_ICON = Template('./assets/shop/cost/Voucher.png')
@ -34,7 +24,7 @@ class VoucherShop(ShopClerk):
Returns:
str:
"""
return voucher_redirect(self.config.Voucher_Filter.strip())
return voucher_redirect(self.config.OpsiVoucher_Filter.strip())
def _get_vouchers(self):
"""