Merge branch 'master' into wx3

This commit is contained in:
blitzmann
2015-08-27 22:05:38 -04:00
35 changed files with 199 additions and 34 deletions

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@ saveddata/
#Pyfa file
pyfaFits.html
build/

View File

@@ -18,10 +18,10 @@ debug = False
saveInRoot = False
# Version data
version = "1.13.3"
tag = "git"
expansionName = "Aegis"
expansionVersion = "1.0"
version = "1.14.0"
tag = "Stable"
expansionName = "Galatea"
expansionVersion = "1.2"
evemonMinVersion = "4081"
pyfaPath = None

View File

@@ -159,6 +159,10 @@ class HandledModuleList(HandledList):
dummy.position = index
self[index] = dummy
def toModule(self, index, mod):
mod.position = index
self[index] = mod
def freeSlot(self, slot):
for i in range(len(self) -1, -1, -1):
mod = self[i]

View File

@@ -4,4 +4,4 @@
# Modules from group: Entosis Link (2 of 2)
type = "active"
def handler(fit, module, context):
pass
fit.ship.forceItemAttr("disallowAssistance", module.getModifiedItemAttr("disallowAssistance"))

View File

@@ -1,7 +0,0 @@
# passiveMassAdd
#
# Used by:
# Modules from group: Entosis Link (2 of 2)
type = "offline"
def handler(fit, module, context):
fit.ship.increaseItemAttr("mass", module.getModifiedItemAttr("massAddition"))

View File

@@ -0,0 +1,8 @@
# passiveSpeedLimit
#
# Used by:
# Modules from group: Entosis Link (2 of 2)
runtime = "late"
type = "passive"
def handler(fit, src, context):
fit.extraAttributes['speedLimit'] = src.getModifiedItemAttr("speedLimit")

View File

@@ -1,6 +1,7 @@
# shipBonusAfterburnerSpeedFactorCC2
#
# Used by:
# Ship: Fiend
# Ship: Phantasm
type = "passive"
def handler(fit, module, context):

View File

@@ -1,6 +1,7 @@
# shipBonusAfterburnerSpeedFactorCF2
#
# Used by:
# Ship: Imp
# Ship: Succubus
type = "passive"
def handler(fit, module, context):

View File

@@ -2,6 +2,7 @@
#
# Used by:
# Ship: Ashimmu
# Ship: Fiend
# Ship: Gnosis
# Ship: Phantasm
type = "passive"

View File

@@ -1,6 +1,7 @@
# shipBonusMediumEnergyTurretTrackingAC2
#
# Used by:
# Ship: Fiend
# Ship: Phantasm
type = "passive"
def handler(fit, ship, context):

View File

@@ -3,6 +3,7 @@
# Used by:
# Ship: Confessor
# Ship: Cruor
# Ship: Imp
# Ship: Succubus
type = "passive"
def handler(fit, ship, context):

View File

@@ -1,6 +1,7 @@
# shipBonusSmallEnergyTurretTracking2AF
#
# Used by:
# Ship: Imp
# Ship: Succubus
type = "passive"
def handler(fit, ship, context):

View File

@@ -1,7 +1,6 @@
# systemDamageDrones
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemDamageEmMissiles
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemDamageExplosiveMissiles
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemDamageKineticMissiles
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemDamageMultiplierGunnery
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemDamageThermalMissiles
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Magnetar Effect Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -2,7 +2,6 @@
#
# Used by:
# Celestials named like: Black Hole Effect Beacon Class (6 of 6)
# Celestials named like: Drifter Incursion (6 of 6)
runTime = "early"
type = ("projected", "offline")
def handler(fit, beacon, context):

View File

@@ -0,0 +1,8 @@
# systemMaxVelocityPercentage
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
runTime = "early"
type = ("projected", "offline")
def handler(fit, beacon, context):
fit.ship.boostItemAttr("maxVelocity", beacon.getModifiedItemAttr("maxVelocityMultiplier"), stackingPenalties=True)

View File

@@ -1,7 +1,6 @@
# systemSmartBombEmDamage
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Red Giant Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemSmartBombExplosiveDamage
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Red Giant Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemSmartBombKineticDamage
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Red Giant Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,7 +1,6 @@
# systemSmartBombThermalDamage
#
# Used by:
# Celestials named like: Drifter Incursion (6 of 6)
# Celestials named like: Red Giant Beacon Class (6 of 6)
runTime = "early"
type = ("projected", "offline")

View File

@@ -1,6 +1,7 @@
# velocityBonusOnline
#
# Used by:
# Modules from group: Entosis Link (2 of 2)
# Modules from group: Nanofiber Internal Structure (7 of 7)
# Modules from group: Overdrive Injector System (7 of 7)
type = "passive"

View File

@@ -303,6 +303,14 @@ class Fit(object):
def jamChance(self):
return (1-self.ecmProjectedStr)*100
@property
def maxSpeed(self):
speedLimit = self.ship.getModifiedItemAttr("speedLimit")
if speedLimit and self.ship.getModifiedItemAttr("maxVelocity") > speedLimit:
return speedLimit
return self.ship.getModifiedItemAttr("maxVelocity")
@property
def alignTime(self):
agility = self.ship.getModifiedItemAttr("agility")

