From 28404cd8bb48c8bedc0974cf0d13c3080fe89198 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Tue, 13 Dec 2016 23:31:39 -0800 Subject: [PATCH] bajillion pep8 fixes to pass tox --- eos/db/gamedata/item.py | 4 +- eos/db/gamedata/queries.py | 8 +- eos/db/migrations/upgrade1.py | 12 +- eos/db/migrations/upgrade10.py | 1 + eos/db/migrations/upgrade11.py | 10 +- eos/db/migrations/upgrade12.py | 10 +- eos/db/migrations/upgrade13.py | 3 +- eos/db/migrations/upgrade14.py | 6 +- eos/db/migrations/upgrade15.py | 2 +- eos/db/migrations/upgrade16.py | 1 + eos/db/migrations/upgrade17.py | 5 +- eos/db/migrations/upgrade18.py | 46 +- eos/db/migrations/upgrade19.py | 8 +- eos/db/migrations/upgrade2.py | 1 + eos/db/migrations/upgrade3.py | 1 + eos/db/migrations/upgrade4.py | 10 +- eos/db/migrations/upgrade5.py | 1 + eos/db/migrations/upgrade6.py | 4 +- eos/db/migrations/upgrade7.py | 7 +- eos/db/migrations/upgrade8.py | 12 +- eos/db/migrations/upgrade9.py | 4 +- eos/db/saveddata/fighter.py | 2 +- eos/db/saveddata/fit.py | 216 +-- eos/db/saveddata/loadDefaultDatabaseValues.py | 1 + eos/db/saveddata/queries.py | 3 - eos/effects/adaptivearmorhardener.py | 69 +- eos/effects/angelsetbonus.py | 4 +- eos/effects/armoredcommanddurationbonus.py | 5 +- eos/effects/armoredcommandmindlink.py | 17 +- eos/effects/armoredcommandstrengthbonus.py | 14 +- eos/effects/caldarishipewstrengthcb.py | 6 +- eos/effects/chargebonuswarfarecharge.py | 59 +- eos/effects/commandburstaoebonus.py | 2 + eos/effects/commandburstaoerolebonus.py | 5 +- eos/effects/commandburstreloadtimebonus.py | 2 + eos/effects/commandprocessoreffect.py | 8 +- eos/effects/commandshipmultirelayeffect.py | 7 +- .../elitebonuscommanddestroyerarmored1.py | 17 +- .../elitebonuscommanddestroyerinfo1.py | 17 +- .../elitebonuscommanddestroyershield1.py | 17 +- .../elitebonuscommanddestroyerskirmish1.py | 17 +- .../elitebonuscommandshiparmoredcs3.py | 17 +- .../elitebonuscommandshipinformationcs3.py | 17 +- eos/effects/elitebonuscommandshipsiegecs3.py | 17 +- .../elitebonuscommandshipskirmishcs3.py | 17 +- .../elitebonuscoveropsnosneutfalloff1.py | 6 +- ...bonuslogisticremotearmorrepairduration3.py | 5 +- ...ogisticremotearmorrepairoptimalfalloff1.py | 10 +- eos/effects/energyneutralizerfalloff.py | 4 +- eos/effects/entityenergyneutralizerfalloff.py | 4 +- ...ceharvestingdroneoperationdurationbonus.py | 5 +- eos/effects/iceharvestingdronespecbonus.py | 8 +- eos/effects/industrialbonusdronedamage.py | 2 +- .../informationcommanddurationbonus.py | 5 +- eos/effects/informationcommandmindlink.py | 17 +- .../informationcommandstrengthbonus.py | 14 +- .../invulnerabilitycoredurationbonus.py | 8 +- eos/effects/miningdronespecbonus.py | 8 +- eos/effects/miningforemanburstbonusics2.py | 17 +- .../miningforemanburstbonusorecapital2.py | 17 +- eos/effects/miningforemandurationbonus.py | 5 +- eos/effects/miningforemanmindlink.py | 17 +- eos/effects/miningforemanstrengthbonus.py | 14 +- eos/effects/mininginfomultiplier.py | 5 +- eos/effects/modedamptdresistspostdiv.py | 1 + eos/effects/modulebonusafterburner.py | 2 +- ...modulebonusancillaryremotearmorrepairer.py | 3 +- ...modulebonusancillaryremoteshieldbooster.py | 3 +- eos/effects/modulebonusmicrowarpdrive.py | 3 +- eos/effects/modulebonuswarfarelinkarmor.py | 1 + eos/effects/modulebonuswarfarelinkinfo.py | 1 + eos/effects/modulebonuswarfarelinkmining.py | 1 + eos/effects/modulebonuswarfarelinkshield.py | 1 + eos/effects/modulebonuswarfarelinkskirmish.py | 1 + eos/effects/moduletitaneffectgenerator.py | 12 +- eos/effects/noscpuneedbonuseffect.py | 5 +- eos/effects/powerbooster.py | 3 +- eos/effects/remotehullrepairentity.py | 3 +- eos/effects/remotehullrepairfalloff.py | 3 +- eos/effects/remotewebifierentity.py | 3 +- eos/effects/remotewebifierfalloff.py | 3 +- ...olebonusremotearmorrepairoptimalfalloff.py | 9 +- eos/effects/shieldcommandburstbonusics3.py | 17 +- .../shieldcommandburstbonusorecapital3.py | 17 +- eos/effects/shieldcommanddurationbonus.py | 5 +- eos/effects/shieldcommandmindlink.py | 17 +- eos/effects/shieldcommandstrengthbonus.py | 14 +- .../shipbonuscarriera4warfarelinksbonus.py | 22 +- .../shipbonuscarrierc4warfarelinksbonus.py | 22 +- .../shipbonuscarrierg4warfarelinksbonus.py | 22 +- .../shipbonuscarrierm4warfarelinksbonus.py | 22 +- eos/effects/shipbonuscloakcpumc2.py | 5 +- eos/effects/shipbonuscloakcpumf1.py | 5 +- .../shipbonusdronehpdamageminingics4.py | 1 - ...shipbonusdronehpdamageminingorecapital4.py | 1 - .../shipbonusdroneiceharvestingrole.py | 5 +- eos/effects/shipbonusdronerepairmc1.py | 11 +- ...pbonusforceauxiliarya4warfarelinksbonus.py | 22 +- ...pbonusforceauxiliaryc4warfarelinksbonus.py | 22 +- ...pbonusforceauxiliaryg4warfarelinksbonus.py | 22 +- ...pbonusforceauxiliarym4warfarelinksbonus.py | 22 +- ...shipbonusminingdroneamountpercentrookie.py | 1 - eos/effects/shipbonusnosoptimalfalloffac2.py | 8 +- eos/effects/shipbonussetfalloffaf2.py | 5 +- ...hipbonussupercarriera5warfarelinksbonus.py | 22 +- ...hipbonussupercarrierc5warfarelinksbonus.py | 22 +- ...hipbonussupercarrierg5warfarelinksbonus.py | 22 +- ...hipbonussupercarrierm5warfarelinksbonus.py | 22 +- .../shipmodesmallmissiledamagepostdiv.py | 6 +- eos/effects/skirmishcommanddurationbonus.py | 5 +- eos/effects/skirmishcommandmindlink.py | 17 +- eos/effects/skirmishcommandstrengthbonus.py | 14 +- ...spatialphenomenagenerationdurationbonus.py | 5 +- ...samarrdefensive2remotearmorrepairamount.py | 2 + ...systembonusamarrdefensivearmoredwarfare.py | 22 +- ...embonusamarrdefensiveinformationwarfare.py | 22 +- ...ystembonusamarrdefensiveskirmishwarfare.py | 22 +- ...defensive2remoteshieldtransporteramount.py | 2 + ...bonuscaldaridefensiveinformationwarfare.py | 22 +- ...systembonuscaldaridefensivesiegewarfare.py | 22 +- ...tembonuscaldaridefensiveskirmishwarfare.py | 22 +- ...llentedefensive2remotearmorrepairamount.py | 2 + ...tembonusgallentedefensivearmoredwarfare.py | 22 +- ...onusgallentedefensiveinformationwarfare.py | 22 +- ...embonusgallentedefensiveskirmishwarfare.py | 22 +- ...defensive2remoteshieldtransporteramount.py | 2 + ...tembonusminmatardefensivearmoredwarfare.py | 22 +- ...ystembonusminmatardefensivesiegewarfare.py | 22 +- ...embonusminmatardefensiveskirmishwarfare.py | 22 +- eos/effects/systemarmorrepairamount.py | 4 +- .../systemshieldrepairamountshieldskills.py | 4 +- eos/effects/zcolinorcasurveyscannerbonus.py | 5 +- eos/effects/zcolinorcatractorrangebonus.py | 5 +- eos/effects/zcolinorcatractorvelocitybonus.py | 3 +- eos/graph/fitDps.py | 365 +++-- eos/modifiedAttributeDict.py | 4 +- eos/saveddata/booster.py | 3 +- eos/saveddata/fighter.py | 7 +- eos/saveddata/fighterAbility.py | 8 +- eos/saveddata/fit.py | 6 +- eos/saveddata/module.py | 1450 ++++++++--------- eos/saveddata/targetResists.py | 7 +- gui/builtinContextMenus/__init__.py | 2 +- gui/builtinContextMenus/amount.py | 11 +- gui/builtinContextMenus/cargo.py | 3 +- .../changeAffectingSkills.py | 3 +- gui/builtinContextMenus/damagePattern.py | 7 +- gui/builtinContextMenus/droneRemoveStack.py | 2 + gui/builtinContextMenus/droneSplit.py | 2 - gui/builtinContextMenus/factorReload.py | 71 +- gui/builtinContextMenus/fighterAbilities.py | 2 + gui/builtinContextMenus/implantSets.py | 6 +- gui/builtinContextMenus/itemRemove.py | 8 +- gui/builtinContextMenus/marketJump.py | 2 +- gui/builtinContextMenus/metaSwap.py | 3 +- gui/builtinContextMenus/moduleAmmoPicker.py | 6 +- .../moduleGlobalAmmoPicker.py | 5 +- gui/builtinContextMenus/openFit.py | 1 + gui/builtinContextMenus/priceClear.py | 1 + gui/builtinContextMenus/shipJump.py | 3 +- gui/builtinContextMenus/tacticalMode.py | 1 + gui/builtinContextMenus/targetResists.py | 11 +- gui/builtinContextMenus/whProjector.py | 3 +- gui/builtinPreferenceViews/__init__.py | 3 +- gui/builtinPreferenceViews/dummyView.py | 189 ++- .../pyfaCrestPreferences.py | 19 +- .../pyfaGaugePreferences.py | 37 +- .../pyfaGeneralPreferences.py | 30 +- .../pyfaHTMLExportPreferences.py | 14 +- .../pyfaNetworkPreferences.py | 12 +- .../pyfaUpdatePreferences.py | 9 +- gui/builtinStatsViews/firepowerViewFull.py | 17 +- gui/builtinStatsViews/miningyieldViewFull.py | 18 +- gui/builtinStatsViews/rechargeViewFull.py | 3 +- gui/builtinStatsViews/resistancesViewFull.py | 90 +- gui/builtinStatsViews/resourcesViewFull.py | 15 +- .../targetingMiscViewFull.py | 18 +- gui/builtinViewColumns/baseIcon.py | 91 +- gui/builtinViewColumns/baseName.py | 3 +- gui/builtinViewColumns/misc.py | 1102 +++++++------ gui/builtinViewColumns/propertyDisplay.py | 2 - gui/builtinViewColumns/state.py | 6 +- gui/builtinViews/entityEditor.py | 14 +- gui/builtinViews/fittingView.py | 27 +- gui/builtinViews/fleetView.py | 6 +- gui/builtinViews/implantEditor.py | 11 +- gui/characterEditor.py | 4 +- gui/commandView.py | 1 - gui/fighterView.py | 4 +- gui/itemStats.py | 18 +- gui/mainFrame.py | 6 +- gui/projectedView.py | 4 +- gui/shipBrowser.py | 4 +- gui/updateDialog.py | 2 - gui/utils/animEffects.py | 1 - gui/utils/compat.py | 3 +- gui/utils/drawUtils.py | 1 - gui/utils/exportHtml.py | 17 +- gui/utils/numberFormatter.py | 10 +- pyfa.py | 2 +- service/fit.py | 8 +- service/market.py | 21 +- service/port.py | 6 +- service/prefetch.py | 6 +- service/pycrest/weak_ciphers.py | 3 +- tox.ini | 2 +- 206 files changed, 3128 insertions(+), 2391 deletions(-) diff --git a/eos/db/gamedata/item.py b/eos/db/gamedata/item.py index a23c3a786..f0100e761 100644 --- a/eos/db/gamedata/item.py +++ b/eos/db/gamedata/item.py @@ -39,8 +39,8 @@ items_table = Table("invtypes", gamedata_meta, Column("iconID", Integer, ForeignKey("icons.iconID")), Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True)) -from .metaGroup import metatypes_table -from .traits import traits_table +from .metaGroup import metatypes_table # noqa +from .traits import traits_table # noqa mapper(Item, items_table, properties={"group": relation(Group, backref="items"), diff --git a/eos/db/gamedata/queries.py b/eos/db/gamedata/queries.py index 66c5ac9b4..3a036488d 100644 --- a/eos/db/gamedata/queries.py +++ b/eos/db/gamedata/queries.py @@ -21,7 +21,9 @@ from sqlalchemy.orm import join, exc from sqlalchemy.sql import and_, or_, select import eos.config -from eos.gamedata import Item, Attribute +# TODO: Unsure which item the code below needs :( +# from eos.gamedata import Item +from eos.gamedata import Attribute from eos.db import gamedata_session from eos.db.gamedata.metaGroup import metatypes_table, items_table from eos.db.util import processEager, processWhere @@ -282,8 +284,8 @@ def directAttributeRequest(itemIDs, attrIDs): raise TypeError("All itemIDs must be integer") q = select((Item.typeID, Attribute.attributeID, Attribute.value), - and_(Attribute.attributeID.in_(attrIDs), Item.typeID.in_(itemIDs)), - from_obj=[join(Attribute, Item)]) + and_(Attribute.attributeID.in_(attrIDs), Item.typeID.in_(itemIDs)), + from_obj=[join(Attribute, Item)]) result = gamedata_session.execute(q).fetchall() return result diff --git a/eos/db/migrations/upgrade1.py b/eos/db/migrations/upgrade1.py index fc2148734..5eb3478c6 100644 --- a/eos/db/migrations/upgrade1.py +++ b/eos/db/migrations/upgrade1.py @@ -45,7 +45,7 @@ CONVERSIONS = { 8746, # Quantum Co-Processor 8745, # Photonic CPU Enhancer 15425, # Naiyon's Modified Co-Processor (never existed but convert - # anyway as some fits may include it) + # anyway as some fits may include it) ], 8748: [ # Upgraded Co-Processor 8747, # Nanomechanical CPU Enhancer I @@ -70,7 +70,7 @@ CONVERSIONS = { 16543, # Micro 'Vigor' Core Augmentation ], 8089: [ # Compact Light Missile Launcher - 8093, # Prototype 'Arbalest' Light Missile Launcher + 8093, # Prototype 'Arbalest' Light Missile Launcher ], 8091: [ # Ample Light Missile Launcher 7993, # Experimental TE-2100 Light Missile Launcher @@ -82,6 +82,7 @@ CONVERSIONS = { ] } + def upgrade(saveddata_engine): # Update fits schema to include target resists attribute try: @@ -92,6 +93,7 @@ def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade10.py b/eos/db/migrations/upgrade10.py index 0bfb0f0ee..1ceeb59e8 100644 --- a/eos/db/migrations/upgrade10.py +++ b/eos/db/migrations/upgrade10.py @@ -6,6 +6,7 @@ Migration 10 import sqlalchemy + def upgrade(saveddata_engine): # Update projectedFits schema to include active attribute try: diff --git a/eos/db/migrations/upgrade11.py b/eos/db/migrations/upgrade11.py index 7265e064a..475537b01 100644 --- a/eos/db/migrations/upgrade11.py +++ b/eos/db/migrations/upgrade11.py @@ -7,7 +7,6 @@ Migration 11 modules with their new replacements """ - CONVERSIONS = { 16467: ( # Medium Gremlin Compact Energy Neutralizer 16471, # Medium Unstable Power Fluctuator I @@ -106,11 +105,12 @@ CONVERSIONS = { ), } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade12.py b/eos/db/migrations/upgrade12.py index dc0eee511..6e3a1d73b 100644 --- a/eos/db/migrations/upgrade12.py +++ b/eos/db/migrations/upgrade12.py @@ -7,7 +7,6 @@ Migration 12 modules with their new replacements """ - CONVERSIONS = { 16457: ( # Crosslink Compact Ballistic Control System 16459, # Muon Coil Bolt Array I @@ -330,11 +329,12 @@ CONVERSIONS = { ), } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade13.py b/eos/db/migrations/upgrade13.py index 047dc7129..b8af898e8 100644 --- a/eos/db/migrations/upgrade13.py +++ b/eos/db/migrations/upgrade13.py @@ -6,10 +6,11 @@ Migration 13 import sqlalchemy + def upgrade(saveddata_engine): # Update fits schema to include implant location attribute try: saveddata_engine.execute("SELECT implantLocation FROM fits LIMIT 1") except sqlalchemy.exc.DatabaseError: saveddata_engine.execute("ALTER TABLE fits ADD COLUMN implantLocation INTEGER;") - saveddata_engine.execute("UPDATE fits SET implantLocation = 0") \ No newline at end of file + saveddata_engine.execute("UPDATE fits SET implantLocation = 0") diff --git a/eos/db/migrations/upgrade14.py b/eos/db/migrations/upgrade14.py index 8b39947b2..c62afa6d1 100644 --- a/eos/db/migrations/upgrade14.py +++ b/eos/db/migrations/upgrade14.py @@ -6,8 +6,10 @@ Migration 14 import sqlalchemy + def upgrade(saveddata_engine): - if saveddata_engine.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='fighters'").scalar() == 'fighters': + if saveddata_engine.execute( + "SELECT name FROM sqlite_master WHERE type='table' AND name='fighters'").scalar() == 'fighters': # Fighters table exists try: saveddata_engine.execute("SELECT active FROM fighters LIMIT 1") @@ -16,4 +18,4 @@ def upgrade(saveddata_engine): # (they will be recreated) saveddata_engine.execute("DROP TABLE fighters") - saveddata_engine.execute("DROP TABLE fightersAbilities") \ No newline at end of file + saveddata_engine.execute("DROP TABLE fightersAbilities") diff --git a/eos/db/migrations/upgrade15.py b/eos/db/migrations/upgrade15.py index d3c57a957..13852b035 100644 --- a/eos/db/migrations/upgrade15.py +++ b/eos/db/migrations/upgrade15.py @@ -6,8 +6,8 @@ Migration 15 import sqlalchemy -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): sql = """ DELETE FROM modules WHERE ID IN ( diff --git a/eos/db/migrations/upgrade16.py b/eos/db/migrations/upgrade16.py index 7dfaac97c..15f9b8786 100644 --- a/eos/db/migrations/upgrade16.py +++ b/eos/db/migrations/upgrade16.py @@ -6,6 +6,7 @@ Migration 16 import sqlalchemy + def upgrade(saveddata_engine): # Update fits schema to include notes attribute try: diff --git a/eos/db/migrations/upgrade17.py b/eos/db/migrations/upgrade17.py index c3d996899..1d6a4cff8 100644 --- a/eos/db/migrations/upgrade17.py +++ b/eos/db/migrations/upgrade17.py @@ -33,7 +33,8 @@ def upgrade(saveddata_engine): inserts.append({"boosterID": value, "boostedID": boosted, "active": 1}) try: - saveddata_session.execute(commandFits_table.insert(), {"boosterID": value, "boostedID": boosted, "active": 1}) - except Exception, e: + saveddata_session.execute(commandFits_table.insert(), + {"boosterID": value, "boostedID": boosted, "active": 1}) + except Exception: pass saveddata_session.commit() diff --git a/eos/db/migrations/upgrade18.py b/eos/db/migrations/upgrade18.py index fadc65134..4a13b7d57 100644 --- a/eos/db/migrations/upgrade18.py +++ b/eos/db/migrations/upgrade18.py @@ -4,27 +4,26 @@ Migration 8 - Converts modules from old Warfare Links to Command Modules """ - CONVERSIONS = { 42526: ( # Armor Command Burst I - 20069, # Armored Warfare Link - Damage Control I - 20409, # Armored Warfare Link - Passive Defense I - 22227, # Armored Warfare Link - Rapid Repair I + 20069, # Armored Warfare Link - Damage Control I + 20409, # Armored Warfare Link - Passive Defense I + 22227, # Armored Warfare Link - Rapid Repair I ), 43552: ( # Armor Command Burst II - 4264, # Armored Warfare Link - Damage Control II - 4266, # Armored Warfare Link - Passive Defense II - 4266, # Armored Warfare Link - Rapid Repair II + 4264, # Armored Warfare Link - Damage Control II + 4266, # Armored Warfare Link - Passive Defense II + 4266, # Armored Warfare Link - Rapid Repair II ), 42527: ( # Information Command Burst I - 11052, # Information Warfare Link - Sensor Integrity I - 20405, # Information Warfare Link - Recon Operation I - 20406, # Information Warfare Link - Electronic Superiority I + 11052, # Information Warfare Link - Sensor Integrity I + 20405, # Information Warfare Link - Recon Operation I + 20406, # Information Warfare Link - Electronic Superiority I ), 43554: ( # Information Command Burst II - 4268, # Information Warfare Link - Electronic Superiority II - 4270, # Information Warfare Link - Recon Operation II - 4272, # Information Warfare Link - Sensor Integrity II + 4268, # Information Warfare Link - Electronic Superiority II + 4270, # Information Warfare Link - Recon Operation II + 4272, # Information Warfare Link - Sensor Integrity II ), 42529: ( # Shield Command Burst I 20124, # Siege Warfare Link - Active Shielding I @@ -34,17 +33,17 @@ CONVERSIONS = { 43555: ( # Shield Command Burst II 4280, # Siege Warfare Link - Active Shielding II 4282, # Siege Warfare Link - Shield Efficiency II - 4284 # Siege Warfare Link - Shield Harmonizing II + 4284 # Siege Warfare Link - Shield Harmonizing II ), 42530: ( # Skirmish Command Burst I - 11017, # Skirmish Warfare Link - Interdiction Maneuvers I - 20070, # Skirmish Warfare Link - Evasive Maneuvers I - 20408, # Skirmish Warfare Link - Rapid Deployment I + 11017, # Skirmish Warfare Link - Interdiction Maneuvers I + 20070, # Skirmish Warfare Link - Evasive Maneuvers I + 20408, # Skirmish Warfare Link - Rapid Deployment I ), 43556: ( # Skirmish Command Burst II 4286, # Skirmish Warfare Link - Evasive Maneuvers II 4288, # Skirmish Warfare Link - Interdiction Maneuvers II - 4290 # Skirmish Warfare Link - Rapid Deployment II + 4290 # Skirmish Warfare Link - Rapid Deployment II ), 42528: ( # Mining Foreman Burst I 22553, # Mining Foreman Link - Harvester Capacitor Efficiency I @@ -54,15 +53,16 @@ CONVERSIONS = { 43551: ( # Mining Foreman Burst II 4274, # Mining Foreman Link - Harvester Capacitor Efficiency II 4276, # Mining Foreman Link - Laser Optimization II - 4278 # Mining Foreman Link - Mining Laser Field Enhancement II + 4278 # Mining Foreman Link - Mining Laser Field Enhancement II ), } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade19.py b/eos/db/migrations/upgrade19.py index 4d93edc7c..090f07dda 100644 --- a/eos/db/migrations/upgrade19.py +++ b/eos/db/migrations/upgrade19.py @@ -11,10 +11,10 @@ def upgrade(saveddata_engine): from eos.db import saveddata_session sql = """ - DELETE FROM commandFits - WHERE boosterID NOT IN (select ID from fits) - OR boostedID NOT IN (select ID from fits) - """ + DELETE FROM commandFits + WHERE boosterID NOT IN (select ID from fits) + OR boostedID NOT IN (select ID from fits) + """ saveddata_session.execute(sql) saveddata_session.commit() diff --git a/eos/db/migrations/upgrade2.py b/eos/db/migrations/upgrade2.py index 917a5218e..526177896 100644 --- a/eos/db/migrations/upgrade2.py +++ b/eos/db/migrations/upgrade2.py @@ -6,6 +6,7 @@ Migration 2 import sqlalchemy + def upgrade(saveddata_engine): # Update characters schema to include default chars try: diff --git a/eos/db/migrations/upgrade3.py b/eos/db/migrations/upgrade3.py index 0350ded72..ccc481047 100644 --- a/eos/db/migrations/upgrade3.py +++ b/eos/db/migrations/upgrade3.py @@ -6,6 +6,7 @@ Migration 3 import sqlalchemy + def upgrade(saveddata_engine): try: saveddata_engine.execute("SELECT modeID FROM fits LIMIT 1") diff --git a/eos/db/migrations/upgrade4.py b/eos/db/migrations/upgrade4.py index 87906cffc..f8c670684 100644 --- a/eos/db/migrations/upgrade4.py +++ b/eos/db/migrations/upgrade4.py @@ -10,7 +10,6 @@ Migration 4 and output of itemDiff.py """ - CONVERSIONS = { 506: ( # 'Basic' Capacitor Power Relay 8205, # Alpha Reactor Control: Capacitor Power Relay @@ -131,11 +130,12 @@ CONVERSIONS = { ), } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade5.py b/eos/db/migrations/upgrade5.py index cf6a3385d..1f5201cf5 100644 --- a/eos/db/migrations/upgrade5.py +++ b/eos/db/migrations/upgrade5.py @@ -4,5 +4,6 @@ Migration 5 Simply deletes damage profiles with a blank name. See GH issue #256 """ + def upgrade(saveddata_engine): saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ?', ("",)) diff --git a/eos/db/migrations/upgrade6.py b/eos/db/migrations/upgrade6.py index ee8a091e6..724a94008 100644 --- a/eos/db/migrations/upgrade6.py +++ b/eos/db/migrations/upgrade6.py @@ -4,6 +4,8 @@ Migration 6 Overwrites damage profile 0 to reset bad uniform values (bad values set with bug) """ + def upgrade(saveddata_engine): saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1")) - saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?)', (1, "Uniform", 25, 25, 25, 25, None)) + saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?)', + (1, "Uniform", 25, 25, 25, 25, None)) diff --git a/eos/db/migrations/upgrade7.py b/eos/db/migrations/upgrade7.py index 226f84b3a..fbb74f910 100644 --- a/eos/db/migrations/upgrade7.py +++ b/eos/db/migrations/upgrade7.py @@ -8,17 +8,16 @@ Migration 7 Pyfa. """ - CONVERSIONS = { 640: ( # Scorpion 4005, # Scorpion Ishukone Watch ) } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert ships for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "fits" SET "shipID" = ? WHERE "shipID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "fits" SET "shipID" = ? WHERE "shipID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade8.py b/eos/db/migrations/upgrade8.py index 9d2c04321..19185443b 100644 --- a/eos/db/migrations/upgrade8.py +++ b/eos/db/migrations/upgrade8.py @@ -7,7 +7,6 @@ Migration 8 modules with their new replacements """ - CONVERSIONS = { 8529: ( # Large F-S9 Regolith Compact Shield Extender 8409, # Large Subordinate Screen Stabilizer I @@ -71,15 +70,16 @@ CONVERSIONS = { 11321, # 800mm Reinforced Nanofiber Plates I ), 11317: ( # 800mm Rolled Tungsten Compact Plates - 11315, # 800mm Reinforced Titanium Plates I + 11315, # 800mm Reinforced Titanium Plates I ), } -def upgrade(saveddata_engine): +def upgrade(saveddata_engine): # Convert modules for replacement_item, list in CONVERSIONS.iteritems(): for retired_item in list: - saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (replacement_item, retired_item)) - + saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) + saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', + (replacement_item, retired_item)) diff --git a/eos/db/migrations/upgrade9.py b/eos/db/migrations/upgrade9.py index ae7b66ad5..a2f5b6148 100644 --- a/eos/db/migrations/upgrade9.py +++ b/eos/db/migrations/upgrade9.py @@ -16,8 +16,10 @@ CREATE TABLE boostersTemp ( ) """ + def upgrade(saveddata_engine): saveddata_engine.execute(tmpTable) - saveddata_engine.execute("INSERT INTO boostersTemp (ID, itemID, fitID, active) SELECT ID, itemID, fitID, active FROM boosters") + saveddata_engine.execute( + "INSERT INTO boostersTemp (ID, itemID, fitID, active) SELECT ID, itemID, fitID, active FROM boosters") saveddata_engine.execute("DROP TABLE boosters") saveddata_engine.execute("ALTER TABLE boostersTemp RENAME TO boosters") diff --git a/eos/db/saveddata/fighter.py b/eos/db/saveddata/fighter.py index 7074369da..179edab11 100644 --- a/eos/db/saveddata/fighter.py +++ b/eos/db/saveddata/fighter.py @@ -18,7 +18,7 @@ # =============================================================================== from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean -from sqlalchemy.orm import * +from sqlalchemy.orm import mapper, relation from eos.db import saveddata_meta from eos.types import Fighter, Fit diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 4e0afeb28..c698a4ec7 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -17,11 +17,11 @@ # along with eos. If not, see . # =============================================================================== -from sqlalchemy import * from sqlalchemy.ext.associationproxy import association_proxy -from sqlalchemy.orm import * from sqlalchemy.orm.collections import attribute_mapped_collection from sqlalchemy.sql import and_ +from sqlalchemy.orm import relation, reconstructor, mapper, relationship +from sqlalchemy import ForeignKey, Column, Integer, String, Table, Boolean from eos.db import saveddata_meta from eos.db import saveddata_session @@ -30,8 +30,9 @@ from eos.db.saveddata.drone import drones_table from eos.db.saveddata.fighter import fighters_table from eos.db.saveddata.implant import fitImplants_table from eos.db.saveddata.module import modules_table -from eos.effectHandlerHelpers import HandledModuleList, HandledImplantBoosterList, HandledProjectedModList, HandledDroneCargoList, HandledProjectedDroneList -from eos.types import Fit, Module, User, Booster, Drone, Fighter, Cargo, Implant, Character, DamagePattern, \ +from eos.effectHandlerHelpers import HandledModuleList, HandledImplantBoosterList, HandledProjectedModList, \ + HandledDroneCargoList, HandledProjectedDroneList +from eos.types import Fit as es_Fit, Module, User, Booster, Drone, Fighter, Cargo, Implant, Character, DamagePattern, \ TargetResists, ImplantLocation fits_table = Table("fits", saveddata_meta, @@ -46,7 +47,7 @@ fits_table = Table("fits", saveddata_meta, Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True), Column("modeID", Integer, nullable=True), Column("implantLocation", Integer, nullable=False, default=ImplantLocation.FIT), - Column("notes", String, nullable = True), + Column("notes", String, nullable=True), ) projectedFits_table = Table("projectedFits", saveddata_meta, @@ -62,6 +63,7 @@ commandFits_table = Table("commandFits", saveddata_meta, Column("active", Boolean, nullable=False, default=1) ) + class ProjectedFit(object): def __init__(self, sourceID, source_fit, amount=1, active=True): self.sourceID = sourceID @@ -92,6 +94,7 @@ class ProjectedFit(object): self.sourceID, self.victimID, self.amount, self.active, hex(id(self)) ) + class CommandFit(object): def __init__(self, boosterID, booster_fit, active=True): self.boosterID = boosterID @@ -111,116 +114,117 @@ class CommandFit(object): self.boosterID, self.boostedID, self.active, hex(id(self)) ) -Fit._Fit__projectedFits = association_proxy( + +es_Fit._Fit__projectedFits = association_proxy( "victimOf", # look at the victimOf association... "source_fit", # .. and return the source fits creator=lambda sourceID, source_fit: ProjectedFit(sourceID, source_fit) ) -Fit._Fit__commandFits = association_proxy( +es_Fit._Fit__commandFits = association_proxy( "boostedOf", # look at the boostedOf association... "booster_fit", # .. and return the booster fit creator=lambda boosterID, booster_fit: CommandFit(boosterID, booster_fit) ) -mapper(Fit, fits_table, - properties={ - "_Fit__modules": relation( - Module, - collection_class=HandledModuleList, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), - order_by=modules_table.c.position, - cascade='all, delete, delete-orphan'), - "_Fit__projectedModules": relation( - Module, - collection_class=HandledProjectedModList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), - "owner": relation( - User, - backref="fits"), - "itemID": fits_table.c.shipID, - "shipID": fits_table.c.shipID, - "_Fit__boosters": relation( - Booster, - collection_class=HandledImplantBoosterList, - cascade='all, delete, delete-orphan', - single_parent=True), - "_Fit__drones": relation( - Drone, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), - "_Fit__fighters": relation( - Fighter, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), - "_Fit__cargo": relation( - Cargo, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(cargo_table.c.fitID == fits_table.c.ID)), - "_Fit__projectedDrones": relation( - Drone, - collection_class=HandledProjectedDroneList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), - "_Fit__projectedFighters": relation( - Fighter, - collection_class=HandledProjectedDroneList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), - "_Fit__implants": relation( - Implant, - collection_class=HandledImplantBoosterList, - cascade='all, delete, delete-orphan', - backref='fit', - single_parent=True, - primaryjoin=fitImplants_table.c.fitID == fits_table.c.ID, - secondaryjoin=fitImplants_table.c.implantID == Implant.ID, - secondary=fitImplants_table), - "_Fit__character": relation( - Character, - backref="fits"), - "_Fit__damagePattern": relation(DamagePattern), - "_Fit__targetResists": relation(TargetResists), - "projectedOnto": relationship( - ProjectedFit, - primaryjoin=projectedFits_table.c.sourceID == fits_table.c.ID, - backref='source_fit', - collection_class=attribute_mapped_collection('victimID'), - cascade='all, delete, delete-orphan'), - "victimOf": relationship( - ProjectedFit, - primaryjoin=fits_table.c.ID == projectedFits_table.c.victimID, - backref='victim_fit', - collection_class=attribute_mapped_collection('sourceID'), - cascade='all, delete, delete-orphan'), - "boostedOnto": relationship( - CommandFit, - primaryjoin=commandFits_table.c.boosterID == fits_table.c.ID, - backref='booster_fit', - collection_class=attribute_mapped_collection('boostedID'), - cascade='all, delete, delete-orphan'), - "boostedOf": relationship( - CommandFit, - primaryjoin=fits_table.c.ID == commandFits_table.c.boostedID, - backref='boosted_fit', - collection_class=attribute_mapped_collection('boosterID'), - cascade='all, delete, delete-orphan'), - } -) +mapper(es_Fit, fits_table, + properties={ + "_Fit__modules": relation( + Module, + collection_class=HandledModuleList, + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa + order_by=modules_table.c.position, + cascade='all, delete, delete-orphan'), + "_Fit__projectedModules": relation( + Module, + collection_class=HandledProjectedModList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa + "owner": relation( + User, + backref="fits"), + "itemID": fits_table.c.shipID, + "shipID": fits_table.c.shipID, + "_Fit__boosters": relation( + Booster, + collection_class=HandledImplantBoosterList, + cascade='all, delete, delete-orphan', + single_parent=True), + "_Fit__drones": relation( + Drone, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa + "_Fit__fighters": relation( + Fighter, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa + "_Fit__cargo": relation( + Cargo, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(cargo_table.c.fitID == fits_table.c.ID)), + "_Fit__projectedDrones": relation( + Drone, + collection_class=HandledProjectedDroneList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa + "_Fit__projectedFighters": relation( + Fighter, + collection_class=HandledProjectedDroneList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa + "_Fit__implants": relation( + Implant, + collection_class=HandledImplantBoosterList, + cascade='all, delete, delete-orphan', + backref='fit', + single_parent=True, + primaryjoin=fitImplants_table.c.fitID == fits_table.c.ID, + secondaryjoin=fitImplants_table.c.implantID == Implant.ID, + secondary=fitImplants_table), + "_Fit__character": relation( + Character, + backref="fits"), + "_Fit__damagePattern": relation(DamagePattern), + "_Fit__targetResists": relation(TargetResists), + "projectedOnto": relationship( + ProjectedFit, + primaryjoin=projectedFits_table.c.sourceID == fits_table.c.ID, + backref='source_fit', + collection_class=attribute_mapped_collection('victimID'), + cascade='all, delete, delete-orphan'), + "victimOf": relationship( + ProjectedFit, + primaryjoin=fits_table.c.ID == projectedFits_table.c.victimID, + backref='victim_fit', + collection_class=attribute_mapped_collection('sourceID'), + cascade='all, delete, delete-orphan'), + "boostedOnto": relationship( + CommandFit, + primaryjoin=commandFits_table.c.boosterID == fits_table.c.ID, + backref='booster_fit', + collection_class=attribute_mapped_collection('boostedID'), + cascade='all, delete, delete-orphan'), + "boostedOf": relationship( + CommandFit, + primaryjoin=fits_table.c.ID == commandFits_table.c.boostedID, + backref='boosted_fit', + collection_class=attribute_mapped_collection('boosterID'), + cascade='all, delete, delete-orphan'), + } + ) mapper(ProjectedFit, projectedFits_table, - properties={ - "_ProjectedFit__amount": projectedFits_table.c.amount, - } -) + properties={ + "_ProjectedFit__amount": projectedFits_table.c.amount, + } + ) -mapper(CommandFit, commandFits_table) \ No newline at end of file +mapper(CommandFit, commandFits_table) diff --git a/eos/db/saveddata/loadDefaultDatabaseValues.py b/eos/db/saveddata/loadDefaultDatabaseValues.py index 6769ed71c..29534bc5e 100644 --- a/eos/db/saveddata/loadDefaultDatabaseValues.py +++ b/eos/db/saveddata/loadDefaultDatabaseValues.py @@ -21,6 +21,7 @@ import eos.db from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern from eos.saveddata.targetResists import TargetResists as es_TargetResists + class ImportError(Exception): pass diff --git a/eos/db/saveddata/queries.py b/eos/db/saveddata/queries.py index bcecb3b69..07060d7c9 100644 --- a/eos/db/saveddata/queries.py +++ b/eos/db/saveddata/queries.py @@ -34,7 +34,6 @@ if configVal is True: itemCache = {} queryCache = {} - def cachedQuery(type, amount, *keywords): itemCache[type] = localItemCache = weakref.WeakValueDictionary() queryCache[type] = typeQueryCache = {} @@ -93,7 +92,6 @@ if configVal is True: return deco - def removeCachedEntry(type, ID): if type not in queryCache: return @@ -123,7 +121,6 @@ else: return deco - def removeCachedEntry(*args, **kwargs): return diff --git a/eos/effects/adaptivearmorhardener.py b/eos/effects/adaptivearmorhardener.py index bf20478c2..33e9f143c 100644 --- a/eos/effects/adaptivearmorhardener.py +++ b/eos/effects/adaptivearmorhardener.py @@ -8,13 +8,15 @@ logger = logging.getLogger(__name__) runTime = "late" type = "active" + + def handler(fit, module, context): damagePattern = fit.damagePattern # Skip if there is no damage pattern. Example: projected ships or fleet boosters if damagePattern: - #logger.debug("Damage Pattern: %f/%f/%f/%f", damagePattern.emAmount, damagePattern.thermalAmount, damagePattern.kineticAmount, damagePattern.explosiveAmount) - #logger.debug("Original Armor Resists: %f/%f/%f/%f", fit.ship.getModifiedItemAttr('armorEmDamageResonance'), fit.ship.getModifiedItemAttr('armorThermalDamageResonance'), fit.ship.getModifiedItemAttr('armorKineticDamageResonance'), fit.ship.getModifiedItemAttr('armorExplosiveDamageResonance')) + # logger.debug("Damage Pattern: %f/%f/%f/%f", damagePattern.emAmount, damagePattern.thermalAmount, damagePattern.kineticAmount, damagePattern.explosiveAmount) + # logger.debug("Original Armor Resists: %f/%f/%f/%f", fit.ship.getModifiedItemAttr('armorEmDamageResonance'), fit.ship.getModifiedItemAttr('armorThermalDamageResonance'), fit.ship.getModifiedItemAttr('armorKineticDamageResonance'), fit.ship.getModifiedItemAttr('armorExplosiveDamageResonance')) # Populate a tuple with the damage profile modified by current armor resists. baseDamageTaken = ( @@ -23,35 +25,36 @@ def handler(fit, module, context): damagePattern.kineticAmount * fit.ship.getModifiedItemAttr('armorKineticDamageResonance'), damagePattern.explosiveAmount * fit.ship.getModifiedItemAttr('armorExplosiveDamageResonance'), ) - #logger.debug("Damage Adjusted for Armor Resists: %f/%f/%f/%f", baseDamageTaken[0], baseDamageTaken[1], baseDamageTaken[2], baseDamageTaken[3]) + # logger.debug("Damage Adjusted for Armor Resists: %f/%f/%f/%f", baseDamageTaken[0], baseDamageTaken[1], baseDamageTaken[2], baseDamageTaken[3]) - resistanceShiftAmount = module.getModifiedItemAttr('resistanceShiftAmount') / 100 # The attribute is in percent and we want a fraction + resistanceShiftAmount = module.getModifiedItemAttr( + 'resistanceShiftAmount') / 100 # The attribute is in percent and we want a fraction RAHResistance = [ - module.getModifiedItemAttr('armorEmDamageResonance'), - module.getModifiedItemAttr('armorThermalDamageResonance'), - module.getModifiedItemAttr('armorKineticDamageResonance'), + module.getModifiedItemAttr('armorEmDamageResonance'), + module.getModifiedItemAttr('armorThermalDamageResonance'), + module.getModifiedItemAttr('armorKineticDamageResonance'), module.getModifiedItemAttr('armorExplosiveDamageResonance'), ] - + # Simulate RAH cycles until the RAH either stops changing or enters a loop. # The number of iterations is limited to prevent an infinite loop if something goes wrong. cycleList = [] loopStart = -20 for num in range(50): - #logger.debug("Starting cycle %d.", num) + # logger.debug("Starting cycle %d.", num) # The strange order is to emulate the ingame sorting when different types have taken the same amount of damage. # This doesn't take into account stacking penalties. In a few cases fitting a Damage Control causes an inaccurate result. damagePattern_tuples = [ (0, baseDamageTaken[0] * RAHResistance[0], RAHResistance[0]), - (3, baseDamageTaken[3] * RAHResistance[3], RAHResistance[3]), + (3, baseDamageTaken[3] * RAHResistance[3], RAHResistance[3]), (2, baseDamageTaken[2] * RAHResistance[2], RAHResistance[2]), (1, baseDamageTaken[1] * RAHResistance[1], RAHResistance[1]), ] - #logger.debug("Damage taken this cycle: %f/%f/%f/%f", damagePattern_tuples[0][1], damagePattern_tuples[3][1], damagePattern_tuples[2][1], damagePattern_tuples[1][1]) - + # logger.debug("Damage taken this cycle: %f/%f/%f/%f", damagePattern_tuples[0][1], damagePattern_tuples[3][1], damagePattern_tuples[2][1], damagePattern_tuples[1][1]) + # Sort the tuple to drop the highest damage value to the bottom sortedDamagePattern_tuples = sorted(damagePattern_tuples, key=lambda damagePattern: damagePattern[1]) - + if sortedDamagePattern_tuples[2][1] == 0: # One damage type: the top damage type takes from the other three # Since the resistances not taking damage will end up going to the type taking damage we just do the whole thing at once. @@ -72,41 +75,47 @@ def handler(fit, module, context): change1 = min(resistanceShiftAmount, 1 - sortedDamagePattern_tuples[1][2]) change2 = -(change0 + change1) / 2 change3 = -(change0 + change1) / 2 - + RAHResistance[sortedDamagePattern_tuples[0][0]] = sortedDamagePattern_tuples[0][2] + change0 RAHResistance[sortedDamagePattern_tuples[1][0]] = sortedDamagePattern_tuples[1][2] + change1 RAHResistance[sortedDamagePattern_tuples[2][0]] = sortedDamagePattern_tuples[2][2] + change2 RAHResistance[sortedDamagePattern_tuples[3][0]] = sortedDamagePattern_tuples[3][2] + change3 - #logger.debug("Resistances shifted to %f/%f/%f/%f", RAHResistance[0], RAHResistance[1], RAHResistance[2], RAHResistance[3]) - + # logger.debug("Resistances shifted to %f/%f/%f/%f", RAHResistance[0], RAHResistance[1], RAHResistance[2], RAHResistance[3]) + # See if the current RAH profile has been encountered before, indicating a loop. for i, val in enumerate(cycleList): - tolerance = 1e-06 - if abs(RAHResistance[0] - val[0]) <= tolerance and abs(RAHResistance[1] - val[1]) <= tolerance and abs(RAHResistance[2] - val[2]) <= tolerance and abs(RAHResistance[3] - val[3]) <= tolerance: + tolerance = 1e-06 + if abs(RAHResistance[0] - val[0]) <= tolerance and \ + abs(RAHResistance[1] - val[1]) <= tolerance and \ + abs(RAHResistance[2] - val[2]) <= tolerance and \ + abs(RAHResistance[3] - val[3]) <= tolerance: loopStart = i - #logger.debug("Loop found: %d-%d", loopStart, num) + # logger.debug("Loop found: %d-%d", loopStart, num) break - if loopStart >= 0: break - + if loopStart >= 0: + break + cycleList.append(list(RAHResistance)) - + if loopStart < 0: - logger.error("Reactive Armor Hardener failed to find equilibrium. Damage profile after armor: %f/%f/%f/%f", baseDamageTaken[0], baseDamageTaken[1], baseDamageTaken[2], baseDamageTaken[3]) - - # Average the profiles in the RAH loop, or the last 20 if it didn't find a loop. + logger.error("Reactive Armor Hardener failed to find equilibrium. Damage profile after armor: %f/%f/%f/%f", + baseDamageTaken[0], baseDamageTaken[1], baseDamageTaken[2], baseDamageTaken[3]) + + # Average the profiles in the RAH loop, or the last 20 if it didn't find a loop. loopCycles = cycleList[loopStart:] numCycles = len(loopCycles) average = [0, 0, 0, 0] for cycle in loopCycles: for i in range(4): average[i] += cycle[i] - + for i in range(4): average[i] = round(average[i] / numCycles, 3) - + # Set the new resistances - #logger.debug("Setting new resist profile: %f/%f/%f/%f", average[0], average[1], average[2],average[3]) - for i, attr in enumerate(('armorEmDamageResonance', 'armorThermalDamageResonance', 'armorKineticDamageResonance', 'armorExplosiveDamageResonance')): + # logger.debug("Setting new resist profile: %f/%f/%f/%f", average[0], average[1], average[2],average[3]) + for i, attr in enumerate(( + 'armorEmDamageResonance', 'armorThermalDamageResonance', 'armorKineticDamageResonance', + 'armorExplosiveDamageResonance')): module.increaseItemAttr(attr, average[i] - module.getModifiedItemAttr(attr)) fit.ship.multiplyItemAttr(attr, average[i], stackingPenalties=True, penaltyGroup="preMul") - \ No newline at end of file diff --git a/eos/effects/angelsetbonus.py b/eos/effects/angelsetbonus.py index 9057b5876..1591e9be1 100644 --- a/eos/effects/angelsetbonus.py +++ b/eos/effects/angelsetbonus.py @@ -8,7 +8,7 @@ type = "passive" def handler(fit, implant, context): fit.appliedImplants.filteredItemMultiply( - lambda - implant: "signatureRadiusBonus" in implant.itemModifiedAttributes and "implantSetAngel" in implant.itemModifiedAttributes, + lambda implant: "signatureRadiusBonus" in implant.itemModifiedAttributes and + "implantSetAngel" in implant.itemModifiedAttributes, "signatureRadiusBonus", implant.getModifiedItemAttr("implantSetAngel")) diff --git a/eos/effects/armoredcommanddurationbonus.py b/eos/effects/armoredcommanddurationbonus.py index 031c6d0ef..171dfbbb2 100644 --- a/eos/effects/armoredcommanddurationbonus.py +++ b/eos/effects/armoredcommanddurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Armored Command type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/armoredcommandmindlink.py b/eos/effects/armoredcommandmindlink.py index 832bc2678..2e36ed6f0 100644 --- a/eos/effects/armoredcommandmindlink.py +++ b/eos/effects/armoredcommandmindlink.py @@ -5,9 +5,16 @@ # Implant: Federation Navy Command Mindlink # Implant: Imperial Navy Command Mindlink type = "passive" + + def handler(fit, src, context): - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("mindlinkBonus")) diff --git a/eos/effects/armoredcommandstrengthbonus.py b/eos/effects/armoredcommandstrengthbonus.py index 363c4f1a8..6bc5e365e 100644 --- a/eos/effects/armoredcommandstrengthbonus.py +++ b/eos/effects/armoredcommandstrengthbonus.py @@ -3,9 +3,15 @@ # Used by: # Skill: Armored Command Specialist type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) diff --git a/eos/effects/caldarishipewstrengthcb.py b/eos/effects/caldarishipewstrengthcb.py index b362382d1..48bdccb60 100644 --- a/eos/effects/caldarishipewstrengthcb.py +++ b/eos/effects/caldarishipewstrengthcb.py @@ -7,5 +7,7 @@ type = "passive" def handler(fit, ship, context): for sensorType in ("Gravimetric", "Ladar", "Magnetometric", "Radar"): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Electronic Warfare"), "scan{0}StrengthBonus".format(sensorType), - ship.getModifiedItemAttr("shipBonusCB"), stackingPenalties=True, skill="Caldari Battleship") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Electronic Warfare"), + "scan{0}StrengthBonus".format(sensorType), + ship.getModifiedItemAttr("shipBonusCB"), stackingPenalties=True, + skill="Caldari Battleship") diff --git a/eos/effects/chargebonuswarfarecharge.py b/eos/effects/chargebonuswarfarecharge.py index 032107bf1..fc4af6c2d 100644 --- a/eos/effects/chargebonuswarfarecharge.py +++ b/eos/effects/chargebonuswarfarecharge.py @@ -14,6 +14,8 @@ which warfareBuffID to run (shouldn't need this right now, but better safe than ''' type = "active", "gang" + + def handler(fit, module, context, **kwargs): print "In chargeBonusWarfareEffect, context: ", context @@ -25,8 +27,12 @@ def handler(fit, module, context, **kwargs): fit.ship.boostItemAttr("shield%sDamageResonance" % damageType, value, stackingPenalties=True) if id == 11: # Shield Burst: Active Shielding: Repair Duration/Capacitor - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill("Shield Emission Systems"), "capacitorNeed", value) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill("Shield Emission Systems"), "duration", value) + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill( + "Shield Emission Systems"), "capacitorNeed", value) + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill( + "Shield Emission Systems"), "duration", value) if id == 12: # Shield Burst: Shield Extension: Shield HP fit.ship.boostItemAttr("shieldCapacity", value, stackingPenalties=True) @@ -36,8 +42,12 @@ def handler(fit, module, context, **kwargs): fit.ship.boostItemAttr("armor%sDamageResonance" % damageType, value, stackingPenalties=True) if id == 14: # Armor Burst: Rapid Repair: Repair Duration/Capacitor - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "capacitorNeed", value) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "duration", value) + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill( + "Repair Systems"), "capacitorNeed", value) + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill( + "Repair Systems"), "duration", value) if id == 15: # Armor Burst: Armor Reinforcement: Armor HP fit.ship.boostItemAttr("armorHP", value, stackingPenalties=True) @@ -47,11 +57,14 @@ def handler(fit, module, context, **kwargs): if id == 17: # Information Burst: Electronic Superiority: EWAR Range and Strength groups = ("ECM", "Sensor Dampener", "Weapon Disruptor", "Target Painter") - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, stackingPenalties=True) - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "falloffEffectiveness", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, + stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "falloffEffectiveness", value, + stackingPenalties=True) for scanType in ("Magnetometric", "Radar", "Ladar", "Gravimetric"): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.nam == "ECM", "scan%sStrengthBonus" % scanType, value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.nam == "ECM", "scan%sStrengthBonus" % scanType, + value, stackingPenalties=True) for attr in ("missileVelocityBonus", "explosionDelayBonus", "aoeVelocityBonus", "falloffBonus", "maxRangeBonus", "aoeCloudSizeBonus", "trackingSpeedBonus"): @@ -60,7 +73,8 @@ def handler(fit, module, context, **kwargs): for attr in ("maxTargetRangeBonus", "scanResolutionBonus"): fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Sensor Dampener", attr, value) - fit.modules.filteredItemBoost(lambda mod: mod.item.gorup.name == "Target Painter", "signatureRadiusBonus", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.gorup.name == "Target Painter", "signatureRadiusBonus", + value, stackingPenalties=True) if id == 18: # Information Burst: Electronic Hardening: Scan Strength for scanType in ("Gravimetric", "Radar", "Ladar", "Magnetometric"): @@ -78,27 +92,39 @@ def handler(fit, module, context, **kwargs): if id == 21: # Skirmish Burst: Interdiction Maneuvers: Tackle Range groups = ("Stasis Web", "Warp Scrambler") - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, + stackingPenalties=True) if id == 22: # Skirmish Burst: Rapid Deployment: AB/MWD Speed Increase - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Afterburner") or mod.item.requiresSkill("High Speed Maneuvering"), "speedFactor", value, stackingPenalties=True) + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Afterburner") or mod.item.requiresSkill("High Speed Maneuvering"), + "speedFactor", value, stackingPenalties=True) if id == 23: # Mining Burst: Mining Laser Field Enhancement: Mining/Survey Range - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Gas Cloud Harvesting"), "maxRange", value, stackingPenalties=True) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("CPU Management"), "surveyScanRange", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or + mod.item.requiresSkill("Ice Harvesting") or + mod.item.requiresSkill("Gas Cloud Harvesting"), + "maxRange", + value, + stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("CPU Management"), "surveyScanRange", + value, stackingPenalties=True) if id == 24: # Mining Burst: Mining Laser Optimization: Mining Capacitor/Duration - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Gas Cloud Harvesting"), "capacitorNeed", value, stackingPenalties=True) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Gas Cloud Harvesting"), "duration", value, stackingPenalties = True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or mod.item.requiresSkill( + "Ice Harvesting") or mod.item.requiresSkill("Gas Cloud Harvesting"), "capacitorNeed", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or mod.item.requiresSkill( + "Ice Harvesting") or mod.item.requiresSkill("Gas Cloud Harvesting"), "duration", value, stackingPenalties=True) if id == 25: # Mining Burst: Mining Equipment Preservation: Crystal Volatility - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining"), "crystalVolatilityChance", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining"), "crystalVolatilityChance", + value, stackingPenalties=True) for x in xrange(1, 4): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): value = module.getModifiedChargeAttr("warfareBuff{}Multiplier".format(x)) id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x)) - print "Buff ID: ",id," value: ",value + print "Buff ID: ", id, " value: ", value if id: if 'commandRun' not in context: print "Add buffID", id, " to ", fit @@ -106,4 +132,3 @@ def handler(fit, module, context, **kwargs): elif kwargs['warfareBuffID'] is not None and kwargs['warfareBuffID'] == id: print "Running buffID ", kwargs['warfareBuffID'], " on ", fit runEffect(kwargs['warfareBuffID'], value) - diff --git a/eos/effects/commandburstaoebonus.py b/eos/effects/commandburstaoebonus.py index 8b7bbfce3..7965a6877 100644 --- a/eos/effects/commandburstaoebonus.py +++ b/eos/effects/commandburstaoebonus.py @@ -5,6 +5,8 @@ # Skill: Leadership # Skill: Wing Command type = "passive" + + def handler(fit, src, context): fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Leadership"), "maxRange", diff --git a/eos/effects/commandburstaoerolebonus.py b/eos/effects/commandburstaoerolebonus.py index eddf8713e..63de8ca87 100644 --- a/eos/effects/commandburstaoerolebonus.py +++ b/eos/effects/commandburstaoerolebonus.py @@ -11,5 +11,8 @@ # Ship: Orca # Ship: Rorqual type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Leadership"), "maxRange", src.getModifiedItemAttr("roleBonusCommandBurstAoERange")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Leadership"), "maxRange", + src.getModifiedItemAttr("roleBonusCommandBurstAoERange")) diff --git a/eos/effects/commandburstreloadtimebonus.py b/eos/effects/commandburstreloadtimebonus.py index 1af92ee57..c0207bef4 100644 --- a/eos/effects/commandburstreloadtimebonus.py +++ b/eos/effects/commandburstreloadtimebonus.py @@ -3,6 +3,8 @@ # Used by: # Skill: Command Burst Specialist type = "passive" + + def handler(fit, src, context): lvl = src.level fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Leadership"), diff --git a/eos/effects/commandprocessoreffect.py b/eos/effects/commandprocessoreffect.py index 03030ed85..887644ece 100644 --- a/eos/effects/commandprocessoreffect.py +++ b/eos/effects/commandprocessoreffect.py @@ -3,6 +3,10 @@ # Used by: # Modules named like: Command Processor I (4 of 4) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupActive", src.getModifiedItemAttr("maxGangModules")) - fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupOnline", src.getModifiedItemAttr("maxGangModules")) + fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupActive", + src.getModifiedItemAttr("maxGangModules")) + fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupOnline", + src.getModifiedItemAttr("maxGangModules")) diff --git a/eos/effects/commandshipmultirelayeffect.py b/eos/effects/commandshipmultirelayeffect.py index de57a5160..9a3b30089 100644 --- a/eos/effects/commandshipmultirelayeffect.py +++ b/eos/effects/commandshipmultirelayeffect.py @@ -6,6 +6,9 @@ # Ship: Rorqual type = "passive" + def handler(fit, src, context): - fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupActive", src.getModifiedItemAttr("maxGangModules")) - fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupOnline", src.getModifiedItemAttr("maxGangModules")) \ No newline at end of file + fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupActive", + src.getModifiedItemAttr("maxGangModules")) + fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Leadership"), "maxGroupOnline", + src.getModifiedItemAttr("maxGangModules")) diff --git a/eos/effects/elitebonuscommanddestroyerarmored1.py b/eos/effects/elitebonuscommanddestroyerarmored1.py index 4b5442b0d..83df03351 100644 --- a/eos/effects/elitebonuscommanddestroyerarmored1.py +++ b/eos/effects/elitebonuscommanddestroyerarmored1.py @@ -4,9 +4,16 @@ # Ship: Magus # Ship: Pontifex type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") diff --git a/eos/effects/elitebonuscommanddestroyerinfo1.py b/eos/effects/elitebonuscommanddestroyerinfo1.py index 9198bc1c7..2f17453b2 100644 --- a/eos/effects/elitebonuscommanddestroyerinfo1.py +++ b/eos/effects/elitebonuscommanddestroyerinfo1.py @@ -4,9 +4,16 @@ # Ship: Pontifex # Ship: Stork type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") diff --git a/eos/effects/elitebonuscommanddestroyershield1.py b/eos/effects/elitebonuscommanddestroyershield1.py index ef5d75c29..03c2e2b8e 100644 --- a/eos/effects/elitebonuscommanddestroyershield1.py +++ b/eos/effects/elitebonuscommanddestroyershield1.py @@ -4,9 +4,16 @@ # Ship: Bifrost # Ship: Stork type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") diff --git a/eos/effects/elitebonuscommanddestroyerskirmish1.py b/eos/effects/elitebonuscommanddestroyerskirmish1.py index aa600f865..b33bdfa02 100644 --- a/eos/effects/elitebonuscommanddestroyerskirmish1.py +++ b/eos/effects/elitebonuscommanddestroyerskirmish1.py @@ -4,9 +4,16 @@ # Ship: Bifrost # Ship: Magus type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandDestroyer1"), skill="Command Destroyers") diff --git a/eos/effects/elitebonuscommandshiparmoredcs3.py b/eos/effects/elitebonuscommandshiparmoredcs3.py index 4832b2904..d7bc3fc46 100644 --- a/eos/effects/elitebonuscommandshiparmoredcs3.py +++ b/eos/effects/elitebonuscommandshiparmoredcs3.py @@ -3,9 +3,16 @@ # Used by: # Ships from group: Command Ship (4 of 8) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") diff --git a/eos/effects/elitebonuscommandshipinformationcs3.py b/eos/effects/elitebonuscommandshipinformationcs3.py index ffa02ba05..283cc76d6 100644 --- a/eos/effects/elitebonuscommandshipinformationcs3.py +++ b/eos/effects/elitebonuscommandshipinformationcs3.py @@ -3,9 +3,16 @@ # Used by: # Ships from group: Command Ship (4 of 8) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") diff --git a/eos/effects/elitebonuscommandshipsiegecs3.py b/eos/effects/elitebonuscommandshipsiegecs3.py index 4e7395d21..a17eb44dc 100644 --- a/eos/effects/elitebonuscommandshipsiegecs3.py +++ b/eos/effects/elitebonuscommandshipsiegecs3.py @@ -3,9 +3,16 @@ # Used by: # Ships from group: Command Ship (4 of 8) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") diff --git a/eos/effects/elitebonuscommandshipskirmishcs3.py b/eos/effects/elitebonuscommandshipskirmishcs3.py index 2c6d03add..345191164 100644 --- a/eos/effects/elitebonuscommandshipskirmishcs3.py +++ b/eos/effects/elitebonuscommandshipskirmishcs3.py @@ -3,9 +3,16 @@ # Used by: # Ships from group: Command Ship (4 of 8) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") diff --git a/eos/effects/elitebonuscoveropsnosneutfalloff1.py b/eos/effects/elitebonuscoveropsnosneutfalloff1.py index df0711cac..aa5b5b558 100644 --- a/eos/effects/elitebonuscoveropsnosneutfalloff1.py +++ b/eos/effects/elitebonuscoveropsnosneutfalloff1.py @@ -3,7 +3,9 @@ # Used by: # Ship: Caedes type = "passive" + + def handler(fit, src, context): fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in ("Energy Nosferatu", "Energy Neutralizer"), - "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusCoverOps1"), stackingPenalties=True, skill="Covert Ops") - + "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusCoverOps1"), + stackingPenalties=True, skill="Covert Ops") diff --git a/eos/effects/elitebonuslogisticremotearmorrepairduration3.py b/eos/effects/elitebonuslogisticremotearmorrepairduration3.py index d26ef3525..5c9b24c1c 100644 --- a/eos/effects/elitebonuslogisticremotearmorrepairduration3.py +++ b/eos/effects/elitebonuslogisticremotearmorrepairduration3.py @@ -3,5 +3,8 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "duration", src.getModifiedItemAttr("eliteBonusLogistics3"), skill="Logistics Cruisers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "duration", + src.getModifiedItemAttr("eliteBonusLogistics3"), skill="Logistics Cruisers") diff --git a/eos/effects/elitebonuslogisticremotearmorrepairoptimalfalloff1.py b/eos/effects/elitebonuslogisticremotearmorrepairoptimalfalloff1.py index d9180ebd7..c14c4bbdf 100644 --- a/eos/effects/elitebonuslogisticremotearmorrepairoptimalfalloff1.py +++ b/eos/effects/elitebonuslogisticremotearmorrepairoptimalfalloff1.py @@ -3,6 +3,12 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusLogistics1"), stackingPenalties=True, skill="Logistics Cruisers") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("eliteBonusLogistics1"), stackingPenalties=True, skill="Logistics Cruisers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), + "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusLogistics1"), + stackingPenalties=True, skill="Logistics Cruisers") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", + src.getModifiedItemAttr("eliteBonusLogistics1"), stackingPenalties=True, + skill="Logistics Cruisers") diff --git a/eos/effects/energyneutralizerfalloff.py b/eos/effects/energyneutralizerfalloff.py index 212f05ffa..e4c22c3fa 100644 --- a/eos/effects/energyneutralizerfalloff.py +++ b/eos/effects/energyneutralizerfalloff.py @@ -8,8 +8,8 @@ type = "active", "projected" def handler(fit, src, context): - 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 >= State.ACTIVE) or + hasattr(src, "amountActive")): amount = src.getModifiedItemAttr("energyNeutralizerAmount") time = src.getModifiedItemAttr("duration") diff --git a/eos/effects/entityenergyneutralizerfalloff.py b/eos/effects/entityenergyneutralizerfalloff.py index 0783295cf..a02abca12 100644 --- a/eos/effects/entityenergyneutralizerfalloff.py +++ b/eos/effects/entityenergyneutralizerfalloff.py @@ -8,8 +8,8 @@ type = "active", "projected" def handler(fit, src, context): - 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 >= State.ACTIVE) or + hasattr(src, "amountActive")): amount = src.getModifiedItemAttr("energyNeutralizerAmount") time = src.getModifiedItemAttr("energyNeutralizerDuration") diff --git a/eos/effects/iceharvestingdroneoperationdurationbonus.py b/eos/effects/iceharvestingdroneoperationdurationbonus.py index d8f61a6c1..18622ccf8 100644 --- a/eos/effects/iceharvestingdroneoperationdurationbonus.py +++ b/eos/effects/iceharvestingdroneoperationdurationbonus.py @@ -4,5 +4,8 @@ # Modules named like: Drone Mining Augmentor (8 of 8) # Skill: Ice Harvesting Drone Operation type = "passive" + + def handler(fit, src, context): - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", src.getModifiedItemAttr("rofBonus")) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", + src.getModifiedItemAttr("rofBonus")) diff --git a/eos/effects/iceharvestingdronespecbonus.py b/eos/effects/iceharvestingdronespecbonus.py index 6fee3f685..18af9f3b1 100644 --- a/eos/effects/iceharvestingdronespecbonus.py +++ b/eos/effects/iceharvestingdronespecbonus.py @@ -3,7 +3,11 @@ # Used by: # Skill: Ice Harvesting Drone Specialization type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Specialization"), "duration", src.getModifiedItemAttr("rofBonus") * lvl) - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Specialization"), "maxVelocity", src.getModifiedItemAttr("maxVelocityBonus") * lvl) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Specialization"), "duration", + src.getModifiedItemAttr("rofBonus") * lvl) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Specialization"), + "maxVelocity", src.getModifiedItemAttr("maxVelocityBonus") * lvl) diff --git a/eos/effects/industrialbonusdronedamage.py b/eos/effects/industrialbonusdronedamage.py index db3fba01d..f6c5137bd 100644 --- a/eos/effects/industrialbonusdronedamage.py +++ b/eos/effects/industrialbonusdronedamage.py @@ -11,8 +11,8 @@ # Ship: Rorqual type = "passive" + def handler(fit, src, context): fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill("Drones"), "damageMultiplier", src.getModifiedItemAttr("industrialBonusDroneDamage")) - diff --git a/eos/effects/informationcommanddurationbonus.py b/eos/effects/informationcommanddurationbonus.py index 2235cde74..f5a7dc351 100644 --- a/eos/effects/informationcommanddurationbonus.py +++ b/eos/effects/informationcommanddurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Information Command type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/informationcommandmindlink.py b/eos/effects/informationcommandmindlink.py index a4551304d..f545ab629 100644 --- a/eos/effects/informationcommandmindlink.py +++ b/eos/effects/informationcommandmindlink.py @@ -5,9 +5,16 @@ # Implant: Imperial Navy Command Mindlink # Implant: Information Command Mindlink type = "passive" + + def handler(fit, src, context): - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("mindlinkBonus")) diff --git a/eos/effects/informationcommandstrengthbonus.py b/eos/effects/informationcommandstrengthbonus.py index 04f17d646..e4431bee0 100644 --- a/eos/effects/informationcommandstrengthbonus.py +++ b/eos/effects/informationcommandstrengthbonus.py @@ -3,9 +3,15 @@ # Used by: # Skill: Information Command Specialist type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) diff --git a/eos/effects/invulnerabilitycoredurationbonus.py b/eos/effects/invulnerabilitycoredurationbonus.py index 8d4165859..b318f11cb 100644 --- a/eos/effects/invulnerabilitycoredurationbonus.py +++ b/eos/effects/invulnerabilitycoredurationbonus.py @@ -3,7 +3,11 @@ # Used by: # Skill: Invulnerability Core Operation type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Invulnerability Core Operation"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Invulnerability Core Operation"), "duration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Invulnerability Core Operation"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Invulnerability Core Operation"), "duration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/miningdronespecbonus.py b/eos/effects/miningdronespecbonus.py index 17c36723c..fe8cdff5a 100644 --- a/eos/effects/miningdronespecbonus.py +++ b/eos/effects/miningdronespecbonus.py @@ -3,7 +3,11 @@ # Used by: # Skill: Mining Drone Specialization type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Drone Specialization"), "miningAmount", src.getModifiedItemAttr("miningAmountBonus") * lvl) - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Drone Specialization"), "maxVelocity", src.getModifiedItemAttr("maxVelocityBonus") * lvl) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Drone Specialization"), "miningAmount", + src.getModifiedItemAttr("miningAmountBonus") * lvl) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Drone Specialization"), "maxVelocity", + src.getModifiedItemAttr("maxVelocityBonus") * lvl) diff --git a/eos/effects/miningforemanburstbonusics2.py b/eos/effects/miningforemanburstbonusics2.py index a2664b025..485138a26 100644 --- a/eos/effects/miningforemanburstbonusics2.py +++ b/eos/effects/miningforemanburstbonusics2.py @@ -3,9 +3,16 @@ # Used by: # Ships from group: Industrial Command Ship (2 of 2) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", + src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("shipBonusICS2"), skill="Industrial Command Ships") diff --git a/eos/effects/miningforemanburstbonusorecapital2.py b/eos/effects/miningforemanburstbonusorecapital2.py index e66243732..b1e7f4b57 100644 --- a/eos/effects/miningforemanburstbonusorecapital2.py +++ b/eos/effects/miningforemanburstbonusorecapital2.py @@ -3,9 +3,16 @@ # Used by: # Ship: Rorqual type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", + src.getModifiedItemAttr("shipBonusORECapital2"), skill="Capital Industrial Ships") diff --git a/eos/effects/miningforemandurationbonus.py b/eos/effects/miningforemandurationbonus.py index 88f33e00a..14a290d2e 100644 --- a/eos/effects/miningforemandurationbonus.py +++ b/eos/effects/miningforemandurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Mining Foreman type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/miningforemanmindlink.py b/eos/effects/miningforemanmindlink.py index e8d89bdd7..ad4339f67 100644 --- a/eos/effects/miningforemanmindlink.py +++ b/eos/effects/miningforemanmindlink.py @@ -4,9 +4,16 @@ # Implant: Mining Foreman Mindlink # Implant: ORE Mining Director Mindlink type = "passive" + + def handler(fit, src, context): - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "buffDuration", + src.getModifiedItemAttr("mindlinkBonus")) diff --git a/eos/effects/miningforemanstrengthbonus.py b/eos/effects/miningforemanstrengthbonus.py index 004c3500d..48d14e33b 100644 --- a/eos/effects/miningforemanstrengthbonus.py +++ b/eos/effects/miningforemanstrengthbonus.py @@ -3,9 +3,15 @@ # Used by: # Skill: Mining Director type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) \ No newline at end of file + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) diff --git a/eos/effects/mininginfomultiplier.py b/eos/effects/mininginfomultiplier.py index d0ca12180..6cb722d76 100644 --- a/eos/effects/mininginfomultiplier.py +++ b/eos/effects/mininginfomultiplier.py @@ -7,5 +7,6 @@ type = "passive" def handler(fit, module, context): - module.multiplyItemAttr("specialtyMiningAmount", module.getModifiedChargeAttr("specialisationAsteroidYieldMultiplier")) - #module.multiplyItemAttr("miningAmount", module.getModifiedChargeAttr("specialisationAsteroidYieldMultiplier")) + module.multiplyItemAttr("specialtyMiningAmount", + module.getModifiedChargeAttr("specialisationAsteroidYieldMultiplier")) + # module.multiplyItemAttr("miningAmount", module.getModifiedChargeAttr("specialisationAsteroidYieldMultiplier")) diff --git a/eos/effects/modedamptdresistspostdiv.py b/eos/effects/modedamptdresistspostdiv.py index db8580229..891b84a82 100644 --- a/eos/effects/modedamptdresistspostdiv.py +++ b/eos/effects/modedamptdresistspostdiv.py @@ -4,6 +4,7 @@ # Modules named like: Sharpshooter Mode (4 of 4) type = "passive" + def handler(fit, module, context): fit.ship.multiplyItemAttr("weaponDisruptionResistance", 1 / module.getModifiedItemAttr("modeEwarResistancePostDiv")) fit.ship.multiplyItemAttr("sensorDampenerResistance", 1 / module.getModifiedItemAttr("modeEwarResistancePostDiv")) diff --git a/eos/effects/modulebonusafterburner.py b/eos/effects/modulebonusafterburner.py index e48bdb437..c26412bb0 100644 --- a/eos/effects/modulebonusafterburner.py +++ b/eos/effects/modulebonusafterburner.py @@ -11,4 +11,4 @@ def handler(fit, module, context): speedBoost = module.getModifiedItemAttr("speedFactor") mass = fit.ship.getModifiedItemAttr("mass") thrust = module.getModifiedItemAttr("speedBoostFactor") - fit.ship.boostItemAttr("maxVelocity", speedBoost * thrust / mass) \ No newline at end of file + fit.ship.boostItemAttr("maxVelocity", speedBoost * thrust / mass) diff --git a/eos/effects/modulebonusancillaryremotearmorrepairer.py b/eos/effects/modulebonusancillaryremotearmorrepairer.py index c3c157b81..78a6ef855 100644 --- a/eos/effects/modulebonusancillaryremotearmorrepairer.py +++ b/eos/effects/modulebonusancillaryremotearmorrepairer.py @@ -7,7 +7,8 @@ type = "projected", "active" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return if module.charge and module.charge.name == "Nanite Repair Paste": multiplier = 3 diff --git a/eos/effects/modulebonusancillaryremoteshieldbooster.py b/eos/effects/modulebonusancillaryremoteshieldbooster.py index 74443b269..99b1a444c 100644 --- a/eos/effects/modulebonusancillaryremoteshieldbooster.py +++ b/eos/effects/modulebonusancillaryremoteshieldbooster.py @@ -7,7 +7,8 @@ type = "projected", "active" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return amount = module.getModifiedItemAttr("shieldBonus") speed = module.getModifiedItemAttr("duration") / 1000.0 fit.extraAttributes.increase("shieldRepair", amount / speed) diff --git a/eos/effects/modulebonusmicrowarpdrive.py b/eos/effects/modulebonusmicrowarpdrive.py index 2c4f6cd91..75df915ce 100644 --- a/eos/effects/modulebonusmicrowarpdrive.py +++ b/eos/effects/modulebonusmicrowarpdrive.py @@ -12,4 +12,5 @@ def handler(fit, module, context): mass = fit.ship.getModifiedItemAttr("mass") thrust = module.getModifiedItemAttr("speedBoostFactor") fit.ship.boostItemAttr("maxVelocity", speedBoost * thrust / mass) - fit.ship.boostItemAttr("signatureRadius", module.getModifiedItemAttr("signatureRadiusBonus"), stackingPenalties = True) + fit.ship.boostItemAttr("signatureRadius", module.getModifiedItemAttr("signatureRadiusBonus"), + stackingPenalties=True) diff --git a/eos/effects/modulebonuswarfarelinkarmor.py b/eos/effects/modulebonuswarfarelinkarmor.py index fb40b6dbc..daa55444e 100644 --- a/eos/effects/modulebonuswarfarelinkarmor.py +++ b/eos/effects/modulebonuswarfarelinkarmor.py @@ -5,6 +5,7 @@ type = "active" runTime = "late" + def handler(fit, module, context): for x in xrange(1, 4): value = module.getModifiedItemAttr("warfareBuff{}Value".format(x)) diff --git a/eos/effects/modulebonuswarfarelinkinfo.py b/eos/effects/modulebonuswarfarelinkinfo.py index daaa041d9..32b493279 100644 --- a/eos/effects/modulebonuswarfarelinkinfo.py +++ b/eos/effects/modulebonuswarfarelinkinfo.py @@ -5,6 +5,7 @@ type = "active" runTime = "late" + def handler(fit, module, context): for x in xrange(1, 4): value = module.getModifiedItemAttr("warfareBuff{}Value".format(x)) diff --git a/eos/effects/modulebonuswarfarelinkmining.py b/eos/effects/modulebonuswarfarelinkmining.py index 9b58290d2..973d523c6 100644 --- a/eos/effects/modulebonuswarfarelinkmining.py +++ b/eos/effects/modulebonuswarfarelinkmining.py @@ -5,6 +5,7 @@ type = "active" runTime = "late" + def handler(fit, module, context): for x in xrange(1, 4): value = module.getModifiedItemAttr("warfareBuff{}Value".format(x)) diff --git a/eos/effects/modulebonuswarfarelinkshield.py b/eos/effects/modulebonuswarfarelinkshield.py index 709202d05..856137e74 100644 --- a/eos/effects/modulebonuswarfarelinkshield.py +++ b/eos/effects/modulebonuswarfarelinkshield.py @@ -5,6 +5,7 @@ type = "active" runTime = "late" + def handler(fit, module, context): for x in xrange(1, 4): value = module.getModifiedItemAttr("warfareBuff{}Value".format(x)) diff --git a/eos/effects/modulebonuswarfarelinkskirmish.py b/eos/effects/modulebonuswarfarelinkskirmish.py index e9edf182b..c0bedf2b1 100644 --- a/eos/effects/modulebonuswarfarelinkskirmish.py +++ b/eos/effects/modulebonuswarfarelinkskirmish.py @@ -5,6 +5,7 @@ type = "active" runTime = "late" + def handler(fit, module, context): for x in xrange(1, 4): value = module.getModifiedItemAttr("warfareBuff{}Value".format(x)) diff --git a/eos/effects/moduletitaneffectgenerator.py b/eos/effects/moduletitaneffectgenerator.py index 2a5de4473..df371813f 100644 --- a/eos/effects/moduletitaneffectgenerator.py +++ b/eos/effects/moduletitaneffectgenerator.py @@ -4,6 +4,8 @@ # Modules from group: Titan Phenomena Generator (4 of 4) type = "active", "gang" + + def handler(fit, module, context, **kwargs): def runEffect(id, value): if id == 39: # Avatar Effect Generator : Capacitor Recharge bonus @@ -53,14 +55,17 @@ def handler(fit, module, context, **kwargs): fit.ship.boostItemAttr("maxVelocity", value, stackingPenalties=True) if id == 52: # Erebus Effect Generator : Shield RR penalty - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Emission Systems"), "shieldBonus", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Emission Systems"), "shieldBonus", + value, stackingPenalties=True) if id == 53: # Leviathan Effect Generator : Armor RR penalty - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "armorDamageAmount", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), + "armorDamageAmount", value, stackingPenalties=True) if id == 54: # Ragnarok Effect Generator : Laser and Hybrid Optimal penalty groups = ("Energy Weapon", "Hybrid Weapon") - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups, "maxRange", value, + stackingPenalties=True) for x in xrange(1, 4): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): @@ -72,4 +77,3 @@ def handler(fit, module, context, **kwargs): fit.addCommandBonus(id, value, module, kwargs['effect']) elif kwargs['warfareBuffID'] is not None and kwargs['warfareBuffID'] == id: runEffect(kwargs['warfareBuffID'], value) - diff --git a/eos/effects/noscpuneedbonuseffect.py b/eos/effects/noscpuneedbonuseffect.py index 9f92b373c..d54b6e023 100644 --- a/eos/effects/noscpuneedbonuseffect.py +++ b/eos/effects/noscpuneedbonuseffect.py @@ -3,5 +3,8 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "cpu", src.getModifiedItemAttr("nosferatuCpuNeedBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "cpu", + src.getModifiedItemAttr("nosferatuCpuNeedBonus")) diff --git a/eos/effects/powerbooster.py b/eos/effects/powerbooster.py index 6fdafc9a4..42dcaca89 100644 --- a/eos/effects/powerbooster.py +++ b/eos/effects/powerbooster.py @@ -11,6 +11,7 @@ def handler(fit, module, context): # Make so that reloads are always taken into account during clculations module.forceReload = True - if module.charge is None: return + if module.charge is None: + return capAmount = module.getModifiedChargeAttr("capacitorBonus") or 0 module.itemModifiedAttributes["capacitorNeed"] = -capAmount diff --git a/eos/effects/remotehullrepairentity.py b/eos/effects/remotehullrepairentity.py index db8de5fe4..367d08bf1 100644 --- a/eos/effects/remotehullrepairentity.py +++ b/eos/effects/remotehullrepairentity.py @@ -7,7 +7,8 @@ runTime = "late" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return bonus = module.getModifiedItemAttr("structureDamageAmount") duration = module.getModifiedItemAttr("duration") / 1000.0 fit.extraAttributes.increase("hullRepair", bonus / duration) diff --git a/eos/effects/remotehullrepairfalloff.py b/eos/effects/remotehullrepairfalloff.py index d7344b646..eaecf6bf9 100644 --- a/eos/effects/remotehullrepairfalloff.py +++ b/eos/effects/remotehullrepairfalloff.py @@ -7,7 +7,8 @@ runTime = "late" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return bonus = module.getModifiedItemAttr("structureDamageAmount") duration = module.getModifiedItemAttr("duration") / 1000.0 fit.extraAttributes.increase("hullRepair", bonus / duration) diff --git a/eos/effects/remotewebifierentity.py b/eos/effects/remotewebifierentity.py index 38028881a..cf9905405 100644 --- a/eos/effects/remotewebifierentity.py +++ b/eos/effects/remotewebifierentity.py @@ -6,6 +6,7 @@ type = "active", "projected" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"), stackingPenalties=True, remoteResists=True) diff --git a/eos/effects/remotewebifierfalloff.py b/eos/effects/remotewebifierfalloff.py index 67f6d4dc5..1db5eb858 100644 --- a/eos/effects/remotewebifierfalloff.py +++ b/eos/effects/remotewebifierfalloff.py @@ -7,6 +7,7 @@ type = "active", "projected" def handler(fit, module, context): - if "projected" not in context: return + if "projected" not in context: + return fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"), stackingPenalties=True, remoteResists=True) diff --git a/eos/effects/rolebonusremotearmorrepairoptimalfalloff.py b/eos/effects/rolebonusremotearmorrepairoptimalfalloff.py index c28744a06..f2c9ae4e9 100644 --- a/eos/effects/rolebonusremotearmorrepairoptimalfalloff.py +++ b/eos/effects/rolebonusremotearmorrepairoptimalfalloff.py @@ -3,6 +3,11 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("roleBonusRepairRange"), stackingPenalties=True) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("roleBonusRepairRange"), stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), + "falloffEffectiveness", src.getModifiedItemAttr("roleBonusRepairRange"), + stackingPenalties=True) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", + src.getModifiedItemAttr("roleBonusRepairRange"), stackingPenalties=True) diff --git a/eos/effects/shieldcommandburstbonusics3.py b/eos/effects/shieldcommandburstbonusics3.py index 9c6ee1541..1a61286b7 100644 --- a/eos/effects/shieldcommandburstbonusics3.py +++ b/eos/effects/shieldcommandburstbonusics3.py @@ -3,9 +3,16 @@ # Used by: # Ship: Orca type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("shipBonusICS3"), skill="Industrial Command Ships") diff --git a/eos/effects/shieldcommandburstbonusorecapital3.py b/eos/effects/shieldcommandburstbonusorecapital3.py index 595d7afae..5972f2044 100644 --- a/eos/effects/shieldcommandburstbonusorecapital3.py +++ b/eos/effects/shieldcommandburstbonusorecapital3.py @@ -3,9 +3,16 @@ # Used by: # Ship: Rorqual type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("shipBonusORECapital3"), skill="Capital Industrial Ships") diff --git a/eos/effects/shieldcommanddurationbonus.py b/eos/effects/shieldcommanddurationbonus.py index 8e7c78ea5..a7425a974 100644 --- a/eos/effects/shieldcommanddurationbonus.py +++ b/eos/effects/shieldcommanddurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Shield Command type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/shieldcommandmindlink.py b/eos/effects/shieldcommandmindlink.py index a350e5c29..fac7a7720 100644 --- a/eos/effects/shieldcommandmindlink.py +++ b/eos/effects/shieldcommandmindlink.py @@ -3,9 +3,16 @@ # Used by: # Implants from group: Cyber Leadership (4 of 10) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("mindlinkBonus")) diff --git a/eos/effects/shieldcommandstrengthbonus.py b/eos/effects/shieldcommandstrengthbonus.py index 775e54d62..b95fe66df 100644 --- a/eos/effects/shieldcommandstrengthbonus.py +++ b/eos/effects/shieldcommandstrengthbonus.py @@ -3,9 +3,15 @@ # Used by: # Skill: Shield Command Specialist type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) diff --git a/eos/effects/shipbonuscarriera4warfarelinksbonus.py b/eos/effects/shipbonuscarriera4warfarelinksbonus.py index 43a053e04..31981bba6 100644 --- a/eos/effects/shipbonuscarriera4warfarelinksbonus.py +++ b/eos/effects/shipbonuscarriera4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Archon type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierA4"), skill="Amarr Carrier") diff --git a/eos/effects/shipbonuscarrierc4warfarelinksbonus.py b/eos/effects/shipbonuscarrierc4warfarelinksbonus.py index ecaf23399..4e19f6916 100644 --- a/eos/effects/shipbonuscarrierc4warfarelinksbonus.py +++ b/eos/effects/shipbonuscarrierc4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Chimera type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierC4"), skill="Caldari Carrier") diff --git a/eos/effects/shipbonuscarrierg4warfarelinksbonus.py b/eos/effects/shipbonuscarrierg4warfarelinksbonus.py index 673807782..05eb85c60 100644 --- a/eos/effects/shipbonuscarrierg4warfarelinksbonus.py +++ b/eos/effects/shipbonuscarrierg4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Thanatos type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierG4"), skill="Gallente Carrier") diff --git a/eos/effects/shipbonuscarrierm4warfarelinksbonus.py b/eos/effects/shipbonuscarrierm4warfarelinksbonus.py index 36fbbfa01..11592c9df 100644 --- a/eos/effects/shipbonuscarrierm4warfarelinksbonus.py +++ b/eos/effects/shipbonuscarrierm4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Nidhoggur type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusCarrierM4"), skill="Minmatar Carrier") diff --git a/eos/effects/shipbonuscloakcpumc2.py b/eos/effects/shipbonuscloakcpumc2.py index 0f8c90e35..ac83921f0 100644 --- a/eos/effects/shipbonuscloakcpumc2.py +++ b/eos/effects/shipbonuscloakcpumc2.py @@ -3,5 +3,8 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Cloaking"), "cpu", src.getModifiedItemAttr("shipBonusMC2"), skill="Minmatar Cruiser") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Cloaking"), "cpu", + src.getModifiedItemAttr("shipBonusMC2"), skill="Minmatar Cruiser") diff --git a/eos/effects/shipbonuscloakcpumf1.py b/eos/effects/shipbonuscloakcpumf1.py index 62a6d0aa7..fe201e1df 100644 --- a/eos/effects/shipbonuscloakcpumf1.py +++ b/eos/effects/shipbonuscloakcpumf1.py @@ -3,5 +3,8 @@ # Used by: # Ship: Caedes type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Cloaking"), "cpu", src.getModifiedItemAttr("shipBonusMF"), skill="Minmatar Frigate") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Cloaking"), "cpu", + src.getModifiedItemAttr("shipBonusMF"), skill="Minmatar Frigate") diff --git a/eos/effects/shipbonusdronehpdamageminingics4.py b/eos/effects/shipbonusdronehpdamageminingics4.py index c8d49571f..8b06c6dec 100644 --- a/eos/effects/shipbonusdronehpdamageminingics4.py +++ b/eos/effects/shipbonusdronehpdamageminingics4.py @@ -35,4 +35,3 @@ def handler(fit, src, context): src.getModifiedItemAttr("shipBonusICS4"), skill="Industrial Command Ships" ) - diff --git a/eos/effects/shipbonusdronehpdamageminingorecapital4.py b/eos/effects/shipbonusdronehpdamageminingorecapital4.py index 1b5ed13f5..8cd53cd81 100644 --- a/eos/effects/shipbonusdronehpdamageminingorecapital4.py +++ b/eos/effects/shipbonusdronehpdamageminingorecapital4.py @@ -35,4 +35,3 @@ def handler(fit, src, context): src.getModifiedItemAttr("shipBonusORECapital4"), skill="Capital Industrial Ships" ) - diff --git a/eos/effects/shipbonusdroneiceharvestingrole.py b/eos/effects/shipbonusdroneiceharvestingrole.py index 010fbea1b..b45241f9f 100644 --- a/eos/effects/shipbonusdroneiceharvestingrole.py +++ b/eos/effects/shipbonusdroneiceharvestingrole.py @@ -3,5 +3,8 @@ # Used by: # Ship: Orca type = "passive" + + def handler(fit, src, context): - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", src.getModifiedItemAttr("roleBonusDroneIceHarvestingSpeed")) + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", + src.getModifiedItemAttr("roleBonusDroneIceHarvestingSpeed")) diff --git a/eos/effects/shipbonusdronerepairmc1.py b/eos/effects/shipbonusdronerepairmc1.py index baaff71f5..77cc9a69d 100644 --- a/eos/effects/shipbonusdronerepairmc1.py +++ b/eos/effects/shipbonusdronerepairmc1.py @@ -3,7 +3,12 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "shieldBonus", src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "structureDamageAmount", src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") - fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "armorDamageAmount", src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "shieldBonus", + src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "structureDamageAmount", + src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") + fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Drones"), "armorDamageAmount", + src.getModifiedItemAttr("shipBonusMC"), skill="Minmatar Cruiser") diff --git a/eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py b/eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py index a6bded847..18ea7291a 100644 --- a/eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py +++ b/eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py @@ -3,10 +3,22 @@ # Used by: # Ship: Apostle type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4") * lvl, skill="Amarr Carrier") diff --git a/eos/effects/shipbonusforceauxiliaryc4warfarelinksbonus.py b/eos/effects/shipbonusforceauxiliaryc4warfarelinksbonus.py index e2e6cd483..fda300de2 100644 --- a/eos/effects/shipbonusforceauxiliaryc4warfarelinksbonus.py +++ b/eos/effects/shipbonusforceauxiliaryc4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Minokawa type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryC4"), skill="Caldari Carrier") diff --git a/eos/effects/shipbonusforceauxiliaryg4warfarelinksbonus.py b/eos/effects/shipbonusforceauxiliaryg4warfarelinksbonus.py index 147ae8df0..63efca50e 100644 --- a/eos/effects/shipbonusforceauxiliaryg4warfarelinksbonus.py +++ b/eos/effects/shipbonusforceauxiliaryg4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Ninazu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryG4"), skill="Gallente Carrier") diff --git a/eos/effects/shipbonusforceauxiliarym4warfarelinksbonus.py b/eos/effects/shipbonusforceauxiliarym4warfarelinksbonus.py index 0c476942a..df5b5181b 100644 --- a/eos/effects/shipbonusforceauxiliarym4warfarelinksbonus.py +++ b/eos/effects/shipbonusforceauxiliarym4warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Lif type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryM4"), skill="Minmatar Carrier") diff --git a/eos/effects/shipbonusminingdroneamountpercentrookie.py b/eos/effects/shipbonusminingdroneamountpercentrookie.py index ddffa24e9..bffbe6b81 100644 --- a/eos/effects/shipbonusminingdroneamountpercentrookie.py +++ b/eos/effects/shipbonusminingdroneamountpercentrookie.py @@ -8,6 +8,5 @@ type = "passive" def handler(fit, container, context): - level = container.level if "skill" in context else 1 fit.drones.filteredItemBoost(lambda drone: drone.item.group.name == "Mining Drone", "miningAmount", container.getModifiedItemAttr("rookieDroneBonus")) diff --git a/eos/effects/shipbonusnosoptimalfalloffac2.py b/eos/effects/shipbonusnosoptimalfalloffac2.py index f741681b5..355b6e22c 100644 --- a/eos/effects/shipbonusnosoptimalfalloffac2.py +++ b/eos/effects/shipbonusnosoptimalfalloffac2.py @@ -3,6 +3,10 @@ # Used by: # Ship: Rabisu type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "falloffEffectiveness", src.getModifiedItemAttr("shipBonusAC2"), skill="Amarr Cruiser") - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "maxRange", src.getModifiedItemAttr("shipBonusAC2"), skill="Amarr Cruiser") + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "falloffEffectiveness", + src.getModifiedItemAttr("shipBonusAC2"), skill="Amarr Cruiser") + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "maxRange", + src.getModifiedItemAttr("shipBonusAC2"), skill="Amarr Cruiser") diff --git a/eos/effects/shipbonussetfalloffaf2.py b/eos/effects/shipbonussetfalloffaf2.py index cf22eedbd..9c6f67d13 100644 --- a/eos/effects/shipbonussetfalloffaf2.py +++ b/eos/effects/shipbonussetfalloffaf2.py @@ -3,5 +3,8 @@ # Used by: # Ship: Caedes type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Energy Turret"), "falloff", src.getModifiedItemAttr("shipBonus2AF"), skill="Amarr Frigate") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Energy Turret"), "falloff", + src.getModifiedItemAttr("shipBonus2AF"), skill="Amarr Frigate") diff --git a/eos/effects/shipbonussupercarriera5warfarelinksbonus.py b/eos/effects/shipbonussupercarriera5warfarelinksbonus.py index e1d000525..fdc2f24bc 100644 --- a/eos/effects/shipbonussupercarriera5warfarelinksbonus.py +++ b/eos/effects/shipbonussupercarriera5warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Aeon type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierA5"), skill="Amarr Carrier") diff --git a/eos/effects/shipbonussupercarrierc5warfarelinksbonus.py b/eos/effects/shipbonussupercarrierc5warfarelinksbonus.py index 768818b2d..5ff00b1ca 100644 --- a/eos/effects/shipbonussupercarrierc5warfarelinksbonus.py +++ b/eos/effects/shipbonussupercarrierc5warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Wyvern type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierC5"), skill="Caldari Carrier") diff --git a/eos/effects/shipbonussupercarrierg5warfarelinksbonus.py b/eos/effects/shipbonussupercarrierg5warfarelinksbonus.py index 28dd6ab20..aa6d4d1e2 100644 --- a/eos/effects/shipbonussupercarrierg5warfarelinksbonus.py +++ b/eos/effects/shipbonussupercarrierg5warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Nyx type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Armored Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierG5"), skill="Gallente Carrier") diff --git a/eos/effects/shipbonussupercarrierm5warfarelinksbonus.py b/eos/effects/shipbonussupercarrierm5warfarelinksbonus.py index 53a6fafec..403b6c6a7 100644 --- a/eos/effects/shipbonussupercarrierm5warfarelinksbonus.py +++ b/eos/effects/shipbonussupercarrierm5warfarelinksbonus.py @@ -3,9 +3,21 @@ # Used by: # Ship: Hel type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff4Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff1Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff3Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "buffDuration", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") + fit.modules.filteredItemBoost( + lambda mod: mod.item.requiresSkill("Skirmish Command") or mod.item.requiresSkill("Shield Command"), + "warfareBuff2Value", src.getModifiedItemAttr("shipBonusSupercarrierM5"), skill="Minmatar Carrier") diff --git a/eos/effects/shipmodesmallmissiledamagepostdiv.py b/eos/effects/shipmodesmallmissiledamagepostdiv.py index 116dd3571..7321f4848 100644 --- a/eos/effects/shipmodesmallmissiledamagepostdiv.py +++ b/eos/effects/shipmodesmallmissiledamagepostdiv.py @@ -4,8 +4,10 @@ # Module: Jackdaw Sharpshooter Mode type = "passive" + def handler(fit, module, context): types = ("thermal", "em", "explosive", "kinetic") for type in types: - fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Rockets") or mod.charge.requiresSkill("Light Missiles"), - "{}Damage".format(type), 1 / module.getModifiedItemAttr("modeDamageBonusPostDiv")) + fit.modules.filteredChargeBoost( + lambda mod: mod.charge.requiresSkill("Rockets") or mod.charge.requiresSkill("Light Missiles"), + "{}Damage".format(type), 1 / module.getModifiedItemAttr("modeDamageBonusPostDiv")) diff --git a/eos/effects/skirmishcommanddurationbonus.py b/eos/effects/skirmishcommanddurationbonus.py index 5ab212a25..7b42437e1 100644 --- a/eos/effects/skirmishcommanddurationbonus.py +++ b/eos/effects/skirmishcommanddurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Skirmish Command type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/skirmishcommandmindlink.py b/eos/effects/skirmishcommandmindlink.py index 4b5d09cad..9999d7f56 100644 --- a/eos/effects/skirmishcommandmindlink.py +++ b/eos/effects/skirmishcommandmindlink.py @@ -5,9 +5,16 @@ # Implant: Republic Fleet Command Mindlink # Implant: Skirmish Command Mindlink type = "passive" + + def handler(fit, src, context): - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("mindlinkBonus")) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("mindlinkBonus")) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("mindlinkBonus")) diff --git a/eos/effects/skirmishcommandstrengthbonus.py b/eos/effects/skirmishcommandstrengthbonus.py index f0af86f77..7963755df 100644 --- a/eos/effects/skirmishcommandstrengthbonus.py +++ b/eos/effects/skirmishcommandstrengthbonus.py @@ -3,9 +3,15 @@ # Used by: # Skill: Skirmish Command Specialist type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) - fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Multiplier", src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) + fit.modules.filteredChargeBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Multiplier", + src.getModifiedItemAttr("commandStrengthBonus") * lvl) diff --git a/eos/effects/spatialphenomenagenerationdurationbonus.py b/eos/effects/spatialphenomenagenerationdurationbonus.py index 846fb6040..b127ae30d 100644 --- a/eos/effects/spatialphenomenagenerationdurationbonus.py +++ b/eos/effects/spatialphenomenagenerationdurationbonus.py @@ -3,6 +3,9 @@ # Used by: # Skill: Spatial Phenomena Generation type = "passive" + + def handler(fit, src, context): lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Spatial Phenomena Generation"), "buffDuration", src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Spatial Phenomena Generation"), "buffDuration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/subsystembonusamarrdefensive2remotearmorrepairamount.py b/eos/effects/subsystembonusamarrdefensive2remotearmorrepairamount.py index 9ff4f9d42..5805bbd60 100644 --- a/eos/effects/subsystembonusamarrdefensive2remotearmorrepairamount.py +++ b/eos/effects/subsystembonusamarrdefensive2remotearmorrepairamount.py @@ -4,6 +4,8 @@ # Subsystem: Legion Defensive - Adaptive Augmenter type = "passive" runTime = "early" + + def handler(fit, module, context): fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusAmarrDefensive2"), diff --git a/eos/effects/subsystembonusamarrdefensivearmoredwarfare.py b/eos/effects/subsystembonusamarrdefensivearmoredwarfare.py index 4a045cd49..75bcf296d 100644 --- a/eos/effects/subsystembonusamarrdefensivearmoredwarfare.py +++ b/eos/effects/subsystembonusamarrdefensivearmoredwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Legion Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") diff --git a/eos/effects/subsystembonusamarrdefensiveinformationwarfare.py b/eos/effects/subsystembonusamarrdefensiveinformationwarfare.py index 2f3b96474..1d5b476b7 100644 --- a/eos/effects/subsystembonusamarrdefensiveinformationwarfare.py +++ b/eos/effects/subsystembonusamarrdefensiveinformationwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Legion Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") diff --git a/eos/effects/subsystembonusamarrdefensiveskirmishwarfare.py b/eos/effects/subsystembonusamarrdefensiveskirmishwarfare.py index c767405fb..141f65cef 100644 --- a/eos/effects/subsystembonusamarrdefensiveskirmishwarfare.py +++ b/eos/effects/subsystembonusamarrdefensiveskirmishwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Legion Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") diff --git a/eos/effects/subsystembonuscaldaridefensive2remoteshieldtransporteramount.py b/eos/effects/subsystembonuscaldaridefensive2remoteshieldtransporteramount.py index 1f3b20c03..4478365ef 100644 --- a/eos/effects/subsystembonuscaldaridefensive2remoteshieldtransporteramount.py +++ b/eos/effects/subsystembonuscaldaridefensive2remoteshieldtransporteramount.py @@ -4,6 +4,8 @@ # Subsystem: Tengu Defensive - Adaptive Shielding type = "passive" runTime = "early" + + def handler(fit, module, context): fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Emission Systems"), "shieldBonus", module.getModifiedItemAttr("subsystemBonusCaldariDefensive2"), diff --git a/eos/effects/subsystembonuscaldaridefensiveinformationwarfare.py b/eos/effects/subsystembonuscaldaridefensiveinformationwarfare.py index c06646196..aefcd0b2d 100644 --- a/eos/effects/subsystembonuscaldaridefensiveinformationwarfare.py +++ b/eos/effects/subsystembonuscaldaridefensiveinformationwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Tengu Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") diff --git a/eos/effects/subsystembonuscaldaridefensivesiegewarfare.py b/eos/effects/subsystembonuscaldaridefensivesiegewarfare.py index 9a3de25c4..2869a8227 100644 --- a/eos/effects/subsystembonuscaldaridefensivesiegewarfare.py +++ b/eos/effects/subsystembonuscaldaridefensivesiegewarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Tengu Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") diff --git a/eos/effects/subsystembonuscaldaridefensiveskirmishwarfare.py b/eos/effects/subsystembonuscaldaridefensiveskirmishwarfare.py index 21a1a2ad5..54778136c 100644 --- a/eos/effects/subsystembonuscaldaridefensiveskirmishwarfare.py +++ b/eos/effects/subsystembonuscaldaridefensiveskirmishwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Tengu Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusCaldariDefensive"), + skill="Caldari Defensive Systems") diff --git a/eos/effects/subsystembonusgallentedefensive2remotearmorrepairamount.py b/eos/effects/subsystembonusgallentedefensive2remotearmorrepairamount.py index f18b60266..f9e7e5039 100644 --- a/eos/effects/subsystembonusgallentedefensive2remotearmorrepairamount.py +++ b/eos/effects/subsystembonusgallentedefensive2remotearmorrepairamount.py @@ -4,6 +4,8 @@ # Subsystem: Proteus Defensive - Adaptive Augmenter type = "passive" runTime = "early" + + def handler(fit, module, context): fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusGallenteDefensive2"), diff --git a/eos/effects/subsystembonusgallentedefensivearmoredwarfare.py b/eos/effects/subsystembonusgallentedefensivearmoredwarfare.py index 5d9369857..d66f4fc32 100644 --- a/eos/effects/subsystembonusgallentedefensivearmoredwarfare.py +++ b/eos/effects/subsystembonusgallentedefensivearmoredwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Proteus Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") diff --git a/eos/effects/subsystembonusgallentedefensiveinformationwarfare.py b/eos/effects/subsystembonusgallentedefensiveinformationwarfare.py index 83a9943ee..90e90eac6 100644 --- a/eos/effects/subsystembonusgallentedefensiveinformationwarfare.py +++ b/eos/effects/subsystembonusgallentedefensiveinformationwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Proteus Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") diff --git a/eos/effects/subsystembonusgallentedefensiveskirmishwarfare.py b/eos/effects/subsystembonusgallentedefensiveskirmishwarfare.py index 6aae7922b..b4ed4e9e2 100644 --- a/eos/effects/subsystembonusgallentedefensiveskirmishwarfare.py +++ b/eos/effects/subsystembonusgallentedefensiveskirmishwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Proteus Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") diff --git a/eos/effects/subsystembonusminmatardefensive2remoteshieldtransporteramount.py b/eos/effects/subsystembonusminmatardefensive2remoteshieldtransporteramount.py index 784c7e7e8..2586c28ec 100644 --- a/eos/effects/subsystembonusminmatardefensive2remoteshieldtransporteramount.py +++ b/eos/effects/subsystembonusminmatardefensive2remoteshieldtransporteramount.py @@ -4,6 +4,8 @@ # Subsystem: Loki Defensive - Adaptive Shielding type = "passive" runTime = "early" + + def handler(fit, module, context): fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Emission Systems"), "shieldBonus", module.getModifiedItemAttr("subsystemBonusMinmatarDefensive2"), diff --git a/eos/effects/subsystembonusminmatardefensivearmoredwarfare.py b/eos/effects/subsystembonusminmatardefensivearmoredwarfare.py index f38d8af9c..7921b5713 100644 --- a/eos/effects/subsystembonusminmatardefensivearmoredwarfare.py +++ b/eos/effects/subsystembonusminmatardefensivearmoredwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Loki Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") diff --git a/eos/effects/subsystembonusminmatardefensivesiegewarfare.py b/eos/effects/subsystembonusminmatardefensivesiegewarfare.py index 80547e83e..de019c309 100644 --- a/eos/effects/subsystembonusminmatardefensivesiegewarfare.py +++ b/eos/effects/subsystembonusminmatardefensivesiegewarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Loki Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Shield Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") diff --git a/eos/effects/subsystembonusminmatardefensiveskirmishwarfare.py b/eos/effects/subsystembonusminmatardefensiveskirmishwarfare.py index 75ecd4da2..645257326 100644 --- a/eos/effects/subsystembonusminmatardefensiveskirmishwarfare.py +++ b/eos/effects/subsystembonusminmatardefensiveskirmishwarfare.py @@ -3,9 +3,21 @@ # Used by: # Subsystem: Loki Defensive - Warfare Processor type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff1Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff3Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff4Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "warfareBuff2Value", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Skirmish Command"), "buffDuration", + src.getModifiedItemAttr("subsystemBonusMinmatarDefensive"), + skill="Minmatar Defensive Systems") diff --git a/eos/effects/systemarmorrepairamount.py b/eos/effects/systemarmorrepairamount.py index 1b28168f1..da585583d 100644 --- a/eos/effects/systemarmorrepairamount.py +++ b/eos/effects/systemarmorrepairamount.py @@ -7,7 +7,7 @@ type = ("projected", "passive") def handler(fit, module, context): - fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Repair Systems") - or mod.item.requiresSkill("Capital Repair Systems"), + fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Repair Systems") or + mod.item.requiresSkill("Capital Repair Systems"), "armorDamageAmount", module.getModifiedItemAttr("armorDamageAmountMultiplier"), stackingPenalties=True, penaltyGroup="postMul") diff --git a/eos/effects/systemshieldrepairamountshieldskills.py b/eos/effects/systemshieldrepairamountshieldskills.py index bde28cd04..707e2dbbb 100644 --- a/eos/effects/systemshieldrepairamountshieldskills.py +++ b/eos/effects/systemshieldrepairamountshieldskills.py @@ -7,7 +7,7 @@ type = ("projected", "passive") def handler(fit, module, context): - fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Shield Operation") - or mod.item.requiresSkill("Capital Shield Operation"), + fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Shield Operation") or + mod.item.requiresSkill("Capital Shield Operation"), "shieldBonus", module.getModifiedItemAttr("shieldBonusMultiplier"), stackingPenalties=True, penaltyGroup="postMul") diff --git a/eos/effects/zcolinorcasurveyscannerbonus.py b/eos/effects/zcolinorcasurveyscannerbonus.py index feed0cc0c..a1eb01fea 100644 --- a/eos/effects/zcolinorcasurveyscannerbonus.py +++ b/eos/effects/zcolinorcasurveyscannerbonus.py @@ -3,5 +3,8 @@ # Used by: # Ships from group: Industrial Command Ship (2 of 2) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Survey Scanner", "surveyScanRange", src.getModifiedItemAttr("roleBonusSurveyScannerRange")) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Survey Scanner", "surveyScanRange", + src.getModifiedItemAttr("roleBonusSurveyScannerRange")) diff --git a/eos/effects/zcolinorcatractorrangebonus.py b/eos/effects/zcolinorcatractorrangebonus.py index b2262a1e9..9c4a20c03 100644 --- a/eos/effects/zcolinorcatractorrangebonus.py +++ b/eos/effects/zcolinorcatractorrangebonus.py @@ -3,5 +3,8 @@ # Used by: # Ships from group: Industrial Command Ship (2 of 2) type = "passive" + + def handler(fit, src, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Tractor Beam", "maxRange", src.getModifiedItemAttr("roleBonusTractorBeamRange")) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Tractor Beam", "maxRange", + src.getModifiedItemAttr("roleBonusTractorBeamRange")) diff --git a/eos/effects/zcolinorcatractorvelocitybonus.py b/eos/effects/zcolinorcatractorvelocitybonus.py index 95219da80..736643324 100644 --- a/eos/effects/zcolinorcatractorvelocitybonus.py +++ b/eos/effects/zcolinorcatractorvelocitybonus.py @@ -6,4 +6,5 @@ type = "passive" def handler(fit, ship, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Tractor Beam", "maxTractorVelocity", ship.getModifiedItemAttr("roleBonusTractorBeamVelocity")) + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Tractor Beam", "maxTractorVelocity", + ship.getModifiedItemAttr("roleBonusTractorBeamVelocity")) diff --git a/eos/graph/fitDps.py b/eos/graph/fitDps.py index cfc9ec5f4..04ef910a5 100644 --- a/eos/graph/fitDps.py +++ b/eos/graph/fitDps.py @@ -1,183 +1,182 @@ -# =============================================================================== -# Copyright (C) 2010 Diego Duclos -# -# This file is part of eos. -# -# eos is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# eos 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with eos. If not, see . -# =============================================================================== - -from math import log, sin, radians, exp - -from eos.graph import Graph -from eos.types import Hardpoint, State - - -class FitDpsGraph(Graph): - defaults = {"angle": 0, - "distance": 0, - "signatureRadius": None, - "velocity": 0} - - def __init__(self, fit, data=None): - Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults) - self.fit = fit - - def calcDps(self, data): - ew = {'signatureRadius': [], 'velocity': []} - fit = self.fit - total = 0 - distance = data["distance"] * 1000 - abssort = lambda val: -abs(val - 1) - - for mod in fit.modules: - if not mod.isEmpty and mod.state >= State.ACTIVE: - if "remoteTargetPaintFalloff" in mod.item.effects: - ew['signatureRadius'].append( - 1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier( - mod, data)) - if "remoteWebifierFalloff" in mod.item.effects: - if distance <= mod.getModifiedItemAttr("maxRange"): - ew['velocity'].append(1 + (mod.getModifiedItemAttr("speedFactor") / 100)) - elif mod.getModifiedItemAttr("falloffEffectiveness") > 0: - # I am affected by falloff - ew['velocity'].append( - 1 + (mod.getModifiedItemAttr("speedFactor") / 100) * self.calculateModuleMultiplier(mod, - data)) - - ew['signatureRadius'].sort(key=abssort) - ew['velocity'].sort(key=abssort) - - for attr, values in ew.iteritems(): - val = data[attr] - try: - for i in xrange(len(values)): - bonus = values[i] - val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289) - data[attr] = val - except: - pass - - for mod in fit.modules: - dps, _ = mod.damageStats(fit.targetResists) - if mod.hardpoint == Hardpoint.TURRET: - if mod.state >= State.ACTIVE: - total += dps * self.calculateTurretMultiplier(mod, data) - - elif mod.hardpoint == Hardpoint.MISSILE: - if mod.state >= State.ACTIVE and mod.maxRange >= distance: - total += dps * self.calculateMissileMultiplier(mod, data) - - if distance <= fit.extraAttributes["droneControlRange"]: - for drone in fit.drones: - multiplier = 1 if drone.getModifiedItemAttr("maxVelocity") > 1 else self.calculateTurretMultiplier( - drone, data) - dps, _ = drone.damageStats(fit.targetResists) - total += dps * multiplier - - # this is janky as fuck - for fighter in fit.fighters: - for ability in fighter.abilities: - if ability.dealsDamage and ability.active: - multiplier = self.calculateFighterMissileMultiplier(ability, data) - dps, _ = ability.damageStats(fit.targetResists) - total += dps * multiplier - - return total - - def calculateMissileMultiplier(self, mod, data): - targetSigRad = data["signatureRadius"] - targetVelocity = data["velocity"] - explosionRadius = mod.getModifiedChargeAttr("aoeCloudSize") - targetSigRad = explosionRadius if targetSigRad is None else targetSigRad - explosionVelocity = mod.getModifiedChargeAttr("aoeVelocity") - damageReductionFactor = mod.getModifiedChargeAttr("aoeDamageReductionFactor") - - sigRadiusFactor = targetSigRad / explosionRadius - if targetVelocity: - velocityFactor = ( - explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** damageReductionFactor - else: - velocityFactor = 1 - - return min(sigRadiusFactor, velocityFactor, 1) - - def calculateTurretMultiplier(self, mod, data): - # Source for most of turret calculation info: http://wiki.eveonline.com/en/wiki/Falloff - chanceToHit = self.calculateTurretChanceToHit(mod, data) - if chanceToHit > 0.01: - # AvgDPS = Base Damage * [ ( ChanceToHit^2 + ChanceToHit + 0.0499 ) / 2 ] - multiplier = (chanceToHit ** 2 + chanceToHit + 0.0499) / 2 - else: - # All hits are wreckings - multiplier = chanceToHit * 3 - dmgScaling = mod.getModifiedItemAttr("turretDamageScalingRadius") - if dmgScaling: - targetSigRad = data["signatureRadius"] - multiplier = min(1, (float(targetSigRad) / dmgScaling) ** 2) - return multiplier - - def calculateFighterMissileMultiplier(self, ability, data): - prefix = ability.attrPrefix - - targetSigRad = data["signatureRadius"] - targetVelocity = data["velocity"] - explosionRadius = ability.fighter.getModifiedItemAttr("{}ExplosionRadius".format(prefix)) - explosionVelocity = ability.fighter.getModifiedItemAttr("{}ExplosionVelocity".format(prefix)) - damageReductionFactor = ability.fighter.getModifiedItemAttr("{}ReductionFactor".format(prefix)) - - # the following conditionals are because CCP can't keep a decent naming convention, as if fighter implementation - # wasn't already fucked. - if damageReductionFactor is None: - damageReductionFactor = ability.fighter.getModifiedItemAttr("{}DamageReductionFactor".format(prefix)) - - damageReductionSensitivity = ability.fighter.getModifiedItemAttr("{}ReductionSensitivity".format(prefix)) - if damageReductionSensitivity is None: - damageReductionSensitivity = ability.fighter.getModifiedItemAttr( - "{}DamageReductionSensitivity".format(prefix)) - - targetSigRad = explosionRadius if targetSigRad is None else targetSigRad - sigRadiusFactor = targetSigRad / explosionRadius - - if targetVelocity: - velocityFactor = (explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** ( - log(damageReductionFactor) / log(damageReductionSensitivity)) - else: - velocityFactor = 1 - - return min(sigRadiusFactor, velocityFactor, 1) - - def calculateTurretChanceToHit(self, mod, data): - distance = data["distance"] * 1000 - tracking = mod.getModifiedItemAttr("trackingSpeed") - turretOptimal = mod.maxRange - turretFalloff = mod.falloff - turretSigRes = mod.getModifiedItemAttr("optimalSigRadius") - targetSigRad = data["signatureRadius"] - targetSigRad = turretSigRes if targetSigRad is None else targetSigRad - transversal = sin(radians(data["angle"])) * data["velocity"] - trackingEq = (((transversal / (distance * tracking)) * - (turretSigRes / targetSigRad)) ** 2) - rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2 - - return 0.5 ** (trackingEq + rangeEq) - - def calculateModuleMultiplier(self, mod, data): - # Simplified formula, we make some assumptions about the module - # This is basically the calculateTurretChanceToHit without tracking values - distance = data["distance"] * 1000 - turretOptimal = mod.maxRange - turretFalloff = mod.falloff - rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2 - - return 0.5 ** (rangeEq) +# =============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of eos. +# +# eos is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# eos 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with eos. If not, see . +# =============================================================================== + +from math import log, sin, radians, exp + +from eos.graph import Graph +from eos.types import Hardpoint, State + + +class FitDpsGraph(Graph): + defaults = {"angle": 0, + "distance": 0, + "signatureRadius": None, + "velocity": 0} + + def __init__(self, fit, data=None): + Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults) + self.fit = fit + + def calcDps(self, data): + ew = {'signatureRadius': [], 'velocity': []} + fit = self.fit + total = 0 + distance = data["distance"] * 1000 + abssort = lambda val: -abs(val - 1) + + for mod in fit.modules: + if not mod.isEmpty and mod.state >= State.ACTIVE: + if "remoteTargetPaintFalloff" in mod.item.effects: + ew['signatureRadius'].append( + 1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier( + mod, data)) + if "remoteWebifierFalloff" in mod.item.effects: + if distance <= mod.getModifiedItemAttr("maxRange"): + ew['velocity'].append(1 + (mod.getModifiedItemAttr("speedFactor") / 100)) + elif mod.getModifiedItemAttr("falloffEffectiveness") > 0: + # I am affected by falloff + ew['velocity'].append( + 1 + (mod.getModifiedItemAttr("speedFactor") / 100) * self.calculateModuleMultiplier(mod, + data)) + + ew['signatureRadius'].sort(key=abssort) + ew['velocity'].sort(key=abssort) + + for attr, values in ew.iteritems(): + val = data[attr] + try: + for i in xrange(len(values)): + bonus = values[i] + val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289) + data[attr] = val + except: + pass + + for mod in fit.modules: + dps, _ = mod.damageStats(fit.targetResists) + if mod.hardpoint == Hardpoint.TURRET: + if mod.state >= State.ACTIVE: + total += dps * self.calculateTurretMultiplier(mod, data) + + elif mod.hardpoint == Hardpoint.MISSILE: + if mod.state >= State.ACTIVE and mod.maxRange >= distance: + total += dps * self.calculateMissileMultiplier(mod, data) + + if distance <= fit.extraAttributes["droneControlRange"]: + for drone in fit.drones: + multiplier = 1 if drone.getModifiedItemAttr("maxVelocity") > 1 else self.calculateTurretMultiplier( + drone, data) + dps, _ = drone.damageStats(fit.targetResists) + total += dps * multiplier + + # this is janky as fuck + for fighter in fit.fighters: + for ability in fighter.abilities: + if ability.dealsDamage and ability.active: + multiplier = self.calculateFighterMissileMultiplier(ability, data) + dps, _ = ability.damageStats(fit.targetResists) + total += dps * multiplier + + return total + + def calculateMissileMultiplier(self, mod, data): + targetSigRad = data["signatureRadius"] + targetVelocity = data["velocity"] + explosionRadius = mod.getModifiedChargeAttr("aoeCloudSize") + targetSigRad = explosionRadius if targetSigRad is None else targetSigRad + explosionVelocity = mod.getModifiedChargeAttr("aoeVelocity") + damageReductionFactor = mod.getModifiedChargeAttr("aoeDamageReductionFactor") + + sigRadiusFactor = targetSigRad / explosionRadius + if targetVelocity: + velocityFactor = (explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** damageReductionFactor + else: + velocityFactor = 1 + + return min(sigRadiusFactor, velocityFactor, 1) + + def calculateTurretMultiplier(self, mod, data): + # Source for most of turret calculation info: http://wiki.eveonline.com/en/wiki/Falloff + chanceToHit = self.calculateTurretChanceToHit(mod, data) + if chanceToHit > 0.01: + # AvgDPS = Base Damage * [ ( ChanceToHit^2 + ChanceToHit + 0.0499 ) / 2 ] + multiplier = (chanceToHit ** 2 + chanceToHit + 0.0499) / 2 + else: + # All hits are wreckings + multiplier = chanceToHit * 3 + dmgScaling = mod.getModifiedItemAttr("turretDamageScalingRadius") + if dmgScaling: + targetSigRad = data["signatureRadius"] + multiplier = min(1, (float(targetSigRad) / dmgScaling) ** 2) + return multiplier + + def calculateFighterMissileMultiplier(self, ability, data): + prefix = ability.attrPrefix + + targetSigRad = data["signatureRadius"] + targetVelocity = data["velocity"] + explosionRadius = ability.fighter.getModifiedItemAttr("{}ExplosionRadius".format(prefix)) + explosionVelocity = ability.fighter.getModifiedItemAttr("{}ExplosionVelocity".format(prefix)) + damageReductionFactor = ability.fighter.getModifiedItemAttr("{}ReductionFactor".format(prefix)) + + # the following conditionals are because CCP can't keep a decent naming convention, as if fighter implementation + # wasn't already fucked. + if damageReductionFactor is None: + damageReductionFactor = ability.fighter.getModifiedItemAttr("{}DamageReductionFactor".format(prefix)) + + damageReductionSensitivity = ability.fighter.getModifiedItemAttr("{}ReductionSensitivity".format(prefix)) + if damageReductionSensitivity is None: + damageReductionSensitivity = ability.fighter.getModifiedItemAttr( + "{}DamageReductionSensitivity".format(prefix)) + + targetSigRad = explosionRadius if targetSigRad is None else targetSigRad + sigRadiusFactor = targetSigRad / explosionRadius + + if targetVelocity: + velocityFactor = (explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** ( + log(damageReductionFactor) / log(damageReductionSensitivity)) + else: + velocityFactor = 1 + + return min(sigRadiusFactor, velocityFactor, 1) + + def calculateTurretChanceToHit(self, mod, data): + distance = data["distance"] * 1000 + tracking = mod.getModifiedItemAttr("trackingSpeed") + turretOptimal = mod.maxRange + turretFalloff = mod.falloff + turretSigRes = mod.getModifiedItemAttr("optimalSigRadius") + targetSigRad = data["signatureRadius"] + targetSigRad = turretSigRes if targetSigRad is None else targetSigRad + transversal = sin(radians(data["angle"])) * data["velocity"] + trackingEq = (((transversal / (distance * tracking)) * + (turretSigRes / targetSigRad)) ** 2) + rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2 + + return 0.5 ** (trackingEq + rangeEq) + + def calculateModuleMultiplier(self, mod, data): + # Simplified formula, we make some assumptions about the module + # This is basically the calculateTurretChanceToHit without tracking values + distance = data["distance"] * 1000 + turretOptimal = mod.maxRange + turretFalloff = mod.falloff + rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2 + + return 0.5 ** (rangeEq) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index c0f778263..d060eb425 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -132,8 +132,8 @@ class ModifiedAttributeDict(collections.MutableMapping): return (key for key in all) def __contains__(self, key): - return ( - self.__original is not None and key in self.__original) or key in self.__modified or key in self.__intermediary + return (self.__original is not None and key in self.__original) or \ + key in self.__modified or key in self.__intermediary def __placehold(self, key): """Create calculation placeholder in item's modified attribute dict""" diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index 3be3845d0..93f0a4bc3 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -159,6 +159,7 @@ class Booster(HandledItem, ItemAttrShortcut): return copy + # Legacy booster side effect code, disabling as not currently implemented ''' class SideEffect(object): @@ -194,4 +195,4 @@ class Booster(HandledItem, ItemAttrShortcut): raise TypeError("Need an effect with a handler") self.__effect = effect -''' \ No newline at end of file +''' diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index 23218ef02..54249a094 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -124,10 +124,6 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def abilities(self): return self.__abilities or [] - @property - def charge(self): - return self.__charge - @property def itemModifiedAttributes(self): return self.__itemModifiedAttributes @@ -269,8 +265,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): for ability in self.abilities: if ability.active: effect = ability.effect - if effect.runTime == runTime and \ - effect.activeByDefault and \ + if effect.runTime == runTime and effect.activeByDefault and \ ((projected and effect.isType("projected")) or not projected): if ability.grouped: effect.handler(fit, self, context) diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index 38a21a27e..cb7c34912 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -95,14 +95,12 @@ class FighterAbility(object): @property def reloadTime(self): - return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + \ - (self.REARM_TIME_MAPPING[self.fighter.getModifiedItemAttr( - "fighterSquadronRole")] or 0 if self.hasCharges else 0) * self.numShots + rearm_time = (self.REARM_TIME_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0) + return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + rearm_time * self.numShots @property def numShots(self): - return self.NUM_SHOTS_MAPPING[ - self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0 + return self.NUM_SHOTS_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0 @property def cycleTime(self): diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 69341c386..8e5435acf 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -28,10 +28,12 @@ from sqlalchemy.orm import validates, reconstructor import eos.db from eos import capSim from eos.effectHandlerHelpers import * +from eos.effectHandlerHelpers import HandledModuleList, HandledDroneCargoList, HandledImplantBoosterList, HandledProjectedDroneList, HandledProjectedModList from eos.enum import Enum from eos.saveddata.module import State, Hardpoint from eos.types import Ship, Character, Slot, Module, Citadel from utils.timer import Timer +import logging logger = logging.getLogger(__name__) @@ -471,7 +473,7 @@ class Fit(object): # todo: ensure that these are run with the module is active only context += ("commandRun",) self.register(thing) - effect.handler(self, thing, context, warfareBuffID = warfareBuffID) + effect.handler(self, thing, context, warfareBuffID=warfareBuffID) # if effect.isType("offline") or (effect.isType("passive") and thing.state >= State.ONLINE) or \ # (effect.isType("active") and thing.state >= State.ACTIVE): @@ -619,7 +621,7 @@ class Fit(object): if not withBoosters and self.commandBonuses: self.__runCommandBoosts(runTime) - timer.checkpoint('Done with runtime: %s'%runTime) + timer.checkpoint('Done with runtime: %s' % runTime) # Mark fit as calculated self.__calculated = True diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 998ac595b..f72431a00 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -1,725 +1,725 @@ -# =============================================================================== -# Copyright (C) 2010 Diego Duclos -# -# This file is part of eos. -# -# eos is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# eos 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with eos. If not, see . -# =============================================================================== - -import logging - -from sqlalchemy.orm import validates, reconstructor - -import eos.db -from eos.effectHandlerHelpers import HandledItem, HandledCharge -from eos.enum import Enum -from eos.mathUtils import floorFloat -from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut -from eos.types import Citadel - -logger = logging.getLogger(__name__) - - -class State(Enum): - OFFLINE = -1 - ONLINE = 0 - ACTIVE = 1 - OVERHEATED = 2 - - -class Slot(Enum): - - # These are self-explanatory - LOW = 1 - MED = 2 - HIGH = 3 - RIG = 4 - SUBSYSTEM = 5 - # not a real slot, need for pyfa display rack separation - MODE = 6 - # system effects. They are projected "modules" and pyfa assumes all modules - # have a slot. In this case, make one up. - SYSTEM = 7 - # used for citadel services - SERVICE = 8 - # fighter 'slots'. Just easier to put them here... - F_LIGHT = 10 - F_SUPPORT = 11 - F_HEAVY = 12 - - -class Hardpoint(Enum): - - NONE = 0 - MISSILE = 1 - TURRET = 2 - - -class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, list): - """An instance of this class represents a module together with its charge and modified attributes""" - DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") - MINING_ATTRIBUTES = ("miningAmount",) - - def __init__(self, item): - """Initialize a module from the program""" - self.__item = item - - if item is not None and self.isInvalid: - raise ValueError("Passed item is not a Module") - - self.__charge = None - self.itemID = item.ID if item is not None else None - self.projected = False - self.state = State.ONLINE - self.build() - - @reconstructor - def init(self): - """Initialize a module from the database and validate""" - self.__item = None - self.__charge = None - - # we need this early if module is invalid and returns early - self.__slot = self.dummySlot - - if self.itemID: - self.__item = eos.db.getItem(self.itemID) - if self.__item is None: - logger.error("Item (id: %d) does not exist", self.itemID) - return - - if self.isInvalid: - logger.error("Item (id: %d) is not a Module", self.itemID) - return - - if self.chargeID: - self.__charge = eos.db.getItem(self.chargeID) - - self.build() - - def build(self): - """ Builds internal module variables from both init's """ - - if self.__charge and self.__charge.category.name != "Charge": - self.__charge = None - - self.__dps = None - self.__miningyield = None - self.__volley = None - self.__reloadTime = None - self.__reloadForce = None - self.__chargeCycles = None - self.__hardpoint = Hardpoint.NONE - self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self) - self.__chargeModifiedAttributes = ModifiedAttributeDict(parent=self) - self.__slot = self.dummySlot # defaults to None - - if self.__item: - self.__itemModifiedAttributes.original = self.__item.attributes - self.__itemModifiedAttributes.overrides = self.__item.overrides - self.__hardpoint = self.__calculateHardpoint(self.__item) - self.__slot = self.__calculateSlot(self.__item) - if self.__charge: - self.__chargeModifiedAttributes.original = self.__charge.attributes - self.__chargeModifiedAttributes.overrides = self.__charge.overrides - - def toDummy(self, index): - mod = self[index] - if not mod.isEmpty: - dummy = Module.buildEmpty(mod.slot) - dummy.position = index - self[index] = dummy - - @classmethod - def buildEmpty(cls, slot): - empty = Module(None) - empty.__slot = slot - empty.dummySlot = slot - return empty - - @classmethod - def buildRack(cls, slot): - empty = Rack(None) - empty.__slot = slot - empty.dummySlot = slot - return empty - - @property - def isEmpty(self): - return self.dummySlot is not None - - @property - def hardpoint(self): - return self.__hardpoint - - @property - def isInvalid(self): - if self.isEmpty: - return False - return self.__item is None or (self.__item.category.name not in ("Module", "Subsystem", "Structure Module") and self.__item.group.name != "Effect Beacon") - - @property - def numCharges(self): - if self.charge is None: - charges = 0 - else: - chargeVolume = self.charge.volume - containerCapacity = self.item.capacity - if chargeVolume is None or containerCapacity is None: - charges = 0 - else: - charges = floorFloat(float(containerCapacity) / chargeVolume) - return charges - - @property - def numShots(self): - if self.charge is None: - return None - if self.__chargeCycles is None and self.charge: - numCharges = self.numCharges - # Usual ammo like projectiles and missiles - if numCharges > 0 and "chargeRate" in self.itemModifiedAttributes: - self.__chargeCycles = self.__calculateAmmoShots() - # Frequency crystals (combat and mining lasers) - elif numCharges > 0 and "crystalsGetDamaged" in self.chargeModifiedAttributes: - self.__chargeCycles = self.__calculateCrystalShots() - # Scripts and stuff - else: - self.__chargeCycles = 0 - return self.__chargeCycles - else: - return self.__chargeCycles - - @property - def hpBeforeReload(self): - """ - If item is some kind of repairer with charges, calculate - HP it reps before going into reload. - """ - cycles = self.numShots - armorRep = self.getModifiedItemAttr("armorDamageAmount") or 0 - shieldRep = self.getModifiedItemAttr("shieldBonus") or 0 - if not cycles or (not armorRep and not shieldRep): - return None - hp = round((armorRep + shieldRep) * cycles) - return hp - - def __calculateAmmoShots(self): - if self.charge is not None: - # Set number of cycles before reload is needed - chargeRate = self.getModifiedItemAttr("chargeRate") - numCharges = self.numCharges - numShots = floorFloat(float(numCharges) / chargeRate) - else: - numShots = None - return numShots - - def __calculateCrystalShots(self): - if self.charge is not None: - if self.getModifiedChargeAttr("crystalsGetDamaged") == 1: - # For depletable crystals, calculate average amount of shots before it's destroyed - hp = self.getModifiedChargeAttr("hp") - chance = self.getModifiedChargeAttr("crystalVolatilityChance") - damage = self.getModifiedChargeAttr("crystalVolatilityDamage") - crystals = self.numCharges - numShots = floorFloat(float(crystals * hp) / (damage * chance)) - else: - # Set 0 (infinite) for permanent crystals like t1 laser crystals - numShots = 0 - else: - numShots = None - return numShots - - @property - def maxRange(self): - attrs = ("maxRange", "shieldTransferRange", "powerTransferRange", - "energyDestabilizationRange", "empFieldRange", - "ecmBurstRange", "warpScrambleRange", "cargoScanRange", - "shipScanRange", "surveyScanRange") - for attr in attrs: - maxRange = self.getModifiedItemAttr(attr) - if maxRange is not None: - return maxRange - if self.charge is not None: - try: - chargeName = self.charge.group.name - except AttributeError: - pass - else: - if chargeName in ("Scanner Probe", "Survey Probe"): - return None - # Source: http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1307419&page=1#15 - # D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1]) - maxVelocity = self.getModifiedChargeAttr("maxVelocity") - flightTime = self.getModifiedChargeAttr("explosionDelay") / 1000.0 - mass = self.getModifiedChargeAttr("mass") - agility = self.getModifiedChargeAttr("agility") - if maxVelocity and flightTime and mass and agility: - accelTime = min(flightTime, mass * agility / 1000000) - # Average distance done during acceleration - duringAcceleration = maxVelocity / 2 * accelTime - # Distance done after being at full speed - fullSpeed = maxVelocity * (flightTime - accelTime) - return duringAcceleration + fullSpeed - - @property - def falloff(self): - attrs = ("falloffEffectiveness", "falloff", "shipScanFalloff") - for attr in attrs: - falloff = self.getModifiedItemAttr(attr) - if falloff is not None: - return falloff - - @property - def slot(self): - return self.__slot - - @property - def itemModifiedAttributes(self): - return self.__itemModifiedAttributes - - @property - def chargeModifiedAttributes(self): - return self.__chargeModifiedAttributes - - @property - def item(self): - return self.__item if self.__item != 0 else None - - @property - def charge(self): - return self.__charge if self.__charge != 0 else None - - @charge.setter - def charge(self, charge): - self.__charge = charge - if charge is not None: - self.chargeID = charge.ID - self.__chargeModifiedAttributes.original = charge.attributes - self.__chargeModifiedAttributes.overrides = charge.overrides - else: - self.chargeID = None - self.__chargeModifiedAttributes.original = None - self.__chargeModifiedAttributes.overrides = {} - - self.__itemModifiedAttributes.clear() - - def damageStats(self, targetResists): - if self.__dps is None: - self.__dps = 0 - self.__volley = 0 - - if not self.isEmpty and self.state >= State.ACTIVE: - if self.charge: - func = self.getModifiedChargeAttr - else: - func = self.getModifiedItemAttr - - volley = sum(map( - lambda attr: (func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)), - self.DAMAGE_TYPES)) - volley *= self.getModifiedItemAttr("damageMultiplier") or 1 - if volley: - cycleTime = self.cycleTime - self.__volley = volley - self.__dps = volley / (cycleTime / 1000.0) - - return self.__dps, self.__volley - - @property - def miningStats(self): - if self.__miningyield is None: - if self.isEmpty: - self.__miningyield = 0 - else: - if self.state >= State.ACTIVE: - volley = self.getModifiedItemAttr("specialtyMiningAmount") or self.getModifiedItemAttr( - "miningAmount") or 0 - if volley: - cycleTime = self.cycleTime - self.__miningyield = volley / (cycleTime / 1000.0) - else: - self.__miningyield = 0 - else: - self.__miningyield = 0 - - return self.__miningyield - - @property - def dps(self): - return self.damageStats(None)[0] - - @property - def volley(self): - return self.damageStats(None)[1] - - @property - def reloadTime(self): - # Get reload time from attrs first, then use - # custom value specified otherwise (e.g. in effects) - moduleReloadTime = self.getModifiedItemAttr("reloadTime") - if moduleReloadTime is None: - moduleReloadTime = self.__reloadTime - return moduleReloadTime - - @reloadTime.setter - def reloadTime(self, milliseconds): - self.__reloadTime = milliseconds - - @property - def forceReload(self): - return self.__reloadForce - - @forceReload.setter - def forceReload(self, type): - self.__reloadForce = type - - def fits(self, fit, hardpointLimit=True): - slot = self.slot - if fit.getSlotsFree(slot) <= (0 if self.owner != fit else -1): - return False - - # Check ship type restrictions - fitsOnType = set() - fitsOnGroup = set() - - shipType = self.getModifiedItemAttr("fitsToShipType") - if shipType is not None: - fitsOnType.add(shipType) - - for attr in self.itemModifiedAttributes.keys(): - if attr.startswith("canFitShipType"): - shipType = self.getModifiedItemAttr(attr) - if shipType is not None: - fitsOnType.add(shipType) - - for attr in self.itemModifiedAttributes.keys(): - if attr.startswith("canFitShipGroup"): - shipGroup = self.getModifiedItemAttr(attr) - if shipGroup is not None: - fitsOnGroup.add(shipGroup) - - if (len(fitsOnGroup) > 0 or len( - fitsOnType) > 0) and fit.ship.item.group.ID not in fitsOnGroup and fit.ship.item.ID not in fitsOnType: - return False - - # AFAIK Citadel modules will always be restricted based on canFitShipType/Group. If we are fitting to a Citadel - # and the module does not have these properties, return false to prevent regular ship modules from being used - if isinstance(fit.ship, Citadel) and len(fitsOnGroup) == 0 and len(fitsOnType) == 0: - return False - - # If the mod is a subsystem, don't let two subs in the same slot fit - if self.slot == Slot.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.getModifiedItemAttr("rigSize") != fit.ship.getModifiedItemAttr("rigSize"): - return False - - # Check max group fitted - max = self.getModifiedItemAttr("maxGroupFitted") - if max is not None: - current = 0 if self.owner != fit else -1 - for mod in fit.modules: - if mod.item and mod.item.groupID == self.item.groupID: - current += 1 - - if current >= max: - return False - - # Check this only if we're told to do so - if hardpointLimit: - if self.hardpoint == Hardpoint.TURRET: - if (fit.ship.getModifiedItemAttr('turretSlotsLeft') or 0) - fit.getHardpointsUsed(Hardpoint.TURRET) < 1: - return False - elif self.hardpoint == Hardpoint.MISSILE: - if (fit.ship.getModifiedItemAttr('launcherSlotsLeft') or 0) - fit.getHardpointsUsed( - Hardpoint.MISSILE) < 1: - return False - - return True - - def isValidState(self, state): - """ - Check if the state is valid for this module, without considering other modules at all - """ - # Check if we're within bounds - if state < -1 or state > 2: - return False - elif state >= State.ACTIVE and not self.item.isType("active"): - return False - elif state == State.OVERHEATED and not self.item.isType("overheat"): - return False - else: - return True - - def canHaveState(self, state=None, projectedOnto=None): - """ - Check with other modules if there are restrictions that might not allow this module to be activated - """ - # 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): - return True - - # Check if the local module is over it's max limit; if it's not, we're fine - maxGroupActive = self.getModifiedItemAttr("maxGroupActive") - if maxGroupActive is None and projectedOnto is None: - return True - - # Following is applicable only to local modules, we do not want to limit projected - if projectedOnto is None: - currActive = 0 - 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: - currActive += 1 - if currActive > maxGroupActive: - break - return currActive <= maxGroupActive - # For projected, we're checking if ship is vulnerable to given item - else: - # Do not allow to apply offensive modules on ship with offensive module immunite, with few exceptions - # (all effects which apply instant modification are exception, generally speaking) - if item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1: - offensiveNonModifiers = {"energyDestabilizationNew", - "leech", - "energyNosferatuFalloff", - "energyNeutralizerFalloff"} - if not offensiveNonModifiers.intersection(set(item.effects)): - return False - # If assistive modules are not allowed, do not let to apply these altogether - if item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1: - return False - return True - - def isValidCharge(self, charge): - # Check sizes, if 'charge size > module volume' it won't fit - if charge is None: - return True - chargeVolume = charge.volume - moduleCapacity = self.item.capacity - if chargeVolume is not None and moduleCapacity is not None and chargeVolume > moduleCapacity: - return False - - itemChargeSize = self.getModifiedItemAttr("chargeSize") - if itemChargeSize > 0: - chargeSize = charge.getAttribute('chargeSize') - if itemChargeSize != chargeSize: - return False - - chargeGroup = charge.groupID - for i in range(5): - itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i)) - if itemChargeGroup is None: - continue - if itemChargeGroup == chargeGroup: - return True - - return False - - def getValidCharges(self): - validCharges = set() - for i in range(5): - itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i)) - if itemChargeGroup is not None: - g = eos.db.getGroup(int(itemChargeGroup), eager=("items.icon", "items.attributes")) - if g is None: - continue - for singleItem in g.items: - if singleItem.published and self.isValidCharge(singleItem): - validCharges.add(singleItem) - - return validCharges - - def __calculateHardpoint(self, item): - effectHardpointMap = {"turretFitted": Hardpoint.TURRET, - "launcherFitted": Hardpoint.MISSILE} - - if item is None: - return Hardpoint.NONE - - for effectName, slot in effectHardpointMap.iteritems(): - if effectName in item.effects: - return slot - - return Hardpoint.NONE - - def __calculateSlot(self, item): - effectSlotMap = {"rigSlot": Slot.RIG, - "loPower": Slot.LOW, - "medPower": Slot.MED, - "hiPower": Slot.HIGH, - "subSystem": Slot.SUBSYSTEM, - "serviceSlot": Slot.SERVICE} - if item is None: - return None - for effectName, slot in effectSlotMap.iteritems(): - if effectName in item.effects: - return slot - if item.group.name == "Effect Beacon": - return Slot.SYSTEM - - raise ValueError("Passed item does not fit in any known slot") - - @validates("ID", "itemID", "ammoID") - def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "itemID": lambda val: val is None or isinstance(val, int), - "ammoID": lambda val: isinstance(val, int)} - - if not map[key](val): - raise ValueError(str(val) + " is not a valid value for " + key) - else: - return val - - def clear(self): - self.__dps = None - self.__miningyield = None - self.__volley = None - self.__reloadTime = None - self.__reloadForce = None - self.__chargeCycles = None - self.itemModifiedAttributes.clear() - self.chargeModifiedAttributes.clear() - - def calculateModifiedAttributes(self, fit, runTime, forceProjected = False, gang = False): - #We will run the effect when two conditions are met: - #1: It makes sense to run the effect - # The effect is either offline - # or the effect is passive and the module is in the online state (or higher) - - # or the effect is active and the module is in the active state (or higher) - # or the effect is overheat and the module is in the overheated state (or higher) - # 2: the runtimes match - - if self.projected or forceProjected: - context = "projected", "module" - projected = True - else: - context = ("module",) - projected = False - - # if gang: - # context += ("commandRun",) - - if self.charge is not None: - # fix for #82 and it's regression #106 - if not projected or (self.projected and not forceProjected) or gang: - for effect in self.charge.effects.itervalues(): - 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 \ - (not gang or (gang and effect.isType("gang"))): - - chargeContext = ("moduleCharge",) - # For gang effects, we pass in the effect itself as an argument. However, to avoid going through - # all the effect files and defining this argument, do a simple try/catch here and be done with it. - # @todo: possibly fix this - try: - effect.handler(fit, self, chargeContext, effect=effect) - except: - effect.handler(fit, self, chargeContext) - - if self.item: - if self.state >= State.OVERHEATED: - for effect in self.item.effects.itervalues(): - if effect.runTime == runTime and \ - effect.isType("overheat") \ - and not forceProjected \ - and effect.activeByDefault \ - and ((gang and effect.isType("gang")) or not gang): - effect.handler(fit, self, context) - - for effect in self.item.effects.itervalues(): - 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 ((projected and effect.isType("projected")) or not projected)\ - and ((gang and effect.isType("gang")) or not gang): - effect.handler(fit, self, context) - - @property - def cycleTime(self): - reactivation = (self.getModifiedItemAttr("moduleReactivationDelay") or 0) - # Reactivation time starts counting after end of module cycle - speed = self.rawCycleTime + reactivation - if self.charge: - reload = self.reloadTime - else: - reload = 0.0 - # Determine if we'll take into account reload time or not - factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload - # If reactivation is longer than 10 seconds then module can be reloaded - # during reactivation time, thus we may ignore reload - if factorReload and reactivation < reload: - numShots = self.numShots - # Time it takes to reload module after end of reactivation time, - # given that we started when module cycle has just over - additionalReloadTime = (reload - reactivation) - # Speed here already takes into consideration reactivation time - speed = (speed * numShots + additionalReloadTime) / numShots if numShots > 0 else speed - - return speed - - @property - def rawCycleTime(self): - speed = self.getModifiedItemAttr("speed") or self.getModifiedItemAttr("duration") - return speed - - @property - def capUse(self): - capNeed = self.getModifiedItemAttr("capacitorNeed") - if capNeed and self.state >= State.ACTIVE: - cycleTime = self.cycleTime - capUsed = capNeed / (cycleTime / 1000.0) - return capUsed - else: - return 0 - - def __deepcopy__(self, memo): - item = self.item - if item is None: - copy = Module.buildEmpty(self.slot) - else: - copy = Module(self.item) - copy.charge = self.charge - copy.state = self.state - return copy - - def __repr__(self): - if self.item: - return "Module(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) - ) - else: - return "EmptyModule() at {}".format(hex(id(self))) - - -class Rack(Module): - """ - This is simply the Module class named something else to differentiate - it for app logic. This class does not do anything special - """ - pass +# =============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of eos. +# +# eos is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# eos 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with eos. If not, see . +# =============================================================================== + +import logging + +from sqlalchemy.orm import validates, reconstructor + +import eos.db +from eos.effectHandlerHelpers import HandledItem, HandledCharge +from eos.enum import Enum +from eos.mathUtils import floorFloat +from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut +from eos.types import Citadel + +logger = logging.getLogger(__name__) + + +class State(Enum): + OFFLINE = -1 + ONLINE = 0 + ACTIVE = 1 + OVERHEATED = 2 + + +class Slot(Enum): + # These are self-explanatory + LOW = 1 + MED = 2 + HIGH = 3 + RIG = 4 + SUBSYSTEM = 5 + # not a real slot, need for pyfa display rack separation + MODE = 6 + # system effects. They are projected "modules" and pyfa assumes all modules + # have a slot. In this case, make one up. + SYSTEM = 7 + # used for citadel services + SERVICE = 8 + # fighter 'slots'. Just easier to put them here... + F_LIGHT = 10 + F_SUPPORT = 11 + F_HEAVY = 12 + + +class Hardpoint(Enum): + NONE = 0 + MISSILE = 1 + TURRET = 2 + + +class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, list): + """An instance of this class represents a module together with its charge and modified attributes""" + DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") + MINING_ATTRIBUTES = ("miningAmount",) + + def __init__(self, item): + """Initialize a module from the program""" + self.__item = item + + if item is not None and self.isInvalid: + raise ValueError("Passed item is not a Module") + + self.__charge = None + self.itemID = item.ID if item is not None else None + self.projected = False + self.state = State.ONLINE + self.build() + + @reconstructor + def init(self): + """Initialize a module from the database and validate""" + self.__item = None + self.__charge = None + + # we need this early if module is invalid and returns early + self.__slot = self.dummySlot + + if self.itemID: + self.__item = eos.db.getItem(self.itemID) + if self.__item is None: + logger.error("Item (id: %d) does not exist", self.itemID) + return + + if self.isInvalid: + logger.error("Item (id: %d) is not a Module", self.itemID) + return + + if self.chargeID: + self.__charge = eos.db.getItem(self.chargeID) + + self.build() + + def build(self): + """ Builds internal module variables from both init's """ + + if self.__charge and self.__charge.category.name != "Charge": + self.__charge = None + + self.__dps = None + self.__miningyield = None + self.__volley = None + self.__reloadTime = None + self.__reloadForce = None + self.__chargeCycles = None + self.__hardpoint = Hardpoint.NONE + self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self) + self.__chargeModifiedAttributes = ModifiedAttributeDict(parent=self) + self.__slot = self.dummySlot # defaults to None + + if self.__item: + self.__itemModifiedAttributes.original = self.__item.attributes + self.__itemModifiedAttributes.overrides = self.__item.overrides + self.__hardpoint = self.__calculateHardpoint(self.__item) + self.__slot = self.__calculateSlot(self.__item) + if self.__charge: + self.__chargeModifiedAttributes.original = self.__charge.attributes + self.__chargeModifiedAttributes.overrides = self.__charge.overrides + + def toDummy(self, index): + mod = self[index] + if not mod.isEmpty: + dummy = Module.buildEmpty(mod.slot) + dummy.position = index + self[index] = dummy + + @classmethod + def buildEmpty(cls, slot): + empty = Module(None) + empty.__slot = slot + empty.dummySlot = slot + return empty + + @classmethod + def buildRack(cls, slot): + empty = Rack(None) + empty.__slot = slot + empty.dummySlot = slot + return empty + + @property + def isEmpty(self): + return self.dummySlot is not None + + @property + def hardpoint(self): + return self.__hardpoint + + @property + def isInvalid(self): + if self.isEmpty: + return False + return self.__item is None or \ + (self.__item.category.name not in ("Module", "Subsystem", "Structure Module") and + self.__item.group.name != "Effect Beacon") + + @property + def numCharges(self): + if self.charge is None: + charges = 0 + else: + chargeVolume = self.charge.volume + containerCapacity = self.item.capacity + if chargeVolume is None or containerCapacity is None: + charges = 0 + else: + charges = floorFloat(float(containerCapacity) / chargeVolume) + return charges + + @property + def numShots(self): + if self.charge is None: + return None + if self.__chargeCycles is None and self.charge: + numCharges = self.numCharges + # Usual ammo like projectiles and missiles + if numCharges > 0 and "chargeRate" in self.itemModifiedAttributes: + self.__chargeCycles = self.__calculateAmmoShots() + # Frequency crystals (combat and mining lasers) + elif numCharges > 0 and "crystalsGetDamaged" in self.chargeModifiedAttributes: + self.__chargeCycles = self.__calculateCrystalShots() + # Scripts and stuff + else: + self.__chargeCycles = 0 + return self.__chargeCycles + else: + return self.__chargeCycles + + @property + def hpBeforeReload(self): + """ + If item is some kind of repairer with charges, calculate + HP it reps before going into reload. + """ + cycles = self.numShots + armorRep = self.getModifiedItemAttr("armorDamageAmount") or 0 + shieldRep = self.getModifiedItemAttr("shieldBonus") or 0 + if not cycles or (not armorRep and not shieldRep): + return None + hp = round((armorRep + shieldRep) * cycles) + return hp + + def __calculateAmmoShots(self): + if self.charge is not None: + # Set number of cycles before reload is needed + chargeRate = self.getModifiedItemAttr("chargeRate") + numCharges = self.numCharges + numShots = floorFloat(float(numCharges) / chargeRate) + else: + numShots = None + return numShots + + def __calculateCrystalShots(self): + if self.charge is not None: + if self.getModifiedChargeAttr("crystalsGetDamaged") == 1: + # For depletable crystals, calculate average amount of shots before it's destroyed + hp = self.getModifiedChargeAttr("hp") + chance = self.getModifiedChargeAttr("crystalVolatilityChance") + damage = self.getModifiedChargeAttr("crystalVolatilityDamage") + crystals = self.numCharges + numShots = floorFloat(float(crystals * hp) / (damage * chance)) + else: + # Set 0 (infinite) for permanent crystals like t1 laser crystals + numShots = 0 + else: + numShots = None + return numShots + + @property + def maxRange(self): + attrs = ("maxRange", "shieldTransferRange", "powerTransferRange", + "energyDestabilizationRange", "empFieldRange", + "ecmBurstRange", "warpScrambleRange", "cargoScanRange", + "shipScanRange", "surveyScanRange") + for attr in attrs: + maxRange = self.getModifiedItemAttr(attr) + if maxRange is not None: + return maxRange + if self.charge is not None: + try: + chargeName = self.charge.group.name + except AttributeError: + pass + else: + if chargeName in ("Scanner Probe", "Survey Probe"): + return None + # Source: http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1307419&page=1#15 + # D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1]) + maxVelocity = self.getModifiedChargeAttr("maxVelocity") + flightTime = self.getModifiedChargeAttr("explosionDelay") / 1000.0 + mass = self.getModifiedChargeAttr("mass") + agility = self.getModifiedChargeAttr("agility") + if maxVelocity and flightTime and mass and agility: + accelTime = min(flightTime, mass * agility / 1000000) + # Average distance done during acceleration + duringAcceleration = maxVelocity / 2 * accelTime + # Distance done after being at full speed + fullSpeed = maxVelocity * (flightTime - accelTime) + return duringAcceleration + fullSpeed + + @property + def falloff(self): + attrs = ("falloffEffectiveness", "falloff", "shipScanFalloff") + for attr in attrs: + falloff = self.getModifiedItemAttr(attr) + if falloff is not None: + return falloff + + @property + def slot(self): + return self.__slot + + @property + def itemModifiedAttributes(self): + return self.__itemModifiedAttributes + + @property + def chargeModifiedAttributes(self): + return self.__chargeModifiedAttributes + + @property + def item(self): + return self.__item if self.__item != 0 else None + + @property + def charge(self): + return self.__charge if self.__charge != 0 else None + + @charge.setter + def charge(self, charge): + self.__charge = charge + if charge is not None: + self.chargeID = charge.ID + self.__chargeModifiedAttributes.original = charge.attributes + self.__chargeModifiedAttributes.overrides = charge.overrides + else: + self.chargeID = None + self.__chargeModifiedAttributes.original = None + self.__chargeModifiedAttributes.overrides = {} + + self.__itemModifiedAttributes.clear() + + def damageStats(self, targetResists): + if self.__dps is None: + self.__dps = 0 + self.__volley = 0 + + if not self.isEmpty and self.state >= State.ACTIVE: + if self.charge: + func = self.getModifiedChargeAttr + else: + func = self.getModifiedItemAttr + + volley = sum(map( + lambda attr: (func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)), + self.DAMAGE_TYPES)) + volley *= self.getModifiedItemAttr("damageMultiplier") or 1 + if volley: + cycleTime = self.cycleTime + self.__volley = volley + self.__dps = volley / (cycleTime / 1000.0) + + return self.__dps, self.__volley + + @property + def miningStats(self): + if self.__miningyield is None: + if self.isEmpty: + self.__miningyield = 0 + else: + if self.state >= State.ACTIVE: + volley = self.getModifiedItemAttr("specialtyMiningAmount") or self.getModifiedItemAttr( + "miningAmount") or 0 + if volley: + cycleTime = self.cycleTime + self.__miningyield = volley / (cycleTime / 1000.0) + else: + self.__miningyield = 0 + else: + self.__miningyield = 0 + + return self.__miningyield + + @property + def dps(self): + return self.damageStats(None)[0] + + @property + def volley(self): + return self.damageStats(None)[1] + + @property + def reloadTime(self): + # Get reload time from attrs first, then use + # custom value specified otherwise (e.g. in effects) + moduleReloadTime = self.getModifiedItemAttr("reloadTime") + if moduleReloadTime is None: + moduleReloadTime = self.__reloadTime + return moduleReloadTime + + @reloadTime.setter + def reloadTime(self, milliseconds): + self.__reloadTime = milliseconds + + @property + def forceReload(self): + return self.__reloadForce + + @forceReload.setter + def forceReload(self, type): + self.__reloadForce = type + + def fits(self, fit, hardpointLimit=True): + slot = self.slot + if fit.getSlotsFree(slot) <= (0 if self.owner != fit else -1): + return False + + # Check ship type restrictions + fitsOnType = set() + fitsOnGroup = set() + + shipType = self.getModifiedItemAttr("fitsToShipType") + if shipType is not None: + fitsOnType.add(shipType) + + for attr in self.itemModifiedAttributes.keys(): + if attr.startswith("canFitShipType"): + shipType = self.getModifiedItemAttr(attr) + if shipType is not None: + fitsOnType.add(shipType) + + for attr in self.itemModifiedAttributes.keys(): + if attr.startswith("canFitShipGroup"): + shipGroup = self.getModifiedItemAttr(attr) + if shipGroup is not None: + fitsOnGroup.add(shipGroup) + + if (len(fitsOnGroup) > 0 or len( + fitsOnType) > 0) and fit.ship.item.group.ID not in fitsOnGroup and fit.ship.item.ID not in fitsOnType: + return False + + # AFAIK Citadel modules will always be restricted based on canFitShipType/Group. If we are fitting to a Citadel + # and the module does not have these properties, return false to prevent regular ship modules from being used + if isinstance(fit.ship, Citadel) and len(fitsOnGroup) == 0 and len(fitsOnType) == 0: + return False + + # If the mod is a subsystem, don't let two subs in the same slot fit + if self.slot == Slot.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.getModifiedItemAttr("rigSize") != fit.ship.getModifiedItemAttr("rigSize"): + return False + + # Check max group fitted + max = self.getModifiedItemAttr("maxGroupFitted") + if max is not None: + current = 0 if self.owner != fit else -1 + for mod in fit.modules: + if mod.item and mod.item.groupID == self.item.groupID: + current += 1 + + if current >= max: + return False + + # Check this only if we're told to do so + if hardpointLimit: + if self.hardpoint == Hardpoint.TURRET: + if (fit.ship.getModifiedItemAttr('turretSlotsLeft') or 0) - fit.getHardpointsUsed(Hardpoint.TURRET) < 1: + return False + elif self.hardpoint == Hardpoint.MISSILE: + if (fit.ship.getModifiedItemAttr('launcherSlotsLeft') or 0) - fit.getHardpointsUsed( + Hardpoint.MISSILE) < 1: + return False + + return True + + def isValidState(self, state): + """ + Check if the state is valid for this module, without considering other modules at all + """ + # Check if we're within bounds + if state < -1 or state > 2: + return False + elif state >= State.ACTIVE and not self.item.isType("active"): + return False + elif state == State.OVERHEATED and not self.item.isType("overheat"): + return False + else: + return True + + def canHaveState(self, state=None, projectedOnto=None): + """ + Check with other modules if there are restrictions that might not allow this module to be activated + """ + # 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): + return True + + # Check if the local module is over it's max limit; if it's not, we're fine + maxGroupActive = self.getModifiedItemAttr("maxGroupActive") + if maxGroupActive is None and projectedOnto is None: + return True + + # Following is applicable only to local modules, we do not want to limit projected + if projectedOnto is None: + currActive = 0 + 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: + currActive += 1 + if currActive > maxGroupActive: + break + return currActive <= maxGroupActive + # For projected, we're checking if ship is vulnerable to given item + else: + # Do not allow to apply offensive modules on ship with offensive module immunite, with few exceptions + # (all effects which apply instant modification are exception, generally speaking) + if item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1: + offensiveNonModifiers = {"energyDestabilizationNew", + "leech", + "energyNosferatuFalloff", + "energyNeutralizerFalloff"} + if not offensiveNonModifiers.intersection(set(item.effects)): + return False + # If assistive modules are not allowed, do not let to apply these altogether + if item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1: + return False + return True + + def isValidCharge(self, charge): + # Check sizes, if 'charge size > module volume' it won't fit + if charge is None: + return True + chargeVolume = charge.volume + moduleCapacity = self.item.capacity + if chargeVolume is not None and moduleCapacity is not None and chargeVolume > moduleCapacity: + return False + + itemChargeSize = self.getModifiedItemAttr("chargeSize") + if itemChargeSize > 0: + chargeSize = charge.getAttribute('chargeSize') + if itemChargeSize != chargeSize: + return False + + chargeGroup = charge.groupID + for i in range(5): + itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i)) + if itemChargeGroup is None: + continue + if itemChargeGroup == chargeGroup: + return True + + return False + + def getValidCharges(self): + validCharges = set() + for i in range(5): + itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i)) + if itemChargeGroup is not None: + g = eos.db.getGroup(int(itemChargeGroup), eager=("items.icon", "items.attributes")) + if g is None: + continue + for singleItem in g.items: + if singleItem.published and self.isValidCharge(singleItem): + validCharges.add(singleItem) + + return validCharges + + def __calculateHardpoint(self, item): + effectHardpointMap = {"turretFitted": Hardpoint.TURRET, + "launcherFitted": Hardpoint.MISSILE} + + if item is None: + return Hardpoint.NONE + + for effectName, slot in effectHardpointMap.iteritems(): + if effectName in item.effects: + return slot + + return Hardpoint.NONE + + def __calculateSlot(self, item): + effectSlotMap = {"rigSlot": Slot.RIG, + "loPower": Slot.LOW, + "medPower": Slot.MED, + "hiPower": Slot.HIGH, + "subSystem": Slot.SUBSYSTEM, + "serviceSlot": Slot.SERVICE} + if item is None: + return None + for effectName, slot in effectSlotMap.iteritems(): + if effectName in item.effects: + return slot + if item.group.name == "Effect Beacon": + return Slot.SYSTEM + + raise ValueError("Passed item does not fit in any known slot") + + @validates("ID", "itemID", "ammoID") + def validator(self, key, val): + map = {"ID": lambda val: isinstance(val, int), + "itemID": lambda val: val is None or isinstance(val, int), + "ammoID": lambda val: isinstance(val, int)} + + if not map[key](val): + raise ValueError(str(val) + " is not a valid value for " + key) + else: + return val + + def clear(self): + self.__dps = None + self.__miningyield = None + self.__volley = None + self.__reloadTime = None + self.__reloadForce = None + self.__chargeCycles = None + self.itemModifiedAttributes.clear() + self.chargeModifiedAttributes.clear() + + def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, gang=False): + # We will run the effect when two conditions are met: + # 1: It makes sense to run the effect + # The effect is either offline + # or the effect is passive and the module is in the online state (or higher) + + # or the effect is active and the module is in the active state (or higher) + # or the effect is overheat and the module is in the overheated state (or higher) + # 2: the runtimes match + + if self.projected or forceProjected: + context = "projected", "module" + projected = True + else: + context = ("module",) + projected = False + + # if gang: + # context += ("commandRun",) + + if self.charge is not None: + # fix for #82 and it's regression #106 + if not projected or (self.projected and not forceProjected) or gang: + for effect in self.charge.effects.itervalues(): + 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 \ + (not gang or (gang and effect.isType("gang"))): + + chargeContext = ("moduleCharge",) + # For gang effects, we pass in the effect itself as an argument. However, to avoid going through + # all the effect files and defining this argument, do a simple try/catch here and be done with it. + # @todo: possibly fix this + try: + effect.handler(fit, self, chargeContext, effect=effect) + except: + effect.handler(fit, self, chargeContext) + + if self.item: + if self.state >= State.OVERHEATED: + for effect in self.item.effects.itervalues(): + if effect.runTime == runTime and \ + effect.isType("overheat") \ + and not forceProjected \ + and effect.activeByDefault \ + and ((gang and effect.isType("gang")) or not gang): + effect.handler(fit, self, context) + + for effect in self.item.effects.itervalues(): + 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 ((projected and effect.isType("projected")) or not projected) \ + and ((gang and effect.isType("gang")) or not gang): + effect.handler(fit, self, context) + + @property + def cycleTime(self): + reactivation = (self.getModifiedItemAttr("moduleReactivationDelay") or 0) + # Reactivation time starts counting after end of module cycle + speed = self.rawCycleTime + reactivation + if self.charge: + reload = self.reloadTime + else: + reload = 0.0 + # Determine if we'll take into account reload time or not + factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload + # If reactivation is longer than 10 seconds then module can be reloaded + # during reactivation time, thus we may ignore reload + if factorReload and reactivation < reload: + numShots = self.numShots + # Time it takes to reload module after end of reactivation time, + # given that we started when module cycle has just over + additionalReloadTime = (reload - reactivation) + # Speed here already takes into consideration reactivation time + speed = (speed * numShots + additionalReloadTime) / numShots if numShots > 0 else speed + + return speed + + @property + def rawCycleTime(self): + speed = self.getModifiedItemAttr("speed") or self.getModifiedItemAttr("duration") + return speed + + @property + def capUse(self): + capNeed = self.getModifiedItemAttr("capacitorNeed") + if capNeed and self.state >= State.ACTIVE: + cycleTime = self.cycleTime + capUsed = capNeed / (cycleTime / 1000.0) + return capUsed + else: + return 0 + + def __deepcopy__(self, memo): + item = self.item + if item is None: + copy = Module.buildEmpty(self.slot) + else: + copy = Module(self.item) + copy.charge = self.charge + copy.state = self.state + return copy + + def __repr__(self): + if self.item: + return "Module(ID={}, name={}) at {}".format( + self.item.ID, self.item.name, hex(id(self)) + ) + else: + return "EmptyModule() at {}".format(hex(id(self))) + + +class Rack(Module): + """ + This is simply the Module class named something else to differentiate + it for app logic. This class does not do anything special + """ + pass diff --git a/eos/saveddata/targetResists.py b/eos/saveddata/targetResists.py index 8b286b3f6..67cd323a8 100644 --- a/eos/saveddata/targetResists.py +++ b/eos/saveddata/targetResists.py @@ -77,7 +77,12 @@ class TargetResists(object): out += "# TargetResists = [name],[EM %],[Thermal %],[Kinetic %],[Explosive %]\n\n" for dp in patterns: out += cls.EXPORT_FORMAT % ( - dp.name, dp.emAmount * 100, dp.thermalAmount * 100, dp.kineticAmount * 100, dp.explosiveAmount * 100) + dp.name, + dp.emAmount * 100, + dp.thermalAmount * 100, + dp.kineticAmount * 100, + dp.explosiveAmount * 100 + ) return out.strip() diff --git a/gui/builtinContextMenus/__init__.py b/gui/builtinContextMenus/__init__.py index 55f26256a..c6a41c112 100644 --- a/gui/builtinContextMenus/__init__.py +++ b/gui/builtinContextMenus/__init__.py @@ -1,6 +1,6 @@ __all__ = [ "openFit", - #"moduleGlobalAmmoPicker", + # "moduleGlobalAmmoPicker", "moduleAmmoPicker", "itemStats", "damagePattern", diff --git a/gui/builtinContextMenus/amount.py b/gui/builtinContextMenus/amount.py index a3186b723..aeac92e5c 100644 --- a/gui/builtinContextMenus/amount.py +++ b/gui/builtinContextMenus/amount.py @@ -1,5 +1,4 @@ from gui.contextMenu import ContextMenu -from gui.itemStats import ItemStatsDialog import eos.types import gui.mainFrame import gui.globalEvents as GE @@ -8,12 +7,13 @@ from service.fit import Fit from eos.saveddata.cargo import Cargo as es_Cargo from eos.saveddata.fighter import Fighter as es_Fighter + class ChangeAmount(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() def display(self, srcContext, selection): - return srcContext in ("cargoItem","projectedFit","fighterItem","projectedFighter") + return srcContext in ("cargoItem", "projectedFit", "fighterItem", "projectedFighter") def getText(self, itmContext, selection): return "Change {0} Quantity".format(itmContext) @@ -26,8 +26,8 @@ class ChangeAmount(ContextMenu): ChangeAmount.register() -class AmountChanger(wx.Dialog): +class AmountChanger(wx.Dialog): def __init__(self, parent, thing, context): wx.Dialog.__init__(self, parent, title="Select Amount", size=wx.Size(220, 60)) self.thing = thing @@ -65,15 +65,14 @@ class AmountChanger(wx.Dialog): event.Skip() self.Close() - ## checks to make sure it's valid number + # checks to make sure it's valid number def onChar(self, event): key = event.GetKeyCode() acceptable_characters = "1234567890" - acceptable_keycode = [3, 22, 13, 8, 127] # modifiers like delete, copy, paste + acceptable_keycode = [3, 22, 13, 8, 127] # modifiers like delete, copy, paste if key in acceptable_keycode or key >= 255 or (key < 255 and chr(key) in acceptable_characters): event.Skip() return else: return False - diff --git a/gui/builtinContextMenus/cargo.py b/gui/builtinContextMenus/cargo.py index 8d1705ee6..1f5ad4202 100644 --- a/gui/builtinContextMenus/cargo.py +++ b/gui/builtinContextMenus/cargo.py @@ -1,11 +1,10 @@ from gui.contextMenu import ContextMenu -from gui.itemStats import ItemStatsDialog -import eos.types import gui.mainFrame import gui.globalEvents as GE import wx from service.fit import Fit + class Cargo(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinContextMenus/changeAffectingSkills.py b/gui/builtinContextMenus/changeAffectingSkills.py index d679a8791..79b7bd3bd 100644 --- a/gui/builtinContextMenus/changeAffectingSkills.py +++ b/gui/builtinContextMenus/changeAffectingSkills.py @@ -8,6 +8,7 @@ import gui.globalEvents as GE from service.fit import Fit from service.character import Character + class ChangeAffectingSkills(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -22,7 +23,7 @@ class ChangeAffectingSkills(ContextMenu): self.charID = fit.character.ID - #if self.sChar.getCharName(self.charID) in ("All 0", "All 5"): + # if self.sChar.getCharName(self.charID) in ("All 0", "All 5"): # return False if srcContext == "fittingShip": diff --git a/gui/builtinContextMenus/damagePattern.py b/gui/builtinContextMenus/damagePattern.py index 553c02e04..b2089e9c0 100644 --- a/gui/builtinContextMenus/damagePattern.py +++ b/gui/builtinContextMenus/damagePattern.py @@ -11,6 +11,7 @@ try: except ImportError: from gui.utils.compat import OrderedDict + class DamagePattern(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -35,9 +36,9 @@ class DamagePattern(ContextMenu): for pattern in self.patterns: start, end = pattern.name.find('['), pattern.name.find(']') if start is not -1 and end is not -1: - currBase = pattern.name[start+1:end] + currBase = pattern.name[start + 1:end] # set helper attr - setattr(pattern, "_name", pattern.name[end+1:].strip()) + setattr(pattern, "_name", pattern.name[end + 1:].strip()) if currBase not in self.subMenus: self.subMenus[currBase] = [] self.subMenus[currBase].append(pattern) @@ -102,7 +103,7 @@ class DamagePattern(ContextMenu): sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() sFit.setDamagePattern(fitID, pattern) - setattr(self.mainFrame,"_activeDmgPattern", pattern) + setattr(self.mainFrame, "_activeDmgPattern", pattern) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) diff --git a/gui/builtinContextMenus/droneRemoveStack.py b/gui/builtinContextMenus/droneRemoveStack.py index af2ecd9ea..8132a8fc9 100644 --- a/gui/builtinContextMenus/droneRemoveStack.py +++ b/gui/builtinContextMenus/droneRemoveStack.py @@ -2,6 +2,8 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import wx import gui.globalEvents as GE +from service.fit import Fit + class ItemRemove(ContextMenu): def __init__(self): diff --git a/gui/builtinContextMenus/droneSplit.py b/gui/builtinContextMenus/droneSplit.py index 476e40eee..2f2ec923e 100644 --- a/gui/builtinContextMenus/droneSplit.py +++ b/gui/builtinContextMenus/droneSplit.py @@ -1,5 +1,4 @@ from gui.contextMenu import ContextMenu -from gui.itemStats import ItemStatsDialog import gui.mainFrame import gui.globalEvents as GE from service.fit import Fit @@ -27,7 +26,6 @@ DroneSplit.register() class DroneSpinner(wx.Dialog): - def __init__(self, parent, drone, context): wx.Dialog.__init__(self, parent, title="Select Amount", size=wx.Size(220, 60)) self.drone = drone diff --git a/gui/builtinContextMenus/factorReload.py b/gui/builtinContextMenus/factorReload.py index ec7c1acdb..d7b33658d 100644 --- a/gui/builtinContextMenus/factorReload.py +++ b/gui/builtinContextMenus/factorReload.py @@ -1,35 +1,36 @@ -from gui.contextMenu import ContextMenu -import gui.mainFrame -import gui.globalEvents as GE -import wx -from gui.bitmapLoader import BitmapLoader -from service.fit import Fit - -class FactorReload(ContextMenu): - def __init__(self): - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - def display(self, srcContext, selection): - return srcContext == "firepowerViewFull" and self.mainFrame.getActiveFit() is not None - - def getText(self, itmContext, selection): - return "Factor in Reload Time" - - def activate(self, fullContext, selection, i): - sFit = Fit.getInstance() - sFit.serviceFittingOptions["useGlobalForceReload"] = not sFit.serviceFittingOptions["useGlobalForceReload"] - fitID = self.mainFrame.getActiveFit() - sFit.refreshFit(fitID) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - - def getBitmap(self, context, selection): - sFit = Fit.getInstance() - fitID = self.mainFrame.getActiveFit() - fit = sFit.getFit(fitID) - if fit.factorReload: - return BitmapLoader.getBitmap("state_active_small", "gui") - else: - return None - - -FactorReload.register() +from gui.contextMenu import ContextMenu +import gui.mainFrame +import gui.globalEvents as GE +import wx +from gui.bitmapLoader import BitmapLoader +from service.fit import Fit + + +class FactorReload(ContextMenu): + def __init__(self): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def display(self, srcContext, selection): + return srcContext == "firepowerViewFull" and self.mainFrame.getActiveFit() is not None + + def getText(self, itmContext, selection): + return "Factor in Reload Time" + + def activate(self, fullContext, selection, i): + sFit = Fit.getInstance() + sFit.serviceFittingOptions["useGlobalForceReload"] = not sFit.serviceFittingOptions["useGlobalForceReload"] + fitID = self.mainFrame.getActiveFit() + sFit.refreshFit(fitID) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + + def getBitmap(self, context, selection): + sFit = Fit.getInstance() + fitID = self.mainFrame.getActiveFit() + fit = sFit.getFit(fitID) + if fit.factorReload: + return BitmapLoader.getBitmap("state_active_small", "gui") + else: + return None + + +FactorReload.register() diff --git a/gui/builtinContextMenus/fighterAbilities.py b/gui/builtinContextMenus/fighterAbilities.py index e422070cc..d262cb052 100644 --- a/gui/builtinContextMenus/fighterAbilities.py +++ b/gui/builtinContextMenus/fighterAbilities.py @@ -2,6 +2,8 @@ import wx from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +from service.fit import Fit + class FighterAbility(ContextMenu): def __init__(self): diff --git a/gui/builtinContextMenus/implantSets.py b/gui/builtinContextMenus/implantSets.py index 0cbfef508..490f52ef2 100644 --- a/gui/builtinContextMenus/implantSets.py +++ b/gui/builtinContextMenus/implantSets.py @@ -2,6 +2,10 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE import wx +from service.implantSet import ImplantSets as s_ImplantSets +from service.character import Character +from service.fit import Fit + class ImplantSets(ContextMenu): def __init__(self): @@ -31,7 +35,7 @@ class ImplantSets(ContextMenu): m = wx.Menu() bindmenu = rootMenu if "wxMSW" in wx.PlatformInfo else m - sIS = service.ImplantSets.getInstance() + sIS = s_ImplantSets.getInstance() implantSets = sIS.getImplantSetList() self.context = context diff --git a/gui/builtinContextMenus/itemRemove.py b/gui/builtinContextMenus/itemRemove.py index 5fbac825f..400890b1a 100644 --- a/gui/builtinContextMenus/itemRemove.py +++ b/gui/builtinContextMenus/itemRemove.py @@ -2,6 +2,8 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import wx import gui.globalEvents as GE +from service.fit import Fit + class ItemRemove(ContextMenu): def __init__(self): @@ -27,8 +29,8 @@ class ItemRemove(ContextMenu): if srcContext == "fittingModule": for module in selection: if module is not None: - sFit.removeModule(fitID,fit.modules.index(module)) - elif srcContext in ("fittingCharge" , "projectedCharge"): + sFit.removeModule(fitID, fit.modules.index(module)) + elif srcContext in ("fittingCharge", "projectedCharge"): sFit.setAmmo(fitID, None, selection) elif srcContext == "droneItem": sFit.removeDrone(fitID, fit.drones.index(selection[0])) @@ -46,6 +48,4 @@ class ItemRemove(ContextMenu): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - - ItemRemove.register() diff --git a/gui/builtinContextMenus/marketJump.py b/gui/builtinContextMenus/marketJump.py index eea2a9a2b..e96292b41 100644 --- a/gui/builtinContextMenus/marketJump.py +++ b/gui/builtinContextMenus/marketJump.py @@ -1,8 +1,8 @@ from gui.contextMenu import ContextMenu -from gui.itemStats import ItemStatsDialog import gui.mainFrame from service.market import Market + class MarketJump(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinContextMenus/metaSwap.py b/gui/builtinContextMenus/metaSwap.py index 66e9ed8a2..3462410e5 100644 --- a/gui/builtinContextMenus/metaSwap.py +++ b/gui/builtinContextMenus/metaSwap.py @@ -8,6 +8,7 @@ import gui.mainFrame import gui.globalEvents as GE from gui.contextMenu import ContextMenu + class MetaSwap(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -94,7 +95,7 @@ class MetaSwap(ContextMenu): sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() fit = sFit.getFit(fitID) - + for mod in self.selection: pos = fit.modules.index(mod) sFit.changeModule(fitID, pos, item.ID) diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index 649b7bc27..e69aac4cd 100644 --- a/gui/builtinContextMenus/moduleAmmoPicker.py +++ b/gui/builtinContextMenus/moduleAmmoPicker.py @@ -52,8 +52,10 @@ class ModuleAmmoPicker(ContextMenu): def turretSorter(self, charge): damage = 0 - range_ = (self.module.getModifiedItemAttr("maxRange") or 0) * (charge.getAttribute("weaponRangeMultiplier") or 1) - falloff = (self.module.getModifiedItemAttr("falloff") or 0) * (charge.getAttribute("fallofMultiplier") or 1) + range_ = (self.module.getModifiedItemAttr("maxRange") or 0) * \ + (charge.getAttribute("weaponRangeMultiplier") or 1) + falloff = (self.module.getModifiedItemAttr("falloff") or 0) * \ + (charge.getAttribute("fallofMultiplier") or 1) for type_ in self.DAMAGE_TYPES: d = charge.getAttribute("%sDamage" % type_) if d > 0: diff --git a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py index 29eedf521..035109320 100644 --- a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py +++ b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py @@ -1,12 +1,11 @@ # -*- coding: utf-8 -*- -from gui.contextMenu import ContextMenu import gui.mainFrame import wx -from gui.bitmapLoader import BitmapLoader -from eos.types import Hardpoint import gui.globalEvents as GE from gui.builtinContextMenus.moduleAmmoPicker import ModuleAmmoPicker import eos.db +from service.fit import Fit + class ModuleGlobalAmmoPicker(ModuleAmmoPicker): def __init__(self): diff --git a/gui/builtinContextMenus/openFit.py b/gui/builtinContextMenus/openFit.py index 621885f67..fad0c2640 100644 --- a/gui/builtinContextMenus/openFit.py +++ b/gui/builtinContextMenus/openFit.py @@ -3,6 +3,7 @@ import gui.mainFrame import wx from gui.shipBrowser import FitSelected + class OpenFit(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinContextMenus/priceClear.py b/gui/builtinContextMenus/priceClear.py index be7986536..e61b7df7f 100644 --- a/gui/builtinContextMenus/priceClear.py +++ b/gui/builtinContextMenus/priceClear.py @@ -4,6 +4,7 @@ import wx import gui.globalEvents as GE from service.market import Market + class PriceClear(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinContextMenus/shipJump.py b/gui/builtinContextMenus/shipJump.py index 478619cf7..b743201a3 100644 --- a/gui/builtinContextMenus/shipJump.py +++ b/gui/builtinContextMenus/shipJump.py @@ -4,6 +4,7 @@ import gui.mainFrame from gui.shipBrowser import Stage3Selected from service.fit import Fit + class ShipJump(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -21,7 +22,7 @@ class ShipJump(ContextMenu): groupID = stuff.item.group.ID self.mainFrame.notebookBrowsers.SetSelection(1) - wx.PostEvent(self.mainFrame.shipBrowser,Stage3Selected(shipID=stuff.item.ID, back=groupID)) + wx.PostEvent(self.mainFrame.shipBrowser, Stage3Selected(shipID=stuff.item.ID, back=groupID)) ShipJump.register() diff --git a/gui/builtinContextMenus/tacticalMode.py b/gui/builtinContextMenus/tacticalMode.py index 3909ef693..62abf309d 100644 --- a/gui/builtinContextMenus/tacticalMode.py +++ b/gui/builtinContextMenus/tacticalMode.py @@ -5,6 +5,7 @@ import gui.mainFrame import gui.globalEvents as GE from service.fit import Fit + class TacticalMode(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinContextMenus/targetResists.py b/gui/builtinContextMenus/targetResists.py index 7f3ba2131..823aa0d82 100644 --- a/gui/builtinContextMenus/targetResists.py +++ b/gui/builtinContextMenus/targetResists.py @@ -11,6 +11,7 @@ try: except ImportError: from gui.utils.compat import OrderedDict + class TargetResists(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -65,15 +66,15 @@ class TargetResists(ContextMenu): msw = True if "wxMSW" in wx.PlatformInfo else False self.patternIds = {} self.subMenus = OrderedDict() - self.singles = [] + self.singles = [] sub = wx.Menu() for pattern in self.patterns: start, end = pattern.name.find('['), pattern.name.find(']') if start is not -1 and end is not -1: - currBase = pattern.name[start+1:end] + currBase = pattern.name[start + 1:end] # set helper attr - setattr(pattern, "_name", pattern.name[end+1:].strip()) + setattr(pattern, "_name", pattern.name[end + 1:].strip()) if currBase not in self.subMenus: self.subMenus[currBase] = [] self.subMenus[currBase].append(pattern) @@ -94,7 +95,7 @@ class TargetResists(ContextMenu): # Create menu for child items grandSub = wx.Menu() - #sub.Bind(wx.EVT_MENU, self.handleResistSwitch) + # sub.Bind(wx.EVT_MENU, self.handleResistSwitch) # Apply child menu to parent item item.SetSubMenu(grandSub) @@ -102,7 +103,7 @@ class TargetResists(ContextMenu): # Append child items to child menu for pattern in patterns: grandSub.AppendItem(self.addPattern(rootMenu if msw else grandSub, pattern)) - sub.AppendItem(item) #finally, append parent item to root menu + sub.AppendItem(item) # finally, append parent item to root menu return sub diff --git a/gui/builtinContextMenus/whProjector.py b/gui/builtinContextMenus/whProjector.py index 96fe2c767..0e3bfed93 100644 --- a/gui/builtinContextMenus/whProjector.py +++ b/gui/builtinContextMenus/whProjector.py @@ -5,6 +5,7 @@ import wx from service.market import Market from service.fit import Fit + class WhProjector(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -42,7 +43,7 @@ class WhProjector(ContextMenu): return sub def handleSelection(self, event): - #Skip events ids that aren't mapped + # Skip events ids that aren't mapped swObj, swName = self.idmap.get(event.Id, (False, False)) if not swObj and not swName: diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py index 48e631eb1..eb7f3c970 100644 --- a/gui/builtinPreferenceViews/__init__.py +++ b/gui/builtinPreferenceViews/__init__.py @@ -1,6 +1,7 @@ import wx -__all__ = ["pyfaGeneralPreferences", "pyfaHTMLExportPreferences", "pyfaUpdatePreferences", "pyfaNetworkPreferences"] # noqa +__all__ = ["pyfaGeneralPreferences", "pyfaHTMLExportPreferences", "pyfaUpdatePreferences", + "pyfaNetworkPreferences"] # noqa if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): __all__.append("pyfaCrestPreferences") diff --git a/gui/builtinPreferenceViews/dummyView.py b/gui/builtinPreferenceViews/dummyView.py index c6c93f582..fb46db87e 100644 --- a/gui/builtinPreferenceViews/dummyView.py +++ b/gui/builtinPreferenceViews/dummyView.py @@ -1,95 +1,94 @@ -# ============================================================================= -# Copyright (C) 2010 Diego Duclos -# -# 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 . -# ============================================================================= - -import wx -from gui.preferenceView import PreferenceView - - -class DummyView(PreferenceView): - title = "Dummy" - - def populatePanel(self, panel): - - mainSizer = wx.BoxSizer(wx.VERTICAL) - - headerSizer = self.initHeader(panel) - mainSizer.Add(headerSizer, 0, wx.EXPAND, 5) - - self.stline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) - mainSizer.Add(self.stline1, 0, wx.EXPAND, 5) - - contentSizer = self.initContent(panel) - mainSizer.Add(contentSizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 10) - - self.stline2 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) - mainSizer.Add(self.stline2, 0, wx.EXPAND, 5) - - footerSizer = self.initFooter(panel) - mainSizer.Add(footerSizer, 0, wx.EXPAND, 5) - panel.SetSizer(mainSizer) - panel.Layout() - - def refreshPanel(self, fit): - pass - - def initHeader(self, panel): - headerSizer = wx.BoxSizer(wx.VERTICAL) - self.stTitle = wx.StaticText(panel, wx.ID_ANY, u"Dummy", wx.DefaultPosition, wx.DefaultSize, 0) - self.stTitle.Wrap(-1) - self.stTitle.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) - headerSizer.Add(self.stTitle, 0, wx.ALL, 5) - - return headerSizer - - def initContent(self, panel): - contentSizer = wx.BoxSizer(wx.VERTICAL) - - self.m_checkBox2 = wx.CheckBox(panel, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0) - contentSizer.Add(self.m_checkBox2, 0, wx.ALL, 5) - - self.m_radioBtn2 = wx.RadioButton(panel, wx.ID_ANY, u"RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0) - contentSizer.Add(self.m_radioBtn2, 0, wx.ALL, 5) - - self.m_slider2 = wx.Slider(panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) - contentSizer.Add(self.m_slider2, 0, wx.ALL, 5) - - self.m_gauge1 = wx.Gauge(panel, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) - contentSizer.Add(self.m_gauge1, 0, wx.ALL, 5) - - self.m_textCtrl2 = wx.TextCtrl(panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) - contentSizer.Add(self.m_textCtrl2, 0, wx.ALL, 5) - - return contentSizer - - def initFooter(self, panel): - footerSizer = wx.BoxSizer(wx.HORIZONTAL) - - footerSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5) - - self.btnRestore = wx.Button(panel, wx.ID_ANY, u"Restore", wx.DefaultPosition, wx.DefaultSize, 0) - self.btnRestore.Enable(False) - - footerSizer.Add(self.btnRestore, 0, wx.ALL, 5) - - self.btnApply = wx.Button(panel, wx.ID_ANY, u"Apply", wx.DefaultPosition, wx.DefaultSize, 0) - footerSizer.Add(self.btnApply, 0, wx.ALL, 5) - return footerSizer - - -DummyView.register() +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# 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 . +# ============================================================================= + +import wx +from gui.preferenceView import PreferenceView + + +class DummyView(PreferenceView): + title = "Dummy" + + def populatePanel(self, panel): + mainSizer = wx.BoxSizer(wx.VERTICAL) + + headerSizer = self.initHeader(panel) + mainSizer.Add(headerSizer, 0, wx.EXPAND, 5) + + self.stline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) + mainSizer.Add(self.stline1, 0, wx.EXPAND, 5) + + contentSizer = self.initContent(panel) + mainSizer.Add(contentSizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 10) + + self.stline2 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) + mainSizer.Add(self.stline2, 0, wx.EXPAND, 5) + + footerSizer = self.initFooter(panel) + mainSizer.Add(footerSizer, 0, wx.EXPAND, 5) + panel.SetSizer(mainSizer) + panel.Layout() + + def refreshPanel(self, fit): + pass + + def initHeader(self, panel): + headerSizer = wx.BoxSizer(wx.VERTICAL) + self.stTitle = wx.StaticText(panel, wx.ID_ANY, u"Dummy", wx.DefaultPosition, wx.DefaultSize, 0) + self.stTitle.Wrap(-1) + self.stTitle.SetFont(wx.Font(14, 70, 90, 90, False, wx.EmptyString)) + headerSizer.Add(self.stTitle, 0, wx.ALL, 5) + + return headerSizer + + def initContent(self, panel): + contentSizer = wx.BoxSizer(wx.VERTICAL) + + self.m_checkBox2 = wx.CheckBox(panel, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0) + contentSizer.Add(self.m_checkBox2, 0, wx.ALL, 5) + + self.m_radioBtn2 = wx.RadioButton(panel, wx.ID_ANY, u"RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0) + contentSizer.Add(self.m_radioBtn2, 0, wx.ALL, 5) + + self.m_slider2 = wx.Slider(panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) + contentSizer.Add(self.m_slider2, 0, wx.ALL, 5) + + self.m_gauge1 = wx.Gauge(panel, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) + contentSizer.Add(self.m_gauge1, 0, wx.ALL, 5) + + self.m_textCtrl2 = wx.TextCtrl(panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) + contentSizer.Add(self.m_textCtrl2, 0, wx.ALL, 5) + + return contentSizer + + def initFooter(self, panel): + footerSizer = wx.BoxSizer(wx.HORIZONTAL) + + footerSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5) + + self.btnRestore = wx.Button(panel, wx.ID_ANY, u"Restore", wx.DefaultPosition, wx.DefaultSize, 0) + self.btnRestore.Enable(False) + + footerSizer.Add(self.btnRestore, 0, wx.ALL, 5) + + self.btnApply = wx.Button(panel, wx.ID_ANY, u"Apply", wx.DefaultPosition, wx.DefaultSize, 0) + footerSizer.Add(self.btnApply, 0, wx.ALL, 5) + return footerSizer + + +DummyView.register() diff --git a/gui/builtinPreferenceViews/pyfaCrestPreferences.py b/gui/builtinPreferenceViews/pyfaCrestPreferences.py index 964596eb6..1891f2216 100644 --- a/gui/builtinPreferenceViews/pyfaCrestPreferences.py +++ b/gui/builtinPreferenceViews/pyfaCrestPreferences.py @@ -30,13 +30,17 @@ class PFCrestPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) - self.stInfo = wx.StaticText(panel, wx.ID_ANY, u"Please see the pyfa wiki on GitHub for information regarding these options.", wx.DefaultPosition, wx.DefaultSize, 0) + self.stInfo = wx.StaticText(panel, wx.ID_ANY, + u"Please see the pyfa wiki on GitHub for information regarding these options.", + wx.DefaultPosition, wx.DefaultSize, 0) self.stInfo.Wrap(dlgWidth - 50) mainSizer.Add(self.stInfo, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) rbSizer = wx.BoxSizer(wx.HORIZONTAL) - self.rbMode = wx.RadioBox(panel, -1, "Mode", wx.DefaultPosition, wx.DefaultSize, ['Implicit', 'User-supplied details'], 1, wx.RA_SPECIFY_COLS) - self.rbServer = wx.RadioBox(panel, -1, "Server", wx.DefaultPosition, wx.DefaultSize, ['Tranquility', 'Singularity'], 1, wx.RA_SPECIFY_COLS) + self.rbMode = wx.RadioBox(panel, -1, "Mode", wx.DefaultPosition, wx.DefaultSize, + ['Implicit', 'User-supplied details'], 1, wx.RA_SPECIFY_COLS) + self.rbServer = wx.RadioBox(panel, -1, "Server", wx.DefaultPosition, wx.DefaultSize, + ['Tranquility', 'Singularity'], 1, wx.RA_SPECIFY_COLS) self.rbMode.SetSelection(self.settings.get('mode')) self.rbServer.SetSelection(self.settings.get('server')) @@ -67,7 +71,8 @@ class PFCrestPref(PreferenceView): detailsTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(detailsTitle, 0, wx.ALL, 5) - mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND, 5) + mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, + wx.EXPAND, 5) fgAddrSizer = wx.FlexGridSizer(2, 2, 0, 0) fgAddrSizer.AddGrowableCol(1) @@ -78,7 +83,8 @@ class PFCrestPref(PreferenceView): self.stSetID.Wrap(-1) fgAddrSizer.Add(self.stSetID, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.inputClientID = wx.TextCtrl(panel, wx.ID_ANY, self.settings.get('clientID'), wx.DefaultPosition, wx.DefaultSize, 0) + self.inputClientID = wx.TextCtrl(panel, wx.ID_ANY, self.settings.get('clientID'), wx.DefaultPosition, + wx.DefaultSize, 0) fgAddrSizer.Add(self.inputClientID, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) @@ -87,7 +93,8 @@ class PFCrestPref(PreferenceView): fgAddrSizer.Add(self.stSetSecret, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.inputClientSecret = wx.TextCtrl(panel, wx.ID_ANY, self.settings.get('clientSecret'), wx.DefaultPosition, wx.DefaultSize, 0) + self.inputClientSecret = wx.TextCtrl(panel, wx.ID_ANY, self.settings.get('clientSecret'), wx.DefaultPosition, + wx.DefaultSize, 0) fgAddrSizer.Add(self.inputClientSecret, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) diff --git a/gui/builtinPreferenceViews/pyfaGaugePreferences.py b/gui/builtinPreferenceViews/pyfaGaugePreferences.py index c20f0d878..88c1e1313 100644 --- a/gui/builtinPreferenceViews/pyfaGaugePreferences.py +++ b/gui/builtinPreferenceViews/pyfaGaugePreferences.py @@ -10,6 +10,7 @@ from gui.bitmapLoader import BitmapLoader from gui.utils import colorUtils import gui.utils.drawUtils as drawUtils + ########################################################################### # Class PFGaugePref ########################################################################### @@ -162,10 +163,12 @@ class PFGaugePref(PreferenceView): self.st0100.Wrap(-1) gSizer1.Add(self.st0100, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp0100S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp0100S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer1.Add(self.cp0100S, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp0100E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp0100E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer1.Add(self.cp0100E, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.gauge0100S = PFGaugePreview(panel, wx.ID_ANY, 33, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER) @@ -181,14 +184,17 @@ class PFGaugePref(PreferenceView): gSizer2 = wx.BoxSizer(wx.HORIZONTAL) - self.st100101 = wx.StaticText(panel, wx.ID_ANY, u"100 - 101", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) + self.st100101 = wx.StaticText(panel, wx.ID_ANY, u"100 - 101", wx.DefaultPosition, wx.DefaultSize, + wx.ALIGN_RIGHT) self.st100101.Wrap(-1) gSizer2.Add(self.st100101, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp100101S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp100101S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer2.Add(self.cp100101S, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp100101E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp100101E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer2.Add(self.cp100101E, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.gauge100101S = PFGaugePreview(panel, wx.ID_ANY, 33, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER) @@ -204,14 +210,17 @@ class PFGaugePref(PreferenceView): gSizer3 = wx.BoxSizer(wx.HORIZONTAL) - self.st101103 = wx.StaticText(panel, wx.ID_ANY, u"101 - 103", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) + self.st101103 = wx.StaticText(panel, wx.ID_ANY, u"101 - 103", wx.DefaultPosition, wx.DefaultSize, + wx.ALIGN_RIGHT) self.st101103.Wrap(-1) gSizer3.Add(self.st101103, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp101103S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp101103S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer3.Add(self.cp101103S, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp101103E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp101103E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer3.Add(self.cp101103E, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.gauge101103S = PFGaugePreview(panel, wx.ID_ANY, 33, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER) @@ -227,14 +236,17 @@ class PFGaugePref(PreferenceView): gSizer4 = wx.BoxSizer(wx.HORIZONTAL) - self.st103105 = wx.StaticText(panel, wx.ID_ANY, u"103 - 105", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) + self.st103105 = wx.StaticText(panel, wx.ID_ANY, u"103 - 105", wx.DefaultPosition, wx.DefaultSize, + wx.ALIGN_RIGHT) self.st103105.Wrap(-1) gSizer4.Add(self.st103105, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp103105S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp103105S = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer4.Add(self.cp103105S, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.cp103105E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) + self.cp103105E = wx.ColourPickerCtrl(panel, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, + wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) gSizer4.Add(self.cp103105E, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.gauge103105S = PFGaugePreview(panel, wx.ID_ANY, 33, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER) @@ -274,7 +286,8 @@ class PFGaugePref(PreferenceView): self.cbLink = wx.CheckBox(panel, wx.ID_ANY, u"Link Colors", wx.DefaultPosition, wx.DefaultSize, 0) buttonsSizer.Add(self.cbLink, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT, 5) - self.sliderGradientStart = wx.Slider(panel, wx.ID_ANY, self.gradientStart, -100, 100, wx.DefaultPosition, (127, -1), wx.SL_HORIZONTAL | wx.SL_LABELS) + self.sliderGradientStart = wx.Slider(panel, wx.ID_ANY, self.gradientStart, -100, 100, wx.DefaultPosition, + (127, -1), wx.SL_HORIZONTAL | wx.SL_LABELS) buttonsSizer.Add(self.sliderGradientStart, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.btnRestore = wx.Button(panel, wx.ID_ANY, u"Restore Defaults", wx.DefaultPosition, wx.DefaultSize, 0) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 35ea9cb1d..0e5a18f93 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -15,7 +15,8 @@ class PFGeneralPref(PreferenceView): def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.dirtySettings = False - self.openFitsSettings = SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []}) + self.openFitsSettings = SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", + {"enabled": False, "pyfaOpenFits": []}) mainSizer = wx.BoxSizer(wx.VERTICAL) @@ -28,22 +29,28 @@ class PFGeneralPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) - self.cbGlobalChar = wx.CheckBox(panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbGlobalChar = wx.CheckBox(panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize, + 0) mainSizer.Add(self.cbGlobalChar, 0, wx.ALL | wx.EXPAND, 5) - self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalDmgPattern, 0, wx.ALL | wx.EXPAND, 5) - self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5) - self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, u"Compact skills needed tooltip", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, u"Compact skills needed tooltip", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbCompactSkills, 0, wx.ALL | wx.EXPAND, 5) - self.cbFitColorSlots = wx.CheckBox(panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbFitColorSlots = wx.CheckBox(panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbFitColorSlots, 0, wx.ALL | wx.EXPAND, 5) - self.cbReopenFits = wx.CheckBox(panel, wx.ID_ANY, u"Reopen previous fits on startup", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbReopenFits = wx.CheckBox(panel, wx.ID_ANY, u"Reopen previous fits on startup", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbReopenFits, 0, wx.ALL | wx.EXPAND, 5) self.cbRackSlots = wx.CheckBox(panel, wx.ID_ANY, u"Separate Racks", wx.DefaultPosition, wx.DefaultSize, 0) @@ -57,16 +64,19 @@ class PFGeneralPref(PreferenceView): self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, u"Show tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowTooltip, 0, wx.ALL | wx.EXPAND, 5) - self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, u"Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, u"Show market shortcuts", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, u"Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGaugeAnimation, 0, wx.ALL | wx.EXPAND, 5) - self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition, + wx.DefaultSize, 0) mainSizer.Add(self.cbExportCharges, 0, wx.ALL | wx.EXPAND, 5) - self.cbOpenFitInNew = wx.CheckBox(panel, wx.ID_ANY, u"Open fittings in a new page by default", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbOpenFitInNew = wx.CheckBox(panel, wx.ID_ANY, u"Open fittings in a new page by default", + wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5) wx.BoxSizer(wx.HORIZONTAL) diff --git a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py index 588c9eead..c6428d8b7 100644 --- a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py +++ b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py @@ -39,10 +39,14 @@ class PFHTMLExportPref(PreferenceView): self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc, 0, wx.ALL, 5) - self.PathLinkCtrl = wx.HyperlinkCtrl(panel, wx.ID_ANY, self.HTMLExportSettings.getPath(), u'file:///{}'.format(self.HTMLExportSettings.getPath()), wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_LEFT | wx.NO_BORDER | wx.HL_CONTEXTMENU) + self.PathLinkCtrl = wx.HyperlinkCtrl(panel, wx.ID_ANY, self.HTMLExportSettings.getPath(), + u'file:///{}'.format(self.HTMLExportSettings.getPath()), + wx.DefaultPosition, wx.DefaultSize, + wx.HL_ALIGN_LEFT | wx.NO_BORDER | wx.HL_CONTEXTMENU) mainSizer.Add(self.PathLinkCtrl, 0, wx.ALL | wx.EXPAND, 5) - self.fileSelectDialog = wx.FileDialog(None, "Save Fitting As...", wildcard="EVE IGB HTML fitting file (*.html)|*.html", style=wx.FD_SAVE) + self.fileSelectDialog = wx.FileDialog(None, "Save Fitting As...", + wildcard="EVE IGB HTML fitting file (*.html)|*.html", style=wx.FD_SAVE) self.fileSelectDialog.SetPath(self.HTMLExportSettings.getPath()) self.fileSelectDialog.SetFilename(os.path.basename(self.HTMLExportSettings.getPath())) @@ -54,7 +58,8 @@ class PFHTMLExportPref(PreferenceView): self.stDesc2.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc2, 0, wx.ALL, 5) - self.exportEnabled = wx.CheckBox(panel, wx.ID_ANY, u"Enable automatic HTML export", wx.DefaultPosition, wx.DefaultSize, 0) + self.exportEnabled = wx.CheckBox(panel, wx.ID_ANY, u"Enable automatic HTML export", wx.DefaultPosition, + wx.DefaultSize, 0) self.exportEnabled.SetValue(self.HTMLExportSettings.getEnabled()) self.exportEnabled.Bind(wx.EVT_CHECKBOX, self.OnExportEnabledChange) mainSizer.Add(self.exportEnabled, 0, wx.ALL | wx.EXPAND, 5) @@ -63,7 +68,8 @@ class PFHTMLExportPref(PreferenceView): self.stDesc4.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc4, 0, wx.ALL, 5) - self.exportMinimal = wx.CheckBox(panel, wx.ID_ANY, u"Enable minimal export Format", wx.DefaultPosition, wx.DefaultSize, 0) + self.exportMinimal = wx.CheckBox(panel, wx.ID_ANY, u"Enable minimal export Format", wx.DefaultPosition, + wx.DefaultSize, 0) self.exportMinimal.SetValue(self.HTMLExportSettings.getMinimalEnabled()) self.exportMinimal.Bind(wx.EVT_CHECKBOX, self.OnMinimalEnabledChange) mainSizer.Add(self.exportMinimal, 0, wx.ALL | wx.EXPAND, 5) diff --git a/gui/builtinPreferenceViews/pyfaNetworkPreferences.py b/gui/builtinPreferenceViews/pyfaNetworkPreferences.py index c8da61bc3..8c93b1a5f 100644 --- a/gui/builtinPreferenceViews/pyfaNetworkPreferences.py +++ b/gui/builtinPreferenceViews/pyfaNetworkPreferences.py @@ -33,7 +33,8 @@ class PFNetworkPref(PreferenceView): mainSizer.Add(self.cbEnableNetwork, 0, wx.ALL | wx.EXPAND, 5) subSizer = wx.BoxSizer(wx.VERTICAL) - self.cbEve = wx.CheckBox(panel, wx.ID_ANY, u"EVE Servers (API && CREST import)", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbEve = wx.CheckBox(panel, wx.ID_ANY, u"EVE Servers (API && CREST import)", wx.DefaultPosition, + wx.DefaultSize, 0) subSizer.Add(self.cbEve, 0, wx.ALL | wx.EXPAND, 5) self.cbPricing = wx.CheckBox(panel, wx.ID_ANY, u"Pricing updates", wx.DefaultPosition, wx.DefaultSize, 0) @@ -49,7 +50,8 @@ class PFNetworkPref(PreferenceView): proxyTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(proxyTitle, 0, wx.ALL, 5) - mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND, 5) + mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, + wx.EXPAND, 5) self.cbEnableNetwork.SetValue(self.settings.isEnabled(self.network.ENABLED)) self.cbEve.SetValue(self.settings.isEnabled(self.network.EVE)) @@ -117,7 +119,8 @@ class PFNetworkPref(PreferenceView): # proxy auth information: login and pass self.stPSetLogin = wx.StaticText(panel, wx.ID_ANY, u"Username:", wx.DefaultPosition, wx.DefaultSize, 0) self.stPSetLogin.Wrap(-1) - self.editProxySettingsLogin = wx.TextCtrl(panel, wx.ID_ANY, self.nAuth[0], wx.DefaultPosition, wx.DefaultSize, 0) + self.editProxySettingsLogin = wx.TextCtrl(panel, wx.ID_ANY, self.nAuth[0], wx.DefaultPosition, wx.DefaultSize, + 0) self.stPSetPassword = wx.StaticText(panel, wx.ID_ANY, u"Password:", wx.DefaultPosition, wx.DefaultSize, 0) self.stPSetPassword.Wrap(-1) self.editProxySettingsPassword = wx.TextCtrl(panel, wx.ID_ANY, self.nAuth[1], wx.DefaultPosition, @@ -129,7 +132,8 @@ class PFNetworkPref(PreferenceView): pAuthSizer.Add(self.editProxySettingsPassword, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) mainSizer.Add(pAuthSizer, 0, wx.EXPAND, 5) - self.stPSAutoDetected = wx.StaticText(panel, wx.ID_ANY, u"Auto-detected: ", wx.DefaultPosition, wx.DefaultSize, 0) + self.stPSAutoDetected = wx.StaticText(panel, wx.ID_ANY, u"Auto-detected: ", wx.DefaultPosition, wx.DefaultSize, + 0) self.stPSAutoDetected.Wrap(-1) mainSizer.Add(self.stPSAutoDetected, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) diff --git a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py index 88022be61..48e2a79cc 100644 --- a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py +++ b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py @@ -32,7 +32,8 @@ class PFUpdatePref(PreferenceView): self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc, 0, wx.ALL, 5) - self.suppressPrerelease = wx.CheckBox(panel, wx.ID_ANY, u"Allow pre-release notifications", wx.DefaultPosition, wx.DefaultSize, 0) + self.suppressPrerelease = wx.CheckBox(panel, wx.ID_ANY, u"Allow pre-release notifications", wx.DefaultPosition, + wx.DefaultSize, 0) self.suppressPrerelease.Bind(wx.EVT_CHECKBOX, self.OnPrereleaseStateChange) self.suppressPrerelease.SetValue(not self.UpdateSettings.get('prerelease')) @@ -41,7 +42,8 @@ class PFUpdatePref(PreferenceView): if (self.UpdateSettings.get('version')): self.versionSizer = wx.BoxSizer(wx.VERTICAL) - self.versionTitle = wx.StaticText(panel, wx.ID_ANY, "Suppressing {0} Notifications".format(self.UpdateSettings.get('version')), wx.DefaultPosition, wx.DefaultSize, 0) + self.versionTitle = wx.StaticText(panel, wx.ID_ANY, "Suppressing {0} Notifications".format( + self.UpdateSettings.get('version')), wx.DefaultPosition, wx.DefaultSize, 0) self.versionTitle.Wrap(-1) self.versionTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) @@ -51,7 +53,8 @@ class PFUpdatePref(PreferenceView): self.versionSizer.AddSpacer((5, 5), 0, wx.EXPAND, 5) - self.versionSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND, 5) + self.versionSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), + 0, wx.EXPAND, 5) self.versionSizer.AddSpacer((5, 5), 0, wx.EXPAND, 5) self.versionSizer.Add(self.versionTitle, 0, wx.EXPAND, 5) diff --git a/gui/builtinStatsViews/firepowerViewFull.py b/gui/builtinStatsViews/firepowerViewFull.py index 39f7bdbd1..9c31fefe2 100644 --- a/gui/builtinStatsViews/firepowerViewFull.py +++ b/gui/builtinStatsViews/firepowerViewFull.py @@ -22,9 +22,12 @@ import gui.mainFrame from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount +from service.fit import Fit + class FirepowerViewFull(StatsView): name = "firepowerViewFull" + def __init__(self, parent): StatsView.__init__(self) self.parent = parent @@ -34,7 +37,7 @@ class FirepowerViewFull(StatsView): return "Firepower" def getTextExtentW(self, text): - width, height = self.parent.GetTextExtent( text ) + width, height = self.parent.GetTextExtent(text) return width def populatePanel(self, contentPanel, headerPanel): @@ -83,7 +86,7 @@ class FirepowerViewFull(StatsView): baseBox.Add(BitmapLoader.getStaticBitmap("volley_big", parent, "gui"), 0, wx.ALIGN_CENTER) - gridS = wx.GridSizer(2,2,0,0) + gridS = wx.GridSizer(2, 2, 0, 0) baseBox.Add(gridS, 0) @@ -138,20 +141,20 @@ class FirepowerViewFull(StatsView): view.refreshPanel(fit) def refreshPanel(self, fit): - #If we did anything intresting, we'd update our labels to reflect the new fit's stats here + # If we did anything intresting, we'd update our labels to reflect the new fit's stats here if fit is not None and fit.targetResists is not None: self.stEff.Show() else: self.stEff.Hide() - stats = (("labelFullDpsWeapon", lambda: fit.weaponDPS, 3, 0, 0, "%s DPS",None), + stats = (("labelFullDpsWeapon", lambda: fit.weaponDPS, 3, 0, 0, "%s DPS", None), ("labelFullDpsDrone", lambda: fit.droneDPS, 3, 0, 0, "%s DPS", None), ("labelFullVolleyTotal", lambda: fit.totalVolley, 3, 0, 0, "%s", "Volley: %.1f"), ("labelFullDpsTotal", lambda: fit.totalDPS, 3, 0, 0, "%s", None)) # See GH issue # - #if fit is not None and fit.totalYield > 0: + # if fit is not None and fit.totalYield > 0: # self.miningyield.Show() - #else: + # else: # self.miningyield.Hide() counter = 0 @@ -165,7 +168,7 @@ class FirepowerViewFull(StatsView): tipStr = valueFormat % valueStr if altFormat is None else altFormat % value label.SetToolTip(wx.ToolTip(tipStr)) self._cachedValues[counter] = value - counter +=1 + counter += 1 self.panel.Layout() self.headerPanel.Layout() diff --git a/gui/builtinStatsViews/miningyieldViewFull.py b/gui/builtinStatsViews/miningyieldViewFull.py index 5a3a10212..f17e30ecf 100644 --- a/gui/builtinStatsViews/miningyieldViewFull.py +++ b/gui/builtinStatsViews/miningyieldViewFull.py @@ -22,18 +22,22 @@ import gui.mainFrame from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount +from service.fit import Fit + class MiningYieldViewFull(StatsView): name = "miningyieldViewFull" + def __init__(self, parent): StatsView.__init__(self) self.parent = parent self._cachedValues = [] + def getHeaderText(self, fit): return "Mining Yield" def getTextExtentW(self, text): - width, height = self.parent.GetTextExtent( text ) + width, height = self.parent.GetTextExtent(text) return width def populatePanel(self, contentPanel, headerPanel): @@ -46,11 +50,11 @@ class MiningYieldViewFull(StatsView): sizerMiningYield = wx.FlexGridSizer(1, 4) sizerMiningYield.AddGrowableCol(1) - contentSizer.Add( sizerMiningYield, 0, wx.EXPAND, 0) + contentSizer.Add(sizerMiningYield, 0, wx.EXPAND, 0) counter = 0 - for miningType, image in (("miner", "mining") , ("drone", "drones")): + for miningType, image in (("miner", "mining"), ("drone", "drones")): baseBox = wx.BoxSizer(wx.HORIZONTAL) sizerMiningYield.Add(baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL) @@ -65,7 +69,7 @@ class MiningYieldViewFull(StatsView): box.Add(hbox, 1, wx.ALIGN_CENTER) lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 m\u00B3/s") - setattr(self, "label%sminingyield%s" % (panel.capitalize() ,miningType.capitalize()), lbl) + setattr(self, "label%sminingyield%s" % (panel.capitalize(), miningType.capitalize()), lbl) hbox.Add(lbl, 0, wx.ALIGN_CENTER) self._cachedValues.append(0) @@ -121,9 +125,9 @@ class MiningYieldViewFull(StatsView): view.refreshPanel(fit) def refreshPanel(self, fit): - #If we did anything intresting, we'd update our labels to reflect the new fit's stats here + # If we did anything intresting, we'd update our labels to reflect the new fit's stats here - stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s",None), + stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s", None), ("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, u"%s m\u00B3/s", None), ("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, u"%s m\u00B3/s", None)) @@ -138,7 +142,7 @@ class MiningYieldViewFull(StatsView): tipStr = valueFormat % valueStr if altFormat is None else altFormat % value label.SetToolTip(wx.ToolTip(tipStr)) self._cachedValues[counter] = value - counter +=1 + counter += 1 self.panel.Layout() self.headerPanel.Layout() diff --git a/gui/builtinStatsViews/rechargeViewFull.py b/gui/builtinStatsViews/rechargeViewFull.py index b8055de97..a285c04cb 100644 --- a/gui/builtinStatsViews/rechargeViewFull.py +++ b/gui/builtinStatsViews/rechargeViewFull.py @@ -62,7 +62,8 @@ class RechargeViewFull(StatsView): # Add an empty label first for correct alignment. sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0) - toolTipText = {"shieldPassive": "Passive shield recharge", "shieldActive": "Active shield boost", "armorActive": "Armor repair amount", "hullActive": "Hull repair amount"} + toolTipText = {"shieldPassive": "Passive shield recharge", "shieldActive": "Active shield boost", + "armorActive": "Armor repair amount", "hullActive": "Hull repair amount"} for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"): bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui") tooltip = wx.ToolTip(toolTipText[tankType]) diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 3f56c3727..16f8cb5a5 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -19,18 +19,18 @@ import wx from gui.statsView import StatsView -from gui import builtinStatsViews from gui.bitmapLoader import BitmapLoader from gui import pygauge as PG from gui.utils.numberFormatter import formatAmount import gui.mainFrame -import gui.builtinViews.fittingView as fv import gui.globalEvents as GE EffectiveHpToggled, EFFECTIVE_HP_TOGGLED = wx.lib.newevent.NewEvent() + class ResistancesViewFull(StatsView): name = "resistancesViewFull" + def __init__(self, parent): StatsView.__init__(self) self.parent = parent @@ -44,7 +44,7 @@ class ResistancesViewFull(StatsView): return "Resistances" def getTextExtentW(self, text): - width, height = self.parent.GetTextExtent( text ) + width, height = self.parent.GetTextExtent(text) return width def populatePanel(self, contentPanel, headerPanel): @@ -55,7 +55,7 @@ class ResistancesViewFull(StatsView): # Custom header EHP headerContentSizer = wx.BoxSizer(wx.HORIZONTAL) hsizer = headerPanel.GetSizer() - hsizer.Add(headerContentSizer,0,0,0) + hsizer.Add(headerContentSizer, 0, 0, 0) self.stEff = wx.StaticText(headerPanel, wx.ID_ANY, "( Effective HP: ") headerContentSizer.Add(self.stEff) headerPanel.GetParent().AddToggleItem(self.stEff) @@ -66,81 +66,83 @@ class ResistancesViewFull(StatsView): stCls = wx.StaticText(headerPanel, wx.ID_ANY, " )") - headerPanel.GetParent().AddToggleItem( stCls ) - headerContentSizer.Add( stCls ) -# headerContentSizer.Add(wx.StaticLine(headerPanel, wx.ID_ANY), 1, wx.ALIGN_CENTER) + headerPanel.GetParent().AddToggleItem(stCls) + headerContentSizer.Add(stCls) + # headerContentSizer.Add(wx.StaticLine(headerPanel, wx.ID_ANY), 1, wx.ALIGN_CENTER) # Display table col = 0 row = 0 sizerResistances = wx.GridBagSizer() - contentSizer.Add( sizerResistances, 0, wx.EXPAND , 0) + contentSizer.Add(sizerResistances, 0, wx.EXPAND, 0) # Add an empty label, then the rest. - sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 )) - col+=1 - toolTipText = {"em" : "Electromagnetic resistance", "thermal" : "Thermal resistance", "kinetic" : "Kinetic resistance", "explosive" : "Explosive resistance"} + sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition(row, col), wx.GBSpan(1, 1)) + col += 1 + toolTipText = {"em": "Electromagnetic resistance", "thermal": "Thermal resistance", + "kinetic": "Kinetic resistance", "explosive": "Explosive resistance"} for damageType in ("em", "thermal", "kinetic", "explosive"): bitmap = BitmapLoader.getStaticBitmap("%s_big" % damageType, contentPanel, "gui") tooltip = wx.ToolTip(toolTipText[damageType]) bitmap.SetToolTip(tooltip) - sizerResistances.Add(bitmap, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) - col+=1 - self.stEHPs = wx.Button(contentPanel, style = wx.BU_EXACTFIT, label = "EHP") + sizerResistances.Add(bitmap, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) + col += 1 + self.stEHPs = wx.Button(contentPanel, style=wx.BU_EXACTFIT, label="EHP") self.stEHPs.SetToolTip(wx.ToolTip("Click to toggle between effective HP and raw HP")) self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP) for i in xrange(4): - sizerResistances.AddGrowableCol(i+1) + sizerResistances.AddGrowableCol(i + 1) - sizerResistances.Add(self.stEHPs, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) - col=0 - row+=1 + sizerResistances.Add(self.stEHPs, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) + col = 0 + row += 1 - gaugeColours=( ((38,133,198),(52,86,98)), ((198,38,38),(83,65,67)), ((163,163,163),(74,90,93)), ((198,133,38),(81,83,67)) ) + gaugeColours = (((38, 133, 198), (52, 86, 98)), ((198, 38, 38), (83, 65, 67)), ((163, 163, 163), (74, 90, 93)), + ((198, 133, 38), (81, 83, 67))) - toolTipText = {"shield" : "Shield resistance", "armor" : "Armor resistance", "hull" : "Hull resistance", "damagePattern" : "Incoming damage pattern"} + toolTipText = {"shield": "Shield resistance", "armor": "Armor resistance", "hull": "Hull resistance", + "damagePattern": "Incoming damage pattern"} for tankType in ("shield", "armor", "hull", "separator", "damagePattern"): if tankType != "separator": bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui") tooltip = wx.ToolTip(toolTipText[tankType]) bitmap.SetToolTip(tooltip) - sizerResistances.Add(bitmap, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) - col+=1 + sizerResistances.Add(bitmap, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) + col += 1 else: - sizerResistances.Add(wx.StaticLine(contentPanel, wx.ID_ANY), wx.GBPosition( row, col ), wx.GBSpan( 1, 6 ), wx.EXPAND|wx.ALIGN_CENTER) - row+=1 - col=0 + sizerResistances.Add(wx.StaticLine(contentPanel, wx.ID_ANY), wx.GBPosition(row, col), wx.GBSpan(1, 6), + wx.EXPAND | wx.ALIGN_CENTER) + row += 1 + col = 0 continue - currGColour=0 + currGColour = 0 for damageType in ("em", "thermal", "kinetic", "explosive"): - box = wx.BoxSizer(wx.HORIZONTAL) - sizerResistances.Add(box, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) + sizerResistances.Add(box, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) + # Fancy gauges addon - #Fancy gauges addon - - pgColour= gaugeColours[currGColour] + pgColour = gaugeColours[currGColour] fc = pgColour[0] bc = pgColour[1] - currGColour+=1 + currGColour += 1 lbl = PG.PyGauge(contentPanel, wx.ID_ANY, 100) lbl.SetMinSize((48, 16)) - lbl.SetBackgroundColour(wx.Colour(bc[0],bc[1],bc[2])) - lbl.SetBarColour(wx.Colour(fc[0],fc[1],fc[2])) + lbl.SetBackgroundColour(wx.Colour(bc[0], bc[1], bc[2])) + lbl.SetBarColour(wx.Colour(fc[0], fc[1], fc[2])) lbl.SetBarGradient() lbl.SetFractionDigits(1) setattr(self, "gaugeResistance%s%s" % (tankType.capitalize(), damageType.capitalize()), lbl) box.Add(lbl, 0, wx.ALIGN_CENTER) - col+=1 + col += 1 box = wx.BoxSizer(wx.VERTICAL) box.SetMinSize(wx.Size(self.getTextExtentW("WWWWk"), -1)) @@ -148,9 +150,9 @@ class ResistancesViewFull(StatsView): box.Add(lbl, 0, wx.ALIGN_CENTER) setattr(self, "labelResistance%sEhp" % tankType.capitalize(), lbl) - sizerResistances.Add(box, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) - row+=1 - col=0 + sizerResistances.Add(box, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) + row += 1 + col = 0 self.stEHPs.SetToolTip(wx.ToolTip("Click to toggle between effective HP and raw HP")) @@ -162,7 +164,7 @@ class ResistancesViewFull(StatsView): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def refreshPanel(self, fit): - #If we did anything intresting, we'd update our labels to reflect the new fit's stats here + # If we did anything intresting, we'd update our labels to reflect the new fit's stats here if fit is None and not self.showEffective: self.showEffective = True wx.PostEvent(self.mainFrame, EffectiveHpToggled(effective=True)) @@ -193,11 +195,11 @@ class ResistancesViewFull(StatsView): total += ehp[tankType] rrFactor = fit.ehp[tankType] / fit.hp[tankType] lbl.SetLabel(formatAmount(ehp[tankType], 3, 0, 9)) - lbl.SetToolTip(wx.ToolTip("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor))) + lbl.SetToolTip( + wx.ToolTip("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor))) else: lbl.SetLabel("0") - self.labelEhp.SetLabel("%s" % formatAmount(total, 3, 0, 9)) if self.showEffective: self.stEff.SetLabel("( Effective HP: ") @@ -206,10 +208,9 @@ class ResistancesViewFull(StatsView): self.stEff.SetLabel("( Raw HP: ") self.labelEhp.SetToolTip(wx.ToolTip("Raw: %d HP" % total)) - - damagePattern = fit.damagePattern if fit is not None and self.showEffective else None + damagePattern = fit.damagePattern if fit is not None and self.showEffective else None total = sum((damagePattern.emAmount, damagePattern.thermalAmount, - damagePattern.kineticAmount, damagePattern.explosiveAmount)) if damagePattern is not None else 0 + damagePattern.kineticAmount, damagePattern.explosiveAmount)) if damagePattern is not None else 0 for damageType in ("em", "thermal", "kinetic", "explosive"): lbl = getattr(self, "gaugeResistanceDamagepattern%s" % damageType.capitalize()) @@ -224,4 +225,3 @@ class ResistancesViewFull(StatsView): ResistancesViewFull.register() - diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index d9c71ff65..39bb0b62a 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -102,7 +102,8 @@ class ResourcesViewFull(StatsView): base = sizerResources sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5) # Turrets & launcher hardslots display - tooltipText = {"turret": "Turret hardpoints", "launcher": "Launcher hardpoints", "drones": "Drones active", "fighter": "Fighter squadrons active", "calibration": "Calibration"} + tooltipText = {"turret": "Turret hardpoints", "launcher": "Launcher hardpoints", "drones": "Drones active", + "fighter": "Fighter squadrons active", "calibration": "Calibration"} for type_ in ("turret", "launcher", "drones", "fighter", "calibration"): box = wx.BoxSizer(wx.HORIZONTAL) @@ -114,7 +115,8 @@ class ResourcesViewFull(StatsView): sizer.Add(box, 0, wx.ALIGN_CENTER) - suffix = {'turret': 'Hardpoints', 'launcher': 'Hardpoints', 'drones': 'Active', 'fighter': 'Tubes', 'calibration': 'Points'} + suffix = {'turret': 'Hardpoints', 'launcher': 'Hardpoints', 'drones': 'Active', 'fighter': 'Tubes', + 'calibration': 'Points'} lbl = wx.StaticText(parent, wx.ID_ANY, "0") setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()), lbl) box.Add(lbl, 0, wx.ALIGN_CENTER | wx.LEFT, 5) @@ -122,7 +124,8 @@ class ResourcesViewFull(StatsView): box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_CENTER) lbl = wx.StaticText(parent, wx.ID_ANY, "0") - setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()), lbl) + setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()), + lbl) box.Add(lbl, 0, wx.ALIGN_CENTER) setattr(self, "boxSizer{}".format(type_.capitalize()), box) @@ -132,7 +135,8 @@ class ResourcesViewFull(StatsView): sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5) # PG, Cpu & drone stuff - tooltipText = {"cpu": "CPU", "pg": "PowerGrid", "droneBay": "Drone bay", "fighterBay": "Fighter bay", "droneBandwidth": "Drone bandwidth", "cargoBay": "Cargo bay"} + tooltipText = {"cpu": "CPU", "pg": "PowerGrid", "droneBay": "Drone bay", "fighterBay": "Fighter bay", + "droneBandwidth": "Drone bandwidth", "cargoBay": "Cargo bay"} for i, group in enumerate((("cpu", "pg"), ("cargoBay", "droneBay", "fighterBay", "droneBandwidth"))): main = wx.BoxSizer(wx.VERTICAL) base.Add(main, 1, wx.ALIGN_CENTER) @@ -164,7 +168,8 @@ class ResourcesViewFull(StatsView): setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl) absolute.Add(lbl, 0, wx.ALIGN_LEFT) - units = {"cpu": " tf", "pg": " MW", "droneBandwidth": " mbit/s", "droneBay": u" m\u00B3", "fighterBay": u" m\u00B3", "cargoBay": u" m\u00B3"} + units = {"cpu": " tf", "pg": " MW", "droneBandwidth": " mbit/s", "droneBay": u" m\u00B3", + "fighterBay": u" m\u00B3", "cargoBay": u" m\u00B3"} lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type_]) absolute.Add(lbl, 0, wx.ALIGN_LEFT) diff --git a/gui/builtinStatsViews/targetingMiscViewFull.py b/gui/builtinStatsViews/targetingMiscViewFull.py index e5be6110a..aab2bf25e 100644 --- a/gui/builtinStatsViews/targetingMiscViewFull.py +++ b/gui/builtinStatsViews/targetingMiscViewFull.py @@ -133,14 +133,17 @@ class TargetingMiscViewFull(StatsView): "specialSmallShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialSmallShipHoldCapacity"), "specialMediumShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialMediumShipHoldCapacity"), "specialLargeShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialLargeShipHoldCapacity"), - "specialIndustrialShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialIndustrialShipHoldCapacity"), + "specialIndustrialShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr( + "specialIndustrialShipHoldCapacity"), "specialOreHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialOreHoldCapacity"), "specialMineralHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialMineralHoldCapacity"), "specialMaterialBayCapacity": lambda: fit.ship.getModifiedItemAttr("specialMaterialBayCapacity"), "specialGasHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialGasHoldCapacity"), "specialSalvageHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialSalvageHoldCapacity"), - "specialCommandCenterHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialCommandCenterHoldCapacity"), - "specialPlanetaryCommoditiesHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialPlanetaryCommoditiesHoldCapacity"), + "specialCommandCenterHoldCapacity": lambda: fit.ship.getModifiedItemAttr( + "specialCommandCenterHoldCapacity"), + "specialPlanetaryCommoditiesHoldCapacity": lambda: fit.ship.getModifiedItemAttr( + "specialPlanetaryCommoditiesHoldCapacity"), "specialQuafeHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialQuafeHoldCapacity") } @@ -196,7 +199,8 @@ class TargetingMiscViewFull(StatsView): label.SetToolTip(wx.ToolTip("Max Warp Distance: %.1f AU" % fit.maxWarpDistance)) elif labelName == "labelSensorStr": if fit.jamChance > 0: - label.SetToolTip(wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance))) + label.SetToolTip( + wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance))) else: label.SetToolTip(wx.ToolTip("Type: %s" % (fit.scanType))) elif labelName == "labelFullAlignTime": @@ -206,7 +210,8 @@ class TargetingMiscViewFull(StatsView): label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility))) elif labelName == "labelFullCargo": tipLines = [] - tipLines.append(u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])) + tipLines.append( + u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])) for attrName, tipAlias in cargoNamesOrder.items(): if newValues[attrName] > 0: tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName])) @@ -235,7 +240,8 @@ class TargetingMiscViewFull(StatsView): # if you add stuff to cargo, the capacity doesn't change and thus it is still cached # This assures us that we force refresh of cargo tooltip tipLines = [] - tipLines.append(u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])) + tipLines.append( + u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])) for attrName, tipAlias in cargoNamesOrder.items(): if cachedCargo[attrName] > 0: tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName])) diff --git a/gui/builtinViewColumns/baseIcon.py b/gui/builtinViewColumns/baseIcon.py index d767a97a6..7f9b16296 100644 --- a/gui/builtinViewColumns/baseIcon.py +++ b/gui/builtinViewColumns/baseIcon.py @@ -1,45 +1,46 @@ -import wx -from eos.types import Drone, Fit, Module, Slot, Rack, Implant -from gui.viewColumn import ViewColumn - - -class BaseIcon(ViewColumn): - name = "Base Icon" - - def __init__(self, fittingView, params): - ViewColumn.__init__(self, fittingView) - self.size = 24 - self.maxsize = self.size - self.mask = wx.LIST_MASK_IMAGE - self.columnText = "" - self.shipImage = fittingView.imageList.GetImageIndex("ship_small", "gui") - - def getImageId(self, stuff): - if isinstance(stuff, Drone): - return -1 - elif isinstance(stuff, Fit): - return self.shipImage - elif isinstance(stuff, Rack): - return -1 - elif isinstance(stuff, Implant): - if stuff.character: # if it has a character as it's parent - return self.fittingView.imageList.GetImageIndex("character_small", "gui") - else: - return self.shipImage - elif isinstance(stuff, Module): - if stuff.isEmpty: - return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui") - else: - return self.loadIconFile(stuff.item.icon.iconFile if stuff.item.icon else "") - - item = getattr(stuff, "item", stuff) - return self.loadIconFile(item.icon.iconFile if item.icon else "") - - def loadIconFile(self, iconFile): - if iconFile: - return self.fittingView.imageList.GetImageIndex(iconFile, "icons") - else: - return -1 - - -BaseIcon.register() +import wx +from eos.types import Drone, Fit, Module, Slot, Rack, Implant +from gui.viewColumn import ViewColumn + + +class BaseIcon(ViewColumn): + name = "Base Icon" + + def __init__(self, fittingView, params): + ViewColumn.__init__(self, fittingView) + self.size = 24 + self.maxsize = self.size + self.mask = wx.LIST_MASK_IMAGE + self.columnText = "" + self.shipImage = fittingView.imageList.GetImageIndex("ship_small", "gui") + + def getImageId(self, stuff): + if isinstance(stuff, Drone): + return -1 + elif isinstance(stuff, Fit): + return self.shipImage + elif isinstance(stuff, Rack): + return -1 + elif isinstance(stuff, Implant): + if stuff.character: # if it has a character as it's parent + return self.fittingView.imageList.GetImageIndex("character_small", "gui") + else: + return self.shipImage + elif isinstance(stuff, Module): + if stuff.isEmpty: + return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), + "gui") + else: + return self.loadIconFile(stuff.item.icon.iconFile if stuff.item.icon else "") + + item = getattr(stuff, "item", stuff) + return self.loadIconFile(item.icon.iconFile if item.icon else "") + + def loadIconFile(self, iconFile): + if iconFile: + return self.fittingView.imageList.GetImageIndex(iconFile, "icons") + else: + return -1 + + +BaseIcon.register() diff --git a/gui/builtinViewColumns/baseName.py b/gui/builtinViewColumns/baseName.py index d739ee903..973219b2c 100644 --- a/gui/builtinViewColumns/baseName.py +++ b/gui/builtinViewColumns/baseName.py @@ -41,7 +41,8 @@ class BaseName(ViewColumn): if isinstance(stuff, Drone): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fighter): - return "%d/%d %s" % (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) + return "%d/%d %s" % \ + (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name) elif isinstance(stuff, Cargo): return "%dx %s" % (stuff.amount, stuff.item.name) elif isinstance(stuff, Fit): diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index 95a8b07bd..6e9c5cb45 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -1,543 +1,559 @@ -# ============================================================================= -# Copyright (C) 2010 Diego Duclos -# -# 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 . -# ============================================================================= - -import wx - -from service.fit import Fit -from service.market import Market -import gui.mainFrame -from gui.viewColumn import ViewColumn -from gui.bitmapLoader import BitmapLoader -from gui.utils.numberFormatter import formatAmount -from gui.utils.listFormatter import formatList - - -class Miscellanea(ViewColumn): - name = "Miscellanea" - - def __init__(self, fittingView, params=None): - if params is None: - params = {"showIcon": True, "displayName": False} - - ViewColumn.__init__(self, fittingView) - if params["showIcon"]: - self.imageId = fittingView.imageList.GetImageIndex("column_misc", "gui") - self.bitmap = BitmapLoader.getBitmap("column_misc", "gui") - self.mask = wx.LIST_MASK_IMAGE - else: - self.imageId = -1 - - if params["displayName"] or self.imageId == -1: - self.columnText = "Misc data" - self.mask |= wx.LIST_MASK_TEXT - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - def getText(self, stuff): - return self.__getData(stuff)[0] - - def getToolTip(self, mod): - return self.__getData(mod)[1] - - def getImageId(self, mod): - return -1 - - def getParameters(self): - return (("displayName", bool, False), ("showIcon", bool, True)) - - def __getData(self, stuff): - item = stuff.item - if item is None: - return "", None - itemGroup = item.group.name - itemCategory = item.category.name - - if itemGroup == "Ship Modifiers": - return "", None - elif itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Combat Drone", "Fighter Drone"): - trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed") - if not trackingSpeed: - return "", None - text = "{0}".format(formatAmount(trackingSpeed, 3, 0, 3)) - tooltip = "Tracking speed" - return text, tooltip - elif itemCategory == "Subsystem": - slots = ("hi", "med", "low") - info = [] - for slot in slots: - n = int(stuff.getModifiedItemAttr("%sSlotModifier" % slot)) - if n > 0: - info.append("{0}{1}".format(n, slot[0].upper())) - return "+ " + ", ".join(info), "Slot Modifiers" - elif itemGroup == "Energy Neutralizer": - neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount") - cycleTime = stuff.cycleTime - if not neutAmount or not cycleTime: - return "", None - capPerSec = float(-neutAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) - tooltip = "Energy neutralization per second" - return text, tooltip - elif itemGroup == "Energy Nosferatu": - neutAmount = stuff.getModifiedItemAttr("powerTransferAmount") - cycleTime = stuff.cycleTime - if not neutAmount or not cycleTime: - return "", None - capPerSec = float(-neutAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) - tooltip = "Energy neutralization per second" - return text, tooltip - elif itemGroup == "Salvager": - chance = stuff.getModifiedItemAttr("accessDifficultyBonus") - if not chance: - return "", None - text = "{0}%".format(formatAmount(chance, 3, 0, 3)) - tooltip = "Item retrieval chance" - return text, tooltip - elif itemGroup == "Data Miners": - strength = stuff.getModifiedItemAttr("virusStrength") - coherence = stuff.getModifiedItemAttr("virusCoherence") - if not strength or not coherence: - return "", None - text = "{0} | {1}".format(formatAmount(strength, 3, 0, 3), formatAmount(coherence, 3, 0, 3)) - tooltip = "Virus strength and coherence" - return text, tooltip - elif itemGroup in ("Warp Scrambler", "Warp Core Stabilizer"): - scramStr = stuff.getModifiedItemAttr("warpScrambleStrength") - if not scramStr: - return "", None - text = "{0}".format(formatAmount(-scramStr, 3, 0, 3, forceSign=True)) - tooltip = "Warp core strength modification" - return text, tooltip - elif itemGroup in ("Stasis Web", "Stasis Webifying Drone"): - speedFactor = stuff.getModifiedItemAttr("speedFactor") - if not speedFactor: - return "", None - text = "{0}%".format(formatAmount(speedFactor, 3, 0, 3)) - tooltip = "Speed reduction" - return text, tooltip - elif itemGroup == "Target Painter": - sigRadBonus = stuff.getModifiedItemAttr("signatureRadiusBonus") - if not sigRadBonus: - return "", None - text = "{0}%".format(formatAmount(sigRadBonus, 3, 0, 3, forceSign=True)) - tooltip = "Signature radius increase" - return text, tooltip - elif itemGroup == "Sensor Dampener": - lockRangeBonus = stuff.getModifiedItemAttr("maxTargetRangeBonus") - scanResBonus = stuff.getModifiedItemAttr("scanResolutionBonus") - if lockRangeBonus is None or scanResBonus is None: - return "", None - display = 0 - for bonus in (lockRangeBonus, scanResBonus): - if abs(bonus) > abs(display): - display = bonus - if not display: - return "", None - text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) - ttEntries = [] - if display == lockRangeBonus: - ttEntries.append("lock range") - if display == scanResBonus: - ttEntries.append("scan resolution") - tooltip = "{0} dampening".format(formatList(ttEntries)).capitalize() - return text, tooltip - elif itemGroup == "Weapon Disruptor": - # Weapon disruption now covers both tracking and guidance (missile) disruptors - # First get the attributes for tracking disruptors - optimalRangeBonus = stuff.getModifiedItemAttr("maxRangeBonus") - falloffRangeBonus = stuff.getModifiedItemAttr("falloffBonus") - trackingSpeedBonus = stuff.getModifiedItemAttr("trackingSpeedBonus") - - trackingDisruptorAttributes = { - "optimal range": optimalRangeBonus, - "falloff range": falloffRangeBonus, - "tracking speed": trackingSpeedBonus} - - isTrackingDisruptor = any(map(lambda x: x is not None and x != 0, trackingDisruptorAttributes.values())) - - # Then get the attributes for guidance disruptors - explosionVelocityBonus = stuff.getModifiedItemAttr("aoeVelocityBonus") - explosionRadiusBonus = stuff.getModifiedItemAttr("aoeCloudSizeBonus") - - flightTimeBonus = stuff.getModifiedItemAttr("explosionDelayBonus") - missileVelocityBonus = stuff.getModifiedItemAttr("missileVelocityBonus") - - guidanceDisruptorAttributes = { - "explosion velocity": explosionVelocityBonus, - "explosion radius": explosionRadiusBonus, - "flight time": flightTimeBonus, - "missile velocity": missileVelocityBonus} - - isGuidanceDisruptor = any(map(lambda x: x is not None and x != 0, guidanceDisruptorAttributes.values())) - - if isTrackingDisruptor: - attributes = trackingDisruptorAttributes - elif isGuidanceDisruptor: - attributes = guidanceDisruptorAttributes - else: - return "", None - - display = max(attributes.values(), key=lambda x: abs(x)) - - text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) - - ttEntries = [] - for attributeName, attributeValue in attributes.items(): - if attributeValue == display: - ttEntries.append(attributeName) - - tooltip = "{0} disruption".format(formatList(ttEntries)).capitalize() - return text, tooltip - elif itemGroup in ("ECM", "Burst Jammer", "Burst Projectors"): - grav = stuff.getModifiedItemAttr("scanGravimetricStrengthBonus") - ladar = stuff.getModifiedItemAttr("scanLadarStrengthBonus") - radar = stuff.getModifiedItemAttr("scanRadarStrengthBonus") - magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthBonus") - displayMax = max(grav, ladar, radar, magnet) - displayMin = min(grav, ladar, radar, magnet) - if grav is None or ladar is None or radar is None or magnet is None or displayMax is None: - return "", None - - if displayMax == displayMin or displayMin is None: - text = "{0}".format( - formatAmount(displayMax, 3, 0, 3), - ) - else: - text = "{0} | {1}".format( - formatAmount(displayMax, 3, 0, 3), - formatAmount(displayMin, 3, 0, 3), - ) - tooltip = "ECM Jammer Strength:\n{0} Gravimetric | {1} Ladar | {2} Magnetometric | {3} Radar".format( - formatAmount(grav, 3, 0, 3), - formatAmount(ladar, 3, 0, 3), - formatAmount(radar, 3, 0, 3), - formatAmount(magnet, 3, 0, 3), - ) - return text, tooltip - elif itemGroup in ("Remote Sensor Booster", "Sensor Booster", "Signal Amplifier"): - scanResBonus = stuff.getModifiedItemAttr("scanResolutionBonus") - lockRangeBonus = stuff.getModifiedItemAttr("maxTargetRangeBonus") - gravBonus = stuff.getModifiedItemAttr("scanGravimetricStrengthPercent") - if scanResBonus is None or lockRangeBonus is None or gravBonus is None: - return "", None - - text = "{0}% | {1}% | {2}%".format( - formatAmount(scanResBonus, 3, 0, 3), - formatAmount(lockRangeBonus, 3, 0, 3), - formatAmount(gravBonus, 3, 0, 3), - ) - tooltip = "Applied bonuses:\n{0}% scan resolution | {1}% lock range | {2}% sensor strength".format( - formatAmount(scanResBonus, 3, 0, 3), - formatAmount(lockRangeBonus, 3, 0, 3), - formatAmount(gravBonus, 3, 0, 3), - ) - return text, tooltip - elif itemGroup in ("Projected ECCM", "ECCM", "Sensor Backup Array"): - grav = stuff.getModifiedItemAttr("scanGravimetricStrengthPercent") - ladar = stuff.getModifiedItemAttr("scanLadarStrengthPercent") - radar = stuff.getModifiedItemAttr("scanRadarStrengthPercent") - magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthPercent") - if grav is None or ladar is None or radar is None or magnet is None: - return "", None - display = max(grav, ladar, radar, magnet) - if not display: - return "", None - text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) - ttEntries = [] - if display == grav: - ttEntries.append("gravimetric") - if display == ladar: - ttEntries.append("ladar") - if display == magnet: - ttEntries.append("magnetometric") - if display == radar: - ttEntries.append("radar") - plu = "" if len(ttEntries) == 1 else "s" - tooltip = "{0} strength{1} bonus".format(formatList(ttEntries), plu).capitalize() - return text, tooltip - elif itemGroup == "Cloaking Device": - recalibration = stuff.getModifiedItemAttr("cloakingTargetingDelay") - if recalibration is None: - return "", None - text = "{0}s".format(formatAmount(float(recalibration) / 1000, 3, 0, 3)) - tooltip = "Sensor recalibration time" - return text, tooltip - elif itemGroup == "Remote Armor Repairer": - repAmount = stuff.getModifiedItemAttr("armorDamageAmount") - cycleTime = stuff.getModifiedItemAttr("duration") - if not repAmount or not cycleTime: - return "", None - repPerSec = float(repAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) - tooltip = "Armor repaired per second" - return text, tooltip - elif itemGroup == "Remote Shield Booster": - repAmount = stuff.getModifiedItemAttr("shieldBonus") - cycleTime = stuff.cycleTime - if not repAmount or not cycleTime: - return "", None - repPerSec = float(repAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) - tooltip = "Shield transferred per second" - return text, tooltip - elif itemGroup == "Remote Capacitor Transmitter": - repAmount = stuff.getModifiedItemAttr("powerTransferAmount") - cycleTime = stuff.cycleTime - if not repAmount or not cycleTime: - return "", None - repPerSec = float(repAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) - tooltip = "Energy transferred per second" - return text, tooltip - elif itemGroup == "Remote Hull Repairer": - repAmount = stuff.getModifiedItemAttr("structureDamageAmount") - cycleTime = stuff.cycleTime - if not repAmount or not cycleTime: - return "", None - repPerSec = float(repAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) - tooltip = "Structure repaired per second" - return text, tooltip - elif itemGroup == "Gang Coordinator": - command = stuff.getModifiedItemAttr("commandBonus") or stuff.getModifiedItemAttr("commandBonusHidden") - if not command: - return "", None - text = "{0}%".format(formatAmount(command, 3, 0, 3, forceSign=True)) - tooltip = "Gang bonus strength" - return text, tooltip - elif itemGroup == "Electronic Warfare Drone": - sigRadBonus = stuff.getModifiedItemAttr("signatureRadiusBonus") - lockRangeMult = stuff.getModifiedItemAttr("maxTargetRangeMultiplier") - scanResMult = stuff.getModifiedItemAttr("scanResolutionMultiplier") - falloffRangeMult = stuff.getModifiedItemAttr("fallofMultiplier") - optimalRangeMult = stuff.getModifiedItemAttr("maxRangeMultiplier") - trackingSpeedMult = stuff.getModifiedItemAttr("trackingSpeedMultiplier") - grav = stuff.getModifiedItemAttr("scanGravimetricStrengthBonus") - ladar = stuff.getModifiedItemAttr("scanLadarStrengthBonus") - radar = stuff.getModifiedItemAttr("scanRadarStrengthBonus") - magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthBonus") - if sigRadBonus: - text = "{0}%".format(formatAmount(sigRadBonus, 3, 0, 3, forceSign=True)) - tooltip = "Signature radius increase" - return text, tooltip - if lockRangeMult is not None and scanResMult is not None: - lockRangeBonus = (lockRangeMult - 1) * 100 - scanResBonus = (scanResMult - 1) * 100 - display = 0 - for bonus in (lockRangeBonus, scanResBonus): - if abs(bonus) > abs(display): - display = bonus - if not display: - return "", None - text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) - ttEntries = [] - if display == lockRangeBonus: - ttEntries.append("lock range") - if display == scanResBonus: - ttEntries.append("scan resolution") - tooltip = "{0} dampening".format(formatList(ttEntries)).capitalize() - return text, tooltip - if falloffRangeMult is not None and optimalRangeMult is not None and trackingSpeedMult is not None: - falloffRangeBonus = (falloffRangeMult - 1) * 100 - optimalRangeBonus = (optimalRangeMult - 1) * 100 - trackingSpeedBonus = (trackingSpeedMult - 1) * 100 - display = 0 - for bonus in (falloffRangeBonus, optimalRangeBonus, trackingSpeedBonus): - if abs(bonus) > abs(display): - display = bonus - if not display: - return "", None - text = "{0}%".format(formatAmount(display, 3, 0, 3), forceSign=True) - ttEntries = [] - if display == optimalRangeBonus: - ttEntries.append("optimal range") - if display == falloffRangeBonus: - ttEntries.append("falloff range") - if display == trackingSpeedBonus: - ttEntries.append("tracking speed") - tooltip = "{0} disruption".format(formatList(ttEntries)).capitalize() - return text, tooltip - if grav is not None and ladar is not None and radar is not None and magnet is not None: - display = max(grav, ladar, radar, magnet) - if not display: - return "", None - text = "{0}".format(formatAmount(display, 3, 0, 3)) - ttEntries = [] - if display == grav: - ttEntries.append("gravimetric") - if display == ladar: - ttEntries.append("ladar") - if display == magnet: - ttEntries.append("magnetometric") - if display == radar: - ttEntries.append("radar") - plu = "" if len(ttEntries) == 1 else "s" - tooltip = "{0} strength{1}".format(formatList(ttEntries), plu).capitalize() - return text, tooltip - else: - return "", None - elif itemGroup == "Fighter Bomber": - optimalSig = stuff.getModifiedItemAttr("optimalSigRadius") - if not optimalSig: - return "", None - text = "{0}m".format(formatAmount(optimalSig, 3, 0, 3)) - tooltip = "Optimal signature radius" - return text, tooltip - elif itemGroup in ("Frequency Mining Laser", "Strip Miner", "Mining Laser", "Gas Cloud Harvester"): - miningAmount = stuff.getModifiedItemAttr("specialtyMiningAmount") or stuff.getModifiedItemAttr("miningAmount") - cycleTime = stuff.cycleTime - if not miningAmount or not cycleTime: - return "", None - minePerSec = float(miningAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(minePerSec, 3, 0, 3)) - tooltip = "Yield per second" - return text, tooltip - elif itemGroup == "Logistic Drone": - armorAmount = stuff.getModifiedItemAttr("armorDamageAmount") - shieldAmount = stuff.getModifiedItemAttr("shieldBonus") - hullAmount = stuff.getModifiedItemAttr("structureDamageAmount") - repAmount = armorAmount or shieldAmount or hullAmount - cycleTime = stuff.getModifiedItemAttr("duration") - if not repAmount or not cycleTime: - return "", None - repPerSec = float(repAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3)) - ttEntries = [] - if hullAmount is not None and repAmount == hullAmount: - ttEntries.append("structure") - if armorAmount is not None and repAmount == armorAmount: - ttEntries.append("armor") - if shieldAmount is not None and repAmount == shieldAmount: - ttEntries.append("shield") - tooltip = "{0} repaired per second".format(formatList(ttEntries)).capitalize() - return text, tooltip - elif itemGroup == "Energy Neutralizer Drone": - neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount") - cycleTime = stuff.getModifiedItemAttr("energyNeutralizerDuration") - if not neutAmount or not cycleTime: - return "", None - capPerSec = float(-neutAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) - tooltip = "Energy neutralization per second" - return text, tooltip - elif itemGroup == "Mining Drone": - miningAmount = stuff.getModifiedItemAttr("miningAmount") - cycleTime = stuff.getModifiedItemAttr("duration") - if not miningAmount or not cycleTime: - return "", None - minePerSec = float(miningAmount) * 1000 / cycleTime - text = "{0}/s".format(formatAmount(minePerSec, 3, 0, 3)) - tooltip = "Yield per second" - return text, tooltip - elif itemGroup == "Micro Jump Drive": - cycleTime = stuff.getModifiedItemAttr("duration") / 1000 - text = "{0}s".format(cycleTime) - tooltip = "Spoolup time" - return text, tooltip - elif itemGroup in ("Siege Module", "Cynosural Field"): - amt = stuff.getModifiedItemAttr("consumptionQuantity") - if amt: - typeID = stuff.getModifiedItemAttr("consumptionType") - item = Market.getInstance().getItem(typeID) - text = "{0} units".format(formatAmount(amt, 3, 0, 3)) - return text, item.name - else: - return "", None - elif itemGroup in ("Ancillary Armor Repairer", "Ancillary Shield Booster"): - hp = stuff.hpBeforeReload - cycles = stuff.numShots - cycleTime = stuff.rawCycleTime - if not hp or not cycleTime or not cycles: - return "", None - fit = Fit.getInstance().getFit(self.mainFrame.getActiveFit()) - ehpTotal = fit.ehp - hpTotal = fit.hp - useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective - tooltip = "HP restored over duration using charges" - if useEhp: - if itemGroup == "Ancillary Armor Repairer": - hpRatio = ehpTotal["armor"] / hpTotal["armor"] - else: - hpRatio = ehpTotal["shield"] / hpTotal["shield"] - tooltip = "E{0}".format(tooltip) - else: - hpRatio = 1 - if itemGroup == "Ancillary Armor Repairer": - hpRatio *= 3 - ehp = hp * hpRatio - duration = cycles * cycleTime / 1000 - text = "{0} / {1}s".format(formatAmount(ehp, 3, 0, 9), formatAmount(duration, 3, 0, 3)) - - return text, tooltip - elif itemGroup == "Armor Resistance Shift Hardener": - itemArmorResistanceShiftHardenerEM = (1 - stuff.getModifiedItemAttr("armorEmDamageResonance")) * 100 - itemArmorResistanceShiftHardenerTherm = (1 - stuff.getModifiedItemAttr("armorThermalDamageResonance")) * 100 - itemArmorResistanceShiftHardenerKin = (1 - stuff.getModifiedItemAttr("armorKineticDamageResonance")) * 100 - itemArmorResistanceShiftHardenerExp = (1 - stuff.getModifiedItemAttr("armorExplosiveDamageResonance")) * 100 - - text = "{0}% | {1}% | {2}% | {3}%".format( - formatAmount(itemArmorResistanceShiftHardenerEM, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerTherm, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerKin, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerExp, 3, 0, 3), - ) - tooltip = "Resistances Shifted to Damage Profile:\n{0}% EM | {1}% Therm | {2}% Kin | {3}% Exp".format( - formatAmount(itemArmorResistanceShiftHardenerEM, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerTherm, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerKin, 3, 0, 3), - formatAmount(itemArmorResistanceShiftHardenerExp, 3, 0, 3), - ) - return text, tooltip - elif stuff.charge is not None: - chargeGroup = stuff.charge.group.name - if chargeGroup in ("Rocket", "Advanced Rocket", "Light Missile", "Advanced Light Missile", "FoF Light Missile", - "Heavy Assault Missile", "Advanced Heavy Assault Missile", "Heavy Missile", "Advanced Heavy Missile", "FoF Heavy Missile", - "Torpedo", "Advanced Torpedo", "Cruise Missile", "Advanced Cruise Missile", "FoF Cruise Missile", - "XL Torpedo", "XL Cruise Missile"): - cloudSize = stuff.getModifiedChargeAttr("aoeCloudSize") - aoeVelocity = stuff.getModifiedChargeAttr("aoeVelocity") - if not cloudSize or not aoeVelocity: - return "", None - text = "{0}{1} | {2}{3}".format(formatAmount(cloudSize, 3, 0, 3), "m", - formatAmount(aoeVelocity, 3, 0, 3), "m/s") - tooltip = "Explosion radius and explosion velocity" - return text, tooltip - elif chargeGroup == "Bomb": - cloudSize = stuff.getModifiedChargeAttr("aoeCloudSize") - if not cloudSize: - return "", None - text = "{0}{1}".format(formatAmount(cloudSize, 3, 0, 3), "m") - tooltip = "Explosion radius" - return text, tooltip - elif chargeGroup in ("Scanner Probe",): - scanStr = stuff.getModifiedChargeAttr("baseSensorStrength") - baseRange = stuff.getModifiedChargeAttr("baseScanRange") - if not scanStr or not baseRange: - return "", None - strTwoAu = scanStr / (2.0 / baseRange) - text = "{0}".format(formatAmount(strTwoAu, 3, 0, 3)) - tooltip = "Scan strength with 2 AU scan range" - return text, tooltip - else: - return "", None - else: - return "", None - - -Miscellanea.register() +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# 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 . +# ============================================================================= + +import wx + +from service.fit import Fit +from service.market import Market +import gui.mainFrame +from gui.viewColumn import ViewColumn +from gui.bitmapLoader import BitmapLoader +from gui.utils.numberFormatter import formatAmount +from gui.utils.listFormatter import formatList + + +class Miscellanea(ViewColumn): + name = "Miscellanea" + + def __init__(self, fittingView, params=None): + if params is None: + params = {"showIcon": True, "displayName": False} + + ViewColumn.__init__(self, fittingView) + if params["showIcon"]: + self.imageId = fittingView.imageList.GetImageIndex("column_misc", "gui") + self.bitmap = BitmapLoader.getBitmap("column_misc", "gui") + self.mask = wx.LIST_MASK_IMAGE + else: + self.imageId = -1 + + if params["displayName"] or self.imageId == -1: + self.columnText = "Misc data" + self.mask |= wx.LIST_MASK_TEXT + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def getText(self, stuff): + return self.__getData(stuff)[0] + + def getToolTip(self, mod): + return self.__getData(mod)[1] + + def getImageId(self, mod): + return -1 + + def getParameters(self): + return (("displayName", bool, False), ("showIcon", bool, True)) + + def __getData(self, stuff): + item = stuff.item + if item is None: + return "", None + itemGroup = item.group.name + itemCategory = item.category.name + + if itemGroup == "Ship Modifiers": + return "", None + elif itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Combat Drone", "Fighter Drone"): + trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed") + if not trackingSpeed: + return "", None + text = "{0}".format(formatAmount(trackingSpeed, 3, 0, 3)) + tooltip = "Tracking speed" + return text, tooltip + elif itemCategory == "Subsystem": + slots = ("hi", "med", "low") + info = [] + for slot in slots: + n = int(stuff.getModifiedItemAttr("%sSlotModifier" % slot)) + if n > 0: + info.append("{0}{1}".format(n, slot[0].upper())) + return "+ " + ", ".join(info), "Slot Modifiers" + elif itemGroup == "Energy Neutralizer": + neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount") + cycleTime = stuff.cycleTime + if not neutAmount or not cycleTime: + return "", None + capPerSec = float(-neutAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) + tooltip = "Energy neutralization per second" + return text, tooltip + elif itemGroup == "Energy Nosferatu": + neutAmount = stuff.getModifiedItemAttr("powerTransferAmount") + cycleTime = stuff.cycleTime + if not neutAmount or not cycleTime: + return "", None + capPerSec = float(-neutAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) + tooltip = "Energy neutralization per second" + return text, tooltip + elif itemGroup == "Salvager": + chance = stuff.getModifiedItemAttr("accessDifficultyBonus") + if not chance: + return "", None + text = "{0}%".format(formatAmount(chance, 3, 0, 3)) + tooltip = "Item retrieval chance" + return text, tooltip + elif itemGroup == "Data Miners": + strength = stuff.getModifiedItemAttr("virusStrength") + coherence = stuff.getModifiedItemAttr("virusCoherence") + if not strength or not coherence: + return "", None + text = "{0} | {1}".format(formatAmount(strength, 3, 0, 3), formatAmount(coherence, 3, 0, 3)) + tooltip = "Virus strength and coherence" + return text, tooltip + elif itemGroup in ("Warp Scrambler", "Warp Core Stabilizer"): + scramStr = stuff.getModifiedItemAttr("warpScrambleStrength") + if not scramStr: + return "", None + text = "{0}".format(formatAmount(-scramStr, 3, 0, 3, forceSign=True)) + tooltip = "Warp core strength modification" + return text, tooltip + elif itemGroup in ("Stasis Web", "Stasis Webifying Drone"): + speedFactor = stuff.getModifiedItemAttr("speedFactor") + if not speedFactor: + return "", None + text = "{0}%".format(formatAmount(speedFactor, 3, 0, 3)) + tooltip = "Speed reduction" + return text, tooltip + elif itemGroup == "Target Painter": + sigRadBonus = stuff.getModifiedItemAttr("signatureRadiusBonus") + if not sigRadBonus: + return "", None + text = "{0}%".format(formatAmount(sigRadBonus, 3, 0, 3, forceSign=True)) + tooltip = "Signature radius increase" + return text, tooltip + elif itemGroup == "Sensor Dampener": + lockRangeBonus = stuff.getModifiedItemAttr("maxTargetRangeBonus") + scanResBonus = stuff.getModifiedItemAttr("scanResolutionBonus") + if lockRangeBonus is None or scanResBonus is None: + return "", None + display = 0 + for bonus in (lockRangeBonus, scanResBonus): + if abs(bonus) > abs(display): + display = bonus + if not display: + return "", None + text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) + ttEntries = [] + if display == lockRangeBonus: + ttEntries.append("lock range") + if display == scanResBonus: + ttEntries.append("scan resolution") + tooltip = "{0} dampening".format(formatList(ttEntries)).capitalize() + return text, tooltip + elif itemGroup == "Weapon Disruptor": + # Weapon disruption now covers both tracking and guidance (missile) disruptors + # First get the attributes for tracking disruptors + optimalRangeBonus = stuff.getModifiedItemAttr("maxRangeBonus") + falloffRangeBonus = stuff.getModifiedItemAttr("falloffBonus") + trackingSpeedBonus = stuff.getModifiedItemAttr("trackingSpeedBonus") + + trackingDisruptorAttributes = { + "optimal range": optimalRangeBonus, + "falloff range": falloffRangeBonus, + "tracking speed": trackingSpeedBonus} + + isTrackingDisruptor = any(map(lambda x: x is not None and x != 0, trackingDisruptorAttributes.values())) + + # Then get the attributes for guidance disruptors + explosionVelocityBonus = stuff.getModifiedItemAttr("aoeVelocityBonus") + explosionRadiusBonus = stuff.getModifiedItemAttr("aoeCloudSizeBonus") + + flightTimeBonus = stuff.getModifiedItemAttr("explosionDelayBonus") + missileVelocityBonus = stuff.getModifiedItemAttr("missileVelocityBonus") + + guidanceDisruptorAttributes = { + "explosion velocity": explosionVelocityBonus, + "explosion radius": explosionRadiusBonus, + "flight time": flightTimeBonus, + "missile velocity": missileVelocityBonus} + + isGuidanceDisruptor = any(map(lambda x: x is not None and x != 0, guidanceDisruptorAttributes.values())) + + if isTrackingDisruptor: + attributes = trackingDisruptorAttributes + elif isGuidanceDisruptor: + attributes = guidanceDisruptorAttributes + else: + return "", None + + display = max(attributes.values(), key=lambda x: abs(x)) + + text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) + + ttEntries = [] + for attributeName, attributeValue in attributes.items(): + if attributeValue == display: + ttEntries.append(attributeName) + + tooltip = "{0} disruption".format(formatList(ttEntries)).capitalize() + return text, tooltip + elif itemGroup in ("ECM", "Burst Jammer", "Burst Projectors"): + grav = stuff.getModifiedItemAttr("scanGravimetricStrengthBonus") + ladar = stuff.getModifiedItemAttr("scanLadarStrengthBonus") + radar = stuff.getModifiedItemAttr("scanRadarStrengthBonus") + magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthBonus") + displayMax = max(grav, ladar, radar, magnet) + displayMin = min(grav, ladar, radar, magnet) + if grav is None or ladar is None or radar is None or magnet is None or displayMax is None: + return "", None + + if displayMax == displayMin or displayMin is None: + text = "{0}".format( + formatAmount(displayMax, 3, 0, 3), + ) + else: + text = "{0} | {1}".format( + formatAmount(displayMax, 3, 0, 3), + formatAmount(displayMin, 3, 0, 3), + ) + tooltip = "ECM Jammer Strength:\n{0} Gravimetric | {1} Ladar | {2} Magnetometric | {3} Radar".format( + formatAmount(grav, 3, 0, 3), + formatAmount(ladar, 3, 0, 3), + formatAmount(radar, 3, 0, 3), + formatAmount(magnet, 3, 0, 3), + ) + return text, tooltip + elif itemGroup in ("Remote Sensor Booster", "Sensor Booster", "Signal Amplifier"): + scanResBonus = stuff.getModifiedItemAttr("scanResolutionBonus") + lockRangeBonus = stuff.getModifiedItemAttr("maxTargetRangeBonus") + gravBonus = stuff.getModifiedItemAttr("scanGravimetricStrengthPercent") + if scanResBonus is None or lockRangeBonus is None or gravBonus is None: + return "", None + + text = "{0}% | {1}% | {2}%".format( + formatAmount(scanResBonus, 3, 0, 3), + formatAmount(lockRangeBonus, 3, 0, 3), + formatAmount(gravBonus, 3, 0, 3), + ) + tooltip = "Applied bonuses:\n{0}% scan resolution | {1}% lock range | {2}% sensor strength".format( + formatAmount(scanResBonus, 3, 0, 3), + formatAmount(lockRangeBonus, 3, 0, 3), + formatAmount(gravBonus, 3, 0, 3), + ) + return text, tooltip + elif itemGroup in ("Projected ECCM", "ECCM", "Sensor Backup Array"): + grav = stuff.getModifiedItemAttr("scanGravimetricStrengthPercent") + ladar = stuff.getModifiedItemAttr("scanLadarStrengthPercent") + radar = stuff.getModifiedItemAttr("scanRadarStrengthPercent") + magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthPercent") + if grav is None or ladar is None or radar is None or magnet is None: + return "", None + display = max(grav, ladar, radar, magnet) + if not display: + return "", None + text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) + ttEntries = [] + if display == grav: + ttEntries.append("gravimetric") + if display == ladar: + ttEntries.append("ladar") + if display == magnet: + ttEntries.append("magnetometric") + if display == radar: + ttEntries.append("radar") + plu = "" if len(ttEntries) == 1 else "s" + tooltip = "{0} strength{1} bonus".format(formatList(ttEntries), plu).capitalize() + return text, tooltip + elif itemGroup == "Cloaking Device": + recalibration = stuff.getModifiedItemAttr("cloakingTargetingDelay") + if recalibration is None: + return "", None + text = "{0}s".format(formatAmount(float(recalibration) / 1000, 3, 0, 3)) + tooltip = "Sensor recalibration time" + return text, tooltip + elif itemGroup == "Remote Armor Repairer": + repAmount = stuff.getModifiedItemAttr("armorDamageAmount") + cycleTime = stuff.getModifiedItemAttr("duration") + if not repAmount or not cycleTime: + return "", None + repPerSec = float(repAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) + tooltip = "Armor repaired per second" + return text, tooltip + elif itemGroup == "Remote Shield Booster": + repAmount = stuff.getModifiedItemAttr("shieldBonus") + cycleTime = stuff.cycleTime + if not repAmount or not cycleTime: + return "", None + repPerSec = float(repAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) + tooltip = "Shield transferred per second" + return text, tooltip + elif itemGroup == "Remote Capacitor Transmitter": + repAmount = stuff.getModifiedItemAttr("powerTransferAmount") + cycleTime = stuff.cycleTime + if not repAmount or not cycleTime: + return "", None + repPerSec = float(repAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) + tooltip = "Energy transferred per second" + return text, tooltip + elif itemGroup == "Remote Hull Repairer": + repAmount = stuff.getModifiedItemAttr("structureDamageAmount") + cycleTime = stuff.cycleTime + if not repAmount or not cycleTime: + return "", None + repPerSec = float(repAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3, forceSign=True)) + tooltip = "Structure repaired per second" + return text, tooltip + elif itemGroup == "Gang Coordinator": + command = stuff.getModifiedItemAttr("commandBonus") or stuff.getModifiedItemAttr("commandBonusHidden") + if not command: + return "", None + text = "{0}%".format(formatAmount(command, 3, 0, 3, forceSign=True)) + tooltip = "Gang bonus strength" + return text, tooltip + elif itemGroup == "Electronic Warfare Drone": + sigRadBonus = stuff.getModifiedItemAttr("signatureRadiusBonus") + lockRangeMult = stuff.getModifiedItemAttr("maxTargetRangeMultiplier") + scanResMult = stuff.getModifiedItemAttr("scanResolutionMultiplier") + falloffRangeMult = stuff.getModifiedItemAttr("fallofMultiplier") + optimalRangeMult = stuff.getModifiedItemAttr("maxRangeMultiplier") + trackingSpeedMult = stuff.getModifiedItemAttr("trackingSpeedMultiplier") + grav = stuff.getModifiedItemAttr("scanGravimetricStrengthBonus") + ladar = stuff.getModifiedItemAttr("scanLadarStrengthBonus") + radar = stuff.getModifiedItemAttr("scanRadarStrengthBonus") + magnet = stuff.getModifiedItemAttr("scanMagnetometricStrengthBonus") + if sigRadBonus: + text = "{0}%".format(formatAmount(sigRadBonus, 3, 0, 3, forceSign=True)) + tooltip = "Signature radius increase" + return text, tooltip + if lockRangeMult is not None and scanResMult is not None: + lockRangeBonus = (lockRangeMult - 1) * 100 + scanResBonus = (scanResMult - 1) * 100 + display = 0 + for bonus in (lockRangeBonus, scanResBonus): + if abs(bonus) > abs(display): + display = bonus + if not display: + return "", None + text = "{0}%".format(formatAmount(display, 3, 0, 3, forceSign=True)) + ttEntries = [] + if display == lockRangeBonus: + ttEntries.append("lock range") + if display == scanResBonus: + ttEntries.append("scan resolution") + tooltip = "{0} dampening".format(formatList(ttEntries)).capitalize() + return text, tooltip + if falloffRangeMult is not None and optimalRangeMult is not None and trackingSpeedMult is not None: + falloffRangeBonus = (falloffRangeMult - 1) * 100 + optimalRangeBonus = (optimalRangeMult - 1) * 100 + trackingSpeedBonus = (trackingSpeedMult - 1) * 100 + display = 0 + for bonus in (falloffRangeBonus, optimalRangeBonus, trackingSpeedBonus): + if abs(bonus) > abs(display): + display = bonus + if not display: + return "", None + text = "{0}%".format(formatAmount(display, 3, 0, 3), forceSign=True) + ttEntries = [] + if display == optimalRangeBonus: + ttEntries.append("optimal range") + if display == falloffRangeBonus: + ttEntries.append("falloff range") + if display == trackingSpeedBonus: + ttEntries.append("tracking speed") + tooltip = "{0} disruption".format(formatList(ttEntries)).capitalize() + return text, tooltip + if grav is not None and ladar is not None and radar is not None and magnet is not None: + display = max(grav, ladar, radar, magnet) + if not display: + return "", None + text = "{0}".format(formatAmount(display, 3, 0, 3)) + ttEntries = [] + if display == grav: + ttEntries.append("gravimetric") + if display == ladar: + ttEntries.append("ladar") + if display == magnet: + ttEntries.append("magnetometric") + if display == radar: + ttEntries.append("radar") + plu = "" if len(ttEntries) == 1 else "s" + tooltip = "{0} strength{1}".format(formatList(ttEntries), plu).capitalize() + return text, tooltip + else: + return "", None + elif itemGroup == "Fighter Bomber": + optimalSig = stuff.getModifiedItemAttr("optimalSigRadius") + if not optimalSig: + return "", None + text = "{0}m".format(formatAmount(optimalSig, 3, 0, 3)) + tooltip = "Optimal signature radius" + return text, tooltip + elif itemGroup in ("Frequency Mining Laser", "Strip Miner", "Mining Laser", "Gas Cloud Harvester"): + miningAmount = stuff.getModifiedItemAttr("specialtyMiningAmount") or stuff.getModifiedItemAttr( + "miningAmount") + cycleTime = stuff.cycleTime + if not miningAmount or not cycleTime: + return "", None + minePerSec = float(miningAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(minePerSec, 3, 0, 3)) + tooltip = "Yield per second" + return text, tooltip + elif itemGroup == "Logistic Drone": + armorAmount = stuff.getModifiedItemAttr("armorDamageAmount") + shieldAmount = stuff.getModifiedItemAttr("shieldBonus") + hullAmount = stuff.getModifiedItemAttr("structureDamageAmount") + repAmount = armorAmount or shieldAmount or hullAmount + cycleTime = stuff.getModifiedItemAttr("duration") + if not repAmount or not cycleTime: + return "", None + repPerSec = float(repAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3)) + ttEntries = [] + if hullAmount is not None and repAmount == hullAmount: + ttEntries.append("structure") + if armorAmount is not None and repAmount == armorAmount: + ttEntries.append("armor") + if shieldAmount is not None and repAmount == shieldAmount: + ttEntries.append("shield") + tooltip = "{0} repaired per second".format(formatList(ttEntries)).capitalize() + return text, tooltip + elif itemGroup == "Energy Neutralizer Drone": + neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount") + cycleTime = stuff.getModifiedItemAttr("energyNeutralizerDuration") + if not neutAmount or not cycleTime: + return "", None + capPerSec = float(-neutAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(capPerSec, 3, 0, 3)) + tooltip = "Energy neutralization per second" + return text, tooltip + elif itemGroup == "Mining Drone": + miningAmount = stuff.getModifiedItemAttr("miningAmount") + cycleTime = stuff.getModifiedItemAttr("duration") + if not miningAmount or not cycleTime: + return "", None + minePerSec = float(miningAmount) * 1000 / cycleTime + text = "{0}/s".format(formatAmount(minePerSec, 3, 0, 3)) + tooltip = "Yield per second" + return text, tooltip + elif itemGroup == "Micro Jump Drive": + cycleTime = stuff.getModifiedItemAttr("duration") / 1000 + text = "{0}s".format(cycleTime) + tooltip = "Spoolup time" + return text, tooltip + elif itemGroup in ("Siege Module", "Cynosural Field"): + amt = stuff.getModifiedItemAttr("consumptionQuantity") + if amt: + typeID = stuff.getModifiedItemAttr("consumptionType") + item = Market.getInstance().getItem(typeID) + text = "{0} units".format(formatAmount(amt, 3, 0, 3)) + return text, item.name + else: + return "", None + elif itemGroup in ("Ancillary Armor Repairer", "Ancillary Shield Booster"): + hp = stuff.hpBeforeReload + cycles = stuff.numShots + cycleTime = stuff.rawCycleTime + if not hp or not cycleTime or not cycles: + return "", None + fit = Fit.getInstance().getFit(self.mainFrame.getActiveFit()) + ehpTotal = fit.ehp + hpTotal = fit.hp + useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective + tooltip = "HP restored over duration using charges" + if useEhp: + if itemGroup == "Ancillary Armor Repairer": + hpRatio = ehpTotal["armor"] / hpTotal["armor"] + else: + hpRatio = ehpTotal["shield"] / hpTotal["shield"] + tooltip = "E{0}".format(tooltip) + else: + hpRatio = 1 + if itemGroup == "Ancillary Armor Repairer": + hpRatio *= 3 + ehp = hp * hpRatio + duration = cycles * cycleTime / 1000 + text = "{0} / {1}s".format(formatAmount(ehp, 3, 0, 9), formatAmount(duration, 3, 0, 3)) + + return text, tooltip + elif itemGroup == "Armor Resistance Shift Hardener": + itemArmorResistanceShiftHardenerEM = (1 - stuff.getModifiedItemAttr("armorEmDamageResonance")) * 100 + itemArmorResistanceShiftHardenerTherm = (1 - stuff.getModifiedItemAttr("armorThermalDamageResonance")) * 100 + itemArmorResistanceShiftHardenerKin = (1 - stuff.getModifiedItemAttr("armorKineticDamageResonance")) * 100 + itemArmorResistanceShiftHardenerExp = (1 - stuff.getModifiedItemAttr("armorExplosiveDamageResonance")) * 100 + + text = "{0}% | {1}% | {2}% | {3}%".format( + formatAmount(itemArmorResistanceShiftHardenerEM, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerTherm, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerKin, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerExp, 3, 0, 3), + ) + tooltip = "Resistances Shifted to Damage Profile:\n{0}% EM | {1}% Therm | {2}% Kin | {3}% Exp".format( + formatAmount(itemArmorResistanceShiftHardenerEM, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerTherm, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerKin, 3, 0, 3), + formatAmount(itemArmorResistanceShiftHardenerExp, 3, 0, 3), + ) + return text, tooltip + elif stuff.charge is not None: + chargeGroup = stuff.charge.group.name + if chargeGroup in ( + "Rocket", + "Advanced Rocket", + "Light Missile", + "Advanced Light Missile", + "FoF Light Missile", + "Heavy Assault Missile", + "Advanced Heavy Assault Missile", + "Heavy Missile", + "Advanced Heavy Missile", + "FoF Heavy Missile", + "Torpedo", + "Advanced Torpedo", + "Cruise Missile", + "Advanced Cruise Missile", + "FoF Cruise Missile", + "XL Torpedo", + "XL Cruise Missile" + ): + cloudSize = stuff.getModifiedChargeAttr("aoeCloudSize") + aoeVelocity = stuff.getModifiedChargeAttr("aoeVelocity") + if not cloudSize or not aoeVelocity: + return "", None + text = "{0}{1} | {2}{3}".format(formatAmount(cloudSize, 3, 0, 3), "m", + formatAmount(aoeVelocity, 3, 0, 3), "m/s") + tooltip = "Explosion radius and explosion velocity" + return text, tooltip + elif chargeGroup == "Bomb": + cloudSize = stuff.getModifiedChargeAttr("aoeCloudSize") + if not cloudSize: + return "", None + text = "{0}{1}".format(formatAmount(cloudSize, 3, 0, 3), "m") + tooltip = "Explosion radius" + return text, tooltip + elif chargeGroup in ("Scanner Probe",): + scanStr = stuff.getModifiedChargeAttr("baseSensorStrength") + baseRange = stuff.getModifiedChargeAttr("baseScanRange") + if not scanStr or not baseRange: + return "", None + strTwoAu = scanStr / (2.0 / baseRange) + text = "{0}".format(formatAmount(strTwoAu, 3, 0, 3)) + tooltip = "Scan strength with 2 AU scan range" + return text, tooltip + else: + return "", None + else: + return "", None + + +Miscellanea.register() diff --git a/gui/builtinViewColumns/propertyDisplay.py b/gui/builtinViewColumns/propertyDisplay.py index 71f22ca5d..1972cfae1 100644 --- a/gui/builtinViewColumns/propertyDisplay.py +++ b/gui/builtinViewColumns/propertyDisplay.py @@ -18,10 +18,8 @@ # ============================================================================= from gui.viewColumn import ViewColumn -from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount from service.attribute import Attribute -import wx class PropertyDisplay(ViewColumn): diff --git a/gui/builtinViewColumns/state.py b/gui/builtinViewColumns/state.py index b6c8698ec..920562087 100644 --- a/gui/builtinViewColumns/state.py +++ b/gui/builtinViewColumns/state.py @@ -47,7 +47,8 @@ class State(ViewColumn): def getImageId(self, stuff): generic_active = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(1).lower(), "gui") - generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(-1).lower(), "gui") + generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(-1).lower(), + "gui") if isinstance(stuff, Drone): if stuff.amountActive > 0: @@ -60,7 +61,8 @@ class State(ViewColumn): if stuff.isEmpty: return -1 else: - return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(stuff.state).lower(), "gui") + return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(stuff.state).lower(), + "gui") elif isinstance(stuff, Fit): fitID = self.mainFrame.getActiveFit() projectionInfo = stuff.getProjectionInfo(fitID) diff --git a/gui/builtinViews/entityEditor.py b/gui/builtinViews/entityEditor.py index c9bffe951..b77efe8a5 100644 --- a/gui/builtinViews/entityEditor.py +++ b/gui/builtinViews/entityEditor.py @@ -1,6 +1,7 @@ import wx from gui.bitmapLoader import BitmapLoader + class BaseValidator(wx.PyValidator): def __init__(self): wx.PyValidator.__init__(self) @@ -14,6 +15,7 @@ class BaseValidator(wx.PyValidator): def TransferFromWindow(self): return True + class TextEntryValidatedDialog(wx.TextEntryDialog): def __init__(self, parent, validator=None, *args, **kargs): wx.TextEntryDialog.__init__(self, parent, *args, **kargs) @@ -23,7 +25,8 @@ class TextEntryValidatedDialog(wx.TextEntryDialog): if validator: self.txtctrl.SetValidator(validator()) -class EntityEditor (wx.Panel): + +class EntityEditor(wx.Panel): """ Entity Editor is a panel that takes some sort of list as a source and populates a drop down with options to add/ rename/clone/delete an entity. Comes with dialogs that take user input. Classes that derive this class must override @@ -51,7 +54,7 @@ class EntityEditor (wx.Panel): bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) if name != "rename" else art btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) if size is None: - size = btn.GetSize() + size = btn.GetSize() btn.SetMinSize(size) btn.SetMaxSize(size) @@ -134,8 +137,9 @@ class EntityEditor (wx.Panel): def OnDelete(self, event): dlg = wx.MessageDialog(self, - "Do you really want to delete the {} {}?".format(self.getActiveEntity().name, self.entityName), - "Confirm Delete", wx.YES | wx.NO | wx.ICON_QUESTION) + "Do you really want to delete the {} {}?".format(self.getActiveEntity().name, + self.entityName), + "Confirm Delete", wx.YES | wx.NO | wx.ICON_QUESTION) dlg.CenterOnParent() if dlg.ShowModal() == wx.ID_YES: @@ -170,4 +174,4 @@ class EntityEditor (wx.Panel): return False self.Parent.Show() - return True \ No newline at end of file + return True diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index cdcddde14..7e9d09d80 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -93,18 +93,18 @@ FitSpawner.register() # Drag'n'drop handler class FittingViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): - wx.PyDropTarget.__init__(self) - self.dropFn = dropFn - # this is really transferring an EVE itemID - self.dropData = wx.PyTextDataObject() - self.SetDataObject(self.dropData) + def __init__(self, dropFn): + wx.PyDropTarget.__init__(self) + self.dropFn = dropFn + # this is really transferring an EVE itemID + self.dropData = wx.PyTextDataObject() + self.SetDataObject(self.dropData) - def OnData(self, x, y, t): - if self.GetData(): - data = self.dropData.GetText().split(':') - self.dropFn(x, y, data) - return t + def OnData(self, x, y, t): + if self.GetData(): + data = self.dropData.GetText().split(':') + self.dropFn(x, y, data) + return t class FittingView(d.Display): @@ -372,7 +372,8 @@ class FittingView(d.Display): module = self.mods[dstRow] sFit = Fit.getInstance() - sFit.moveCargoToModule(self.mainFrame.getActiveFit(), module.position, srcIdx, mstate.CmdDown() and module.isEmpty) + sFit.moveCargoToModule(self.mainFrame.getActiveFit(), module.position, srcIdx, + mstate.CmdDown() and module.isEmpty) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) @@ -425,7 +426,7 @@ class FittingView(d.Display): # as Racks and tactical Modes. This allows us to skip over common # module operations such as swapping, removing, copying, etc. that # would otherwise cause complications - self.blanks = [] # preliminary markers where blanks will be inserted + self.blanks = [] # preliminary markers where blanks will be inserted if sFit.serviceFittingOptions["rackSlots"]: # flag to know when to add blanks, based on previous slot diff --git a/gui/builtinViews/fleetView.py b/gui/builtinViews/fleetView.py index 3b4347ff2..466407b7e 100644 --- a/gui/builtinViews/fleetView.py +++ b/gui/builtinViews/fleetView.py @@ -71,10 +71,14 @@ class FleetView(wx.gizmos.TreeListCtrl): event.Skip() def checkNew(self, event): + self.GetPyData(event.Item) + + # TODO: Doesn't seem to be used + ''' data = self.GetPyData(event.Item) if data and isinstance(data, tuple) and data[0] == "add": layer = data[1] - + ''' def UpdateTab(self, name, img): self.tabManager.SetPageTextIcon(self.tabManager.GetSelection(), name, img) diff --git a/gui/builtinViews/implantEditor.py b/gui/builtinViews/implantEditor.py index b06a0ea5c..8b56833df 100644 --- a/gui/builtinViews/implantEditor.py +++ b/gui/builtinViews/implantEditor.py @@ -8,7 +8,7 @@ from gui.bitmapLoader import BitmapLoader from gui.marketBrowser import SearchBox -class BaseImplantEditorView (wx.Panel): +class BaseImplantEditorView(wx.Panel): def addMarketViewImage(self, iconFile): if iconFile is None: return -1 @@ -19,7 +19,8 @@ class BaseImplantEditorView (wx.Panel): return self.availableImplantsImageList.Add(bitmap) def __init__(self, parent): - wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) + wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.TAB_TRAVERSAL) self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) pmainSizer = wx.BoxSizer(wx.HORIZONTAL) @@ -53,10 +54,12 @@ class BaseImplantEditorView (wx.Panel): buttonSizer = wx.BoxSizer(wx.VERTICAL) buttonSizer.AddSpacer((0, 0), 1) - self.btnAdd = GenBitmapButton(self, wx.ID_ADD, BitmapLoader.getBitmap("fit_add_small", "gui"), style=wx.BORDER_NONE) + self.btnAdd = GenBitmapButton(self, wx.ID_ADD, BitmapLoader.getBitmap("fit_add_small", "gui"), + style=wx.BORDER_NONE) buttonSizer.Add(self.btnAdd, 0) - self.btnRemove = GenBitmapButton(self, wx.ID_REMOVE, BitmapLoader.getBitmap("fit_delete_small", "gui"), style=wx.BORDER_NONE) + self.btnRemove = GenBitmapButton(self, wx.ID_REMOVE, BitmapLoader.getBitmap("fit_delete_small", "gui"), + style=wx.BORDER_NONE) buttonSizer.Add(self.btnRemove, 0) buttonSizer.AddSpacer((0, 0), 1) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 2d9e63277..f2b4b54db 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -557,7 +557,7 @@ class APIView(wx.Panel): if chars: for charName in chars: - i = self.charChoice.Append(charName) + self.charChoice.Append(charName) self.charChoice.SetStringSelection(char) self.charChoice.Enable(True) self.btnFetchSkills.Enable(True) @@ -598,7 +598,7 @@ class APIView(wx.Panel): else: self.charChoice.Clear() for charName in list: - i = self.charChoice.Append(charName) + self.charChoice.Append(charName) self.btnFetchSkills.Enable(True) self.charChoice.Enable(True) diff --git a/gui/commandView.py b/gui/commandView.py index 10f8fda1d..20a7a33a9 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -25,7 +25,6 @@ import gui.droneView from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu from service.fit import Fit -from service.market import Market from eos.saveddata.drone import Drone as es_Drone diff --git a/gui/fighterView.py b/gui/fighterView.py index 524c07976..083901460 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -27,6 +27,7 @@ from gui.builtinViewColumns.state import State from eos.types import Slot from gui.contextMenu import ContextMenu from service.fit import Fit +from service.market import Market class FighterViewDrop(wx.PyDropTarget): @@ -172,7 +173,6 @@ class FighterDisplay(d.Display): keycode = event.GetKeyCode() if keycode == wx.WXK_DELETE or keycode == wx.WXK_NUMPAD_DELETE: row = self.GetFirstSelected() - firstSel = row if row != -1: fighter = self.fighters[self.GetItemData(row)] self.removeFighter(fighter) @@ -187,7 +187,7 @@ class FighterDisplay(d.Display): dropSource = wx.DropSource(self) dropSource.SetData(data) - res = dropSource.DoDragDrop() + dropSource.DoDragDrop() def handleDragDrop(self, x, y, data): ''' diff --git a/gui/itemStats.py b/gui/itemStats.py index a7c008b12..0dfb24181 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -65,7 +65,9 @@ class ItemStatsDialog(wx.Dialog): except IndexError: itmContext = None item = getattr(victim, "item", None) if srcContext.lower() not in ( - "projectedcharge", "fittingcharge") else getattr(victim, "charge", None) + "projectedcharge", + "fittingcharge" + ) else getattr(victim, "charge", None) if item is None: sMkt = Market.getInstance() item = sMkt.getItem(victim.ID) @@ -477,7 +479,7 @@ class ItemParams(wx.Panel): trans = {"Inverse Absolute Percent": (lambda: (1 - value) * 100, unitName), "Inversed Modifier Percent": (lambda: (1 - value) * 100, unitName), "Modifier Percent": ( - lambda: ("%+.2f" if ((value - 1) * 100) % 1 else "%+d") % ((value - 1) * 100), unitName), + lambda: ("%+.2f" if ((value - 1) * 100) % 1 else "%+d") % ((value - 1) * 100), unitName), "Volume": (lambda: value, u"m\u00B3"), "Sizeclass": (lambda: value, ""), "Absolute Percent": (lambda: (value * 100), unitName), @@ -1254,10 +1256,18 @@ class ItemAffectedBy(wx.Panel): if self.showRealNames: display = "%s %s %.2f %s" % (attrName, attrModifier, attrAmount, penalized) saved = "%s %s %.2f %s" % ( - (displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized) + displayName if displayName != "" else attrName, + attrModifier, + attrAmount, + penalized + ) else: display = "%s %s %.2f %s" % ( - (displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized) + displayName if displayName != "" else attrName, + attrModifier, + attrAmount, + penalized + ) saved = "%s %s %.2f %s" % (attrName, attrModifier, attrAmount, penalized) treeitem = self.affectedBy.AppendItem(child, display, attrIcon) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 8f2cf73e7..4c7062f5a 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -26,14 +26,12 @@ import time from codecs import open -from wx._core import PyDeadObjectError from wx.lib.wordwrap import wordwrap import config import gui.aboutData import gui.chromeTabs -import gui.utils.animUtils as animUtils import gui.globalEvents as GE from gui.bitmapLoader import BitmapLoader @@ -52,9 +50,9 @@ from gui.preferenceDialog import PreferenceDialog from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog from gui.utils.clipboard import toClipboard, fromClipboard -from gui.fleetBrowser import FleetBrowser +from gui.fleetBrowser import FleetBrowser # Noqa - TODO: unsure if this is needed here from gui.updateDialog import UpdateDialog -from gui.builtinViews import * +from gui.builtinViews import * # Noqa - TODO: unsure if this is needed here from gui import graphFrame from service.settings import SettingsProvider diff --git a/gui/projectedView.py b/gui/projectedView.py index 8a3135121..f9c666f60 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -23,9 +23,11 @@ import gui.globalEvents as GE import gui.droneView from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu -import eos.types from service.fit import Fit from service.market import Market +from eos.saveddata.drone import Drone as es_Drone +from eos.saveddata.fighter import Fighter as es_Fighter +from eos.saveddata.module import Module as es_Module class DummyItem: diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 6a15678e2..ddb7b42d4 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -932,8 +932,8 @@ class ShipBrowser(wx.Panel): if fits: for fit in fits: - shipTrait = fit.ship.traits.traitText if ( - fit.ship.traits is not None) else "" # empty string if no traits + shipTrait = fit.ship.traits.traitText if (fit.ship.traits is not None) else "" + # empty string if no traits self.lpane.AddWidget(FitItem( self.lpane, diff --git a/gui/updateDialog.py b/gui/updateDialog.py index 8a88f9e17..4326cfb47 100644 --- a/gui/updateDialog.py +++ b/gui/updateDialog.py @@ -18,8 +18,6 @@ # ============================================================================= import wx -from gui.bitmapLoader import BitmapLoader -import config import dateutil.parser from service import settings diff --git a/gui/utils/animEffects.py b/gui/utils/animEffects.py index 67605919a..a705374a0 100644 --- a/gui/utils/animEffects.py +++ b/gui/utils/animEffects.py @@ -1,4 +1,3 @@ - import math diff --git a/gui/utils/compat.py b/gui/utils/compat.py index bf49eb4aa..e0d336b22 100644 --- a/gui/utils/compat.py +++ b/gui/utils/compat.py @@ -14,6 +14,7 @@ except ImportError: class OrderedDict(dict): 'Dictionary that remembers insertion order' + # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. @@ -35,7 +36,7 @@ class OrderedDict(dict): try: self.__root except AttributeError: - self.__root = root = [] # sentinel node + self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) diff --git a/gui/utils/drawUtils.py b/gui/utils/drawUtils.py index 91af8444e..559dac395 100644 --- a/gui/utils/drawUtils.py +++ b/gui/utils/drawUtils.py @@ -3,7 +3,6 @@ import gui.utils.colorUtils as colorUtils def RenderGradientBar(windowColor, width, height, sFactor, eFactor, mFactor=None, fillRatio=2): - if sFactor == 0 and eFactor == 0 and mFactor is None: return DrawFilledBitmap(width, height, windowColor) diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index ed9e8bc2b..59b54319d 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -29,7 +29,6 @@ class exportHtml(): class exportHtmlThread(threading.Thread): - def __init__(self, callback=False): threading.Thread.__init__(self) self.callback = callback @@ -192,7 +191,8 @@ class exportHtmlThread(threading.Thread): fit = fits[0] try: dnaFit = sFit.exportDna(fit[0]) - HTMLgroup += '
  • ' + ship.name + ": " + fit[1] + '
  • \n' + HTMLgroup += '
  • ' + ship.name + ": " + \ + fit[1] + '
  • \n' except: pass finally: @@ -203,8 +203,9 @@ class exportHtmlThread(threading.Thread): # Ship group header HTMLship = ( '
  • \n' - '

    ' + ship.name + ' ' + str(len(fits)) + '

    \n' - '
      \n' + '

      ' + ship.name + ' ' + str( + len(fits)) + '

      \n' + '
        \n' ) for fit in fits: @@ -212,7 +213,8 @@ class exportHtmlThread(threading.Thread): return try: dnaFit = sFit.exportDna(fit[0]) - HTMLship += '
      • ' + fit[1] + '
      • \n' + HTMLship += '
      • ' + fit[ + 1] + '
      • \n' except: continue finally: @@ -227,7 +229,7 @@ class exportHtmlThread(threading.Thread): HTML += ( '
      • \n' '

        ' + group.groupName + ' ' + str(groupFits) + '

        \n' - '
          \n' + HTMLgroup + + '
            \n' + HTMLgroup + '
          \n' ' ' ) @@ -263,7 +265,8 @@ class exportHtmlThread(threading.Thread): return try: dnaFit = sFit.exportDna(fit[0]) - HTML += '' + ship.name + ': ' + fit[1] + '
          \n' + HTML += '' + ship.name + ': ' + \ + fit[1] + '
          \n' except: continue finally: diff --git a/gui/utils/numberFormatter.py b/gui/utils/numberFormatter.py index bb1ca210a..cd8140dce 100644 --- a/gui/utils/numberFormatter.py +++ b/gui/utils/numberFormatter.py @@ -34,7 +34,7 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal # Start from highest possible suffix for key in posOrders: # Find first suitable suffix and check if it's not above highest order - if abs(val) >= 10**key and key <= highest: + if abs(val) >= 10 ** key and key <= highest: mantissa, suffix = val / float(10 ** key), posSuffixMap[key] # Do additional step to eliminate results like 999999 => 1000k # If we're already using our greatest order, we can't do anything useful @@ -49,7 +49,7 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal # If it is, bail - we already have acceptable results break # Find multiplier to get from one order to another - orderDiff = 10**(prevKey - key) + orderDiff = 10 ** (prevKey - key) # If rounded mantissa according to our specifications is greater than # or equal to multiplier if roundToPrec(mantissa, prec) >= orderDiff: @@ -67,8 +67,8 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal except IndexError: nextKey = 0 # Check if mantissa with next suffix is in range [1, 1000) - if abs(val) < 10**(nextKey) and key >= lowest: - mantissa, suffix = val / float(10**key), negSuffixMap[key] + if abs(val) < 10 ** (nextKey) and key >= lowest: + mantissa, suffix = val / float(10 ** key), negSuffixMap[key] # Do additional step to eliminate results like 0.9999 => 1000m # Check if the key we're potentially switching to is greater than our # upper boundary @@ -76,7 +76,7 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal # If it is, leave loop with results we already have break # Find the multiplier between current and next order - orderDiff = 10**(nextKey - key) + orderDiff = 10 ** (nextKey - key) # If rounded mantissa according to our specifications is greater than # or equal to multiplier if roundToPrec(mantissa, prec) >= orderDiff: diff --git a/pyfa.py b/pyfa.py index e3364814e..e465b0d5a 100755 --- a/pyfa.py +++ b/pyfa.py @@ -124,7 +124,7 @@ if __name__ == "__main__": import os.path import eos.db - import service.prefetch # noqa + import service.prefetch from gui.mainFrame import MainFrame # Make sure the saveddata db exists diff --git a/service/fit.py b/service/fit.py index 61b8ccc3b..1c4083bde 100644 --- a/service/fit.py +++ b/service/fit.py @@ -667,10 +667,10 @@ class Fit(object): standardAttackActive = True else: # Activate all other abilities (Neut, Web, etc) except propmods if no standard attack is active - if (ability.effect.isImplemented - and standardAttackActive is False - and ability.effect.handlerName != u'fighterabilitymicrowarpdrive' - and ability.effect.handlerName != u'fighterabilityevasivemaneuvers'): + if ability.effect.isImplemented and \ + standardAttackActive is False and \ + ability.effect.handlerName != u'fighterabilitymicrowarpdrive' and \ + ability.effect.handlerName != u'fighterabilityevasivemaneuvers': ability.active = True if used >= total: diff --git a/service/market.py b/service/market.py index 30972795e..c711201b6 100644 --- a/service/market.py +++ b/service/market.py @@ -360,7 +360,16 @@ class Market(): ("complex", frozenset((6,))), ("officer", frozenset((5,)))]) self.SEARCH_CATEGORIES = ( - "Drone", "Module", "Subsystem", "Charge", "Implant", "Deployable", "Fighter", "Structure", "Structure Module") + "Drone", + "Module", + "Subsystem", + "Charge", + "Implant", + "Deployable", + "Fighter", + "Structure", + "Structure Module", + ) self.SEARCH_GROUPS = ("Ice Product",) self.ROOT_MARKET_GROUPS = (9, # Modules 1111, # Rigs @@ -377,7 +386,7 @@ class Market(): @classmethod def getInstance(cls): - if cls.instance == None: + if cls.instance is None: cls.instance = Market() return cls.instance @@ -385,7 +394,7 @@ class Market(): """Creates reverse dictionary""" rev = {} for item, value in orig.items(): - if not value in rev: + if value not in rev: rev[value] = set() rev[value].add(item) return rev @@ -796,7 +805,7 @@ class Market(): def cb(): try: callback(requests) - except Exception, e: + except Exception: pass eos.db.commit() @@ -819,7 +828,7 @@ class Market(): def clearPriceCache(self): self.priceCache.clear() - deleted_rows = eos.db.clearPrices() + eos.db.clearPrices() def getSystemWideEffects(self): """ @@ -862,7 +871,7 @@ class Market(): groupname = re.sub(garbage, "", groupname) groupname = re.sub(" {2,}", " ", groupname).strip() # Add stuff to dictionary - if not groupname in effects: + if groupname not in effects: effects[groupname] = set() effects[groupname].add((beacon, beaconname, shortname)) # Break loop on 1st result diff --git a/service/port.py b/service/port.py index d6645ed23..a15dd0d49 100644 --- a/service/port.py +++ b/service/port.py @@ -35,7 +35,7 @@ from service.fit import Fit import wx -from eos.types import State, Slot, Module, Cargo, Fit, Ship, Drone, Implant, Booster, Citadel +from eos.types import State, Slot, Module, Cargo, Ship, Drone, Implant, Booster, Citadel from service.crest import Crest from service.market import Market @@ -823,8 +823,8 @@ class Port(object): slot = module.slot if slot not in stuff: stuff[slot] = [] - curr = module.item.name if module.item else ( - "[Empty %s slot]" % Slot.getName(slot).capitalize() if slot is not None else "") + curr = module.item.name if module.item \ + else ("[Empty %s slot]" % Slot.getName(slot).capitalize() if slot is not None else "") if module.charge and sFit.serviceFittingOptions["exportCharges"]: curr += ", %s" % module.charge.name if module.state == State.OFFLINE: diff --git a/service/prefetch.py b/service/prefetch.py index 8d8348322..6e5b668c1 100644 --- a/service/prefetch.py +++ b/service/prefetch.py @@ -32,8 +32,10 @@ class PrefetchThread(threading.Thread): # We're a daemon thread, as such, interpreter might get shut down while we do stuff # Make sure we don't throw tracebacks to console try: - es_Character.setSkillList(db.getItemsByCategory("Skill", eager=( - "effects", "attributes", "attributes.info.icon", "attributes.info.unit", "icon"))) + es_Character.setSkillList(db.getItemsByCategory( + "Skill", + eager=("effects", "attributes", "attributes.info.icon", "attributes.info.unit", "icon") + )) except: pass diff --git a/service/pycrest/weak_ciphers.py b/service/pycrest/weak_ciphers.py index e3a82ca15..48da3c909 100644 --- a/service/pycrest/weak_ciphers.py +++ b/service/pycrest/weak_ciphers.py @@ -102,8 +102,7 @@ class WeakCiphersHTTPSConnection(urllib3.connection.VerifiedHTTPSConnection): # self.is_verified = (resolved_cert_reqs == ssl.CERT_REQUIRED or self.assert_fingerprint is not None) -class WeakCiphersHTTPSConnectionPool( - urllib3.connectionpool.HTTPSConnectionPool): +class WeakCiphersHTTPSConnectionPool(urllib3.connectionpool.HTTPSConnectionPool): ConnectionCls = WeakCiphersHTTPSConnection diff --git a/tox.ini b/tox.ini index 5eae895b9..ad49d6c5b 100644 --- a/tox.ini +++ b/tox.ini @@ -12,4 +12,4 @@ commands = py.test -vv --cov Pyfa tests/ [testenv:pep8] deps = flake8 -commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E501,E731 service gui eos utils config.py pyfa.py +commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E127,E501,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=130