Rename internal_id to game_index.

This commit is contained in:
Eevee 2011-03-24 19:37:12 -07:00
parent 3a6fe6d539
commit d986355bf3
6 changed files with 26 additions and 26 deletions

View file

@ -1,4 +1,4 @@
item_id,generation_id,internal_id item_id,generation_id,game_index
1,3,1 1,3,1
1,4,1 1,4,1
1,5,1 1,5,1
1 item_id generation_id internal_id game_index
2 1 3 1
3 1 4 1
4 1 5 1

View file

@ -1,4 +1,4 @@
id,location_id,internal_id,identifier id,location_id,game_index,identifier
1,1,1, 1,1,1,
2,2,2, 2,2,2,
3,3,3, 3,3,3,

1 id location_id internal_id game_index identifier
2 1 1 1
3 2 2 2
4 3 3 3

View file

@ -1,4 +1,4 @@
location_id,generation_id,internal_id location_id,generation_id,game_index
1,4,7 1,4,7
2,4,9 2,4,9
3,4,11 3,4,11
1 location_id generation_id internal_id game_index
2 1 4 7
3 2 4 9
4 3 4 11

View file

@ -1,4 +1,4 @@
pokemon_id,generation_id,internal_id pokemon_id,generation_id,game_index
1,1,153 1,1,153
1,2,1 1,2,1
1,3,1 1,3,1
1 pokemon_id generation_id internal_id game_index
2 1 1 153
3 1 2 1
4 1 3 1

View file

@ -574,15 +574,15 @@ create_translation_table('item_fling_effect_prose', ItemFlingEffect, 'prose',
info=dict(description="Description of the effect", format='plaintext')), info=dict(description="Description of the effect", format='plaintext')),
) )
class ItemInternalID(TableBase): class ItemGameIndex(TableBase):
u"""The internal ID number a game uses for an item u"""The internal ID number a game uses for an item
""" """
__tablename__ = 'item_internal_ids' __tablename__ = 'item_game_indices'
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,
info=dict(description="The database ID of the item")) info=dict(description="The database ID of the item"))
generation_id = Column(Integer, ForeignKey('generations.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="ID of the generation of games")) info=dict(description="ID of the generation of games"))
internal_id = Column(Integer, nullable=False, game_index = Column(Integer, nullable=False,
info=dict(description="Internal ID of the item in the generation")) info=dict(description="Internal ID of the item in the generation"))
class ItemPocket(TableBase): class ItemPocket(TableBase):
@ -626,7 +626,7 @@ class LocationArea(TableBase):
info=dict(description="A numeric ID")) info=dict(description="A numeric ID"))
location_id = Column(Integer, ForeignKey('locations.id'), nullable=False, location_id = Column(Integer, ForeignKey('locations.id'), nullable=False,
info=dict(description="ID of the location this area is part of")) info=dict(description="ID of the location this area is part of"))
internal_id = Column(Integer, nullable=False, game_index = Column(Integer, nullable=False,
info=dict(description="ID the games ude for this area")) info=dict(description="ID the games ude for this area"))
identifier = Column(Unicode(64), nullable=True, identifier = Column(Unicode(64), nullable=True,
info=dict(description="An identifier", format='identifier')) info=dict(description="An identifier", format='identifier'))
@ -648,15 +648,15 @@ class LocationAreaEncounterRate(TableBase):
rate = Column(Integer, nullable=True, rate = Column(Integer, nullable=True,
info=dict(description="The encounter rate")) # units? info=dict(description="The encounter rate")) # units?
class LocationInternalID(TableBase): class LocationGameIndex(TableBase):
u"""IDs the games use internally for locations u"""IDs the games use internally for locations
""" """
__tablename__ = 'location_internal_ids' __tablename__ = 'location_game_indices'
location_id = Column(Integer, ForeignKey('locations.id'), nullable=False, primary_key=True, location_id = Column(Integer, ForeignKey('locations.id'), nullable=False, primary_key=True,
info=dict(description="Database ID of the locaion")) info=dict(description="Database ID of the locaion"))
generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False, primary_key=True, generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False, primary_key=True,
info=dict(description="ID of the generation this entry to")) info=dict(description="ID of the generation this entry to"))
internal_id = Column(Integer, nullable=False, game_index = Column(Integer, nullable=False,
info=dict(description="Internal game ID of the location")) info=dict(description="Internal game ID of the location"))
class Machine(TableBase): class Machine(TableBase):
@ -1389,15 +1389,15 @@ create_translation_table('pokemon_habitat_names', PokemonHabitat, 'names',
info=dict(description="The name", format='plaintext', official=True)), info=dict(description="The name", format='plaintext', official=True)),
) )
class PokemonInternalID(TableBase): class PokemonGameIndex(TableBase):
u"""The number of a Pokémon a game uses internally u"""The number of a Pokémon a game uses internally
""" """
__tablename__ = 'pokemon_internal_ids' __tablename__ = 'pokemon_game_indices'
pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, autoincrement=False, nullable=False, pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, autoincrement=False, nullable=False,
info=dict(description=u"Database ID of the Pokémon")) info=dict(description=u"Database ID of the Pokémon"))
generation_id = Column(Integer, ForeignKey('generations.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=u"Database ID of the generation")) info=dict(description=u"Database ID of the generation"))
internal_id = Column(Integer, nullable=False, game_index = Column(Integer, nullable=False,
info=dict(description=u"Internal ID the generation's games use for the Pokémon")) info=dict(description=u"Internal ID the generation's games use for the Pokémon"))
class PokemonItem(TableBase): class PokemonItem(TableBase):
@ -1726,8 +1726,8 @@ ItemCategory.pocket = relation(ItemPocket)
ItemFlavorText.version_group = relation(VersionGroup) ItemFlavorText.version_group = relation(VersionGroup)
ItemFlavorText.language = relation(Language) ItemFlavorText.language = relation(Language)
ItemInternalID.item = relation(Item, backref='internal_ids') ItemGameIndex.item = relation(Item, backref='game_indices')
ItemInternalID.generation = relation(Generation) ItemGameIndex.generation = relation(Generation)
ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.identifier) ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.identifier)
@ -1735,8 +1735,8 @@ Location.region = relation(Region, backref='locations')
LocationArea.location = relation(Location, backref='areas') LocationArea.location = relation(Location, backref='areas')
LocationInternalID.location = relation(Location, backref='internal_ids') LocationGameIndex.location = relation(Location, backref='game_indices')
LocationInternalID.generation = relation(Generation) LocationGameIndex.generation = relation(Generation)
Machine.item = relation(Item) Machine.item = relation(Item)
Machine.version_group = relation(VersionGroup) Machine.version_group = relation(VersionGroup)

