2023-05-27 18:54:51 +08:00
|
|
|
from module.base.decorator import Config
|
2023-05-25 23:03:17 +08:00
|
|
|
from module.logger import logger
|
2021-12-24 12:35:34 -05:00
|
|
|
from module.shop.shop_core import CoreShop
|
2021-07-10 23:11:32 -04:00
|
|
|
from module.shop.shop_general import GeneralShop
|
|
|
|
|
from module.shop.shop_guild import GuildShop
|
2022-06-05 22:42:08 +08:00
|
|
|
from module.shop.shop_medal import MedalShop2
|
2021-07-10 23:11:32 -04:00
|
|
|
from module.shop.shop_merit import MeritShop
|
|
|
|
|
from module.shop.ui import ShopUI
|
|
|
|
|
|
|
|
|
|
|
2022-06-04 20:59:06 -04:00
|
|
|
class RewardShop(ShopUI):
|
2021-10-29 16:10:49 -04:00
|
|
|
def run_frequent(self):
|
2022-01-19 21:36:37 -05:00
|
|
|
# Munitions shops
|
2021-09-23 22:04:03 +08:00
|
|
|
self.ui_goto_shop()
|
|
|
|
|
|
2022-06-03 03:04:28 +08:00
|
|
|
GeneralShop(self.config, self.device).run()
|
2021-09-23 22:04:03 +08:00
|
|
|
|
2021-10-29 16:10:49 -04:00
|
|
|
self.config.task_delay(server_update=True)
|
2021-09-23 22:04:03 +08:00
|
|
|
|
2023-05-27 18:54:51 +08:00
|
|
|
@Config.when(SERVER='tw')
|
|
|
|
|
def run_once(self):
|
|
|
|
|
# Munitions shops
|
|
|
|
|
self.ui_goto_shop()
|
|
|
|
|
self.shop_swipe()
|
|
|
|
|
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=5):
|
|
|
|
|
MeritShop(self.config, self.device).run()
|
|
|
|
|
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=4):
|
|
|
|
|
CoreShop(self.config, self.device).run()
|
|
|
|
|
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=2):
|
|
|
|
|
GuildShop(self.config, self.device).run()
|
|
|
|
|
|
|
|
|
|
# 2022.06.01 Medal shop has been moved to page_munitions
|
|
|
|
|
# Now the left most shop, its UI has changed considerably
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=1):
|
|
|
|
|
MedalShop2(self.config, self.device).run()
|
|
|
|
|
|
|
|
|
|
# Cannot go back to general shop so don't stay in page_munitions
|
|
|
|
|
self.ui_goto_main()
|
|
|
|
|
self.config.task_delay(server_update=True)
|
|
|
|
|
|
|
|
|
|
@Config.when(SERVER=None)
|
2021-10-29 16:10:49 -04:00
|
|
|
def run_once(self):
|
2022-01-19 21:36:37 -05:00
|
|
|
# Munitions shops
|
2021-10-29 16:10:49 -04:00
|
|
|
self.ui_goto_shop()
|
2021-09-23 22:04:03 +08:00
|
|
|
|
2023-05-25 23:03:17 +08:00
|
|
|
current = self._shop_bottom_navbar.get_active(main=self)
|
|
|
|
|
logger.info(f'Shop nav actives at left={current}')
|
2022-01-19 21:36:37 -05:00
|
|
|
|
2023-05-25 23:03:17 +08:00
|
|
|
if current is not None:
|
|
|
|
|
current += 1
|
2023-06-08 16:16:05 +08:00
|
|
|
# core_monthly, core, merit, general, event
|
2023-05-25 23:03:17 +08:00
|
|
|
# core, merit, general, event, event (2 event shops sometimes)
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=current - 1):
|
|
|
|
|
MeritShop(self.config, self.device).run()
|
2023-06-08 16:16:05 +08:00
|
|
|
if current - 3 >= 1:
|
|
|
|
|
if self.shop_bottom_navbar_ensure(left=current - 3):
|
|
|
|
|
CoreShop(self.config, self.device).run()
|
|
|
|
|
else:
|
|
|
|
|
logger.warning('Cannot navigate to core shop, skip')
|
2023-05-25 23:03:17 +08:00
|
|
|
else:
|
|
|
|
|
logger.error('Cannot get the position of general shop, skip merit shop and core shop')
|
|
|
|
|
|
|
|
|
|
self.shop_swipe()
|
2023-06-08 16:16:05 +08:00
|
|
|
# gift, meta, medal, guild, prototype
|
2023-06-08 23:59:17 +08:00
|
|
|
# meta, gift, medal, guild, prototype [EN]
|
2023-06-08 16:16:05 +08:00
|
|
|
if self.shop_bottom_navbar_ensure(left=4):
|
2022-01-19 21:36:37 -05:00
|
|
|
GuildShop(self.config, self.device).run()
|
2021-12-24 12:35:34 -05:00
|
|
|
|
2023-06-08 16:16:05 +08:00
|
|
|
if self.shop_bottom_navbar_ensure(left=3):
|
2022-06-05 22:42:08 +08:00
|
|
|
MedalShop2(self.config, self.device).run()
|
2021-10-29 16:10:49 -04:00
|
|
|
|
2022-06-05 22:42:08 +08:00
|
|
|
# Cannot go back to general shop so don't stay in page_munitions
|
|
|
|
|
self.ui_goto_main()
|
2021-12-22 00:46:39 +08:00
|
|
|
self.config.task_delay(server_update=True)
|