(drones, exportMutants=True, mutaData=None, standAlone=True)
| 164 | |
| 165 | |
| 166 | def exportDrones(drones, exportMutants=True, mutaData=None, standAlone=True): |
| 167 | |
| 168 | # Same as in drone additions panel |
| 169 | DRONE_ORDER = ('Light Scout Drones', 'Medium Scout Drones', |
| 170 | 'Heavy Attack Drones', 'Sentry Drones', 'Combat Utility Drones', |
| 171 | 'Electronic Warfare Drones', 'Logistic Drones', 'Mining Drones', 'Salvage Drones') |
| 172 | |
| 173 | def getDroneName(drone): |
| 174 | if drone.isMutated: |
| 175 | return drone.baseItem.typeName |
| 176 | return drone.item.typeName |
| 177 | |
| 178 | def droneSorter(drone): |
| 179 | if drone.isMutated: |
| 180 | item = drone.baseItem |
| 181 | else: |
| 182 | item = drone.item |
| 183 | groupName = Market.getInstance().getMarketGroupByItem(item).marketGroupName |
| 184 | return (DRONE_ORDER.index(groupName), drone.isMutated, drone.fullName) |
| 185 | |
| 186 | if mutaData is None: |
| 187 | mutaData = MutationExportData() |
| 188 | sections = [] |
| 189 | droneLines = [] |
| 190 | for drone in sorted(drones, key=droneSorter): |
| 191 | if drone.isMutated and exportMutants: |
| 192 | mutaData.mutants[mutaData.reference] = drone |
| 193 | mutationSuffix = ' [{}]'.format(mutaData.reference) |
| 194 | mutaData.reference += 1 |
| 195 | else: |
| 196 | mutationSuffix = '' |
| 197 | droneLines.append('{} x{}{}'.format(getDroneName(drone), drone.amount, mutationSuffix)) |
| 198 | if droneLines: |
| 199 | sections.append('\n'.join(droneLines)) |
| 200 | if exportMutants and mutaData.mutants and standAlone: |
| 201 | sections.append(mutaData.formatMutants()) |
| 202 | return '\n\n\n'.join(sections) |
| 203 | |
| 204 | |
| 205 | def exportFighters(fighters): |
no test coverage detected