Skip to content

Commit

Permalink
Merge branch 'master' into crowdin_master
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann committed Mar 24, 2022
2 parents bb38ba6 + ee6b57e commit 51e351d
Show file tree
Hide file tree
Showing 526 changed files with 396,629 additions and 267,274 deletions.
2 changes: 2 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
version = None
language = None

API_CLIENT_ID = '095d8cd841ac40b581330919b49fe746'
ESI_CACHE = 'esi_cache'
SSO_CALLBACK = 'https://pyfa-org.github.io/Pyfa/callback'

LOGLEVEL_MAP = {
"critical": CRITICAL,
Expand Down
47 changes: 43 additions & 4 deletions db_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import sqlite3
import sys

import sqlalchemy.orm
from sqlalchemy import or_, and_


# todo: need to set the EOS language to en, becasuse this assumes it's being run within an English context
# Need to know what that would do if called from pyfa
Expand Down Expand Up @@ -132,7 +135,7 @@ def _addRows(data, cls, fieldMap=None):

def processEveTypes():
print('processing evetypes')
data = _readData('fsd_lite', 'evetypes', keyIdName='typeID')
data = _readData('fsd_binary', 'types', keyIdName='typeID')
for row in data:
if (
# Apparently people really want Civilian modules available
Expand All @@ -144,6 +147,7 @@ def processEveTypes():
# Nearly useless and clutter search results too much
elif (
row['typeName_en-us'].startswith('Limited Synth ') or
row['typeName_en-us'].startswith('Expired ') or
row['typeName_en-us'].endswith(' Filament') and (
"'Needlejack'" not in row['typeName_en-us'] and
"'Devana'" not in row['typeName_en-us'] and
Expand Down Expand Up @@ -179,15 +183,15 @@ def processEveTypes():

def processEveGroups():
print('processing evegroups')
data = _readData('fsd_lite', 'evegroups', keyIdName='groupID')
data = _readData('fsd_binary', 'groups', keyIdName='groupID')
map = {'groupName_en-us': 'name'}
map.update({'groupName'+v: 'name'+v for (k, v) in eos.config.translation_mapping.items() if k != 'en'})
_addRows(data, eos.gamedata.Group, fieldMap=map)
return data

def processEveCategories():
print('processing evecategories')
data = _readData('fsd_lite', 'evecategories', keyIdName='categoryID')
data = _readData('fsd_binary', 'categories', keyIdName='categoryID')
map = { 'categoryName_en-us': 'name' }
map.update({'categoryName'+v: 'name'+v for (k, v) in eos.config.translation_mapping.items() if k != 'en'})
_addRows(data, eos.gamedata.Category, fieldMap=map)
Expand Down Expand Up @@ -591,7 +595,17 @@ def processImplantSets(eveTypesData):
# pyfa, we can do it here as a post-processing step
for attr in eos.db.gamedata_session.query(eos.gamedata.Attribute).filter(eos.gamedata.Attribute.ID == 1367).all():
attr.value = 4.0
for item in eos.db.gamedata_session.query(eos.gamedata.Item).filter(eos.gamedata.Item.name.like('%abyssal%')).all():
for item in eos.db.gamedata_session.query(eos.gamedata.Item).filter(or_(
eos.gamedata.Item.name.like('%abyssal%'),
eos.gamedata.Item.name.like('%mutated%'),
eos.gamedata.Item.name.like('%_PLACEHOLDER%'),
# Drifter weapons are published for some reason
eos.gamedata.Item.name.in_(('Lux Kontos', 'Lux Xiphos'))
)).all():
if 'Asteroid Mining Crystal' in item.name:
continue
if 'Mutated Drone Specialization' in item.name:
continue
item.published = False

for x in [
Expand All @@ -601,6 +615,31 @@ def processImplantSets(eveTypesData):
print ('Removing Category: {}'.format(cat.name))
eos.db.gamedata_session.delete(cat)

# Unused normally, can be useful for customizing items
def _hardcodeAttribs(typeID, attrMap):
for attrName, value in attrMap.items():
try:
attr = eos.db.gamedata_session.query(eos.gamedata.Attribute).filter(and_(
eos.gamedata.Attribute.name == attrName, eos.gamedata.Attribute.typeID == typeID)).one()
except sqlalchemy.orm.exc.NoResultFound:
attrInfo = eos.db.gamedata_session.query(eos.gamedata.AttributeInfo).filter(eos.gamedata.AttributeInfo.name == attrName).one()
attr = eos.gamedata.Attribute()
attr.ID = attrInfo.ID
attr.typeID = typeID
attr.value = value
eos.db.gamedata_session.add(attr)
else:
attr.value = value

def _hardcodeEffects(typeID, effectMap):
item = eos.db.gamedata_session.query(eos.gamedata.Item).filter(eos.gamedata.Item.ID == typeID).one()
item.effects.clear()
for effectID, effectName in effectMap.items():
effect = eos.gamedata.Effect()
effect.effectID = effectID
effect.effectName = effectName
item.effects[effectName] = effect

eos.db.gamedata_session.commit()
eos.db.gamedata_engine.execute('VACUUM')

Expand Down
2 changes: 1 addition & 1 deletion eos/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_gamedata_session():
pyfalog.debug('Importing saveddata DB scheme')
# noinspection PyPep8
from eos.db.saveddata import booster, cargo, character, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, \
miscData, mutator, module, override, price, queries, skill, targetProfile, user
miscData, mutatorMod, mutatorDrone, module, override, price, queries, skill, targetProfile, user

pyfalog.debug('Importing gamedata queries')
# noinspection PyPep8
Expand Down
2 changes: 1 addition & 1 deletion eos/db/gamedata/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================

from sqlalchemy import Boolean, Column, Float, ForeignKey, Integer, String, Table
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Table
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import backref, deferred, mapper, relation, synonym
from sqlalchemy.orm.collections import attribute_mapped_collection
Expand Down
18 changes: 18 additions & 0 deletions eos/db/migrations/upgrade45.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Migration 45
- Drone mutaplasmid support
"""

import sqlalchemy


def upgrade(saveddata_engine):
try:
saveddata_engine.execute("SELECT baseItemID FROM drones LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE drones ADD COLUMN baseItemID INTEGER;")
try:
saveddata_engine.execute("SELECT mutaplasmidID FROM drones LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE drones ADD COLUMN mutaplasmidID INTEGER;")
68 changes: 68 additions & 0 deletions eos/db/migrations/upgrade46.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""
Migration 46
- Mining crystal changes
"""

CONVERSIONS = {
60276: ( # Simple Asteroid Mining Crystal Type A I
18066, # Veldspar Mining Crystal I
18062, # Scordite Mining Crystal I
18060, # Pyroxeres Mining Crystal I
18058, # Plagioclase Mining Crystal I
),
60281: ( # Simple Asteroid Mining Crystal Type A II
18618, # Veldspar Mining Crystal II
18616, # Scordite Mining Crystal II
18614, # Pyroxeres Mining Crystal II
18612, # Plagioclase Mining Crystal II
),
60285: ( # Coherent Asteroid Mining Crystal Type A I
18056, # Omber Mining Crystal I
18052, # Kernite Mining Crystal I
18050, # Jaspet Mining Crystal I
18048, # Hemorphite Mining Crystal I
18046, # Hedbergite Mining Crystal I
),
60288: ( # Coherent Asteroid Mining Crystal Type A II
18610, # Omber Mining Crystal II
18604, # Jaspet Mining Crystal II
18606, # Kernite Mining Crystal II
18600, # Hedbergite Mining Crystal II
18602, # Hemorphite Mining Crystal II
),
60291: ( # Variegated Asteroid Mining Crystal Type A I
18044, # Gneiss Mining Crystal I
18042, # Dark Ochre Mining Crystal I
18040, # Crokite Mining Crystal I
),
60294: ( # Variegated Asteroid Mining Crystal Type A II
18598, # Gneiss Mining Crystal II
18596, # Dark Ochre Mining Crystal II
18594, # Crokite Mining Crystal II
),
60297: ( # Complex Asteroid Mining Crystal Type A I
18038, # Bistot Mining Crystal I
18036, # Arkonor Mining Crystal I
18064, # Spodumain Mining Crystal I
),
60300: ( # Complex Asteroid Mining Crystal Type A II
18592, # Bistot Mining Crystal II
18590, # Arkonor Mining Crystal II
18624, # Spodumain Mining Crystal II
),
}


def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "modules" SET "baseItemID" = ? WHERE "baseItemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "modules" SET "chargeID" = ? WHERE "chargeID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
3 changes: 2 additions & 1 deletion eos/db/saveddata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
__all__ = [
"character",
"fit",
"mutator",
"mutatorMod",
"mutatorDrone",
"module",
"user",
"skill",
Expand Down
20 changes: 14 additions & 6 deletions eos/db/saveddata/drone.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,35 @@
# ===============================================================================

from sqlalchemy import Table, Column, Integer, Float, ForeignKey, Boolean, DateTime
from sqlalchemy.orm import mapper, relation
from sqlalchemy.orm import mapper, relation, synonym
from sqlalchemy.orm.collections import attribute_mapped_collection
import datetime

from eos.db import saveddata_meta
from eos.saveddata.drone import Drone
from eos.saveddata.fit import Fit
from eos.saveddata.mutator import MutatorDrone

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("baseItemID", Integer, nullable=True),
Column("mutaplasmidID", Integer, nullable=True),
Column("amount", Integer, nullable=False),
Column("amountActive", Integer, nullable=False),
Column("projected", Boolean, default=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now),
Column("projectionRange", Float, nullable=True)
)
Column("projectionRange", Float, nullable=True))


mapper(Drone, drones_table,
properties={
"owner": relation(Fit)
}
)
"ID": synonym("groupID"),
"owner": relation(Fit),
"mutators": relation(
MutatorDrone,
backref="item",
cascade="all,delete-orphan",
collection_class=attribute_mapped_collection('attrID'))})
13 changes: 6 additions & 7 deletions eos/db/saveddata/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
# ===============================================================================

from sqlalchemy import Table, Column, Integer, Float, ForeignKey, CheckConstraint, Boolean, DateTime
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.orm import relation, mapper
from sqlalchemy.orm.collections import attribute_mapped_collection
import datetime

from eos.db import saveddata_meta
from eos.saveddata.module import Module
from eos.saveddata.mutator import Mutator
from eos.saveddata.fit import Fit
from eos.saveddata.mutator import MutatorModule

modules_table = Table("modules", saveddata_meta,
Column("ID", Integer, primary_key=True),
Expand All @@ -45,13 +45,12 @@
Column("projectionRange", Float, nullable=True),
CheckConstraint('("dummySlot" = NULL OR "itemID" = NULL) AND "dummySlot" != "itemID"'))


mapper(Module, modules_table,
properties={
"owner": relation(Fit),
"mutators": relation(
Mutator,
backref="module",
MutatorModule,
backref="item",
cascade="all,delete-orphan",
collection_class=attribute_mapped_collection('attrID')
)
})
collection_class=attribute_mapped_collection('attrID'))})
17 changes: 9 additions & 8 deletions eos/db/saveddata/mutator.py → eos/db/saveddata/mutatorDrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
from sqlalchemy.orm import mapper

