Add a ton of default values

This commit is contained in:
Ebag333
2017-02-09 00:56:33 -08:00
parent f2c84692a9
commit 7865219164
27 changed files with 104 additions and 7 deletions

View File

@@ -18,6 +18,7 @@
# ===============================================================================
import sqlalchemy
from sqlalchemy.exc import DatabaseError
import logging
logger = logging.getLogger(__name__)
@@ -32,7 +33,7 @@ class DatabaseCleanup(object):
try:
results = saveddata_engine.execute(query)
return results
except sqlalchemy.exc.DatabaseError:
except DatabaseError:
logger.error("Failed to connect to database or error executing query:\n%s", query)
return None

View File

@@ -74,6 +74,9 @@ commandFits_table = Table("commandFits", saveddata_meta,
class ProjectedFit(object):
victim_fit = None
victimID = None
def __init__(self, sourceID, source_fit, amount=1, active=True):
self.sourceID = sourceID
self.source_fit = source_fit
@@ -105,6 +108,9 @@ class ProjectedFit(object):
class CommandFit(object):
boosted_fit = None
boostedID = None
def __init__(self, boosterID, booster_fit, active=True):
self.boosterID = boosterID
self.booster_fit = booster_fit

View File

@@ -242,6 +242,8 @@ class HandledProjectedDroneList(HandledDroneCargoList):
class HandledItem(object):
itemModifiedAttributes = None
def preAssignItemAttr(self, *args, **kwargs):
self.itemModifiedAttributes.preAssign(*args, **kwargs)
@@ -259,6 +261,8 @@ class HandledItem(object):
class HandledCharge(object):
chargeModifiedAttributes = None
def preAssignChargeAttr(self, *args, **kwargs):
self.chargeModifiedAttributes.preAssign(*args, **kwargs)

View File

@@ -19,6 +19,8 @@
class EqBase(object):
ID = None
def __eq__(self, other):
return type(self) == type(other) and self.ID == other.ID

View File

@@ -45,6 +45,9 @@ class Effect(EqBase):
# Filter to change names of effects to valid python method names
nameFilter = re.compile("[^A-Za-z0-9]")
def __init__(self):
self.name = None
@reconstructor
def init(self):
"""
@@ -201,12 +204,25 @@ def effectDummy(*args, **kwargs):
class Item(EqBase):
typeID = None
name = None
group = None
effects = None
raceID = None
factionID = None
category = None
ID = None
__attributes = None
MOVE_ATTRS = (4, # Mass
38, # Capacity
161) # Volume
MOVE_ATTR_INFO = None
def __init__(self):
pass
@classmethod
def getMoveAttrInfo(cls):
info = getattr(cls, "MOVE_ATTR_INFO", None)
@@ -435,18 +451,22 @@ class EffectInfo(EqBase):
class AttributeInfo(EqBase):
pass
name = None
class Attribute(EqBase):
pass
value = None
attributeID = None
class Category(EqBase):
pass
name = None
class AlphaClone(EqBase):
def __init__(self):
self.skills = None
@reconstructor
def init(self):
self.skillCache = {}
@@ -466,7 +486,8 @@ class AlphaCloneSkill(EqBase):
class Group(EqBase):
pass
category = None
name = None
class Icon(EqBase):
@@ -474,6 +495,11 @@ class Icon(EqBase):
class MarketGroup(EqBase):
def __init__(self):
self.parent = None
self.name = None
self.ID = None
def __repr__(self):
return u"MarketGroup(ID={}, name={}, parent={}) at {}".format(
self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self))
@@ -485,6 +511,9 @@ class MetaGroup(EqBase):
class MetaType(EqBase):
def __init__(self):
self.parent = None
pass

View File

@@ -31,9 +31,13 @@ logger = logging.getLogger(__name__)
class Character(object):
ownerID = None
savedName = None
ID = None
__itemList = None
__itemIDMap = None
__itemNameMap = None
apiID = None
@classmethod
def getSkillList(cls):

View File

@@ -24,6 +24,9 @@ from sqlalchemy.orm import reconstructor
class CrestChar(object):
name = None
ID = None
def __init__(self, id, name, refresh_token=None):
self.ID = id
self.name = name

View File

@@ -21,6 +21,9 @@ import re
class DamagePattern(object):
name = None
ID = None
Name = None
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
def __init__(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25):

View File

@@ -33,6 +33,7 @@ logger = logging.getLogger(__name__)
class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal")
DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm")
owner = None
def __init__(self, item):
"""Initialize a fighter from the program"""

View File

@@ -27,6 +27,7 @@ logger = logging.getLogger(__name__)
class FighterAbility(object):
DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal")
DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm")
fighter = None
# We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed
# with the fighter squadron role

View File

@@ -49,6 +49,18 @@ class ImplantLocation(Enum):
class Fit(object):
"""Represents a fitting, with modules, ship, implants, etc."""
name = None
shipID = None
booster = None
ownerID = None
__projectedFits = None
__commandFits = None
projectedOnto = None
boostedOnto = None
ID = None
owner = None
notes = None
PEAK_RECHARGE = 0.25
def __init__(self, ship=None, name=""):

View File

@@ -29,6 +29,8 @@ logger = logging.getLogger(__name__)
class Implant(HandledItem, ItemAttrShortcut):
ID = None
def __init__(self, item):
self.__item = item

View File

@@ -71,6 +71,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def __init__(self, item):
"""Initialize a module from the program"""
self.owner = None
self.dummySlot = None
self.__item = item
if item is not None and self.isInvalid:

View File

@@ -28,6 +28,8 @@ logger = logging.getLogger(__name__)
class Override(EqBase):
itemID = None
def __init__(self, item, attr, value):
self.itemID = item.ID
self.__item = item

View File

@@ -22,6 +22,8 @@ import re
class TargetResists(object):
# also determined import/export order - VERY IMPORTANT
name = None
ID = None
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
def __init__(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0):

View File

@@ -25,6 +25,9 @@ from sqlalchemy.orm import validates
class User(object):
username = None
ID = None
def __init__(self, username, password=None, admin=False):
self.username = username
if password is not None: