diff --git a/eos/db/gamedata/item.py b/eos/db/gamedata/item.py index 2683a41e9..16f1fd134 100644 --- a/eos/db/gamedata/item.py +++ b/eos/db/gamedata/item.py @@ -25,7 +25,7 @@ from sqlalchemy.orm.collections import attribute_mapped_collection from eos.db import gamedata_meta from eos.db.gamedata.dynamicAttributes import dynamicApplicable_table from eos.db.gamedata.effect import typeeffects_table -from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, MetaType, Traits +from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, Traits, MetaGroup items_table = Table("invtypes", gamedata_meta, Column("typeID", Integer, primary_key=True), @@ -41,9 +41,11 @@ items_table = Table("invtypes", gamedata_meta, Column("iconID", Integer), Column("graphicID", Integer), Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True), + Column("metaLevel", Integer), + Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID"), index=True), + Column("variationParentTypeID", Integer, ForeignKey("invtypes.typeID"), index=True), Column("replacements", String)) -from .metaGroup import metatypes_table # noqa from .traits import traits_table # noqa mapper(Item, items_table, @@ -51,9 +53,8 @@ mapper(Item, items_table, "group" : relation(Group, backref=backref("items", cascade="all,delete")), "_Item__attributes": relation(Attribute, cascade='all, delete, delete-orphan', collection_class=attribute_mapped_collection('name')), "effects": relation(Effect, secondary=typeeffects_table, collection_class=attribute_mapped_collection('name')), - "metaGroup" : relation(MetaType, - primaryjoin=metatypes_table.c.typeID == items_table.c.typeID, - uselist=False), + "metaGroup" : relation(MetaGroup, backref=backref("items", cascade="all,delete")), + "varParent" : relation(Item, backref=backref("varChildren", cascade="all,delete"), remote_side=items_table.c.typeID), "ID" : synonym("typeID"), "name" : synonym("typeName"), "description" : deferred(items_table.c.description), @@ -64,7 +65,6 @@ mapper(Item, items_table, primaryjoin=dynamicApplicable_table.c.applicableTypeID == items_table.c.typeID, secondaryjoin=dynamicApplicable_table.c.typeID == DynamicItem.typeID, secondary=dynamicApplicable_table, - backref="applicableItems") - }) + backref="applicableItems")}) Item.category = association_proxy("group", "category") diff --git a/eos/db/gamedata/metaGroup.py b/eos/db/gamedata/metaGroup.py index 3c044a1cf..05221c44d 100644 --- a/eos/db/gamedata/metaGroup.py +++ b/eos/db/gamedata/metaGroup.py @@ -17,35 +17,17 @@ # along with eos. If not, see . # =============================================================================== -from sqlalchemy import Table, Column, Integer, ForeignKey, String -from sqlalchemy.ext.associationproxy import association_proxy -from sqlalchemy.orm import relation, mapper, synonym +from sqlalchemy import Table, Column, Integer, String +from sqlalchemy.orm import mapper, synonym from eos.db import gamedata_meta -from eos.db.gamedata.item import items_table -from eos.gamedata import Item, MetaGroup, MetaType +from eos.gamedata import MetaGroup metagroups_table = Table("invmetagroups", gamedata_meta, 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("parentTypeID", Integer, ForeignKey("invtypes.typeID")), - Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID"))) - mapper(MetaGroup, metagroups_table, 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) - }) - -MetaType.name = association_proxy("info", "name") + "name": synonym("metaGroupName")}) diff --git a/eos/db/gamedata/queries.py b/eos/db/gamedata/queries.py index 4bd165c35..8ed334669 100644 --- a/eos/db/gamedata/queries.py +++ b/eos/db/gamedata/queries.py @@ -23,8 +23,8 @@ from sqlalchemy.sql import and_, or_, select import eos.config from eos.db import gamedata_session +from eos.db.gamedata.item import items_table from eos.db.gamedata.group import groups_table -from eos.db.gamedata.metaGroup import items_table, metatypes_table from eos.db.util import processEager, processWhere from eos.gamedata import AlphaClone, Attribute, AttributeInfo, Category, DynamicItem, Group, Item, MarketGroup, MetaData, MetaGroup @@ -259,6 +259,10 @@ def getMetaGroup(lookfor, eager=None): return metaGroup +def getMetaGroups(): + return gamedata_session.query(MetaGroup).all() + + @cachedQuery(1, "lookfor") def getMarketGroup(lookfor, eager=None): if isinstance(lookfor, int): @@ -342,11 +346,9 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None): if len(itemids) == 0: return [] - itemfilter = or_(*(metatypes_table.c.parentTypeID == itemid for itemid in itemids)) + itemfilter = or_(*(items_table.c.variationParentTypeID == 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)).filter(filter).all() if vars: return vars diff --git a/eos/effects.py b/eos/effects.py index 9989c27ea..6dfedd27d 100644 --- a/eos/effects.py +++ b/eos/effects.py @@ -11746,7 +11746,7 @@ class Effect3771(BaseEffect): armorHPBonusAddPassive Used by: - Subsystems from group: Defensive Systems (9 of 12) + Subsystems from group: Defensive Subsystem (9 of 12) """ type = 'passive' @@ -11761,7 +11761,7 @@ class Effect3773(BaseEffect): hardPointModifierEffect Used by: - Subsystems from group: Offensive Systems (12 of 12) + Subsystems from group: Offensive Subsystem (12 of 12) """ type = 'passive' @@ -11794,7 +11794,7 @@ class Effect3782(BaseEffect): powerOutputAddPassive Used by: - Subsystems from group: Offensive Systems (8 of 12) + Subsystems from group: Offensive Subsystem (8 of 12) """ type = 'passive' @@ -11809,7 +11809,7 @@ class Effect3783(BaseEffect): cpuOutputAddCpuOutputPassive Used by: - Subsystems from group: Offensive Systems (8 of 12) + Subsystems from group: Offensive Subsystem (8 of 12) """ type = 'passive' @@ -11824,7 +11824,7 @@ class Effect3797(BaseEffect): droneBandwidthAddPassive Used by: - Subsystems from group: Offensive Systems (12 of 12) + Subsystems from group: Offensive Subsystem (12 of 12) """ type = 'passive' @@ -11839,7 +11839,7 @@ class Effect3799(BaseEffect): droneCapacityAdddroneCapacityPassive Used by: - Subsystems from group: Offensive Systems (12 of 12) + Subsystems from group: Offensive Subsystem (12 of 12) """ type = 'passive' @@ -11869,7 +11869,7 @@ class Effect3808(BaseEffect): signatureRadiusAddPassive Used by: - Subsystems from group: Defensive Systems (8 of 12) + Subsystems from group: Defensive Subsystem (8 of 12) Subsystems named like: Propulsion Interdiction Nullifier (4 of 4) """ @@ -11916,7 +11916,7 @@ class Effect3831(BaseEffect): shieldCapacityAddPassive Used by: - Subsystems from group: Defensive Systems (8 of 12) + Subsystems from group: Defensive Subsystem (8 of 12) """ type = 'passive' @@ -18769,7 +18769,7 @@ class Effect5262(BaseEffect): covertOpsCloakCpuPenalty Used by: - Subsystems from group: Defensive Systems (8 of 12) + Subsystems from group: Defensive Subsystem (8 of 12) """ type = 'passive' @@ -18785,7 +18785,7 @@ class Effect5263(BaseEffect): covertCynoCpuPenalty Used by: - Subsystems from group: Defensive Systems (8 of 12) + Subsystems from group: Defensive Subsystem (8 of 12) """ type = 'passive' @@ -18817,7 +18817,7 @@ class Effect5265(BaseEffect): warfareLinkCpuPenalty Used by: - Subsystems from group: Offensive Systems (8 of 12) + Subsystems from group: Offensive Subsystem (8 of 12) """ type = 'passive' @@ -36010,7 +36010,7 @@ class Effect7232(BaseEffect): modifyDamageMultiplierBonusMax Used by: - Implants named like: Low Grade Mimesis (5 of 6) + Implants named like: Grade Mimesis (10 of 12) """ type = 'passive' @@ -36027,7 +36027,7 @@ class Effect7233(BaseEffect): modifyDamageMultiplierBonusPerCycle Used by: - Implants named like: Low Grade Mimesis (5 of 6) + Implants named like: Grade Mimesis (10 of 12) """ type = 'passive' @@ -36044,7 +36044,7 @@ class Effect7234(BaseEffect): implantSetMimesis Used by: - Implants named like: Low Grade Mimesis (6 of 6) + Implants named like: Grade Mimesis (12 of 12) """ runTime = 'early' diff --git a/eos/gamedata.py b/eos/gamedata.py index 8041f78b9..bdd7b3a1d 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -609,10 +609,6 @@ class MetaGroup(EqBase): pass -class MetaType(EqBase): - pass - - class Unit(EqBase): def __init__(self): diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index ba01618fd..8864ace65 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -122,7 +122,7 @@ class Booster(HandledItem, ItemAttrShortcut): (effect.isType("passive") or effect.isType("boosterSideEffect")): if effect.isType("boosterSideEffect") and effect not in self.activeSideEffectEffects: continue - effect.handler(fit, self, ("booster",), None) + effect.handler(fit, self, ("booster",), None, effect=effect) @validates("ID", "itemID", "ammoID", "active") def validator(self, key, val): diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 4cc1bf566..084f33d37 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -422,7 +422,7 @@ class Skill(HandledItem): (not fit.isStructure or effect.isType("structure")) and \ effect.activeByDefault: try: - effect.handler(fit, self, ("skill",), None) + effect.handler(fit, self, ("skill",), None, effect=effect) except AttributeError: continue diff --git a/eos/saveddata/drone.py b/eos/saveddata/drone.py index 1703b48e2..5dbfdfb5d 100644 --- a/eos/saveddata/drone.py +++ b/eos/saveddata/drone.py @@ -334,7 +334,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): if self.charge: for effect in self.charge.effects.values(): if effect.runTime == runTime and effect.activeByDefault: - effect.handler(fit, self, ("droneCharge",), projectionRange) + effect.handler(fit, self, ("droneCharge",), projectionRange, effect=effect) def __deepcopy__(self, memo): copy = Drone(self.item) diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index c7e4f48a7..92ae10474 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -95,7 +95,7 @@ class Implant(HandledItem, ItemAttrShortcut): return for effect in self.item.effects.values(): if effect.runTime == runTime and effect.isType("passive") and effect.activeByDefault: - effect.handler(fit, self, ("implant",), None) + effect.handler(fit, self, ("implant",), None, effect=effect) @validates("fitID", "itemID", "active") def validator(self, key, val): diff --git a/eos/saveddata/mode.py b/eos/saveddata/mode.py index 33a1754df..0de41140d 100644 --- a/eos/saveddata/mode.py +++ b/eos/saveddata/mode.py @@ -54,7 +54,7 @@ class Mode(ItemAttrShortcut, HandledItem): if self.item: for effect in self.item.effects.values(): if effect.runTime == runTime and effect.activeByDefault: - effect.handler(fit, self, ("module",), None) + effect.handler(fit, self, ("module",), None, effect=effect) def __deepcopy__(self, memo): copy = Mode(self.item) diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index b37c91199..68faedf3d 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -882,7 +882,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): and not forceProjected \ and effect.activeByDefault \ and ((gang and effect.isType("gang")) or not gang): - effect.handler(fit, self, context, projectionRange) + effect.handler(fit, self, context, projectionRange, effect=effect) for effect in self.item.effects.values(): if effect.runTime == runTime and \ diff --git a/eos/saveddata/ship.py b/eos/saveddata/ship.py index d032bbfbe..4b87b1bd9 100644 --- a/eos/saveddata/ship.py +++ b/eos/saveddata/ship.py @@ -98,7 +98,7 @@ class Ship(ItemAttrShortcut, HandledItem): # skillbook modifiers will use the stale modifier value # GH issue #351 fit.register(self) - effect.handler(fit, self, ("ship",), None) + effect.handler(fit, self, ("ship",), None, effect=effect) def validateModeItem(self, item, owner=None): """ Checks if provided item is a valid mode """ diff --git a/eve.db b/eve.db index 57397c877..16c419360 100644 Binary files a/eve.db and b/eve.db differ diff --git a/graphs/gui/frame.py b/graphs/gui/frame.py index cfb311edb..47261c292 100644 --- a/graphs/gui/frame.py +++ b/graphs/gui/frame.py @@ -116,9 +116,7 @@ class GraphFrame(AuxiliaryFrame): self.SetMinSize(newSize) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/graphs/gui/lists.py b/graphs/gui/lists.py index a4ba0b947..d98fea6bb 100644 --- a/graphs/gui/lists.py +++ b/graphs/gui/lists.py @@ -152,10 +152,10 @@ class BaseWrapperList(gui.display.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + modifiers = event.GetModifiers() + if keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: self.removeWrappers(self.getSelectedWrappers()) event.Skip() diff --git a/gui/builtinAdditionPanes/boosterView.py b/gui/builtinAdditionPanes/boosterView.py index 60785b73f..5b17515a9 100644 --- a/gui/builtinAdditionPanes/boosterView.py +++ b/gui/builtinAdditionPanes/boosterView.py @@ -88,12 +88,12 @@ class BoosterView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: boosters = self.getSelectedBoosters() self.removeBoosters(boosters) event.Skip() diff --git a/gui/builtinAdditionPanes/cargoView.py b/gui/builtinAdditionPanes/cargoView.py index ce133fc00..e28a1c3eb 100644 --- a/gui/builtinAdditionPanes/cargoView.py +++ b/gui/builtinAdditionPanes/cargoView.py @@ -104,12 +104,12 @@ class CargoView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: cargos = self.getSelectedCargos() self.removeCargos(cargos) event.Skip() diff --git a/gui/builtinAdditionPanes/commandView.py b/gui/builtinAdditionPanes/commandView.py index 2499d051c..272c51d8a 100644 --- a/gui/builtinAdditionPanes/commandView.py +++ b/gui/builtinAdditionPanes/commandView.py @@ -102,12 +102,12 @@ class CommandView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: commandFits = self.getSelectedCommandFits() self.removeCommandFits(commandFits) event.Skip() diff --git a/gui/builtinAdditionPanes/droneView.py b/gui/builtinAdditionPanes/droneView.py index 105e4710f..efd4b62a3 100644 --- a/gui/builtinAdditionPanes/droneView.py +++ b/gui/builtinAdditionPanes/droneView.py @@ -120,12 +120,12 @@ class DroneView(Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: drones = self.getSelectedDrones() self.removeDroneStacks(drones) event.Skip() @@ -260,7 +260,7 @@ class DroneView(Display): drone = self.drones[row] except IndexError: return - if wx.GetMouseState().GetModifiers() == wx.MOD_ALT: + if event.GetModifiers() == wx.MOD_ALT: self.removeDroneStacks([drone]) else: self.removeDrone(drone) diff --git a/gui/builtinAdditionPanes/fighterView.py b/gui/builtinAdditionPanes/fighterView.py index d6348a978..d37346b3f 100644 --- a/gui/builtinAdditionPanes/fighterView.py +++ b/gui/builtinAdditionPanes/fighterView.py @@ -205,12 +205,12 @@ class FighterDisplay(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: fighters = self.getSelectedFighters() self.removeFighters(fighters) event.Skip() @@ -315,12 +315,11 @@ class FighterDisplay(d.Display): if row != -1: col = self.getColumn(event.Position) if col != self.getColIndex(State): - mstate = wx.GetMouseState() try: fighter = self.fighters[row] except IndexError: return - if mstate.GetModifiers() == wx.MOD_ALT: + if event.GetModifiers() == wx.MOD_ALT: fighters = getSimilarFighters(self.original, fighter) else: fighters = [fighter] diff --git a/gui/builtinAdditionPanes/implantView.py b/gui/builtinAdditionPanes/implantView.py index 7bcd35379..e608e6ec1 100644 --- a/gui/builtinAdditionPanes/implantView.py +++ b/gui/builtinAdditionPanes/implantView.py @@ -162,12 +162,12 @@ class ImplantDisplay(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: implants = self.getSelectedImplants() self.removeImplants(implants) event.Skip() diff --git a/gui/builtinAdditionPanes/projectedView.py b/gui/builtinAdditionPanes/projectedView.py index 06fb38972..a87646ad9 100644 --- a/gui/builtinAdditionPanes/projectedView.py +++ b/gui/builtinAdditionPanes/projectedView.py @@ -129,12 +129,12 @@ class ProjectedView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand( fitID=self.mainFrame.getActiveFit(), items=self.getSelectedProjectors(), @@ -267,7 +267,7 @@ class ProjectedView(d.Display): selection = self.getSelectedProjectors() if mainItem not in selection: selection = [mainItem] - modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT + modPressed = event.GetModifiers() == wx.MOD_ALT fitID = self.mainFrame.getActiveFit() if isinstance(mainItem, EosModule) and modPressed: fit = Fit.getInstance().getFit(fitID) @@ -342,7 +342,7 @@ class ProjectedView(d.Display): if mainItem is None: return fitID = self.mainFrame.getActiveFit() - modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT + modPressed = event.GetModifiers() == wx.MOD_ALT if isinstance(mainItem, EosFit): self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand( fitID=fitID, items=[mainItem], amount=math.inf if modPressed else 1)) diff --git a/gui/builtinContextMenus/fitAddCurrentlyOpen.py b/gui/builtinContextMenus/fitAddCurrentlyOpen.py index b29998cd6..335523c9d 100644 --- a/gui/builtinContextMenus/fitAddCurrentlyOpen.py +++ b/gui/builtinContextMenus/fitAddCurrentlyOpen.py @@ -1,7 +1,6 @@ # noinspection PyPackageRequirements import wx -import gui.fitCommands as cmd import gui.mainFrame from gui.builtinViews.emptyView import BlankPage from gui.contextMenu import ContextMenuUnconditional diff --git a/gui/builtinContextMenus/itemProjectionRange.py b/gui/builtinContextMenus/itemProjectionRange.py index 987eaee03..2e69e2d30 100644 --- a/gui/builtinContextMenus/itemProjectionRange.py +++ b/gui/builtinContextMenus/itemProjectionRange.py @@ -52,19 +52,18 @@ class ChangeItemProjectionRange(ContextMenuCombined): newRange = cleanInputFloat * 1000 else: newRange = None - - fitID = self.mainFrame.getActiveFit() - items = selection - if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL): - if isinstance(mainItem, EosModule): - fit = Fit.getInstance().getFit(fitID) - positions = getSimilarModPositions(fit.projectedModules, mainItem) - items = [fit.projectedModules[p] for p in positions] - elif isinstance(mainItem, EosFighter): - fit = Fit.getInstance().getFit(fitID) - items = getSimilarFighters(fit.projectedFighters, mainItem) - self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand( - fitID=fitID, items=items, projectionRange=newRange)) + fitID = self.mainFrame.getActiveFit() + items = selection + if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL): + if isinstance(mainItem, EosModule): + fit = Fit.getInstance().getFit(fitID) + positions = getSimilarModPositions(fit.projectedModules, mainItem) + items = [fit.projectedModules[p] for p in positions] + elif isinstance(mainItem, EosFighter): + fit = Fit.getInstance().getFit(fitID) + items = getSimilarFighters(fit.projectedFighters, mainItem) + self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand( + fitID=fitID, items=items, projectionRange=newRange)) ChangeItemProjectionRange.register() diff --git a/gui/builtinContextMenus/itemStats.py b/gui/builtinContextMenus/itemStats.py index 0707d1f30..dabac9d5f 100644 --- a/gui/builtinContextMenus/itemStats.py +++ b/gui/builtinContextMenus/itemStats.py @@ -48,10 +48,9 @@ class ItemStats(ContextMenuSingle): if srcContext == "fittingModule" and stuff.isEmpty: return - mstate = wx.GetMouseState() reuse = False - if mstate.GetModifiers() == wx.MOD_SHIFT: + if wx.GetMouseState().GetModifiers() == wx.MOD_SHIFT: reuse = True if self.mainFrame.GetActiveStatsWindow() is None and reuse: diff --git a/gui/builtinContextMenus/itemVariationChange.py b/gui/builtinContextMenus/itemVariationChange.py index 026876e64..9b8423fc9 100644 --- a/gui/builtinContextMenus/itemVariationChange.py +++ b/gui/builtinContextMenus/itemVariationChange.py @@ -56,9 +56,7 @@ class ChangeItemToVariation(ContextMenuCombined): fit = sFit.getFit(self.mainFrame.getActiveFit()) def get_metalevel(x): - if 'metaLevel' not in x.attributes: - return 0 - return x.attributes['metaLevel'].value + return x.metaLevel or 0 def get_metagroup(x): # We want deadspace before officer mods diff --git a/gui/builtinContextMenus/moduleAmmoChange.py b/gui/builtinContextMenus/moduleAmmoChange.py index 1918ad58d..bdcf2dc6e 100644 --- a/gui/builtinContextMenus/moduleAmmoChange.py +++ b/gui/builtinContextMenus/moduleAmmoChange.py @@ -226,9 +226,8 @@ class ChangeModuleAmmo(ContextMenuCombined): fitID = self.mainFrame.getActiveFit() sFit = Fit.getInstance() fit = sFit.getFit(fitID) - mstate = wx.GetMouseState() # Switch in selection or all modules, depending on modifier key state and settings - switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (mstate.GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL)) + switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL)) if switchAll: if self.srcContext == 'fittingModule': command = cmd.GuiChangeLocalModuleChargesCommand diff --git a/gui/builtinItemStatsViews/itemCompare.py b/gui/builtinItemStatsViews/itemCompare.py index 37acc7351..97ebff68d 100644 --- a/gui/builtinItemStatsViews/itemCompare.py +++ b/gui/builtinItemStatsViews/itemCompare.py @@ -9,7 +9,7 @@ from gui.utils.numberFormatter import formatAmount def defaultSort(item): - return (item.attributes['metaLevel'].value if 'metaLevel' in item.attributes else 0, item.name) + return (item.metaLevel or 0, item.name) class ItemCompare(wx.Panel): diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 5e020704d..984a746bf 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -215,7 +215,7 @@ class ItemView(Display): # Get position of market group metagrpid = sMkt.getMetaGroupIdByItem(item) metatab = self.metaMap.get(metagrpid) - metalvl = self.metalvls.get(item.ID, 0) + metalvl = item.metaLevel or 0 return catname, mktgrpid, parentname, metatab, metalvl, item.name @@ -237,11 +237,6 @@ class ItemView(Display): def populate(self, items): if len(items) > 0: - # Get dictionary with meta level attribute - sAttr = Attribute.getInstance() - attrs = sAttr.getAttributeInfo("metaLevel") - sMkt = self.sMkt - self.metalvls = sMkt.directAttrRequest(items, attrs) # Clear selection self.unselectAll() # Perform sorting, using item's meta levels besides other stuff @@ -254,11 +249,6 @@ class ItemView(Display): def refresh(self, items): if len(items) > 1: - # Get dictionary with meta level attribute - sAttr = Attribute.getInstance() - attrs = sAttr.getAttributeInfo("metaLevel") - sMkt = self.sMkt - self.metalvls = sMkt.directAttrRequest(items, attrs) # Re-sort stuff if self.marketBrowser.mode != 'recent': items.sort(key=self.itemSort) diff --git a/gui/builtinShipBrowser/fitItem.py b/gui/builtinShipBrowser/fitItem.py index dfb403cb8..2187930fc 100644 --- a/gui/builtinShipBrowser/fitItem.py +++ b/gui/builtinShipBrowser/fitItem.py @@ -283,9 +283,7 @@ class FitItem(SFItem.SFBrowserItem): event.Skip() def editCheckEsc(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.RestoreEditButton() else: event.Skip() diff --git a/gui/builtinShipBrowser/navigationPanel.py b/gui/builtinShipBrowser/navigationPanel.py index bbded1f8f..1df80bd0d 100644 --- a/gui/builtinShipBrowser/navigationPanel.py +++ b/gui/builtinShipBrowser/navigationPanel.py @@ -109,10 +109,10 @@ class NavigationPanel(SFItem.SFBrowserItem): def OnBrowserSearchBoxKeyPress(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.BrowserSearchBox.Show(False) - elif event.RawControlDown() and event.GetKeyCode() == wx.WXK_BACK: + elif keycode == wx.WXK_BACK and modifiers == wx.MOD_CONTROL: HandleCtrlBackspace(self.BrowserSearchBox) else: event.Skip() diff --git a/gui/builtinShipBrowser/shipItem.py b/gui/builtinShipBrowser/shipItem.py index 21ed999d7..e0eae64b0 100644 --- a/gui/builtinShipBrowser/shipItem.py +++ b/gui/builtinShipBrowser/shipItem.py @@ -176,9 +176,7 @@ class ShipItem(SFItem.SFBrowserItem): self.Refresh() def editCheckEsc(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.tcFitName.Show(False) else: event.Skip() diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index 083df889d..d7952d6be 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -689,9 +689,8 @@ class Miscellanea(ViewColumn): baseRange = stuff.getModifiedChargeAttr("baseScanRange") if not scanStr or not baseRange: return "", None - strTwoAu = scanStr / (2.0 / baseRange) - text = "{0}".format(formatAmount(strTwoAu, 3, 0, 3)) - tooltip = "Scan strength with 2 AU scan range" + text = "{}".format(formatAmount(scanStr, 4, 0, 3)) + tooltip = "Scan strength at {} AU scan range".format(formatAmount(baseRange, 3, 0, 0)) return text, tooltip else: return "", None diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 349afbafb..9025586d0 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -280,12 +280,12 @@ class FittingView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: modules = [m for m in self.getSelectedMods() if not m.isEmpty] self.removeModule(modules) event.Skip() diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 52210d4b5..9af767acc 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -258,9 +258,7 @@ class CharacterEditor(AuxiliaryFrame): wx.PostEvent(self, GE.CharListUpdated()) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/esiFittings.py b/gui/esiFittings.py index a94c362e5..22dec7a4f 100644 --- a/gui/esiFittings.py +++ b/gui/esiFittings.py @@ -92,9 +92,7 @@ class EveFittings(AuxiliaryFrame): self.charChoice.SetSelection(0) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() @@ -248,9 +246,7 @@ class ExportToEve(AuxiliaryFrame): self.charChoice.SetSelection(0) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() @@ -358,9 +354,7 @@ class SsoCharacterMgmt(AuxiliaryFrame): event.Skip() def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/itemStats.py b/gui/itemStats.py index 62667befe..284121ecc 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -133,9 +133,7 @@ class ItemStatsFrame(AuxiliaryFrame): self.parentWnd.SetActiveStatsWindow(self) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 9ce5e7c2c..ee22d3fd1 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -281,9 +281,7 @@ class DmgPatternEditor(AuxiliaryFrame): self.stNotice.SetLabel("Patterns exported to clipboard") def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index ae0b68824..cfee57b4f 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -81,9 +81,7 @@ class PreferenceDialog(wx.Dialog): self.Close() def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/propertyEditor.py b/gui/propertyEditor.py index d5b827bbf..2292c5ac5 100644 --- a/gui/propertyEditor.py +++ b/gui/propertyEditor.py @@ -89,9 +89,7 @@ class AttributeEditor(AuxiliaryFrame): self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/setEditor.py b/gui/setEditor.py index 5af95f35b..578cf18fd 100644 --- a/gui/setEditor.py +++ b/gui/setEditor.py @@ -185,9 +185,7 @@ class ImplantSetEditor(AuxiliaryFrame): return def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/targetProfileEditor.py b/gui/targetProfileEditor.py index 0112ef73f..244aec20b 100644 --- a/gui/targetProfileEditor.py +++ b/gui/targetProfileEditor.py @@ -369,9 +369,7 @@ class TargetProfileEditor(AuxiliaryFrame): self.stNotice.SetLabel("Profiles exported to clipboard") def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/imgs/renders/73@1x.png b/imgs/renders/73@1x.png new file mode 100644 index 000000000..54e17af48 Binary files /dev/null and b/imgs/renders/73@1x.png differ diff --git a/imgs/renders/73@2x.png b/imgs/renders/73@2x.png new file mode 100644 index 000000000..5e4eeb32d Binary files /dev/null and b/imgs/renders/73@2x.png differ diff --git a/scripts/effectUsedBy.py b/scripts/effectUsedBy.py index 4f239004b..1b9ad2670 100755 --- a/scripts/effectUsedBy.py +++ b/scripts/effectUsedBy.py @@ -152,7 +152,7 @@ ig.categoryID = ic.categoryID' QUERY_TYPEID_GROUPID = 'SELECT groupID FROM invtypes WHERE typeID = ? LIMIT 1' QUERY_GROUPID_CATEGORYID = 'SELECT categoryID FROM invgroups WHERE \ groupID = ? LIMIT 1' -QUERY_TYPEID_PARENTTYPEID = 'SELECT parentTypeID FROM invmetatypes WHERE \ +QUERY_TYPEID_PARENTTYPEID = 'SELECT variationParentTypeID FROM invtypes WHERE \ typeID = ? LIMIT 1' QUERY_TYPEID_MARKETGROUPID = 'SELECT marketGroupID FROM invtypes WHERE \ typeID = ? LIMIT 1' diff --git a/scripts/jsonToSql.py b/scripts/jsonToSql.py index caab1d184..c356e84ba 100755 --- a/scripts/jsonToSql.py +++ b/scripts/jsonToSql.py @@ -56,15 +56,14 @@ def main(db, json_path): # Config dict tables = { 'clonegrades': ('fsd_lite', eos.gamedata.AlphaCloneSkill), - 'dgmattribs': ('bulkdata', eos.gamedata.AttributeInfo), - 'dgmeffects': ('bulkdata', eos.gamedata.Effect), - 'dgmtypeattribs': ('bulkdata', eos.gamedata.Attribute), - 'dgmtypeeffects': ('bulkdata', eos.gamedata.ItemEffect), - 'dgmunits': ('bulkdata', eos.gamedata.Unit), + 'dogmaattributes': ('bulkdata', eos.gamedata.AttributeInfo), + 'dogmaeffects': ('bulkdata', eos.gamedata.Effect), + 'dogmatypeattributes': ('bulkdata', eos.gamedata.Attribute), + 'dogmatypeeffects': ('bulkdata', eos.gamedata.ItemEffect), + 'dogmaunits': ('bulkdata', eos.gamedata.Unit), 'evecategories': ('fsd_lite', eos.gamedata.Category), 'evegroups': ('fsd_lite', eos.gamedata.Group), - 'invmetagroups': ('bulkdata', eos.gamedata.MetaGroup), - 'invmetatypes': ('bulkdata', eos.gamedata.MetaType), + 'metagroups': ('fsd_binary', eos.gamedata.MetaGroup), 'evetypes': ('fsd_lite', eos.gamedata.Item), 'traits': ('phobos', eos.gamedata.Traits), 'metadata': ('phobos', eos.gamedata.MetaData), @@ -73,13 +72,16 @@ def main(db, json_path): fieldMapping = { 'marketgroups': { 'id': 'marketGroupID', - 'name': 'marketGroupName'}} + 'name': 'marketGroupName'}, + 'metagroups': { + 'id': 'metaGroupID'}} rowsInValues = ( 'evetypes', 'evegroups', 'evecategories', - 'marketgroups') + 'marketgroups', + 'metagroups') def convertIcons(data): new = [] @@ -176,13 +178,13 @@ def main(db, json_path): # Get data on item effects # Format: {type ID: set(effect, IDs)} typesEffects = {} - for row in tables['dgmtypeeffects']: + for row in tables['dogmatypeeffects']: typesEffects.setdefault(row['typeID'], set()).add(row['effectID']) # Get data on type attributes # Format: {type ID: {attribute ID: attribute value}} typesNormalAttribs = {} typesSkillAttribs = {} - for row in tables['dgmtypeattribs']: + for row in tables['dogmatypeattributes']: attributeID = row['attributeID'] if attributeID in skillReqAttribsFlat: typeSkillAttribs = typesSkillAttribs.setdefault(row['typeID'], {}) @@ -304,7 +306,7 @@ def main(db, json_path): # group Ship Modifiers, for items like tactical t3 ship modes row['groupID'] == 1306 or # Civilian weapons - row['typeName'].startswith('Civilian') or + (row['typeName'].startswith('Civilian') and "Shuttle" not in row['typeName']) or # Micro Bombs (Fighters) row['typeID'] in (41549, 41548, 41551, 41550) or # Abyssal weather (environment) @@ -321,7 +323,7 @@ def main(db, json_path): # ignore checker def isIgnored(file, row): - if file in ('evetypes', 'dgmtypeeffects', 'dgmtypeattribs', 'invmetatypes') and row['typeID'] not in eveTypes: + if file in ('evetypes', 'dogmatypeeffects', 'dogmatypeattributes') and row['typeID'] not in eveTypes: return True return False @@ -338,7 +340,7 @@ def main(db, json_path): if ( jsonName == 'evetypes' and ( # Apparently people really want Civilian modules available - row['typeName'].startswith('Civilian') or + (row['typeName'].startswith('Civilian') and "Shuttle" not in row['typeName']) or row['typeName'] in ('Capsule', 'Dark Blood Tracking Disruptor')) ): row['published'] = True diff --git a/service/market.py b/service/market.py index bae35bbce..d55148800 100644 --- a/service/market.py +++ b/service/market.py @@ -20,6 +20,7 @@ import queue import threading from collections import OrderedDict +from itertools import chain # noinspection PyPackageRequirements import wx @@ -29,7 +30,7 @@ from sqlalchemy.sql import or_ import config import eos.db from eos.gamedata import Category as types_Category, Group as types_Group, Item as types_Item, MarketGroup as types_MarketGroup, \ - MetaGroup as types_MetaGroup, MetaType as types_MetaType + MetaGroup as types_MetaGroup from service import conversions from service.jargon import JargonLoader from service.settings import SettingsProvider @@ -118,13 +119,13 @@ class SearchWorkerThread(threading.Thread): if len(request) >= config.minItemSearchLength: results = eos.db.searchItems(request, where=filter_, join=(types_Item.group, types_Group.category), - eager=("group.category", "metaGroup", "metaGroup.parent")) + eager=("group.category", "metaGroup")) jargon_results = [] if len(jargon_request) >= config.minItemSearchLength: jargon_results = eos.db.searchItems(jargon_request, where=filter_, join=(types_Item.group, types_Group.category), - eager=("group.category", "metaGroup", "metaGroup.parent")) + eager=("group.category", "metaGroup")) items = set() # Return only published items, consult with Market service this time @@ -217,7 +218,8 @@ class Market: } self.ITEMS_FORCEGROUP_R = self.__makeRevDict(self.ITEMS_FORCEGROUP) - self.les_grp.addItems = list(self.getItem(itmn) for itmn in self.ITEMS_FORCEGROUP_R[self.les_grp]) + for grp, itemNames in self.ITEMS_FORCEGROUP_R.items(): + grp.addItems = list(self.getItem(i) for i in itemNames) self.customGroups.add(self.les_grp) # List of items which are forcibly published or hidden @@ -313,10 +315,12 @@ class Market: # Misc definitions # 0 is for items w/o meta group - self.META_MAP = OrderedDict([("normal", frozenset((0, 1, 2, 14))), - ("faction", frozenset((4, 3))), + self.META_MAP = OrderedDict([("faction", frozenset((4, 3, 52))), ("complex", frozenset((6,))), ("officer", frozenset((5,)))]) + nonNormalMetas = set(chain(*self.META_MAP.values())) + self.META_MAP["normal"] = frozenset((0, *(mg.ID for mg in eos.db.getMetaGroups() if mg.ID not in nonNormalMetas))) + self.META_MAP.move_to_end("normal", last=False) self.META_MAP_REVERSE = {sv: k for k, v in self.META_MAP.items() for sv in v} self.SEARCH_CATEGORIES = ( "Drone", @@ -461,19 +465,8 @@ class Market: """Get meta group by item""" # Check if item is in forced metagroup map if item.name in self.ITEMS_FORCEDMETAGROUP: - # Create meta group from scratch - metaGroup = types_MetaType() - # Get meta group info object based on meta group name - metaGroupInfo = self.getMetaGroup(self.ITEMS_FORCEDMETAGROUP[item.name][0]) - # Get parent item based on its name - parent = self.getItem(self.ITEMS_FORCEDMETAGROUP[item.name][1]) - # Assign all required for metaGroup variables - metaGroup.info = metaGroupInfo - metaGroup.items = item - metaGroup.parent = parent - metaGroup.metaGroupID = metaGroupInfo.ID - metaGroup.parentTypeID = parent.ID - metaGroup.typeID = item.ID + metaGroupName = self.ITEMS_FORCEDMETAGROUP[item.name][0] + metaGroup = eos.db.getMetaGroup(metaGroupName) # If no forced meta group is provided, try to use item's # meta group if any else: @@ -513,14 +506,15 @@ class Market: def getParentItemByItem(self, item, selfparent=True): """Get parent item by item""" - mg = self.getMetaGroupByItem(item) - if mg: - parent = mg.parent + parent = None + if item.name in self.ITEMS_FORCEDMETAGROUP: + parentName = self.ITEMS_FORCEDMETAGROUP[item.name][1] + parent = self.getItem(parentName) + if parent is None: + parent = item.varParent # Consider self as parent if item has no parent in database - elif selfparent is True: + if parent is None and selfparent is True: parent = item - else: - parent = None return parent def getVariationsByItems(self, items, alreadyparent=False): @@ -756,7 +750,7 @@ class Market: filter_ = types_Category.name.in_(["Ship", "Structure"]) results = eos.db.searchItems(name, where=filter_, join=(types_Item.group, types_Group.category), - eager=("group.category", "metaGroup", "metaGroup.parent")) + eager=("group.category", "metaGroup")) ships = set() for item in results: if self.getPublicityByItem(item): diff --git a/service/port/efs.py b/service/port/efs.py index 307baa3fa..47975a629 100755 --- a/service/port/efs.py +++ b/service/port/efs.py @@ -460,13 +460,11 @@ class EfsPort: def getT2ItemsWhere(additionalFilter, mustBeOffensive=False, category="Module"): # Used to obtain a smaller subset of items while still containing examples of each group. T2_META_LEVEL = 5 - metaLevelAttrID = getAttributeInfo("metaLevel").attributeID categoryID = getCategory(category).categoryID result = gamedata_session.query(Item).join(ItemEffect, Group, Attribute).\ filter( additionalFilter, - Attribute.attributeID == metaLevelAttrID, - Attribute.value == T2_META_LEVEL, + Item.metaLevel == T2_META_LEVEL, Group.categoryID == categoryID, ).all() if mustBeOffensive: @@ -591,18 +589,18 @@ class EfsPort: preTraitMultipliers = getCurrentMultipliers(tf) for effect in fit.ship.item.effects.values(): if effect.isImplemented: - effect.handler(tf, tf.ship, []) + effect.handler(tf, tf.ship, [], None, effect=effect) # Factor in mode effects for T3 Destroyers if fit.mode is not None: for effect in fit.mode.item.effects.values(): if effect.isImplemented: - effect.handler(tf, fit.mode, []) + effect.handler(tf, fit.mode, [], None, effect=effect) if fit.ship.item.groupID == getGroup("Strategic Cruiser").ID: subSystems = list(filter(lambda mod: mod.slot == FittingSlot.SUBSYSTEM and mod.item, fit.modules)) for sub in subSystems: for effect in sub.item.effects.values(): if effect.isImplemented: - effect.handler(tf, sub, []) + effect.handler(tf, sub, [], None, effect=effect) postTraitMultipliers = getCurrentMultipliers(tf) getMaxRatio = lambda dictA, dictB, key: max(map(lambda a, b: b / a, dictA[key], dictB[key])) multipliers["turret"] = round(getMaxRatio(preTraitMultipliers, postTraitMultipliers, "turrets"), 6) diff --git a/version.yml b/version.yml index b7242e30a..852cade4c 100644 --- a/version.yml +++ b/version.yml @@ -1 +1 @@ -version: v2.11.1 +version: v2.12.1