From 0c278b668ccba242fe247b13c04b6d98629263b0 Mon Sep 17 00:00:00 2001 From: Neugeniko Date: Wed, 16 Dec 2015 12:56:28 +1100 Subject: [PATCH] Handle Crest Import and Export of Drone Bay and Cargo Bay contents. --- service/port.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/service/port.py b/service/port.py index fc7d308b7..7f1ff11e2 100644 --- a/service/port.py +++ b/service/port.py @@ -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)