From 47cec0af3681e900ca625a13f8aa532f2f2bbdf8 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Sat, 25 Apr 2020 18:04:05 +0800 Subject: [PATCH] =?UTF-8?q?Optimize:=20=E4=BC=98=E5=8C=96log,=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=B2=BE=E8=8B=B1=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 缩短log, 尽量在GUI上显示为一行 - 只有在开荒或地图信息缺失的时候, 将未检测到星级的敌人当成精英 --- module/map/camera.py | 10 ++++++---- module/map/map.py | 14 +++++++++----- module/map/map_base.py | 6 ++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/module/map/camera.py b/module/map/camera.py index f0ffd30df..63f88f539 100644 --- a/module/map/camera.py +++ b/module/map/camera.py @@ -303,13 +303,15 @@ class Camera(InfoBarHandler): location = location_ensure(location) grid = np.array(location) - self.camera + self.grids.center_grid - logger.info('Convert_map_to_grid. Map: %s, Camera: %s, grids_center: %s, grid: %s' % ( - location2node(location), str(self.camera), str(self.grids.center_grid), str(grid))) + logger.info('Convert_map_to_grid') + logger.info(f'Map: {location2node(location)}, ' + f'Camera: {location2node(self.camera)}, ' + f'Center: {location2node(self.grids.center_grid)}, ' + f'grid: {location2node(grid)}') if grid in self.grids: return self.grids[grid] else: - logger.warning('Convert_map_to_grid Failed. Map: %s, Camera: %s, grids_center: %s, grid: %s' % ( - location2node(location), str(self.camera), str(self.grids.center_grid), str(grid))) + logger.warning('Convert_map_to_grid Failed.') self.grids.save_error_image() self.focus_to(location) grid = np.array(location) - self.camera + self.grids.center_grid diff --git a/module/map/map.py b/module/map/map.py index 1803d940c..9bc197e3a 100644 --- a/module/map/map.py +++ b/module/map/map.py @@ -304,15 +304,19 @@ class Map(Fleet): if not self.config.MAP_HAS_SIREN: return False - grids = self.map.select(may_siren=True, is_enemy=True) - grids = grids.add(self.map.select(is_siren=True)) - grids = grids.add(self.map.select(is_enemy=True, enemy_scale=0)) - grids = grids.delete(self.map.select(is_boss=True)) logger.info('May siren: %s' % self.map.select(may_siren=True)) logger.info('May siren and is enemy: %s' % self.map.select(may_siren=True, is_enemy=True)) + grids = self.map.select(may_siren=True, is_enemy=True) + logger.info('Is siren: %s' % self.map.select(is_siren=True)) - logger.info('Is 0 scale enemy: %s' % self.map.select(is_enemy=True, enemy_scale=0)) + grids = grids.add(self.map.select(is_siren=True)) + + if self.config.POOR_MAP_DATA or not self.is_map_green: + logger.info('Is 0 scale enemy: %s' % self.map.select(is_enemy=True, enemy_scale=0)) + grids = grids.add(self.map.select(is_enemy=True, enemy_scale=0)) + logger.info('Delete is boss: %s' % self.map.select(is_boss=True)) + grids = grids.delete(self.map.select(is_boss=True)) grids = self.select_grids(grids, **kwargs) diff --git a/module/map/map_base.py b/module/map/map_base.py index 2f8320593..a4b79ae1f 100644 --- a/module/map/map_base.py +++ b/module/map/map_base.py @@ -368,8 +368,10 @@ class CampaignMap: if upper.may_carrier: may['carrier'] += 1 - logger.info('missing: %s' % missing) - logger.info('may: %s' % may) + logger.attr('enemy_missing', + ', '.join([f'{k[:2].upper()}:{str(v).rjust(2)}' for k, v in missing.items() if k != 'battle'])) + logger.attr('enemy_may____', + ', '.join([f'{k[:2].upper()}:{str(v).rjust(2)}' for k, v in may.items()])) return may, missing def missing_is_none(self, battle_count, mystery_count=0, siren_count=0, carrier_count=0):