Add option to export implants/boosters via ESI
This commit is contained in:
@@ -56,7 +56,7 @@ INV_FLAG_DRONEBAY = 87
|
||||
INV_FLAG_FIGHTER = 158
|
||||
|
||||
|
||||
def exportESI(ofit, exportCharges, callback):
|
||||
def exportESI(ofit, exportCharges, exportImplants, exportBoosters, callback):
|
||||
# A few notes:
|
||||
# max fit name length is 50 characters
|
||||
# Most keys are created simply because they are required, but bogus data is okay
|
||||
@@ -133,6 +133,22 @@ def exportESI(ofit, exportCharges, callback):
|
||||
item['type_id'] = fighter.item.ID
|
||||
fit['items'].append(item)
|
||||
|
||||
if exportImplants:
|
||||
for implant in ofit.implants:
|
||||
item = nested_dict()
|
||||
item['flag'] = INV_FLAG_CARGOBAY
|
||||
item['quantity'] = 1
|
||||
item['type_id'] = implant.item.ID
|
||||
fit['items'].append(item)
|
||||
|
||||
if exportBoosters:
|
||||
for booster in ofit.boosters:
|
||||
item = nested_dict()
|
||||
item['flag'] = INV_FLAG_CARGOBAY
|
||||
item['quantity'] = 1
|
||||
item['type_id'] = booster.item.ID
|
||||
fit['items'].append(item)
|
||||
|
||||
if len(fit['items']) == 0:
|
||||
raise ESIExportException("Cannot export fitting: module list cannot be empty.")
|
||||
|
||||
|
||||
@@ -323,8 +323,8 @@ class Port:
|
||||
return importESI(string)
|
||||
|
||||
@staticmethod
|
||||
def exportESI(fit, exportCharges, callback=None):
|
||||
return exportESI(fit, exportCharges, callback=callback)
|
||||
def exportESI(fit, exportCharges, exportImplants, exportBoosters, callback=None):
|
||||
return exportESI(fit, exportCharges, exportImplants, exportBoosters, callback=callback)
|
||||
|
||||
# XML-related methods
|
||||
@staticmethod
|
||||
|
||||
@@ -376,6 +376,8 @@ class EsiSettings:
|
||||
"timeout": 60,
|
||||
"server": "Tranquility",
|
||||
"exportCharges": True,
|
||||
"exportImplants": True,
|
||||
"exportBoosters": True,
|
||||
"enforceJwtExpiration": True
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user