mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Add the SpecialEncounter table, along with SpecialEncounterType
and SpecialEncounterVersion
This commit is contained in:
parent
e0ccad23aa
commit
538bc8ea5f
6 changed files with 94 additions and 0 deletions
9
pokedex/data/csv/special_encounter_type_names.csv
Normal file
9
pokedex/data/csv/special_encounter_type_names.csv
Normal file
|
@ -0,0 +1,9 @@
|
|||
special_encounter_type_id,local_language_id,name
|
||||
1,9,Starting Pokémon
|
||||
2,9,Gift
|
||||
3,9,Fossil
|
||||
4,9,Overworld
|
||||
5,9,Purchase
|
||||
6,9,Trade
|
||||
7,9,Prize
|
||||
8,9,Snag
|
|
9
pokedex/data/csv/special_encounter_types.csv
Normal file
9
pokedex/data/csv/special_encounter_types.csv
Normal file
|
@ -0,0 +1,9 @@
|
|||
id,identifier
|
||||
1,starter
|
||||
2,gift
|
||||
3,fossil
|
||||
4,overworld
|
||||
5,purchase
|
||||
6,trade
|
||||
7,prize
|
||||
8,snag
|
|
1
pokedex/data/csv/special_encounter_versions.csv
Normal file
1
pokedex/data/csv/special_encounter_versions.csv
Normal file
|
@ -0,0 +1 @@
|
|||
special_encounter_id,version_id
|
|
1
pokedex/data/csv/special_encounters.csv
Normal file
1
pokedex/data/csv/special_encounters.csv
Normal file
|
@ -0,0 +1 @@
|
|||
id,type_id,event_pokemon_id,location_area_id,roam_region_id,cost,traded_species_id,traded_gender_id
|
|
1
pokedex/data/csv/trainer_names.csv
Normal file
1
pokedex/data/csv/trainer_names.csv
Normal file
|
@ -0,0 +1 @@
|
|||
trainer_id,local_language_id,name
|
|
|
@ -1516,6 +1516,56 @@ create_translation_table('region_names', Region, 'names',
|
|||
info=dict(description="The name", format='plaintext', official=True)),
|
||||
)
|
||||
|
||||
|
||||
class SpecialEncounter(TableBase):
|
||||
u"""Special in-game encounters with pokémon: trades, prizes, fossils, etc.
|
||||
"""
|
||||
__tablename__ = 'special_encounters'
|
||||
id = Column(Integer, primary_key=True, nullable=False,
|
||||
info=dict(description=u"A numeric ID"))
|
||||
type_id = Column(Integer, ForeignKey('special_encounter_types.id'), nullable=False,
|
||||
info=dict(description=u"Type of the encounter"))
|
||||
event_pokemon_id = Column(Integer, ForeignKey('event_pokemon.id'), nullable=False,
|
||||
info=dict(description=u"The pokémon encountered"))
|
||||
location_area_id = Column(Integer, ForeignKey('location_areas.id'), nullable=True,
|
||||
info=dict(description=u"The location of the encounter, if specific"))
|
||||
roam_region_id = Column(Integer, ForeignKey('regions.id'), nullable=True,
|
||||
info=dict(description=u"The region, if roaming"))
|
||||
cost = Column(Integer, nullable=True,
|
||||
info=dict(description=u"The cost, in game money or coints, if applicable"))
|
||||
traded_species_id = Column(Integer, ForeignKey('pokemon_species.id'), nullable=True,
|
||||
info=dict(description=u"The species the player needs to offer in trade, if applicable"))
|
||||
traded_gender_id = Column(Integer, ForeignKey('genders.id'), nullable=True,
|
||||
info=dict(description=u"The gender of the pokémon the player needs to offer in trade, if applicable"))
|
||||
|
||||
|
||||
class SpecialEncounterType(TableBase):
|
||||
u"""Type of a special in-game encounter
|
||||
"""
|
||||
__tablename__ = 'special_encounter_types'
|
||||
__singlename__ = 'special_encounter_type'
|
||||
id = Column(Integer, primary_key=True, nullable=False,
|
||||
info=dict(description=u"A numeric ID"))
|
||||
identifier = Column(Unicode(16), nullable=False,
|
||||
info=dict(description=u"An identifier", format='identifier'))
|
||||
|
||||
create_translation_table('special_encounter_type_names', SpecialEncounterType, 'names',
|
||||
relation_lazy='joined',
|
||||
name = Column(Unicode(16), nullable=False, index=True,
|
||||
info=dict(description="The name", format='plaintext', official=False)),
|
||||
)
|
||||
|
||||
|
||||
class SpecialEncounterVersion(TableBase):
|
||||
u"""Maps special encounters to the versions they occur in
|
||||
"""
|
||||
__tablename__ = 'special_encounter_versions'
|
||||
special_encounter_id = Column(Integer, ForeignKey('special_encounters.id'), primary_key=True, nullable=False, autoincrement=False,
|
||||
info=dict(description=u"The encounter"))
|
||||
version_id = Column(Integer, ForeignKey('versions.id'), primary_key=True, nullable=False, autoincrement=False,
|
||||
info=dict(description=u"The version"))
|
||||
|
||||
|
||||
class Stat(TableBase):
|
||||
u"""A Stat, such as Attack or Speed
|
||||
"""
|
||||
|
@ -2147,9 +2197,32 @@ Region.version_group_regions = relationship(VersionGroupRegion,
|
|||
Region.version_groups = association_proxy('version_group_regions', 'version_group')
|
||||
|
||||
|
||||
SpecialEncounter.type = relationship(SpecialEncounterType,
|
||||
backref='encounters')
|
||||
SpecialEncounter.event_pokemon = relationship(EventPokemon,
|
||||
backref='encounters')
|
||||
SpecialEncounter.location_area = relationship(LocationArea,
|
||||
backref='special_encounters')
|
||||
SpecialEncounter.roam_region = relationship(Region,
|
||||
backref='roam_encounters')
|
||||
SpecialEncounter.traded_species = relationship(PokemonSpecies,
|
||||
backref='possible_in_game_trades')
|
||||
SpecialEncounter.traded_gender = relationship(Gender)
|
||||
SpecialEncounter.versions = relationship(Version,
|
||||
secondary=SpecialEncounterVersion.__table__,
|
||||
primaryjoin=SpecialEncounterVersion.special_encounter_id == SpecialEncounter.id,
|
||||
secondaryjoin=SpecialEncounterVersion.version_id == Version.id,
|
||||
backref='special_encounters')
|
||||
|
||||
|
||||
SpecialEncounterVersion.encounter = relationship(SpecialEncounter)
|
||||
SpecialEncounterVersion.version = relationship(Version)
|
||||
|
||||
|
||||
Stat.damage_class = relationship(MoveDamageClass,
|
||||
backref='stats')
|
||||
|
||||
|
||||
StatHint.stat = relationship(Stat,
|
||||
innerjoin=True,
|
||||
backref='hints')
|
||||
|
|
Loading…
Reference in a new issue