mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 13:09:25 +08:00
ref: split the check of whether to shop to corresponding class
This commit is contained in:
@@ -101,3 +101,9 @@ class CoreShop_250814(ShopClerk, ShopStatus):
|
||||
|
||||
# Execute buy operations
|
||||
self.shop_buy()
|
||||
|
||||
|
||||
class CoreShop_250814(CoreShop_250814):
|
||||
def run(self):
|
||||
if self.config.full_config.ShopOnce_CoreShop_Enable:
|
||||
super().run()
|
||||
|
||||
@@ -114,3 +114,9 @@ class GuildShop_250814(ShopClerk, ShopUI, ShopStatus):
|
||||
else:
|
||||
logger.info('Guild coins < 110, skip refreshing')
|
||||
break
|
||||
|
||||
|
||||
class GuildShop_250814(GuildShop_250814):
|
||||
def run(self):
|
||||
if self.config.full_config.ShopOnce_GuildShop_Enable:
|
||||
super().run()
|
||||
|
||||
@@ -282,3 +282,9 @@ class MedalShop2_250814(ShopClerk, ShopStatus):
|
||||
del_cached_property(self, 'shop_grid')
|
||||
del_cached_property(self, 'shop_medal_items')
|
||||
continue
|
||||
|
||||
|
||||
class MedalShop2_250814(MedalShop2_250814):
|
||||
def run(self):
|
||||
if self.config.full_config.ShopOnce_MedalShop2_Enable:
|
||||
super().run()
|
||||
|
||||
@@ -84,3 +84,9 @@ class MeritShop_250814(ShopClerk, ShopUI, ShopStatus):
|
||||
if refresh and self.shop_refresh():
|
||||
continue
|
||||
break
|
||||
|
||||
|
||||
class MeritShop_250814(MeritShop_250814):
|
||||
def run(self):
|
||||
if self.config.full_config.ShopOnce_MeritShop_Enable:
|
||||
super().run()
|
||||
|
||||
@@ -44,53 +44,6 @@ class RewardShop(ShopUI):
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
|
||||
class RewardShop(RewardShop):
|
||||
|
||||
def buy_merit_shop(self):
|
||||
self.device.click_record_clear()
|
||||
self.shop_nav_250814.set(NAV_GENERAL, main=self)
|
||||
self.shop_tab_250814.set(TAB_MERIT, main=self)
|
||||
MeritShop_250814(self.config, self.device).run()
|
||||
|
||||
def buy_guild_shop(self):
|
||||
self.device.click_record_clear()
|
||||
self.shop_nav_250814.set(NAV_GENERAL, main=self)
|
||||
self.shop_tab_250814.set(TAB_GUILD, main=self)
|
||||
GuildShop_250814(self.config, self.device).run()
|
||||
|
||||
def buy_core_shop(self):
|
||||
# core limited, core monthly, medal, prototype
|
||||
self.device.click_record_clear()
|
||||
self.shop_nav_250814.set(NAV_MONTHLY, main=self)
|
||||
self.shop_tab_250814.set(TAB_CORE_MONTHLY, main=self)
|
||||
CoreShop_250814(self.config, self.device).run()
|
||||
|
||||
def buy_medal_shop(self):
|
||||
self.device.click_record_clear()
|
||||
self.shop_nav_250814.set(NAV_MONTHLY, main=self)
|
||||
self.shop_tab_250814.set(TAB_MEDAL, main=self)
|
||||
MedalShop2_250814(self.config, self.device).run()
|
||||
|
||||
def run_once(self):
|
||||
# Munitions shops
|
||||
if self.config.SERVER in ['tw']:
|
||||
self.config.task_delay(server_update=True)
|
||||
self.config.task_stop()
|
||||
|
||||
self.ui_goto_shop()
|
||||
|
||||
if self.config.full_config.ShopOnce_MeritShop_Enable:
|
||||
self.buy_merit_shop()
|
||||
if self.config.full_config.ShopOnce_GuildShop_Enable:
|
||||
self.buy_guild_shop()
|
||||
if self.config.full_config.ShopOnce_CoreShop_Enable:
|
||||
self.buy_core_shop()
|
||||
if self.config.full_config.ShopOnce_MedalShop2_Enable:
|
||||
self.buy_medal_shop()
|
||||
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
self = RewardShop('alas')
|
||||
self.device.screenshot()
|
||||
|
||||
Reference in New Issue
Block a user