Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Event Shop #4222

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
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_LOAD_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/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 modified assets/cn/ui/SHOP_GOTO_MUNITIONS.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 modified assets/en/ui/SHOP_GOTO_MUNITIONS.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 modified assets/jp/ui/SHOP_GOTO_MUNITIONS.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/GachaTicket.png
Binary file added assets/shop/event/Oil.png
Binary file added assets/shop/event/PRS7.png
Binary file added assets/shop/event/PlateAntiairT3.png
Binary file added assets/shop/event/PlateGeneralT3.png
Binary file added assets/shop/event/PlateGunT3.png
Binary file added assets/shop/event/PlatePlaneT3.png
Binary file added assets/shop/event/PlateTorpedoT3.png
Binary file modified assets/tw/ui/SHOP_GOTO_MUNITIONS.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": "all",
"CustomFilter": "EquipUR > EquipSSR > GachaTicket\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
31 changes: 31 additions & 0 deletions module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -7847,6 +7847,37 @@
"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": "all",
"option": [
"all",
"custom"
]
},
"CustomFilter": {
"type": "textarea",
"value": "EquipUR > EquipSSR > GachaTicket\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
19 changes: 19 additions & 0 deletions module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,25 @@ MeritShop:
CoreShop:
Filter: |-
Array
EventShop:
Enable: false
UnlockShipSSR: false
BuyShipUR:
value: 0
option: [ 0, 1, 2 ]
PresetFilter:
value: all
option:
- all
- custom
CustomFilter: |-
EquipUR > EquipSSR > GachaTicket
> 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 = 'all' # all, custom
EventShop_CustomFilter = 'EquipUR > EquipSSR > GachaTicket\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
31 changes: 31 additions & 0 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,37 @@
"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",
"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
31 changes: 31 additions & 0 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,37 @@
"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",
"custom": "custom"
},
"CustomFilter": {
"name": "EventShop.CustomFilter.name",
"help": "EventShop.CustomFilter.help"
}
},
"ShipyardDr": {
"_info": {
"name": "ShipyardDr._info.name",
Expand Down
31 changes: 31 additions & 0 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,37 @@
"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": "全部",
"custom": "自定义"
},
"CustomFilter": {
"name": "自定义过滤器",
"help": "使用自定义过滤器需将 \"活动商店过滤器\" 设置为 \"自定义\",并阅读 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string"
}
},
"ShipyardDr": {
"_info": {
"name": "彩科研图纸购买设置",
Expand Down
31 changes: 31 additions & 0 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,37 @@
"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": "全部",
"custom": "自定義"
},
"CustomFilter": {
"name": "自定義過濾器",
"help": "使用自定義過濾器需將 \"活動商店過濾器\" 設定為 \"自定義\",並閱讀 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string"
}
},
"ShipyardDr": {
"_info": {
"name": "彩科研圖紙購買設定",
Expand Down
12 changes: 6 additions & 6 deletions module/ocr/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ class Digit(Ocr):
Method ocr() returns int, or a list of int.
"""

def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789IDSB',
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789IDSBZ',
name=None):
super().__init__(buttons, lang=lang, letter=letter, threshold=threshold, alphabet=alphabet, name=name)

def after_process(self, result):
result = super().after_process(result)
result = result.replace('I', '1').replace('D', '0').replace('S', '5')
result = result.replace('B', '8')
result = result.replace('B', '8').replace('Z', '2')

prev = result
result = int(result) if result else 0
Expand All @@ -163,14 +163,14 @@ class DigitYuv(Digit, OcrYuv):


class DigitCounter(Ocr):
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789/IDSB',
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789/IDSBZ',
name=None):
super().__init__(buttons, lang=lang, letter=letter, threshold=threshold, alphabet=alphabet, name=name)

def after_process(self, result):
result = super().after_process(result)
result = result.replace('I', '1').replace('D', '0').replace('S', '5')
result = result.replace('B', '8')
result = result.replace('B', '8').replace('Z', '2')
return result

def ocr(self, image, direct_ocr=False):
Expand Down Expand Up @@ -204,14 +204,14 @@ class DigitCounterYuv(DigitCounter, OcrYuv):


class Duration(Ocr):
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789:IDSB',
def __init__(self, buttons, lang='azur_lane', letter=(255, 255, 255), threshold=128, alphabet='0123456789:IDSBZ',
name=None):
super().__init__(buttons, lang=lang, letter=letter, threshold=threshold, alphabet=alphabet, name=name)

def after_process(self, result):
result = super().after_process(result)
result = result.replace('I', '1').replace('D', '0').replace('S', '5')
result = result.replace('B', '8')
result = result.replace('B', '8').replace('Z', '2')
return result

def ocr(self, image, direct_ocr=False):
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
Loading