| 259 | # They always are added initially for the sake of brevity, as this option may not be retained long term. |
| 260 | @staticmethod |
| 261 | def getModuleInfo(fit, padTypeIDs=False): |
| 262 | moduleNames = [] |
| 263 | modTypeIDs = [] |
| 264 | moduleNameSets = {FittingSlot.LOW: [], FittingSlot.MED: [], FittingSlot.HIGH: [], FittingSlot.RIG: [], FittingSlot.SUBSYSTEM: []} |
| 265 | modTypeIDSets = {FittingSlot.LOW: [], FittingSlot.MED: [], FittingSlot.HIGH: [], FittingSlot.RIG: [], FittingSlot.SUBSYSTEM: []} |
| 266 | for mod in fit.modules: |
| 267 | try: |
| 268 | if mod.item is not None: |
| 269 | if mod.charge is not None: |
| 270 | modTypeIDSets[mod.slot].append([mod.item.typeID, mod.charge.typeID]) |
| 271 | moduleNameSets[mod.slot].append(mod.item.typeName + ": " + mod.charge.typeName) |
| 272 | else: |
| 273 | modTypeIDSets[mod.slot].append(mod.item.typeID) |
| 274 | moduleNameSets[mod.slot].append(mod.item.typeName) |
| 275 | else: |
| 276 | modTypeIDSets[mod.slot].append(0) |
| 277 | moduleNameSets[mod.slot].append("Empty Slot") |
| 278 | except (KeyboardInterrupt, SystemExit): |
| 279 | raise |
| 280 | except: |
| 281 | pyfalog.error("Could not find name for module {0}".format(vars(mod))) |
| 282 | |
| 283 | for modInfo in [ |
| 284 | ["High Slots:"], moduleNameSets[FittingSlot.HIGH], ["", "Med Slots:"], moduleNameSets[FittingSlot.MED], |
| 285 | ["", "Low Slots:"], moduleNameSets[FittingSlot.LOW], ["", "Rig Slots:"], moduleNameSets[FittingSlot.RIG] |
| 286 | ]: |
| 287 | moduleNames.extend(modInfo) |
| 288 | if len(moduleNameSets[FittingSlot.SUBSYSTEM]) > 0: |
| 289 | moduleNames.extend(["", "Subsystems:"]) |
| 290 | moduleNames.extend(moduleNameSets[FittingSlot.SUBSYSTEM]) |
| 291 | |
| 292 | for slotType in [FittingSlot.HIGH, FittingSlot.MED, FittingSlot.LOW, FittingSlot.RIG, FittingSlot.SUBSYSTEM]: |
| 293 | if slotType is not FittingSlot.SUBSYSTEM or len(modTypeIDSets[slotType]) > 0: |
| 294 | modTypeIDs.extend([0, 0] if slotType is not FittingSlot.HIGH else [0]) |
| 295 | modTypeIDs.extend(modTypeIDSets[slotType]) |
| 296 | |
| 297 | droneNames = [] |
| 298 | droneIDs = [] |
| 299 | fighterNames = [] |
| 300 | fighterIDs = [] |
| 301 | for drone in fit.drones: |
| 302 | if drone.amountActive > 0: |
| 303 | droneIDs.append(drone.item.typeID) |
| 304 | droneNames.append("%s x%s" % (drone.item.typeName, drone.amount)) |
| 305 | for fighter in fit.fighters: |
| 306 | if fighter.amount > 0: |
| 307 | fighterIDs.append(fighter.item.typeID) |
| 308 | fighterNames.append("%s x%s" % (fighter.item.typeName, fighter.amount)) |
| 309 | if len(droneNames) > 0: |
| 310 | modTypeIDs.extend([0, 0]) |
| 311 | modTypeIDs.extend(droneIDs) |
| 312 | moduleNames.extend(["", "Drones:"]) |
| 313 | moduleNames.extend(droneNames) |
| 314 | if len(fighterNames) > 0: |
| 315 | modTypeIDs.extend([0, 0]) |
| 316 | modTypeIDs.extend(fighterIDs) |
| 317 | moduleNames.extend(["", "Fighters:"]) |
| 318 | moduleNames.extend(fighterNames) |