Schema documentation, up to Language

This commit is contained in:
Petr Viktorin 2010-10-03 18:21:50 +03:00 committed by Eevee
parent e617daec2f
commit febbf16222

View file

@ -1,5 +1,29 @@
# encoding: utf8 # encoding: utf8
u"""The Pokédex schema
Columns have a info dictionary with these keys:
- description: The description of the column
- official: True if the values appear in games or official material; False if
they are fan-created or fan-written. This flag is currently only set for
official text columns.
- markup: The format of a text column. Can be one of:
- plaintext: Normal Unicode text (widely used in names)
- markdown: Veekun's Markdown flavor (generally used in effect descriptions)
- gametext: Transcription of in-game text that strives to be both
human-readable and represent the original text exactly.
- identifier: A fan-made identifier in the [-_a-z0-9]* format. Not intended
for translation.
- latex: A formula in LaTeX syntax.
- foreign: If set, the column contains foreign (non-English) text.
"""
# XXX: Check if "gametext" is set correctly everywhere
# XXX: Some columns paradoxically have official=True and markup='identifier'.
# This is when one column is used as both the English name (lowercased) and
# an identifier. This should be fixed.
from sqlalchemy import Column, ForeignKey, MetaData, PrimaryKeyConstraint, Table from sqlalchemy import Column, ForeignKey, MetaData, PrimaryKeyConstraint, Table
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.associationproxy import association_proxy
@ -14,78 +38,141 @@ metadata = MetaData()
TableBase = declarative_base(metadata=metadata) TableBase = declarative_base(metadata=metadata)
class Ability(TableBase): class Ability(TableBase):
"""An ability a pokémon can have, such as Static or Pressure.
"""
__tablename__ = 'abilities' __tablename__ = 'abilities'
__singlename__ = 'ability' __singlename__ = 'ability'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(24), nullable=False) info=dict(description="A numeric ID"))
generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False) name = Column(Unicode(24), nullable=False,
effect = Column(markdown.MarkdownColumn(5120), nullable=False) info=dict(description="The official English name of this ability", official=True, format='plaintext'))
short_effect = Column(markdown.MarkdownColumn(255), nullable=False) generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False,
info=dict(description="ID of the generation this ability was introduced in", detail=True))
effect = Column(markdown.MarkdownColumn(5120), nullable=False,
info=dict(description="Detailed description of this ability's effect", format='markdown'))
short_effect = Column(markdown.MarkdownColumn(255), nullable=False,
info=dict(description="Short summary of this ability's effect", format='markdown'))
class AbilityFlavorText(TableBase): class AbilityFlavorText(TableBase):
"""In-game flavor text of an ability
"""
__tablename__ = 'ability_flavor_text' __tablename__ = 'ability_flavor_text'
ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False) ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False,
version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="A numeric ID"))
flavor_text = Column(Unicode(64), nullable=False) version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="The versions this flavor text is shown in"))
flavor_text = Column(Unicode(64), nullable=False,
info=dict(description="The actual flavor text", official=True, format='gametext'))
class AbilityName(TableBase): class AbilityName(TableBase):
"""Non-English official name of an ability
"""
__tablename__ = 'ability_names' __tablename__ = 'ability_names'
ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False) ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False,
language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="ID of the ability"))
name = Column(Unicode(16), nullable=False) language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="ID of the language"))
name = Column(Unicode(16), nullable=False,
info=dict(description="ID of the language", official=True, foreign=True, format='plaintext'))
class Berry(TableBase): class Berry(TableBase):
"""A Berry, consumable item that grows on trees
For data common to all Items, such as the name, see the corresponding Item entry.
"""
__tablename__ = 'berries' __tablename__ = 'berries'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
item_id = Column(Integer, ForeignKey('items.id'), nullable=False) info=dict(description="A numeric ID"))
firmness_id = Column(Integer, ForeignKey('berry_firmness.id'), nullable=False) item_id = Column(Integer, ForeignKey('items.id'), nullable=False,
natural_gift_power = Column(Integer, nullable=True) info=dict(description="ID of the Item this Berry corresponds to"))
natural_gift_type_id = Column(Integer, ForeignKey('types.id'), nullable=True) firmness_id = Column(Integer, ForeignKey('berry_firmness.id'), nullable=False,
size = Column(Integer, nullable=False) info=dict(description="ID of this berry's firmness"))
max_harvest = Column(Integer, nullable=False) natural_gift_power = Column(Integer, nullable=True,
growth_time = Column(Integer, nullable=False) info=dict(description="Power of Natural Gift when that move is used with this Berry"))
soil_dryness = Column(Integer, nullable=False) natural_gift_type_id = Column(Integer, ForeignKey('types.id'), nullable=True,
smoothness = Column(Integer, nullable=False) info=dict(description="ID of the Type that Natural Gift will have when used with this Berry"))
size = Column(Integer, nullable=False,
info=dict(description=u"Size of this Berry, in millimeters"))
max_harvest = Column(Integer, nullable=False,
info=dict(description="Maximum number of these berries that can grow on one tree"))
growth_time = Column(Integer, nullable=False,
info=dict(description="Time it takes the tree to grow one stage, in hours. Multiply by four to get overall time."))
soil_dryness = Column(Integer, nullable=False,
info=dict(description="The speed of soil drying the tree causes")) # XXX: What's this exactly? I'm not a good farmer
smoothness = Column(Integer, nullable=False,
info=dict(description="Smoothness of this Berry, a culinary attribute. Higher is better."))
class BerryFirmness(TableBase): class BerryFirmness(TableBase):
"""A Berry firmness, such as "hard" or "very soft".
"""
__tablename__ = 'berry_firmness' __tablename__ = 'berry_firmness'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(10), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(10), nullable=False,
info=dict(description="English name of the firmness level", official=True, format='plaintext'))
class BerryFlavor(TableBase): class BerryFlavor(TableBase):
"""A Berry flavor level.
"""
__tablename__ = 'berry_flavors' __tablename__ = 'berry_flavors'
berry_id = Column(Integer, ForeignKey('berries.id'), primary_key=True, nullable=False, autoincrement=False) berry_id = Column(Integer, ForeignKey('berries.id'), primary_key=True, nullable=False, autoincrement=False,
contest_type_id = Column(Integer, ForeignKey('contest_types.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="ID of the berry"))
flavor = Column(Integer, nullable=False) contest_type_id = Column(Integer, ForeignKey('contest_types.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="ID of the flavor"))
flavor = Column(Integer, nullable=False,
info=dict(description="Level of the flavor in the berry"))
class ContestCombo(TableBase): class ContestCombo(TableBase):
"""Combo of two moves in a Contest.
"""
__tablename__ = 'contest_combos' __tablename__ = 'contest_combos'
first_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) first_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False,
second_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="ID of the first move in the combo"))
second_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="ID of the second and final move in the combo"))
class ContestEffect(TableBase): class ContestEffect(TableBase):
"""Effect of a move when used in a Contest.
"""
__tablename__ = 'contest_effects' __tablename__ = 'contest_effects'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
appeal = Column(SmallInteger, nullable=False) info=dict(description="A numeric ID"))
jam = Column(SmallInteger, nullable=False) appeal = Column(SmallInteger, nullable=False,
flavor_text = Column(Unicode(64), nullable=False) info=dict(description="The base number of hearts the user of this move gets"))
effect = Column(Unicode(255), nullable=False) jam = Column(SmallInteger, nullable=False,
info=dict(description="The base number of hearts the user's opponent loses"))
flavor_text = Column(Unicode(64), nullable=False,
info=dict(description="English in-game description of this effect", official=True, format='gametext'))
effect = Column(Unicode(255), nullable=False,
info=dict(description="Detailed description of the effect", format='markdown'))
class ContestType(TableBase): class ContestType(TableBase):
u"""A Contest type, such as "cool" or "smart". Also functions as Berry flavor and Pokéblock color."""
__tablename__ = 'contest_types' __tablename__ = 'contest_types'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(6), nullable=False) info=dict(description="A numeric ID"))
flavor = Column(Unicode(6), nullable=False) name = Column(Unicode(6), nullable=False,
color = Column(Unicode(6), nullable=False) info=dict(description="The English name of the Contest type", official=True, format='identifier'))
flavor = Column(Unicode(6), nullable=False,
info=dict(description="The English name of the corresponding Berry flavor", official=True, format='identifier'))
color = Column(Unicode(6), nullable=False,
info=dict(description="The English name of the corresponding Pokéblock color", official=True, format='identifier'))
class EggGroup(TableBase): class EggGroup(TableBase):
"""An Egg group. Usually, two Pokémon can breed if they share an Egg Group.
(exceptions are the Ditto and No Eggs groups)
"""
__tablename__ = 'egg_groups' __tablename__ = 'egg_groups'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(16), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(16), nullable=False,
info=dict(description="The English “official” name. One NPC in Stadium uses these names; they are pretty bad.", official=True, format='identifier'))
class Encounter(TableBase): class Encounter(TableBase):
"""Rows in this table represent encounters with wild Pokémon. Bear with """Encounters with wild Pokémon.
me, here.
Bear with me, here.
Within a given area in a given game, encounters are differentiated by the Within a given area in a given game, encounters are differentiated by the
"slot" they are in and the state of the game world. "slot" they are in and the state of the game world.
@ -107,170 +194,254 @@ class Encounter(TableBase):
""" """
__tablename__ = 'encounters' __tablename__ = 'encounters'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
version_id = Column(Integer, ForeignKey('versions.id'), nullable=False, autoincrement=False) info=dict(description="A numeric ID"))
location_area_id = Column(Integer, ForeignKey('location_areas.id'), nullable=False, autoincrement=False) version_id = Column(Integer, ForeignKey('versions.id'), nullable=False, autoincrement=False,
encounter_slot_id = Column(Integer, ForeignKey('encounter_slots.id'), nullable=False, autoincrement=False) info=dict(description="The ID of the Version this applies to"))
pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=False, autoincrement=False) location_area_id = Column(Integer, ForeignKey('location_areas.id'), nullable=False, autoincrement=False,
min_level = Column(Integer, nullable=False, autoincrement=False) info=dict(description="The ID of the Location of this encounter"))
max_level = Column(Integer, nullable=False, autoincrement=False) encounter_slot_id = Column(Integer, ForeignKey('encounter_slots.id'), nullable=False, autoincrement=False,
info=dict(description="The ID of the encounter slot, which determines terrain and rarity"))
pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=False, autoincrement=False,
info=dict(description=u"The ID of the encountered Pokémon"))
min_level = Column(Integer, nullable=False, autoincrement=False,
info=dict(description=u"The minimum level of the encountered Pokémon"))
max_level = Column(Integer, nullable=False, autoincrement=False,
info=dict(description=u"The maxmum level of the encountered Pokémon"))
class EncounterCondition(TableBase): class EncounterCondition(TableBase):
"""Rows in this table represent varying conditions in the game world, such """A conditions in the game world that affects pokémon encounters, such as time of day.
as time of day.
""" """
__tablename__ = 'encounter_conditions' __tablename__ = 'encounter_conditions'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(64), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(64), nullable=False,
info=dict(description="An English name of the condition", format='plaintext'))
class EncounterConditionValue(TableBase): class EncounterConditionValue(TableBase):
"""Rows in this table represent possible states for a condition; for """A possible state for a condition; for example, the state of 'swarm' could be 'swarm' or 'no swarm'.
example, the state of 'swarm' could be 'swarm' or 'no swarm'.
""" """
__tablename__ = 'encounter_condition_values' __tablename__ = 'encounter_condition_values'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
encounter_condition_id = Column(Integer, ForeignKey('encounter_conditions.id'), primary_key=False, nullable=False, autoincrement=False) info=dict(description="A numeric ID"))
name = Column(Unicode(64), nullable=False) encounter_condition_id = Column(Integer, ForeignKey('encounter_conditions.id'), primary_key=False, nullable=False, autoincrement=False,
is_default = Column(Boolean, nullable=False) info=dict(description="The ID of the encounter condition this is a value of"))
name = Column(Unicode(64), nullable=False,
info=dict(description="An english name of this value", format='plaintext'))
is_default = Column(Boolean, nullable=False,
info=dict(description='Set if this value is "default" or "normal" in some sense'))
class EncounterConditionValueMap(TableBase): class EncounterConditionValueMap(TableBase):
"""Maps encounters to the specific conditions under which they occur.""" """Maps encounters to the specific conditions under which they occur."""
__tablename__ = 'encounter_condition_value_map' __tablename__ = 'encounter_condition_value_map'
encounter_id = Column(Integer, ForeignKey('encounters.id'), primary_key=True, nullable=False, autoincrement=False) encounter_id = Column(Integer, ForeignKey('encounters.id'), primary_key=True, nullable=False, autoincrement=False,
encounter_condition_value_id = Column(Integer, ForeignKey('encounter_condition_values.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="ID of the encounter"))
encounter_condition_value_id = Column(Integer, ForeignKey('encounter_condition_values.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="ID of the encounter condition value"))
class EncounterTerrain(TableBase): class EncounterTerrain(TableBase):
"""Rows in this table represent ways the player can enter a wild encounter, """A way the player can enter a wild encounter, e.g., surfing, fishing, or walking through tall grass.
e.g., surfing, fishing, or walking through tall grass.
""" """
__tablename__ = 'encounter_terrain' __tablename__ = 'encounter_terrain'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(64), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(64), nullable=False,
info=dict(description="An english name of this terrain", format='plaintext'))
class EncounterSlot(TableBase): class EncounterSlot(TableBase):
"""Rows in this table represent an abstract "slot" within a terrain, """Aan abstract "slot" within a terrain, associated with both some set of conditions and a rarity.
associated with both some set of conditions and a rarity.
Note that there are two encounters per slot, so the rarities will only add Note that there are two encounters per slot, so the rarities will only add
up to 50. up to 50.
""" """
__tablename__ = 'encounter_slots' __tablename__ = 'encounter_slots'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
version_group_id = Column(Integer, ForeignKey('version_groups.id'), nullable=False, autoincrement=False) info=dict(description="A numeric ID"))
encounter_terrain_id = Column(Integer, ForeignKey('encounter_terrain.id'), primary_key=False, nullable=False, autoincrement=False) version_group_id = Column(Integer, ForeignKey('version_groups.id'), nullable=False, autoincrement=False,
info=dict(description="The ID of the Version group this slot is in"))
encounter_terrain_id = Column(Integer, ForeignKey('encounter_terrain.id'), primary_key=False, nullable=False, autoincrement=False,
info=dict(description="The ID of the terrain"))
slot = Column(Integer, nullable=True) slot = Column(Integer, nullable=True)
rarity = Column(Integer, nullable=False) # XXX: What is this?
rarity = Column(Integer, nullable=False,
info=dict(description="The chance of the encounter, in percent")) # XXX: It is in percent, right? I'm confused.
class EncounterSlotCondition(TableBase): class EncounterSlotCondition(TableBase):
"""Lists all conditions that affect each slot.""" """A condition that affects an encounter slot."""
__tablename__ = 'encounter_slot_conditions' __tablename__ = 'encounter_slot_conditions'
encounter_slot_id = Column(Integer, ForeignKey('encounter_slots.id'), primary_key=True, nullable=False, autoincrement=False) encounter_slot_id = Column(Integer, ForeignKey('encounter_slots.id'), primary_key=True, nullable=False, autoincrement=False,
encounter_condition_id = Column(Integer, ForeignKey('encounter_conditions.id'), primary_key=True, nullable=False, autoincrement=False) info=dict(description="The ID of the encounter slot"))
encounter_condition_id = Column(Integer, ForeignKey('encounter_conditions.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description="The ID of the encounter condition"))
class EvolutionChain(TableBase): class EvolutionChain(TableBase):
"""A family of pokémon that are linked by evolution"""
__tablename__ = 'evolution_chains' __tablename__ = 'evolution_chains'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
growth_rate_id = Column(Integer, ForeignKey('growth_rates.id'), nullable=False) info=dict(description="A numeric ID"))
baby_trigger_item_id = Column(Integer, ForeignKey('items.id'), nullable=True) growth_rate_id = Column(Integer, ForeignKey('growth_rates.id'), nullable=False,
info=dict(description="ID of the growth rate for this family"))
baby_trigger_item_id = Column(Integer, ForeignKey('items.id'), nullable=True,
info=dict(description="Item that a parent must hold while breeding to produce a baby"))
class EvolutionTrigger(TableBase): class EvolutionTrigger(TableBase):
"""An evolution type, such as "level" or "trade"."""
__tablename__ = 'evolution_triggers' __tablename__ = 'evolution_triggers'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
identifier = Column(Unicode(16), nullable=False) info=dict(description="A numeric ID"))
identifier = Column(Unicode(16), nullable=False,
info=dict(description="An English identifier", format='identifier'))
class Experience(TableBase): class Experience(TableBase):
"""EXP needed for a certain level with a certain growth rate"""
__tablename__ = 'experience' __tablename__ = 'experience'
growth_rate_id = Column(Integer, ForeignKey('growth_rates.id'), primary_key=True, nullable=False) growth_rate_id = Column(Integer, ForeignKey('growth_rates.id'), primary_key=True, nullable=False,
level = Column(Integer, primary_key=True, nullable=False, autoincrement=False) info=dict(description="ID of the growth rate"))
experience = Column(Integer, nullable=False) level = Column(Integer, primary_key=True, nullable=False, autoincrement=False,
info=dict(description="The level"))
experience = Column(Integer, nullable=False,
info=dict(description="The number of EXP points needed to get to that level"))
class Generation(TableBase): class Generation(TableBase):
u"""A Generation of the pokémon franchise"""
__tablename__ = 'generations' __tablename__ = 'generations'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
main_region_id = Column(Integer, ForeignKey('regions.id')) info=dict(description="A numeric ID"))
canonical_pokedex_id = Column(Integer, ForeignKey('pokedexes.id')) main_region_id = Column(Integer, ForeignKey('regions.id'),
name = Column(Unicode(16), nullable=False) info=dict(description="ID of the region this generation's main games take place in"))
canonical_pokedex_id = Column(Integer, ForeignKey('pokedexes.id'),
info=dict(description=u"ID of the pokédex this generation's main games use by default"))
name = Column(Unicode(16), nullable=False,
info=dict(description=u'An English name of this generation, such as "Generation IV"', format='plaintext'))
class GrowthRate(TableBase): class GrowthRate(TableBase):
"""`formula` is written in LaTeX math notation.""" u"""Growth rate of a pokémon, i.e. the EXP → level function."""
__tablename__ = 'growth_rates' __tablename__ = 'growth_rates'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(20), nullable=False) info=dict(description="A numeric ID"))
formula = Column(Unicode(500), nullable=False) name = Column(Unicode(20), nullable=False,
info=dict(description="A name for the", format='identifier'))
formula = Column(Unicode(500), nullable=False,
info=dict(description="The formula", format='latex'))
class Item(TableBase): class Item(TableBase):
"""An Item from the games, like "Poké Ball" or "Bicycle"."""
__tablename__ = 'items' __tablename__ = 'items'
__singlename__ = 'item' __singlename__ = 'item'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
name = Column(Unicode(20), nullable=False) info=dict(description="A numeric ID"))
category_id = Column(Integer, ForeignKey('item_categories.id'), nullable=False) name = Column(Unicode(20), nullable=False,
cost = Column(Integer, nullable=False) info=dict(description="The English name of the item", official=True, format='plaintext'))
fling_power = Column(Integer, nullable=True) category_id = Column(Integer, ForeignKey('item_categories.id'), nullable=False,
fling_effect_id = Column(Integer, ForeignKey('item_fling_effects.id'), nullable=True) info=dict(description="ID of a category this item belongs to"))
effect = Column(markdown.MarkdownColumn(5120), nullable=False) 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 @property
def appears_underground(self): def appears_underground(self):
"""True if the item appears underground, as specified by the appropriate flag"""
return any(flag.identifier == u'underground' for flag in self.flags) return any(flag.identifier == u'underground' for flag in self.flags)
class ItemCategory(TableBase): class ItemCategory(TableBase):
"""An item category"""
# XXX: This is fanon, right?
__tablename__ = 'item_categories' __tablename__ = 'item_categories'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
pocket_id = Column(Integer, ForeignKey('item_pockets.id'), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(16), nullable=False) 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): class ItemFlag(TableBase):
"""An item attribute such as "consumable" or "holdable"."""
__tablename__ = 'item_flags' __tablename__ = 'item_flags'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
identifier = Column(Unicode(24), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(64), nullable=False) 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): class ItemFlagMap(TableBase):
"""Maps an item flag to its item."""
__tablename__ = 'item_flag_map' __tablename__ = 'item_flag_map'
item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False) 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) 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): class ItemFlavorText(TableBase):
"""An in-game description of an item"""
__tablename__ = 'item_flavor_text' __tablename__ = 'item_flavor_text'
item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False) 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) info=dict(description="The ID of the item"))
flavor_text = Column(Unicode(255), nullable=False) 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): class ItemFlingEffect(TableBase):
"""An effect of the move Fling when used with a specific item"""
__tablename__ = 'item_fling_effects' __tablename__ = 'item_fling_effects'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
effect = Column(Unicode(255), 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): class ItemInternalID(TableBase):
"""The internal ID number a game uses for an item"""
__tablename__ = 'item_internal_ids' __tablename__ = 'item_internal_ids'
item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, autoincrement=False, nullable=False) 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) info=dict(description="The database ID of the item"))
internal_id = Column(Integer, nullable=False) 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): class ItemName(TableBase):
"""A non-English name of an item"""
__tablename__ = 'item_names' __tablename__ = 'item_names'
item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, nullable=False, autoincrement=False) 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) info=dict(description="The ID of the item"))
name = Column(Unicode(16), nullable=False) 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): class ItemPocket(TableBase):
"""A pocket that categorizes items"""
__tablename__ = 'item_pockets' __tablename__ = 'item_pockets'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
identifier = Column(Unicode(16), nullable=False) info=dict(description="A numeric ID"))
name = Column(Unicode(16), nullable=False) 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'))
class Language(TableBase): class Language(TableBase):
u"""A language the Pokémon games have been transleted into; except English"""
__tablename__ = 'languages' __tablename__ = 'languages'
id = Column(Integer, primary_key=True, nullable=False) id = Column(Integer, primary_key=True, nullable=False,
iso639 = Column(Unicode(2), nullable=False) info=dict(description="A numeric ID"))
iso3166 = Column(Unicode(2), nullable=False) iso639 = Column(Unicode(2), nullable=False,
name = Column(Unicode(16), nullable=False) info=dict(description="The two-letter code of the country where this language is spoken. Note that it is not unique."))
iso3166 = Column(Unicode(2), nullable=False,
info=dict(description="The two-letter code of the language. Note that it is not unique."))
name = Column(Unicode(16), nullable=False,
info=dict(description="The English name of the language", format='plaintext'))
class Location(TableBase): class Location(TableBase):
__tablename__ = 'locations' __tablename__ = 'locations'