from eos.db import saveddata_meta
from eos.saveddata.mutator import Mutator
from eos.saveddata.mutator import MutatorDrone

mutator_table = Table("mutators", saveddata_meta,
Column("moduleID", Integer, ForeignKey("modules.ID"), primary_key=True, index=True),
Column("attrID", Integer, primary_key=True, index=True),
Column("value", Float, nullable=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now))
mutatorDrones_table = Table(
"mutatorsDrones", saveddata_meta,
Column("groupID", Integer, ForeignKey("drones.groupID"), primary_key=True, index=True),
Column("attrID", Integer, primary_key=True, index=True),
Column("value", Float, nullable=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now))

mapper(Mutator, mutator_table)
mapper(MutatorDrone, mutatorDrones_table)
36 changes: 36 additions & 0 deletions eos/db/saveddata/mutatorMod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================

import datetime

from sqlalchemy import Column, DateTime, Float, ForeignKey, Integer, Table
from sqlalchemy.orm import mapper

from eos.db import saveddata_meta
from eos.saveddata.mutator import MutatorModule

mutatorMods_table = Table(
"mutators", saveddata_meta,
Column("moduleID", Integer, ForeignKey("modules.ID"), primary_key=True, index=True),
Column("attrID", Integer, primary_key=True, index=True),
Column("value", Float, nullable=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now))

mapper(MutatorModule, mutatorMods_table)
Loading

0 comments on commit 51e351d

Please sign in to comment.