feat(enhancer): add broken enhancer tracking
- Add pattern for broken enhancers: 'Your enhancer X on your Y broke'
- Track enhancer breaks with type and weapon info
- Display 💔 ENHANCER BROKEN notifications
- Include enhancers_broken in session summary
Based on user-provided reference code but with cleaner regex pattern.
This commit is contained in:
parent
f957165394
commit
06a95f56f4
|
|
@ -190,9 +190,19 @@ class LogWatcher:
|
|||
)
|
||||
|
||||
# DECAY (when weapon durability decreases)
|
||||
# English: "Your Omegaton M2100 has decayed 15 PEC"
|
||||
# Swedish: "Din Piron PBP-17 (L) har nått minimalt skick"
|
||||
PATTERN_DECAY = re.compile(
|
||||
r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+'
|
||||
r'(?:Your|Din)\s+([\w\s]+?)\s+(?:has\s+decayed|har\s+nått\s+minimalt\s+skick)',
|
||||
r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+\[?\]?\s*'
|
||||
r'(?:Your|Din)\s+([\w\s\-()]+?)\s+(?:has\s+decayed|har\s+nått\s+minimalt\s+skick)',
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
# BROKEN ENHANCERS
|
||||
# English: "Your enhancer Weapon Damage Enhancer 1 on your Piron PBP-17 (L) broke"
|
||||
PATTERN_ENHANCER_BROKEN = re.compile(
|
||||
r'^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[System\]\s+\[?\]?\s*'
|
||||
r'Your\s+enhancer\s+([\w\s]+?)\s+on\s+your\s+([\w\s\-()]+?)\s+broke',
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
|
|
@ -239,6 +249,7 @@ class LogWatcher:
|
|||
'weapon_tier_en': PATTERN_WEAPON_TIER_EN,
|
||||
'evade': PATTERN_EVADE,
|
||||
'decay': PATTERN_DECAY,
|
||||
'enhancer_broken': PATTERN_ENHANCER_BROKEN,
|
||||
'ped_transfer': PATTERN_PED_TRANSFER,
|
||||
'attribute_sv': PATTERN_ATTRIBUTE_SV,
|
||||
'attribute_en': PATTERN_ATTRIBUTE_EN,
|
||||
|
|
@ -540,6 +551,19 @@ class LogWatcher:
|
|||
data={'item': match.group(2).strip()}
|
||||
)
|
||||
|
||||
# BROKEN ENHANCER
|
||||
match = self.PATTERN_ENHANCER_BROKEN.match(line)
|
||||
if match:
|
||||
return LogEvent(
|
||||
timestamp=self._parse_timestamp(match.group(1)),
|
||||
event_type='enhancer_broken',
|
||||
raw_line=line,
|
||||
data={
|
||||
'enhancer_type': match.group(2).strip(),
|
||||
'weapon': match.group(3).strip()
|
||||
}
|
||||
)
|
||||
|
||||
# ATTRIBUTE GAIN - Swedish
|
||||
match = self.PATTERN_ATTRIBUTE_SV.match(line)
|
||||
if match:
|
||||
|
|
|
|||
8
main.py
8
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, 'weapon_tiers': 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, 'enhancers_broken': 0, 'damage_dealt': 0, 'damage_taken': 0, 'evades': 0, 'total_ped': Decimal('0.0')}
|
||||
|
||||
def on_event(event):
|
||||
"""Handle log events."""
|
||||
|
|
@ -248,6 +248,10 @@ class LemontropiaApp:
|
|||
stats['weapon_tiers'] += 1
|
||||
print(f" ⬆️ TIER UP: {event.data.get('weapon_name')} reached tier {event.data.get('new_tier')}!")
|
||||
|
||||
elif event.event_type == 'enhancer_broken':
|
||||
stats['enhancers_broken'] += 1
|
||||
print(f" 💔 ENHANCER BROKEN: {event.data.get('enhancer_type')} on {event.data.get('weapon')}!")
|
||||
|
||||
elif event.event_type == 'damage_dealt':
|
||||
stats['damage_dealt'] += 1
|
||||
print(f" 💥 Damage Dealt: {event.data.get('damage')} pts")
|
||||
|
|
@ -271,6 +275,7 @@ class LemontropiaApp:
|
|||
self.watcher.subscribe('skill', on_event)
|
||||
self.watcher.subscribe('level_up', on_event)
|
||||
self.watcher.subscribe('weapon_tier', on_event)
|
||||
self.watcher.subscribe('enhancer_broken', on_event)
|
||||
self.watcher.subscribe('damage_dealt', on_event)
|
||||
self.watcher.subscribe('critical_hit', on_event)
|
||||
self.watcher.subscribe('damage_taken', on_event)
|
||||
|
|
@ -307,6 +312,7 @@ class LemontropiaApp:
|
|||
print(f" Skills: {stats['skills']}")
|
||||
print(f" Level Ups: {stats['level_ups']}")
|
||||
print(f" Weapon Tiers: {stats['weapon_tiers']}")
|
||||
print(f" Enhancers Broken: {stats['enhancers_broken']}")
|
||||
print(f" Damage Dealt: {stats['damage_dealt']}")
|
||||
print(f" Damage Taken: {stats['damage_taken']}")
|
||||
print(f" Evades/Misses: {stats['evades']}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue