Get list of damage dealer mods with ammo data
This commit is contained in:
@@ -26,6 +26,8 @@ from eos.utils.spoolSupport import SpoolType, SpoolOptions, calculateSpoolup, re
|
||||
|
||||
class BaseEffect:
|
||||
|
||||
dealsDamage = False
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, module, context, projectionRange, **kwargs):
|
||||
pass
|
||||
@@ -62,6 +64,7 @@ class Effect10(BaseEffect):
|
||||
Modules from group: Energy Weapon (212 of 214)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -169,6 +172,7 @@ class Effect34(BaseEffect):
|
||||
Modules from group: Projectile Weapon (165 of 165)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -189,6 +193,7 @@ class Effect38(BaseEffect):
|
||||
Modules from group: Smart Bomb (118 of 118)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
|
||||
@@ -544,6 +549,7 @@ class Effect101(BaseEffect):
|
||||
Structure Modules named like: Standup Launcher (7 of 7)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active', 'projected'
|
||||
|
||||
@staticmethod
|
||||
@@ -15094,6 +15100,7 @@ class Effect4489(BaseEffect):
|
||||
Module: 'Judgment' Electromagnetic Doomsday
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -15110,6 +15117,7 @@ class Effect4490(BaseEffect):
|
||||
Module: 'Oblivion' Kinetic Doomsday
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -15126,6 +15134,7 @@ class Effect4491(BaseEffect):
|
||||
Module: 'Aurora Ominae' Thermal Doomsday
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -15142,6 +15151,7 @@ class Effect4492(BaseEffect):
|
||||
Module: 'Gjallarhorn' Explosive Doomsday
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -27333,6 +27343,7 @@ class Effect6431(BaseEffect):
|
||||
Fighters from group: Light Fighter (32 of 32)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
displayName = 'Missile Attack'
|
||||
hasCharges = True
|
||||
prefix = 'fighterAbilityMissiles'
|
||||
@@ -27593,6 +27604,7 @@ class Effect6465(BaseEffect):
|
||||
Fighters from group: Heavy Fighter (34 of 34)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
displayName = 'Turret Attack'
|
||||
prefix = 'fighterAbilityAttackMissile'
|
||||
type = 'active'
|
||||
@@ -27635,6 +27647,7 @@ class Effect6472(BaseEffect):
|
||||
Modules named like: Lance (4 of 4)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -27651,6 +27664,7 @@ class Effect6473(BaseEffect):
|
||||
Module: Bosonic Field Generator
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
@@ -27861,6 +27875,7 @@ class Effect6485(BaseEffect):
|
||||
Fighters from group: Heavy Fighter (16 of 34)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
displayName = 'Bomb'
|
||||
hasCharges = True
|
||||
prefix = 'fighterAbilityLaunchBomb'
|
||||
@@ -33925,6 +33940,7 @@ class Effect6995(BaseEffect):
|
||||
Modules from group: Precursor Weapon (18 of 18)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
type = 'active'
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -145,6 +145,12 @@ class Effect(EqBase):
|
||||
|
||||
return self.__effectDef is not None
|
||||
|
||||
@property
|
||||
def dealsDamage(self):
|
||||
if not self.__generated:
|
||||
self.__generateHandler()
|
||||
return self.__dealsDamage
|
||||
|
||||
def isType(self, type):
|
||||
"""
|
||||
Check if this effect is of the passed type
|
||||
@@ -166,6 +172,7 @@ class Effect(EqBase):
|
||||
self.__handler = getattr(effectDef, "handler", eos.effects.BaseEffect.handler)
|
||||
self.__runTime = getattr(effectDef, "runTime", "normal")
|
||||
self.__activeByDefault = getattr(effectDef, "activeByDefault", True)
|
||||
self.__dealsDamage = effectDef.dealsDamage
|
||||
effectType = getattr(effectDef, "type", None)
|
||||
effectType = effectType if isinstance(effectType, tuple) or effectType is None else (effectType,)
|
||||
self.__type = effectType
|
||||
@@ -174,6 +181,7 @@ class Effect(EqBase):
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__dealsDamage = False
|
||||
self.__type = None
|
||||
pyfalog.debug("ImportError generating handler: {0}", e)
|
||||
except AttributeError as e:
|
||||
@@ -181,12 +189,14 @@ class Effect(EqBase):
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__dealsDamage = False
|
||||
self.__type = None
|
||||
pyfalog.error("AttributeError generating handler: {0}", e)
|
||||
except Exception as e:
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__dealsDamage = False
|
||||
self.__type = None
|
||||
pyfalog.critical("Exception generating handler:")
|
||||
pyfalog.critical(e)
|
||||
|
||||
@@ -429,6 +429,20 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return True
|
||||
return False
|
||||
|
||||
def canDealDamage(self, ignoreState=False):
|
||||
if self.isEmpty:
|
||||
return False
|
||||
for effect in self.item.effects.values():
|
||||
if effect.dealsDamage and (
|
||||
ignoreState or
|
||||
effect.isType('offline') or
|
||||
(effect.isType('passive') and self.state >= FittingModuleState.ONLINE) or
|
||||
(effect.isType('active') and self.state >= FittingModuleState.ACTIVE) or
|
||||
(effect.isType('overheat') and self.state >= FittingModuleState.OVERHEATED)
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
def getVolleyParameters(self, spoolOptions=None, targetProfile=None, ignoreState=False):
|
||||
if self.isEmpty or (self.state < FittingModuleState.ACTIVE and not ignoreState):
|
||||
return {0: DmgTypes(0, 0, 0, 0)}
|
||||
|
||||
@@ -3,6 +3,7 @@ import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenuSingle
|
||||
from service.market import Market
|
||||
|
||||
|
||||
class GraphFitAmmoPicker(ContextMenuSingle):
|
||||
@@ -23,7 +24,7 @@ class GraphFitAmmoPicker(ContextMenuSingle):
|
||||
return 'Plot with Different Ammo...'
|
||||
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
with AmmoPicker(self.mainFrame) as dlg:
|
||||
with AmmoPicker(self.mainFrame, mainItem.item) as dlg:
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
pass
|
||||
else:
|
||||
@@ -35,6 +36,32 @@ GraphFitAmmoPicker.register()
|
||||
|
||||
class AmmoPicker(wx.Dialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, fit):
|
||||
super().__init__(parent, title='Choose Different Ammo', style=wx.DEFAULT_DIALOG_STYLE)
|
||||
|
||||
mods = self.getMods(fit)
|
||||
|
||||
self.SetMinSize((346, 156))
|
||||
|
||||
|
||||
|
||||
def getMods(self, fit):
|
||||
sMkt = Market.getInstance()
|
||||
loadableCharges = {}
|
||||
# Modules, Format: {frozenset(ammo): [module list]}
|
||||
mods = {}
|
||||
if fit is not None:
|
||||
for mod in fit.modules:
|
||||
if not mod.canDealDamage():
|
||||
continue
|
||||
typeID = mod.item.ID
|
||||
if typeID in loadableCharges:
|
||||
charges = loadableCharges[typeID]
|
||||
else:
|
||||
charges = loadableCharges.setdefault(typeID, set())
|
||||
for charge in mod.getValidCharges():
|
||||
if sMkt.getPublicityByItem(charge):
|
||||
charges.add(charge)
|
||||
if charges:
|
||||
mods.setdefault(frozenset(charges), []).append(mod)
|
||||
return mods
|
||||
|
||||
Reference in New Issue
Block a user