| 536 | item.replacements = ','.join('{}'.format(tid) for tid in sorted(itemReplacements)) |
| 537 | |
| 538 | def processImplantSets(eveTypesData): |
| 539 | print('composing implant sets') |
| 540 | # Includes only implants which can be considered part of sets, not all implants |
| 541 | implant_groups = (300, 1730) |
| 542 | specials = {'Genolution': ('Genolution Core Augmentation', r'CA-\d+')} |
| 543 | implantSets = {} |
| 544 | for row in eveTypesData: |
| 545 | if not row.get('published'): |
| 546 | continue |
| 547 | if row.get('groupID') not in implant_groups: |
| 548 | continue |
| 549 | typeName = row.get('typeName_en-us', '') |
| 550 | # Regular sets matching |
| 551 | m = re.match(r'(?P<grade>(High|Mid|Low)-grade) (?P<set>\w+) (?P<implant>(Alpha|Beta|Gamma|Delta|Epsilon|Omega))', typeName, re.IGNORECASE) |
| 552 | if m: |
| 553 | implantSets.setdefault((m.group('grade'), m.group('set')), set()).add(row['typeID']) |
| 554 | # Special set matching |
| 555 | for setHandle, (setName, implantPattern) in specials.items(): |
| 556 | pattern = '(?P<set>{}) (?P<implant>{})'.format(setName, implantPattern) |
| 557 | m = re.match(pattern, typeName) |
| 558 | if m: |
| 559 | implantSets.setdefault((None, setHandle), set()).add(row['typeID']) |
| 560 | break |
| 561 | data = [] |
| 562 | for (gradeName, setName), implants in implantSets.items(): |
| 563 | if len(implants) < 2: |
| 564 | continue |
| 565 | implants = ','.join('{}'.format(tid) for tid in sorted(implants)) |
| 566 | row = {'setName': setName, 'gradeName': gradeName, 'implants': implants} |
| 567 | data.append(row) |
| 568 | _addRows(data, eos.gamedata.ImplantSet) |
| 569 | |
| 570 | eveTypesData = processEveTypes() |
| 571 | eveGroupsData = processEveGroups() |