View File

@@ -35,6 +35,10 @@ class Ship(ItemAttrShortcut, HandledItem):
"droneControlRange": 20000,
"cloaked": False,
"siege": False
# We also have speedLimit for Entosis Link, but there seems to be an
# issue with naming it exactly "speedLimit" due to unknown reasons.
# Regardless, we don't have to put it here anyways - it will come up
# as None unless the Entosis effect sets it.
}
def __init__(self, item):

View File

@@ -19,4 +19,5 @@ __all__ = [
"targetResists",
"priceClear",
"amount",
"metaSwap",
]

View File

@@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-
from gui.contextMenu import ContextMenu
from gui.itemStats import ItemStatsDialog
import gui.mainFrame
import service
import wx
import gui.globalEvents as GE
class MetaSwap(ContextMenu):
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, srcContext, selection):
if self.mainFrame.getActiveFit() is None or srcContext not in ("fittingModule",):
return False
# Check if list of variations is same for all of selection
# If not - don't show the menu
mkt = service.Market.getInstance()
self.variations = None
for i in selection:
variations = mkt.getVariationsByItems([i.item])
if self.variations is None:
self.variations = variations
else:
if variations != self.variations:
return False
self.selection = selection
return True
def getText(self, itmContext, selection):
return "Variations"
def getSubMenu(self, context, selection, rootMenu, i, pitem):
self.moduleLookup = {}
def get_metalevel(x):
return x.attributes["metaLevel"].value
def get_metagroup(x):
return x.metaGroup.ID if x.metaGroup is not None else 0
m = wx.Menu()
# If on Windows we need to bind out events into the root menu, on other
# platforms they need to go to our sub menu
if "wxMSW" in wx.PlatformInfo:
bindmenu = rootMenu
else:
bindmenu = m
# Sort items by metalevel, and group within that metalevel
items = list(self.variations)
items.sort(key=get_metalevel)
items.sort(key=get_metagroup)
group = None
for item in items:
# Apparently no metaGroup for the Tech I variant:
if item.metaGroup is None:
thisgroup = "Tech I"
else:
thisgroup = item.metaGroup.name
if thisgroup != group:
group = thisgroup
id = wx.NewId()
m.Append(id, u'%s' % group)
m.Enable(id, False)
id = wx.NewId()
mitem = wx.MenuItem(rootMenu, id, item.name)
bindmenu.Bind(wx.EVT_MENU, self.handleModule, mitem)
self.moduleLookup[id] = item
m.AppendItem(mitem)
return m
def handleModule(self, event):
item = self.moduleLookup.get(event.Id, None)
if item is None:
event.Skip()
return
sFit = service.Fit.getInstance()
fitID = self.mainFrame.getActiveFit()
fit = sFit.getFit(fitID)
for mod in self.selection:
pos = fit.modules.index(mod)
sFit.changeModule(fitID, pos, item.ID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
MetaSwap.register()

View File

@@ -149,7 +149,7 @@ class TargetingMiscViewFull(StatsView):
("labelScanRes", {"main": lambda: fit.ship.getModifiedItemAttr("scanResolution")}, 3, 0, 0, "mm"),
("labelSensorStr", {"main": lambda: fit.scanStrength}, 3, 0, 0, ""),
("labelCtrlRange", {"main": lambda: fit.extraAttributes["droneControlRange"] / 1000}, 3, 0, 0, "km"),
("labelFullSpeed", {"main": lambda: fit.ship.getModifiedItemAttr("maxVelocity")}, 3, 0, 0, "m/s"),
("labelFullSpeed", {"main": lambda: fit.maxSpeed}, 3, 0, 0, "m/s"),
("labelFullAlignTime", {"main": lambda: fit.alignTime}, 3, 0, 0, "s"),
("labelFullSigRadius", {"main": lambda: fit.ship.getModifiedItemAttr("signatureRadius")}, 3, 0, 9, ""),
("labelFullWarpSpeed", {"main": lambda: fit.warpSpeed}, 3, 0, 0, "AU/s"),

View File

@@ -42,7 +42,12 @@ class GraphFrame(wx.Frame):
try:
import matplotlib as mpl
cache_dir = mpl._get_cachedir()
try:
cache_dir = mpl._get_cachedir()
except:
cache_dir = unicode(os.path.expanduser(os.path.join("~", ".matplotlib")))
cache_file = os.path.join(cache_dir, 'fontList.cache')
if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file):
# remove matplotlib font cache, see #234

View File

