Merge branch 'EosCodeCleanup-V2' of https://github.com/Ebag333/Pyfa into Ebag333-EosCodeCleanup-V2

Conflicts:
	eos/effects/mininginfomultiplier.py
This commit is contained in:
blitzman
2016-11-20 13:59:14 -05:00
2032 changed files with 7926 additions and 2631 deletions

View File

@@ -1,6 +1,7 @@
version = "0.2.3"
tag = "git"
def test():
import tests.runTests
import unittest

View File

@@ -1,12 +1,12 @@
import heapq
from math import sqrt, exp
import time
from math import sqrt, exp
DAY = 24 * 60 * 60 * 1000
def lcm(a,b):
n = a*b
def lcm(a, b):
n = a * b
while b:
a, b = b, a % b
return n / a
@@ -40,20 +40,19 @@ class CapSimulator(object):
# relevant decimal digits of capacitor for LCM period optimization
self.stability_precision = 1
def scale_activation(self, duration, capNeed):
for res in self.scale_resolutions:
mod = duration % res
if mod:
if mod > res/2.0:
mod = res-mod
if mod > res / 2.0:
mod = res - mod
else:
mod = -mod
if abs(mod) <= duration/100.0:
if abs(mod) <= duration / 100.0:
# only adjust if the adjustment is less than 1%
duration += mod
capNeed += float(mod)/duration * capNeed
capNeed += float(mod) / duration * capNeed
break
return duration, capNeed
@@ -91,12 +90,12 @@ class CapSimulator(object):
for (duration, capNeed, clipSize, disableStagger), amount in mods.iteritems():
if self.stagger and not disableStagger:
if clipSize == 0:
duration = int(duration/amount)
duration = int(duration / amount)
else:
stagger_amount = (duration*clipSize+10000)/(amount*clipSize)
stagger_amount = (duration * clipSize + 10000) / (amount * clipSize)
for i in range(1, amount):
heapq.heappush(self.state,
[i*stagger_amount, duration,
[i * stagger_amount, duration,
capNeed, 0, clipSize])
else:
capNeed *= amount
@@ -109,13 +108,11 @@ class CapSimulator(object):
heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize])
if disable_period:
self.period = self.t_max
else:
self.period = period
def run(self):
"""Run the simulation"""
@@ -135,13 +132,13 @@ class CapSimulator(object):
capCapacity = self.capacitorCapacity
tau = self.capacitorRecharge / 5.0
cap_wrap = capCapacity # cap value at last period
cap_lowest = capCapacity # lowest cap value encountered
cap_lowest_pre = capCapacity # lowest cap value before activations
cap = capCapacity # current cap value
t_wrap = self.period # point in time of next period
cap_wrap = capCapacity # cap value at last period
cap_lowest = capCapacity # lowest cap value encountered
cap_lowest_pre = capCapacity # lowest cap value before activations
cap = capCapacity # current cap value
t_wrap = self.period # point in time of next period
t_now = t_last = 0
t_last = 0
t_max = self.t_max
while 1:
@@ -150,7 +147,7 @@ class CapSimulator(object):
if t_now >= t_max:
break
cap = ((1.0+(sqrt(cap/capCapacity)-1.0)*exp((t_last-t_now)/tau))**2)*capCapacity
cap = ((1.0 + (sqrt(cap / capCapacity) - 1.0) * exp((t_last - t_now) / tau)) ** 2) * capCapacity
if t_now != t_last:
if cap < cap_lowest_pre:
@@ -182,7 +179,7 @@ class CapSimulator(object):
if clipSize:
if shot % clipSize == 0:
shot = 0
t_now += 10000 # include reload time
t_now += 10000 # include reload time
activation[0] = t_now
activation[3] = shot
@@ -195,19 +192,17 @@ class CapSimulator(object):
# calculate EVE's stability value
try:
avgDrain = reduce(float.__add__, map(lambda x: x[2]/x[1], self.state), 0.0)
self.cap_stable_eve = 0.25 * (1.0 + sqrt(-(2.0 * avgDrain * tau - capCapacity)/capCapacity)) ** 2
avgDrain = reduce(float.__add__, map(lambda x: x[2] / x[1], self.state), 0.0)
self.cap_stable_eve = 0.25 * (1.0 + sqrt(-(2.0 * avgDrain * tau - capCapacity) / capCapacity)) ** 2
except ValueError:
self.cap_stable_eve = 0.0
if cap > 0.0:
# capacitor low/high water marks
self.cap_stable_low = cap_lowest
self.cap_stable_high = cap_lowest_pre
else:
self.cap_stable_low =\
self.cap_stable_high = 0.0
self.cap_stable_low = \
self.cap_stable_high = 0.0
self.runtime = time.time()-start
self.runtime = time.time() - start

View File

