Remove local build files not intended for git
This commit is contained in:
@@ -1,255 +0,0 @@
|
||||
import inspect
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
from optparse import AmbiguousOptionError, BadOptionError, OptionParser
|
||||
|
||||
from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, StreamHandler, TimedRotatingFileHandler, WARNING, \
|
||||
__version__ as logbook_version
|
||||
|
||||
sys.path.append(os.getcwd())
|
||||
import config
|
||||
|
||||
from math import log
|
||||
|
||||
try:
|
||||
import wxversion
|
||||
except ImportError:
|
||||
wxversion = None
|
||||
|
||||
try:
|
||||
import sqlalchemy
|
||||
except ImportError:
|
||||
sqlalchemy = None
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
class PassThroughOptionParser(OptionParser):
|
||||
|
||||
def _process_args(self, largs, rargs, values):
|
||||
while rargs:
|
||||
try:
|
||||
OptionParser._process_args(self, largs, rargs, values)
|
||||
except (BadOptionError, AmbiguousOptionError) as e:
|
||||
pyfalog.error("Bad startup option passed.")
|
||||
largs.append(e.opt_str)
|
||||
|
||||
usage = "usage: %prog [--root]"
|
||||
parser = PassThroughOptionParser(usage=usage)
|
||||
parser.add_option("-r", "--root", action="store_true", dest="rootsavedata", help="if you want pyfa to store its data in root folder, use this option", default=False)
|
||||
parser.add_option("-w", "--wx28", action="store_true", dest="force28", help="Force usage of wxPython 2.8", default=False)
|
||||
parser.add_option("-d", "--debug", action="store_true", dest="debug", help="Set logger to debug level.", default=False)
|
||||
parser.add_option("-t", "--title", action="store", dest="title", help="Set Window Title", default=None)
|
||||
parser.add_option("-s", "--savepath", action="store", dest="savepath", help="Set the folder for savedata", default=None)
|
||||
parser.add_option("-l", "--logginglevel", action="store", dest="logginglevel", help="Set desired logging level [Critical|Error|Warning|Info|Debug]", default="Error")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.rootsavedata is True:
|
||||
config.saveInRoot = True
|
||||
|
||||
config.debug = options.debug
|
||||
|
||||
config.defPaths(options.savepath)
|
||||
|
||||
try:
|
||||
import requests
|
||||
config.requestsVersion = requests.__version__
|
||||
except ImportError:
|
||||
raise PreCheckException("Cannot import requests. You can download requests from https://pypi.python.org/pypi/requests.")
|
||||
|
||||
import eos.db
|
||||
|
||||
#if config.saVersion[0] > 0 or config.saVersion[1] >= 7:
|
||||
# <0.7 doesn't have support for events ;_; (mac-deprecated)
|
||||
config.sa_events = True
|
||||
import eos.events
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
import service.prefetch # noqa: F401
|
||||
|
||||
# Make sure the saveddata db exists
|
||||
if not os.path.exists(config.savePath):
|
||||
os.mkdir(config.savePath)
|
||||
|
||||
eos.db.saveddata_meta.create_all()
|
||||
|
||||
import json
|
||||
from service.fit import Fit
|
||||
from service.efsPort import EfsPort
|
||||
|
||||
from sqlalchemy import Column, String, Integer, ForeignKey, Boolean, Table
|
||||
from sqlalchemy.orm import relation, mapper, synonym, deferred
|
||||
from eos.db import gamedata_session
|
||||
from eos.db import gamedata_meta
|
||||
from eos.db.gamedata.metaGroup import metatypes_table, items_table
|
||||
from eos.db.gamedata.group import groups_table
|
||||
|
||||
from eos.gamedata import AlphaClone, Attribute, Category, Group, Item, MarketGroup, \
|
||||
MetaGroup, AttributeInfo, MetaData, Effect, ItemEffect, Traits
|
||||
from eos.db.gamedata.traits import traits_table
|
||||
from eos.saveddata.mode import Mode
|
||||
|
||||
def exportBaseShips(opts):
|
||||
nameReq = ''
|
||||
if opts:
|
||||
if opts.search:
|
||||
nameReq = opts.search
|
||||
if opts.outputpath:
|
||||
basePath = opts.outputpath
|
||||
elif opts.savepath:
|
||||
basePath = opts.savepath
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
if basePath[len(basePath) - 1] != os.sep:
|
||||
basePath = basePath + os.sep
|
||||
outputBaseline = open(basePath + 'shipBaseJSON.js', 'w')
|
||||
outputBaseline.write('let shipBaseJSON = JSON.stringify([')
|
||||
shipCata = eos.db.getItemsByCategory('Ship')
|
||||
baseLimit = 1000
|
||||
baseN = 0
|
||||
for ship in iter(shipCata):
|
||||
if baseN < baseLimit and nameReq in ship.name:
|
||||
print(ship.name)
|
||||
print(ship.groupID)
|
||||
dna = str(ship.ID)
|
||||
if ship.groupID == 963:
|
||||
stats = t3cGetStatSet(dna, ship.name, ship.groupID, ship.raceID)
|
||||
elif ship.groupID == 1305:
|
||||
stats = t3dGetStatSet(dna, ship.name, ship.groupID, ship.raceID)
|
||||
else:
|
||||
stats = setFitFromString(dna, ship.name, ship.groupID)
|
||||
outputBaseline.write(stats)
|
||||
outputBaseline.write(',\n')
|
||||
baseN += 1
|
||||
outputBaseline.write(']);\nexport {shipBaseJSON};')
|
||||
outputBaseline.close()
|
||||
|
||||
def t3dGetStatSet(dnaString, shipName, groupID, raceID):
|
||||
t3dModeGroupFilter = Group.groupID == 1306
|
||||
data = list(gamedata_session.query(Group).options().filter(t3dModeGroupFilter).all())
|
||||
#Normally we would filter this via the raceID,
|
||||
#Unfortunately somebody fat fingered the Jackdaw modes raceIDs as 4 (Amarr) not 1 (Caldari)
|
||||
# t3dModes = list(filter(lambda mode: mode.raceID == raceID, data[0].items)) #Line for if/when they fix it
|
||||
t3dModes = list(filter(lambda mode: shipName in mode.name, data[0].items))
|
||||
shipModeData = ''
|
||||
n = 0
|
||||
while n < len(t3dModes):
|
||||
dna = dnaString + ':' + str(t3dModes[n].ID) + ';1'
|
||||
#Don't add the new line for the last mode
|
||||
if n < len(t3dModes) - 1:
|
||||
shipModeData += setFitFromString(dna, t3dModes[n].name, groupID) + ',\n'
|
||||
else:
|
||||
shipModeData += setFitFromString(dna, t3dModes[n].name, groupID)
|
||||
n += 1
|
||||
return shipModeData
|
||||
|
||||
def t3cGetStatSet(dnaString, shipName, groupID, raceID):
|
||||
subsystemFilter = Group.categoryID == 32
|
||||
data = list(gamedata_session.query(Group).options().filter(subsystemFilter).all())
|
||||
# multi dimension array to hold the t3c subsystems as ss[index of subsystem type][index subsystem item]
|
||||
ss = [[], [], [], []]
|
||||
s = 0
|
||||
while s < 4:
|
||||
ss[s] = list(filter(lambda subsystem: subsystem.raceID == raceID, data[s].items))
|
||||
s += 1
|
||||
print(shipName)
|
||||
print(ss)
|
||||
shipPermutationData = ''
|
||||
n = 0
|
||||
a = 0
|
||||
while a < 3:
|
||||
b = 0
|
||||
while b < 3:
|
||||
c = 0
|
||||
while c < 3:
|
||||
d = 0
|
||||
while d < 3:
|
||||
dna = dnaString + ':' + str(ss[0][a].ID) \
|
||||
+ ';1:' + str(ss[1][b].ID) + ';1:' + str(ss[2][c].ID) \
|
||||
+ ';1:' + str(ss[3][d].ID) + ';1'
|
||||
#Don't add the new line for the last permutation
|
||||
if a == 2 and b == 2 and c == 2 and d == 2:
|
||||
shipPermutationData += setFitFromString(dna, shipName, groupID)
|
||||
else:
|
||||
shipPermutationData += setFitFromString(dna, shipName, groupID) + ',\n'
|
||||
d += 1
|
||||
n += 1
|
||||
c += 1
|
||||
b += 1
|
||||
a += 1
|
||||
print(str(n) + ' subsystem conbinations for ' + shipName)
|
||||
return shipPermutationData
|
||||
try:
|
||||
armorLinkShip = eos.db.searchFits('armor links')[0]
|
||||
infoLinkShip = eos.db.searchFits('information links')[0]
|
||||
shieldLinkShip = eos.db.searchFits('shield links')[0]
|
||||
skirmishLinkShip = eos.db.searchFits('skirmish links')[0]
|
||||
except:
|
||||
armorLinkShip = None
|
||||
infoLinkShip = None
|
||||
shieldLinkShip = None
|
||||
skirmishLinkShip = None
|
||||
|
||||
def setFitFromString(dnaString, fitName, groupID) :
|
||||
if armorLinkShip == None:
|
||||
print('Cannot find correct link fits for base calculations')
|
||||
return ''
|
||||
modArray = dnaString.split(':')
|
||||
fitL = Fit()
|
||||
fitID = fitL.newFit(int(modArray[0]), fitName)
|
||||
fit = eos.db.getFit(fitID)
|
||||
ammoArray = []
|
||||
n = -1
|
||||
for mod in iter(modArray):
|
||||
n = n + 1
|
||||
if n > 0:
|
||||
modSp = mod.split(';')
|
||||
if len(modSp) == 2:
|
||||
k = 0
|
||||
while k < int(modSp[1]):
|
||||
k = k + 1
|
||||
itemID = int(modSp[0])
|
||||
item = eos.db.getItem(int(modSp[0]), eager=("attributes", "group.category"))
|
||||
cat = item.category.name
|
||||
print(cat)
|
||||
if cat == 'Drone':
|
||||
fitL.addDrone(fitID, itemID, int(modSp[1]), recalc=False)
|
||||
k += int(modSp[1])
|
||||
if cat == 'Fighter':
|
||||
fitL.addFighter(fitID, itemID, recalc=False)
|
||||
k += 100
|
||||
if fitL.isAmmo(int(modSp[0])):
|
||||
k += 100
|
||||
ammoArray.append(int(modSp[0]));
|
||||
# Set mode if module is a mode on a t3d
|
||||
if item.groupID == 1306 and groupID == 1305:
|
||||
fitL.setMode(fitID, Mode(item))
|
||||
else:
|
||||
fitL.appendModule(fitID, int(modSp[0]))
|
||||
fit = eos.db.getFit(fitID)
|
||||
for ammo in iter(ammoArray):
|
||||
fitL.setAmmo(fitID, ammo, list(filter(lambda mod: str(mod).find('name') > 0, fit.modules)))
|
||||
if len(fit.drones) > 0:
|
||||
fit.drones[0].amountActive = fit.drones[0].amount
|
||||
eos.db.commit()
|
||||
for fighter in iter(fit.fighters):
|
||||
for ability in fighter.abilities:
|
||||
if ability.effect.handlerName == u'fighterabilityattackm' and ability.active == True:
|
||||
for abilityAltRef in fighter.abilities:
|
||||
if abilityAltRef.effect.isImplemented:
|
||||
abilityAltRef.active = True
|
||||
fitL.recalc(fit)
|
||||
fit = eos.db.getFit(fitID)
|
||||
print(list(filter(lambda mod: mod.item and mod.item.groupID in [1189, 658], fit.modules)))
|
||||
fitL.addCommandFit(fit.ID, armorLinkShip)
|
||||
fitL.addCommandFit(fit.ID, shieldLinkShip)
|
||||
fitL.addCommandFit(fit.ID, skirmishLinkShip)
|
||||
fitL.addCommandFit(fit.ID, infoLinkShip)
|
||||
jsonStr = EfsPort.exportEfs(fit, groupID)
|
||||
Fit.deleteFit(fitID)
|
||||
return jsonStr
|
||||
@@ -1,55 +0,0 @@
|
||||
import inspect
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
sys.path.append(os.getcwd())
|
||||
import config
|
||||
from pyfa import options
|
||||
|
||||
if options.rootsavedata is True:
|
||||
config.saveInRoot = True
|
||||
config.debug = options.debug
|
||||
config.defPaths(options.savepath)
|
||||
|
||||
import eos.db
|
||||
# Make sure the saveddata db exists
|
||||
if not os.path.exists(config.savePath):
|
||||
os.mkdir(config.savePath)
|
||||
|
||||
from service.efsPort import EfsPort
|
||||
|
||||
def exportPyfaFits(opts):
|
||||
nameReq = ''
|
||||
if opts:
|
||||
if opts.search:
|
||||
nameReq = opts.search
|
||||
if opts.outputpath:
|
||||
basePath = opts.outputpath
|
||||
elif opts.savepath:
|
||||
basePath = opts.savepath
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
if basePath[len(basePath) - 1] != os.sep:
|
||||
basePath = basePath + os.sep
|
||||
output = open(basePath + 'shipJSON.js', 'w')
|
||||
output.write('let shipJSON = JSON.stringify([')
|
||||
#The current storage system isn't going to hold more than 2500 fits as local browser storage is limited
|
||||
limit = 2500
|
||||
skipTill = 0
|
||||
n = 0
|
||||
fitList = eos.db.getFitList()
|
||||
for fit in fitList:
|
||||
if limit == None or n < limit:
|
||||
n += 1
|
||||
name = fit.ship.name + ': ' + fit.name
|
||||
if n >= skipTill and nameReq in name:
|
||||
stats = EfsPort.exportEfs(fit, 0)
|
||||
output.write(stats)
|
||||
output.write(',\n')
|
||||
output.write(']);\nexport {shipJSON};')
|
||||
output.close()
|
||||
@@ -1,60 +0,0 @@
|
||||
from efs_export_base_fits import *
|
||||
|
||||
def efsFitsFromHTMLExport(opts):
|
||||
if opts:
|
||||
if opts.outputpath:
|
||||
basePath = opts.outputpath
|
||||
elif opts.savepath:
|
||||
basePath = opts.savepath
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
else:
|
||||
basePath = config.savePath + os.sep
|
||||
if basePath[len(basePath) - 1] != os.sep:
|
||||
basePath = basePath + os.sep
|
||||
output = open(basePath + 'shipJSON.js', 'w')
|
||||
output.write('let shipJSON = JSON.stringify([')
|
||||
try:
|
||||
with open('pyfaFits.html'):
|
||||
fileLocation = 'pyfaFits.html'
|
||||
except:
|
||||
try:
|
||||
d = config.savePath + os.sep + 'pyfaFits.html'
|
||||
print(d)
|
||||
with open(d):
|
||||
fileLocation = d
|
||||
except:
|
||||
fileLocation = None;
|
||||
limit = 10000
|
||||
n = 0
|
||||
skipTill = 0
|
||||
nameReq = ''
|
||||
minimalExport = True
|
||||
if fileLocation != None:
|
||||
with open(fileLocation) as f:
|
||||
for fullLine in f:
|
||||
if limit == None or n < limit:
|
||||
if n <= 1 and '<!DOCTYPE html>' in fullLine:
|
||||
minimalExport = False
|
||||
n += 1
|
||||
fullIndex = fullLine.find('data-dna="')
|
||||
minimalIndex = fullLine.find('/dna/')
|
||||
if fullIndex >= 0:
|
||||
startInd = fullLine.find('data-dna="') + 10
|
||||
elif minimalIndex >= 0 and minimalExport:
|
||||
startInd = fullLine.find('/dna/') + 5
|
||||
else:
|
||||
startInd = -1
|
||||
print(startInd)
|
||||
if startInd >= 0:
|
||||
line = fullLine[startInd:len(fullLine)]
|
||||
endInd = line.find('::')
|
||||
dna = line[0:endInd]
|
||||
name = line[line.find('>') + 1:line.find('<')]
|
||||
if n >= skipTill and nameReq in name:
|
||||
print('name: ' + name + ' DNA: ' + dna + fullLine)
|
||||
stats = setFitFromString(dna, name, 0)
|
||||
output.write(stats)
|
||||
output.write(',\n')
|
||||
output.write(']);\nexport {shipJSON};')
|
||||
output.close()
|
||||
@@ -1,212 +0,0 @@
|
||||
from optparse import AmbiguousOptionError, BadOptionError, OptionParser
|
||||
|
||||
class PassThroughOptionParser(OptionParser):
|
||||
|
||||
def _process_args(self, largs, rargs, values):
|
||||
while rargs:
|
||||
try:
|
||||
OptionParser._process_args(self, largs, rargs, values)
|
||||
except (BadOptionError, AmbiguousOptionError) as e:
|
||||
pyfalog.error("Bad startup option passed.")
|
||||
largs.append(e.opt_str)
|
||||
|
||||
usage = "usage: %prog [options]"
|
||||
parser = PassThroughOptionParser(usage=usage)
|
||||
parser.add_option(
|
||||
"-f", "--exportfits", action="store_true", dest="exportfits", \
|
||||
help="Export this copy of pyfa's local fits to a shipJSON file that Eve Fleet Simulator can import from", \
|
||||
default=False)
|
||||
parser.add_option(
|
||||
"-b", "--exportbaseships", action="store_true", dest="exportbaseships", \
|
||||
help="Export ship stats to a shipBaseJSON file used by Eve Fleet Simulator", \
|
||||
default=False)
|
||||
parser.add_option(
|
||||
"-c", "--convertfitsfromhtml", action="store_true", dest="convertfitsfromhtml", \
|
||||
help="Convert an exported pyfaFits.html file to a shipJSON file that Eve Fleet Simulator can import from\n"
|
||||
+ " Note this process loses data like fleet boosters as the DNA format exported by to html contains limited data", \
|
||||
default=False)
|
||||
parser.add_option("-s", "--savepath", action="store", dest="savepath",
|
||||
help="Set the folder for savedata", default=None)
|
||||
parser.add_option(
|
||||
"-o", "--outputpath", action="store", dest="outputpath",
|
||||
help="Output directory, defaults to the savepath", default=None)
|
||||
parser.add_option(
|
||||
'-i', "--search", action="store", dest="search",
|
||||
help="Ignore ships and fits that don't contain the searched string", default=None)
|
||||
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.exportfits:
|
||||
from efs_export_pyfa_fits import exportPyfaFits
|
||||
exportPyfaFits(options)
|
||||
|
||||
if options.exportbaseships:
|
||||
from efs_export_base_fits import exportBaseShips
|
||||
exportBaseShips(options)
|
||||
|
||||
if options.convertfitsfromhtml:
|
||||
from efs_process_html_export import efsFitsFromHTMLExport
|
||||
efsFitsFromHTMLExport(options)
|
||||
|
||||
#stuff bellow this point is purely scrap diagnostic stuff and should not be public (as it's scrawl)
|
||||
def printGroupData():
|
||||
from eos.db import gamedata_session
|
||||
from eos.gamedata import Group, Category
|
||||
filterVal = Group.categoryID == 6
|
||||
data = gamedata_session.query(Group).options().list(filter(filterVal).all())
|
||||
for group in data:
|
||||
print(group.groupName + ' groupID: ' + str(group.groupID))
|
||||
return ''
|
||||
|
||||
def printSizeData():
|
||||
from eos.db import gamedata_session
|
||||
from eos.gamedata import Group
|
||||
filterVal = Group.categoryID == 6
|
||||
data = gamedata_session.query(Group).options().filter(filterVal).all()
|
||||
ships = gamedata_session.query(Group).options().filter(filterVal)
|
||||
print(data)
|
||||
print(vars(data[0]))
|
||||
|
||||
shipSizes = ['Frigate', 'Destroyer', 'Cruiser', 'Battlecruiser', 'Battleship', 'Capital', 'Industrial', 'Misc']
|
||||
groupSets = [
|
||||
[25, 31, 237, 324, 830, 831, 834, 893, 1283, 1527],
|
||||
[420, 541, 1305, 1534],
|
||||
[26, 358, 832, 833, 894, 906, 963],
|
||||
[419, 540, 1201],
|
||||
[27, 381, 898, 900],
|
||||
[30, 485, 513, 547, 659, 883, 902, 1538],
|
||||
[28, 380, 1202, 463, 543, 941],
|
||||
[29, 1022]
|
||||
]
|
||||
i = 0
|
||||
while i < 8:
|
||||
groupNames = '\'' + shipSizes[i] + '\': {\'name\': \'' + shipSizes[i] + '\', \'groupIDs\': groupIDFromGroupName(['
|
||||
for gid in groupSets[i]:
|
||||
if gid is not groupSets[i][0]:
|
||||
groupNames = groupNames + '\', '
|
||||
groupNames = groupNames + '\'' + list(filter(lambda gr: gr.groupID == gid, data))[0].groupName
|
||||
print(groupNames + '\'], data)}')
|
||||
i = i + 1
|
||||
projectedModGroupIds = [
|
||||
41, 52, 65, 67, 68, 71, 80, 201, 208, 291, 325, 379, 585,
|
||||
842, 899, 1150, 1154, 1189, 1306, 1672, 1697, 1698, 1815, 1894
|
||||
]
|
||||
from eos.db import gamedata_session
|
||||
from eos.gamedata import Group
|
||||
data = gamedata_session.query(Group).all()
|
||||
groupNames = ''
|
||||
for gid in projectedModGroupIds:
|
||||
if gid is not projectedModGroupIds[0]:
|
||||
groupNames = groupNames + '\', '
|
||||
print(gid)
|
||||
groupNames = groupNames + '\'' + list(filter(lambda gr: gr.groupID == gid, data))[0].groupName
|
||||
print(groupNames + '\'')
|
||||
|
||||
def wepMultisFromTraitText(fit):
|
||||
filterVal = Traits.typeID == fit.shipID
|
||||
data = gamedata_session.query(Traits).options().filter(filterVal).all()
|
||||
roleBonusMode = False
|
||||
if len(data) == 0:
|
||||
return multipliers
|
||||
d = data[0]
|
||||
s1 = str(vars(d))
|
||||
ds = s1.encode(encoding="utf-8", errors="ignore")
|
||||
#print(ds)
|
||||
previousTypedBonus = 0
|
||||
previousDroneTypeBonus = 0
|
||||
for bonusText in data[0].traitText.splitlines():
|
||||
bonusText = bonusText.lower()
|
||||
if 'per skill level' in bonusText:
|
||||
roleBonusMode = False
|
||||
if 'role bonus' in bonusText or 'misc bonus' in bonusText:
|
||||
roleBonusMode = True
|
||||
multi = 1
|
||||
if 'damage' in bonusText and not any(e in bonusText for e in ['control', 'heat']):
|
||||
splitText = bonusText.split('%')
|
||||
if (float(splitText[0]) > 0) is False:
|
||||
print('damage bonus split did not parse correctly!')
|
||||
print(float(splitText[0]))
|
||||
if roleBonusMode:
|
||||
addedMulti = float(splitText[0])
|
||||
else:
|
||||
addedMulti = float(splitText[0]) * 5
|
||||
if any(e in bonusText for e in [' em', 'thermal', 'kinetic', 'explosive']):
|
||||
if addedMulti > previousTypedBonus:
|
||||
previousTypedBonus = addedMulti
|
||||
else:
|
||||
addedMulti = 0
|
||||
if any(e in bonusText for e in ['heavy drone', 'medium drone', 'light drone', 'sentry drone']):
|
||||
if addedMulti > previousDroneTypeBonus:
|
||||
previousDroneTypeBonus = addedMulti
|
||||
else:
|
||||
addedMulti = 0
|
||||
multi = 1 + (addedMulti / 100)
|
||||
elif 'rate of fire' in bonusText:
|
||||
splitText = bonusText.split('%')
|
||||
if (float(splitText[0]) > 0) is False:
|
||||
print('rate of fire bonus split did not parse correctly!')
|
||||
print(float(splitText[0]))
|
||||
if roleBonusMode:
|
||||
rofMulti = float(splitText[0])
|
||||
else:
|
||||
rofMulti = float(splitText[0]) * 5
|
||||
multi = 1 / (1 - (rofMulti / 100))
|
||||
if multi > 1:
|
||||
if 'drone' in bonusText.lower():
|
||||
multipliers['droneBandwidth'] *= multi
|
||||
elif 'turret' in bonusText.lower():
|
||||
multipliers['turret'] *= multi
|
||||
elif any(e in bonusText for e in ['missile', 'torpedo']):
|
||||
multipliers['launcher'] *= multi
|
||||
|
||||
|
||||
def examDiff(ai, bi, attr=False):
|
||||
print('')
|
||||
print('A:' + str(ai))
|
||||
print('B:' + str(bi))
|
||||
a = dict(map(lambda k: (k, getattr(ai, k)), dir(ai)))
|
||||
b = dict(map(lambda k: (k, getattr(bi, k)), dir(bi)))
|
||||
try:
|
||||
print(a.keys())
|
||||
print('A:' + str(a))
|
||||
print(b.keys())
|
||||
print('B:' + str(b))
|
||||
print('A exclusive keys:')
|
||||
for key in filter(lambda k: k not in b.keys(), a.keys()):
|
||||
print(key)
|
||||
print('B exclusive keys:')
|
||||
for key in filter(lambda k: k not in a.keys(), b.keys()):
|
||||
print(key)
|
||||
print('A key/value pairs where B is None:')
|
||||
for key in filter(lambda k: k in b.keys() and b[k] == None and a[k] != None, a.keys()):
|
||||
print(key)
|
||||
print(a[key])
|
||||
print('B key/value pairs where A is None:')
|
||||
for key in filter(lambda k: k in a.keys() and a[k] == None and b[k] != None, b.keys()):
|
||||
print(key)
|
||||
print(b[key])
|
||||
except Exception as e:
|
||||
if attr == True:
|
||||
print('Could not print itemModifiedAttributes for a or b')
|
||||
print(e)
|
||||
else:
|
||||
print('Checking itemModifiedAttributes diff')
|
||||
examDiff(ai.itemModifiedAttributes, bi.itemModifiedAttributes, True)
|
||||
if attr == False:
|
||||
print('Checking itemModifiedAttributes diff')
|
||||
examDiff(ai.itemModifiedAttributes, bi.itemModifiedAttributes, True)
|
||||
print('')
|
||||
|
||||
def groupIDFromGroupName(names, data=None):
|
||||
# Group data can optionally be passed to the function to improve preformace with repeated calls.
|
||||
if data is None:
|
||||
data = gamedata_session.query(Group).all()
|
||||
returnSingle = False
|
||||
if not isinstance(names, list):
|
||||
names = [names]
|
||||
returnSingle = True
|
||||
gidList = list(map(lambda incGroup: incGroup.groupID, (filter(lambda group: group.groupName in names, data))))
|
||||
if returnSingle:
|
||||
return gidList[0]
|
||||
return gidList
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [[ $2 == -v ]] ; then
|
||||
MUTE=False
|
||||
else
|
||||
MUTE=TRUE
|
||||
fi
|
||||
EXPECTERRORS=False
|
||||
if [[ $3 == --search ]] ; then
|
||||
if [[ $5 == --expect-errors ]] ; then
|
||||
EXPECTERRORS=True
|
||||
fi
|
||||
else
|
||||
if [[ $3 == --expect-errors ]] ; then
|
||||
EXPECTERRORS=True
|
||||
fi
|
||||
fi
|
||||
if [[ $1 == -f ]] ; then
|
||||
if [[ $MUTE == TRUE ]] ; then
|
||||
python3opt savedata/efs_util.py\ -f | grep awgahwogfa
|
||||
else
|
||||
python3opt savedata/efs_util.py\ -f\ --search=$4
|
||||
fi
|
||||
elif [[ $1 == -b ]] ; then
|
||||
if [[ $MUTE == TRUE ]] ; then
|
||||
python3opt savedata/efs_util.py\ -b | grep awgahwogfa
|
||||
else
|
||||
python3opt savedata/efs_util.py\ -b\ --search=$4
|
||||
fi
|
||||
elif [[ $1 == -u ]] ; then
|
||||
if [[ $MUTE == TRUE ]] ; then
|
||||
python3opt savedata/efs_util.py\ -b\ -f\ -o\ .. | grep awgahwogfa
|
||||
else
|
||||
python3opt savedata/efs_util.py\ -b\ -f\ -o\ ..
|
||||
fi
|
||||
elif [[ $1 == -a ]] ; then
|
||||
if [[ $MUTE == TRUE ]] ; then
|
||||
python3opt savedata/efs_util.py\ -b\ -f | grep awgahwogfa
|
||||
else
|
||||
python3opt savedata/efs_util.py\ -b\ -f\ --search=$4
|
||||
fi
|
||||
else
|
||||
echo Defaulting to fits and base ships.\n
|
||||
if [[ $MUTE == TRUE ]] ; then
|
||||
python3opt savedata/efs_util.py\ -b\ -f | grep awgahwogfa
|
||||
else
|
||||
python3opt savedata/efs_util.py\ -b\ -f\ --search=$4
|
||||
fi
|
||||
fi
|
||||
if [[ $EXPECTERRORS == True ]] ; then
|
||||
echo Expecting non standard output, this should only be used for testing
|
||||
else
|
||||
diff -s --color=always ../shipJSON.js ~/.pyfa/shipJSON.js | grep -m 3 --color ''
|
||||
diff -s --color=always ../shipBaseJSON.js ~/.pyfa/shipBaseJSON.js | grep -m 3 --color ''
|
||||
/home/stock/scripts/Pyfa/.tox/pep8/bin/flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py,floatspin.py --ignore=E121,E126,E127,E128,E203,E731,F401,E722,E741 service/efsPort.py --max-line-length=165
|
||||
fi
|
||||
Reference in New Issue
Block a user