From 18ee375742fc8fb71a062635406e794bc9511de5 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Fri, 18 May 2012 21:31:51 -0500 Subject: extract trainer group id and trainer id from TrainerFragment objects original-commit-id: a6efb7f0fbc5dd791feebb21c497caa328125224 --- crystal.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crystal.py') diff --git a/crystal.py b/crystal.py index 0df8b4b..dca98f6 100644 --- a/crystal.py +++ b/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 = "" -- cgit v1.2.3