From a6efb7f0fbc5dd791feebb21c497caa328125224 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Fri, 18 May 2012 21:31:51 -0500 Subject: [PATCH] extract trainer group id and trainer id from TrainerFragment objects --- extras/crystal.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/extras/crystal.py b/extras/crystal.py index 0df8b4b5c..dca98f612 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -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 = ""