+ name = Column(Unicode(20), nullable=False)
+ formula = Column(Unicode(500), nullable=False)
+
+class Item(TableBase):
+ __tablename__ = 'items'
+ __singlename__ = 'item'
+ id = Column(Integer, primary_key=True, nullable=False)
+ name = Column(Unicode(16), nullable=False)
+ category_id = Column(Integer, ForeignKey('item_categories.id'), nullable=False)
+ 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(markdown.MarkdownColumn(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'
+ id = Column(Integer, primary_key=True, nullable=False)
+ pocket_id = Column(Integer, ForeignKey('item_pockets.id'), nullable=False)
+ name = Column(Unicode(16), nullable=False)
+
+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):
+ __tablename__ = 'item_flag_map'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False)
+ item_flag_id = Column(Integer, ForeignKey('item_flags.id'), primary_key=True, autoincrement=False, nullable=False)
+
+class ItemFlavorText(TableBase):
+ __tablename__ = 'item_flavor_text'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False)
+ version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, autoincrement=False, nullable=False)
+ flavor_text = Column(Unicode(255), nullable=False)
+
+class ItemFlingEffect(TableBase):
+ __tablename__ = 'item_fling_effects'
+ id = Column(Integer, primary_key=True, nullable=False)
+ effect = Column(Unicode(255), nullable=False)
+
+class ItemInternalID(TableBase):
+ __tablename__ = 'item_internal_ids'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False)
+ generation_id = Column(Integer, ForeignKey('generations.id'), primary_key=True, autoincrement=False, nullable=False)
+ internal_id = Column(Integer, nullable=False)
+
+class ItemName(TableBase):
+ __tablename__ = 'item_names'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, nullable=False, autoincrement=False)
+ language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False)
+ name = Column(Unicode(16), nullable=False)
+
+class ItemPocket(TableBase):
+ __tablename__ = 'item_pockets'
+ id = Column(Integer, primary_key=True, nullable=False)
+ identifier = Column(Unicode(16), nullable=False)