Merge branch 'master' into v2.2.0b1

# Conflicts:
#	eve.db
This commit is contained in:
blitzmann
2018-06-12 21:41:04 -04:00
13 changed files with 45 additions and 39 deletions

View File

@@ -8,4 +8,4 @@ type = "passive"
def handler(fit, container, context):
level = container.level if "skill" in context else 1
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill("Drones"),
"maxVelocity", container.getModifiedItemAttr("droneMaxVelocityBonus") * level)
"maxVelocity", container.getModifiedItemAttr("droneMaxVelocityBonus") * level, stackingPenalties=True)

View File

@@ -6,5 +6,5 @@ type = "passive"
def handler(fit, skill, context):
fit.modules.filteredItemBoost(lambda mod: True, "heatDamage",
fit.modules.filteredItemBoost(lambda mod: "heatDamage" in mod.item.attributes, "heatDamage",
skill.getModifiedItemAttr("thermodynamicsHeatDamage") * skill.level)

View File

@@ -1016,6 +1016,16 @@ class Fit(object):
def getNumSlots(self, type):
return self.ship.getModifiedItemAttr(self.slots[type]) or 0
def getHardpointsFree(self, type):
if type == Hardpoint.NONE:
return 1
elif type == Hardpoint.TURRET:
return self.ship.getModifiedItemAttr('turretSlotsLeft') - self.getHardpointsUsed(Hardpoint.TURRET)
elif type == Hardpoint.MISSILE:
return self.ship.getModifiedItemAttr('launcherSlotsLeft') - self.getHardpointsUsed(Hardpoint.MISSILE)
else:
raise ValueError("%d is not a valid value for Hardpoint Enum", type)
@property
def calibrationUsed(self):
return self.getItemAttrOnlineSum(self.modules, 'upgradeCost')

View File

@@ -73,7 +73,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"""An instance of this class represents a module together with its charge and modified attributes"""
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
MINING_ATTRIBUTES = ("miningAmount",)
SYSTEM_GROUPS = ("Effect Beacon", "MassiveEnvironments", "Uninteractable Localized Effect Beacon", "Non-Interactable Object")
SYSTEM_GROUPS = ("Effect Beacon", "MassiveEnvironments", "Abyssal Hazards", "Non-Interactable Object")
def __init__(self, item, baseItem=None, mutaplasmid=None):
"""Initialize a module from the program"""
@@ -524,7 +524,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if max is not None:
current = 0 # if self.owner != fit else -1 # Disabled, see #1278
for mod in fit.modules:
if mod.item and mod.item.groupID == self.item.groupID:
if (mod.item and mod.item.groupID == self.item.groupID and
self.modPosition != mod.modPosition):
current += 1
if current >= max:
@@ -532,12 +533,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
# Check this only if we're told to do so
if hardpointLimit:
if self.hardpoint == Hardpoint.TURRET:
if fit.ship.getModifiedItemAttr('turretSlotsLeft') - fit.getHardpointsUsed(Hardpoint.TURRET) < 1:
return False
elif self.hardpoint == Hardpoint.MISSILE:
if fit.ship.getModifiedItemAttr('launcherSlotsLeft') - fit.getHardpointsUsed(Hardpoint.MISSILE) < 1:
return False
if fit.getHardpointsFree(self.hardpoint) < 1:
return False
return True

View File

@@ -195,7 +195,7 @@ class WhProjector(ContextMenu):
def getLocalizedEnvironments(self):
sMkt = Market.getInstance()
grp = sMkt.getGroup("Uninteractable Localized Effect Beacon")
grp = sMkt.getGroup("Abyssal Hazards")
effects = dict()

View File

@@ -686,7 +686,22 @@ class FittingView(d.Display):
# only consider changing color if we're dealing with a Module
if type(mod) is Module:
if slotMap[mod.slot] or getattr(mod, 'restrictionOverridden', None): # Color too many modules as red
hasRestrictionOverriden = getattr(mod, 'restrictionOverridden', None)
# If module had broken fitting restrictions but now doesn't,
# ensure it is now valid, and remove restrictionOverridden
# variable. More in #1519
if not fit.ignoreRestrictions and hasRestrictionOverriden:
clean = False
if mod.fits(fit, False):
if not mod.hardpoint:
clean = True
elif fit.getHardpointsFree(mod.hardpoint) >= 0:
clean = True
if clean:
del mod.restrictionOverridden
hasRestrictionOverriden = not hasRestrictionOverriden
if slotMap[mod.slot] or hasRestrictionOverriden: # Color too many modules as red
self.SetItemBackgroundColour(i, wx.Colour(204, 51, 51))
elif sFit.serviceFittingOptions["colorFitBySlot"]: # Color by slot it enabled
self.SetItemBackgroundColour(i, self.slotColour(mod.slot))

View File

@@ -20,6 +20,7 @@ from gui.bitmap_loader import BitmapLoader
from gui.utils import draw
from gui.utils import color as color_utils
from service.fit import Fit
from gui.utils import fonts
_PageChanging, EVT_NOTEBOOK_PAGE_CHANGING = wx.lib.newevent.NewEvent()
_PageChanged, EVT_NOTEBOOK_PAGE_CHANGED = wx.lib.newevent.NewEvent()
@@ -357,7 +358,7 @@ class _TabRenderer:
self.tab_bitmap = None
self.tab_back_bitmap = None
self.padding = 4
self.font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
self.font = wx.Font(fonts.NORMAL, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
self.tab_img = img
self.position = (0, 0) # Not used internally for rendering - helper for tab container
@@ -1322,7 +1323,7 @@ class PFNotebookPagePreview(wx.Frame):
self.padding = 15
self.transp = 0
hfont = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
hfont = wx.Font(fonts.NORMAL, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
self.SetFont(hfont)
tx, ty = self.GetTextExtent(self.title)
@@ -1384,7 +1385,7 @@ class PFNotebookPagePreview(wx.Frame):
mdc.SetBackground(wx.Brush(color))
mdc.Clear()
font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
font = wx.Font(11, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
mdc.SetFont(font)
x, y = mdc.GetTextExtent(self.title)

View File

File diff suppressed because one or more lines are too long

View File

@@ -216,7 +216,7 @@ def main(old, new, groups=True, effects=True, attributes=True, renames=True):
# Initialize container for the data for each item with empty stuff besides groupID
dictionary[itemid] = [groupID, set(), {}]
# Add items filtered by group
query = 'SELECT it.typeID, it.groupID FROM invtypes AS it INNER JOIN invgroups AS ig ON it.groupID = ig.groupID WHERE it.published = 1 AND ig.groupName IN ("Effect Beacon", "Ship Modifiers", "Mutaplasmids", "MassiveEnvironments", "Uninteractable Localized Effect Beacon", "Non-Interactable Object")'
query = 'SELECT it.typeID, it.groupID FROM invtypes AS it INNER JOIN invgroups AS ig ON it.groupID = ig.groupID WHERE it.published = 1 AND ig.groupName IN ("Effect Beacon", "Ship Modifiers", "Mutaplasmids", "MassiveEnvironments", "Abyssal Hazards", "Non-Interactable Object")'
cursor.execute(query)
for row in cursor:
itemid = row[0]

View File

@@ -25,7 +25,7 @@ import re
# Add eos root path to sys.path so we can import ourselves
path = os.path.dirname(__file__)
sys.path.append(os.path.realpath(os.path.join(path, "..")))
sys.path.insert(0, os.path.realpath(os.path.join(path, "..")))
import json
import argparse
@@ -172,21 +172,6 @@ def main(db, json_path):
newData.append(newRow)
return newData
def convertTypes(typesData):
"""
Add factionID column to evetypes table.
"""
factionMap = {}
with open(os.path.join(jsonPath, "fsdTypeOverrides.json")) as f:
overridesData = json.load(f)
for typeID, typeData in list(overridesData.items()):
factionID = typeData.get("factionID")
if factionID is not None:
factionMap[int(typeID)] = factionID
for row in typesData:
row['factionID'] = factionMap.get(int(row['typeID']))
return typesData
data = {}
# Dump all data to memory so we can easely cross check ignored rows
@@ -199,8 +184,6 @@ def main(db, json_path):
tableData = convertIcons(tableData)
if jsonName == "phbtraits":
tableData = convertTraits(tableData)
if jsonName == "evetypes":
tableData = convertTypes(tableData)
if jsonName == "clonegrades":
tableData = convertClones(tableData)
data[jsonName] = tableData

View File

@@ -9,14 +9,14 @@ import json
iconDict = {}
stream = open(r"C:\Users\Ryan\Sync\Git\blitzmann\Pyfa\scripts\iconIDs.yaml", "r")
stream = open('iconIDs.yaml', 'r')
docs = yaml.load_all(stream)
for doc in docs:
for k,v in list(doc.items()):
iconDict[str(k)] = {"iconFile": v['iconFile']}
iconDict[str(k)] = {'iconFile': v['iconFile']}
with open('icons.json', 'w') as outfile:
json.dump(iconDict, outfile)
print("done")
print('done')

View File

@@ -1011,7 +1011,7 @@ class Fit(object):
# remove invalid modules when switching back to enabled fitting restrictions
if not fit.ignoreRestrictions:
for m in fit.modules:
if not m.isEmpty and not m.fits(fit):
if not m.isEmpty and not m.fits(fit, False):
self.removeModule(fit.ID, m.modPosition)
eos.db.commit()