From abf31f8e520d12b53f1aba5405b202af09d56aca Mon Sep 17 00:00:00 2001 From: Eevee Date: Sun, 2 May 2010 16:07:45 -0700 Subject: [PATCH] Restored Item.appears_underground and added location support to rst. --- pokedex/data/csv/item_flags.csv | 18 +++++++++--------- pokedex/db/rst.py | 1 + pokedex/db/tables.py | 7 ++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pokedex/data/csv/item_flags.csv b/pokedex/data/csv/item_flags.csv index 6019ab3..6f85de1 100644 --- a/pokedex/data/csv/item_flags.csv +++ b/pokedex/data/csv/item_flags.csv @@ -1,9 +1,9 @@ -id,name -1,Has a count in the bag -2,Consumed when used -3,Usable outside battle -4,Usable in battle -5,Can be held by a Pokémon -6,Works passively when held -7,Usable by a Pokémon when held -8,Appears in Sinnoh Underground +id,identifier,name +1,countable,Has a count in the bag +2,consumable,Consumed when used +3,usable_overworld,Usable outside battle +4,usable_in_battle,Usable in battle +5,holdable,Can be held by a Pokémon +6,holdable_passive,Works passively when held +7,holdable_active,Usable by a Pokémon when held +8,underground,Appears in Sinnoh Underground diff --git a/pokedex/db/rst.py b/pokedex/db/rst.py index 9ee84ba..baedf0e 100644 --- a/pokedex/db/rst.py +++ b/pokedex/db/rst.py @@ -120,6 +120,7 @@ def generic_role(name, rawtext, text, lineno, inliner, options={}, content=[]): roles.register_local_role('ability', generic_role) roles.register_local_role('item', generic_role) +roles.register_local_role('location', generic_role) roles.register_local_role('move', generic_role) roles.register_local_role('type', generic_role) roles.register_local_role('pokemon', generic_role) diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index f3243e6..e71fc97 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -201,7 +201,11 @@ class Item(TableBase): cost = Column(Integer, nullable=False) fling_power = Column(Integer, nullable=True) fling_effect_id = Column(Integer, ForeignKey('item_fling_effects.id'), nullable=True) - effect = Column(Unicode(5120), nullable=False) + effect = Column(rst.RstTextColumn(5120), nullable=False) + + @property + def appears_underground(self): + return any(flag.identifier == u'underground' for flag in self.flags) class ItemCategory(TableBase): __tablename__ = 'item_categories' @@ -212,6 +216,7 @@ class ItemCategory(TableBase): class ItemFlag(TableBase): __tablename__ = 'item_flags' id = Column(Integer, primary_key=True, nullable=False) + identifier = Column(Unicode(24), nullable=False) name = Column(Unicode(64), nullable=False) class ItemFlagMap(TableBase): -- 2.7.4