@@ -4,7 +4,7 @@ This script bootstraps Phobos from a supplied path and feeds it
information regarding EVE data paths and where to dump data. It then imports
some other scripts and uses them to convert the json data into a SQLite
database and then compare the new database to the existing one, producing a
diff which can then be used to assist in the updating.
diff which can then be used to assist in the updating.
"""
import sys
@@ -18,7 +18,7 @@ import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--eve", dest="eve_path", help="Location of EVE directory", required=True)
parser.add_argument("-c", "--cache", dest="cache_path", help="Location of EVE cache directory. If not specified, an attempt will be make to automatically determine path.")
parser.add_argument("-r", "--res", dest="res_path", help="Location of EVE shared resource cache", required=True)
parser.add_argument("-r", "--res", dest="res_path", help="Location of EVE shared resource cache. If not specified, an attempt will be make to automatically determine path.")
parser.add_argument("-d", "--dump", dest="dump_path", help="Location of Phobos JSON dump directory", required=True)
parser.add_argument("-p", "--phobos", dest="phb_path", help="Location of Phobos, defaults to path noted in script", default=phb_path)
parser.add_argument("-s", "--singularity", action="store_true", help="Singularity build")
@@ -27,7 +27,7 @@ parser.add_argument("-j", "--nojson", dest="nojson", action="store_true", help="
args = parser.parse_args()
eve_path = os.path.expanduser(unicode(args.eve_path, sys.getfilesystemencoding()))
cache_path = os.path.expanduser(unicode(args.cache_path, sys.getfilesystemencoding())) if args.cache_path else None
res_path = os.path.expanduser(unicode(args.res_path, sys.getfilesystemencoding()))
res_path = os.path.expanduser(unicode(args.res_path, sys.getfilesystemencoding())) if args.res_path else None
dump_path = os.path.expanduser(unicode(args.dump_path, sys.getfilesystemencoding()))
script_path = os.path.dirname(unicode(__file__, sys.getfilesystemencoding()))
@@ -54,6 +54,10 @@ if not args.nojson:
from writer import *
rvr = reverence.blue.EVE(eve_path, cachepath=args.cache_path, sharedcachepath=res_path, server="singularity" if args.singularity else "tranquility")
print "EVE Directory: {}".format(rvr.paths.root)
print "Cache Directory: {}".format(rvr.paths.cache)
print "Shared Resource Directory: {}".format(rvr.paths.sharedcache)
print
pickle_miner = ResourcePickleMiner(rvr)
trans = Translator(pickle_miner)
@@ -66,17 +70,19 @@ if not args.nojson:
TraitMiner(staticcache_miner, bulkdata_miner, trans),
SqliteMiner(eve_path, trans),
staticcache_miner,
CachedCallsMiner(rvr, trans),
#CachedCallsMiner(rvr, trans),
pickle_miner
)
writers = (
JsonWriter(dump_path, indent=2),
)
list = "dgmexpressions,dgmattribs,dgmeffects,dgmtypeattribs,dgmtypeeffects,"\
"dgmunits,icons,invcategories,invgroups,invmetagroups,invmetatypes,"\
"invtypes,mapbulk_marketGroups,phbmetadata,phbtraits,fsdTypeOverrides"
"invtypes,mapbulk_marketGroups,phbmetadata,phbtraits,fsdTypeOverrides"\
"evegroups,evetypes"
FlowManager(miners, writers).run(list, "multi")

View File

@@ -440,6 +440,38 @@ class Fit(object):
eos.db.commit()
return numSlots != len(fit.modules)
def changeModule(self, fitID, position, newItemID):
fit = eos.db.getFit(fitID)
if fit.modules[position].isEmpty:
return None
# Dummy it out in case the next bit fails
fit.modules.toDummy(position)
item = eos.db.getItem(newItemID, eager=("attributes", "group.category"))
try:
m = eos.types.Module(item)
except ValueError:
return False
if m.fits(fit):
m.owner = fit
fit.modules.toModule(position, m)
if m.isValidState(State.ACTIVE):
m.state = State.ACTIVE
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
self.recalc(fit)
# Then, check states of all modules and change where needed. This will recalc if needed
self.checkStates(fit, m)
fit.fill()
eos.db.commit()
return True
else:
return None
def moveCargoToModule(self, fitID, moduleIdx, cargoIdx, copyMod=False):
"""
Moves cargo to fitting window. Can either do a copy, move, or swap with current module

View File

@@ -206,7 +206,9 @@ class Market():
"Leopard": self.les_grp, # 2013 new year gift
"Whiptail": self.les_grp, # AT12 prize
"Chameleon": self.les_grp, # AT12 prize
"Victorieux Luxury Yacht": self.les_grp # Worlds Collide prize \o/ chinese getting owned
"Victorieux Luxury Yacht": self.les_grp, # Worlds Collide prize \o/ chinese getting owned
"Imp": self.les_grp, # AT13 prize
"Fiend": self.les_grp, # AT13 prize
}
self.ITEMS_FORCEGROUP_R = self.__makeRevDict(self.ITEMS_FORCEGROUP)
@@ -230,9 +232,9 @@ class Market():
"Guristas Shuttle": False,
"Mobile Decoy Unit": False, # Seems to be left over test mod for deployables
"Tournament Micro Jump Unit": False, # Normally seen only on tournament arenas
"Council Diplomatic Shuttle": False, # CSM X celebration
"Imp": False, # AT13 prize, not a real ship yet
"Fiend": False, # AT13 prize, not a real ship yet
"Council Diplomatic Shuttle": False, # CSM X celebration]
"Imp": False, # AT13 prize
"Fiend": False, # AT13 prize
}
# do not publish ships that we convert

Binary file not shown.