View file

@ -128,8 +128,8 @@ class SaveFilePokemon(object):
self._held_item = None self._held_item = None
if st.held_item_id: if st.held_item_id:
self._held_item = session.query(tables.ItemInternalID) \ self._held_item = session.query(tables.ItemGameIndex) \
.filter_by(generation_id = 4, internal_id = st.held_item_id).one().item .filter_by(generation_id = 4, game_index = st.held_item_id).one().item
self._stats = [] self._stats = []
for pokemon_stat in self._pokemon.stats: for pokemon_stat in self._pokemon.stats:
@ -173,19 +173,19 @@ class SaveFilePokemon(object):
pokeball_id = st.hgss_pokeball - 17 + 492 pokeball_id = st.hgss_pokeball - 17 + 492
else: else:
pokeball_id = st.dppt_pokeball pokeball_id = st.dppt_pokeball
self._pokeball = session.query(tables.ItemInternalID) \ self._pokeball = session.query(tables.ItemGameIndex) \
.filter_by(generation_id = 4, internal_id = pokeball_id).one().item .filter_by(generation_id = 4, game_index = pokeball_id).one().item
egg_loc_id = st.pt_egg_location_id or st.dp_egg_location_id egg_loc_id = st.pt_egg_location_id or st.dp_egg_location_id
met_loc_id = st.pt_met_location_id or st.dp_met_location_id met_loc_id = st.pt_met_location_id or st.dp_met_location_id
self._egg_location = None self._egg_location = None
if egg_loc_id: if egg_loc_id:
self._egg_location = session.query(tables.LocationInternalID) \ self._egg_location = session.query(tables.LocationGameIndex) \
.filter_by(generation_id = 4, internal_id = egg_loc_id).one().location .filter_by(generation_id = 4, game_index = egg_loc_id).one().location
self._met_location = session.query(tables.LocationInternalID) \ self._met_location = session.query(tables.LocationGameIndex) \
.filter_by(generation_id = 4, internal_id = met_loc_id).one().location .filter_by(generation_id = 4, game_index = met_loc_id).one().location
@property @property
def species(self): def species(self):