+class ItemCategory(TableBase, UnofficiallyNamed):
+ u"""An item category
+ """
+ # XXX: This is fanon, right?
+ __tablename__ = 'item_categories'
+ __singlename__ = 'item_category'
+ 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"))
+ identifier = Column(Unicode(16), nullable=False,
+ info=dict(description="An identifier", format='identifier'))
+
+class ItemFlag(TableBase, UnofficiallyNamed):
+ u"""An item attribute such as "consumable" or "holdable".
+ """
+ __tablename__ = 'item_flags'
+ __singlename__ = 'item_flag'
+ 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'))
+ description = ProseColumn(Unicode(64), plural='descriptions', nullable=False,
+ info=dict(description="Short 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, LanguageSpecific):
+ u"""An in-game description of an item
+ """
+ __tablename__ = 'item_flavor_text'
+ __singlename__ = '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'
+ __singlename__ = 'item_fling_effect'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ effect = ProseColumn(Unicode(255), plural='effects', nullable=False,
+ info=dict(description="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 ItemPocket(TableBase, OfficiallyNamed):
+ u"""A pocket that categorizes items
+ """
+ __tablename__ = 'item_pockets'
+ __singlename__ = 'item_pocket'
+ 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'))
+
+class Language(TableBase, OfficiallyNamed):
+ u"""A language the Pokémon games have been transleted into
+ """
+ __tablename__ = 'languages'
+ __singlename__ = 'language'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ iso639 = Column(Unicode(2), nullable=False,
+ info=dict(description="The two-letter code of the country where this language is spoken. Note that it is not unique.", format='identifier'))
+ iso3166 = Column(Unicode(2), nullable=False,
+ info=dict(description="The two-letter code of the language. Note that it is not unique.", format='identifier'))
+ identifier = Column(Unicode(16), nullable=False,
+ info=dict(description="An identifier", format='identifier'))
+ official = Column(Boolean, nullable=False, index=True,
+ info=dict(description=u"True iff games are produced in the language."))
+ order = Column(Integer, nullable=True,
+ info=dict(description=u"Order for sorting in foreign name lists."))
+
+ # Languages compare equal to its identifier, so a dictionary of
+ # translations, with a Language as the key, can be indexed by the identifier
+ def __eq__(self, other):
+ try:
+ return (
+ self is other or
+ self.identifier == other or
+ self.identifier == other.identifier
+ )
+ except AttributeError:
+ return NotImplemented
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __hash__(self):
+ return hash(self.identifier)
+
+class Location(TableBase, OfficiallyNamed):
+ u"""A place in the Pokémon world
+ """