Merge pull request #62 from encukou/xd-tutor

Colosseum/XD fixes
This commit is contained in:
Eevee 2012-02-04 16:50:52 -08:00
commit 6e3238b0d0
4 changed files with 1862 additions and 1856 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,14 @@
id,generation_id,pokedex_id id,generation_id,pokedex_id,order
1,1,2 1,1,2,1
2,1,2 2,1,2,2
3,2,3 3,2,3,3
4,2,3 4,2,3,4
5,3,4 5,3,4,5
6,3,4 6,3,4,6
7,3,2 7,3,2,9
8,4,5 8,4,5,10
9,4,6 9,4,6,11
10,4,7 10,4,7,12
11,5,8 11,5,8,13
12,3,4 12,3,4,7
13,3,4 13,3,4,8

1 id generation_id pokedex_id order
2 1 1 2 1
3 2 1 2 2
4 3 2 3 3
5 4 2 3 4
6 5 3 4 5
7 6 3 4 6
8 7 3 2 9
9 8 4 5 10
10 9 4 6 11
11 10 4 7 12
12 11 5 8 13
13 12 3 4 7
14 13 3 4 8

View file

@ -1587,6 +1587,8 @@ class VersionGroup(TableBase):
info=dict(description=u"The ID of the generation the games in this group belong to.")) info=dict(description=u"The ID of the generation the games in this group belong to."))
pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), nullable=False, pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), nullable=False,
info=dict(description=u"The ID of the regional Pokédex used in this version group.")) info=dict(description=u"The ID of the regional Pokédex used in this version group."))
order = Column(Integer, nullable=True,
info=dict(description=u"Order for sorting. Almost by date of release, except similar versions are grouped together."))
class VersionGroupRegion(TableBase): class VersionGroupRegion(TableBase):
u"""Maps a version group to a region that appears in it.""" u"""Maps a version group to a region that appears in it."""
@ -1877,7 +1879,7 @@ Pokedex.region = relationship(Region,
backref='pokedexes') backref='pokedexes')
Pokedex.version_groups = relationship(VersionGroup, Pokedex.version_groups = relationship(VersionGroup,
innerjoin=True, innerjoin=True,
order_by=VersionGroup.id.asc(), order_by=VersionGroup.order.asc(),
backref='pokedex') backref='pokedex')
@ -2058,7 +2060,9 @@ Region.generation = relationship(Generation, uselist=False)
Region.version_group_regions = relationship(VersionGroupRegion, Region.version_group_regions = relationship(VersionGroupRegion,
order_by=VersionGroupRegion.version_group_id.asc(), order_by=VersionGroupRegion.version_group_id.asc(),
backref='region') backref='region')
Region.version_groups = association_proxy('version_group_regions', 'version_group') Region.version_groups = relationship(VersionGroup,
secondary=VersionGroupRegion.__table__,
order_by=VersionGroup.order)
Stat.damage_class = relationship(MoveDamageClass, Stat.damage_class = relationship(MoveDamageClass,
@ -2101,7 +2105,7 @@ VersionGroup.versions = relationship(Version,
backref=backref('version_group', lazy='joined')) backref=backref('version_group', lazy='joined'))
VersionGroup.generation = relationship(Generation, VersionGroup.generation = relationship(Generation,
innerjoin=True, lazy='joined', innerjoin=True, lazy='joined',
backref='version_groups') backref=backref('version_groups', order_by=VersionGroup.order))
VersionGroup.version_group_regions = relationship(VersionGroupRegion, VersionGroup.version_group_regions = relationship(VersionGroupRegion,
backref='version_group') backref='version_group')
VersionGroup.regions = association_proxy('version_group_regions', 'region') VersionGroup.regions = association_proxy('version_group_regions', 'region')

View file

@ -98,11 +98,12 @@ for move_identifier, pokemon_identifiers in xd_tutor_data.items():
session.add(pokemon_move) session.add(pokemon_move)
# And unfortunately, we have to copy level-up moves. To both XD and Colosseum. # And unfortunately, we have to copy level-up moves. To both XD and Colosseum.
for pokemon_id, move_id, level in set( for pokemon_id, move_id, level, order in set(
session.query( session.query(
tables.PokemonMove.pokemon_id, tables.PokemonMove.pokemon_id,
tables.PokemonMove.move_id, tables.PokemonMove.move_id,
tables.PokemonMove.level, tables.PokemonMove.level,
tables.PokemonMove.order,
) )
.filter_by(method=level_up) .filter_by(method=level_up)
.filter_by(version_group=emerald_version_group) .filter_by(version_group=emerald_version_group)
@ -114,6 +115,7 @@ for pokemon_id, move_id, level in set(
pokemon_move.move_id = move_id pokemon_move.move_id = move_id
pokemon_move.method = level_up pokemon_move.method = level_up
pokemon_move.level = level pokemon_move.level = level
pokemon_move.order = order
pokemon_move.version_group = version_group pokemon_move.version_group = version_group
session.add(pokemon_move) session.add(pokemon_move)