Merge pull request #478 from Neugeniko/master

Handle Crest Import and Export of Drone Bay and Cargo Bay contents.
This commit is contained in:
blitzmann
2015-12-20 18:35:36 -05:00

View File

@@ -44,6 +44,9 @@ INV_FLAGS = {
Slot.RIG: 92,
Slot.SUBSYSTEM: 125}
INV_FLAG_CARGOBAY = 5
INV_FLAG_DRONEBAY = 87
class Port(object):
"""Service which houses all import/export format functions"""
@classmethod
@@ -90,7 +93,24 @@ class Port(object):
item['type']['href'] = "%stypes/%d/"%(eve._authed_endpoint, module.item.ID)
item['type']['id'] = module.item.ID
item['type']['name'] = ''
fit['items'].append(item)
for cargo in ofit.cargo:
item = nested_dict()
item['flag'] = INV_FLAG_CARGOBAY
item['quantity'] = cargo.amount
item['type']['href'] = "%stypes/%d/"%(eve._authed_endpoint, cargo.item.ID)
item['type']['id'] = cargo.item.ID
item['type']['name'] = ''
fit['items'].append(item)
for drone in ofit.drones:
item = nested_dict()
item['flag'] = INV_FLAG_DRONEBAY
item['quantity'] = drone.amount
item['type']['href'] = "%stypes/%d/"%(eve._authed_endpoint, drone.item.ID)
item['type']['id'] = drone.item.ID
item['type']['name'] = ''
fit['items'].append(item)
return json.dumps(fit)
@@ -142,11 +162,11 @@ class Port(object):
for module in items:
try:
item = sMkt.getItem(module['type']['id'], eager="group.category")
if item.category.name == "Drone":
if module['flag'] == INV_FLAG_DRONEBAY:
d = Drone(item)
d.amount = module['quantity']
f.drones.append(d)
elif item.category.name == "Charge":
elif module['flag'] == INV_FLAG_CARGOBAY:
c = Cargo(item)
c.amount = module['quantity']
f.cargo.append(c)