+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ name = Column(Unicode(20), nullable=False,
+ info=dict(description="The English name of the item", official=True, format='plaintext'))
+ category_id = Column(Integer, ForeignKey('item_categories.id'), nullable=False,
+ info=dict(description="ID of a category this item belongs to"))
+ cost = Column(Integer, nullable=False,
+ info=dict(description=u"Cost of the item when bought. Items sell for half this price."))
+ fling_power = Column(Integer, nullable=True,
+ info=dict(description=u"Power of the move Fling when used with this item."))
+ fling_effect_id = Column(Integer, ForeignKey('item_fling_effects.id'), nullable=True,
+ info=dict(description=u"ID of the fling-effect of the move Fling when used with this item. Note that these are different from move effects."))
+ effect = Column(markdown.MarkdownColumn(5120), nullable=False,
+ info=dict(description=u"Detailed English description of the item's effect.", format='markdown'))
+
+ @property
+ def appears_underground(self):
+ u"""True if the item appears underground, as specified by the appropriate flag
+ """
+ return any(flag.identifier == u'underground' for flag in self.flags)
+
+class ItemCategory(TableBase):
+ u"""An item category
+ """
+ # XXX: This is fanon, right?
+ __tablename__ = 'item_categories'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ pocket_id = Column(Integer, ForeignKey('item_pockets.id'), nullable=False,
+ info=dict(description="ID of the pocket these items go to"))
+ name = Column(Unicode(16), nullable=False,
+ info=dict(description="English name of the category", format='plaintext'))
+
+class ItemFlag(TableBase):
+ u"""An item attribute such as "consumable" or "holdable".
+ """
+ __tablename__ = 'item_flags'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ identifier = Column(Unicode(24), nullable=False,
+ info=dict(description="Identifier of the flag", format='identifier'))
+ name = Column(Unicode(64), nullable=False,
+ info=dict(description="Short English description of the flag", format='plaintext'))
+
+class ItemFlagMap(TableBase):
+ u"""Maps an item flag to its item.
+ """
+ __tablename__ = 'item_flag_map'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="The ID of the item"))
+ item_flag_id = Column(Integer, ForeignKey('item_flags.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="The ID of the item flag"))
+
+class ItemFlavorText(TableBase):
+ u"""An in-game description of an item
+ """
+ __tablename__ = 'item_flavor_text'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="The ID of the item"))
+ version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="ID of the version group that sports this text"))
+ flavor_text = Column(Unicode(255), nullable=False,
+ info=dict(description="The flavor text itself", official=True, format='gametext'))
+
+class ItemFlingEffect(TableBase):
+ u"""An effect of the move Fling when used with a specific item
+ """
+ __tablename__ = 'item_fling_effects'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ effect = Column(Unicode(255), nullable=False,
+ info=dict(description="English description of the effect", format='plaintext'))
+
+class ItemInternalID(TableBase):
+ u"""The internal ID number a game uses for an item
+ """
+ __tablename__ = 'item_internal_ids'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="The database ID of the item"))
+ generation_id = Column(Integer, ForeignKey('generations.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description="ID of the generation of games"))
+ internal_id = Column(Integer, nullable=False,
+ info=dict(description="Internal ID of the item in the generation"))
+
+class ItemName(TableBase):
+ u"""A non-English name of an item
+ """
+ __tablename__ = 'item_names'
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description="The ID of the item"))
+ language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description="The ID of the language"))
+ name = Column(Unicode(16), nullable=False,
+ info=dict(description="The name of the item in this language", foreign=True, format='plaintext'))
+
+class ItemPocket(TableBase):
+ u"""A pocket that categorizes items
+ """
+ __tablename__ = 'item_pockets'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ identifier = Column(Unicode(16), nullable=False,
+ info=dict(description="An identifier of this pocket", format='identifier'))
+ name = Column(Unicode(16), nullable=False,
+ info=dict(description="A numeric ID", format='plaintext'))