|
|
@ -438,6 +438,11 @@ class DBEditor(QMainWindow): |
|
|
QMessageBox.information(self, 'Database Reinitialized', 'The database has been cleared and reinitialized.') |
|
|
QMessageBox.information(self, 'Database Reinitialized', 'The database has been cleared and reinitialized.') |
|
|
|
|
|
|
|
|
def determine_origin_mark(self, pfic, target_generation): |
|
|
def determine_origin_mark(self, pfic, target_generation): |
|
|
|
|
|
shiftable_forms = event_system.call_sync('get_shiftable_forms', pfic) |
|
|
|
|
|
if len(shiftable_forms) > 0: |
|
|
|
|
|
for shiftable_form in shiftable_forms: |
|
|
|
|
|
mark_id = self.determine_origin_mark(shiftable_form[2], target_generation) |
|
|
|
|
|
return mark_id |
|
|
encounters = event_system.call_sync('get_encounter_locations', pfic) |
|
|
encounters = event_system.call_sync('get_encounter_locations', pfic) |
|
|
if encounters: |
|
|
if encounters: |
|
|
generation_encounters = [] |
|
|
generation_encounters = [] |
|
|
@ -459,6 +464,29 @@ class DBEditor(QMainWindow): |
|
|
return mark_id |
|
|
return mark_id |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
def test_evolve_encounters(self, pfic, target_generation): |
|
|
|
|
|
evolve_encounters = event_system.call_sync('get_evolve_encounters', pfic) |
|
|
|
|
|
if evolve_encounters: |
|
|
|
|
|
available_encounters = [] |
|
|
|
|
|
for encounter in evolve_encounters: |
|
|
|
|
|
game_id = encounter.game_id |
|
|
|
|
|
game_info = event_system.call_sync('get_game_by_id', game_id) |
|
|
|
|
|
if game_info[2] == target_generation: |
|
|
|
|
|
available_encounters.append(encounter) |
|
|
|
|
|
|
|
|
|
|
|
if len(available_encounters) > 0: |
|
|
|
|
|
available_encounters = sorted(available_encounters, key=lambda x: x.game_id) |
|
|
|
|
|
mark_id = self.determine_origin_mark(available_encounters[0].from_pfic, target_generation) |
|
|
|
|
|
if mark_id != None: |
|
|
|
|
|
return mark_id |
|
|
|
|
|
|
|
|
|
|
|
mark_id = self.test_evolve_encounters(available_encounters[0].from_pfic, target_generation) |
|
|
|
|
|
if mark_id != None: |
|
|
|
|
|
return mark_id |
|
|
|
|
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def gather_marks_info(self, data): |
|
|
def gather_marks_info(self, data): |
|
|
event_system.emit_sync('clear_log_display') |
|
|
event_system.emit_sync('clear_log_display') |
|
|
self.logger.info("Starting to gather marks information...") |
|
|
self.logger.info("Starting to gather marks information...") |
|
|
@ -520,21 +548,10 @@ class DBEditor(QMainWindow): |
|
|
# If there are no encounters for the pokemon form from this generation, |
|
|
# If there are no encounters for the pokemon form from this generation, |
|
|
# look to see if a previous evolution has an encounter from this generation, and use the mark of the earliest |
|
|
# look to see if a previous evolution has an encounter from this generation, and use the mark of the earliest |
|
|
# game from this generation that the previous evolution is encounterable in. |
|
|
# game from this generation that the previous evolution is encounterable in. |
|
|
evolve_encounters = event_system.call_sync('get_evolve_encounters', pfic) |
|
|
mark_id = self.test_evolve_encounters(pfic, target_generation) |
|
|
if evolve_encounters: |
|
|
if mark_id != None: |
|
|
available_encounters = [] |
|
|
event_system.emit_sync('assign_mark_to_form', (pfic, mark_id)) |
|
|
for encounter in evolve_encounters: |
|
|
continue; |
|
|
game_id = encounter.game_id |
|
|
|
|
|
game_info = event_system.call_sync('get_game_by_id', game_id) |
|
|
|
|
|
if game_info[2] == target_generation: |
|
|
|
|
|
available_encounters.append(encounter) |
|
|
|
|
|
|
|
|
|
|
|
if len(available_encounters) > 0: |
|
|
|
|
|
available_encounters = sorted(available_encounters, key=lambda x: x.game_id) |
|
|
|
|
|
mark_id = self.determine_origin_mark(available_encounters[0].from_pfic, target_generation) |
|
|
|
|
|
if mark_id != None: |
|
|
|
|
|
event_system.emit_sync('assign_mark_to_form', (pfic, mark_id)) |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
encounters = event_system.call_sync('get_encounter_locations', pfic) |
|
|
encounters = event_system.call_sync('get_encounter_locations', pfic) |
|
|
count = 0 |
|
|
count = 0 |
|
|
@ -547,18 +564,29 @@ class DBEditor(QMainWindow): |
|
|
if count == 0: |
|
|
if count == 0: |
|
|
#Rule 2b |
|
|
#Rule 2b |
|
|
# Check to see if this is a sub-form pokemon, and if so, use the mark of the base form. |
|
|
# Check to see if this is a sub-form pokemon, and if so, use the mark of the base form. |
|
|
base = pfic[:-6] |
|
|
shiftable_forms = event_system.call_sync('get_shiftable_forms', pfic) |
|
|
alternate_forms = event_system.call_sync('find_default_form', base) |
|
|
if len(shiftable_forms) > 0: |
|
|
if alternate_forms: |
|
|
|
|
|
form_found = False |
|
|
form_found = False |
|
|
for alternate_form in alternate_forms: |
|
|
for shiftable_form in shiftable_forms: |
|
|
mark_id = self.determine_origin_mark(alternate_form.pfic, target_generation) |
|
|
mark_id = self.determine_origin_mark(shiftable_form[2], target_generation) |
|
|
if mark_id != None: |
|
|
if mark_id != None: |
|
|
event_system.emit_sync('assign_mark_to_form', (pfic, mark_id)) |
|
|
event_system.emit_sync('assign_mark_to_form', (pfic, mark_id)) |
|
|
form_found = True |
|
|
form_found = True |
|
|
break; |
|
|
break; |
|
|
if form_found: |
|
|
if form_found: |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
#base = pfic[:-6] |
|
|
|
|
|
#alternate_forms = event_system.call_sync('find_default_form', base) |
|
|
|
|
|
#if alternate_forms: |
|
|
|
|
|
# form_found = False |
|
|
|
|
|
# for alternate_form in alternate_forms: |
|
|
|
|
|
# mark_id = self.determine_origin_mark(alternate_form.pfic, target_generation) |
|
|
|
|
|
# if mark_id != None: |
|
|
|
|
|
# event_system.emit_sync('assign_mark_to_form', (pfic, mark_id)) |
|
|
|
|
|
# form_found = True |
|
|
|
|
|
# break; |
|
|
|
|
|
# if form_found: |
|
|
|
|
|
# continue; |
|
|
|
|
|
|
|
|
#Rule 4 |
|
|
#Rule 4 |
|
|
# If there are no encounters for the pokemon form or its evolution line from this generation, |
|
|
# If there are no encounters for the pokemon form or its evolution line from this generation, |
|
|
|