summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-20 03:02:35 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-20 03:02:35 -0500
commit1fb70a4b4f25b3b2824392d0aeecae86d7a5d083 (patch)
treeccea4499076ba61cf83b6ca16e90a1634f51807a
parentb731d8d1f8ae09e1ad37a6a8d7d330d8a7839535 (diff)
update TrainerGroupParam and TrainerIdParam to use better constant/number rules
-rw-r--r--extras/crystal.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/extras/crystal.py b/extras/crystal.py
index 69cd25e9c..729ee3203 100644
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -1693,15 +1693,32 @@ class PointerParamToItemAndLetter(MultiByteParam):
class TrainerIdParam(SingleByteParam):
- #raise NotImplementedError, bryan_message
- pass
- #def to_asm(self):
- # pass
+ def to_asm(self):
+ # find the group id by first finding the param type id
+ i = 0
+ foundit = None
+ for (k, v) in self.parent.param_types.items():
+ if v["class"] == TrainerGroupParam:
+ foundit = i
+ break
+ i += 1
-class TrainerGroupParam(SingleByteParam):
- #raise NotImplementedError, bryan_message
- pass
+ if foundit == None:
+ raise Exception, "didn't find a TrainerGroupParam in this command??"
+ # now get the trainer group id
+ trainer_group_id = self.parent.params[foundit].byte
+
+ # check the rule to see whether to use an id or not
+ if "uses_numeric_trainer_ids" in trainer_group_names[trainer_group_id].keys():
+ return str(self.byte)
+ else:
+ return trainer_group_names[trainer_group_id]["trainer_names"][self.byte-1]
+
+class TrainerGroupParam(SingleByteParam):
+ def to_asm(self):
+ trainer_group_id = self.byte
+ return trainer_group_names[trainer_group_id]["constant"]
class MenuDataPointerParam(PointerLabelParam):
#read menu data at the target site