Skip to content

Commit 48ac9d8

Browse files
committed
Chore: Format code
1 parent 7c922b0 commit 48ac9d8

7 files changed

Lines changed: 41 additions & 14 deletions

File tree

module/freebies/supply_pack.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,11 @@ def goto_supply_pack(self, skip_first_screenshot=True):
128128
in: page_shop
129129
out: page_supply_pack, supply pack tab
130130
"""
131-
while 1:
132-
if skip_first_screenshot:
133-
skip_first_screenshot = False
134-
else:
135-
self.device.screenshot()
136-
131+
logger.info('Goto supply pack')
132+
for _ in self.loop():
133+
137134
if self.match_template_color(page_supply_pack.check_button, offset=(20, 20)):
138-
logger.info("Page arrive: page_supply_pack")
135+
logger.info('At supply pack')
139136
break
140137

141138
elif self.appear_then_click(page_supply_pack.check_button, offset=(20, 20), interval=3):

module/shop/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import numpy as np
21
import re
32

3+
import numpy as np
4+
45
from module.base.button import ButtonGrid
56
from module.base.decorator import Config, cached_property
67
from module.base.filter import Filter
7-
from module.base.utils import rgb2gray
88
from module.base.timer import Timer
99
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_3, GET_SHIP
1010
from module.logger import logger
@@ -50,6 +50,7 @@ class ShopItem_250814(Item):
5050
Calculation result of unsold ship_T2 is 0.36, so 0.3 is taken as threshold,
5151
result of sold product is < 0.2
5252
"""
53+
5354
def predict_valid(self):
5455
mean = np.mean(np.max(self.image, axis=2) > 139)
5556
return mean > 0.3
@@ -100,6 +101,7 @@ def predict(self, image, name=True, amount=True, cost=False, price=False, tag=Fa
100101
class ShopItemGrid_250814(ShopItemGrid):
101102
item_class = ShopItem_250814
102103

104+
103105
class ShopBase(UI):
104106
_currency = 0
105107
shop_template_folder = ''

module/shop/shop_core.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ def shop_core_items(self):
104104
ShopItemGrid:
105105
"""
106106
shop_grid = self.shop_grid
107-
shop_core_items = ShopItemGrid_250814(shop_grid, templates={}, template_area=(25, 20, 82, 72), amount_area=(42, 50, 65, 65), cost_area=(-12, 115, 60, 155), price_area=(18, 121, 85, 150))
107+
shop_core_items = ShopItemGrid_250814(
108+
shop_grid,
109+
templates={},
110+
template_area=(25, 20, 82, 72),
111+
amount_area=(42, 50, 65, 65),
112+
cost_area=(-12, 115, 60, 155),
113+
price_area=(18, 121, 85, 150),
114+
)
108115
shop_core_items.load_template_folder(self.shop_template_folder)
109116
shop_core_items.load_cost_template_folder('./assets/shop/cost')
110117
return shop_core_items

module/shop/shop_general.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ def shop_general_items(self):
165165
"""
166166
shop_grid = self.shop_grid
167167

168-
shop_general_items = ShopItemGrid_250814(shop_grid, templates={}, template_area=(25, 20, 82, 72), amount_area=(42, 50, 65, 65), cost_area=(-12, 115, 60, 155), price_area=(14, 121, 85, 150))
168+
shop_general_items = ShopItemGrid_250814(
169+
shop_grid,
170+
templates={},
171+
template_area=(25, 20, 82, 72),
172+
amount_area=(42, 50, 65, 65),
173+
cost_area=(-12, 115, 60, 155),
174+
price_area=(14, 121, 85, 150),
175+
)
169176
shop_general_items.load_template_folder(self.shop_template_folder)
170177
shop_general_items.load_cost_template_folder('./assets/shop/cost')
171178
return shop_general_items

module/shop/shop_guild.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ def shop_guild_items(self):
117117
ShopItemGrid:
118118
"""
119119
shop_grid = self.shop_grid
120-
shop_guild_items = ShopItemGrid_250814(shop_grid, templates={}, template_area=(25, 20, 82, 72), amount_area=(42, 50, 65, 65), cost_area=(-12, 115, 60, 155), price_area=(14, 121, 85, 150))
120+
shop_guild_items = ShopItemGrid_250814(
121+
shop_grid,
122+
templates={},
123+
template_area=(25, 20, 82, 72),
124+
amount_area=(42, 50, 65, 65),
125+
cost_area=(-12, 115, 60, 155),
126+
price_area=(14, 121, 85, 150),
127+
)
121128
self.shop_template_folder = './assets/shop/guild'
122129
shop_guild_items.load_template_folder(self.shop_template_folder)
123130
shop_guild_items.load_cost_template_folder('./assets/shop/cost')

module/shop/shop_medal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
class ShopAdaptiveScroll(AdaptiveScroll):
2626
def match_color(self, main):
27-
from module.base.utils import save_image
2827
area = (self.area[0] - self.background, self.area[1], self.area[2] + self.background, self.area[3])
2928
image = main.image_crop(area, copy=False)
3029

@@ -46,6 +45,7 @@ def match_color(self, main):
4645
mask[peaks] = 1
4746
return mask
4847

48+
4949
MEDAL_SHOP_SCROLL_250814 = ShopAdaptiveScroll(
5050
MEDAL_SHOP_SCROLL_AREA_250814.button,
5151
background=1,

module/shop/shop_merit.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ def shop_merit_items(self):
8787
ShopItemGrid:
8888
"""
8989
shop_grid = self.shop_grid
90-
shop_merit_items = ShopItemGrid_250814(shop_grid, templates={}, template_area=(25, 20, 82, 72), amount_area=(42, 50, 65, 65), cost_area=(-12, 115, 60, 155), price_area=(14, 121, 85, 150))
90+
shop_merit_items = ShopItemGrid_250814(
91+
shop_grid,
92+
templates={},
93+
template_area=(25, 20, 82, 72),
94+
amount_area=(42, 50, 65, 65),
95+
cost_area=(-12, 115, 60, 155),
96+
price_area=(14, 121, 85, 150),
97+
)
9198
shop_merit_items.load_template_folder(self.shop_template_folder)
9299
shop_merit_items.load_cost_template_folder('./assets/shop/cost')
93100
return shop_merit_items

0 commit comments

Comments
 (0)