Adding descriptions to enums.
Renaming Enums into more useful names.
This commit is contained in:
@@ -129,7 +129,7 @@ def Saveddata():
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.character import Character
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.booster import Booster
|
||||
|
||||
@@ -139,7 +139,7 @@ def Saveddata():
|
||||
'Fit' : Fit,
|
||||
'Character': Character,
|
||||
'Module' : Module,
|
||||
'State' : State,
|
||||
'State' : FittingModuleState,
|
||||
'Booster' : Booster,
|
||||
}
|
||||
return helper
|
||||
|
||||
12
config.py
12
config.py
@@ -6,7 +6,7 @@ import wx
|
||||
from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \
|
||||
StreamHandler, TimedRotatingFileHandler, WARNING
|
||||
import hashlib
|
||||
from eos.const import Slot
|
||||
from eos.const import FittingSlot
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
@@ -50,11 +50,11 @@ LOGLEVEL_MAP = {
|
||||
}
|
||||
|
||||
slotColourMap = {
|
||||
Slot.LOW: wx.Colour(250, 235, 204), # yellow = low slots
|
||||
Slot.MED: wx.Colour(188, 215, 241), # blue = mid slots
|
||||
Slot.HIGH: wx.Colour(235, 204, 209), # red = high slots
|
||||
Slot.RIG: '',
|
||||
Slot.SUBSYSTEM: ''
|
||||
FittingSlot.LOW: wx.Colour(250, 235, 204), # yellow = low slots
|
||||
FittingSlot.MED: wx.Colour(188, 215, 241), # blue = mid slots
|
||||
FittingSlot.HIGH: wx.Colour(235, 204, 209), # red = high slots
|
||||
FittingSlot.RIG: '',
|
||||
FittingSlot.SUBSYSTEM: ''
|
||||
}
|
||||
|
||||
def getClientSecret():
|
||||
|
||||
74
eos/const.py
74
eos/const.py
@@ -1,8 +1,29 @@
|
||||
# =============================================================================
|
||||
# Copyright (C) 2019 Ryan Holmes
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
from eos.enum import Enum
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class Slot(Enum):
|
||||
class FittingSlot(Enum):
|
||||
"""
|
||||
Contains slots for ship fittings
|
||||
"""
|
||||
# These are self-explanatory
|
||||
LOW = 1
|
||||
MED = 2
|
||||
@@ -25,54 +46,81 @@ class Slot(Enum):
|
||||
FS_SUPPORT = 14
|
||||
FS_HEAVY = 15
|
||||
|
||||
|
||||
class ImplantLocation(Enum):
|
||||
"""
|
||||
Contains location of the implant
|
||||
"""
|
||||
FIT = 0
|
||||
CHARACTER = 1
|
||||
|
||||
|
||||
class CalcType(Enum):
|
||||
"""
|
||||
Contains location of the calculation
|
||||
"""
|
||||
LOCAL = 0
|
||||
PROJECTED = 1
|
||||
COMMAND = 2
|
||||
|
||||
class State(Enum):
|
||||
class FittingModuleState(Enum):
|
||||
"""
|
||||
Contains the state of a fitting module
|
||||
"""
|
||||
OFFLINE = -1
|
||||
ONLINE = 0
|
||||
ACTIVE = 1
|
||||
OVERHEATED = 2
|
||||
|
||||
class Hardpoint(Enum):
|
||||
class FittingHardpoint(Enum):
|
||||
"""
|
||||
Contains the types of a fitting hardpoint
|
||||
"""
|
||||
NONE = 0
|
||||
MISSILE = 1
|
||||
TURRET = 2
|
||||
|
||||
class LoginMethod(Enum):
|
||||
class EsiLoginMethod(Enum):
|
||||
"""
|
||||
Contains the method of ESI login
|
||||
"""
|
||||
SERVER = 0
|
||||
MANUAL = 1
|
||||
|
||||
class SsoMode(Enum):
|
||||
class EsiSsoMode(Enum):
|
||||
"""
|
||||
Contains the mode of ESI sso mode
|
||||
"""
|
||||
AUTO = 0
|
||||
CUSTOM = 1
|
||||
|
||||
class ESIEndpoints(Enum):
|
||||
class EsiEndpoints(Enum):
|
||||
"""
|
||||
Contains the endpoint paths for the ESI access
|
||||
"""
|
||||
CHAR = "/v4/characters/{character_id}/"
|
||||
CHAR_SKILLS = "/v4/characters/{character_id}/skills/"
|
||||
CHAR_FITTINGS = "/v1/characters/{character_id}/fittings/"
|
||||
CHAR_DEL_FIT = "/v1/characters/{character_id}/fittings/{fitting_id}/"
|
||||
|
||||
class MultiBuy_ItemType(IntEnum):
|
||||
class PortMultiBuyItemType(IntEnum):
|
||||
"""
|
||||
Contains different types of items to multibuy export
|
||||
"""
|
||||
IMPLANTS = 1
|
||||
CARGO = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
class Options(IntEnum):
|
||||
class PortEftOptions(IntEnum):
|
||||
"""
|
||||
Contains different options for eft-export
|
||||
"""
|
||||
IMPLANTS = 1
|
||||
MUTATIONS = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
class RigSize(Enum):
|
||||
# Matches to item attribute "rigSize" on ship and rig items
|
||||
class PortEftRigSize(Enum):
|
||||
"""
|
||||
Contains different sizes of ship rigs
|
||||
"""
|
||||
SMALL = 1
|
||||
MEDIUM = 2
|
||||
LARGE = 3
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
# Used by:
|
||||
# Module: Energy Neutralization Burst Projector
|
||||
# Structure Module: Standup Energy Neutralization Burst Projector
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
||||
|
||||
type = "active", "projected"
|
||||
|
||||
|
||||
def handler(fit, src, context, **kwargs):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= FittingModuleState.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
|
||||
if 'effect' in kwargs:
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
#
|
||||
# Used by:
|
||||
# Modules from group: Energy Neutralizer (54 of 54)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
||||
|
||||
type = "active", "projected"
|
||||
|
||||
|
||||
def handler(fit, src, context, **kwargs):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= FittingModuleState.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
|
||||
if 'effect' in kwargs:
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
#
|
||||
# Used by:
|
||||
# Drones from group: Energy Neutralizer Drone (3 of 3)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
||||
|
||||
type = "active", "projected"
|
||||
|
||||
|
||||
def handler(fit, src, context, **kwargs):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= FittingModuleState.ACTIVE) or
|
||||
hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = src.getModifiedItemAttr("energyNeutralizerDuration")
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Used by:
|
||||
# Structure Modules from group: Structure Energy Neutralizer (5 of 5)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
from eos.modifiedAttributeDict import ModifiedAttributeDict
|
||||
|
||||
type = "active", "projected"
|
||||
@@ -11,7 +11,7 @@ type = "active", "projected"
|
||||
def handler(fit, src, context, **kwargs):
|
||||
amount = 0
|
||||
if "projected" in context:
|
||||
if (hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive"):
|
||||
if (hasattr(src, "state") and src.state >= FittingModuleState.ACTIVE) or hasattr(src, "amountActive"):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
|
||||
if 'effect' in kwargs:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Used by:
|
||||
# Structure Modules from group: Structure Warp Scrambler (2 of 2)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
|
||||
# Not used by any item
|
||||
runTime = "early"
|
||||
@@ -14,7 +14,7 @@ def handler(fit, module, context):
|
||||
fit.ship.increaseItemAttr("warpScrambleStatus", module.getModifiedItemAttr("warpScrambleStrength"))
|
||||
if module.charge is not None and module.charge.ID == 47336:
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty and mod.item.requiresSkill("High Speed Maneuvering") and mod.state > State.ONLINE:
|
||||
mod.state = State.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:
|
||||
mod.state = State.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("High Speed Maneuvering") and mod.state > FittingModuleState.ONLINE:
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > FittingModuleState.ONLINE:
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Used by:
|
||||
# Modules from group: Warp Disrupt Field Generator (7 of 7)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
|
||||
type = "projected", "active"
|
||||
runTime = "early"
|
||||
@@ -19,10 +19,10 @@ def handler(fit, module, context):
|
||||
fit.ship.increaseItemAttr("warpScrambleStatus", module.getModifiedItemAttr("warpScrambleStrength"))
|
||||
if module.charge is not None and module.charge.ID == 45010:
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty and mod.item.requiresSkill("High Speed Maneuvering") and mod.state > State.ONLINE:
|
||||
mod.state = State.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:
|
||||
mod.state = State.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("High Speed Maneuvering") and mod.state > FittingModuleState.ONLINE:
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > FittingModuleState.ONLINE:
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
else:
|
||||
if module.charge is None:
|
||||
fit.ship.boostItemAttr("mass", module.getModifiedItemAttr("massBonusPercentage"))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Used by:
|
||||
# Modules named like: Warp Scrambler (27 of 27)
|
||||
from eos.saveddata.module import State
|
||||
from eos.saveddata.module import FittingModuleState
|
||||
|
||||
runTime = "early"
|
||||
type = "projected", "active"
|
||||
@@ -16,10 +16,10 @@ def handler(fit, module, context):
|
||||
|
||||
# this is such a dirty hack
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty and mod.state > State.ONLINE and (
|
||||
if not mod.isEmpty and mod.state > FittingModuleState.ONLINE and (
|
||||
mod.item.requiresSkill("Micro Jump Drive Operation") or
|
||||
mod.item.requiresSkill("High Speed Maneuvering")
|
||||
):
|
||||
mod.state = State.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:
|
||||
mod.state = State.ONLINE
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > FittingModuleState.ONLINE:
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
from math import log, sin, radians, exp
|
||||
|
||||
from eos.graph import Graph
|
||||
from eos.saveddata.module import State, Hardpoint
|
||||
from eos.saveddata.module import FittingModuleState, FittingHardpoint
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -46,7 +46,7 @@ class FitDpsGraph(Graph):
|
||||
abssort = lambda _val: -abs(_val - 1)
|
||||
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty and mod.state >= State.ACTIVE:
|
||||
if not mod.isEmpty and mod.state >= FittingModuleState.ACTIVE:
|
||||
if "remoteTargetPaintFalloff" in mod.item.effects or "structureModuleEffectTargetPainter" in mod.item.effects:
|
||||
ew['signatureRadius'].append(
|
||||
1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier(
|
||||
@@ -76,12 +76,12 @@ class FitDpsGraph(Graph):
|
||||
|
||||
for mod in fit.modules:
|
||||
dps = mod.getDps(targetResists=fit.targetResists).total
|
||||
if mod.hardpoint == Hardpoint.TURRET:
|
||||
if mod.state >= State.ACTIVE:
|
||||
if mod.hardpoint == FittingHardpoint.TURRET:
|
||||
if mod.state >= FittingModuleState.ACTIVE:
|
||||
total += dps * self.calculateTurretMultiplier(mod, data)
|
||||
|
||||
elif mod.hardpoint == Hardpoint.MISSILE:
|
||||
if mod.state >= State.ACTIVE and mod.maxRange is not None and mod.maxRange >= distance:
|
||||
elif mod.hardpoint == FittingHardpoint.MISSILE:
|
||||
if mod.state >= FittingModuleState.ACTIVE and mod.maxRange is not None and mod.maxRange >= distance:
|
||||
total += dps * self.calculateMissileMultiplier(mod, data)
|
||||
|
||||
if distance <= fit.extraAttributes["droneControlRange"]:
|
||||
|
||||
@@ -25,7 +25,7 @@ import eos.db
|
||||
from eos.effectHandlerHelpers import HandledItem, HandledCharge
|
||||
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut
|
||||
from eos.saveddata.fighterAbility import FighterAbility
|
||||
from eos.saveddata.module import Slot
|
||||
from eos.saveddata.module import FittingSlot
|
||||
from eos.utils.stats import DmgTypes
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -116,12 +116,12 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
def __calculateSlot(self, item):
|
||||
types = {
|
||||
"Light" : Slot.F_LIGHT,
|
||||
"Support": Slot.F_SUPPORT,
|
||||
"Heavy" : Slot.F_HEAVY,
|
||||
"StandupLight": Slot.FS_LIGHT,
|
||||
"StandupSupport": Slot.FS_SUPPORT,
|
||||
"StandupHeavy": Slot.FS_HEAVY
|
||||
"Light" : FittingSlot.F_LIGHT,
|
||||
"Support": FittingSlot.F_SUPPORT,
|
||||
"Heavy" : FittingSlot.F_HEAVY,
|
||||
"StandupLight": FittingSlot.FS_LIGHT,
|
||||
"StandupSupport": FittingSlot.FS_SUPPORT,
|
||||
"StandupHeavy": FittingSlot.FS_HEAVY
|
||||
}
|
||||
|
||||
for t, slot in types.items():
|
||||
|
||||
@@ -34,7 +34,7 @@ from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.character import Character
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.module import Module, State, Slot, Hardpoint
|
||||
from eos.saveddata.module import Module, FittingModuleState, FittingSlot, FittingHardpoint
|
||||
from eos.utils.stats import DmgTypes
|
||||
from logbook import Logger
|
||||
|
||||
@@ -892,7 +892,7 @@ class Fit(object):
|
||||
if self.ship is None:
|
||||
return
|
||||
|
||||
for slotType in (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE):
|
||||
for slotType in (FittingSlot.LOW, FittingSlot.MED, FittingSlot.HIGH, FittingSlot.RIG, FittingSlot.SUBSYSTEM, FittingSlot.SERVICE):
|
||||
amount = self.getSlotsFree(slotType, True)
|
||||
if amount > 0:
|
||||
for _ in range(int(amount)):
|
||||
@@ -939,7 +939,7 @@ class Fit(object):
|
||||
def getItemAttrOnlineSum(dict, attr):
|
||||
amount = 0
|
||||
for mod in dict:
|
||||
add = mod.getModifiedItemAttr(attr) if mod.state >= State.ONLINE else None
|
||||
add = mod.getModifiedItemAttr(attr) if mod.state >= FittingModuleState.ONLINE else None
|
||||
if add is not None:
|
||||
amount += add
|
||||
|
||||
@@ -958,29 +958,29 @@ class Fit(object):
|
||||
|
||||
for mod in chain(self.modules, self.fighters):
|
||||
if mod.slot is type and (not getattr(mod, "isEmpty", False) or countDummies):
|
||||
if type in (Slot.F_HEAVY, Slot.F_SUPPORT, Slot.F_LIGHT, Slot.FS_HEAVY, Slot.FS_LIGHT, Slot.FS_SUPPORT) and not mod.active:
|
||||
if type in (FittingSlot.F_HEAVY, FittingSlot.F_SUPPORT, FittingSlot.F_LIGHT, FittingSlot.FS_HEAVY, FittingSlot.FS_LIGHT, FittingSlot.FS_SUPPORT) and not mod.active:
|
||||
continue
|
||||
amount += 1
|
||||
|
||||
return amount
|
||||
|
||||
slots = {
|
||||
Slot.LOW : "lowSlots",
|
||||
Slot.MED : "medSlots",
|
||||
Slot.HIGH : "hiSlots",
|
||||
Slot.RIG : "rigSlots",
|
||||
Slot.SUBSYSTEM: "maxSubSystems",
|
||||
Slot.SERVICE : "serviceSlots",
|
||||
Slot.F_LIGHT : "fighterLightSlots",
|
||||
Slot.F_SUPPORT: "fighterSupportSlots",
|
||||
Slot.F_HEAVY : "fighterHeavySlots",
|
||||
Slot.FS_LIGHT: "fighterStandupLightSlots",
|
||||
Slot.FS_SUPPORT: "fighterStandupSupportSlots",
|
||||
Slot.FS_HEAVY: "fighterStandupHeavySlots",
|
||||
FittingSlot.LOW : "lowSlots",
|
||||
FittingSlot.MED : "medSlots",
|
||||
FittingSlot.HIGH : "hiSlots",
|
||||
FittingSlot.RIG : "rigSlots",
|
||||
FittingSlot.SUBSYSTEM: "maxSubSystems",
|
||||
FittingSlot.SERVICE : "serviceSlots",
|
||||
FittingSlot.F_LIGHT : "fighterLightSlots",
|
||||
FittingSlot.F_SUPPORT: "fighterSupportSlots",
|
||||
FittingSlot.F_HEAVY : "fighterHeavySlots",
|
||||
FittingSlot.FS_LIGHT: "fighterStandupLightSlots",
|
||||
FittingSlot.FS_SUPPORT: "fighterStandupSupportSlots",
|
||||
FittingSlot.FS_HEAVY: "fighterStandupHeavySlots",
|
||||
}
|
||||
|
||||
def getSlotsFree(self, type, countDummies=False):
|
||||
if type in (Slot.MODE, Slot.SYSTEM):
|
||||
if type in (FittingSlot.MODE, FittingSlot.SYSTEM):
|
||||
# These slots don't really exist, return default 0
|
||||
return 0
|
||||
|
||||
@@ -992,12 +992,12 @@ class Fit(object):
|
||||
return self.ship.getModifiedItemAttr(self.slots[type]) or 0
|
||||
|
||||
def getHardpointsFree(self, type):
|
||||
if type == Hardpoint.NONE:
|
||||
if type == FittingHardpoint.NONE:
|
||||
return 1
|
||||
elif type == Hardpoint.TURRET:
|
||||
return self.ship.getModifiedItemAttr('turretSlotsLeft') - self.getHardpointsUsed(Hardpoint.TURRET)
|
||||
elif type == Hardpoint.MISSILE:
|
||||
return self.ship.getModifiedItemAttr('launcherSlotsLeft') - self.getHardpointsUsed(Hardpoint.MISSILE)
|
||||
elif type == FittingHardpoint.TURRET:
|
||||
return self.ship.getModifiedItemAttr('turretSlotsLeft') - self.getHardpointsUsed(FittingHardpoint.TURRET)
|
||||
elif type == FittingHardpoint.MISSILE:
|
||||
return self.ship.getModifiedItemAttr('launcherSlotsLeft') - self.getHardpointsUsed(FittingHardpoint.MISSILE)
|
||||
else:
|
||||
raise ValueError("%d is not a valid value for Hardpoint Enum", type)
|
||||
|
||||
@@ -1159,7 +1159,7 @@ class Fit(object):
|
||||
capUsed = 0
|
||||
capAdded = 0
|
||||
for mod in self.modules:
|
||||
if mod.state >= State.ACTIVE:
|
||||
if mod.state >= FittingModuleState.ACTIVE:
|
||||
if (mod.getModifiedItemAttr("capacitorNeed") or 0) != 0:
|
||||
cycleTime = mod.rawCycleTime or 0
|
||||
reactivationTime = mod.getModifiedItemAttr("moduleReactivationDelay") or 0
|
||||
@@ -1173,7 +1173,7 @@ class Fit(object):
|
||||
capAdded -= capNeed
|
||||
|
||||
# If this is a turret, don't stagger activations
|
||||
disableStagger = mod.hardpoint == Hardpoint.TURRET
|
||||
disableStagger = mod.hardpoint == FittingHardpoint.TURRET
|
||||
|
||||
drains.append((int(fullCycleTime), mod.getModifiedItemAttr("capacitorNeed") or 0,
|
||||
mod.numShots or 0, disableStagger, reloadTime))
|
||||
|
||||
@@ -23,7 +23,7 @@ from logbook import Logger
|
||||
from sqlalchemy.orm import reconstructor, validates
|
||||
|
||||
import eos.db
|
||||
from eos.const import Slot, State, Hardpoint
|
||||
from eos.const import FittingSlot, FittingModuleState, FittingHardpoint
|
||||
from eos.effectHandlerHelpers import HandledCharge, HandledItem
|
||||
from eos.enum import Enum
|
||||
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
|
||||
@@ -36,26 +36,26 @@ from eos.utils.stats import DmgTypes
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
ProjectedMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
State.OFFLINE: State.ACTIVE,
|
||||
State.ONLINE: State.ACTIVE # Just in case
|
||||
FittingModuleState.OVERHEATED: FittingModuleState.ACTIVE,
|
||||
FittingModuleState.ACTIVE: FittingModuleState.OFFLINE,
|
||||
FittingModuleState.OFFLINE: FittingModuleState.ACTIVE,
|
||||
FittingModuleState.ONLINE: FittingModuleState.ACTIVE # Just in case
|
||||
}
|
||||
|
||||
|
||||
# Old state : New State
|
||||
LocalMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.ONLINE,
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.ACTIVE
|
||||
FittingModuleState.OVERHEATED: FittingModuleState.ACTIVE,
|
||||
FittingModuleState.ACTIVE: FittingModuleState.ONLINE,
|
||||
FittingModuleState.OFFLINE: FittingModuleState.ONLINE,
|
||||
FittingModuleState.ONLINE: FittingModuleState.ACTIVE
|
||||
}
|
||||
|
||||
|
||||
# For system effects. They should only ever be online or offline
|
||||
ProjectedSystem = {
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.OFFLINE
|
||||
FittingModuleState.OFFLINE: FittingModuleState.ONLINE,
|
||||
FittingModuleState.ONLINE: FittingModuleState.OFFLINE
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__charge = None
|
||||
|
||||
self.projected = False
|
||||
self.state = State.ONLINE
|
||||
self.state = FittingModuleState.ONLINE
|
||||
self.build()
|
||||
|
||||
@reconstructor
|
||||
@@ -139,7 +139,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__reloadTime = None
|
||||
self.__reloadForce = None
|
||||
self.__chargeCycles = None
|
||||
self.__hardpoint = Hardpoint.NONE
|
||||
self.__hardpoint = FittingHardpoint.NONE
|
||||
self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self)
|
||||
self.__chargeModifiedAttributes = ModifiedAttributeDict(parent=self)
|
||||
self.__slot = self.dummySlot # defaults to None
|
||||
@@ -382,7 +382,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if self.isEmpty:
|
||||
self.__miningyield = 0
|
||||
else:
|
||||
if self.state >= State.ACTIVE:
|
||||
if self.state >= FittingModuleState.ACTIVE:
|
||||
volley = self.getModifiedItemAttr("specialtyMiningAmount") or self.getModifiedItemAttr(
|
||||
"miningAmount") or 0
|
||||
if volley:
|
||||
@@ -396,7 +396,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return self.__miningyield
|
||||
|
||||
def getVolley(self, spoolOptions=None, targetResists=None, ignoreState=False):
|
||||
if self.isEmpty or (self.state < State.ACTIVE and not ignoreState):
|
||||
if self.isEmpty or (self.state < FittingModuleState.ACTIVE and not ignoreState):
|
||||
return DmgTypes(0, 0, 0, 0)
|
||||
if self.__baseVolley is None:
|
||||
dmgGetter = self.getModifiedChargeAttr if self.charge else self.getModifiedItemAttr
|
||||
@@ -434,7 +434,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return dps
|
||||
|
||||
def getRemoteReps(self, spoolOptions=None, ignoreState=False):
|
||||
if self.isEmpty or (self.state < State.ACTIVE and not ignoreState):
|
||||
if self.isEmpty or (self.state < FittingModuleState.ACTIVE and not ignoreState):
|
||||
return None, 0
|
||||
|
||||
def getBaseRemoteReps(module):
|
||||
@@ -576,14 +576,14 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return False
|
||||
|
||||
# If the mod is a subsystem, don't let two subs in the same slot fit
|
||||
if self.slot == Slot.SUBSYSTEM:
|
||||
if self.slot == FittingSlot.SUBSYSTEM:
|
||||
subSlot = self.getModifiedItemAttr("subSystemSlot")
|
||||
for mod in fit.modules:
|
||||
if mod.getModifiedItemAttr("subSystemSlot") == subSlot:
|
||||
return False
|
||||
|
||||
# Check rig sizes
|
||||
if self.slot == Slot.RIG:
|
||||
if self.slot == FittingSlot.RIG:
|
||||
if self.getModifiedItemAttr("rigSize") != fit.ship.getModifiedItemAttr("rigSize"):
|
||||
return False
|
||||
|
||||
@@ -613,9 +613,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
# Check if we're within bounds
|
||||
if state < -1 or state > 2:
|
||||
return False
|
||||
elif state >= State.ACTIVE and not self.item.isType("active"):
|
||||
elif state >= FittingModuleState.ACTIVE and not self.item.isType("active"):
|
||||
return False
|
||||
elif state == State.OVERHEATED and not self.item.isType("overheat"):
|
||||
elif state == FittingModuleState.OVERHEATED and not self.item.isType("overheat"):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -627,7 +627,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
# If we're going to set module to offline or online for local modules or offline for projected,
|
||||
# it should be fine for all cases
|
||||
item = self.item
|
||||
if (state <= State.ONLINE and projectedOnto is None) or (state <= State.OFFLINE):
|
||||
if (state <= FittingModuleState.ONLINE and projectedOnto is None) or (state <= FittingModuleState.OFFLINE):
|
||||
return True
|
||||
|
||||
# Check if the local module is over it's max limit; if it's not, we're fine
|
||||
@@ -641,7 +641,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
group = item.group.name
|
||||
for mod in self.owner.modules:
|
||||
currItem = getattr(mod, "item", None)
|
||||
if mod.state >= State.ACTIVE and currItem is not None and currItem.group.name == group:
|
||||
if mod.state >= FittingModuleState.ACTIVE and currItem is not None and currItem.group.name == group:
|
||||
currActive += 1
|
||||
if currActive > maxGroupActive:
|
||||
break
|
||||
@@ -704,28 +704,28 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
@staticmethod
|
||||
def __calculateHardpoint(item):
|
||||
effectHardpointMap = {
|
||||
"turretFitted" : Hardpoint.TURRET,
|
||||
"launcherFitted": Hardpoint.MISSILE
|
||||
"turretFitted" : FittingHardpoint.TURRET,
|
||||
"launcherFitted": FittingHardpoint.MISSILE
|
||||
}
|
||||
|
||||
if item is None:
|
||||
return Hardpoint.NONE
|
||||
return FittingHardpoint.NONE
|
||||
|
||||
for effectName, slot in effectHardpointMap.items():
|
||||
if effectName in item.effects:
|
||||
return slot
|
||||
|
||||
return Hardpoint.NONE
|
||||
return FittingHardpoint.NONE
|
||||
|
||||
@staticmethod
|
||||
def calculateSlot(item):
|
||||
effectSlotMap = {
|
||||
"rigSlot" : Slot.RIG,
|
||||
"loPower" : Slot.LOW,
|
||||
"medPower" : Slot.MED,
|
||||
"hiPower" : Slot.HIGH,
|
||||
"subSystem" : Slot.SUBSYSTEM,
|
||||
"serviceSlot": Slot.SERVICE
|
||||
"rigSlot" : FittingSlot.RIG,
|
||||
"loPower" : FittingSlot.LOW,
|
||||
"medPower" : FittingSlot.MED,
|
||||
"hiPower" : FittingSlot.HIGH,
|
||||
"subSystem" : FittingSlot.SUBSYSTEM,
|
||||
"serviceSlot": FittingSlot.SERVICE
|
||||
}
|
||||
if item is None:
|
||||
return None
|
||||
@@ -733,7 +733,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effectName in item.effects:
|
||||
return slot
|
||||
if item.group.name in Module.SYSTEM_GROUPS:
|
||||
return Slot.SYSTEM
|
||||
return FittingSlot.SYSTEM
|
||||
|
||||
return None
|
||||
|
||||
@@ -787,8 +787,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effect.runTime == runTime and \
|
||||
effect.activeByDefault and \
|
||||
(effect.isType("offline") or
|
||||
(effect.isType("passive") and self.state >= State.ONLINE) or
|
||||
(effect.isType("active") and self.state >= State.ACTIVE)) and \
|
||||
(effect.isType("passive") and self.state >= FittingModuleState.ONLINE) or
|
||||
(effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) and \
|
||||
(not gang or (gang and effect.isType("gang"))):
|
||||
|
||||
chargeContext = ("moduleCharge",)
|
||||
@@ -801,7 +801,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
effect.handler(fit, self, chargeContext)
|
||||
|
||||
if self.item:
|
||||
if self.state >= State.OVERHEATED:
|
||||
if self.state >= FittingModuleState.OVERHEATED:
|
||||
for effect in self.item.effects.values():
|
||||
if effect.runTime == runTime and \
|
||||
effect.isType("overheat") \
|
||||
@@ -814,8 +814,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effect.runTime == runTime and \
|
||||
effect.activeByDefault and \
|
||||
(effect.isType("offline") or
|
||||
(effect.isType("passive") and self.state >= State.ONLINE) or
|
||||
(effect.isType("active") and self.state >= State.ACTIVE)) \
|
||||
(effect.isType("passive") and self.state >= FittingModuleState.ONLINE) or
|
||||
(effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) \
|
||||
and ((projected and effect.isType("projected")) or not projected) \
|
||||
and ((gang and effect.isType("gang")) or not gang):
|
||||
try:
|
||||
@@ -890,7 +890,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
@property
|
||||
def capUse(self):
|
||||
capNeed = self.getModifiedItemAttr("capacitorNeed")
|
||||
if capNeed and self.state >= State.ACTIVE:
|
||||
if capNeed and self.state >= FittingModuleState.ACTIVE:
|
||||
cycleTime = self.cycleTime
|
||||
if cycleTime > 0:
|
||||
capUsed = capNeed / (cycleTime / 1000.0)
|
||||
@@ -902,10 +902,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
def getProposedState(mod, click, proposedState=None):
|
||||
# todo: instead of passing in module, make this a instanced function.
|
||||
pyfalog.debug("Get proposed state for module.")
|
||||
if mod.slot == Slot.SUBSYSTEM or mod.isEmpty:
|
||||
return State.ONLINE
|
||||
if mod.slot == FittingSlot.SUBSYSTEM or mod.isEmpty:
|
||||
return FittingModuleState.ONLINE
|
||||
|
||||
if mod.slot == Slot.SYSTEM:
|
||||
if mod.slot == FittingSlot.SYSTEM:
|
||||
transitionMap = ProjectedSystem
|
||||
else:
|
||||
transitionMap = ProjectedMap if mod.projected else LocalMap
|
||||
@@ -915,9 +915,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if proposedState is not None:
|
||||
state = proposedState
|
||||
elif click == "right":
|
||||
state = State.OVERHEATED
|
||||
state = FittingModuleState.OVERHEATED
|
||||
elif click == "ctrl":
|
||||
state = State.OFFLINE
|
||||
state = FittingModuleState.OFFLINE
|
||||
else:
|
||||
state = transitionMap[currState]
|
||||
if not mod.isValidState(state):
|
||||
|
||||
@@ -25,7 +25,7 @@ from gui.builtinMarketBrowser.events import ItemSelected, ITEM_SELECTED
|
||||
import gui.mainFrame
|
||||
import gui.display as d
|
||||
from gui.builtinViewColumns.state import State
|
||||
from eos.saveddata.module import Slot
|
||||
from eos.saveddata.module import FittingSlot
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.utils.staticHelpers import DragDropHelper
|
||||
from service.fit import Fit
|
||||
@@ -93,9 +93,9 @@ class FighterView(wx.Panel):
|
||||
if fit:
|
||||
for x in self.labels:
|
||||
if fit.isStructure:
|
||||
slot = getattr(Slot, "FS_{}".format(x.upper()))
|
||||
slot = getattr(FittingSlot, "FS_{}".format(x.upper()))
|
||||
else:
|
||||
slot = getattr(Slot, "F_{}".format(x.upper()))
|
||||
slot = getattr(FittingSlot, "F_{}".format(x.upper()))
|
||||
used = fit.getSlotsUsed(slot)
|
||||
total = fit.getNumSlots(slot)
|
||||
color = wx.Colour(204, 51, 51) if used > total else wx.SystemSettings.GetColour(
|
||||
|
||||
@@ -5,7 +5,7 @@ import wx
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from eos.saveddata.module import Hardpoint
|
||||
from eos.saveddata.module import FittingHardpoint
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.market import Market
|
||||
@@ -136,7 +136,7 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
hardpoint = self.module.hardpoint
|
||||
moduleName = self.module.item.name
|
||||
# Make sure we do not consider mining turrets as combat turrets
|
||||
if hardpoint == Hardpoint.TURRET and self.module.getModifiedItemAttr("miningAmount", None) is None:
|
||||
if hardpoint == FittingHardpoint.TURRET and self.module.getModifiedItemAttr("miningAmount", None) is None:
|
||||
self.addSeperator(m, "Long Range")
|
||||
items = []
|
||||
range_ = None
|
||||
@@ -180,7 +180,7 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
m.Append(item)
|
||||
|
||||
self.addSeperator(m, "Short Range")
|
||||
elif hardpoint == Hardpoint.MISSILE and moduleName != 'Festival Launcher':
|
||||
elif hardpoint == FittingHardpoint.MISSILE and moduleName != 'Festival Launcher':
|
||||
self.charges.sort(key=self.missileSorter)
|
||||
type_ = None
|
||||
sub = None
|
||||
|
||||
@@ -26,7 +26,7 @@ import gui.mainFrame
|
||||
from gui.chrome_tabs import EVT_NOTEBOOK_PAGE_CHANGED
|
||||
from gui.utils import fonts
|
||||
|
||||
from eos.saveddata.module import Hardpoint
|
||||
from eos.saveddata.module import FittingHardpoint
|
||||
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
|
||||
@@ -196,9 +196,9 @@ class ResourcesViewFull(StatsView):
|
||||
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
stats = (
|
||||
("label%sUsedTurretHardpoints", lambda: fit.getHardpointsUsed(Hardpoint.TURRET), 0, 0, 0),
|
||||
("label%sUsedTurretHardpoints", lambda: fit.getHardpointsUsed(FittingHardpoint.TURRET), 0, 0, 0),
|
||||
("label%sTotalTurretHardpoints", lambda: fit.ship.getModifiedItemAttr('turretSlotsLeft'), 0, 0, 0),
|
||||
("label%sUsedLauncherHardpoints", lambda: fit.getHardpointsUsed(Hardpoint.MISSILE), 0, 0, 0),
|
||||
("label%sUsedLauncherHardpoints", lambda: fit.getHardpointsUsed(FittingHardpoint.MISSILE), 0, 0, 0),
|
||||
("label%sTotalLauncherHardpoints", lambda: fit.ship.getModifiedItemAttr('launcherSlotsLeft'), 0, 0, 0),
|
||||
("label%sUsedDronesActive", lambda: fit.activeDrones, 0, 0, 0),
|
||||
("label%sTotalDronesActive", lambda: fit.extraAttributes["maxActiveDrones"], 0, 0, 0),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import wx
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.module import Module, Slot, Rack
|
||||
from eos.saveddata.module import Module, FittingSlot, Rack
|
||||
from eos.saveddata.fit import Fit
|
||||
from gui.viewColumn import ViewColumn
|
||||
|
||||
@@ -32,7 +32,7 @@ class BaseIcon(ViewColumn):
|
||||
return self.shipImage
|
||||
elif isinstance(stuff, Module):
|
||||
if stuff.isEmpty:
|
||||
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(),
|
||||
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % FittingSlot.getName(stuff.slot).lower(),
|
||||
"gui")
|
||||
else:
|
||||
return self.loadIconFile(stuff.item.iconID or "")
|
||||
|
||||
@@ -25,7 +25,7 @@ from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.module import Module, Slot, Rack
|
||||
from eos.saveddata.module import Module, FittingSlot, Rack
|
||||
from eos.saveddata.fit import Fit
|
||||
from service.fit import Fit as FitSvc
|
||||
from service.market import Market
|
||||
@@ -72,10 +72,10 @@ class BaseName(ViewColumn):
|
||||
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
|
||||
elif isinstance(stuff, Rack):
|
||||
if FitSvc.getInstance().serviceFittingOptions["rackLabels"]:
|
||||
if stuff.slot == Slot.MODE:
|
||||
if stuff.slot == FittingSlot.MODE:
|
||||
return '─ Tactical Mode ─'
|
||||
else:
|
||||
return '─ {} {} Slot{}─'.format(stuff.num, Slot.getName(stuff.slot).capitalize(), '' if stuff.num == 1 else 's')
|
||||
return '─ {} {} Slot{}─'.format(stuff.num, FittingSlot.getName(stuff.slot).capitalize(), '' if stuff.num == 1 else 's')
|
||||
else:
|
||||
return ""
|
||||
elif isinstance(stuff, Module):
|
||||
@@ -89,7 +89,7 @@ class BaseName(ViewColumn):
|
||||
return "{} {}".format(type.name, stuff.item.name[-1:])
|
||||
|
||||
if stuff.isEmpty:
|
||||
return "%s Slot" % Slot.getName(stuff.slot).capitalize()
|
||||
return "%s Slot" % FittingSlot.getName(stuff.slot).capitalize()
|
||||
else:
|
||||
return stuff.item.name
|
||||
elif isinstance(stuff, Implant):
|
||||
|
||||
@@ -24,7 +24,7 @@ import wx
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.module import Module, State as State_, Rack
|
||||
from eos.saveddata.module import Module, FittingModuleState as State_, Rack
|
||||
from gui.viewColumn import ViewColumn
|
||||
|
||||
import gui.mainFrame
|
||||
|
||||
@@ -30,7 +30,7 @@ import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
import gui.multiSwitch
|
||||
from eos.saveddata.mode import Mode
|
||||
from eos.saveddata.module import Module, Rack, Slot
|
||||
from eos.saveddata.module import Module, Rack, FittingSlot
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.builtinMarketBrowser.events import ITEM_SELECTED
|
||||
from gui.builtinShipBrowser.events import EVT_FIT_REMOVED, EVT_FIT_RENAMED, EVT_FIT_SELECTED, FitSelected
|
||||
@@ -474,7 +474,7 @@ class FittingView(d.Display):
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.activeFitID)
|
||||
|
||||
slotOrder = [Slot.SUBSYSTEM, Slot.HIGH, Slot.MED, Slot.LOW, Slot.RIG, Slot.SERVICE]
|
||||
slotOrder = [FittingSlot.SUBSYSTEM, FittingSlot.HIGH, FittingSlot.MED, FittingSlot.LOW, FittingSlot.RIG, FittingSlot.SERVICE]
|
||||
|
||||
if fit is not None:
|
||||
self.mods = fit.modules[:]
|
||||
@@ -507,7 +507,7 @@ class FittingView(d.Display):
|
||||
# while also marking the mode header position in the Blanks list
|
||||
if sFit.serviceFittingOptions["rackSlots"]:
|
||||
self.blanks.append(len(self.mods))
|
||||
self.mods.append(Rack.buildRack(Slot.MODE, None))
|
||||
self.mods.append(Rack.buildRack(FittingSlot.MODE, None))
|
||||
|
||||
self.mods.append(fit.mode)
|
||||
else:
|
||||
@@ -648,8 +648,8 @@ class FittingView(d.Display):
|
||||
slotMap = {}
|
||||
|
||||
# test for too many modules (happens with t3s / CCP change in slot layout)
|
||||
for slotType in Slot.getTypes():
|
||||
slot = Slot.getValue(slotType)
|
||||
for slotType in FittingSlot.getTypes():
|
||||
slot = FittingSlot.getValue(slotType)
|
||||
slotMap[slot] = fit.getSlotsFree(slot) < 0
|
||||
|
||||
for i, mod in enumerate(self.mods):
|
||||
@@ -735,8 +735,8 @@ class FittingView(d.Display):
|
||||
return
|
||||
|
||||
slotMap = {}
|
||||
for slotType in Slot.getTypes():
|
||||
slot = Slot.getValue(slotType)
|
||||
for slotType in FittingSlot.getTypes():
|
||||
slot = FittingSlot.getValue(slotType)
|
||||
slotMap[slot] = fit.getSlotsFree(slot) < 0
|
||||
|
||||
padding = 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import wx
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
import eos.db
|
||||
from logbook import Logger
|
||||
from service.fit import Fit
|
||||
@@ -52,8 +52,8 @@ class FitAddModuleCommand(wx.Command):
|
||||
self.module.owner = fit
|
||||
numSlots = len(fit.modules)
|
||||
fit.modules.append(self.module)
|
||||
if self.module.isValidState(State.ACTIVE):
|
||||
self.module.state = State.ACTIVE
|
||||
if self.module.isValidState(FittingModuleState.ACTIVE):
|
||||
self.module.state = FittingModuleState.ACTIVE
|
||||
|
||||
# todo: fix these
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import wx
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
import eos.db
|
||||
from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -28,7 +28,7 @@ class FitAddProjectedEnvCommand(wx.Command):
|
||||
|
||||
# todo: thing to check for existing environmental effects
|
||||
|
||||
module.state = State.ONLINE
|
||||
module.state = FittingModuleState.ONLINE
|
||||
if module.isExclusiveSystemEffect:
|
||||
# if this is an exclusive system effect, we need to cache the old one. We make room for the new one here, which returns the old one
|
||||
self.old_item = fit.projectedModules.makeRoom(module)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import wx
|
||||
import eos.db
|
||||
from logbook import Logger
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ class FitAddProjectedModuleCommand(wx.Command):
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
module.state = State.ACTIVE
|
||||
module.state = FittingModuleState.ACTIVE
|
||||
if not module.canHaveState(module.state, fit):
|
||||
module.state = State.OFFLINE
|
||||
module.state = FittingModuleState.OFFLINE
|
||||
fit.projectedModules.append(module)
|
||||
|
||||
eos.db.commit()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import wx
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
import eos.db
|
||||
from eos.db.gamedata.queries import getDynamicItem
|
||||
from logbook import Logger
|
||||
@@ -62,8 +62,8 @@ class FitImportMutatedCommand(wx.Command):
|
||||
module.owner = fit
|
||||
numSlots = len(fit.modules)
|
||||
fit.modules.append(module)
|
||||
if module.isValidState(State.ACTIVE):
|
||||
module.state = State.ACTIVE
|
||||
if module.isValidState(FittingModuleState.ACTIVE):
|
||||
module.state = FittingModuleState.ACTIVE
|
||||
|
||||
# todo: fix these
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
|
||||
@@ -2,7 +2,7 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.saveddata.module import Module, State
|
||||
from eos.saveddata.module import Module, FittingModuleState
|
||||
from gui.fitCommands.helpers import ModuleInfoCache
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -75,8 +75,8 @@ class FitReplaceModuleCommand(wx.Command):
|
||||
if self.module.fits(fit):
|
||||
self.module.owner = fit
|
||||
fit.modules.toModule(self.position, self.module)
|
||||
if self.module.isValidState(State.ACTIVE):
|
||||
self.module.state = State.ACTIVE
|
||||
if self.module.isValidState(FittingModuleState.ACTIVE):
|
||||
self.module.state = FittingModuleState.ACTIVE
|
||||
|
||||
if self.old_module and self.old_module.charge and self.module.isValidCharge(self.old_module.charge):
|
||||
self.module.charge = self.old_module.charge
|
||||
|
||||
@@ -37,7 +37,7 @@ from service.esi import Esi
|
||||
|
||||
from eos.saveddata.implant import Implant as es_Implant
|
||||
from eos.saveddata.character import Character as es_Character, Skill
|
||||
from eos.saveddata.module import Slot as es_Slot, Module as es_Module
|
||||
from eos.saveddata.module import FittingSlot as es_Slot, Module as es_Module
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
@@ -10,9 +10,9 @@ import webbrowser
|
||||
|
||||
import eos.db
|
||||
from eos.enum import Enum
|
||||
from eos.const import LoginMethod
|
||||
from eos.const import EsiLoginMethod
|
||||
from eos.saveddata.ssocharacter import SsoCharacter
|
||||
from service.esiAccess import APIException, SsoMode
|
||||
from service.esiAccess import APIException, EsiSsoMode
|
||||
import gui.globalEvents as GE
|
||||
from gui.ssoLogin import SsoLogin, SsoLoginServer
|
||||
from service.server import StoppableHTTPServer, AuthHandler
|
||||
@@ -103,8 +103,8 @@ class Esi(EsiAccess):
|
||||
|
||||
def login(self):
|
||||
# always start the local server if user is using client details. Otherwise, start only if they choose to do so.
|
||||
if self.settings.get('ssoMode') == SsoMode.CUSTOM or self.settings.get('loginMode') == LoginMethod.SERVER:
|
||||
dlg = gui.ssoLogin.SsoLoginServer(6461 if self.settings.get('ssoMode') == SsoMode.CUSTOM else 0)
|
||||
if self.settings.get('ssoMode') == EsiSsoMode.CUSTOM or self.settings.get('loginMode') == EsiLoginMethod.SERVER:
|
||||
dlg = gui.ssoLogin.SsoLoginServer(6461 if self.settings.get('ssoMode') == EsiSsoMode.CUSTOM else 0)
|
||||
dlg.ShowModal()
|
||||
else:
|
||||
dlg = gui.ssoLogin.SsoLogin()
|
||||
@@ -138,7 +138,7 @@ class Esi(EsiAccess):
|
||||
def handleLogin(self, message):
|
||||
|
||||
# we already have authenticated stuff for the auto mode
|
||||
if self.settings.get('ssoMode') == SsoMode.AUTO:
|
||||
if self.settings.get('ssoMode') == EsiSsoMode.AUTO:
|
||||
ssoInfo = message['SSOInfo'][0]
|
||||
auth_response = json.loads(base64.b64decode(ssoInfo))
|
||||
else:
|
||||
|
||||
@@ -18,7 +18,7 @@ import base64
|
||||
|
||||
import datetime
|
||||
from eos.enum import Enum
|
||||
from eos.const import SsoMode, ESIEndpoints
|
||||
from eos.const import EsiSsoMode, EsiEndpoints
|
||||
from service.settings import EsiSettings, NetworkSettings
|
||||
|
||||
from requests import Session
|
||||
@@ -78,7 +78,7 @@ class EsiAccess(object):
|
||||
|
||||
@property
|
||||
def sso_url(self):
|
||||
if self.settings.get("ssoMode") == SsoMode.CUSTOM:
|
||||
if self.settings.get("ssoMode") == EsiSsoMode.CUSTOM:
|
||||
return "https://login.eveonline.com"
|
||||
return "https://www.pyfa.io"
|
||||
|
||||
@@ -99,20 +99,20 @@ class EsiAccess(object):
|
||||
return '%s/oauth/token' % self.sso_url
|
||||
|
||||
def getSkills(self, char):
|
||||
return self.get(char, ESIEndpoints.CHAR_SKILLS, character_id=char.characterID)
|
||||
return self.get(char, EsiEndpoints.CHAR_SKILLS, character_id=char.characterID)
|
||||
|
||||
def getSecStatus(self, char):
|
||||
return self.get(char, ESIEndpoints.CHAR, character_id=char.characterID)
|
||||
return self.get(char, EsiEndpoints.CHAR, character_id=char.characterID)
|
||||
|
||||
def getFittings(self, char):
|
||||
return self.get(char, ESIEndpoints.CHAR_FITTINGS, character_id=char.characterID)
|
||||
return self.get(char, EsiEndpoints.CHAR_FITTINGS, character_id=char.characterID)
|
||||
|
||||
def postFitting(self, char, json_str):
|
||||
# @todo: new fitting ID can be recovered from resp.data,
|
||||
return self.post(char, ESIEndpoints.CHAR_FITTINGS, json_str, character_id=char.characterID)
|
||||
return self.post(char, EsiEndpoints.CHAR_FITTINGS, json_str, character_id=char.characterID)
|
||||
|
||||
def delFitting(self, char, fittingID):
|
||||
return self.delete(char, ESIEndpoints.CHAR_DEL_FIT, character_id=char.characterID, fitting_id=fittingID)
|
||||
return self.delete(char, EsiEndpoints.CHAR_DEL_FIT, character_id=char.characterID, fitting_id=fittingID)
|
||||
|
||||
@staticmethod
|
||||
def update_token(char, tokenResponse):
|
||||
@@ -125,7 +125,7 @@ class EsiAccess(object):
|
||||
def getLoginURI(self, redirect=None):
|
||||
self.state = str(uuid.uuid4())
|
||||
|
||||
if self.settings.get("ssoMode") == SsoMode.AUTO:
|
||||
if self.settings.get("ssoMode") == EsiSsoMode.AUTO:
|
||||
args = {
|
||||
'state': self.state,
|
||||
'pyfa_version': config.version,
|
||||
@@ -172,7 +172,7 @@ class EsiAccess(object):
|
||||
'refresh_token': refreshToken,
|
||||
}
|
||||
|
||||
if self.settings.get('ssoMode') == SsoMode.AUTO:
|
||||
if self.settings.get('ssoMode') == EsiSsoMode.AUTO:
|
||||
# data is all we really need, the rest is handled automatically by pyfa.io
|
||||
return {
|
||||
'data': data,
|
||||
|
||||
@@ -31,7 +31,7 @@ from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
|
||||
from eos.saveddata.drone import Drone as es_Drone
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from eos.saveddata.fit import Fit as FitType, ImplantLocation
|
||||
from eos.saveddata.module import Module as es_Module, State
|
||||
from eos.saveddata.module import Module as es_Module, FittingModuleState
|
||||
from eos.saveddata.ship import Ship as es_Ship
|
||||
from service.character import Character
|
||||
from service.damagePattern import DamagePattern
|
||||
@@ -347,7 +347,7 @@ class Fit(FitDeprecated):
|
||||
elif isinstance(thing, es_Module):
|
||||
thing.state = es_Module.getProposedState(thing, click)
|
||||
if not thing.canHaveState(thing.state, fit):
|
||||
thing.state = State.OFFLINE
|
||||
thing.state = FittingModuleState.OFFLINE
|
||||
elif isinstance(thing, FitType):
|
||||
projectionInfo = thing.getProjectionInfo(fitID)
|
||||
if projectionInfo:
|
||||
@@ -379,8 +379,8 @@ class Fit(FitDeprecated):
|
||||
if m.fits(fit):
|
||||
m.owner = fit
|
||||
fit.modules.toModule(position, m)
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
self.recalc(fit)
|
||||
@@ -534,13 +534,13 @@ class Fit(FitDeprecated):
|
||||
if mod != base:
|
||||
# fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
|
||||
if not mod.canHaveState(mod.state) or not mod.isValidState(mod.state):
|
||||
mod.state = State.ONLINE
|
||||
mod.state = FittingModuleState.ONLINE
|
||||
changed = True
|
||||
|
||||
for mod in fit.projectedModules:
|
||||
# fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
|
||||
if not mod.canHaveState(mod.state, fit) or not mod.isValidState(mod.state):
|
||||
mod.state = State.OFFLINE
|
||||
mod.state = FittingModuleState.OFFLINE
|
||||
changed = True
|
||||
|
||||
for drone in fit.projectedDrones:
|
||||
|
||||
@@ -27,7 +27,7 @@ from eos.saveddata.cargo import Cargo as es_Cargo
|
||||
from eos.saveddata.drone import Drone as es_Drone
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from eos.saveddata.implant import Implant as es_Implant
|
||||
from eos.saveddata.module import Module as es_Module, State
|
||||
from eos.saveddata.module import Module as es_Module, FittingModuleState
|
||||
from eos.saveddata.fit import Fit as FitType
|
||||
from utils.deprecated import deprecated
|
||||
|
||||
@@ -304,16 +304,16 @@ class FitDeprecated(object):
|
||||
fit.projectedFighters.append(fighter)
|
||||
elif thing.group.name in es_Module.SYSTEM_GROUPS:
|
||||
module = es_Module(thing)
|
||||
module.state = State.ONLINE
|
||||
module.state = FittingModuleState.ONLINE
|
||||
fit.projectedModules.append(module)
|
||||
else:
|
||||
try:
|
||||
module = es_Module(thing)
|
||||
except ValueError:
|
||||
return False
|
||||
module.state = State.ACTIVE
|
||||
module.state = FittingModuleState.ACTIVE
|
||||
if not module.canHaveState(module.state, fit):
|
||||
module.state = State.OFFLINE
|
||||
module.state = FittingModuleState.OFFLINE
|
||||
fit.projectedModules.append(module)
|
||||
|
||||
eos.db.commit()
|
||||
@@ -396,8 +396,8 @@ class FitDeprecated(object):
|
||||
m.owner = fit
|
||||
numSlots = len(fit.modules)
|
||||
fit.modules.append(m)
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
self.recalc(fit)
|
||||
@@ -465,8 +465,8 @@ class FitDeprecated(object):
|
||||
if m.fits(fit):
|
||||
m.owner = fit
|
||||
fit.modules.toModule(position, m)
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
|
||||
if recalc:
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
@@ -508,8 +508,8 @@ class FitDeprecated(object):
|
||||
try:
|
||||
cargoP = es_Module(cargo.item)
|
||||
cargoP.owner = fit
|
||||
if cargoP.isValidState(State.ACTIVE):
|
||||
cargoP.state = State.ACTIVE
|
||||
if cargoP.isValidState(FittingModuleState.ACTIVE):
|
||||
cargoP.state = FittingModuleState.ACTIVE
|
||||
except:
|
||||
pyfalog.warning("Invalid item: {0}", cargo.item)
|
||||
return
|
||||
|
||||
@@ -28,7 +28,7 @@ from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module, State, Slot
|
||||
from eos.saveddata.module import Module, FittingModuleState, FittingSlot
|
||||
from eos.saveddata.ship import Ship
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
@@ -106,8 +106,8 @@ def importDna(string):
|
||||
f.modules.append(m)
|
||||
else:
|
||||
m.owner = f
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
moduleList.append(m)
|
||||
|
||||
# Recalc to get slot numbers correct for T3 cruisers
|
||||
@@ -116,8 +116,8 @@ def importDna(string):
|
||||
for module in moduleList:
|
||||
if module.fits(f):
|
||||
module.owner = f
|
||||
if module.isValidState(State.ACTIVE):
|
||||
module.state = State.ACTIVE
|
||||
if module.isValidState(FittingModuleState.ACTIVE):
|
||||
module.state = FittingModuleState.ACTIVE
|
||||
f.modules.append(module)
|
||||
|
||||
return f
|
||||
@@ -131,7 +131,7 @@ def exportDna(fit):
|
||||
sFit = svcFit.getInstance()
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty:
|
||||
if mod.slot == Slot.SUBSYSTEM:
|
||||
if mod.slot == FittingSlot.SUBSYSTEM:
|
||||
subsystems.append(mod)
|
||||
continue
|
||||
if mod.itemID not in mods:
|
||||
|
||||
@@ -7,7 +7,7 @@ from config import version as pyfaVersion
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
from eos.enum import Enum
|
||||
from eos.saveddata.module import Hardpoint, Slot, Module, State
|
||||
from eos.saveddata.module import FittingHardpoint, FittingSlot, Module, FittingModuleState
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.effectHandlerHelpers import HandledList
|
||||
from eos.db import gamedata_session, getCategory, getAttributeInfo, getGroup
|
||||
@@ -78,7 +78,7 @@ class EfsPort:
|
||||
propWithBloom = next(filter(activePropWBloomFilter, propMods), None)
|
||||
if propWithBloom is not None:
|
||||
oldPropState = propWithBloom.state
|
||||
propWithBloom.state = State.ONLINE
|
||||
propWithBloom.state = FittingModuleState.ONLINE
|
||||
sFit.recalc(fit)
|
||||
sp = fit.maxSpeed
|
||||
sig = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
@@ -190,8 +190,8 @@ class EfsPort:
|
||||
def getModuleInfo(fit, padTypeIDs=False):
|
||||
moduleNames = []
|
||||
modTypeIDs = []
|
||||
moduleNameSets = {Slot.LOW: [], Slot.MED: [], Slot.HIGH: [], Slot.RIG: [], Slot.SUBSYSTEM: []}
|
||||
modTypeIDSets = {Slot.LOW: [], Slot.MED: [], Slot.HIGH: [], Slot.RIG: [], Slot.SUBSYSTEM: []}
|
||||
moduleNameSets = {FittingSlot.LOW: [], FittingSlot.MED: [], FittingSlot.HIGH: [], FittingSlot.RIG: [], FittingSlot.SUBSYSTEM: []}
|
||||
modTypeIDSets = {FittingSlot.LOW: [], FittingSlot.MED: [], FittingSlot.HIGH: [], FittingSlot.RIG: [], FittingSlot.SUBSYSTEM: []}
|
||||
for mod in fit.modules:
|
||||
try:
|
||||
if mod.item is not None:
|
||||
@@ -208,17 +208,17 @@ class EfsPort:
|
||||
pyfalog.error("Could not find name for module {0}".format(vars(mod)))
|
||||
|
||||
for modInfo in [
|
||||
["High Slots:"], moduleNameSets[Slot.HIGH], ["", "Med Slots:"], moduleNameSets[Slot.MED],
|
||||
["", "Low Slots:"], moduleNameSets[Slot.LOW], ["", "Rig Slots:"], moduleNameSets[Slot.RIG]
|
||||
["High Slots:"], moduleNameSets[FittingSlot.HIGH], ["", "Med Slots:"], moduleNameSets[FittingSlot.MED],
|
||||
["", "Low Slots:"], moduleNameSets[FittingSlot.LOW], ["", "Rig Slots:"], moduleNameSets[FittingSlot.RIG]
|
||||
]:
|
||||
moduleNames.extend(modInfo)
|
||||
if len(moduleNameSets[Slot.SUBSYSTEM]) > 0:
|
||||
if len(moduleNameSets[FittingSlot.SUBSYSTEM]) > 0:
|
||||
moduleNames.extend(["", "Subsystems:"])
|
||||
moduleNames.extend(moduleNameSets[Slot.SUBSYSTEM])
|
||||
moduleNames.extend(moduleNameSets[FittingSlot.SUBSYSTEM])
|
||||
|
||||
for slotType in [Slot.HIGH, Slot.MED, Slot.LOW, Slot.RIG, Slot.SUBSYSTEM]:
|
||||
if slotType is not Slot.SUBSYSTEM or len(modTypeIDSets[slotType]) > 0:
|
||||
modTypeIDs.extend([0, 0] if slotType is not Slot.HIGH else [0])
|
||||
for slotType in [FittingSlot.HIGH, FittingSlot.MED, FittingSlot.LOW, FittingSlot.RIG, FittingSlot.SUBSYSTEM]:
|
||||
if slotType is not FittingSlot.SUBSYSTEM or len(modTypeIDSets[slotType]) > 0:
|
||||
modTypeIDs.extend([0, 0] if slotType is not FittingSlot.HIGH else [0])
|
||||
modTypeIDs.extend(modTypeIDSets[slotType])
|
||||
|
||||
droneNames = []
|
||||
@@ -323,18 +323,18 @@ class EfsPort:
|
||||
name = stats.item.name + ", " + stats.charge.name
|
||||
else:
|
||||
name = stats.item.name
|
||||
if stats.hardpoint == Hardpoint.TURRET:
|
||||
if stats.hardpoint == FittingHardpoint.TURRET:
|
||||
tracking = stats.getModifiedItemAttr("trackingSpeed")
|
||||
typeing = "Turret"
|
||||
# Bombs share most attributes with missiles despite not needing the hardpoint
|
||||
elif stats.hardpoint == Hardpoint.MISSILE or "Bomb Launcher" in stats.item.name:
|
||||
elif stats.hardpoint == FittingHardpoint.MISSILE or "Bomb Launcher" in stats.item.name:
|
||||
maxVelocity = stats.getModifiedChargeAttr("maxVelocity")
|
||||
explosionDelay = stats.getModifiedChargeAttr("explosionDelay")
|
||||
damageReductionFactor = stats.getModifiedChargeAttr("aoeDamageReductionFactor")
|
||||
explosionRadius = stats.getModifiedChargeAttr("aoeCloudSize")
|
||||
explosionVelocity = stats.getModifiedChargeAttr("aoeVelocity")
|
||||
typeing = "Missile"
|
||||
elif stats.hardpoint == Hardpoint.NONE:
|
||||
elif stats.hardpoint == FittingHardpoint.NONE:
|
||||
aoeFieldRange = stats.getModifiedItemAttr("empFieldRange")
|
||||
# This also covers non-bomb weapons with dps values and no hardpoints, most notably targeted doomsdays.
|
||||
typeing = "SmartBomb"
|
||||
@@ -488,11 +488,11 @@ class EfsPort:
|
||||
getDroneMulti = lambda d: sumDamage(d.getModifiedItemAttr) * d.getModifiedItemAttr("damageMultiplier")
|
||||
fitMultipliers["drones"] = list(map(getDroneMulti, tf.drones))
|
||||
|
||||
getFitTurrets = lambda f: filter(lambda mod: mod.hardpoint == Hardpoint.TURRET, f.modules)
|
||||
getFitTurrets = lambda f: filter(lambda mod: mod.hardpoint == FittingHardpoint.TURRET, f.modules)
|
||||
getTurretMulti = lambda mod: mod.getModifiedItemAttr("damageMultiplier") / mod.cycleTime
|
||||
fitMultipliers["turrets"] = list(map(getTurretMulti, getFitTurrets(tf)))
|
||||
|
||||
getFitLaunchers = lambda f: filter(lambda mod: mod.hardpoint == Hardpoint.MISSILE, f.modules)
|
||||
getFitLaunchers = lambda f: filter(lambda mod: mod.hardpoint == FittingHardpoint.MISSILE, f.modules)
|
||||
getLauncherMulti = lambda mod: sumDamage(mod.getModifiedChargeAttr) / mod.cycleTime
|
||||
fitMultipliers["launchers"] = list(map(getLauncherMulti, getFitLaunchers(tf)))
|
||||
return fitMultipliers
|
||||
@@ -530,7 +530,7 @@ class EfsPort:
|
||||
if effect._Effect__effectModule is not None:
|
||||
effect.handler(tf, fit.mode, [])
|
||||
if fit.ship.item.groupID == getGroup("Strategic Cruiser").ID:
|
||||
subSystems = list(filter(lambda mod: mod.slot == Slot.SUBSYSTEM and mod.item, fit.modules))
|
||||
subSystems = list(filter(lambda mod: mod.slot == FittingSlot.SUBSYSTEM and mod.item, fit.modules))
|
||||
for sub in subSystems:
|
||||
for effect in sub.item.effects.values():
|
||||
if effect._Effect__effectModule is not None:
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
import re
|
||||
from enum import Enum
|
||||
from eos.const import RigSize
|
||||
from eos.const import Options
|
||||
from eos.const import PortEftRigSize
|
||||
from eos.const import PortEftOptions
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
@@ -32,7 +32,7 @@ from eos.saveddata.booster import Booster
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.module import Module, State, Slot
|
||||
from eos.saveddata.module import Module, FittingModuleState, FittingSlot
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.fit import Fit
|
||||
from service.fit import Fit as svcFit
|
||||
@@ -44,14 +44,14 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
EFT_OPTIONS = (
|
||||
(Options.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(Options.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
|
||||
(Options.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
|
||||
(PortEftOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(PortEftOptions.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
|
||||
(PortEftOptions.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
|
||||
)
|
||||
|
||||
|
||||
MODULE_CATS = ('Module', 'Subsystem', 'Structure Module')
|
||||
SLOT_ORDER = (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE)
|
||||
SLOT_ORDER = (FittingSlot.LOW, FittingSlot.MED, FittingSlot.HIGH, FittingSlot.RIG, FittingSlot.SUBSYSTEM, FittingSlot.SERVICE)
|
||||
OFFLINE_SUFFIX = '/OFFLINE'
|
||||
|
||||
|
||||
@@ -81,21 +81,21 @@ def exportEft(fit, options):
|
||||
modName = module.baseItem.name
|
||||
else:
|
||||
modName = module.item.name
|
||||
if module.isMutated and options[Options.MUTATIONS.value]:
|
||||
if module.isMutated and options[PortEftOptions.MUTATIONS.value]:
|
||||
mutants[mutantReference] = module
|
||||
mutationSuffix = ' [{}]'.format(mutantReference)
|
||||
mutantReference += 1
|
||||
else:
|
||||
mutationSuffix = ''
|
||||
modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == State.OFFLINE else ''
|
||||
if module.charge and options[Options.LOADED_CHARGES.value]:
|
||||
modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == FittingModuleState.OFFLINE else ''
|
||||
if module.charge and options[PortEftOptions.LOADED_CHARGES.value]:
|
||||
rackLines.append('{}, {}{}{}'.format(
|
||||
modName, module.charge.name, modOfflineSuffix, mutationSuffix))
|
||||
else:
|
||||
rackLines.append('{}{}{}'.format(modName, modOfflineSuffix, mutationSuffix))
|
||||
else:
|
||||
rackLines.append('[Empty {} slot]'.format(
|
||||
Slot.getName(slotType).capitalize() if slotType is not None else ''))
|
||||
FittingSlot.getName(slotType).capitalize() if slotType is not None else ''))
|
||||
if rackLines:
|
||||
modSection.append('\n'.join(rackLines))
|
||||
if modSection:
|
||||
@@ -117,7 +117,7 @@ def exportEft(fit, options):
|
||||
sections.append('\n\n'.join(minionSection))
|
||||
|
||||
# Section 3: implants, boosters
|
||||
if options[Options.IMPLANTS.value]:
|
||||
if options[PortEftOptions.IMPLANTS.value]:
|
||||
charSection = []
|
||||
implantLines = []
|
||||
for implant in fit.implants:
|
||||
@@ -144,7 +144,7 @@ def exportEft(fit, options):
|
||||
|
||||
# Section 5: mutated modules' details
|
||||
mutationLines = []
|
||||
if mutants and options[Options.MUTATIONS.value]:
|
||||
if mutants and options[PortEftOptions.MUTATIONS.value]:
|
||||
for mutantReference in sorted(mutants):
|
||||
mutant = mutants[mutantReference]
|
||||
mutationLines.append(renderMutant(mutant, firstPrefix='[{}] '.format(mutantReference), prefix=' '))
|
||||
@@ -436,8 +436,8 @@ def importEftCfg(shipname, lines, iportuser):
|
||||
else:
|
||||
m.owner = fitobj
|
||||
# Activate mod if it is activable
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
# Add charge to mod if applicable, on any errors just don't add anything
|
||||
if chargeName:
|
||||
try:
|
||||
@@ -717,12 +717,12 @@ class AbstractFit:
|
||||
@property
|
||||
def __slotContainerMap(self):
|
||||
return {
|
||||
Slot.HIGH: self.modulesHigh,
|
||||
Slot.MED: self.modulesMed,
|
||||
Slot.LOW: self.modulesLow,
|
||||
Slot.RIG: self.rigs,
|
||||
Slot.SUBSYSTEM: self.subsystems,
|
||||
Slot.SERVICE: self.services}
|
||||
FittingSlot.HIGH: self.modulesHigh,
|
||||
FittingSlot.MED: self.modulesMed,
|
||||
FittingSlot.LOW: self.modulesLow,
|
||||
FittingSlot.RIG: self.rigs,
|
||||
FittingSlot.SUBSYSTEM: self.subsystems,
|
||||
FittingSlot.SERVICE: self.services}
|
||||
|
||||
def getContainerBySlot(self, slotType):
|
||||
return self.__slotContainerMap.get(slotType)
|
||||
@@ -793,10 +793,10 @@ class AbstractFit:
|
||||
|
||||
if itemSpec.charge is not None and m.isValidCharge(itemSpec.charge):
|
||||
m.charge = itemSpec.charge
|
||||
if itemSpec.offline and m.isValidState(State.OFFLINE):
|
||||
m.state = State.OFFLINE
|
||||
elif m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if itemSpec.offline and m.isValidState(FittingModuleState.OFFLINE):
|
||||
m.state = FittingModuleState.OFFLINE
|
||||
elif m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
return m
|
||||
|
||||
def addImplant(self, itemSpec):
|
||||
|
||||
@@ -28,7 +28,7 @@ from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module, State, Slot
|
||||
from eos.saveddata.module import Module, FittingModuleState, FittingSlot
|
||||
from eos.saveddata.ship import Ship
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
@@ -41,12 +41,12 @@ class ESIExportException(Exception):
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
INV_FLAGS = {
|
||||
Slot.LOW: 11,
|
||||
Slot.MED: 19,
|
||||
Slot.HIGH: 27,
|
||||
Slot.RIG: 92,
|
||||
Slot.SUBSYSTEM: 125,
|
||||
Slot.SERVICE: 164
|
||||
FittingSlot.LOW: 11,
|
||||
FittingSlot.MED: 19,
|
||||
FittingSlot.HIGH: 27,
|
||||
FittingSlot.RIG: 92,
|
||||
FittingSlot.SUBSYSTEM: 125,
|
||||
FittingSlot.SERVICE: 164
|
||||
}
|
||||
|
||||
INV_FLAG_CARGOBAY = 5
|
||||
@@ -82,7 +82,7 @@ def exportESI(ofit):
|
||||
item = nested_dict()
|
||||
slot = module.slot
|
||||
|
||||
if slot == Slot.SUBSYSTEM:
|
||||
if slot == FittingSlot.SUBSYSTEM:
|
||||
# Order of subsystem matters based on this attr. See GH issue #130
|
||||
slot = int(module.getModifiedItemAttr("subSystemSlot"))
|
||||
item['flag'] = slot
|
||||
@@ -189,8 +189,8 @@ def importESI(string):
|
||||
if m.fits(fitobj):
|
||||
fitobj.modules.append(m)
|
||||
else:
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
|
||||
moduleList.append(m)
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
|
||||
from enum import Enum
|
||||
from eos.const import MultiBuy_ItemType
|
||||
from eos.const import PortMultiBuyItemType
|
||||
|
||||
|
||||
|
||||
MULTIBUY_OPTIONS = (
|
||||
(MultiBuy_ItemType.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(MultiBuy_ItemType.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
|
||||
(MultiBuy_ItemType.CARGO.value, 'Cargo', 'Export cargo contents', True),
|
||||
(PortMultiBuyItemType.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(PortMultiBuyItemType.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
|
||||
(PortMultiBuyItemType.CARGO.value, 'Cargo', 'Export cargo contents', True),
|
||||
)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ def exportMultiBuy(fit, options):
|
||||
if module.isMutated:
|
||||
continue
|
||||
addItem(module.item)
|
||||
if module.charge and options[MultiBuy_ItemType.LOADED_CHARGES.value]:
|
||||
if module.charge and options[PortMultiBuyItemType.LOADED_CHARGES.value]:
|
||||
addItem(module.charge, module.numCharges)
|
||||
|
||||
for drone in fit.drones:
|
||||
@@ -53,11 +53,11 @@ def exportMultiBuy(fit, options):
|
||||
for fighter in fit.fighters:
|
||||
addItem(fighter.item, fighter.amountActive)
|
||||
|
||||
if options[MultiBuy_ItemType.CARGO.value]:
|
||||
if options[PortMultiBuyItemType.CARGO.value]:
|
||||
for cargo in fit.cargo:
|
||||
addItem(cargo.item, cargo.amount)
|
||||
|
||||
if options[MultiBuy_ItemType.IMPLANTS.value]:
|
||||
if options[PortMultiBuyItemType.IMPLANTS.value]:
|
||||
for implant in fit.implants:
|
||||
addItem(implant.item)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module, State, Slot
|
||||
from eos.saveddata.module import Module, FittingModuleState, FittingSlot
|
||||
from eos.saveddata.ship import Ship
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
@@ -198,8 +198,8 @@ def importXml(text, iportuser):
|
||||
m.owner = fitobj
|
||||
fitobj.modules.append(m)
|
||||
else:
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
|
||||
moduleList.append(m)
|
||||
|
||||
@@ -266,7 +266,7 @@ def exportXml(iportuser, *fits):
|
||||
|
||||
slot = module.slot
|
||||
|
||||
if slot == Slot.SUBSYSTEM:
|
||||
if slot == FittingSlot.SUBSYSTEM:
|
||||
# Order of subsystem matters based on this attr. See GH issue #130
|
||||
slotId = module.getModifiedItemAttr("subSystemSlot") - 125
|
||||
else:
|
||||
@@ -278,7 +278,7 @@ def exportXml(iportuser, *fits):
|
||||
|
||||
hardware = doc.createElement("hardware")
|
||||
hardware.setAttribute("type", module.item.name)
|
||||
slotName = Slot.getName(slot).lower()
|
||||
slotName = FittingSlot.getName(slot).lower()
|
||||
slotName = slotName if slotName != "high" else "hi"
|
||||
hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId))
|
||||
fitting.appendChild(hardware)
|
||||
|
||||
Reference in New Issue
Block a user