extract trainer group id and trainer id from TrainerFragment objects

This commit is contained in:
Bryan Bishop 2012-05-18 21:31:51 -05:00
parent a17ef09e10
commit a6efb7f0fb
1 changed files with 15 additions and 0 deletions

View File

@ -3313,6 +3313,7 @@ class ItemFragmentParam(PointerLabelParam):
global_dependencies.add(self.itemfrag)
return self.dependencies
trainer_group_maximums = {}
class TrainerFragment(Command):
"""used by TrainerFragmentParam and PeopleEvent for trainer data
@ -3376,6 +3377,20 @@ class TrainerFragment(Command):
self.dependencies = deps
return deps
def parse(self):
Command.parse(self)
# get the trainer group id
trainer_group = self.params[1].byte
# get the trainer id
trainer_id = self.params[2].byte
if not trainer_group in trainer_group_maximums.keys():
trainer_group_maximums[trainer_group] = trainer_id
elif trainer_group_maximums[trainer_group] < trainer_id:
trainer_group_maximums[trainer_group] = trainer_id
def to_asm(self):
xspacing = ""
output = ""