Merge branch 'master' into ammo_graph
This commit is contained in:
@@ -85,7 +85,7 @@ pyfalog.debug('Importing gamedata DB scheme')
|
||||
from eos.db.gamedata import alphaClones, attribute, category, effect, group, item, marketGroup, metaData, metaGroup, queries, traits, unit, dynamicAttributes
|
||||
pyfalog.debug('Importing saveddata DB scheme')
|
||||
# noinspection PyPep8
|
||||
from eos.db.saveddata import booster, cargo, character, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, \
|
||||
from eos.db.saveddata import booster, cargo, character, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, \
|
||||
miscData, mutator, module, override, price, queries, skill, targetProfile, user
|
||||
|
||||
pyfalog.debug('Importing gamedata queries')
|
||||
|
||||
166
eos/db/migrations/upgrade35.py
Normal file
166
eos/db/migrations/upgrade35.py
Normal file
@@ -0,0 +1,166 @@
|
||||
"""
|
||||
Migration 35
|
||||
|
||||
- Remove builtin damage patterns and target profiles from the database
|
||||
"""
|
||||
|
||||
import sqlalchemy
|
||||
|
||||
|
||||
dmgPatterns = (
|
||||
'Uniform',
|
||||
'[Bombs]Concussion Bomb',
|
||||
'[Bombs]Electron Bomb',
|
||||
'[Bombs]Scorch Bomb',
|
||||
'[Bombs]Shrapnel Bomb',
|
||||
'[Exotic Plasma]Baryon',
|
||||
'[Exotic Plasma]Meson',
|
||||
'[Exotic Plasma]Tetryon',
|
||||
'[Exotic Plasma][T2] Mystic',
|
||||
'[Exotic Plasma][T2] Occult',
|
||||
'[Frequency Crystals]Gamma',
|
||||
'[Frequency Crystals]Infrared',
|
||||
'[Frequency Crystals]Microwave',
|
||||
'[Frequency Crystals]Multifrequency',
|
||||
'[Frequency Crystals]Radio',
|
||||
'[Frequency Crystals]Standard',
|
||||
'[Frequency Crystals]Ultraviolet',
|
||||
'[Frequency Crystals]Xray',
|
||||
'[Frequency Crystals][T2] Aurora',
|
||||
'[Frequency Crystals][T2] Conflagration',
|
||||
'[Frequency Crystals][T2] Gleam',
|
||||
'[Frequency Crystals][T2] Scorch',
|
||||
'[Generic]EM',
|
||||
'[Generic]Explosive',
|
||||
'[Generic]Kinetic',
|
||||
'[Generic]Thermal',
|
||||
'[Hybrid Charges]Antimatter',
|
||||
'[Hybrid Charges]Iridium',
|
||||
'[Hybrid Charges]Iron',
|
||||
'[Hybrid Charges]Lead',
|
||||
'[Hybrid Charges]Plutonium',
|
||||
'[Hybrid Charges]Thorium',
|
||||
'[Hybrid Charges]Tungsten',
|
||||
'[Hybrid Charges]Uranium',
|
||||
'[Hybrid Charges][T2] Javelin',
|
||||
'[Hybrid Charges][T2] Null',
|
||||
'[Hybrid Charges][T2] Spike',
|
||||
'[Hybrid Charges][T2] Void',
|
||||
'[Missiles]Inferno',
|
||||
'[Missiles]Mjolnir',
|
||||
'[Missiles]Nova',
|
||||
'[Missiles]Scourge',
|
||||
'[Missiles][Structure) Standup Missile',
|
||||
'[Missiles][Structure] Standup Missile',
|
||||
'[NPC][Asteroid] Angel Cartel',
|
||||
'[NPC][Asteroid] Blood Raiders',
|
||||
'[NPC][Asteroid] Guristas',
|
||||
'[NPC][Asteroid] Rogue Drone',
|
||||
'[NPC][Asteroid] Sanshas Nation',
|
||||
'[NPC][Asteroid] Serpentis',
|
||||
'[NPC][Burner] Ashimmu (Blood Raiders)',
|
||||
'[NPC][Burner] Cruor (Blood Raiders)',
|
||||
'[NPC][Burner] Daredevil (Serpentis)',
|
||||
'[NPC][Burner] Dramiel (Angel)',
|
||||
'[NPC][Burner] Enyo',
|
||||
'[NPC][Burner] Hawk',
|
||||
'[NPC][Burner] Jaguar',
|
||||
'[NPC][Burner] Sentinel',
|
||||
'[NPC][Burner] Succubus (Sanshas Nation)',
|
||||
'[NPC][Burner] Talos',
|
||||
'[NPC][Burner] Vengeance',
|
||||
'[NPC][Burner] Worm (Guristas)',
|
||||
'[NPC][Deadspace] Angel Cartel',
|
||||
'[NPC][Deadspace] Blood Raiders',
|
||||
'[NPC][Deadspace] Guristas',
|
||||
'[NPC][Deadspace] Rogue Drone',
|
||||
'[NPC][Deadspace] Sanshas Nation',
|
||||
'[NPC][Deadspace] Serpentis',
|
||||
'[NPC][Mission] Amarr Empire',
|
||||
'[NPC][Mission] CONCORD',
|
||||
'[NPC][Mission] Caldari State',
|
||||
'[NPC][Mission] Gallente Federation',
|
||||
'[NPC][Mission] Khanid',
|
||||
'[NPC][Mission] Minmatar Republic',
|
||||
'[NPC][Mission] Mordus Legion',
|
||||
'[NPC][Mission] Thukker',
|
||||
'[NPC][Other] Sansha Incursion',
|
||||
'[NPC][Other] Sleepers',
|
||||
'[Projectile Ammo]Carbonized Lead',
|
||||
'[Projectile Ammo]Depleted Uranium',
|
||||
'[Projectile Ammo]EMP',
|
||||
'[Projectile Ammo]Fusion',
|
||||
'[Projectile Ammo]Nuclear',
|
||||
'[Projectile Ammo]Phased Plasma',
|
||||
'[Projectile Ammo]Proton',
|
||||
'[Projectile Ammo]Titanium Sabot',
|
||||
'[Projectile Ammo][T2] Barrage',
|
||||
'[Projectile Ammo][T2] Hail',
|
||||
'[Projectile Ammo][T2] Quake',
|
||||
'[Projectile Ammo][T2] Tremor')
|
||||
|
||||
tgtProfiles = (
|
||||
'Uniform (25%)',
|
||||
'Uniform (50%)',
|
||||
'Uniform (75%)',
|
||||
'Uniform (90%)',
|
||||
'[NPC][Asteroid] Angel Cartel',
|
||||
'[NPC][Asteroid] Blood Raiders',
|
||||
'[NPC][Asteroid] Guristas',
|
||||
'[NPC][Asteroid] Rogue Drones',
|
||||
'[NPC][Asteroid] Sanshas Nation',
|
||||
'[NPC][Asteroid] Serpentis',
|
||||
'[NPC][Burner] Ashimmu (Blood Raiders)',
|
||||
'[NPC][Burner] Cruor (Blood Raiders)',
|
||||
'[NPC][Burner] Daredevil (Serpentis)',
|
||||
'[NPC][Burner] Dramiel (Angel)',
|
||||
'[NPC][Burner] Enyo',
|
||||
'[NPC][Burner] Hawk',
|
||||
'[NPC][Burner] Jaguar',
|
||||
'[NPC][Burner] Sentinel',
|
||||
'[NPC][Burner] Succubus (Sanshas Nation)',
|
||||
'[NPC][Burner] Talos',
|
||||
'[NPC][Burner] Vengeance',
|
||||
'[NPC][Burner] Worm (Guristas)',
|
||||
'[NPC][Deadspace] Angel Cartel',
|
||||
'[NPC][Deadspace] Blood Raiders',
|
||||
'[NPC][Deadspace] Guristas',
|
||||
'[NPC][Deadspace] Rogue Drones',
|
||||
'[NPC][Deadspace] Sanshas Nation',
|
||||
'[NPC][Deadspace] Serpentis',
|
||||
'[NPC][Mission] Amarr Empire',
|
||||
'[NPC][Mission] CONCORD',
|
||||
'[NPC][Mission] Caldari State',
|
||||
'[NPC][Mission] Gallente Federation',
|
||||
'[NPC][Mission] Khanid',
|
||||
'[NPC][Mission] Minmatar Republic',
|
||||
'[NPC][Mission] Mordus Legion',
|
||||
'[NPC][Other] Sansha Incursion',
|
||||
'[NPC][Other] Sleeper',
|
||||
'[T1 Resist]Armor',
|
||||
'[T1 Resist]Armor (+T2 DCU)',
|
||||
'[T1 Resist]Hull',
|
||||
'[T1 Resist]Hull (+T2 DCU)',
|
||||
'[T1 Resist]Shield',
|
||||
'[T1 Resist]Shield (+T2 DCU)',
|
||||
'[T2 Resist]Amarr (Armor)',
|
||||
'[T2 Resist]Amarr (Shield)',
|
||||
'[T2 Resist]Caldari (Armor)',
|
||||
'[T2 Resist]Caldari (Shield)',
|
||||
'[T2 Resist]Gallente (Armor)',
|
||||
'[T2 Resist]Gallente (Shield)',
|
||||
'[T2 Resist]Minmatar (Armor)',
|
||||
'[T2 Resist]Minmatar (Shield)')
|
||||
|
||||
|
||||
def upgrade(saveddata_engine):
|
||||
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name in ({});'.format(', '.join('\'{}\''.format(n) for n in dmgPatterns)))
|
||||
saveddata_engine.execute('DELETE FROM targetResists WHERE name in ({});'.format(', '.join('\'{}\''.format(n) for n in tgtProfiles)))
|
||||
try:
|
||||
saveddata_engine.execute("SELECT builtinDamagePatternID FROM fits LIMIT 1")
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN builtinDamagePatternID INT;")
|
||||
try:
|
||||
saveddata_engine.execute("SELECT builtinTargetResistsID FROM fits LIMIT 1")
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN builtinTargetResistsID INT;")
|
||||
@@ -13,6 +13,5 @@ __all__ = [
|
||||
"miscData",
|
||||
"targetProfile",
|
||||
"override",
|
||||
"implantSet",
|
||||
"loadDefaultDatabaseValues"
|
||||
"implantSet"
|
||||
]
|
||||
|
||||
@@ -24,16 +24,20 @@ import datetime
|
||||
from eos.db import saveddata_meta
|
||||
from eos.saveddata.damagePattern import DamagePattern
|
||||
|
||||
damagePatterns_table = Table("damagePatterns", saveddata_meta,
|
||||
Column("ID", Integer, primary_key=True),
|
||||
Column("name", String),
|
||||
Column("emAmount", Float),
|
||||
Column("thermalAmount", Float),
|
||||
Column("kineticAmount", Float),
|
||||
Column("explosiveAmount", Float),
|
||||
Column("ownerID", ForeignKey("users.ID"), nullable=True),
|
||||
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
|
||||
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
|
||||
)
|
||||
damagePatterns_table = Table(
|
||||
'damagePatterns',
|
||||
saveddata_meta,
|
||||
Column('ID', Integer, primary_key=True),
|
||||
Column('name', String),
|
||||
Column('emAmount', Float),
|
||||
Column('thermalAmount', Float),
|
||||
Column('kineticAmount', Float),
|
||||
Column('explosiveAmount', Float),
|
||||
Column('ownerID', ForeignKey('users.ID'), nullable=True),
|
||||
Column('created', DateTime, nullable=True, default=datetime.datetime.now),
|
||||
Column('modified', DateTime, nullable=True, onupdate=datetime.datetime.now))
|
||||
|
||||
mapper(DamagePattern, damagePatterns_table)
|
||||
mapper(
|
||||
DamagePattern,
|
||||
damagePatterns_table,
|
||||
properties={'rawName': damagePatterns_table.c.name})
|
||||
|
||||
@@ -53,8 +53,10 @@ fits_table = Table("fits", saveddata_meta,
|
||||
Column("timestamp", Integer, nullable=False),
|
||||
Column("characterID", ForeignKey("characters.ID"), nullable=True),
|
||||
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True),
|
||||
Column("builtinDamagePatternID", Integer, nullable=True),
|
||||
Column("booster", Boolean, nullable=False, index=True, default=0),
|
||||
Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True),
|
||||
Column("builtinTargetResistsID", Integer, nullable=True),
|
||||
Column("modeID", Integer, nullable=True),
|
||||
Column("implantLocation", Integer, nullable=False),
|
||||
Column("notes", String, nullable=True),
|
||||
@@ -233,8 +235,10 @@ mapper(es_Fit, fits_table,
|
||||
"_Fit__character": relation(
|
||||
Character,
|
||||
backref="fits"),
|
||||
"_Fit__damagePattern": relation(DamagePattern),
|
||||
"_Fit__targetProfile": relation(TargetProfile),
|
||||
"_Fit__userDamagePattern": relation(DamagePattern),
|
||||
"_Fit__builtinDamagePatternID": fits_table.c.builtinDamagePatternID,
|
||||
"_Fit__userTargetProfile": relation(TargetProfile),
|
||||
"_Fit__builtinTargetProfileID": fits_table.c.builtinTargetResistsID,
|
||||
"projectedOnto": projectedFitSourceRel,
|
||||
"victimOf": relationship(
|
||||
ProjectedFit,
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
# ===============================================================================
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
# ===============================================================================
|
||||
|
||||
|
||||
import eos.db
|
||||
from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
|
||||
from eos.saveddata.targetProfile import TargetProfile as es_TargetProfile
|
||||
|
||||
|
||||
class ImportError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class DefaultDatabaseValues:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
instance = None
|
||||
|
||||
@classmethod
|
||||
def importDamageProfileDefaults(cls):
|
||||
damageProfileList = [["Uniform", 25, 25, 25, 25],
|
||||
["[Generic]EM", 1, 0, 0, 0],
|
||||
["[Generic]Thermal", 0, 1, 0, 0],
|
||||
["[Generic]Kinetic", 0, 0, 1, 0],
|
||||
["[Generic]Explosive", 0, 0, 0, 1],
|
||||
["[NPC][Asteroid] Blood Raiders", 5067, 4214, 0, 0],
|
||||
["[Bombs]Electron Bomb", 6400, 0, 0, 0],
|
||||
["[Bombs]Scorch Bomb", 0, 6400, 0, 0],
|
||||
["[Bombs]Concussion Bomb", 0, 0, 6400, 0],
|
||||
["[Bombs]Shrapnel Bomb", 0, 0, 0, 6400],
|
||||
["[Frequency Crystals][T2] Conflagration", 7.7, 7.7, 0, 0],
|
||||
["[Frequency Crystals][T2] Scorch", 9, 2, 0, 0],
|
||||
["[Frequency Crystals][T2] Gleam", 7, 7, 0, 0],
|
||||
["[Frequency Crystals][T2] Aurora", 5, 3, 0, 0],
|
||||
["[Frequency Crystals]Multifrequency", 7, 5, 0, 0],
|
||||
["[Frequency Crystals]Gamma", 7, 4, 0, 0],
|
||||
["[Frequency Crystals]Xray", 6, 4, 0, 0],
|
||||
["[Frequency Crystals]Ultraviolet", 6, 3, 0, 0],
|
||||
["[Frequency Crystals]Standard", 5, 3, 0, 0],
|
||||
["[Frequency Crystals]Infrared", 5, 2, 0, 0],
|
||||
["[Frequency Crystals]Microwave", 4, 2, 0, 0],
|
||||
["[Frequency Crystals]Radio", 5, 0, 0, 0],
|
||||
["[Hybrid Charges][T2] Void", 0, 7.7, 7.7, 0],
|
||||
["[Hybrid Charges][T2] Null", 0, 6, 5, 0],
|
||||
["[Hybrid Charges][T2] Javelin", 0, 8, 6, 0],
|
||||
["[Hybrid Charges][T2] Spike", 0, 4, 4, 0],
|
||||
["[Hybrid Charges]Antimatter", 0, 5, 7, 0],
|
||||
["[Hybrid Charges]Plutonium", 0, 5, 6, 0],
|
||||
["[Hybrid Charges]Uranium", 0, 4, 6, 0],
|
||||
["[Hybrid Charges]Thorium", 0, 4, 5, 0],
|
||||
["[Hybrid Charges]Lead", 0, 3, 5, 0],
|
||||
["[Hybrid Charges]Iridium", 0, 3, 4, 0],
|
||||
["[Hybrid Charges]Tungsten", 0, 2, 4, 0],
|
||||
["[Hybrid Charges]Iron", 0, 2, 3, 0],
|
||||
["[Missiles]Mjolnir", 1, 0, 0, 0],
|
||||
["[Missiles]Inferno", 0, 1, 0, 0],
|
||||
["[Missiles]Scourge", 0, 0, 1, 0],
|
||||
["[Missiles]Nova", 0, 0, 0, 1],
|
||||
["[Missiles][Structure] Standup Missile", 1, 1, 1, 1],
|
||||
["[Projectile Ammo][T2] Hail", 0, 0, 3.3, 12.1],
|
||||
["[Projectile Ammo][T2] Barrage", 0, 0, 5, 6],
|
||||
["[Projectile Ammo][T2] Quake", 0, 0, 5, 9],
|
||||
["[Projectile Ammo][T2] Tremor", 0, 0, 3, 5],
|
||||
["[Projectile Ammo]EMP", 9, 0, 1, 2],
|
||||
["[Projectile Ammo]Phased Plasma", 0, 10, 2, 0],
|
||||
["[Projectile Ammo]Fusion", 0, 0, 2, 10],
|
||||
["[Projectile Ammo]Depleted Uranium", 0, 3, 2, 3],
|
||||
["[Projectile Ammo]Titanium Sabot", 0, 0, 6, 2],
|
||||
["[Projectile Ammo]Proton", 3, 0, 2, 0],
|
||||
["[Projectile Ammo]Carbonized Lead", 0, 0, 4, 1],
|
||||
["[Projectile Ammo]Nuclear", 0, 0, 1, 4],
|
||||
# Different sizes of plasma do different damage, the values here are
|
||||
# average of proportions across sizes
|
||||
["[Exotic Plasma][T2] Occult", 0, 55863, 0, 44137],
|
||||
["[Exotic Plasma][T2] Mystic", 0, 66319, 0, 33681],
|
||||
["[Exotic Plasma]Tetryon", 0, 69208, 0, 30792],
|
||||
["[Exotic Plasma]Baryon", 0, 59737, 0, 40263],
|
||||
["[Exotic Plasma]Meson", 0, 60519, 0, 39481],
|
||||
["[NPC][Burner] Cruor (Blood Raiders)", 90, 90, 0, 0],
|
||||
["[NPC][Burner] Dramiel (Angel)", 55, 0, 20, 96],
|
||||
["[NPC][Burner] Daredevil (Serpentis)", 0, 110, 154, 0],
|
||||
["[NPC][Burner] Succubus (Sanshas Nation)", 135, 30, 0, 0],
|
||||
["[NPC][Burner] Worm (Guristas)", 0, 0, 228, 0],
|
||||
["[NPC][Burner] Enyo", 0, 147, 147, 0],
|
||||
["[NPC][Burner] Hawk", 0, 0, 247, 0],
|
||||
["[NPC][Burner] Jaguar", 36, 0, 50, 182],
|
||||
["[NPC][Burner] Vengeance", 232, 0, 0, 0],
|
||||
["[NPC][Burner] Ashimmu (Blood Raiders)", 260, 100, 0, 0],
|
||||
["[NPC][Burner] Talos", 0, 413, 413, 0],
|
||||
["[NPC][Burner] Sentinel", 0, 75, 0, 90],
|
||||
["[NPC][Asteroid] Angel Cartel", 1838, 562, 2215, 3838],
|
||||
["[NPC][Deadspace] Angel Cartel", 369, 533, 1395, 3302],
|
||||
["[NPC][Deadspace] Blood Raiders", 6040, 5052, 10, 15],
|
||||
["[NPC][Asteroid] Guristas", 0, 1828, 7413, 0],
|
||||
["[NPC][Deadspace] Guristas", 0, 1531, 9680, 0],
|
||||
["[NPC][Asteroid] Rogue Drone", 394, 666, 1090, 1687],
|
||||
["[NPC][Deadspace] Rogue Drone", 276, 1071, 1069, 871],
|
||||
["[NPC][Asteroid] Sanshas Nation", 5586, 4112, 0, 0],
|
||||
["[NPC][Deadspace] Sanshas Nation", 3009, 2237, 0, 0],
|
||||
["[NPC][Asteroid] Serpentis", 0, 5373, 4813, 0],
|
||||
["[NPC][Deadspace] Serpentis", 0, 3110, 1929, 0],
|
||||
["[NPC][Mission] Amarr Empire", 4464, 3546, 97, 0],
|
||||
["[NPC][Mission] Caldari State", 0, 2139, 4867, 0],
|
||||
["[NPC][Mission] CONCORD", 336, 134, 212, 412],
|
||||
["[NPC][Mission] Gallente Federation", 9, 3712, 2758, 0],
|
||||
["[NPC][Mission] Khanid", 612, 483, 43, 6],
|
||||
["[NPC][Mission] Minmatar Republic", 1024, 388, 1655, 4285],
|
||||
["[NPC][Mission] Mordus Legion", 25, 262, 625, 0],
|
||||
["[NPC][Mission] Thukker", 0, 52, 10, 79],
|
||||
["[NPC][Other] Sleepers", 1472, 1472, 1384, 1384],
|
||||
["[NPC][Other] Sansha Incursion", 1682, 1347, 3678, 3678]]
|
||||
|
||||
for damageProfileRow in damageProfileList:
|
||||
name, em, therm, kin, exp = damageProfileRow
|
||||
damageProfile = eos.db.getDamagePattern(name)
|
||||
if damageProfile is None:
|
||||
damageProfile = es_DamagePattern(em, therm, kin, exp)
|
||||
damageProfile.name = name
|
||||
eos.db.add(damageProfile)
|
||||
else:
|
||||
damageProfile.emAmount = em
|
||||
damageProfile.thermalAmount = therm
|
||||
damageProfile.kineticAmount = kin
|
||||
damageProfile.explosiveAmount = exp
|
||||
eos.db.commit()
|
||||
|
||||
@classmethod
|
||||
def importTargetProfileDefaults(cls):
|
||||
targetProfileList = [["Uniform (25%)", 0.25, 0.25, 0.25, 0.25],
|
||||
["Uniform (50%)", 0.50, 0.50, 0.50, 0.50],
|
||||
["Uniform (75%)", 0.75, 0.75, 0.75, 0.75],
|
||||
["Uniform (90%)", 0.90, 0.90, 0.90, 0.90],
|
||||
["[T1 Resist]Shield", 0.0, 0.20, 0.40, 0.50],
|
||||
["[T1 Resist]Armor", 0.50, 0.45, 0.25, 0.10],
|
||||
["[T1 Resist]Hull", 0.33, 0.33, 0.33, 0.33],
|
||||
["[T1 Resist]Shield (+T2 DCU)", 0.125, 0.30, 0.475, 0.562],
|
||||
["[T1 Resist]Armor (+T2 DCU)", 0.575, 0.532, 0.363, 0.235],
|
||||
["[T1 Resist]Hull (+T2 DCU)", 0.598, 0.598, 0.598, 0.598],
|
||||
["[T2 Resist]Amarr (Shield)", 0.0, 0.20, 0.70, 0.875],
|
||||
["[T2 Resist]Amarr (Armor)", 0.50, 0.35, 0.625, 0.80],
|
||||
["[T2 Resist]Caldari (Shield)", 0.20, 0.84, 0.76, 0.60],
|
||||
["[T2 Resist]Caldari (Armor)", 0.50, 0.8625, 0.625, 0.10],
|
||||
["[T2 Resist]Gallente (Shield)", 0.0, 0.60, 0.85, 0.50],
|
||||
["[T2 Resist]Gallente (Armor)", 0.50, 0.675, 0.8375, 0.10],
|
||||
["[T2 Resist]Minmatar (Shield)", 0.75, 0.60, 0.40, 0.50],
|
||||
["[T2 Resist]Minmatar (Armor)", 0.90, 0.675, 0.25, 0.10],
|
||||
["[NPC][Asteroid] Angel Cartel", 0.54, 0.42, 0.37, 0.32],
|
||||
["[NPC][Asteroid] Blood Raiders", 0.34, 0.39, 0.45, 0.52],
|
||||
["[NPC][Asteroid] Guristas", 0.55, 0.35, 0.3, 0.48],
|
||||
["[NPC][Asteroid] Rogue Drones", 0.35, 0.38, 0.44, 0.49],
|
||||
["[NPC][Asteroid] Sanshas Nation", 0.35, 0.4, 0.47, 0.53],
|
||||
["[NPC][Asteroid] Serpentis", 0.49, 0.38, 0.29, 0.51],
|
||||
["[NPC][Deadspace] Angel Cartel", 0.59, 0.48, 0.4, 0.32],
|
||||
["[NPC][Deadspace] Blood Raiders", 0.31, 0.39, 0.47, 0.56],
|
||||
["[NPC][Deadspace] Guristas", 0.57, 0.39, 0.31, 0.5],
|
||||
["[NPC][Deadspace] Rogue Drones", 0.42, 0.42, 0.47, 0.49],
|
||||
["[NPC][Deadspace] Sanshas Nation", 0.31, 0.39, 0.47, 0.56],
|
||||
["[NPC][Deadspace] Serpentis", 0.49, 0.38, 0.29, 0.56],
|
||||
["[NPC][Mission] Amarr Empire", 0.34, 0.38, 0.42, 0.46],
|
||||
["[NPC][Mission] Caldari State", 0.51, 0.38, 0.3, 0.51],
|
||||
["[NPC][Mission] CONCORD", 0.47, 0.46, 0.47, 0.47],
|
||||
["[NPC][Mission] Gallente Federation", 0.51, 0.38, 0.31, 0.52],
|
||||
["[NPC][Mission] Khanid", 0.51, 0.42, 0.36, 0.4],
|
||||
["[NPC][Mission] Minmatar Republic", 0.51, 0.46, 0.41, 0.35],
|
||||
["[NPC][Mission] Mordus Legion", 0.32, 0.48, 0.4, 0.62],
|
||||
["[NPC][Other] Sleeper", 0.61, 0.61, 0.61, 0.61],
|
||||
["[NPC][Other] Sansha Incursion", 0.65, 0.63, 0.64, 0.65],
|
||||
["[NPC][Burner] Cruor (Blood Raiders)", 0.8, 0.73, 0.69, 0.67],
|
||||
["[NPC][Burner] Dramiel (Angel)", 0.35, 0.48, 0.61, 0.68],
|
||||
["[NPC][Burner] Daredevil (Serpentis)", 0.69, 0.59, 0.59, 0.43],
|
||||
["[NPC][Burner] Succubus (Sanshas Nation)", 0.35, 0.48, 0.61, 0.68],
|
||||
["[NPC][Burner] Worm (Guristas)", 0.48, 0.58, 0.69, 0.74],
|
||||
["[NPC][Burner] Enyo", 0.58, 0.72, 0.86, 0.24],
|
||||
["[NPC][Burner] Hawk", 0.3, 0.86, 0.79, 0.65],
|
||||
["[NPC][Burner] Jaguar", 0.78, 0.65, 0.48, 0.56],
|
||||
["[NPC][Burner] Vengeance", 0.66, 0.56, 0.75, 0.86],
|
||||
["[NPC][Burner] Ashimmu (Blood Raiders)", 0.8, 0.76, 0.68, 0.7],
|
||||
["[NPC][Burner] Talos", 0.68, 0.59, 0.59, 0.43],
|
||||
["[NPC][Burner] Sentinel", 0.58, 0.45, 0.52, 0.66]]
|
||||
|
||||
for targetProfileRow in targetProfileList:
|
||||
name = targetProfileRow[0]
|
||||
em = targetProfileRow[1]
|
||||
therm = targetProfileRow[2]
|
||||
kin = targetProfileRow[3]
|
||||
exp = targetProfileRow[4]
|
||||
try:
|
||||
maxVel = targetProfileRow[5]
|
||||
except IndexError:
|
||||
maxVel = None
|
||||
try:
|
||||
sigRad = targetProfileRow[6]
|
||||
except IndexError:
|
||||
sigRad = None
|
||||
try:
|
||||
radius = targetProfileRow[7]
|
||||
except:
|
||||
radius = None
|
||||
targetProfile = eos.db.getTargetProfile(name)
|
||||
if targetProfile is None:
|
||||
targetProfile = es_TargetProfile(em, therm, kin, exp, maxVel, sigRad, radius)
|
||||
targetProfile.name = name
|
||||
eos.db.add(targetProfile)
|
||||
else:
|
||||
targetProfile.emAmount = em
|
||||
targetProfile.thermalAmount = therm
|
||||
targetProfile.kineticAmount = kin
|
||||
targetProfile.explosiveAmount = exp
|
||||
targetProfile.maxVelocity = maxVel
|
||||
targetProfile.signatureRadius = sigRad
|
||||
targetProfile.radius = radius
|
||||
eos.db.commit()
|
||||
|
||||
|
||||
@classmethod
|
||||
def importRequiredDefaults(cls):
|
||||
damageProfileList = [["Uniform", 25, 25, 25, 25]]
|
||||
|
||||
for damageProfileRow in damageProfileList:
|
||||
name, em, therm, kin, exp = damageProfileRow
|
||||
damageProfile = eos.db.getDamagePattern(name)
|
||||
if damageProfile is None:
|
||||
damageProfile = es_DamagePattern(em, therm, kin, exp)
|
||||
damageProfile.name = name
|
||||
eos.db.add(damageProfile)
|
||||
else:
|
||||
damageProfile.emAmount = em
|
||||
damageProfile.thermalAmount = therm
|
||||
damageProfile.kineticAmount = kin
|
||||
damageProfile.explosiveAmount = exp
|
||||
eos.db.commit()
|
||||
@@ -413,7 +413,7 @@ def getDamagePattern(lookfor, eager=None):
|
||||
eager = processEager(eager)
|
||||
with sd_lock:
|
||||
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
|
||||
DamagePattern.name == lookfor).first()
|
||||
DamagePattern.rawName == lookfor).first()
|
||||
else:
|
||||
raise TypeError("Need integer or string as argument")
|
||||
return pattern
|
||||
@@ -434,7 +434,7 @@ def getTargetProfile(lookfor, eager=None):
|
||||
eager = processEager(eager)
|
||||
with sd_lock:
|
||||
pattern = saveddata_session.query(TargetProfile).options(*eager).filter(
|
||||
TargetProfile.name == lookfor).first()
|
||||
TargetProfile.rawName == lookfor).first()
|
||||
else:
|
||||
raise TypeError("Need integer or string as argument")
|
||||
return pattern
|
||||
|
||||
@@ -24,23 +24,28 @@ import datetime
|
||||
from eos.db import saveddata_meta
|
||||
from eos.saveddata.targetProfile import TargetProfile
|
||||
|
||||
targetProfiles_table = Table("targetResists", saveddata_meta,
|
||||
Column("ID", Integer, primary_key=True),
|
||||
Column("name", String),
|
||||
Column("emAmount", Float),
|
||||
Column("thermalAmount", Float),
|
||||
Column("kineticAmount", Float),
|
||||
Column("explosiveAmount", Float),
|
||||
Column("maxVelocity", Float, nullable=True),
|
||||
Column("signatureRadius", Float, nullable=True),
|
||||
Column("radius", Float, nullable=True),
|
||||
Column("ownerID", ForeignKey("users.ID"), nullable=True),
|
||||
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
|
||||
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
|
||||
)
|
||||
|
||||
mapper(TargetProfile, targetProfiles_table,
|
||||
properties={
|
||||
"_maxVelocity": targetProfiles_table.c.maxVelocity,
|
||||
"_signatureRadius": targetProfiles_table.c.signatureRadius,
|
||||
"_radius": targetProfiles_table.c.radius})
|
||||
targetProfiles_table = Table(
|
||||
'targetResists',
|
||||
saveddata_meta,
|
||||
Column('ID', Integer, primary_key=True),
|
||||
Column('name', String),
|
||||
Column('emAmount', Float),
|
||||
Column('thermalAmount', Float),
|
||||
Column('kineticAmount', Float),
|
||||
Column('explosiveAmount', Float),
|
||||
Column('maxVelocity', Float, nullable=True),
|
||||
Column('signatureRadius', Float, nullable=True),
|
||||
Column('radius', Float, nullable=True),
|
||||
Column('ownerID', ForeignKey('users.ID'), nullable=True),
|
||||
Column('created', DateTime, nullable=True, default=datetime.datetime.now),
|
||||
Column('modified', DateTime, nullable=True, onupdate=datetime.datetime.now))
|
||||
|
||||
mapper(
|
||||
TargetProfile,
|
||||
targetProfiles_table,
|
||||
properties={
|
||||
'rawName': targetProfiles_table.c.name,
|
||||
'_maxVelocity': targetProfiles_table.c.maxVelocity,
|
||||
'_signatureRadius': targetProfiles_table.c.signatureRadius,
|
||||
'_radius': targetProfiles_table.c.radius})
|
||||
|
||||
138
eos/effects.py
138
eos/effects.py
@@ -1350,7 +1350,6 @@ class Effect508(BaseEffect):
|
||||
Ship: Cheetah
|
||||
Ship: Freki
|
||||
Ship: Republic Fleet Firetail
|
||||
Ship: Rifter
|
||||
Ship: Slasher
|
||||
Ship: Stiletto
|
||||
Ship: Wolf
|
||||
@@ -1737,7 +1736,7 @@ class Effect596(BaseEffect):
|
||||
ammoInfluenceRange
|
||||
|
||||
Used by:
|
||||
Items from category: Charge (587 of 951)
|
||||
Items from category: Charge (590 of 954)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -1789,7 +1788,13 @@ class Effect600(BaseEffect):
|
||||
ammoTrackingMultiplier
|
||||
|
||||
Used by:
|
||||
Items from category: Charge (182 of 951)
|
||||
Charges from group: Advanced Artillery Ammo (8 of 8)
|
||||
Charges from group: Advanced Autocannon Ammo (8 of 8)
|
||||
Charges from group: Advanced Beam Laser Crystal (8 of 8)
|
||||
Charges from group: Advanced Blaster Charge (8 of 8)
|
||||
Charges from group: Advanced Exotic Plasma Charge (6 of 6)
|
||||
Charges from group: Advanced Pulse Laser Crystal (8 of 8)
|
||||
Charges from group: Advanced Railgun Charge (8 of 8)
|
||||
Charges from group: Projectile Ammo (128 of 128)
|
||||
"""
|
||||
|
||||
@@ -2316,7 +2321,7 @@ class Effect804(BaseEffect):
|
||||
ammoInfluenceCapNeed
|
||||
|
||||
Used by:
|
||||
Items from category: Charge (493 of 951)
|
||||
Items from category: Charge (496 of 954)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -4793,7 +4798,7 @@ class Effect1615(BaseEffect):
|
||||
shipAdvancedSpaceshipCommandAgilityBonus
|
||||
|
||||
Used by:
|
||||
Items from market group: Ships > Capital Ships (40 of 40)
|
||||
Items from market group: Ships > Capital Ships (40 of 41)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -4826,7 +4831,7 @@ class Effect1617(BaseEffect):
|
||||
shipCapitalAgilityBonus
|
||||
|
||||
Used by:
|
||||
Items from market group: Ships > Capital Ships (31 of 40)
|
||||
Items from market group: Ships > Capital Ships (31 of 41)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -9158,7 +9163,7 @@ class Effect3001(BaseEffect):
|
||||
|
||||
Used by:
|
||||
Modules from group: Missile Launcher Torpedo (22 of 22)
|
||||
Items from market group: Ship Equipment > Turrets & Bays (429 of 888)
|
||||
Items from market group: Ship Equipment > Turrets & Bays (429 of 889)
|
||||
Module: Interdiction Sphere Launcher I
|
||||
"""
|
||||
|
||||
@@ -9221,7 +9226,7 @@ class Effect3025(BaseEffect):
|
||||
Used by:
|
||||
Modules from group: Energy Weapon (101 of 214)
|
||||
Modules from group: Hybrid Weapon (105 of 221)
|
||||
Modules from group: Precursor Weapon (18 of 18)
|
||||
Modules from group: Precursor Weapon (19 of 19)
|
||||
Modules from group: Projectile Weapon (99 of 165)
|
||||
"""
|
||||
|
||||
@@ -24474,7 +24479,7 @@ class Effect6104(BaseEffect):
|
||||
entosisDurationMultiply
|
||||
|
||||
Used by:
|
||||
Items from market group: Ships > Capital Ships (31 of 40)
|
||||
Items from market group: Ships > Capital Ships (31 of 41)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -29051,7 +29056,8 @@ class Effect6582(BaseEffect):
|
||||
# Turrets
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Energy Turret') or
|
||||
mod.item.requiresSkill('Capital Hybrid Turret') or
|
||||
mod.item.requiresSkill('Capital Projectile Turret'),
|
||||
mod.item.requiresSkill('Capital Projectile Turret') or
|
||||
mod.item.requiresSkill('Capital Precursor Weapon'),
|
||||
'damageMultiplier', src.getModifiedItemAttr('siegeTurretDamageBonus'), **kwargs)
|
||||
|
||||
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill('Motion Prediction'),
|
||||
@@ -33938,7 +33944,7 @@ class Effect6995(BaseEffect):
|
||||
targetDisintegratorAttack
|
||||
|
||||
Used by:
|
||||
Modules from group: Precursor Weapon (18 of 18)
|
||||
Modules from group: Precursor Weapon (19 of 19)
|
||||
"""
|
||||
|
||||
dealsDamage = True
|
||||
@@ -35137,6 +35143,7 @@ class Effect7092(BaseEffect):
|
||||
Ship: Hydra
|
||||
Ship: Leshak
|
||||
Ship: Tiamat
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -35160,6 +35167,7 @@ class Effect7093(BaseEffect):
|
||||
Ship: Hydra
|
||||
Ship: Leshak
|
||||
Ship: Tiamat
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -35182,6 +35190,7 @@ class Effect7094(BaseEffect):
|
||||
Ship: Hydra
|
||||
Ship: Leshak
|
||||
Ship: Tiamat
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -35238,6 +35247,7 @@ class Effect7112(BaseEffect):
|
||||
Ship: Hydra
|
||||
Ship: Leshak
|
||||
Ship: Tiamat
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -36027,7 +36037,7 @@ class Effect7232(BaseEffect):
|
||||
modifyDamageMultiplierBonusMax
|
||||
|
||||
Used by:
|
||||
Implants named like: Grade Mimesis (10 of 12)
|
||||
Implants named like: Grade Mimesis (15 of 18)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -36044,7 +36054,7 @@ class Effect7233(BaseEffect):
|
||||
modifyDamageMultiplierBonusPerCycle
|
||||
|
||||
Used by:
|
||||
Implants named like: Grade Mimesis (10 of 12)
|
||||
Implants named like: Grade Mimesis (15 of 18)
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
@@ -36061,7 +36071,7 @@ class Effect7234(BaseEffect):
|
||||
implantSetMimesis
|
||||
|
||||
Used by:
|
||||
Implants named like: Grade Mimesis (12 of 12)
|
||||
Implants named like: Grade Mimesis (18 of 18)
|
||||
"""
|
||||
|
||||
runTime = 'early'
|
||||
@@ -36075,3 +36085,103 @@ class Effect7234(BaseEffect):
|
||||
fit.appliedImplants.filteredItemMultiply(
|
||||
lambda imp: imp.item.group.name == 'Cyberimplant', 'damageMultiplierBonusPerCycleModifier',
|
||||
implant.getModifiedItemAttr('setBonusMimesis'), **kwargs)
|
||||
|
||||
|
||||
class Effect7238(BaseEffect):
|
||||
"""
|
||||
shipBonusDreadnoughtPC1DamageMultMax
|
||||
|
||||
Used by:
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, src, context, projectionRange, **kwargs):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Precursor Weapon'), 'damageMultiplier',
|
||||
src.getModifiedItemAttr('shipBonusDreadnoughtPC1'), skill='Precursor Dreadnought', **kwargs)
|
||||
|
||||
|
||||
class Effect7239(BaseEffect):
|
||||
"""
|
||||
shipBonusDreadnoughtPC2ArmorResists
|
||||
|
||||
Used by:
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, src, context, projectionRange, **kwargs):
|
||||
for type in ('Em', 'Explosive', 'Kinetic', 'Thermal'):
|
||||
fit.ship.boostItemAttr('armor{0}DamageResonance'.format(type), src.getModifiedItemAttr('shipBonusDreadnoughtPC2'),
|
||||
skill='Precursor Dreadnought', **kwargs)
|
||||
|
||||
|
||||
class Effect7240(BaseEffect):
|
||||
"""
|
||||
shipBonusDreadnoughtPC3WeaponSpeed
|
||||
|
||||
Used by:
|
||||
Ship: Zirnitra
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, src, context, projectionRange, **kwargs):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Precursor Weapon'), 'speed',
|
||||
src.getModifiedItemAttr('shipBonusDreadnoughtPC3'), skill='Precursor Dreadnought', **kwargs)
|
||||
|
||||
|
||||
class Effect7242(BaseEffect):
|
||||
"""
|
||||
capitalPrecursorTurretDmgBonusRequiredSkill
|
||||
|
||||
Used by:
|
||||
Skill: Capital Precursor Weapon
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, container, context, projectionRange, **kwargs):
|
||||
level = container.level if 'skill' in context else 1
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Precursor Weapon'),
|
||||
'damageMultiplier', container.getModifiedItemAttr('damageMultiplierBonus') * level, **kwargs)
|
||||
|
||||
|
||||
class Effect7247(BaseEffect):
|
||||
"""
|
||||
shipBonusHAMHMLAoeVelocityMC
|
||||
|
||||
Used by:
|
||||
Ship: Bellicose
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, ship, context, projectionRange, **kwargs):
|
||||
fit.modules.filteredChargeBoost(lambda mod: (mod.charge.requiresSkill('Heavy Missiles') or
|
||||
mod.charge.requiresSkill('Heavy Assault Missiles')),
|
||||
'aoeVelocity', ship.getModifiedItemAttr('shipBonusMC'),
|
||||
skill='Minmatar Cruiser', **kwargs)
|
||||
|
||||
|
||||
class Effect7248(BaseEffect):
|
||||
"""
|
||||
shipPBonusROFMF
|
||||
|
||||
Used by:
|
||||
Ship: Rifter
|
||||
"""
|
||||
|
||||
type = 'passive'
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, ship, context, projectionRange, **kwargs):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Small Projectile Turret'),
|
||||
'speed', ship.getModifiedItemAttr('shipBonusMF'), skill='Minmatar Frigate', **kwargs)
|
||||
|
||||
@@ -383,7 +383,8 @@ class Item(EqBase):
|
||||
500016: "sisters",
|
||||
500018: "mordu",
|
||||
500019: "sansha",
|
||||
500020: "serpentis"
|
||||
500020: "serpentis",
|
||||
500026: "triglavian"
|
||||
}
|
||||
|
||||
@property
|
||||
|
||||
@@ -18,21 +18,162 @@
|
||||
# ===============================================================================
|
||||
|
||||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
from sqlalchemy.orm import reconstructor
|
||||
|
||||
import eos.db
|
||||
|
||||
|
||||
BUILTINS = OrderedDict([
|
||||
(-1, ('Uniform', 25, 25, 25, 25)),
|
||||
(-2, ('[Generic]EM', 1, 0, 0, 0)),
|
||||
(-3, ('[Generic]Thermal', 0, 1, 0, 0)),
|
||||
(-4, ('[Generic]Kinetic', 0, 0, 1, 0)),
|
||||
(-5, ('[Generic]Explosive', 0, 0, 0, 1)),
|
||||
(-6, ('[Bombs]Electron Bomb', 6400, 0, 0, 0)),
|
||||
(-7, ('[Bombs]Scorch Bomb', 0, 6400, 0, 0)),
|
||||
(-8, ('[Bombs]Concussion Bomb', 0, 0, 6400, 0)),
|
||||
(-9, ('[Bombs]Shrapnel Bomb', 0, 0, 0, 6400)),
|
||||
(-10, ('[Frequency Crystals]|[T2] Conflagration', 7.7, 7.7, 0, 0)),
|
||||
(-11, ('[Frequency Crystals]|[T2] Scorch', 9, 2, 0, 0)),
|
||||
(-12, ('[Frequency Crystals]|[T2] Gleam', 7, 7, 0, 0)),
|
||||
(-13, ('[Frequency Crystals]|[T2] Aurora', 5, 3, 0, 0)),
|
||||
(-14, ('[Frequency Crystals]Multifrequency', 7, 5, 0, 0)),
|
||||
(-15, ('[Frequency Crystals]Gamma', 7, 4, 0, 0)),
|
||||
(-16, ('[Frequency Crystals]Xray', 6, 4, 0, 0)),
|
||||
(-17, ('[Frequency Crystals]Ultraviolet', 6, 3, 0, 0)),
|
||||
(-18, ('[Frequency Crystals]Standard', 5, 3, 0, 0)),
|
||||
(-19, ('[Frequency Crystals]Infrared', 5, 2, 0, 0)),
|
||||
(-20, ('[Frequency Crystals]Microwave', 4, 2, 0, 0)),
|
||||
(-21, ('[Frequency Crystals]Radio', 5, 0, 0, 0)),
|
||||
(-22, ('[Hybrid Charges]|[T2] Void', 0, 7.7, 7.7, 0)),
|
||||
(-23, ('[Hybrid Charges]|[T2] Null', 0, 6, 5, 0)),
|
||||
(-24, ('[Hybrid Charges]|[T2] Javelin', 0, 8, 6, 0)),
|
||||
(-25, ('[Hybrid Charges]|[T2] Spike', 0, 4, 4, 0)),
|
||||
(-26, ('[Hybrid Charges]Antimatter', 0, 5, 7, 0)),
|
||||
(-27, ('[Hybrid Charges]Plutonium', 0, 5, 6, 0)),
|
||||
(-28, ('[Hybrid Charges]Uranium', 0, 4, 6, 0)),
|
||||
(-29, ('[Hybrid Charges]Thorium', 0, 4, 5, 0)),
|
||||
(-30, ('[Hybrid Charges]Lead', 0, 3, 5, 0)),
|
||||
(-31, ('[Hybrid Charges]Iridium', 0, 3, 4, 0)),
|
||||
(-32, ('[Hybrid Charges]Tungsten', 0, 2, 4, 0)),
|
||||
(-33, ('[Hybrid Charges]Iron', 0, 2, 3, 0)),
|
||||
(-34, ('[Missiles]Mjolnir', 1, 0, 0, 0)),
|
||||
(-35, ('[Missiles]Inferno', 0, 1, 0, 0)),
|
||||
(-36, ('[Missiles]Scourge', 0, 0, 1, 0)),
|
||||
(-37, ('[Missiles]Nova', 0, 0, 0, 1)),
|
||||
(-38, ('[Missiles]|[Structure] Standup Missile', 1, 1, 1, 1)),
|
||||
(-39, ('[Projectile Ammo]|[T2] Hail', 0, 0, 3.3, 12.1)),
|
||||
(-40, ('[Projectile Ammo]|[T2] Barrage', 0, 0, 5, 6)),
|
||||
(-41, ('[Projectile Ammo]|[T2] Quake', 0, 0, 5, 9)),
|
||||
(-42, ('[Projectile Ammo]|[T2] Tremor', 0, 0, 3, 5)),
|
||||
(-43, ('[Projectile Ammo]EMP', 9, 0, 1, 2)),
|
||||
(-44, ('[Projectile Ammo]Phased Plasma', 0, 10, 2, 0)),
|
||||
(-45, ('[Projectile Ammo]Fusion', 0, 0, 2, 10)),
|
||||
(-46, ('[Projectile Ammo]Depleted Uranium', 0, 3, 2, 3)),
|
||||
(-47, ('[Projectile Ammo]Titanium Sabot', 0, 0, 6, 2)),
|
||||
(-48, ('[Projectile Ammo]Proton', 3, 0, 2, 0)),
|
||||
(-49, ('[Projectile Ammo]Carbonized Lead', 0, 0, 4, 1)),
|
||||
(-50, ('[Projectile Ammo]Nuclear', 0, 0, 1, 4)),
|
||||
# Different sizes of plasma do different damage ratios, the values here
|
||||
# are average of ratios across sizes
|
||||
(-51, ('[Exotic Plasma]|[T2] Occult', 0, 55863, 0, 44137)),
|
||||
(-52, ('[Exotic Plasma]|[T2] Mystic', 0, 66319, 0, 33681)),
|
||||
(-53, ('[Exotic Plasma]Tetryon', 0, 69208, 0, 30792)),
|
||||
(-54, ('[Exotic Plasma]Baryon', 0, 59737, 0, 40263)),
|
||||
(-55, ('[Exotic Plasma]Meson', 0, 60519, 0, 39481)),
|
||||
(-56, ('[NPC][Asteroid]Angel Cartel', 1838, 562, 2215, 3838)),
|
||||
(-57, ('[NPC][Asteroid]Blood Raiders', 5067, 4214, 0, 0)),
|
||||
(-58, ('[NPC][Asteroid]Guristas', 0, 1828, 7413, 0)),
|
||||
(-59, ('[NPC][Asteroid]Rogue Drone', 394, 666, 1090, 1687)),
|
||||
(-60, ('[NPC][Asteroid]Sanshas Nation', 5586, 4112, 0, 0)),
|
||||
(-61, ('[NPC][Asteroid]Serpentis', 0, 5373, 4813, 0)),
|
||||
(-62, ('[NPC][Deadspace]Angel Cartel', 369, 533, 1395, 3302)),
|
||||
(-63, ('[NPC][Deadspace]Blood Raiders', 6040, 5052, 10, 15)),
|
||||
(-64, ('[NPC][Deadspace]Guristas', 0, 1531, 9680, 0)),
|
||||
(-65, ('[NPC][Deadspace]Rogue Drone', 276, 1071, 1069, 871)),
|
||||
(-66, ('[NPC][Deadspace]Sanshas Nation', 3009, 2237, 0, 0)),
|
||||
(-67, ('[NPC][Deadspace]Serpentis', 0, 3110, 1929, 0)),
|
||||
(-68, ('[NPC][Mission]Amarr Empire', 4464, 3546, 97, 0)),
|
||||
(-69, ('[NPC][Mission]Caldari State', 0, 2139, 4867, 0)),
|
||||
(-70, ('[NPC][Mission]CONCORD', 336, 134, 212, 412)),
|
||||
(-71, ('[NPC][Mission]Gallente Federation', 9, 3712, 2758, 0)),
|
||||
(-72, ('[NPC][Mission]Khanid', 612, 483, 43, 6)),
|
||||
(-73, ('[NPC][Mission]Minmatar Republic', 1024, 388, 1655, 4285)),
|
||||
(-74, ('[NPC][Mission]Mordus Legion', 25, 262, 625, 0)),
|
||||
(-75, ('[NPC][Mission]Thukker', 0, 52, 10, 79)),
|
||||
(-76, ('[NPC][Burner]Cruor (Blood Raiders)', 90, 90, 0, 0)),
|
||||
(-77, ('[NPC][Burner]Dramiel (Angel)', 55, 0, 20, 96)),
|
||||
(-78, ('[NPC][Burner]Daredevil (Serpentis)', 0, 110, 154, 0)),
|
||||
(-79, ('[NPC][Burner]Succubus (Sanshas Nation)', 135, 30, 0, 0)),
|
||||
(-80, ('[NPC][Burner]Worm (Guristas)', 0, 0, 228, 0)),
|
||||
(-81, ('[NPC][Burner]Enyo', 0, 147, 147, 0)),
|
||||
(-82, ('[NPC][Burner]Hawk', 0, 0, 247, 0)),
|
||||
(-83, ('[NPC][Burner]Jaguar', 36, 0, 50, 182)),
|
||||
(-84, ('[NPC][Burner]Vengeance', 232, 0, 0, 0)),
|
||||
(-85, ('[NPC][Burner]Ashimmu (Blood Raiders)', 260, 100, 0, 0)),
|
||||
(-86, ('[NPC][Burner]Talos', 0, 413, 413, 0)),
|
||||
(-87, ('[NPC][Burner]Sentinel', 0, 75, 0, 90)),
|
||||
(-88, ('[NPC][Other]Sleepers', 1472, 1472, 1384, 1384)),
|
||||
(-89, ('[NPC][Other]Sansha Incursion', 1682, 1347, 3678, 3678)),
|
||||
# Source: ticket #2067
|
||||
(-90, ('[NPC][Invasion][Invading Precursor Entities]0% spool up', 31, 29, 24, 16)),
|
||||
(-91, ('[NPC][Invasion][Invading Precursor Entities]50% spool up', 29, 37, 15, 19)),
|
||||
(-92, ('[NPC][Invasion][Invading Precursor Entities]100% spool up', 28, 41, 11, 20)),
|
||||
(-93, ('[NPC][Invasion]Retaliating Amarr Entities', 58, 42, 0, 0)),
|
||||
(-94, ('[NPC][Invasion]Retaliating Caldari Entities', 30, 43, 2, 25)),
|
||||
(-95, ('[NPC][Invasion]Retaliating Gallente Entities', 0, 42, 58, 0)),
|
||||
(-96, ('[NPC][Invasion]Retaliating Minmatar Entities', 17, 8, 44, 31))])
|
||||
|
||||
|
||||
class DamagePattern:
|
||||
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
|
||||
|
||||
DAMAGE_TYPES = ('em', 'thermal', 'kinetic', 'explosive')
|
||||
_builtins = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.builtin = False
|
||||
self.update(*args, **kwargs)
|
||||
|
||||
@reconstructor
|
||||
def init(self):
|
||||
self.builtin = False
|
||||
|
||||
def update(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25):
|
||||
self.emAmount = emAmount
|
||||
self.thermalAmount = thermalAmount
|
||||
self.kineticAmount = kineticAmount
|
||||
self.explosiveAmount = explosiveAmount
|
||||
|
||||
@classmethod
|
||||
def getBuiltinList(cls):
|
||||
if cls._builtins is None:
|
||||
cls.__generateBuiltins()
|
||||
return list(cls._builtins.values())
|
||||
|
||||
@classmethod
|
||||
def getBuiltinById(cls, id):
|
||||
if cls._builtins is None:
|
||||
cls.__generateBuiltins()
|
||||
return cls._builtins.get(id)
|
||||
|
||||
@classmethod
|
||||
def getDefaultBuiltin(cls):
|
||||
if cls._builtins is None:
|
||||
cls.__generateBuiltins()
|
||||
return cls._builtins.get(-1)
|
||||
|
||||
@classmethod
|
||||
def __generateBuiltins(cls):
|
||||
cls._builtins = OrderedDict()
|
||||
for id, (rawName, em, therm, kin, explo) in BUILTINS.items():
|
||||
pattern = DamagePattern(emAmount=em, thermalAmount=therm, kineticAmount=kin, explosiveAmount=explo)
|
||||
pattern.ID = id
|
||||
pattern.rawName = rawName
|
||||
pattern.builtin = True
|
||||
cls._builtins[id] = pattern
|
||||
|
||||
def calculateEhp(self, fit):
|
||||
ehp = {}
|
||||
for (type, attr) in (('shield', 'shieldCapacity'), ('armor', 'armorHP'), ('hull', 'hp')):
|
||||
@@ -98,7 +239,7 @@ class DamagePattern:
|
||||
lookup = {}
|
||||
current = eos.db.getDamagePatternList()
|
||||
for pattern in current:
|
||||
lookup[pattern.name] = pattern
|
||||
lookup[pattern.rawName] = pattern
|
||||
|
||||
for line in lines:
|
||||
try:
|
||||
@@ -131,7 +272,7 @@ class DamagePattern:
|
||||
eos.db.save(pattern)
|
||||
else:
|
||||
pattern = DamagePattern(**fields)
|
||||
pattern.name = name.strip()
|
||||
pattern.rawName = name.strip()
|
||||
eos.db.save(pattern)
|
||||
patterns.append(pattern)
|
||||
|
||||
@@ -147,11 +288,41 @@ class DamagePattern:
|
||||
out += "# Values are in following format:\n"
|
||||
out += "# DamageProfile = [name],[EM amount],[Thermal amount],[Kinetic amount],[Explosive amount]\n\n"
|
||||
for dp in patterns:
|
||||
out += cls.EXPORT_FORMAT % (dp.name, dp.emAmount, dp.thermalAmount, dp.kineticAmount, dp.explosiveAmount)
|
||||
out += cls.EXPORT_FORMAT % (dp.rawName, dp.emAmount, dp.thermalAmount, dp.kineticAmount, dp.explosiveAmount)
|
||||
|
||||
return out.strip()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.rawName
|
||||
|
||||
@property
|
||||
def fullName(self):
|
||||
categories, tail = self.__parseRawName()
|
||||
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
|
||||
|
||||
@property
|
||||
def shortName(self):
|
||||
return self.__parseRawName()[1]
|
||||
|
||||
@property
|
||||
def hierarchy(self):
|
||||
return self.__parseRawName()[0]
|
||||
|
||||
def __parseRawName(self):
|
||||
categories = []
|
||||
remainingName = self.rawName.strip() if self.rawName else ''
|
||||
while True:
|
||||
start, end = remainingName.find('['), remainingName.find(']')
|
||||
if start == -1 or end == -1:
|
||||
return categories, remainingName
|
||||
splitter = remainingName.find('|')
|
||||
if splitter != -1 and splitter == start - 1:
|
||||
return categories, remainingName[1:]
|
||||
categories.append(remainingName[start + 1:end])
|
||||
remainingName = remainingName[end + 1:].strip()
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
p = DamagePattern(self.emAmount, self.thermalAmount, self.kineticAmount, self.explosiveAmount)
|
||||
p.name = "%s copy" % self.name
|
||||
p.rawName = "%s copy" % self.rawName
|
||||
return p
|
||||
|
||||
@@ -28,15 +28,17 @@ from sqlalchemy.orm import reconstructor, validates
|
||||
|
||||
import eos.db
|
||||
from eos import capSim
|
||||
from eos.calc import calculateMultiplier, calculateLockTime
|
||||
from eos.calc import calculateLockTime, calculateMultiplier
|
||||
from eos.const import CalcType, FitSystemSecurity, FittingHardpoint, FittingModuleState, FittingSlot, ImplantLocation
|
||||
from eos.effectHandlerHelpers import (
|
||||
HandledBoosterList, HandledDroneCargoList, HandledImplantList,
|
||||
HandledModuleList, HandledProjectedDroneList, HandledProjectedModList)
|
||||
from eos.saveddata.character import Character
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.damagePattern import DamagePattern
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.targetProfile import TargetProfile
|
||||
from eos.utils.stats import DmgTypes, RRTypes
|
||||
|
||||
|
||||
@@ -166,11 +168,23 @@ class Fit:
|
||||
|
||||
@property
|
||||
def targetProfile(self):
|
||||
return self.__targetProfile
|
||||
if self.__userTargetProfile is not None:
|
||||
return self.__userTargetProfile
|
||||
if self.__builtinTargetProfileID is not None:
|
||||
return TargetProfile.getBuiltinById(self.__builtinTargetProfileID)
|
||||
return None
|
||||
|
||||
@targetProfile.setter
|
||||
def targetProfile(self, targetProfile):
|
||||
self.__targetProfile = targetProfile
|
||||
if targetProfile is None:
|
||||
self.__userTargetProfile = None
|
||||
self.__builtinTargetProfileID = None
|
||||
elif targetProfile.builtin:
|
||||
self.__userTargetProfile = None
|
||||
self.__builtinTargetProfileID = targetProfile.ID
|
||||
else:
|
||||
self.__userTargetProfile = targetProfile
|
||||
self.__builtinTargetProfileID = None
|
||||
self.__weaponDpsMap = {}
|
||||
self.__weaponVolleyMap = {}
|
||||
self.__droneDps = None
|
||||
@@ -178,11 +192,25 @@ class Fit:
|
||||
|
||||
@property
|
||||
def damagePattern(self):
|
||||
return self.__damagePattern
|
||||
if self.__userDamagePattern is not None:
|
||||
return self.__userDamagePattern
|
||||
if self.__builtinDamagePatternID is not None:
|
||||
pattern = DamagePattern.getBuiltinById(self.__builtinDamagePatternID)
|
||||
if pattern is not None:
|
||||
return pattern
|
||||
return DamagePattern.getDefaultBuiltin()
|
||||
|
||||
@damagePattern.setter
|
||||
def damagePattern(self, damagePattern):
|
||||
self.__damagePattern = damagePattern
|
||||
if damagePattern is None:
|
||||
self.__userDamagePattern = None
|
||||
self.__builtinDamagePatternID = None
|
||||
elif damagePattern.builtin:
|
||||
self.__userDamagePattern = None
|
||||
self.__builtinDamagePatternID = damagePattern.ID
|
||||
else:
|
||||
self.__userDamagePattern = damagePattern
|
||||
self.__builtinDamagePatternID = None
|
||||
self.__ehp = None
|
||||
self.__effectiveTank = None
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
|
||||
import math
|
||||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
from logbook import Logger
|
||||
from sqlalchemy.orm import reconstructor
|
||||
|
||||
import eos.db
|
||||
|
||||
@@ -28,13 +30,82 @@ import eos.db
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
BUILTINS = OrderedDict([
|
||||
# 0 is taken by ideal target profile, composed manually in one of TargetProfile methods
|
||||
(-1, ('Uniform (25%)', 0.25, 0.25, 0.25, 0.25)),
|
||||
(-2, ('Uniform (50%)', 0.50, 0.50, 0.50, 0.50)),
|
||||
(-3, ('Uniform (75%)', 0.75, 0.75, 0.75, 0.75)),
|
||||
(-4, ('Uniform (90%)', 0.90, 0.90, 0.90, 0.90)),
|
||||
(-5, ('[T1 Resist]Shield', 0.0, 0.20, 0.40, 0.50)),
|
||||
(-6, ('[T1 Resist]Armor', 0.50, 0.45, 0.25, 0.10)),
|
||||
(-7, ('[T1 Resist]Hull', 0.33, 0.33, 0.33, 0.33)),
|
||||
(-8, ('[T1 Resist]Shield (+T2 DCU)', 0.125, 0.30, 0.475, 0.562)),
|
||||
(-9, ('[T1 Resist]Armor (+T2 DCU)', 0.575, 0.532, 0.363, 0.235)),
|
||||
(-10, ('[T1 Resist]Hull (+T2 DCU)', 0.598, 0.598, 0.598, 0.598)),
|
||||
(-11, ('[T2 Resist]Amarr (Shield)', 0.0, 0.20, 0.70, 0.875)),
|
||||
(-12, ('[T2 Resist]Amarr (Armor)', 0.50, 0.35, 0.625, 0.80)),
|
||||
(-13, ('[T2 Resist]Caldari (Shield)', 0.20, 0.84, 0.76, 0.60)),
|
||||
(-14, ('[T2 Resist]Caldari (Armor)', 0.50, 0.8625, 0.625, 0.10)),
|
||||
(-15, ('[T2 Resist]Gallente (Shield)', 0.0, 0.60, 0.85, 0.50)),
|
||||
(-16, ('[T2 Resist]Gallente (Armor)', 0.50, 0.675, 0.8375, 0.10)),
|
||||
(-17, ('[T2 Resist]Minmatar (Shield)', 0.75, 0.60, 0.40, 0.50)),
|
||||
(-18, ('[T2 Resist]Minmatar (Armor)', 0.90, 0.675, 0.25, 0.10)),
|
||||
(-19, ('[NPC][Asteroid]Angel Cartel', 0.54, 0.42, 0.37, 0.32)),
|
||||
(-20, ('[NPC][Asteroid]Blood Raiders', 0.34, 0.39, 0.45, 0.52)),
|
||||
(-21, ('[NPC][Asteroid]Guristas', 0.55, 0.35, 0.3, 0.48)),
|
||||
(-22, ('[NPC][Asteroid]Rogue Drones', 0.35, 0.38, 0.44, 0.49)),
|
||||
(-23, ('[NPC][Asteroid]Sanshas Nation', 0.35, 0.4, 0.47, 0.53)),
|
||||
(-24, ('[NPC][Asteroid]Serpentis', 0.49, 0.38, 0.29, 0.51)),
|
||||
(-25, ('[NPC][Deadspace]Angel Cartel', 0.59, 0.48, 0.4, 0.32)),
|
||||
(-26, ('[NPC][Deadspace]Blood Raiders', 0.31, 0.39, 0.47, 0.56)),
|
||||
(-27, ('[NPC][Deadspace]Guristas', 0.57, 0.39, 0.31, 0.5)),
|
||||
(-28, ('[NPC][Deadspace]Rogue Drones', 0.42, 0.42, 0.47, 0.49)),
|
||||
(-29, ('[NPC][Deadspace]Sanshas Nation', 0.31, 0.39, 0.47, 0.56)),
|
||||
(-30, ('[NPC][Deadspace]Serpentis', 0.49, 0.38, 0.29, 0.56)),
|
||||
(-31, ('[NPC][Mission]Amarr Empire', 0.34, 0.38, 0.42, 0.46)),
|
||||
(-32, ('[NPC][Mission]Caldari State', 0.51, 0.38, 0.3, 0.51)),
|
||||
(-33, ('[NPC][Mission]CONCORD', 0.47, 0.46, 0.47, 0.47)),
|
||||
(-34, ('[NPC][Mission]Gallente Federation', 0.51, 0.38, 0.31, 0.52)),
|
||||
(-35, ('[NPC][Mission]Khanid', 0.51, 0.42, 0.36, 0.4)),
|
||||
(-36, ('[NPC][Mission]Minmatar Republic', 0.51, 0.46, 0.41, 0.35)),
|
||||
(-37, ('[NPC][Mission]Mordus Legion', 0.32, 0.48, 0.4, 0.62)),
|
||||
(-38, ('[NPC][Other]Sleeper', 0.61, 0.61, 0.61, 0.61)),
|
||||
(-39, ('[NPC][Other]Sansha Incursion', 0.65, 0.63, 0.64, 0.65)),
|
||||
(-40, ('[NPC][Burner]Cruor (Blood Raiders)', 0.8, 0.73, 0.69, 0.67)),
|
||||
(-41, ('[NPC][Burner]Dramiel (Angel)', 0.35, 0.48, 0.61, 0.68)),
|
||||
(-42, ('[NPC][Burner]Daredevil (Serpentis)', 0.69, 0.59, 0.59, 0.43)),
|
||||
(-43, ('[NPC][Burner]Succubus (Sanshas Nation)', 0.35, 0.48, 0.61, 0.68)),
|
||||
(-44, ('[NPC][Burner]Worm (Guristas)', 0.48, 0.58, 0.69, 0.74)),
|
||||
(-45, ('[NPC][Burner]Enyo', 0.58, 0.72, 0.86, 0.24)),
|
||||
(-46, ('[NPC][Burner]Hawk', 0.3, 0.86, 0.79, 0.65)),
|
||||
(-47, ('[NPC][Burner]Jaguar', 0.78, 0.65, 0.48, 0.56)),
|
||||
(-48, ('[NPC][Burner]Vengeance', 0.66, 0.56, 0.75, 0.86)),
|
||||
(-49, ('[NPC][Burner]Ashimmu (Blood Raiders)', 0.8, 0.76, 0.68, 0.7)),
|
||||
(-50, ('[NPC][Burner]Talos', 0.68, 0.59, 0.59, 0.43)),
|
||||
(-51, ('[NPC][Burner]Sentinel', 0.58, 0.45, 0.52, 0.66)),
|
||||
# Source: ticket #2067
|
||||
(-52, ('[NPC][Invasion]Invading Precursor Entities', 0.46, 0.39, 0.48, 0.42)),
|
||||
(-53, ('[NPC][Invasion]Retaliating Amarr Entities', 0.36, 0.31, 0.44, 0.60)),
|
||||
(-54, ('[NPC][Invasion]Retaliating Caldari Entities', 0.28, 0.61, 0.48, 0.39)),
|
||||
(-55, ('[NPC][Invasion]Retaliating Gallente Entities', 0.36, 0.39, 0.56, 0.50)),
|
||||
(-56, ('[NPC][Invasion]Retaliating Minmatar Entities', 0.62, 0.42, 0.35, 0.40))])
|
||||
|
||||
|
||||
class TargetProfile:
|
||||
|
||||
# also determined import/export order - VERY IMPORTANT
|
||||
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
|
||||
DAMAGE_TYPES = ('em', 'thermal', 'kinetic', 'explosive')
|
||||
_idealTarget = None
|
||||
_builtins = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.builtin = False
|
||||
self.update(*args, **kwargs)
|
||||
|
||||
@reconstructor
|
||||
def init(self):
|
||||
self.builtin = False
|
||||
|
||||
def update(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0, maxVelocity=None, signatureRadius=None, radius=None):
|
||||
self.emAmount = emAmount
|
||||
self.thermalAmount = thermalAmount
|
||||
@@ -44,7 +115,29 @@ class TargetProfile:
|
||||
self._signatureRadius = signatureRadius
|
||||
self._radius = radius
|
||||
|
||||
_idealTarget = None
|
||||
@classmethod
|
||||
def getBuiltinList(cls):
|
||||
if cls._builtins is None:
|
||||
cls.__generateBuiltins()
|
||||
return list(cls._builtins.values())
|
||||
|
||||
@classmethod
|
||||
def getBuiltinById(cls, id):
|
||||
if cls._builtins is None:
|
||||
cls.__generateBuiltins()
|
||||
return cls._builtins.get(id)
|
||||
|
||||
@classmethod
|
||||
def __generateBuiltins(cls):
|
||||
cls._builtins = OrderedDict()
|
||||
for id, data in BUILTINS.items():
|
||||
rawName = data[0]
|
||||
data = data[1:]
|
||||
profile = TargetProfile(*data)
|
||||
profile.ID = id
|
||||
profile.rawName = rawName
|
||||
profile.builtin = True
|
||||
cls._builtins[id] = profile
|
||||
|
||||
@classmethod
|
||||
def getIdeal(cls):
|
||||
@@ -57,8 +150,9 @@ class TargetProfile:
|
||||
maxVelocity=0,
|
||||
signatureRadius=None,
|
||||
radius=0)
|
||||
cls._idealTarget.name = 'Ideal Target'
|
||||
cls._idealTarget.ID = -1
|
||||
cls._idealTarget.rawName = 'Ideal Target'
|
||||
cls._idealTarget.ID = 0
|
||||
cls._idealTarget.builtin = True
|
||||
return cls._idealTarget
|
||||
|
||||
@property
|
||||
@@ -100,7 +194,7 @@ class TargetProfile:
|
||||
lookup = {}
|
||||
current = eos.db.getTargetProfileList()
|
||||
for pattern in current:
|
||||
lookup[pattern.name] = pattern
|
||||
lookup[pattern.rawName] = pattern
|
||||
|
||||
for line in lines:
|
||||
try:
|
||||
@@ -149,7 +243,7 @@ class TargetProfile:
|
||||
eos.db.save(pattern)
|
||||
else:
|
||||
pattern = TargetProfile(**fields)
|
||||
pattern.name = name.strip()
|
||||
pattern.rawName = name.strip()
|
||||
eos.db.save(pattern)
|
||||
patterns.append(pattern)
|
||||
|
||||
@@ -166,7 +260,7 @@ class TargetProfile:
|
||||
out += "# TargetProfile = [name],[EM %],[Thermal %],[Kinetic %],[Explosive %],[Max velocity m/s],[Signature radius m],[Radius m]\n\n"
|
||||
for dp in patterns:
|
||||
out += cls.EXPORT_FORMAT % (
|
||||
dp.name,
|
||||
dp.rawName,
|
||||
dp.emAmount * 100,
|
||||
dp.thermalAmount * 100,
|
||||
dp.kineticAmount * 100,
|
||||
@@ -178,9 +272,39 @@ class TargetProfile:
|
||||
|
||||
return out.strip()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.rawName
|
||||
|
||||
@property
|
||||
def fullName(self):
|
||||
categories, tail = self.__parseRawName()
|
||||
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
|
||||
|
||||
@property
|
||||
def shortName(self):
|
||||
return self.__parseRawName()[1]
|
||||
|
||||
@property
|
||||
def hierarchy(self):
|
||||
return self.__parseRawName()[0]
|
||||
|
||||
def __parseRawName(self):
|
||||
hierarchy = []
|
||||
remainingName = self.rawName.strip() if self.rawName else ''
|
||||
while True:
|
||||
start, end = remainingName.find('['), remainingName.find(']')
|
||||
if start == -1 or end == -1:
|
||||
return hierarchy, remainingName
|
||||
splitter = remainingName.find('|')
|
||||
if splitter != -1 and splitter == start - 1:
|
||||
return hierarchy, remainingName[1:]
|
||||
hierarchy.append(remainingName[start + 1:end])
|
||||
remainingName = remainingName[end + 1:].strip()
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
p = TargetProfile(
|
||||
self.emAmount, self.thermalAmount, self.kineticAmount, self.explosiveAmount,
|
||||
self._maxVelocity, self._signatureRadius, self._radius)
|
||||
p.name = "%s copy" % self.name
|
||||
p.rawName = "%s copy" % self.rawName
|
||||
return p
|
||||
|
||||
Reference in New Issue
Block a user