mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-09 05:47:30 +08:00
Add: The Flame-Touched Dagger (event_20211111_cn)
- Fix: Force to use fleet2 when MAP_CLEAR_ALL_THIS_TIME is True
This commit is contained in:
parent
c75aa7bd94
commit
a723740528
@ -71,4 +71,5 @@ To add a new event, add a new row in here, and run `python -m dev_tools.event_ex
|
||||
| 20211008 | event 20201012 cn | Sundered Blue | - | - | - | 劃破海空之翼 |
|
||||
| 20211014 | raid 20210708 | Cross Wave | - | - | - | 穿越彼方的水線 |
|
||||
| 20211028 | event 20211028 cn | Skybound Oratorio | 复刻穹顶下的圣咏曲 | Skybound Oratorio Rerun | 神穹を衝く聖歌(復刻) | - |
|
||||
| 20211028 | event 20211028 tw | Iris of Light and Dark | - | - | - | 復刻光與影的鳶尾之華 |
|
||||
| 20211028 | event 20211028 tw | Iris of Light and Dark | - | - | - | 復刻光與影的鳶尾之華 |
|
||||
| 20211111 | event 20211111 cn | The Flame-Touched Dagger | 杰诺瓦的焰火 | The Flame-Touched Dagger | 燈火のシニエ | - |
|
28
campaign/event_20211111_cn/campaign_base.py
Normal file
28
campaign/event_20211111_cn/campaign_base.py
Normal file
@ -0,0 +1,28 @@
|
||||
from module.campaign.campaign_base import CampaignBase as CampaignBase_
|
||||
from module.base.utils import color_similarity_2d
|
||||
from module.template.assets import TEMPLATE_ENEMY_BOSS
|
||||
from module.map_detection.grid import Grid
|
||||
|
||||
|
||||
class EventGrid(Grid):
|
||||
def predict_boss(self):
|
||||
# Small boss icon
|
||||
if self.relative_hsv_count(area=(0.03, -0.15, 0.63, 0.15), h=(358 - 3, 358 + 3), shape=(50, 20)) > 100:
|
||||
image = self.relative_crop((0.03, -0.15, 0.63, 0.15), shape=(50, 20))
|
||||
image = color_similarity_2d(image, color=(255, 77, 82))
|
||||
if TEMPLATE_ENEMY_BOSS.match(image, similarity=0.7):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def predict_enemy_genre(self):
|
||||
image = self.relative_crop((-0.55, -0.2, 0.45, 0.2), shape=(50, 20))
|
||||
image = color_similarity_2d(image, color=(255, 150, 24))
|
||||
if TEMPLATE_ENEMY_BOSS.match(image, similarity=0.75):
|
||||
return 'Siren_Siren'
|
||||
|
||||
return super().predict_enemy_genre()
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
grid_class = EventGrid
|
74
campaign/event_20211111_cn/sp1.py
Normal file
74
campaign/event_20211111_cn/sp1.py
Normal file
@ -0,0 +1,74 @@
|
||||
from .campaign_base import CampaignBase
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
|
||||
MAP = CampaignMap('SP1')
|
||||
MAP.shape = 'H7'
|
||||
MAP.camera_data = ['D2', 'D5', 'E2', 'E5']
|
||||
MAP.camera_data_spawn_point = ['D5']
|
||||
MAP.map_data = """
|
||||
ME -- ME ++ ++ ++ MB MB
|
||||
++ -- ME Me __ -- -- MB
|
||||
-- Me -- -- Me Me ME --
|
||||
-- ME ++ -- ME ++ ++ --
|
||||
ME -- ++ MS -- ME -- --
|
||||
-- -- -- ++ -- -- -- ME
|
||||
SP SP -- -- -- ME ME ++
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 3, 'siren': 1},
|
||||
{'battle': 1, 'enemy': 1},
|
||||
{'battle': 2, 'enemy': 1},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, \
|
||||
= MAP.flatten()
|
||||
|
||||
|
||||
class Config:
|
||||
# ===== Start of generated config =====
|
||||
MAP_SIREN_TEMPLATE = []
|
||||
# MOVABLE_ENEMY_TURN = (0,)
|
||||
MAP_HAS_SIREN = True
|
||||
# MAP_HAS_MOVABLE_ENEMY = True
|
||||
MAP_HAS_MAP_STORY = True
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = False
|
||||
MAP_HAS_MYSTERY = False
|
||||
# ===== End of generated config =====
|
||||
|
||||
MAP_SWIPE_MULTIPLY = 1.715
|
||||
MAP_SWIPE_MULTIPLY_MINITOUCH = 1.658
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_siren():
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_4(self):
|
||||
return self.clear_boss()
|
72
campaign/event_20211111_cn/sp2.py
Normal file
72
campaign/event_20211111_cn/sp2.py
Normal file
@ -0,0 +1,72 @@
|
||||
from .campaign_base import CampaignBase
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
from .sp1 import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('SP2')
|
||||
MAP.shape = 'I7'
|
||||
MAP.camera_data = ['D2', 'D5', 'F2', 'F5']
|
||||
MAP.camera_data_spawn_point = ['D5']
|
||||
MAP.map_data = """
|
||||
++ -- -- -- ME -- MB ++ ++
|
||||
ME -- MS -- -- -- ME MB ++
|
||||
-- -- ++ ++ ++ __ -- -- MB
|
||||
-- Me ++ MS -- Me -- ++ ++
|
||||
-- -- -- -- ME -- Me ME --
|
||||
ME -- ME ME ++ ME -- -- ME
|
||||
SP SP -- -- ++ ++ ME ME ME
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 3, 'siren': 2},
|
||||
{'battle': 1, 'enemy': 2},
|
||||
{'battle': 2, 'enemy': 1},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, I7, \
|
||||
= MAP.flatten()
|
||||
|
||||
|
||||
class Config(ConfigBase):
|
||||
# ===== Start of generated config =====
|
||||
MAP_SIREN_TEMPLATE = []
|
||||
# MOVABLE_ENEMY_TURN = (0,)
|
||||
MAP_HAS_SIREN = True
|
||||
# MAP_HAS_MOVABLE_ENEMY = True
|
||||
MAP_HAS_MAP_STORY = True
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = False
|
||||
MAP_HAS_MYSTERY = False
|
||||
# ===== End of generated config =====
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_siren():
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_4(self):
|
||||
return self.clear_boss()
|
76
campaign/event_20211111_cn/sp3.py
Normal file
76
campaign/event_20211111_cn/sp3.py
Normal file
@ -0,0 +1,76 @@
|
||||
from .campaign_base import CampaignBase
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
from .sp1 import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('SP3')
|
||||
MAP.shape = 'I8'
|
||||
MAP.camera_data = ['D3', 'D6', 'F3', 'F6']
|
||||
MAP.camera_data_spawn_point = ['F6']
|
||||
MAP.map_data = """
|
||||
++ ++ ++ ++ ME ME -- -- ME
|
||||
MB MB MB ++ -- -- -- ME --
|
||||
-- ME -- ME Me ++ MS -- ++
|
||||
ME MS -- __ ME -- ME -- ++
|
||||
++ ++ ++ -- -- ++ ++ -- ME
|
||||
ME ME MS Me -- ++ ++ ME --
|
||||
-- -- -- -- -- SP SP -- --
|
||||
Me ME ++ ME -- -- -- -- ME
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 3, 'siren': 2},
|
||||
{'battle': 1, 'enemy': 2, 'siren': 1},
|
||||
{'battle': 2, 'enemy': 1},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'enemy': 1},
|
||||
{'battle': 5, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, I7, \
|
||||
A8, B8, C8, D8, E8, F8, G8, H8, I8, \
|
||||
= MAP.flatten()
|
||||
|
||||
|
||||
class Config(ConfigBase):
|
||||
# ===== Start of generated config =====
|
||||
MAP_SIREN_TEMPLATE = []
|
||||
# MOVABLE_ENEMY_TURN = (0,)
|
||||
MAP_HAS_SIREN = True
|
||||
# MAP_HAS_MOVABLE_ENEMY = True
|
||||
MAP_HAS_MAP_STORY = True
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = False
|
||||
MAP_HAS_MYSTERY = False
|
||||
# ===== End of generated config =====
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_siren():
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_5(self):
|
||||
return self.fleet_boss.clear_boss()
|
@ -544,11 +544,11 @@ IS_WAR_ARCHIVES = False
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'
|
||||
|
||||
LOADER = LuaLoader(FILE, server='CN')
|
||||
DATA = LOADER.load('./sharecfg/chapter_template.lua')
|
||||
DATA_LOOP = LOADER.load('./sharecfg/chapter_template_loop.lua')
|
||||
MAP_EVENT_LIST = LOADER.load('./sharecfg/map_event_list.lua')
|
||||
MAP_EVENT_TEMPLATE = LOADER.load('./sharecfg/map_event_template.lua')
|
||||
EXPECTATION_DATA = LOADER.load('./sharecfgdata/sharecfg/expedition_data_template.lua')
|
||||
DATA = LOADER.load('./sharecfgdata/sharecfg/chapter_template.lua')
|
||||
DATA_LOOP = LOADER.load('./sharecfgdata/sharecfg/chapter_template_loop.lua')
|
||||
MAP_EVENT_LIST = LOADER.load('./sharecfgdata/sharecfg/map_event_list.lua')
|
||||
MAP_EVENT_TEMPLATE = LOADER.load('./sharecfgdata/sharecfg/map_event_template.lua')
|
||||
EXPECTATION_DATA = LOADER.load('./sharecfgdata/expedition_data_template.lua')
|
||||
|
||||
ct = ChapterTemplate()
|
||||
ct.extract(ct.get_chapter_by_name(KEYWORD, select=SELECT), folder=FOLDER)
|
||||
|
@ -68,11 +68,7 @@ class CampaignBase(CampaignUI, Map, AutoSearchCombat):
|
||||
|
||||
return self.battle_default()
|
||||
else:
|
||||
backup = self.config.FLEET_BOSS
|
||||
if self.config.FLEET_2 != 0:
|
||||
self.config.FLEET_BOSS = 2
|
||||
result = self.battle_boss()
|
||||
self.config.FLEET_BOSS = backup
|
||||
return result
|
||||
|
||||
@Config.when(MAP_CLEAR_ALL_THIS_TIME=False, POOR_MAP_DATA=False)
|
||||
|
@ -56,9 +56,9 @@ class CampaignRun(UI):
|
||||
files = [f[:-3] for f in os.listdir(folder) if f[-3:] == '.py']
|
||||
logger.warning(f'Existing files: {files}')
|
||||
|
||||
logger.critical('Please update Alas')
|
||||
logger.critical('If file is still missing after update, '
|
||||
'contact developers, or make map files yourself using dev_tools/map_extractor.py')
|
||||
logger.critical(f'Possible reason: This event ({folder}) does not have {name}')
|
||||
logger.critical(f'Possible reason: You are using an old Alas, '
|
||||
'please check for update, or make map files yourself using dev_tools/map_extractor.py')
|
||||
raise RequestHumanTakeover
|
||||
|
||||
config = copy.copy(self.config).merge(self.module.Config())
|
||||
|
@ -555,6 +555,7 @@
|
||||
"type": "select",
|
||||
"value": "campaign_main",
|
||||
"option": [
|
||||
"event_20211111_cn",
|
||||
"event_20211028_tw",
|
||||
"event_20211028_cn",
|
||||
"event_20201012_cn",
|
||||
@ -594,10 +595,10 @@
|
||||
"event_20200326_cn",
|
||||
"event_20200227_cn"
|
||||
],
|
||||
"tw": "event_20211028_tw",
|
||||
"cn": "event_20211028_cn",
|
||||
"en": "event_20211028_cn",
|
||||
"jp": "event_20211028_cn"
|
||||
"cn": "event_20211111_cn",
|
||||
"en": "event_20211111_cn",
|
||||
"jp": "event_20211111_cn",
|
||||
"tw": "event_20211028_tw"
|
||||
},
|
||||
"Mode": {
|
||||
"type": "disable",
|
||||
@ -2521,6 +2522,7 @@
|
||||
"value": "campaign_main",
|
||||
"option": [
|
||||
"campaign_main",
|
||||
"event_20211111_cn",
|
||||
"event_20211028_tw",
|
||||
"event_20211028_cn",
|
||||
"event_20201012_cn",
|
||||
@ -2560,10 +2562,10 @@
|
||||
"event_20200326_cn",
|
||||
"event_20200227_cn"
|
||||
],
|
||||
"tw": "event_20211028_tw",
|
||||
"cn": "event_20211028_cn",
|
||||
"en": "event_20211028_cn",
|
||||
"jp": "event_20211028_cn"
|
||||
"cn": "event_20211111_cn",
|
||||
"en": "event_20211111_cn",
|
||||
"jp": "event_20211111_cn",
|
||||
"tw": "event_20211028_tw"
|
||||
},
|
||||
"Mode": {
|
||||
"type": "disable",
|
||||
@ -4114,6 +4116,7 @@
|
||||
"type": "select",
|
||||
"value": "campaign_main",
|
||||
"option": [
|
||||
"event_20211111_cn",
|
||||
"event_20211028_tw",
|
||||
"event_20211028_cn",
|
||||
"event_20201012_cn",
|
||||
@ -4153,10 +4156,10 @@
|
||||
"event_20200326_cn",
|
||||
"event_20200227_cn"
|
||||
],
|
||||
"tw": "event_20211028_tw",
|
||||
"cn": "event_20211028_cn",
|
||||
"en": "event_20211028_cn",
|
||||
"jp": "event_20211028_cn"
|
||||
"cn": "event_20211111_cn",
|
||||
"en": "event_20211111_cn",
|
||||
"jp": "event_20211111_cn",
|
||||
"tw": "event_20211028_tw"
|
||||
},
|
||||
"Mode": {
|
||||
"type": "disable",
|
||||
@ -4506,6 +4509,7 @@
|
||||
"type": "select",
|
||||
"value": "campaign_main",
|
||||
"option": [
|
||||
"event_20211111_cn",
|
||||
"event_20211028_tw",
|
||||
"event_20211028_cn",
|
||||
"event_20201012_cn",
|
||||
@ -4545,10 +4549,10 @@
|
||||
"event_20200326_cn",
|
||||
"event_20200227_cn"
|
||||
],
|
||||
"tw": "event_20211028_tw",
|
||||
"cn": "event_20211028_cn",
|
||||
"en": "event_20211028_cn",
|
||||
"jp": "event_20211028_cn"
|
||||
"cn": "event_20211111_cn",
|
||||
"en": "event_20211111_cn",
|
||||
"jp": "event_20211111_cn",
|
||||
"tw": "event_20211028_tw"
|
||||
},
|
||||
"Mode": {
|
||||
"type": "disable",
|
||||
@ -4888,6 +4892,7 @@
|
||||
"type": "select",
|
||||
"value": "campaign_main",
|
||||
"option": [
|
||||
"event_20211111_cn",
|
||||
"event_20211028_tw",
|
||||
"event_20211028_cn",
|
||||
"event_20201012_cn",
|
||||
@ -4927,10 +4932,10 @@
|
||||
"event_20200326_cn",
|
||||
"event_20200227_cn"
|
||||
],
|
||||
"tw": "event_20211028_tw",
|
||||
"cn": "event_20211028_cn",
|
||||
"en": "event_20211028_cn",
|
||||
"jp": "event_20211028_cn"
|
||||
"cn": "event_20211111_cn",
|
||||
"en": "event_20211111_cn",
|
||||
"jp": "event_20211111_cn",
|
||||
"tw": "event_20211028_tw"
|
||||
},
|
||||
"Mode": {
|
||||
"type": "disable",
|
||||
|
@ -399,6 +399,7 @@
|
||||
"name": "Event Name",
|
||||
"help": "Automatically selects to the latest event",
|
||||
"campaign_main": "campaign_main",
|
||||
"event_20211111_cn": "The Flame-Touched Dagger",
|
||||
"event_20211028_tw": "復刻光與影的鳶尾之華",
|
||||
"event_20211028_cn": "Skybound Oratorio Rerun",
|
||||
"raid_20210708": "Cross Wave rerun",
|
||||
|
@ -399,6 +399,7 @@
|
||||
"name": "Campaign.Event.name",
|
||||
"help": "Campaign.Event.help",
|
||||
"campaign_main": "campaign_main",
|
||||
"event_20211111_cn": "燈火のシニエ",
|
||||
"event_20211028_tw": "復刻光與影的鳶尾之華",
|
||||
"event_20211028_cn": "神穹を衝く聖歌(復刻)",
|
||||
"raid_20210708": "交錯する新たな波 (復刻)",
|
||||
|
@ -399,6 +399,7 @@
|
||||
"name": "活动名称",
|
||||
"help": "自动选择至最新的活动",
|
||||
"campaign_main": "主线图",
|
||||
"event_20211111_cn": "杰诺瓦的焰火",
|
||||
"event_20211028_tw": "復刻光與影的鳶尾之華",
|
||||
"event_20211028_cn": "复刻穹顶下的圣咏曲",
|
||||
"raid_20210708": "复刻穿越彼方的水线",
|
||||
|
@ -399,6 +399,7 @@
|
||||
"name": "活動名稱",
|
||||
"help": "自動選擇至最新的活動圖",
|
||||
"campaign_main": "主線圖",
|
||||
"event_20211111_cn": "The Flame-Touched Dagger",
|
||||
"event_20211028_tw": "復刻光與影的鳶尾之華",
|
||||
"event_20211028_cn": "Skybound Oratorio Rerun",
|
||||
"raid_20210708": "穿越彼方的水線",
|
||||
|
@ -17,6 +17,7 @@ class Camera(MapOperation):
|
||||
view: View
|
||||
map: CampaignMap
|
||||
camera = (0, 0)
|
||||
grid_class = Grid
|
||||
_correct_camera = False
|
||||
_prev_view = None
|
||||
_prev_swipe = None
|
||||
@ -85,7 +86,7 @@ class Camera(MapOperation):
|
||||
|
||||
def _view_init(self):
|
||||
if not hasattr(self, 'view'):
|
||||
self.view = View(self.config)
|
||||
self.view = View(self.config, grid_class=self.grid_class)
|
||||
|
||||
def update(self, camera=True):
|
||||
"""Update map image
|
||||
|
@ -7,7 +7,6 @@ from module.logger import logger
|
||||
from module.map.map_grids import SelectedGrids
|
||||
from module.map_detection.detector import MapDetector
|
||||
from module.map_detection.grid import Grid
|
||||
from module.map_detection.os_grid import OSGrid
|
||||
from module.map_detection.utils import *
|
||||
from module.map_detection.utils_assets import *
|
||||
|
||||
@ -19,14 +18,16 @@ class View(MapDetector):
|
||||
center_offset: np.ndarray
|
||||
swipe_base: np.ndarray
|
||||
|
||||
def __init__(self, config, mode='main'):
|
||||
def __init__(self, config, mode='main', grid_class=Grid):
|
||||
"""
|
||||
Args:
|
||||
config (AzurLaneConfig):
|
||||
mode (str): 'main' for normal azur lane maps, 'os' for operation siren
|
||||
grid_class:
|
||||
"""
|
||||
super().__init__(config)
|
||||
self.mode = mode
|
||||
self.grid_class = grid_class
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.grids.values())
|
||||
@ -59,10 +60,10 @@ class View(MapDetector):
|
||||
|
||||
# Create local view map
|
||||
grids = {}
|
||||
grid_class = OSGrid if self.mode == 'os' else Grid
|
||||
|
||||
for loca, points in self.generate():
|
||||
if area_in_area(area1=corner2area(points), area2=self.config.DETECTING_AREA):
|
||||
grids[loca] = grid_class(location=loca, image=image, corner=points, config=self.config)
|
||||
grids[loca] = self.grid_class(location=loca, image=image, corner=points, config=self.config)
|
||||
|
||||
# Handle grids offset
|
||||
offset = np.min(list(grids.keys()), axis=0)
|
||||
|
@ -6,6 +6,7 @@ from module.exception import MapDetectionError
|
||||
from module.logger import logger
|
||||
from module.map.camera import Camera
|
||||
from module.map.map_base import location_ensure, location2node
|
||||
from module.map_detection.os_grid import OSGrid
|
||||
from module.map_detection.view import View
|
||||
from module.os.map_operation import OSMapOperation
|
||||
from module.os.radar import Radar
|
||||
@ -21,7 +22,7 @@ class OSCamera(OSMapOperation, Camera):
|
||||
def _view_init(self):
|
||||
if not hasattr(self, 'view'):
|
||||
storage = ((10, 7), [(110.307, 103.657), (1012.311, 103.657), (-32.959, 600.567), (1113.057, 600.567)])
|
||||
view = View(self.config, mode='os')
|
||||
view = View(self.config, mode='os', grid_class=OSGrid)
|
||||
view.detector_set_backend('homography')
|
||||
view.backend.load_homography(storage=storage)
|
||||
self.view = view
|
||||
|
Loading…
Reference in New Issue
Block a user