summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-18 21:31:51 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-18 21:31:51 -0500
commit18ee375742fc8fb71a062635406e794bc9511de5 (patch)
treea496d143deff61f7452c275c07441e2f0beee888
parente64cd9cd9edbd472f287c2d96c925c7f072481c5 (diff)
extract trainer group id and trainer id from TrainerFragment objects
original-commit-id: a6efb7f0fbc5dd791feebb21c497caa328125224
-rw-r--r--crystal.py15
1 files changed, 15 insertions, 0 deletions
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 = ""