diff --git a/core/log_watcher.py b/core/log_watcher.py index 432ad3c..c89e3ee 100644 --- a/core/log_watcher.py +++ b/core/log_watcher.py @@ -154,12 +154,19 @@ class LogWatcher: # WEAPON TIER/LEVEL UP # Swedish: "Din Piron PBP-17 (L) har nått nivå 0.38" + # English: "Your Piron PBP-17 (L) has reached tier 2.68" PATTERN_WEAPON_TIER_SV = re.compile( - r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+' + r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+\[?\]?\s*' r'Din\s+([\w\s\-()]+?)\s+har\s+nått\s+nivå\s+(\d+(?:\.\d+)?)', re.IGNORECASE ) + PATTERN_WEAPON_TIER_EN = re.compile( + r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+\[?\]?\s*' + r'Your\s+([\w\s\-()]+?)\s+has\s+reached\s+tier\s+(\d+(?:\.\d+)?)', + re.IGNORECASE + ) + # COMBAT EVADE/DODGE/MISS # English: "You Evaded", "The target Evaded your attack", "The attack missed you" PATTERN_EVADE = re.compile( @@ -440,7 +447,7 @@ class LogWatcher: data={'heal_amount': Decimal(match.group(2))} ) - # WEAPON TIER/LEVEL + # WEAPON TIER/LEVEL - Swedish match = self.PATTERN_WEAPON_TIER_SV.match(line) if match: return LogEvent( @@ -449,7 +456,22 @@ class LogWatcher: raw_line=line, data={ 'weapon_name': match.group(2).strip(), - 'new_tier': Decimal(match.group(3)) + 'new_tier': Decimal(match.group(3)), + 'language': 'swedish' + } + ) + + # WEAPON TIER/LEVEL - English + match = self.PATTERN_WEAPON_TIER_EN.match(line) + if match: + return LogEvent( + timestamp=self._parse_timestamp(match.group(1)), + event_type='weapon_tier', + raw_line=line, + data={ + 'weapon_name': match.group(2).strip(), + 'new_tier': Decimal(match.group(3)), + 'language': 'english' } ) diff --git a/main.py b/main.py index 3b1b59b..8f47678 100644 --- a/main.py +++ b/main.py @@ -207,7 +207,7 @@ class LemontropiaApp: logger.info(f"Using REAL log: {log_path}") # Stats tracking - stats = {'loot': 0, 'globals': 0, 'hofs': 0, 'skills': 0, 'level_ups': 0, 'damage_dealt': 0, 'damage_taken': 0, 'evades': 0, 'total_ped': Decimal('0.0')} + stats = {'loot': 0, 'globals': 0, 'hofs': 0, 'skills': 0, 'level_ups': 0, 'weapon_tiers': 0, 'damage_dealt': 0, 'damage_taken': 0, 'evades': 0, 'total_ped': Decimal('0.0')} def on_event(event): """Handle log events.""" @@ -240,6 +240,10 @@ class LemontropiaApp: stats['level_ups'] += 1 print(f" 🎉 LEVEL UP: {event.data.get('skill_name')} reached level {event.data.get('new_level')}!") + elif event.event_type == 'weapon_tier': + stats['weapon_tiers'] += 1 + print(f" ⬆️ TIER UP: {event.data.get('weapon_name')} reached tier {event.data.get('new_tier')}!") + elif event.event_type == 'damage_dealt': stats['damage_dealt'] += 1 print(f" 💥 Damage Dealt: {event.data.get('damage')} pts") @@ -258,6 +262,7 @@ class LemontropiaApp: self.watcher.subscribe('hof', on_event) self.watcher.subscribe('skill', on_event) self.watcher.subscribe('level_up', on_event) + self.watcher.subscribe('weapon_tier', on_event) self.watcher.subscribe('damage_dealt', on_event) self.watcher.subscribe('damage_taken', on_event) self.watcher.subscribe('evade', on_event) @@ -292,6 +297,7 @@ class LemontropiaApp: print(f" HoFs: {stats['hofs']}") print(f" Skills: {stats['skills']}") print(f" Level Ups: {stats['level_ups']}") + print(f" Weapon Tiers: {stats['weapon_tiers']}") print(f" Damage Dealt: {stats['damage_dealt']}") print(f" Damage Taken: {stats['damage_taken']}") print(f" Evades/Misses: {stats['evades']}")