Skip to content

Commit

Permalink
Add: Event Shop
Browse files Browse the repository at this point in the history
  • Loading branch information
guoh064 committed Sep 20, 2024
1 parent c118235 commit 9b6a640
Show file tree
Hide file tree
Showing 47 changed files with 1,236 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ config/reloadflag
config/reloadalas
test.py
test/
assets/shop/event_cost

# Created by .ignore support plugin (hsz.mobi)

Expand Down
Binary file added assets/cn/shop_event/EVENT_SHOP_DEADLINE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/shop_event/EVENT_SHOP_ITEM_REMAIN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/shop_event/EVENT_SHOP_PT_SSR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/shop_event/EVENT_SHOP_PT_UR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/shop_event/EVENT_SHOP_SCROLL_AREA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cn/shop_event/EVENT_SHOP_SECOND_ENSURE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/Array.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/AugmentChangeT1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/AugmentChangeT2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/AugmentCore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/AugmentEnhanceT2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/BoxT4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/CatT1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/CatT2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/CatT3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/Chip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/Coin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/DRS7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/DRS7_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/DRS7_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/FoodT1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/Oil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/PRS7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/PlateAntiairT3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/PlateGeneralT3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shop/event/PlateGunT3.png
Binary file added assets/shop/event/PlatePlaneT3.png
Binary file added assets/shop/event/PlateTorpedoT3.png
7 changes: 7 additions & 0 deletions config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,13 @@
"CoreShop": {
"Filter": "Array"
},
"EventShop": {
"Enable": false,
"UnlockShipSSR": false,
"BuyShipUR": 0,
"PresetFilter": "high_value",
"CustomFilter": "EquipUR > EquipSSR\n> DR > PR > Array > Chip > CatT3\n> Meta > Skinbox\n> Oil > Coin > FoodT1\n> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1\n> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4\n> ShipSSR"
},
"Storage": {
"Storage": {}
}
Expand Down
32 changes: 32 additions & 0 deletions module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -7847,6 +7847,38 @@
"value": "Array"
}
},
"EventShop": {
"Enable": {
"type": "checkbox",
"value": false
},
"UnlockShipSSR": {
"type": "checkbox",
"value": false
},
"BuyShipUR": {
"type": "select",
"value": 0,
"option": [
0,
1,
2
]
},
"PresetFilter": {
"type": "select",
"value": "high_value",
"option": [
"all",
"high_value",
"custom"
]
},
"CustomFilter": {
"type": "textarea",
"value": "EquipUR > EquipSSR\n> DR > PR > Array > Chip > CatT3\n> Meta > Skinbox\n> Oil > Coin > FoodT1\n> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1\n> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4\n> ShipSSR"
}
},
"Storage": {
"Storage": {
"type": "storage",
Expand Down
20 changes: 20 additions & 0 deletions module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,26 @@ MeritShop:
CoreShop:
Filter: |-
Array
EventShop:
Enable: false
UnlockShipSSR: false
BuyShipUR:
value: 0
option: [ 0, 1, 2 ]
PresetFilter:
value: high_value
option:
- all
- high_value
- custom
CustomFilter: |-
EquipUR > EquipSSR
> DR > PR > Array > Chip > CatT3
> Meta > Skinbox
> Oil > Coin > FoodT1
> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1
> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4
> ShipSSR
ShipyardDr:
ResearchSeries:
value: 2
Expand Down
1 change: 1 addition & 0 deletions module/config/argument/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ DailyMission:
- MedalShop2
- MeritShop
- CoreShop
- EventShop
Shipyard:
- Scheduler
- ShipyardDr
Expand Down
7 changes: 7 additions & 0 deletions module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ class GeneratedConfig:
# Group `CoreShop`
CoreShop_Filter = 'Array'

# Group `EventShop`
EventShop_Enable = False
EventShop_UnlockShipSSR = False
EventShop_BuyShipUR = 0 # 0, 1, 2
EventShop_PresetFilter = 'high_value' # all, high_value, custom
EventShop_CustomFilter = 'EquipUR > EquipSSR\n> DR > PR > Array > Chip > CatT3\n> Meta > Skinbox\n> Oil > Coin > FoodT1\n> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1\n> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4\n> ShipSSR'

# Group `ShipyardDr`
ShipyardDr_ResearchSeries = 2 # 2, 3
ShipyardDr_ShipIndex = 0 # 0, 1, 2, 3, 4, 5, 6
Expand Down
5 changes: 5 additions & 0 deletions module/config/config_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ def SERVER(self):
# For dev purpose, auto extract new item templates
SHOP_EXTRACT_TEMPLATE = False

"""
module.event_shop
"""
EVENT_SHOP_IGNORE_DEADLINE = False

"""
module.war_archives
"""
Expand Down
32 changes: 32 additions & 0 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,38 @@
"help": "All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string>\nHowever unlike other shops, only Chip and Array are supported\nALAS does not browse, scroll, or recognize any other items displayed besides those two"
}
},
"EventShop": {
"_info": {
"name": "Event Shop",
"help": "Ships will be bought after event ends, and corresponding pts will be preserved."
},
"Enable": {
"name": "Enable Event Shop",
"help": ""
},
"UnlockShipSSR": {
"name": "Unlock event SSR ship",
"help": "If not enabled, will discard `ShipSSR` and `Meta` in filter string."
},
"BuyShipUR": {
"name": "Buy X event UR ship",
"help": "",
"0": "0",
"1": "1",
"2": "2"
},
"PresetFilter": {
"name": "Preset Filter Select",
"help": "",
"all": "all",
"high_value": "high_value",
"custom": "custom"
},
"CustomFilter": {
"name": "Custom Filter",
"help": "To use your own filter, set \"Preset Filter Select\" to \"custom\". All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string>"
}
},
"ShipyardDr": {
"_info": {
"name": "DR Blueprints Purchase Settings",
Expand Down
32 changes: 32 additions & 0 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,38 @@
"help": "CoreShop.Filter.help"
}
},
"EventShop": {
"_info": {
"name": "EventShop._info.name",
"help": "EventShop._info.help"
},
"Enable": {
"name": "EventShop.Enable.name",
"help": "EventShop.Enable.help"
},
"UnlockShipSSR": {
"name": "EventShop.UnlockShipSSR.name",
"help": "EventShop.UnlockShipSSR.help"
},
"BuyShipUR": {
"name": "EventShop.BuyShipUR.name",
"help": "EventShop.BuyShipUR.help",
"0": "0",
"1": "1",
"2": "2"
},
"PresetFilter": {
"name": "EventShop.PresetFilter.name",
"help": "EventShop.PresetFilter.help",
"all": "all",
"high_value": "high_value",
"custom": "custom"
},
"CustomFilter": {
"name": "EventShop.CustomFilter.name",
"help": "EventShop.CustomFilter.help"
}
},
"ShipyardDr": {
"_info": {
"name": "ShipyardDr._info.name",
Expand Down
32 changes: 32 additions & 0 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,38 @@
"help": ""
}
},
"EventShop": {
"_info": {
"name": "活动商店",
"help": "活动船只将会在活动结束后购买"
},
"Enable": {
"name": "启用活动商店",
"help": ""
},
"UnlockShipSSR": {
"name": "解锁活动金船",
"help": "如果不启用,将会抛掉过滤器中的ShipSSR和Meta"
},
"BuyShipUR": {
"name": "购买X只活动彩船",
"help": "",
"0": "0",
"1": "1",
"2": "2"
},
"PresetFilter": {
"name": "活动商店过滤器",
"help": "",
"all": "全部",
"high_value": "高价值",
"custom": "自定义"
},
"CustomFilter": {
"name": "自定义过滤器",
"help": "使用自定义过滤器需将 \"活动商店过滤器\" 设置为 \"自定义\",并阅读 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string"
}
},
"ShipyardDr": {
"_info": {
"name": "彩科研图纸购买设置",
Expand Down
32 changes: 32 additions & 0 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,38 @@
"help": ""
}
},
"EventShop": {
"_info": {
"name": "活動商店",
"help": "活動船只將會在活動結束後購買"
},
"Enable": {
"name": "啟用活動商店",
"help": ""
},
"UnlockShipSSR": {
"name": "解鎖活動金船",
"help": "如果不啟用,將會拋掉過濾器中的ShipSSR和Meta"
},
"BuyShipUR": {
"name": "購買X只活動彩船",
"help": "",
"0": "0",
"1": "1",
"2": "2"
},
"PresetFilter": {
"name": "活動商店過濾器",
"help": "",
"all": "全部",
"high_value": "高價值",
"custom": "自定義"
},
"CustomFilter": {
"name": "自定義過濾器",
"help": "使用自定義過濾器需將 \"活動商店過濾器\" 設定為 \"自定義\",並閱讀 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string"
}
},
"ShipyardDr": {
"_info": {
"name": "彩科研圖紙購買設定",
Expand Down
13 changes: 12 additions & 1 deletion module/shop/shop_reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from module.shop.shop_medal import MedalShop2
from module.shop.shop_merit import MeritShop
from module.shop.ui import ShopUI
from module.shop_event.shop_event import EventShop
from module.shop_event.ui import OCR_EVENT_SHOP_SECOND_ENSURE


class RewardShop(ShopUI):
Expand All @@ -19,7 +21,16 @@ def run_frequent(self):

def run_once(self):
# Munitions shops
self.ui_goto_shop()
if self.config.EventShop_Enable:
self.ui_goto_event_shop()
if self.shop_tab.get_active(main=self) == 2:
EventShop(self.config, self.device).run()
text = OCR_EVENT_SHOP_SECOND_ENSURE.ocr(self.device.image)
if text != "":
self.shop_nav.set(main=self, upper=2)
EventShop(self.config, self.device).run()
else:
self.ui_goto_shop()

self.shop_tab.set(main=self, left=2)
self.shop_nav.set(main=self, upper=2)
Expand Down
40 changes: 37 additions & 3 deletions module/shop/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from module.handler.assets import POPUP_CONFIRM
from module.logger import logger
from module.shop.assets import *
from module.ui.assets import ACADEMY_GOTO_MUNITIONS, BACK_ARROW
from module.ui.assets import ACADEMY_GOTO_MUNITIONS, BACK_ARROW, SHOP_GOTO_MUNITIONS
from module.ui.navbar import Navbar
from module.ui.page import page_academy, page_munitions
from module.ui.page import page_academy, page_main, page_shop, page_munitions
from module.ui.ui import UI


Expand Down Expand Up @@ -57,10 +57,11 @@ def shop_tab(self):
- index
1: Monthly shops
2: General supply shops
3: Event shops
"""
grids = ButtonGrid(
origin=(340, 93), delta=(189, 0),
button_shape=(188, 54), grid_shape=(2, 1),
button_shape=(188, 54), grid_shape=(3, 1),
name='SHOP_TAB')
return Navbar(
grids=grids,
Expand All @@ -85,6 +86,9 @@ def shop_nav(self):
3: Guild shop
4: Meta shop
5: Gift shop
- index when `shop_tab` is at 3
1: Current event shop
2: Previous event shop (if exists)
"""
grids = ButtonGrid(
origin=(339, 217), delta=(0, 65),
Expand Down Expand Up @@ -237,3 +241,33 @@ def ui_goto_shop(self):
# Large offset cause it camera in academy can be move around
if self.appear_then_click(ACADEMY_GOTO_MUNITIONS, offset=(200, 200), interval=5):
continue

def ui_goto_event_shop(self):
"""
Goes to page_munitions
This route guarantees start
in event shop if exists
Pages:
in: Any
out: page_munitions
"""
if self.ui_get_current_page() == page_munitions\
and self.shop_tab.get_active(main=self) == 2:
logger.info(f'Already at {page_munitions}')
return

self.ui_ensure(page_shop)

skip_first_screenshot = True
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()

if self.appear(page_munitions.check_button, offset=(20, 20)):
break

if self.appear_then_click(SHOP_GOTO_MUNITIONS, offset=(20, 20), interval=5):
continue
12 changes: 12 additions & 0 deletions module/shop_event/assets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from module.base.button import Button
from module.base.template import Template

# This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually.

EVENT_SHOP_DEADLINE = Button(area={'cn': (437, 192, 761, 216), 'en': (437, 192, 761, 216), 'jp': (437, 192, 761, 216), 'tw': (437, 192, 761, 216)}, color={'cn': (76, 75, 60), 'en': (76, 75, 60), 'jp': (76, 75, 60), 'tw': (76, 75, 60)}, button={'cn': (437, 192, 761, 216), 'en': (437, 192, 761, 216), 'jp': (437, 192, 761, 216), 'tw': (437, 192, 761, 216)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_DEADLINE.png', 'en': './assets/cn/shop_event/EVENT_SHOP_DEADLINE.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_DEADLINE.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_DEADLINE.png'})
EVENT_SHOP_ITEM_REMAIN = Button(area={'cn': (442, 231, 490, 250), 'en': (442, 231, 490, 250), 'jp': (442, 231, 490, 250), 'tw': (442, 231, 490, 250)}, color={'cn': (146, 150, 78), 'en': (146, 150, 78), 'jp': (146, 150, 78), 'tw': (146, 150, 78)}, button={'cn': (442, 231, 490, 250), 'en': (442, 231, 490, 250), 'jp': (442, 231, 490, 250), 'tw': (442, 231, 490, 250)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_ITEM_REMAIN.png', 'en': './assets/cn/shop_event/EVENT_SHOP_ITEM_REMAIN.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_ITEM_REMAIN.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_ITEM_REMAIN.png'})
EVENT_SHOP_PT_SSR = Button(area={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, color={'cn': (88, 91, 101), 'en': (88, 91, 101), 'jp': (88, 91, 101), 'tw': (88, 91, 101)}, button={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_PT_SSR.png', 'en': './assets/cn/shop_event/EVENT_SHOP_PT_SSR.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_PT_SSR.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_PT_SSR.png'})
EVENT_SHOP_PT_UR = Button(area={'cn': (911, 171, 1008, 200), 'en': (911, 171, 1008, 200), 'jp': (911, 171, 1008, 200), 'tw': (911, 171, 1008, 200)}, color={'cn': (255, 255, 255), 'en': (255, 255, 255), 'jp': (255, 255, 255), 'tw': (255, 255, 255)}, button={'cn': (911, 171, 1008, 200), 'en': (911, 171, 1008, 200), 'jp': (911, 171, 1008, 200), 'tw': (911, 171, 1008, 200)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_PT_UR.png', 'en': './assets/cn/shop_event/EVENT_SHOP_PT_UR.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_PT_UR.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_PT_UR.png'})
EVENT_SHOP_SCROLL_AREA = Button(area={'cn': (1260, 221, 1266, 643), 'en': (1260, 221, 1266, 643), 'jp': (1260, 221, 1266, 643), 'tw': (1260, 221, 1266, 643)}, color={'cn': (242, 205, 66), 'en': (242, 205, 66), 'jp': (242, 205, 66), 'tw': (242, 205, 66)}, button={'cn': (1260, 221, 1266, 643), 'en': (1260, 221, 1266, 643), 'jp': (1260, 221, 1266, 643), 'tw': (1260, 221, 1266, 643)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_SCROLL_AREA.png', 'en': './assets/cn/shop_event/EVENT_SHOP_SCROLL_AREA.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_SCROLL_AREA.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_SCROLL_AREA.png'})
EVENT_SHOP_SECOND_ENSURE = Button(area={'cn': (339, 302, 442, 328), 'en': (339, 302, 442, 328), 'jp': (339, 302, 442, 328), 'tw': (339, 302, 442, 328)}, color={'cn': (255, 255, 255), 'en': (255, 255, 255), 'jp': (255, 255, 255), 'tw': (255, 255, 255)}, button={'cn': (339, 302, 442, 328), 'en': (339, 302, 442, 328), 'jp': (339, 302, 442, 328), 'tw': (339, 302, 442, 328)}, file={'cn': './assets/cn/shop_event/EVENT_SHOP_SECOND_ENSURE.png', 'en': './assets/cn/shop_event/EVENT_SHOP_SECOND_ENSURE.png', 'jp': './assets/cn/shop_event/EVENT_SHOP_SECOND_ENSURE.png', 'tw': './assets/cn/shop_event/EVENT_SHOP_SECOND_ENSURE.png'})
Loading

0 comments on commit 9b6a640

Please sign in to comment.