Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -7,7 +7,7 @@ Migration 1
|
||||
loaded as they no longer exist in the database. We therefore replace these
|
||||
modules with their new replacements
|
||||
|
||||
Based on http://community.eveonline.com/news/patch-notes/patch-notes-for-oceanus/
|
||||
Based on https://www.eveonline.com/news/view/patch-notes-for-oceanus
|
||||
and output of itemDiff.py
|
||||
"""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Migration 25
|
||||
|
||||
- Converts T3C fitting configurations based on the spreadsheet noted here:
|
||||
https://community.eveonline.com/news/patch-notes/patch-notes-for-july-2017-release
|
||||
https://www.eveonline.com/news/view/patch-notes-for-july-2017-release
|
||||
|
||||
(csv copies can be found on the pyfa repo in case the official documents are deleted)
|
||||
|
||||
@@ -4228,8 +4228,8 @@ def upgrade(saveddata_engine):
|
||||
# We don't have a conversion for this. I don't think this will ever happen, but who knows
|
||||
continue
|
||||
|
||||
# It doesn't actully matter which old module is replaced with which new module, so we don't have to worry
|
||||
# about module position or anything like that. Just doe a straight up record UPDATE
|
||||
# It doesn't actually matter which old module is replaced with which new module, so we don't have to worry
|
||||
# about module position or anything like that. Just do a straight up record UPDATE
|
||||
for i, old in enumerate(oldModules[:4]):
|
||||
saveddata_engine.execute("UPDATE modules SET itemID = ? WHERE ID = ?", (newModules[i], old[0]))
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Migration 4
|
||||
from database), which causes pyfa to crash. We therefore replace these
|
||||
modules with their new replacements
|
||||
|
||||
Based on http://community.eveonline.com/news/patch-notes/patch-notes-for-proteus/
|
||||
Based on https://www.eveonline.com/news/view/patch-notes-for-proteus
|
||||
and output of itemDiff.py
|
||||
"""
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ matplotlib==3.8.2
|
||||
python-dateutil==2.8.2
|
||||
requests==2.31.0
|
||||
sqlalchemy==1.4.50
|
||||
cryptography==41.0.7
|
||||
cryptography==42.0.2
|
||||
markdown2==2.4.11
|
||||
packaging==23.2
|
||||
roman==4.1
|
||||
|
||||
@@ -28,17 +28,20 @@ from service.esiAccess import EsiAccess
|
||||
|
||||
def renderMutant(mutant, firstPrefix='', prefix=''):
|
||||
exportLines = []
|
||||
exportLines.append('{}{}'.format(firstPrefix, mutant.baseItem.name))
|
||||
exportLines.append('{}{}'.format(prefix, mutant.mutaplasmid.item.name))
|
||||
exportLines.append('{}{}'.format(prefix, renderMutantAttrs(mutant)))
|
||||
return '\n'.join(exportLines)
|
||||
|
||||
|
||||
def renderMutantAttrs(mutant):
|
||||
mutatedAttrs = {}
|
||||
for attrID, mutator in mutant.mutators.items():
|
||||
attrName = getAttributeInfo(attrID).name
|
||||
mutatedAttrs[attrName] = mutator.value
|
||||
exportLines.append('{}{}'.format(firstPrefix, mutant.baseItem.name))
|
||||
exportLines.append('{}{}'.format(prefix, mutant.mutaplasmid.item.name))
|
||||
customAttrsLine = ', '.join(
|
||||
return ', '.join(
|
||||
'{} {}'.format(a, floatUnerr(mutatedAttrs[a]))
|
||||
for a in sorted(mutatedAttrs))
|
||||
exportLines.append('{}{}'.format(prefix, customAttrsLine))
|
||||
return '\n'.join(exportLines)
|
||||
|
||||
|
||||
def parseMutant(lines):
|
||||
@@ -64,8 +67,13 @@ def parseMutant(lines):
|
||||
mutationsLine = lines[2]
|
||||
except IndexError:
|
||||
return baseItem, mutaplasmidItem, {}
|
||||
mutations = parseMutantAttrs(mutationsLine)
|
||||
return baseItem, mutaplasmidItem, mutations
|
||||
|
||||
|
||||
def parseMutantAttrs(line):
|
||||
mutations = {}
|
||||
pairs = [p.strip() for p in mutationsLine.split(',')]
|
||||
pairs = [p.strip() for p in line.split(',')]
|
||||
for pair in pairs:
|
||||
try:
|
||||
attrName, value = pair.split(' ')
|
||||
@@ -79,7 +87,7 @@ def parseMutant(lines):
|
||||
if attrInfo is None:
|
||||
continue
|
||||
mutations[attrInfo.ID] = value
|
||||
return baseItem, mutaplasmidItem, mutations
|
||||
return mutations
|
||||
|
||||
|
||||
def parseDynamicItemString(text):
|
||||
|
||||
@@ -24,6 +24,7 @@ import xml.parsers.expat
|
||||
from logbook import Logger
|
||||
|
||||
from eos.const import FittingModuleState, FittingSlot
|
||||
from eos.db import getDynamicItem
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
@@ -34,7 +35,8 @@ from eos.saveddata.ship import Ship
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
from service.port.shared import IPortUser, processing_notify
|
||||
from service.port.muta import renderMutantAttrs, parseMutantAttrs
|
||||
from service.port.shared import IPortUser, processing_notify, fetchItem
|
||||
from utils.strfunctions import replace_ltgt, sequential_rep
|
||||
|
||||
|
||||
@@ -115,7 +117,7 @@ def _resolve_ship(fitting, sMkt, b_localized):
|
||||
|
||||
def _resolve_module(hardware, sMkt, b_localized):
|
||||
# type: (xml.dom.minidom.Element, service.market.Market, bool) -> eos.saveddata.module.Module
|
||||
moduleName = hardware.getAttribute("type")
|
||||
moduleName = hardware.getAttribute("base_type") or hardware.getAttribute("type")
|
||||
emergency = None
|
||||
if b_localized:
|
||||
try:
|
||||
@@ -142,7 +144,14 @@ def _resolve_module(hardware, sMkt, b_localized):
|
||||
must_retry = True
|
||||
if not must_retry:
|
||||
break
|
||||
return item
|
||||
|
||||
mutaplasmidName = hardware.getAttribute("mutaplasmid")
|
||||
mutaplasmidItem = fetchItem(mutaplasmidName) if mutaplasmidName else None
|
||||
|
||||
mutatedAttrsText = hardware.getAttribute("mutated_attrs")
|
||||
mutatedAttrs = parseMutantAttrs(mutatedAttrsText) if mutatedAttrsText else None
|
||||
|
||||
return item, mutaplasmidItem, mutatedAttrs
|
||||
|
||||
|
||||
def importXml(text, iportuser):
|
||||
@@ -185,12 +194,25 @@ def importXml(text, iportuser):
|
||||
moduleList = []
|
||||
for hardware in hardwares:
|
||||
try:
|
||||
item = _resolve_module(hardware, sMkt, b_localized)
|
||||
item, mutaItem, mutaAttrs = _resolve_module(hardware, sMkt, b_localized)
|
||||
if not item or not item.published:
|
||||
continue
|
||||
|
||||
if item.category.name == "Drone":
|
||||
d = Drone(item)
|
||||
d = None
|
||||
if mutaItem:
|
||||
mutaplasmid = getDynamicItem(mutaItem.ID)
|
||||
if mutaplasmid:
|
||||
try:
|
||||
d = Drone(mutaplasmid.resultingItem, item, mutaplasmid)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
for attrID, mutator in d.mutators.items():
|
||||
if attrID in mutaAttrs:
|
||||
mutator.value = mutaAttrs[attrID]
|
||||
if d is None:
|
||||
d = Drone(item)
|
||||
d.amount = int(hardware.getAttribute("qty"))
|
||||
fitobj.drones.append(d)
|
||||
elif item.category.name == "Fighter":
|
||||
@@ -205,8 +227,21 @@ def importXml(text, iportuser):
|
||||
c.amount = int(hardware.getAttribute("qty"))
|
||||
fitobj.cargo.append(c)
|
||||
else:
|
||||
m = None
|
||||
try:
|
||||
m = Module(item)
|
||||
if mutaItem:
|
||||
mutaplasmid = getDynamicItem(mutaItem.ID)
|
||||
if mutaplasmid:
|
||||
try:
|
||||
m = Module(mutaplasmid.resultingItem, item, mutaplasmid)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
for attrID, mutator in m.mutators.items():
|
||||
if attrID in mutaAttrs:
|
||||
mutator.value = mutaAttrs[attrID]
|
||||
if m is None:
|
||||
m = Module(item)
|
||||
# When item can't be added to any slot (unknown item or just charge), ignore it
|
||||
except ValueError:
|
||||
pyfalog.warning("item can't be added to any slot (unknown item or just charge), ignore it")
|
||||
@@ -254,6 +289,11 @@ def exportXml(fits, iportuser, callback):
|
||||
fittings.setAttribute("count", "%s" % fit_count)
|
||||
doc.appendChild(fittings)
|
||||
|
||||
def addMutantAttributes(node, mutant):
|
||||
node.setAttribute("base_type", mutant.baseItem.name)
|
||||
node.setAttribute("mutaplasmid", mutant.mutaplasmid.item.name)
|
||||
node.setAttribute("mutated_attrs", renderMutantAttrs(mutant))
|
||||
|
||||
for i, fit in enumerate(fits):
|
||||
try:
|
||||
fitting = doc.createElement("fitting")
|
||||
@@ -303,6 +343,9 @@ def exportXml(fits, iportuser, callback):
|
||||
slotName = FittingSlot(slot).name.lower()
|
||||
slotName = slotName if slotName != "high" else "hi"
|
||||
hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId))
|
||||
if module.isMutated:
|
||||
addMutantAttributes(hardware, module)
|
||||
|
||||
fitting.appendChild(hardware)
|
||||
|
||||
if module.charge:
|
||||
@@ -316,6 +359,9 @@ def exportXml(fits, iportuser, callback):
|
||||
hardware.setAttribute("qty", "%d" % drone.amount)
|
||||
hardware.setAttribute("slot", "drone bay")
|
||||
hardware.setAttribute("type", drone.item.name)
|
||||
if drone.isMutated:
|
||||
addMutantAttributes(hardware, drone)
|
||||
|
||||
fitting.appendChild(hardware)
|
||||
|
||||
for fighter in fit.fighters:
|
||||
|
||||
Reference in New Issue
Block a user