""" EU-Utility - Enhancer Calculator Plugin Calculate enhancer break rates and costs. """ from PyQt6.QtWidgets import ( QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QComboBox, QFrame ) from PyQt6.QtCore import Qt from plugins.base_plugin import BasePlugin class EnhancerCalculatorPlugin(BasePlugin): """Calculate enhancer usage and costs.""" name = "Enhancer Calc" version = "1.0.0" author = "ImpulsiveFPS" description = "Calculate enhancer break rates and costs" hotkey = "ctrl+shift+e" # Break rates (approximate) BREAK_RATES = { 'Accuracy': 0.0012, # 0.12% 'Damage': 0.0015, # 0.15% 'Economy': 0.0010, # 0.10% 'Range': 0.0013, # 0.13% } def initialize(self): """Setup enhancer calculator.""" self.saved_calculations = [] def get_ui(self): """Create enhancer calculator UI.""" widget = QWidget() widget.setStyleSheet("background: transparent;") layout = QVBoxLayout(widget) layout.setSpacing(15) layout.setContentsMargins(0, 0, 0, 0) # Title title = QLabel(" Enhancer Calculator") title.setStyleSheet("color: white; font-size: 16px; font-weight: bold;") layout.addWidget(title) # Calculator calc_frame = QFrame() calc_frame.setStyleSheet(""" QFrame { background-color: rgba(30, 35, 45, 200); border: 1px solid rgba(100, 110, 130, 80); border-radius: 6px; } """) calc_layout = QVBoxLayout(calc_frame) calc_layout.setSpacing(10) # Enhancer type type_layout = QHBoxLayout() type_layout.addWidget(QLabel("Type:")) self.type_combo = QComboBox() self.type_combo.addItems(list(self.BREAK_RATES.keys())) self.type_combo.setStyleSheet(""" QComboBox { background-color: rgba(20, 25, 35, 200); color: white; border: 1px solid rgba(100, 110, 130, 80); padding: 5px; } """) type_layout.addWidget(self.type_combo) calc_layout.addLayout(type_layout) # TT value tt_layout = QHBoxLayout() tt_layout.addWidget(QLabel("TT Value:")) self.tt_input = QLineEdit() self.tt_input.setPlaceholderText("e.g., 40.00") tt_layout.addWidget(self.tt_input) calc_layout.addLayout(tt_layout) # Number of shots shots_layout = QHBoxLayout() shots_layout.addWidget(QLabel("Shots/hour:")) self.shots_input = QLineEdit() self.shots_input.setPlaceholderText("e.g., 3600") self.shots_input.setText("3600") shots_layout.addWidget(self.shots_input) calc_layout.addLayout(shots_layout) # Calculate button calc_btn = QPushButton("Calculate") calc_btn.setStyleSheet(""" QPushButton { background-color: #ff8c42; color: white; padding: 10px; border: none; border-radius: 4px; font-weight: bold; } """) calc_btn.clicked.connect(self._calculate) calc_layout.addWidget(calc_btn) # Results self.break_rate_label = QLabel("Break rate: -") self.break_rate_label.setStyleSheet("color: rgba(255,255,255,180);") calc_layout.addWidget(self.break_rate_label) self.breaks_label = QLabel("Expected breaks/hour: -") self.breaks_label.setStyleSheet("color: #f44336;") calc_layout.addWidget(self.breaks_label) self.cost_label = QLabel("Cost/hour: -") self.cost_label.setStyleSheet("color: #ffc107;") calc_layout.addWidget(self.cost_label) layout.addWidget(calc_frame) # Info info = QLabel(""" Typical break rates: • Damage: ~0.15% per shot • Accuracy: ~0.12% per shot • Economy: ~0.10% per shot • Range: ~0.13% per shot """) info.setStyleSheet("color: rgba(255,255,255,120); font-size: 10px;") info.setWordWrap(True) layout.addWidget(info) layout.addStretch() return widget def _calculate(self): """Calculate enhancer costs.""" try: enhancer_type = self.type_combo.currentText() tt_value = float(self.tt_input.text() or 0) shots = int(self.shots_input.text() or 3600) break_rate = self.BREAK_RATES.get(enhancer_type, 0.001) # Expected breaks expected_breaks = shots * break_rate # Cost hourly_cost = expected_breaks * tt_value self.break_rate_label.setText(f"Break rate: {break_rate*100:.3f}% per shot") self.breaks_label.setText(f"Expected breaks/hour: {expected_breaks:.2f}") self.cost_label.setText(f"Cost/hour: {hourly_cost:.2f} PED") except Exception as e: self.break_rate_label.setText(f"Error: {e}")