@@ -1,11 +1,13 @@
from os.path import realpath, join, dirname, abspath
import sys
from os.path import realpath, join, dirname, abspath
debug = False
gamedataCache = True
saveddataCache = True
gamedata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "eve.db")), sys.getfilesystemencoding())
saveddata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding())
gamedata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "eve.db")),
sys.getfilesystemencoding())
saveddata_connectionstring = 'sqlite:///' + unicode(
realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding())
#Autodetect path, only change if the autodetection bugs out.
# Autodetect path, only change if the autodetection bugs out.
path = dirname(unicode(__file__, sys.getfilesystemencoding()))

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
import threading
@@ -24,17 +24,20 @@ from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import pool
from eos import config
import migration
from eos import config
class ReadOnlyException(Exception):
pass
gamedata_connectionstring = config.gamedata_connectionstring
if callable(gamedata_connectionstring):
gamedata_engine = create_engine("sqlite://", creator=gamedata_connectionstring, echo = config.debug)
gamedata_engine = create_engine("sqlite://", creator=gamedata_connectionstring, echo=config.debug)
else:
gamedata_engine = create_engine(gamedata_connectionstring, echo = config.debug)
gamedata_engine = create_engine(gamedata_connectionstring, echo=config.debug)
gamedata_meta = MetaData()
gamedata_meta.bind = gamedata_engine
@@ -44,8 +47,8 @@ gamedata_session = sessionmaker(bind=gamedata_engine, autoflush=False, expire_on
# game db because we haven't reached gamedata_meta.create_all()
try:
config.gamedata_version = gamedata_session.execute(
"SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'"
).fetchone()[0]
"SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'"
).fetchone()[0]
except:
config.gamedata_version = None
@@ -63,19 +66,19 @@ if saveddata_connectionstring is not None:
# Lock controlling any changes introduced to session
sd_lock = threading.Lock()
#Import all the definitions for all our database stuff
# Import all the definitions for all our database stuff
from eos.db.gamedata import *
from eos.db.saveddata import *
#Import queries
# Import queries
from eos.db.gamedata.queries import *
from eos.db.saveddata.queries import *
#If using in memory saveddata, you'll want to reflect it so the data structure is good.
# If using in memory saveddata, you'll want to reflect it so the data structure is good.
if config.saveddata_connectionstring == "sqlite:///:memory:":
saveddata_meta.create_all()
def rollback():
with sd_lock:
saveddata_session.rollback()

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,20 +15,22 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, Float, Unicode, ForeignKey, String, Boolean
from sqlalchemy.orm import relation, mapper, synonym, deferred
from sqlalchemy.ext.associationproxy import association_proxy
from eos.types import Attribute, Icon, AttributeInfo, Unit
from sqlalchemy.orm import relation, mapper, synonym, deferred
from eos.db import gamedata_meta
from eos.types import Attribute, Icon, AttributeInfo, Unit
typeattributes_table = Table("dgmtypeattribs", gamedata_meta,
Column("value", Float),
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True, index=True),
Column("attributeID", ForeignKey("dgmattribs.attributeID"), primary_key=True))
Column("value", Float),
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True, index=True),
Column("attributeID", ForeignKey("dgmattribs.attributeID"), primary_key=True))
attributes_table = Table("dgmattribs", gamedata_meta,
Column("attributeID", Integer, primary_key = True),
Column("attributeID", Integer, primary_key=True),
Column("attributeName", String),
Column("defaultValue", Float),
Column("maxAttributeID", Integer, ForeignKey("dgmattribs.attributeID")),
@@ -40,14 +42,14 @@ attributes_table = Table("dgmattribs", gamedata_meta,
Column("unitID", Integer, ForeignKey("dgmunits.unitID")))
mapper(Attribute, typeattributes_table,
properties = {"info": relation(AttributeInfo, lazy=False)})
properties={"info": relation(AttributeInfo, lazy=False)})
mapper(AttributeInfo, attributes_table,
properties = {"icon" : relation(Icon),
"unit": relation(Unit),
"ID": synonym("attributeID"),
"name": synonym("attributeName"),
"description" : deferred(attributes_table.c.description)})
properties={"icon": relation(Icon),
"unit": relation(Unit),
"ID": synonym("attributeID"),
"name": synonym("attributeName"),
"description": deferred(attributes_table.c.description)})
Attribute.ID = association_proxy("info", "attributeID")
Attribute.name = association_proxy("info", "attributeName")

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, ForeignKey, Boolean, Table
from sqlalchemy.orm import relation, mapper, synonym, deferred
@@ -24,14 +24,14 @@ from eos.db import gamedata_meta
from eos.types import Category, Icon
categories_table = Table("invcategories", gamedata_meta,
Column("categoryID", Integer, primary_key = True),
Column("categoryID", Integer, primary_key=True),
Column("categoryName", String),
Column("description", String),
Column("published", Boolean),
Column("iconID", Integer, ForeignKey("icons.iconID")))
mapper(Category, categories_table,
properties = {"icon" : relation(Icon),
"ID" : synonym("categoryID"),
"name" : synonym("categoryName"),
"description" : deferred(categories_table.c.description)})
properties={"icon": relation(Icon),
"ID": synonym("categoryID"),
"name": synonym("categoryName"),
"description": deferred(categories_table.c.description)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,35 +15,35 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, Boolean, Table, ForeignKey
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import mapper, synonym, relation, deferred
from eos.types import Effect, EffectInfo
from eos.db import gamedata_meta
from eos.types import Effect, EffectInfo
typeeffects_table = Table("dgmtypeeffects", gamedata_meta,
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True, index=True),
Column("effectID", Integer, ForeignKey("dgmeffects.effectID"), primary_key=True))
effects_table = Table("dgmeffects", gamedata_meta,
Column("effectID", Integer, primary_key = True),
Column("effectID", Integer, primary_key=True),
Column("effectName", String),
Column("description", String),
Column("published", Boolean),
Column("isAssistance", Boolean),
Column("isOffensive", Boolean))
mapper(EffectInfo, effects_table,
properties = {"ID" : synonym("effectID"),
"name" : synonym("effectName"),
"description" : deferred(effects_table.c.description)})
properties={"ID": synonym("effectID"),
"name": synonym("effectName"),
"description": deferred(effects_table.c.description)})
mapper(Effect, typeeffects_table,
properties = {"ID": synonym("effectID"),
"info": relation(EffectInfo, lazy=False)})
properties={"ID": synonym("effectID"),
"info": relation(EffectInfo, lazy=False)})
Effect.name = association_proxy("info", "name")
Effect.description = association_proxy("info", "description")

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, Boolean, ForeignKey, Table
from sqlalchemy.orm import relation, mapper, synonym, deferred
@@ -24,7 +24,7 @@ from eos.db import gamedata_meta
from eos.types import Group, Icon, Category
groups_table = Table("invgroups", gamedata_meta,
Column("groupID", Integer, primary_key = True),
Column("groupID", Integer, primary_key=True),
Column("groupName", String),
Column("description", String),
Column("published", Boolean),
@@ -32,8 +32,8 @@ groups_table = Table("invgroups", gamedata_meta,
Column("iconID", Integer, ForeignKey("icons.iconID")))
mapper(Group, groups_table,
properties = {"category" : relation(Category, backref = "groups"),
"icon" : relation(Icon),
"ID" : synonym("groupID"),
"name" : synonym("groupName"),
"description" : deferred(groups_table.c.description)})
properties={"category": relation(Category, backref="groups"),
"icon": relation(Icon),
"ID": synonym("groupID"),
"name": synonym("groupName"),
"description": deferred(groups_table.c.description)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, Table
from sqlalchemy.orm import mapper, synonym, deferred
@@ -24,10 +24,10 @@ from eos.db import gamedata_meta
from eos.types import Icon
icons_table = Table("icons", gamedata_meta,
Column("iconID", Integer, primary_key = True),
Column("iconID", Integer, primary_key=True),
Column("description", String),
Column("iconFile", String))
mapper(Icon, icons_table,
properties = {"ID" : synonym("iconID"),
"description" : deferred(icons_table.c.description)})
properties={"ID": synonym("iconID"),
"description": deferred(icons_table.c.description)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,18 +15,18 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, Boolean, ForeignKey, Table, Float
from sqlalchemy.orm import relation, mapper, synonym, deferred
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relation, mapper, synonym, deferred
from sqlalchemy.orm.collections import attribute_mapped_collection
from eos.db import gamedata_meta
from eos.types import Icon, Attribute, Item, Effect, MetaType, Group, Traits
items_table = Table("invtypes", gamedata_meta,
Column("typeID", Integer, primary_key = True),
Column("typeID", Integer, primary_key=True),
Column("typeName", String, index=True),
Column("description", String),
Column("raceID", Integer),
@@ -43,19 +43,19 @@ from .metaGroup import metatypes_table
from .traits import traits_table
mapper(Item, items_table,
properties = {"group" : relation(Group, backref = "items"),
"icon" : relation(Icon),
"_Item__attributes" : relation(Attribute, collection_class = attribute_mapped_collection('name')),
"effects" : relation(Effect, collection_class = attribute_mapped_collection('name')),
"metaGroup" : relation(MetaType,
primaryjoin = metatypes_table.c.typeID == items_table.c.typeID,
uselist = False),
"ID" : synonym("typeID"),
"name" : synonym("typeName"),
"description" : deferred(items_table.c.description),
"traits" : relation(Traits,
primaryjoin = traits_table.c.typeID == items_table.c.typeID,
uselist = False)
})
properties={"group": relation(Group, backref="items"),
"icon": relation(Icon),
"_Item__attributes": relation(Attribute, collection_class=attribute_mapped_collection('name')),
"effects": relation(Effect, collection_class=attribute_mapped_collection('name')),
"metaGroup": relation(MetaType,
primaryjoin=metatypes_table.c.typeID == items_table.c.typeID,
uselist=False),
"ID": synonym("typeID"),
"name": synonym("typeName"),
"description": deferred(items_table.c.description),
"traits": relation(Traits,
primaryjoin=traits_table.c.typeID == items_table.c.typeID,
uselist=False)
})
Item.category = association_proxy("group", "category")

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, String, Integer, Boolean, ForeignKey, Table
from sqlalchemy.orm import relation, mapper, synonym, deferred
@@ -24,17 +24,19 @@ from eos.db import gamedata_meta
from eos.types import Item, MarketGroup, Icon
marketgroups_table = Table("invmarketgroups", gamedata_meta,
Column("marketGroupID", Integer, primary_key = True),
Column("marketGroupID", Integer, primary_key=True),
Column("marketGroupName", String),
Column("description", String),
Column("hasTypes", Boolean),
Column("parentGroupID", Integer, ForeignKey("invmarketgroups.marketGroupID", initially="DEFERRED", deferrable=True)),
Column("parentGroupID", Integer,
ForeignKey("invmarketgroups.marketGroupID", initially="DEFERRED", deferrable=True)),
Column("iconID", Integer, ForeignKey("icons.iconID")))
mapper(MarketGroup, marketgroups_table,
properties = {"items" : relation(Item, backref = "marketGroup"),
"parent" : relation(MarketGroup, backref = "children", remote_side = [marketgroups_table.c.marketGroupID]),
"icon" : relation(Icon),
"ID" : synonym("marketGroupID"),
"name" : synonym("marketGroupName"),
"description" : deferred(marketgroups_table.c.description)})
properties={"items": relation(Item, backref="marketGroup"),
"parent": relation(MarketGroup, backref="children",
remote_side=[marketgroups_table.c.marketGroupID]),
"icon": relation(Icon),
"ID": synonym("marketGroupID"),
"name": synonym("marketGroupName"),
"description": deferred(marketgroups_table.c.description)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,15 +15,16 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, Table, String
from sqlalchemy.orm import mapper
from eos.types import MetaData
from eos.db import gamedata_meta
from eos.types import MetaData
metadata_table = Table("metadata", gamedata_meta,
Column("field_name", String, primary_key=True),
Column("field_value", String))
Column("field_name", String, primary_key=True),
Column("field_value", String))
mapper(MetaData, metadata_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,33 +15,33 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relation, mapper, synonym
from eos.db import gamedata_meta
from eos.db.gamedata.item import items_table
from eos.types import MetaGroup, Item, MetaType
from sqlalchemy.ext.associationproxy import association_proxy
metagroups_table = Table("invmetagroups", gamedata_meta,
Column("metaGroupID", Integer, primary_key = True),
Column("metaGroupID", Integer, primary_key=True),
Column("metaGroupName", String))
metatypes_table = Table("invmetatypes", gamedata_meta,
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key = True),
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True),
Column("parentTypeID", Integer, ForeignKey("invtypes.typeID")),
Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID")))
mapper(MetaGroup, metagroups_table,
properties = {"ID" : synonym("metaGroupID"),
"name" : synonym("metaGroupName")})
properties={"ID": synonym("metaGroupID"),
"name": synonym("metaGroupName")})
mapper(MetaType, metatypes_table,
properties = {"ID" : synonym("metaGroupID"),
"parent" : relation(Item, primaryjoin = metatypes_table.c.parentTypeID == items_table.c.typeID),
"items" : relation(Item, primaryjoin = metatypes_table.c.typeID == items_table.c.typeID),
"info": relation(MetaGroup, lazy=False)})
properties={"ID": synonym("metaGroupID"),
"parent": relation(Item, primaryjoin=metatypes_table.c.parentTypeID == items_table.c.typeID),
"items": relation(Item, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID),
"info": relation(MetaGroup, lazy=False)})
MetaType.name = association_proxy("info", "name")

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,21 +15,23 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy.orm import join, exc
from sqlalchemy.sql import and_, or_, select
import eos.config
from eos.db import gamedata_session
from eos.db.gamedata.metaGroup import metatypes_table, items_table
from sqlalchemy.sql import and_, or_, select, func
from sqlalchemy.orm import join, exc
from eos.types import Item, Category, Group, MarketGroup, AttributeInfo, MetaData, MetaGroup
from eos.db.util import processEager, processWhere
import eos.config
from eos.types import Item, Category, Group, MarketGroup, AttributeInfo, MetaData, MetaGroup
configVal = getattr(eos.config, "gamedataCache", None)
if configVal is True:
def cachedQuery(amount, *keywords):
def deco(function):
cache = {}
def checkAndReturn(*args, **kwargs):
useCache = kwargs.pop("useCache", True)
cacheKey = []
@@ -45,6 +47,7 @@ if configVal is True:
return handler
return checkAndReturn
return deco
elif callable(configVal):
@@ -56,8 +59,10 @@ else:
return function(*args, **kwargs)
return checkAndReturn
return deco
def sqlizeString(line):
# Escape backslashes first, as they will be as escape symbol in queries
# Then escape percent and underscore signs
@@ -65,7 +70,10 @@ def sqlizeString(line):
line = line.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_").replace("*", "%")
return line
itemNameMap = {}
@cachedQuery(1, "lookfor")
def getItem(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -88,7 +96,10 @@ def getItem(lookfor, eager=None):
raise TypeError("Need integer or string as argument")
return item
groupNameMap = {}
@cachedQuery(1, "lookfor")
def getGroup(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -111,63 +122,78 @@ def getGroup(lookfor, eager=None):
raise TypeError("Need integer or string as argument")
return group
categoryNameMap = {}
@cachedQuery(1, "lookfor")
def getCategory(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
category = gamedata_session.query(Category).get(lookfor)
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(Category.ID == lookfor).first()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
Category.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in categoryNameMap:
id = categoryNameMap[lookfor]
if eager is None:
category = gamedata_session.query(Category).get(id)
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(Category.ID == id).first()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
Category.ID == id).first()
else:
# Category names are unique, so we can use first() instead of one()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(Category.name == lookfor).first()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
Category.name == lookfor).first()
categoryNameMap[lookfor] = category.ID
else:
raise TypeError("Need integer or string as argument")
return category
metaGroupNameMap = {}
@cachedQuery(1, "lookfor")
def getMetaGroup(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
metaGroup = gamedata_session.query(MetaGroup).get(lookfor)
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(MetaGroup.ID == lookfor).first()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in metaGroupNameMap:
id = metaGroupNameMap[lookfor]
if eager is None:
metaGroup = gamedata_session.query(MetaGroup).get(id)
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(MetaGroup.ID == id).first()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == id).first()
else:
# MetaGroup names are unique, so we can use first() instead of one()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(MetaGroup.name == lookfor).first()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.name == lookfor).first()
metaGroupNameMap[lookfor] = metaGroup.ID
else:
raise TypeError("Need integer or string as argument")
return metaGroup
@cachedQuery(1, "lookfor")
def getMarketGroup(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
marketGroup = gamedata_session.query(MarketGroup).get(lookfor)
else:
marketGroup = gamedata_session.query(MarketGroup).options(*processEager(eager)).filter(MarketGroup.ID == lookfor).first()
marketGroup = gamedata_session.query(MarketGroup).options(*processEager(eager)).filter(
MarketGroup.ID == lookfor).first()
else:
raise TypeError("Need integer as argument")
return marketGroup
@cachedQuery(2, "where", "filter")
def getItemsByCategory(filter, where=None, eager=None):
if isinstance(filter, int):
@@ -178,7 +204,9 @@ def getItemsByCategory(filter, where=None, eager=None):
raise TypeError("Need integer or string as argument")
filter = processWhere(filter, where)
return gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter(filter).all()
return gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter(
filter).all()
@cachedQuery(3, "where", "nameLike", "join")
def searchItems(nameLike, where=None, join=None, eager=None):
@@ -201,6 +229,7 @@ def searchItems(nameLike, where=None, join=None, eager=None):
items = items.limit(100).all()
return items
@cachedQuery(2, "where", "itemids")
def getVariations(itemids, where=None, eager=None):
for itemid in itemids:
@@ -213,9 +242,11 @@ def getVariations(itemids, where=None, eager=None):
itemfilter = or_(*(metatypes_table.c.parentTypeID == itemid for itemid in itemids))
filter = processWhere(itemfilter, where)
joinon = items_table.c.typeID == metatypes_table.c.typeID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(filter).all()
vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(
filter).all()
return vars
@cachedQuery(1, "attr")
def getAttributeInfo(attr, eager=None):
if isinstance(attr, basestring):
@@ -230,6 +261,7 @@ def getAttributeInfo(attr, eager=None):
result = None
return result
@cachedQuery(1, "field")
def getMetaData(field):
if isinstance(field, basestring):
@@ -238,6 +270,7 @@ def getMetaData(field):
raise TypeError("Need string as argument")
return data
@cachedQuery(2, "itemIDs", "attributeID")
def directAttributeRequest(itemIDs, attrIDs):
for itemID in itemIDs:
@@ -248,8 +281,8 @@ def directAttributeRequest(itemIDs, attrIDs):
raise TypeError("All itemIDs must be integer")
q = select((eos.types.Item.typeID, eos.types.Attribute.attributeID, eos.types.Attribute.value),
and_(eos.types.Attribute.attributeID.in_(attrIDs), eos.types.Item.typeID.in_(itemIDs)),
from_obj=[join(eos.types.Attribute, eos.types.Item)])
and_(eos.types.Attribute.attributeID.in_(attrIDs), eos.types.Item.typeID.in_(itemIDs)),
from_obj=[join(eos.types.Attribute, eos.types.Item)])
result = gamedata_session.execute(q).fetchall()
return result

View File

@@ -1,11 +1,11 @@
from sqlalchemy import Column, Table, Integer, String, ForeignKey
from sqlalchemy.orm import mapper
from eos.types import Traits
from eos.db import gamedata_meta
from eos.types import Traits
traits_table = Table("invtraits", gamedata_meta,
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True),
Column("traitText", String))
mapper(Traits, traits_table);
mapper(Traits, traits_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, Table, Integer, String
from sqlalchemy.orm import mapper, synonym
@@ -24,10 +24,10 @@ from eos.db import gamedata_meta
from eos.types import Unit
groups_table = Table("dgmunits", gamedata_meta,
Column("unitID", Integer, primary_key = True),
Column("unitID", Integer, primary_key=True),
Column("unitName", String),
Column("displayName", String))
mapper(Unit, groups_table,
properties = {"ID" : synonym("unitID"),
"name" : synonym("unitName")})
properties={"ID": synonym("unitID"),
"name": synonym("unitName")})

View File

@@ -1,20 +1,22 @@
import config
import logging
import shutil
import time
import re
import os
import config
import migrations
import logging
logger = logging.getLogger(__name__)
def getVersion(db):
cursor = db.execute('PRAGMA user_version')
return cursor.fetchone()[0]
def getAppVersion():
return migrations.appVersion
def update(saveddata_engine):
dbVersion = getVersion(saveddata_engine)
appVersion = getAppVersion()
@@ -24,7 +26,7 @@ def update(saveddata_engine):
if dbVersion < appVersion:
# Automatically backup database
toFile = "%s/saveddata_migration_%d-%d_%s.db"%(
toFile = "%s/saveddata_migration_%d-%d_%s.db" % (
config.savePath,
dbVersion,
appVersion,
@@ -33,9 +35,9 @@ def update(saveddata_engine):
shutil.copyfile(config.saveDB, toFile)
for version in xrange(dbVersion, appVersion):
func = migrations.updates[version+1]
func = migrations.updates[version + 1]
if func:
logger.info("Applying database update: %d", version+1)
logger.info("Applying database update: %d", version + 1)
func(saveddata_engine)
# when all is said and done, set version to current

View File

@@ -11,7 +11,6 @@ upgrade files 1-5)
import pkgutil
import re
updates = {}
appVersion = 0

View File

@@ -17,4 +17,3 @@ __all__ = [
"implantSet",
"loadDefaultDatabaseValues"
]

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,25 +15,26 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, ForeignKey, Integer, UniqueConstraint, Boolean
from sqlalchemy.orm import mapper, relation
from sqlalchemy import Table, Column, ForeignKey, Integer, Boolean
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import mapper, relation
from eos.db import saveddata_meta
from eos.types import Booster
boosters_table = Table("boosters", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ID", Integer, primary_key=True),
Column("itemID", Integer),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable = False),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable=False),
Column("active", Boolean),
)
activeSideEffects_table = Table("boostersActiveSideEffects", saveddata_meta,
Column("boosterID", ForeignKey("boosters.ID"), primary_key = True),
Column("effectID", Integer, primary_key = True))
Column("boosterID", ForeignKey("boosters.ID"), primary_key=True),
Column("effectID", Integer, primary_key=True))
class ActiveSideEffectsDummy(object):
def __init__(self, effectID):
@@ -42,6 +43,6 @@ class ActiveSideEffectsDummy(object):
mapper(ActiveSideEffectsDummy, activeSideEffects_table)
mapper(Booster, boosters_table,
properties = {"_Booster__activeSideEffectDummies" : relation(ActiveSideEffectsDummy)})
properties={"_Booster__activeSideEffectDummies": relation(ActiveSideEffectsDummy)})
Booster._Booster__activeSideEffectIDs = association_proxy("_Booster__activeSideEffectDummies", "effectID")

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,18 +15,18 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean
from sqlalchemy import Table, Column, Integer, ForeignKey
from sqlalchemy.orm import mapper
from eos.db import saveddata_meta
from eos.types import Cargo
cargo_table = Table("cargo", saveddata_meta,
Column("ID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable = False, index = True),
Column("itemID", Integer, nullable = False),
Column("amount", Integer, nullable = False))
Column("ID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable=False, index=True),
Column("itemID", Integer, nullable=False),
Column("amount", Integer, nullable=False))
mapper(Cargo, cargo_table)
mapper(Cargo, cargo_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,44 +15,44 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.orm import relation, mapper
from eos.db import saveddata_meta
from eos.db.saveddata.implant import charImplants_table
from eos.types import Character, User, Skill, Implant
from eos.effectHandlerHelpers import HandledImplantBoosterList
from eos.types import Character, User, Skill, Implant
characters_table = Table("characters", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("name", String, nullable = False),
Column("ID", Integer, primary_key=True),
Column("name", String, nullable=False),
Column("apiID", Integer),
Column("apiKey", String),
Column("defaultChar", Integer),
Column("chars", String, nullable = True),
Column("chars", String, nullable=True),
Column("defaultLevel", Integer, nullable=True),
Column("ownerID", ForeignKey("users.ID"), nullable = True))
Column("ownerID", ForeignKey("users.ID"), nullable=True))
mapper(Character, characters_table,
properties = {
"savedName": characters_table.c.name,
"_Character__owner": relation(
User,
backref = "characters"),
"_Character__skills": relation(
Skill,
backref="character",
cascade = "all,delete-orphan"),
"_Character__implants": relation(
Implant,
collection_class = HandledImplantBoosterList,
cascade='all,delete-orphan',
backref='character',
single_parent=True,
primaryjoin = charImplants_table.c.charID == characters_table.c.ID,
secondaryjoin = charImplants_table.c.implantID == Implant.ID,
secondary = charImplants_table),
}
)
properties={
"savedName": characters_table.c.name,
"_Character__owner": relation(
User,
backref="characters"),
"_Character__skills": relation(
Skill,
backref="character",
cascade="all,delete-orphan"),
"_Character__implants": relation(
Implant,
collection_class=HandledImplantBoosterList,
cascade='all,delete-orphan',
backref='character',
single_parent=True,
primaryjoin=charImplants_table.c.charID == characters_table.c.ID,
secondaryjoin=charImplants_table.c.implantID == Implant.ID,
secondary=charImplants_table),
}
)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,17 +15,17 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, String, Boolean
from sqlalchemy import Table, Column, Integer, String
from sqlalchemy.orm import mapper
from eos.db import saveddata_meta
from eos.types import CrestChar
crest_table = Table("crest", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("name", String, nullable = False, unique = True),
Column("refresh_token", String, nullable = False))
Column("ID", Integer, primary_key=True),
Column("name", String, nullable=False, unique=True),
Column("refresh_token", String, nullable=False))
mapper(CrestChar, crest_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.orm import mapper
@@ -24,7 +24,7 @@ from eos.db import saveddata_meta
from eos.types import DamagePattern
damagePatterns_table = Table("damagePatterns", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ID", Integer, primary_key=True),
Column("name", String),
Column("emAmount", Integer),
Column("thermalAmount", Integer),

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,19 +15,20 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean
from sqlalchemy.orm import mapper
from eos.db import saveddata_meta
from eos.types import Drone
drones_table = Table("drones", saveddata_meta,
Column("groupID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable = False, index = True),
Column("itemID", Integer, nullable = False),
Column("amount", Integer, nullable = False),
Column("amountActive", Integer, nullable = False),
Column("projected", Boolean, default = False))
Column("fitID", Integer, ForeignKey("fits.ID"), nullable=False, index=True),
Column("itemID", Integer, nullable=False),
Column("amount", Integer, nullable=False),
Column("amountActive", Integer, nullable=False),
Column("projected", Boolean, default=False))
mapper(Drone, drones_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,38 +15,36 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean
from sqlalchemy.orm import mapper
from sqlalchemy.orm import *
from eos.db import saveddata_meta
from eos.types import Fighter, Fit
from sqlalchemy.orm import *
from sqlalchemy.sql import and_
from eos.effectHandlerHelpers import *
from eos.types import FighterAbility
fighters_table = Table("fighters", saveddata_meta,
Column("groupID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable = False, index = True),
Column("itemID", Integer, nullable = False),
Column("active", Boolean, nullable=True),
Column("amount", Integer, nullable = False),
Column("projected", Boolean, default = False))
Column("groupID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable=False, index=True),
Column("itemID", Integer, nullable=False),
Column("active", Boolean, nullable=True),
Column("amount", Integer, nullable=False),
Column("projected", Boolean, default=False))
fighter_abilities_table = Table("fightersAbilities", saveddata_meta,
Column("groupID", Integer, ForeignKey("fighters.groupID"), primary_key=True, index = True),
Column("effectID", Integer, nullable = False, primary_key=True),
Column("active", Boolean, default = False))
Column("groupID", Integer, ForeignKey("fighters.groupID"), primary_key=True,
index=True),
Column("effectID", Integer, nullable=False, primary_key=True),
Column("active", Boolean, default=False))
mapper(Fighter, fighters_table,
properties = {
"owner": relation(Fit),
"_Fighter__abilities": relation(
FighterAbility,
backref="fighter",
cascade='all, delete, delete-orphan'),
properties={
"owner": relation(Fit),
"_Fighter__abilities": relation(
FighterAbility,
backref="fighter",
cascade='all, delete, delete-orphan'),
})
mapper(FighterAbility, fighter_abilities_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,43 +15,45 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.sql import and_
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 eos.db import saveddata_meta
from eos.db.saveddata.module import modules_table
from eos.db.saveddata.cargo import cargo_table
from eos.db.saveddata.drone import drones_table
from eos.db.saveddata.fighter import fighters_table
from eos.db.saveddata.cargo import cargo_table
from eos.db.saveddata.implant import fitImplants_table
from eos.types import Fit, Module, User, Booster, Drone, Fighter, Cargo, Implant, Character, DamagePattern, TargetResists, ImplantLocation
from eos.db.saveddata.module import modules_table
from eos.effectHandlerHelpers import *
from eos.types import Fit, Module, User, Booster, Drone, Fighter, Cargo, Implant, Character, DamagePattern, \
TargetResists, ImplantLocation
fits_table = Table("fits", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ownerID", ForeignKey("users.ID"), nullable = True, index = True),
Column("shipID", Integer, nullable = False, index = True),
Column("name", String, nullable = False),
Column("timestamp", Integer, nullable = False),
Column("characterID", ForeignKey("characters.ID"), nullable = True),
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True),
Column("booster", Boolean, nullable = False, index = True, default = 0),
Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True),
Column("modeID", Integer, nullable=True),
Column("implantLocation", Integer, nullable=False, default=ImplantLocation.FIT),
)
Column("ID", Integer, primary_key=True),
Column("ownerID", ForeignKey("users.ID"), nullable=True, index=True),
Column("shipID", Integer, nullable=False, index=True),
Column("name", String, nullable=False),
Column("timestamp", Integer, nullable=False),
Column("characterID", ForeignKey("characters.ID"), nullable=True),
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True),
Column("booster", Boolean, nullable=False, index=True, default=0),
Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True),
Column("modeID", Integer, nullable=True),
Column("implantLocation", Integer, nullable=False, default=ImplantLocation.FIT),
)
projectedFits_table = Table("projectedFits", saveddata_meta,
Column("sourceID", ForeignKey("fits.ID"), primary_key = True),
Column("victimID", ForeignKey("fits.ID"), primary_key = True),
Column("amount", Integer, nullable = False, default = 1),
Column("active", Boolean, nullable = False, default = 1),
)
Column("sourceID", ForeignKey("fits.ID"), primary_key=True),
Column("victimID", ForeignKey("fits.ID"), primary_key=True),
Column("amount", Integer, nullable=False, default=1),
Column("active", Boolean, nullable=False, default=1),
)
class ProjectedFit(object):
def __init__(self, sourceID, source_fit, amount=1, active=True):
@@ -83,6 +85,7 @@ class ProjectedFit(object):
self.sourceID, self.victimID, self.amount, self.active, hex(id(self))
)
Fit._Fit__projectedFits = association_proxy(
"victimOf", # look at the victimOf association...
"source_fit", # .. and return the source fits
@@ -90,90 +93,90 @@ Fit._Fit__projectedFits = association_proxy(
)
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'),
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'),
}
)
)
mapper(ProjectedFit, projectedFits_table,
properties = {
"_ProjectedFit__amount": projectedFits_table.c.amount,
properties={
"_ProjectedFit__amount": projectedFits_table.c.amount,
}
)
)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,52 +15,51 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.orm import mapper, relation
from eos.db import saveddata_meta
from eos.types import Fleet, Wing, Squad, Fit
from eos.db.saveddata.fit import fits_table
from eos.types import Fleet, Wing, Squad, Fit
gangs_table = Table("gangs", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ID", Integer, primary_key=True),
Column("leaderID", ForeignKey("fits.ID")),
Column("boosterID", ForeignKey("fits.ID")),
Column("name", String))
wings_table = Table("wings", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ID", Integer, primary_key=True),
Column("gangID", ForeignKey("gangs.ID")),
Column("boosterID", ForeignKey("fits.ID")),
Column("leaderID", ForeignKey("fits.ID")))
squads_table = Table("squads", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("ID", Integer, primary_key=True),
Column("wingID", ForeignKey("wings.ID")),
Column("leaderID", ForeignKey("fits.ID")),
Column("boosterID", ForeignKey("fits.ID")))
squadmembers_table = Table("squadmembers", saveddata_meta,
Column("squadID", ForeignKey("squads.ID"), primary_key = True),
Column("memberID", ForeignKey("fits.ID"), primary_key = True))
Column("squadID", ForeignKey("squads.ID"), primary_key=True),
Column("memberID", ForeignKey("fits.ID"), primary_key=True))
mapper(Fleet, gangs_table,
properties = {"wings" : relation(Wing, backref="gang"),
"leader" : relation(Fit, primaryjoin = gangs_table.c.leaderID == fits_table.c.ID),
"booster": relation(Fit, primaryjoin = gangs_table.c.boosterID == fits_table.c.ID)})
properties={"wings": relation(Wing, backref="gang"),
"leader": relation(Fit, primaryjoin=gangs_table.c.leaderID == fits_table.c.ID),
"booster": relation(Fit, primaryjoin=gangs_table.c.boosterID == fits_table.c.ID)})
mapper(Wing, wings_table,
properties = {"squads" : relation(Squad, backref="wing"),
"leader" : relation(Fit, primaryjoin = wings_table.c.leaderID == fits_table.c.ID),
"booster": relation(Fit, primaryjoin = wings_table.c.boosterID == fits_table.c.ID)})
properties={"squads": relation(Squad, backref="wing"),
"leader": relation(Fit, primaryjoin=wings_table.c.leaderID == fits_table.c.ID),
"booster": relation(Fit, primaryjoin=wings_table.c.boosterID == fits_table.c.ID)})
mapper(Squad, squads_table,
properties = {"leader" : relation(Fit, primaryjoin = squads_table.c.leaderID == fits_table.c.ID),
"booster" : relation(Fit, primaryjoin = squads_table.c.boosterID == fits_table.c.ID),
"members" : relation(Fit,
primaryjoin = squads_table.c.ID == squadmembers_table.c.squadID,
secondaryjoin = squadmembers_table.c.memberID == fits_table.c.ID,
secondary = squadmembers_table)})
properties={"leader": relation(Fit, primaryjoin=squads_table.c.leaderID == fits_table.c.ID),
"booster": relation(Fit, primaryjoin=squads_table.c.boosterID == fits_table.c.ID),
"members": relation(Fit,
primaryjoin=squads_table.c.ID == squadmembers_table.c.squadID,
secondaryjoin=squadmembers_table.c.memberID == fits_table.c.ID,
secondary=squadmembers_table)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean
from sqlalchemy.orm import mapper
@@ -24,20 +24,20 @@ from eos.db import saveddata_meta
from eos.types import Implant
implants_table = Table("implants", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("itemID", Integer),
Column("active", Boolean))
Column("ID", Integer, primary_key=True),
Column("itemID", Integer),
Column("active", Boolean))
fitImplants_table = Table("fitImplants", saveddata_meta,
Column("fitID", ForeignKey("fits.ID"), index = True),
Column("implantID", ForeignKey("implants.ID"), primary_key = True))
Column("fitID", ForeignKey("fits.ID"), index=True),
Column("implantID", ForeignKey("implants.ID"), primary_key=True))
charImplants_table = Table("charImplants", saveddata_meta,
Column("charID", ForeignKey("characters.ID"), index = True),
Column("implantID", ForeignKey("implants.ID"), primary_key = True))
Column("charID", ForeignKey("characters.ID"), index=True),
Column("implantID", ForeignKey("implants.ID"), primary_key=True))
implantsSetMap_table = Table("implantSetMap", saveddata_meta,
Column("setID", ForeignKey("implantSets.ID"), index = True),
Column("implantID", ForeignKey("implants.ID"), primary_key = True))
Column("setID", ForeignKey("implantSets.ID"), index=True),
Column("implantID", ForeignKey("implants.ID"), primary_key=True))
mapper(Implant, implants_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2016 Ryan Holmes
#
# This file is part of eos.
@@ -15,31 +15,31 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy import Table, Column, Integer, String
from sqlalchemy.orm import relation, mapper
from eos.db import saveddata_meta
from eos.db.saveddata.implant import implantsSetMap_table
from eos.types import Implant, ImplantSet
from eos.effectHandlerHelpers import HandledImplantBoosterList
from eos.types import Implant, ImplantSet
implant_set_table = Table("implantSets", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("name", String, nullable = False),
)
Column("ID", Integer, primary_key=True),
Column("name", String, nullable=False),
)
mapper(ImplantSet, implant_set_table,
properties = {
"_ImplantSet__implants": relation(
Implant,
collection_class = HandledImplantBoosterList,
cascade='all, delete, delete-orphan',
backref='set',
single_parent=True,
primaryjoin = implantsSetMap_table.c.setID == implant_set_table.c.ID,
secondaryjoin = implantsSetMap_table.c.implantID == Implant.ID,
secondary = implantsSetMap_table),
}
)
properties={
"_ImplantSet__implants": relation(
Implant,
collection_class=HandledImplantBoosterList,
cascade='all, delete, delete-orphan',
backref='set',
single_parent=True,
primaryjoin=implantsSetMap_table.c.setID == implant_set_table.c.ID,
secondaryjoin=implantsSetMap_table.c.implantID == Implant.ID,
secondary=implantsSetMap_table),
}
)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
@@ -15,104 +15,104 @@
#
# 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
import eos.types
class ImportError(Exception):
pass
class DefaultDatabaseValues():
def __init__(self):
pass
instance = None
@classmethod
def importDamageProfileDefaults(self):
damageProfileList = []
damageProfileList.append(["Uniform", "25", "25", "25", "25"])
damageProfileList.append(["[Generic]EM", "100", "0", "0", "0"])
damageProfileList.append(["[Generic]Thermal", "0", "100", "0", "0"])
damageProfileList.append(["[Generic]Kinetic", "0", "0", "100", "0"])
damageProfileList.append(["[Generic]Explosive", "0", "0", "0", "100"])
damageProfileList.append(["[NPC][Asteroid] Blood Raiders", "5067", "4214", "0", "0"])
damageProfileList.append(["[Bombs]Concussion Bomb", "0", "0", "6400", "0"])
damageProfileList.append(["[Bombs]Electron Bomb", "6400", "0", "0", "0"])
damageProfileList.append(["[Bombs]Scorch Bomb", "0", "6400", "0", "0"])
damageProfileList.append(["[Bombs]Shrapnel Bomb", "0", "0", "0", "6400"])
damageProfileList.append(["[Frequency Crystals][T2] Gleam", "56", "56", "0", "0"])
damageProfileList.append(["[Frequency Crystals][T2] Aurora", "40", "24", "0", "0"])
damageProfileList.append(["[Frequency Crystals][T2] Scorch", "72", "16", "0", "0"])
damageProfileList.append(["[Frequency Crystals][T2] Conflagration", "61.6", "61.6", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Gamma", "61.6", "35.2", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Infrared", "44", "17.6", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Microwave", "35.2", "17.6", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Multifrequency", "61.6", "44", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Radio", "44", "0", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Standard", "44", "26.4", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Ultraviolet", "52.8", "26.4", "0", "0"])
damageProfileList.append(["[Frequency Crystals]Xray", "52.8", "35.2", "0", "0"])
damageProfileList.append(["[Hybrid Charges][T2] Void", "0", "61.6", "61.6", "0"])
damageProfileList.append(["[Hybrid Charges][T2] Null", "0", "48", "40", "0"])
damageProfileList.append(["[Hybrid Charges][T2] Javelin", "0", "64", "48", "0"])
damageProfileList.append(["[Hybrid Charges][T2] Spike", "0", "32", "32", "0"])
damageProfileList.append(["[Hybrid Charges]Antimatter", "0", "48", "67.2", "0"])
damageProfileList.append(["[Hybrid Charges]Iridium", "0", "28.8", "38.4", "0"])
damageProfileList.append(["[Hybrid Charges]Iron", "0", "19.2", "28.8", "0"])
damageProfileList.append(["[Hybrid Charges]Lead", "0", "28.8", "48", "0"])
damageProfileList.append(["[Hybrid Charges]Plutonium", "0", "48", "57.6", "0"])
damageProfileList.append(["[Hybrid Charges]Thorium", "0", "38.4", "48", "0"])
damageProfileList.append(["[Hybrid Charges]Tungsten", "0", "19.2", "38.4", "0"])
damageProfileList.append(["[Hybrid Charges]Uranium", "0", "38.4", "57.6", "0"])
damageProfileList.append(["[Missiles]Mjolnir", "100", "0", "0", "0"])
damageProfileList.append(["[Missiles]Inferno", "0", "100", "0", "0"])
damageProfileList.append(["[Missiles]Scourge", "0", "0", "100", "0"])
damageProfileList.append(["[Missiles]Nova", "0", "0", "0", "100"])
damageProfileList.append(["[Missiles][Structure) Standup Missile", "100", "100", "100", "100"])
damageProfileList.append(["[Projectile Ammo][T2] Tremor", "0", "0", "24", "40"])
damageProfileList.append(["[Projectile Ammo][T2] Quake", "0", "0", "40", "72"])
damageProfileList.append(["[Projectile Ammo][T2] Hail", "0", "0", "26.4", "96.8"])
damageProfileList.append(["[Projectile Ammo][T2] Barrage", "0", "0", "40", "48"])
damageProfileList.append(["[Projectile Ammo]Carbonized Lead", "0", "0", "35.2", "8.8"])
damageProfileList.append(["[Projectile Ammo]Depleted Uranium", "0", "26.4", "17.6", "26.4"])
damageProfileList.append(["[Projectile Ammo]EMP", "79.2", "0", "8.8", "17.6"])
damageProfileList.append(["[Projectile Ammo]Fusion", "0", "0", "17.6", "88"])
damageProfileList.append(["[Projectile Ammo]Nuclear", "0", "0", "8.8", "35.2"])
damageProfileList.append(["[Projectile Ammo]Phased Plasma", "0", "88", "17.6", "0"])
damageProfileList.append(["[Projectile Ammo]Proton", "26.4", "0", "17.6", "0"])
damageProfileList.append(["[Projectile Ammo]Titanium Sabot", "0", "0", "52.8", "176"])
damageProfileList.append(["[NPC][Burner] Cruor (Blood Raiders)", "90", "90", "0", "0"])
damageProfileList.append(["[NPC][Burner] Dramiel (Angel)", "55", "0", "20", "96"])
damageProfileList.append(["[NPC][Burner] Daredevil (Serpentis)", "0", "110", "154", "0"])
damageProfileList.append(["[NPC][Burner] Succubus (Sanshas Nation)", "135", "30", "0", "0"])
damageProfileList.append(["[NPC][Burner] Worm (Guristas)", "0", "0", "228", "0"])
damageProfileList.append(["[NPC][Burner] Enyo", "0", "147", "147", "0"])
damageProfileList.append(["[NPC][Burner] Hawk", "0", "0", "247", "0"])
damageProfileList.append(["[NPC][Burner] Jaguar", "36", "0", "50", "182"])
damageProfileList.append(["[NPC][Burner] Vengeance", "232", "0", "0", "0"])
damageProfileList.append(["[NPC][Burner] Ashimmu (Blood Raiders)", "260", "100", "0", "0"])
damageProfileList.append(["[NPC][Burner] Talos", "0", "413", "413", "0"])
damageProfileList.append(["[NPC][Burner] Sentinel", "0", "75", "0", "90"])
damageProfileList.append(["[NPC][Asteroid] Angel Cartel", "1838", "562", "2215", "3838"])
damageProfileList.append(["[NPC][Deadspace] Angel Cartel", "369", "533", "1395", "3302"])
damageProfileList.append(["[NPC][Deadspace] Blood Raiders", "6040", "5052", "10", "15"])
damageProfileList.append(["[NPC][Asteroid] Guristas", "0", "1828", "7413", "0"])
damageProfileList.append(["[NPC][Deadspace] Guristas", "0", "1531", "9680", "0"])
damageProfileList.append(["[NPC][Asteroid] Rogue Drone", "394", "666", "1090", "1687"])
damageProfileList.append(["[NPC][Deadspace] Rogue Drone", "276", "1071", "1069", "871"])
damageProfileList.append(["[NPC][Asteroid] Sanshas Nation", "5586", "4112", "0", "0"])
damageProfileList.append(["[NPC][Deadspace] Sanshas Nation", "3009", "2237", "0", "0"])
damageProfileList.append(["[NPC][Asteroid] Serpentis", "0", "5373", "4813", "0"])
damageProfileList.append(["[NPC][Deadspace] Serpentis", "0", "3110", "1929", "0"])
damageProfileList.append(["[NPC][Mission] Amarr Empire", "4464", "3546", "97", "0"])
damageProfileList.append(["[NPC][Mission] Caldari State", "0", "2139", "4867", "0"])
damageProfileList.append(["[NPC][Mission] CONCORD", "336", "134", "212", "412"])
damageProfileList.append(["[NPC][Mission] Gallente Federation", "9", "3712", "2758", "0"])
damageProfileList.append(["[NPC][Mission] Khanid", "612", "483", "43", "6"])
damageProfileList.append(["[NPC][Mission] Minmatar Republic", "1024", "388", "1655", "4285"])
damageProfileList.append(["[NPC][Mission] Mordus Legion", "25", "262", "625", "0"])
damageProfileList.append(["[NPC][Mission] Thukker", "0", "52", "10", "79"])
damageProfileList.append(["[NPC][Other] Sleepers", "1472", "1472", "1384", "1384"])
damageProfileList.append(["[NPC][Other] Sansha Incursion", "1682", "1347", "3678", "3678"])
def importDamageProfileDefaults(cls):
damageProfileList = [["Uniform", "25", "25", "25", "25"], ["[Generic]EM", "100", "0", "0", "0"],
["[Generic]Thermal", "0", "100", "0", "0"], ["[Generic]Kinetic", "0", "0", "100", "0"],
["[Generic]Explosive", "0", "0", "0", "100"],
["[NPC][Asteroid] Blood Raiders", "5067", "4214", "0", "0"],
["[Bombs]Concussion Bomb", "0", "0", "6400", "0"],
["[Bombs]Electron Bomb", "6400", "0", "0", "0"],
["[Bombs]Scorch Bomb", "0", "6400", "0", "0"],
["[Bombs]Shrapnel Bomb", "0", "0", "0", "6400"],
["[Frequency Crystals][T2] Gleam", "56", "56", "0", "0"],
["[Frequency Crystals][T2] Aurora", "40", "24", "0", "0"],
["[Frequency Crystals][T2] Scorch", "72", "16", "0", "0"],
["[Frequency Crystals][T2] Conflagration", "61.6", "61.6", "0", "0"],
["[Frequency Crystals]Gamma", "61.6", "35.2", "0", "0"],
["[Frequency Crystals]Infrared", "44", "17.6", "0", "0"],
["[Frequency Crystals]Microwave", "35.2", "17.6", "0", "0"],
["[Frequency Crystals]Multifrequency", "61.6", "44", "0", "0"],
["[Frequency Crystals]Radio", "44", "0", "0", "0"],
["[Frequency Crystals]Standard", "44", "26.4", "0", "0"],
["[Frequency Crystals]Ultraviolet", "52.8", "26.4", "0", "0"],
["[Frequency Crystals]Xray", "52.8", "35.2", "0", "0"],
["[Hybrid Charges][T2] Void", "0", "61.6", "61.6", "0"],
["[Hybrid Charges][T2] Null", "0", "48", "40", "0"],
["[Hybrid Charges][T2] Javelin", "0", "64", "48", "0"],
["[Hybrid Charges][T2] Spike", "0", "32", "32", "0"],
["[Hybrid Charges]Antimatter", "0", "48", "67.2", "0"],
["[Hybrid Charges]Iridium", "0", "28.8", "38.4", "0"],
["[Hybrid Charges]Iron", "0", "19.2", "28.8", "0"],
["[Hybrid Charges]Lead", "0", "28.8", "48", "0"],
["[Hybrid Charges]Plutonium", "0", "48", "57.6", "0"],
["[Hybrid Charges]Thorium", "0", "38.4", "48", "0"],
["[Hybrid Charges]Tungsten", "0", "19.2", "38.4", "0"],
["[Hybrid Charges]Uranium", "0", "38.4", "57.6", "0"],
["[Missiles]Mjolnir", "100", "0", "0", "0"], ["[Missiles]Inferno", "0", "100", "0", "0"],
["[Missiles]Scourge", "0", "0", "100", "0"], ["[Missiles]Nova", "0", "0", "0", "100"],
["[Missiles][Structure) Standup Missile", "100", "100", "100", "100"],
["[Projectile Ammo][T2] Tremor", "0", "0", "24", "40"],
["[Projectile Ammo][T2] Quake", "0", "0", "40", "72"],
["[Projectile Ammo][T2] Hail", "0", "0", "26.4", "96.8"],
["[Projectile Ammo][T2] Barrage", "0", "0", "40", "48"],
["[Projectile Ammo]Carbonized Lead", "0", "0", "35.2", "8.8"],
["[Projectile Ammo]Depleted Uranium", "0", "26.4", "17.6", "26.4"],
["[Projectile Ammo]EMP", "79.2", "0", "8.8", "17.6"],
["[Projectile Ammo]Fusion", "0", "0", "17.6", "88"],
["[Projectile Ammo]Nuclear", "0", "0", "8.8", "35.2"],
["[Projectile Ammo]Phased Plasma", "0", "88", "17.6", "0"],
["[Projectile Ammo]Proton", "26.4", "0", "17.6", "0"],
["[Projectile Ammo]Titanium Sabot", "0", "0", "52.8", "176"],
["[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
@@ -123,59 +123,58 @@ class DefaultDatabaseValues():
eos.db.save(damageProfile)
@classmethod
def importResistProfileDefaults(self):
targetResistProfileList = []
targetResistProfileList.append(["Uniform (25%)", "0.25", "0.25", "0.25", "0.25"])
targetResistProfileList.append(["Uniform (50%)", "0.50", "0.50", "0.50", "0.50"])
targetResistProfileList.append(["Uniform (75%)", "0.75", "0.75", "0.75", "0.75"])
targetResistProfileList.append(["Uniform (90%)", "0.90", "0.90", "0.90", "0.90"])
targetResistProfileList.append(["[T1 Resist]Shield", "0.0", "0.20", "0.40", "0.50"])
targetResistProfileList.append(["[T1 Resist]Armor", "0.50", "0.45", "0.25", "0.10"])
targetResistProfileList.append(["[T1 Resist]Hull", "0.33", "0.33", "0.33", "0.33"])
targetResistProfileList.append(["[T1 Resist]Shield (+T2 DCU)", "0.125", "0.30", "0.475", "0.562"])
targetResistProfileList.append(["[T1 Resist]Armor (+T2 DCU)", "0.575", "0.532", "0.363", "0.235"])
targetResistProfileList.append(["[T1 Resist]Hull (+T2 DCU)", "0.598", "0.598", "0.598", "0.598"])
targetResistProfileList.append(["[T2 Resist]Amarr (Shield)", "0.0", "0.20", "0.70", "0.875"])
targetResistProfileList.append(["[T2 Resist]Amarr (Armor)", "0.50", "0.35", "0.625", "0.80"])
targetResistProfileList.append(["[T2 Resist]Caldari (Shield)", "0.20", "0.84", "0.76", "0.60"])
targetResistProfileList.append(["[T2 Resist]Caldari (Armor)", "0.50", "0.8625", "0.625", "0.10"])
targetResistProfileList.append(["[T2 Resist]Gallente (Shield)", "0.0", "0.60", "0.85", "0.50"])
targetResistProfileList.append(["[T2 Resist]Gallente (Armor)", "0.50", "0.675", "0.8375", "0.10"])
targetResistProfileList.append(["[T2 Resist]Minmatar (Shield)", "0.75", "0.60", "0.40", "0.50"])
targetResistProfileList.append(["[T2 Resist]Minmatar (Armor)", "0.90", "0.675", "0.25", "0.10"])
targetResistProfileList.append(["[NPC][Asteroid] Angel Cartel", "0.54", "0.42", "0.37", "0.32"])
targetResistProfileList.append(["[NPC][Asteroid] Blood Raiders", "0.34", "0.39", "0.45", "0.52"])
targetResistProfileList.append(["[NPC][Asteroid] Guristas", "0.55", "0.35", "0.3", "0.48"])
targetResistProfileList.append(["[NPC][Asteroid] Rogue Drones", "0.35", "0.38", "0.44", "0.49"])
targetResistProfileList.append(["[NPC][Asteroid] Sanshas Nation", "0.35", "0.4", "0.47", "0.53"])
targetResistProfileList.append(["[NPC][Asteroid] Serpentis", "0.49", "0.38", "0.29", "0.51"])
targetResistProfileList.append(["[NPC][Deadspace] Angel Cartel", "0.59", "0.48", "0.4", "0.32"])
targetResistProfileList.append(["[NPC][Deadspace] Blood Raiders", "0.31", "0.39", "0.47", "0.56"])
targetResistProfileList.append(["[NPC][Deadspace] Guristas", "0.57", "0.39", "0.31", "0.5"])
targetResistProfileList.append(["[NPC][Deadspace] Rogue Drones", "0.42", "0.42", "0.47", "0.49"])
targetResistProfileList.append(["[NPC][Deadspace] Sanshas Nation", "0.31", "0.39", "0.47", "0.56"])
targetResistProfileList.append(["[NPC][Deadspace] Serpentis", "0.49", "0.38", "0.29", "0.56"])
targetResistProfileList.append(["[NPC][Mission] Amarr Empire", "0.34", "0.38", "0.42", "0.46"])
targetResistProfileList.append(["[NPC][Mission] Caldari State", "0.51", "0.38", "0.3", "0.51"])
targetResistProfileList.append(["[NPC][Mission] CONCORD", "0.47", "0.46", "0.47", "0.47"])
targetResistProfileList.append(["[NPC][Mission] Gallente Federation", "0.51", "0.38", "0.31", "0.52"])
targetResistProfileList.append(["[NPC][Mission] Khanid", "0.51", "0.42", "0.36", "0.4"])
targetResistProfileList.append(["[NPC][Mission] Minmatar Republic", "0.51", "0.46", "0.41", "0.35"])
targetResistProfileList.append(["[NPC][Mission] Mordus Legion", "0.32", "0.48", "0.4", "0.62"])
targetResistProfileList.append(["[NPC][Other] Sleeper", "0.61", "0.61", "0.61", "0.61"])
targetResistProfileList.append(["[NPC][Other] Sansha Incursion", "0.65", "0.63", "0.64", "0.65"])
targetResistProfileList.append(["[NPC][Burner] Cruor (Blood Raiders)", "0.8", "0.73", "0.69", "0.67"])
targetResistProfileList.append(["[NPC][Burner] Dramiel (Angel)", "0.35", "0.48", "0.61", "0.68"])
targetResistProfileList.append(["[NPC][Burner] Daredevil (Serpentis)", "0.69", "0.59", "0.59", "0.43"])
targetResistProfileList.append(["[NPC][Burner] Succubus (Sanshas Nation)", "0.35", "0.48", "0.61", "0.68"])
targetResistProfileList.append(["[NPC][Burner] Worm (Guristas)", "0.48", "0.58", "0.69", "0.74"])
targetResistProfileList.append(["[NPC][Burner] Enyo", "0.58", "0.72", "0.86", "0.24"])
targetResistProfileList.append(["[NPC][Burner] Hawk", "0.3", "0.86", "0.79", "0.65"])
targetResistProfileList.append(["[NPC][Burner] Jaguar", "0.78", "0.65", "0.48", "0.56"])
targetResistProfileList.append(["[NPC][Burner] Vengeance", "0.66", "0.56", "0.75", "0.86"])
targetResistProfileList.append(["[NPC][Burner] Ashimmu (Blood Raiders)", "0.8", "0.76", "0.68", "0.7"])
targetResistProfileList.append(["[NPC][Burner] Talos", "0.68", "0.59", "0.59", "0.43"])
targetResistProfileList.append(["[NPC][Burner] Sentinel", "0.58", "0.45", "0.52", "0.66"])
def importResistProfileDefaults(cls):
targetResistProfileList = [["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 targetResistProfileRow in targetResistProfileList:
name, em, therm, kin, exp = targetResistProfileRow
@@ -186,9 +185,8 @@ class DefaultDatabaseValues():
eos.db.save(resistsProfile)
@classmethod
def importRequiredDefaults(self):
damageProfileList = []
damageProfileList.append(["Uniform", "25", "25", "25", "25"])
def importRequiredDefaults(cls):
damageProfileList = [["Uniform", "25", "25", "25", "25"]]
for damageProfileRow in damageProfileList:
name, em, therm, kin, exp = damageProfileRow

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2011 Anton Vorobyov
#
# This file is part of eos.
@@ -15,15 +15,16 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Column, Table, String
from sqlalchemy.orm import mapper
from eos.types import MiscData
from eos.db import saveddata_meta
from eos.types import MiscData
miscdata_table = Table("miscdata", saveddata_meta,
Column("fieldName", String, primary_key=True),
Column("fieldValue", String))
Column("fieldName", String, primary_key=True),
Column("fieldValue", String))
mapper(MiscData, miscdata_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, CheckConstraint, Boolean
from sqlalchemy.orm import relation, mapper
@@ -24,16 +24,15 @@ from eos.db import saveddata_meta
from eos.types import Module, Fit
modules_table = Table("modules", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable = False, index = True),
Column("itemID", Integer, nullable = True),
Column("dummySlot", Integer, nullable = True, default = None),
Column("ID", Integer, primary_key=True),
Column("fitID", Integer, ForeignKey("fits.ID"), nullable=False, index=True),
Column("itemID", Integer, nullable=True),
Column("dummySlot", Integer, nullable=True, default=None),
Column("chargeID", Integer),
Column("state", Integer, CheckConstraint("state >= -1"), CheckConstraint("state <= 2")),
Column("projected", Boolean, default = False, nullable = False),
Column("projected", Boolean, default=False, nullable=False),
Column("position", Integer),
CheckConstraint('("dummySlot" = NULL OR "itemID" = NULL) AND "dummySlot" != "itemID"'))
mapper(Module, modules_table,
properties = {"owner" : relation(Fit)})
properties={"owner": relation(Fit)})

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, Float
from sqlalchemy.orm import mapper
@@ -24,8 +24,8 @@ from eos.db import saveddata_meta
from eos.types import Override
overrides_table = Table("overrides", saveddata_meta,
Column("itemID", Integer, primary_key=True, index = True),
Column("attrID", Integer, primary_key=True, index = True),
Column("value", Float, nullable = False))
Column("itemID", Integer, primary_key=True, index=True),
Column("attrID", Integer, primary_key=True, index=True),
Column("value", Float, nullable=False))
mapper(Override, overrides_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,17 +15,18 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Float, Integer
from sqlalchemy.orm import mapper
from eos.db import saveddata_meta
from eos.types import Price
prices_table = Table("prices", saveddata_meta,
Column("typeID", Integer, primary_key=True),
Column("price", Float),
Column("time", Integer, nullable = False),
Column("time", Integer, nullable=False),
Column("failed", Integer))
mapper(Price, prices_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,27 +15,33 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from eos.db.util import processEager, processWhere
from eos.db import saveddata_session, sd_lock
from eos.types import *
from eos.db.saveddata.fleet import squadmembers_table
from eos.db.saveddata.fit import projectedFits_table
from sqlalchemy.sql import and_
from eos.db import saveddata_session, sd_lock
from eos.db.saveddata.fit import projectedFits_table
from eos.db.saveddata.fleet import squadmembers_table
from eos.db.util import processEager, processWhere
from eos.types import *
import eos.config
configVal = getattr(eos.config, "saveddataCache", None)
if configVal is True:
import weakref
itemCache = {}
queryCache = {}
def cachedQuery(type, amount, *keywords):
itemCache[type] = localItemCache = weakref.WeakValueDictionary()
queryCache[type] = typeQueryCache = {}
def deco(function):
localQueryCache = typeQueryCache[function] = {}
def setCache(cacheKey, args, kwargs):
items = function(*args, **kwargs)
IDs = set()
@@ -44,7 +50,7 @@ if configVal is True:
for item in stuff:
ID = getattr(item, "ID", None)
if ID is None:
#Some uncachable data, don't cache this query
# Some uncachable data, don't cache this query
del localQueryCache[cacheKey]
break
localItemCache[ID] = item
@@ -70,7 +76,7 @@ if configVal is True:
for ID in IDs:
data = localItemCache.get(ID)
if data is None:
#Fuck, some of our stuff isn't cached it seems.
# Fuck, some of our stuff isn't cached it seems.
items = setCache(cacheKey, args, kwargs)
break
items.append(data)
@@ -82,11 +88,14 @@ if configVal is True:
break
return items
return checkAndReturn
return deco
def removeCachedEntry(type, ID):
if not type in queryCache:
if type not in queryCache:
return
functionCache = queryCache[type]
for _, localCache in functionCache.iteritems():
@@ -111,11 +120,14 @@ else:
return function(*args, **kwargs)
return checkAndReturn
return deco
def removeCachedEntry(*args, **kwargs):
return
def sqlizeString(line):
# Escape backslashes first, as they will be as escape symbol in queries
# Then escape percent and underscore signs
@@ -123,6 +135,7 @@ def sqlizeString(line):
line = line.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_").replace("*", "%")
return line
@cachedQuery(User, 1, "lookfor")
def getUser(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -141,6 +154,7 @@ def getUser(lookfor, eager=None):
raise TypeError("Need integer or string as argument")
return user
@cachedQuery(Character, 1, "lookfor")
def getCharacter(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -154,17 +168,20 @@ def getCharacter(lookfor, eager=None):
elif isinstance(lookfor, basestring):
eager = processEager(eager)
with sd_lock:
character = saveddata_session.query(Character).options(*eager).filter(Character.savedName == lookfor).first()
character = saveddata_session.query(Character).options(*eager).filter(
Character.savedName == lookfor).first()
else:
raise TypeError("Need integer or string as argument")
return character
def getCharacterList(eager=None):
eager = processEager(eager)
with sd_lock:
characters = saveddata_session.query(Character).options(*eager).all()
return characters
def getCharactersForUser(lookfor, eager=None):
if isinstance(lookfor, int):
eager = processEager(eager)
@@ -174,6 +191,7 @@ def getCharactersForUser(lookfor, eager=None):
raise TypeError("Need integer as argument")
return characters
@cachedQuery(Fit, 1, "lookfor")
def getFit(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -194,6 +212,7 @@ def getFit(lookfor, eager=None):
return fit
@cachedQuery(Fleet, 1, "fleetID")
def getFleet(fleetID, eager=None):
if isinstance(fleetID, int):
@@ -208,6 +227,7 @@ def getFleet(fleetID, eager=None):
raise TypeError("Need integer as argument")
return fleet
@cachedQuery(Wing, 1, "wingID")
def getWing(wingID, eager=None):
if isinstance(wingID, int):
@@ -222,6 +242,7 @@ def getWing(wingID, eager=None):
raise TypeError("Need integer as argument")
return wing
@cachedQuery(Squad, 1, "squadID")
def getSquad(squadID, eager=None):
if isinstance(squadID, int):
@@ -236,6 +257,7 @@ def getSquad(squadID, eager=None):
raise TypeError("Need integer as argument")
return squad
def getFitsWithShip(shipID, ownerID=None, where=None, eager=None):
"""
Get all the fits using a certain ship.
@@ -257,6 +279,7 @@ def getFitsWithShip(shipID, ownerID=None, where=None, eager=None):
return fits
def getBoosterFits(ownerID=None, where=None, eager=None):
"""
Get all the fits that are flagged as a boosting ship
@@ -276,11 +299,13 @@ def getBoosterFits(ownerID=None, where=None, eager=None):
return fits
def countAllFits():
with sd_lock:
count = saveddata_session.query(Fit).count()
return count
def countFitsWithShip(shipID, ownerID=None, where=None, eager=None):
"""
Get all the fits using a certain ship.
@@ -301,6 +326,7 @@ def countFitsWithShip(shipID, ownerID=None, where=None, eager=None):
raise TypeError("ShipID must be integer")
return count
def getFitList(eager=None):
eager = processEager(eager)
with sd_lock:
@@ -308,12 +334,14 @@ def getFitList(eager=None):
return fits
def getFleetList(eager=None):
eager = processEager(eager)
with sd_lock:
fleets = saveddata_session.query(Fleet).options(*eager).all()
return fleets
@cachedQuery(Price, 1, "typeID")
def getPrice(typeID):
if isinstance(typeID, int):
@@ -323,12 +351,14 @@ def getPrice(typeID):
raise TypeError("Need integer as argument")
return price
def clearPrices():
with sd_lock:
deleted_rows = saveddata_session.query(Price).delete()
commit()
return deleted_rows
def getMiscData(field):
if isinstance(field, basestring):
with sd_lock:
@@ -337,24 +367,28 @@ def getMiscData(field):
raise TypeError("Need string as argument")
return data
def getDamagePatternList(eager=None):
eager = processEager(eager)
with sd_lock:
patterns = saveddata_session.query(DamagePattern).options(*eager).all()
return patterns
def getTargetResistsList(eager=None):
eager = processEager(eager)
with sd_lock:
patterns = saveddata_session.query(TargetResists).options(*eager).all()
return patterns
def getImplantSetList(eager=None):
eager = processEager(eager)
with sd_lock:
sets = saveddata_session.query(ImplantSet).options(*eager).all()
return sets
@cachedQuery(DamagePattern, 1, "lookfor")
def getDamagePattern(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -364,15 +398,18 @@ def getDamagePattern(lookfor, eager=None):
else:
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(DamagePattern.ID == lookfor).first()
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
DamagePattern.ID == lookfor).first()
elif isinstance(lookfor, basestring):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(DamagePattern.name == lookfor).first()
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
DamagePattern.name == lookfor).first()
else:
raise TypeError("Need integer or string as argument")
return pattern
@cachedQuery(TargetResists, 1, "lookfor")
def getTargetResists(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -382,15 +419,18 @@ def getTargetResists(lookfor, eager=None):
else:
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(TargetResists.ID == lookfor).first()
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
TargetResists.ID == lookfor).first()
elif isinstance(lookfor, basestring):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(TargetResists.name == lookfor).first()
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
TargetResists.name == lookfor).first()
else:
raise TypeError("Need integer or string as argument")
return pattern
@cachedQuery(ImplantSet, 1, "lookfor")
def getImplantSet(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -400,7 +440,8 @@ def getImplantSet(lookfor, eager=None):
else:
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(TargetResists.ID == lookfor).first()
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(
TargetResists.ID == lookfor).first()
elif isinstance(lookfor, basestring):
eager = processEager(eager)
with sd_lock:
@@ -409,13 +450,14 @@ def getImplantSet(lookfor, eager=None):
raise TypeError("Improper argument")
return pattern
def searchFits(nameLike, where=None, eager=None):
if not isinstance(nameLike, basestring):
raise TypeError("Need string as argument")
# Prepare our string for request
nameLike = u"%{0}%".format(sqlizeString(nameLike))
#Add any extra components to the search to our where clause
# Add any extra components to the search to our where clause
filter = processWhere(Fit.name.like(nameLike, escape="\\"), where)
eager = processEager(eager)
with sd_lock:
@@ -423,15 +465,18 @@ def searchFits(nameLike, where=None, eager=None):
return fits
def getSquadsIDsWithFitID(fitID):
if isinstance(fitID, int):
with sd_lock:
squads = saveddata_session.query(squadmembers_table.c.squadID).filter(squadmembers_table.c.memberID == fitID).all()
squads = saveddata_session.query(squadmembers_table.c.squadID).filter(
squadmembers_table.c.memberID == fitID).all()
squads = tuple(entry[0] for entry in squads)
return squads
else:
raise TypeError("Need integer as argument")
def getProjectedFits(fitID):
if isinstance(fitID, int):
with sd_lock:
@@ -441,12 +486,14 @@ def getProjectedFits(fitID):
else:
raise TypeError("Need integer as argument")
def getCrestCharacters(eager=None):
eager = processEager(eager)
with sd_lock:
characters = saveddata_session.query(CrestChar).options(*eager).all()
return characters
@cachedQuery(CrestChar, 1, "lookfor")
def getCrestCharacter(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -465,21 +512,25 @@ def getCrestCharacter(lookfor, eager=None):
raise TypeError("Need integer or string as argument")
return character
def getOverrides(itemID, eager=None):
if isinstance(itemID, int):
return saveddata_session.query(Override).filter(Override.itemID == itemID).all()
else:
raise TypeError("Need integer as argument")
def clearOverrides():
with sd_lock:
deleted_rows = saveddata_session.query(Override).delete()
commit()
return deleted_rows
def getAllOverrides(eager=None):
return saveddata_session.query(Override).all()
def removeInvalid(fits):
invalids = [f for f in fits if f.isInvalid]
@@ -490,14 +541,17 @@ def removeInvalid(fits):
return fits
def add(stuff):
with sd_lock:
saveddata_session.add(stuff)
def save(stuff):
add(stuff)
commit()
def remove(stuff):
removeCachedEntry(type(stuff), stuff.ID)
with sd_lock:

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey
from sqlalchemy.orm import mapper
@@ -24,8 +24,8 @@ from eos.db import saveddata_meta
from eos.types import Skill
skills_table = Table("characterSkills", saveddata_meta,
Column("characterID", ForeignKey("characters.ID"), primary_key = True, index = True),
Column("itemID", Integer, primary_key = True),
Column("_Skill__level", Integer, nullable = True))
Column("characterID", ForeignKey("characters.ID"), primary_key=True, index=True),
Column("itemID", Integer, primary_key=True),
Column("_Skill__level", Integer, nullable=True))
mapper(Skill, skills_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, Float, ForeignKey, String
from sqlalchemy.orm import mapper
@@ -24,12 +24,12 @@ from eos.db import saveddata_meta
from eos.types import TargetResists
targetResists_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("ownerID", ForeignKey("users.ID"), nullable=True))
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))
mapper(TargetResists, targetResists_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy import Table, Column, Integer, String, Boolean
from sqlalchemy.orm import mapper
@@ -24,9 +24,9 @@ from eos.db import saveddata_meta
from eos.types import User
users_table = Table("users", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("username", String, nullable = False, unique = True),
Column("password", String, nullable = False),
Column("admin", Boolean, nullable = False))
Column("ID", Integer, primary_key=True),
Column("username", String, nullable=False, unique=True),
Column("password", String, nullable=False),
Column("admin", Boolean, nullable=False))
mapper(User, users_table)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,10 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
from sqlalchemy.orm import eagerload
from sqlalchemy.sql import and_, or_
from sqlalchemy.sql import and_
replace = {"attributes": "_Item__attributes",
"modules": "_Fit__modules",
@@ -31,8 +31,9 @@ replace = {"attributes": "_Item__attributes",
"damagePattern": "_Fit__damagePattern",
"projectedFits": "_Fit__projectedFits"}
def processEager(eager):
if eager == None:
if eager is None:
return tuple()
else:
l = []
@@ -44,6 +45,7 @@ def processEager(eager):
return l
def _replacements(eagerString):
splitEager = eagerString.split(".")
for i in xrange(len(splitEager)):
@@ -54,6 +56,7 @@ def _replacements(eagerString):
return ".".join(splitEager)
def processWhere(clause, where):
if where is not None:
if not hasattr(where, "__iter__"):

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
@@ -15,15 +15,17 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
#from sqlalchemy.orm.attributes import flag_modified
import eos.db
import eos.types
# from sqlalchemy.orm.attributes import flag_modified
import logging
import eos.db
import eos.types
logger = logging.getLogger(__name__)
class HandledList(list):
def filteredItemPreAssign(self, filter, *args, **kwargs):
for element in self:
@@ -108,11 +110,12 @@ class HandledList(list):
def remove(self, thing):
# We must flag it as modified, otherwise it not be removed from the database
# @todo: flag_modified isn't in os x skel. need to rebuild to include
#flag_modified(thing, "itemID")
# flag_modified(thing, "itemID")
if thing.isInvalid: # see GH issue #324
thing.itemID = 0
list.remove(self, thing)
class HandledModuleList(HandledList):
def append(self, mod):
emptyPosition = float("Inf")
@@ -169,11 +172,12 @@ class HandledModuleList(HandledList):
self[index] = mod
def freeSlot(self, slot):
for i in range(len(self) -1, -1, -1):
for i in range(len(self) - 1, -1, -1):
mod = self[i]
if mod.getModifiedItemAttr("subSystemSlot") == slot:
del self[i]
class HandledDroneCargoList(HandledList):
def find(self, item):
for o in self:
@@ -190,6 +194,7 @@ class HandledDroneCargoList(HandledList):
if thing.isInvalid:
self.remove(thing)
class HandledImplantBoosterList(HandledList):
def append(self, thing):
if thing.isInvalid:
@@ -206,6 +211,7 @@ class HandledImplantBoosterList(HandledList):
HandledList.append(self, thing)
class HandledProjectedModList(HandledList):
def append(self, proj):
if proj.isInvalid:
@@ -232,6 +238,7 @@ class HandledProjectedModList(HandledList):
if not proj.item.isType("projected") and not isSystemEffect:
self.remove(proj)
class HandledProjectedDroneList(HandledDroneCargoList):
def append(self, proj):
proj.projected = True
@@ -241,6 +248,7 @@ class HandledProjectedDroneList(HandledDroneCargoList):
if proj.isInvalid or not proj.item.isType("projected"):
self.remove(proj)
class HandledItem(object):
def preAssignItemAttr(self, *args, **kwargs):
self.itemModifiedAttributes.preAssign(*args, **kwargs)
@@ -257,6 +265,7 @@ class HandledItem(object):
def forceItemAttr(self, *args, **kwargs):
self.itemModifiedAttributes.force(*args, **kwargs)
class HandledCharge(object):
def preAssignChargeAttr(self, *args, **kwargs):
self.chargeModifiedAttributes.preAssign(*args, **kwargs)

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
# 2010 Anton Vorobyov
#
@@ -16,4 +16,4 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================

View File

@@ -3,6 +3,8 @@
# Used by:
# Modules named like: Dynamic Fuel Valve (8 of 8)
type = "passive"
def handler(fit, container, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Propulsion Module",
"capacitorNeed", container.getModifiedItemAttr("capNeedBonus"))

View File

@@ -4,6 +4,8 @@
# Implant: Zor's Custom Navigation Hyper-Link
# Skill: Acceleration Control
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Propulsion Module",

View File

@@ -3,6 +3,8 @@
# Used by:
# Implants named like: Eifyr and Co. 'Rogue' Acceleration Control AC (6 of 6)
type = "passive"
def handler(fit, implant, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Propulsion Module",
"speedFactor", implant.getModifiedItemAttr("speedFBonus"))

View File

@@ -5,6 +5,8 @@
# Implant: Poteque 'Prospector' Archaeology AC-905
# Implant: Poteque 'Prospector' Environmental Analysis EY-1005
type = "passive"
def handler(fit, container, context):
fit.modules.filteredItemIncrease(lambda module: module.item.requiresSkill("Archaeology"),
"accessDifficultyBonus",

View File

@@ -5,7 +5,9 @@
# Implant: Poteque 'Prospector' Environmental Analysis EY-1005
# Implant: Poteque 'Prospector' Hacking HC-905
type = "passive"
def handler(fit, container, context):
fit.modules.filteredItemIncrease(lambda c: c.item.requiresSkill("Hacking"),
"accessDifficultyBonus",
container.getModifiedItemAttr("accessDifficultyBonusModifier"), position="post")
"accessDifficultyBonus",
container.getModifiedItemAttr("accessDifficultyBonusModifier"), position="post")

View File

@@ -4,5 +4,7 @@
# Modules from group: Missile Launcher Bomb (2 of 2)
# Modules from group: Shield Extender (33 of 33)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("signatureRadius", module.getModifiedItemAttr("signatureRadiusAdd"))
fit.ship.increaseItemAttr("signatureRadius", module.getModifiedItemAttr("signatureRadiusAdd"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Skill: Advanced Drone Interfacing
type = "passive"
def handler(fit, skill, context):
fit.modules.filteredItemIncrease(lambda mod: mod.item.group.name == "Fighter Support Unit",
"maxGroupActive", skill.level)

View File

@@ -5,7 +5,9 @@
# Implant: Zor's Custom Navigation Link
# Skill: Afterburner
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Afterburner"),
"duration", container.getModifiedItemAttr("durationBonus") * level)
"duration", container.getModifiedItemAttr("durationBonus") * level)

View File

@@ -5,7 +5,9 @@
# Modules from group: Nanofiber Internal Structure (7 of 7)
# Modules from group: Reinforced Bulkhead (8 of 8)
type = "passive"
def handler(fit, module, context):
fit.ship.boostItemAttr("agility",
module.getModifiedItemAttr("agilityMultiplier"),
stackingPenalties = True)
stackingPenalties=True)

View File

@@ -3,5 +3,7 @@
# Used by:
# Modules named like: Polycarbon Engine Housing (8 of 8)
type = "passive"
def handler(fit, module, context):
fit.ship.boostItemAttr("agility", module.getModifiedItemAttr("agilityMultiplier"), stackingPenalties = True)
fit.ship.boostItemAttr("agility", module.getModifiedItemAttr("agilityMultiplier"), stackingPenalties=True)

View File

@@ -8,5 +8,7 @@
# Charges from group: Advanced Pulse Laser Crystal (8 of 8)
# Charges from group: Advanced Railgun Charge (8 of 8)
type = "passive"
def handler(fit, module, context):
module.multiplyItemAttr("falloff", module.getModifiedChargeAttr("fallofMultiplier") or 1)

View File

@@ -3,6 +3,8 @@
# Used by:
# Items from category: Charge (465 of 884)
type = "passive"
def handler(fit, module, context):
# Dirty hack to work around cap charges setting cap booster
# injection amount to zero

View File

@@ -3,5 +3,7 @@
# Used by:
# Items from category: Charge (571 of 884)
type = "passive"
def handler(fit, module, context):
module.multiplyItemAttr("maxRange", module.getModifiedChargeAttr("weaponRangeMultiplier"))
module.multiplyItemAttr("maxRange", module.getModifiedChargeAttr("weaponRangeMultiplier"))

View File

@@ -5,5 +5,7 @@
# Charges from group: Interdiction Probe (2 of 2)
# Charges from group: Survey Probe (3 of 3)
type = "passive"
def handler(fit, module, context):
module.multiplyItemAttr("speed", module.getModifiedChargeAttr("speedMultiplier") or 1)

View File

@@ -9,5 +9,7 @@
# Charges from group: Advanced Railgun Charge (8 of 8)
# Charges from group: Projectile Ammo (129 of 129)
type = "passive"
def handler(fit, module, context):
module.multiplyItemAttr("trackingSpeed", module.getModifiedChargeAttr("trackingSpeedMultiplier"))
module.multiplyItemAttr("trackingSpeed", module.getModifiedChargeAttr("trackingSpeedMultiplier"))

View File

@@ -4,8 +4,11 @@
# Implants named like: grade Halo (18 of 18)
runTime = "early"
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"))
implant.getModifiedItemAttr("implantSetAngel"))

View File

@@ -3,5 +3,7 @@
# Used by:
# Modules from group: Warp Core Stabilizer (8 of 8)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("warmScrambleStatus", module.getModifiedItemAttr("warpScrambleStrength"))
fit.ship.increaseItemAttr("warmScrambleStatus", module.getModifiedItemAttr("warpScrambleStrength"))

View File

@@ -6,6 +6,8 @@
# Implant: Poteque 'Prospector' Environmental Analysis EY-1005
# Skill: Archaeology
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill("Archaeology"),

View File

@@ -4,6 +4,9 @@
# Implants named like: Exile Booster (4 of 4)
# Implant: Antipharmakon Kosybo
type = "passive"
def handler(fit, booster, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems") or mod.item.requiresSkill("Capital Repair Systems"),
"armorDamageAmount", booster.getModifiedItemAttr("armorDamageAmountBonus"))
fit.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Repair Systems") or mod.item.requiresSkill("Capital Repair Systems"),
"armorDamageAmount", booster.getModifiedItemAttr("armorDamageAmountBonus"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Modules named like: Auxiliary Nano Pump (8 of 8)
type = "passive"
def handler(fit, implant, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Capital Repair Systems"),
"armorDamageAmount", implant.getModifiedItemAttr("repairBonus"),

View File

@@ -4,6 +4,8 @@
# Skill: Armored Warfare Specialist
runTime = "early"
type = "passive"
def handler(fit, skill, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Warfare Specialist"),
"commandBonus", skill.getModifiedItemAttr("squadronCommandBonus") * skill.level)

View File

@@ -5,6 +5,8 @@
# Implant: Federation Navy Warfare Mindlink
# Implant: Imperial Navy Warfare Mindlink
type = "passive"
def handler(fit, implant, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Warfare Specialist"),
"commandBonus", implant.getModifiedItemAttr("mindlinkBonus"))
"commandBonus", implant.getModifiedItemAttr("mindlinkBonus"))

View File

@@ -3,5 +3,7 @@
# Used by:
# Modules from group: Armor Reinforcer (48 of 48)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("armorHP", module.getModifiedItemAttr("armorHPBonusAdd"))
fit.ship.increaseItemAttr("armorHP", module.getModifiedItemAttr("armorHPBonusAdd"))

View File

@@ -3,5 +3,7 @@
# Used by:
# Subsystems from group: Defensive Systems (16 of 16)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("armorHP", module.getModifiedItemAttr("armorHPBonusAdd"))

View File

@@ -5,5 +5,7 @@
# Modules from group: Armor Plating Energized (187 of 187)
# Modules named like: QA Multiship Module Players (4 of 4)
type = "passive"
def handler(fit, module, context):
fit.ship.multiplyItemAttr("armorHP", module.getModifiedItemAttr("armorHPMultiplier"))
fit.ship.multiplyItemAttr("armorHP", module.getModifiedItemAttr("armorHPMultiplier"))

View File

@@ -3,5 +3,7 @@
# Used by:
# Modules from group: Armor Reinforcer (48 of 48)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("mass", module.getModifiedItemAttr("massAddition"))
fit.ship.increaseItemAttr("mass", module.getModifiedItemAttr("massAddition"))

View File

@@ -4,7 +4,9 @@
# Modules from group: Armor Repair Unit (105 of 105)
runTime = "late"
type = "active"
def handler(fit, module, context):
amount = module.getModifiedItemAttr("armorDamageAmount")
speed = module.getModifiedItemAttr("duration") / 1000.0
fit.extraAttributes.increase("armorRepair", amount / speed)
fit.extraAttributes.increase("armorRepair", amount / speed)

View File

@@ -3,6 +3,8 @@
# Used by:
# Implants named like: Grade Asklepian (15 of 16)
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"),
"armorDamageAmount", src.getModifiedItemAttr("armorRepairBonus"))

View File

@@ -7,6 +7,10 @@
# Ship: Exequror
# Ship: Inquisitor
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Armor Repairer", "falloffEffectiveness", src.getModifiedItemAttr("falloffBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Ancillary Remote Armor Repairer", "falloffEffectiveness", src.getModifiedItemAttr("falloffBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Armor Repairer", "falloffEffectiveness",
src.getModifiedItemAttr("falloffBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Ancillary Remote Armor Repairer",
"falloffEffectiveness", src.getModifiedItemAttr("falloffBonus"))

View File

@@ -7,6 +7,10 @@
# Ship: Exequror
# Ship: Inquisitor
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Armor Repairer", "maxRange", src.getModifiedItemAttr("maxRangeBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Ancillary Remote Armor Repairer", "maxRange", src.getModifiedItemAttr("maxRangeBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Armor Repairer", "maxRange",
src.getModifiedItemAttr("maxRangeBonus"))
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Ancillary Remote Armor Repairer", "maxRange",
src.getModifiedItemAttr("maxRangeBonus"))

View File

@@ -5,5 +5,7 @@
type = "gang"
gangBoost = "armorHP"
gangBonus = "armorHpBonus"
def handler(fit, skill, context):
fit.ship.boostItemAttr(gangBoost, skill.getModifiedItemAttr(gangBonus) * skill.level)

View File

@@ -3,6 +3,8 @@
# Used by:
# Skill: Armor Layering
type = "passive"
def handler(fit, container, context):
level = container.level
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Reinforcer",

View File

@@ -7,6 +7,9 @@
type = "gang", "active"
gangBonus = "armorHpBonus2"
gangBoost = "armorHP"
def handler(fit, module, context):
if "gang" not in context: return
if "gang" not in context:
return
fit.ship.boostItemAttr("armorHP", module.getModifiedItemAttr("armorHpBonus2"))

View File

@@ -6,6 +6,8 @@
# Skill: Astrogeology
# Skill: Mining
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining"),

View File

@@ -3,7 +3,10 @@
# Used by:
# Variations of module: Scan Pinpointing Array I (2 of 2)
type = "passive"
def handler(fit, module, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Astrometrics"),
"baseMaxScanDeviation", module.getModifiedItemAttr("maxScanDeviationModifierModule"),
"baseMaxScanDeviation",
module.getModifiedItemAttr("maxScanDeviationModifierModule"),
stackingPenalties=True)

View File

@@ -5,7 +5,10 @@
# Skill: Astrometric Pinpointing
# Skill: Astrometrics
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Astrometrics"),
"baseMaxScanDeviation", container.getModifiedItemAttr("maxScanDeviationModifier") * level)
"baseMaxScanDeviation",
container.getModifiedItemAttr("maxScanDeviationModifier") * level)

View File

@@ -3,6 +3,8 @@
# Used by:
# Variations of module: Scan Rangefinding Array I (2 of 2)
type = "passive"
def handler(fit, module, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Astrometrics"),
"baseSensorStrength", module.getModifiedItemAttr("scanStrengthBonusModule"),

View File

@@ -8,6 +8,8 @@
# Skill: Astrometric Rangefinding
# Skill: Astrometrics
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
penalized = False if "skill" in context or "implant" in context else True

View File

@@ -4,6 +4,8 @@
# Ship: Myrmidon
# Ship: Prophecy
type = "passive"
def handler(fit, ship, context):
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill("Drones"),
"maxVelocity", ship.getModifiedItemAttr("roleBonusCBC"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ships named like: Harbinger (2 of 2)
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Medium Energy Turret"),
"maxRange", ship.getModifiedItemAttr("roleBonusCBC"))

View File

@@ -4,6 +4,8 @@
# Ships named like: Brutix (2 of 2)
# Ship: Ferox
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Medium Hybrid Turret"),
"maxRange", ship.getModifiedItemAttr("roleBonusCBC"))

View File

@@ -4,6 +4,8 @@
# Ships named like: Drake (2 of 2)
# Ship: Cyclone
type = "passive"
def handler(fit, skill, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"),
"maxVelocity", skill.getModifiedItemAttr("roleBonusCBC"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ships named like: Hurricane (2 of 2)
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Medium Projectile Turret"),
"maxRange", ship.getModifiedItemAttr("roleBonusCBC"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Oracle
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Energy Turret"),
"capacitorNeed", ship.getModifiedItemAttr("bcLargeTurretCap"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Oracle
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Energy Turret"),
"cpu", ship.getModifiedItemAttr("bcLargeTurretCPU"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Oracle
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Energy Turret"),
"power", ship.getModifiedItemAttr("bcLargeTurretPower"))

View File

@@ -4,6 +4,8 @@
# Ship: Naga
# Ship: Talos
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Hybrid Turret"),
"capacitorNeed", ship.getModifiedItemAttr("bcLargeTurretCap"))

View File

@@ -4,6 +4,8 @@
# Ship: Naga
# Ship: Talos
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Hybrid Turret"),
"cpu", ship.getModifiedItemAttr("bcLargeTurretCPU"))

View File

@@ -4,6 +4,8 @@
# Ship: Naga
# Ship: Talos
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Hybrid Turret"),
"power", ship.getModifiedItemAttr("bcLargeTurretPower"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Tornado
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Projectile Turret"),
"cpu", ship.getModifiedItemAttr("bcLargeTurretCPU"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Tornado
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Large Projectile Turret"),
"power", ship.getModifiedItemAttr("bcLargeTurretPower"))

View File

@@ -4,6 +4,9 @@
# Implants named like: Eifyr and Co. 'Alchemist' Biology BY (2 of 2)
# Skill: Biology
type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.boosters.filteredItemBoost(lambda bst: True, "boosterDuration", container.getModifiedItemAttr("durationBonus") * level)
fit.boosters.filteredItemBoost(lambda bst: True, "boosterDuration",
container.getModifiedItemAttr("durationBonus") * level)

View File

@@ -4,6 +4,9 @@
# Ships from group: Blockade Runner (4 of 4)
type = "passive"
runTime = "early"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Cloaking Device",
"cpu", ship.getModifiedItemAttr("eliteIndustrialCovertCloakBonus"), skill="Transport Ships")
"cpu", ship.getModifiedItemAttr("eliteIndustrialCovertCloakBonus"),
skill="Transport Ships")

View File

@@ -3,5 +3,7 @@
# Used by:
# Implants from group: Booster (12 of 45)
type = "boosterSideEffect"
def handler(fit, booster, context):
fit.ship.boostItemAttr("armorHP", booster.getModifiedItemAttr("boosterArmorHPPenalty"))

View File

@@ -5,6 +5,8 @@
# Implants named like: Mindflood Booster (3 of 4)
# Implants named like: Sooth Sayer Booster (3 of 4)
type = "boosterSideEffect"
def handler(fit, booster, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Repair Unit",
"armorDamageAmount", booster.getModifiedItemAttr("boosterArmorRepairAmountPenalty"))

View File

@@ -4,5 +4,7 @@
# Implants named like: Blue Pill Booster (3 of 5)
# Implants named like: Exile Booster (3 of 4)
type = "boosterSideEffect"
def handler(fit, booster, context):
fit.ship.boostItemAttr("capacitorCapacity", booster.getModifiedItemAttr("boosterCapacitorCapacityPenalty"))

View File

@@ -3,5 +3,7 @@
# Used by:
# Implants from group: Booster (12 of 45)
type = "boosterSideEffect"
def handler(fit, booster, context):
fit.ship.boostItemAttr("maxVelocity", booster.getModifiedItemAttr("boosterMaxVelocityPenalty"))

View File

@@ -4,6 +4,8 @@
# Implants named like: Exile Booster (3 of 4)
# Implants named like: Mindflood Booster (3 of 4)
type = "boosterSideEffect"
def handler(fit, booster, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"),
"aoeCloudSize", booster.getModifiedItemAttr("boosterMissileAOECloudPenalty"))

Some files were not shown because too many files have changed in this diff Show More