mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
gift-pokemon: separate gift-egg method
This allows us to indicate eggs by the method, rather than by the level (which will now merely reflect the hatch level in that generation)
This commit is contained in:
parent
b7500e92f0
commit
618aa0064b
2 changed files with 106 additions and 96 deletions
|
@ -17,3 +17,4 @@ id,identifier,order
|
||||||
16,red-flowers,8
|
16,red-flowers,8
|
||||||
17,rough-terrain,9
|
17,rough-terrain,9
|
||||||
18,gift,18
|
18,gift,18
|
||||||
|
19,gift-egg,19
|
||||||
|
|
|
|
@ -13,35 +13,35 @@ session = connect()
|
||||||
def get_version(name):
|
def get_version(name):
|
||||||
return session.query(Version).filter_by(identifier=identifier_from_name(name)).one()
|
return session.query(Version).filter_by(identifier=identifier_from_name(name)).one()
|
||||||
|
|
||||||
def gift_data():
|
R = get_version(u'red')
|
||||||
R = get_version(u'red')
|
B = get_version(u'blue')
|
||||||
B = get_version(u'blue')
|
Y = get_version(u'yellow')
|
||||||
Y = get_version(u'yellow')
|
G = get_version(u'gold')
|
||||||
G = get_version(u'gold')
|
S = get_version(u'silver')
|
||||||
S = get_version(u'silver')
|
C = get_version(u'crystal')
|
||||||
C = get_version(u'crystal')
|
RU = get_version(u'ruby')
|
||||||
RU = get_version(u'ruby')
|
SA = get_version(u'sapphire')
|
||||||
SA = get_version(u'sapphire')
|
EM = get_version(u'emerald')
|
||||||
EM = get_version(u'emerald')
|
FR = get_version(u'firered')
|
||||||
FR = get_version(u'firered')
|
LG = get_version(u'leafgreen')
|
||||||
LG = get_version(u'leafgreen')
|
|
||||||
|
|
||||||
DI = get_version(u'diamond')
|
DI = get_version(u'diamond')
|
||||||
PE = get_version(u'pearl')
|
PE = get_version(u'pearl')
|
||||||
PT = get_version(u'platinum')
|
PT = get_version(u'platinum')
|
||||||
HG = get_version(u'heartgold')
|
HG = get_version(u'heartgold')
|
||||||
SS = get_version(u'soulsilver')
|
SS = get_version(u'soulsilver')
|
||||||
|
|
||||||
BL = get_version(u'black')
|
BL = get_version(u'black')
|
||||||
WH = get_version(u'white')
|
WH = get_version(u'white')
|
||||||
B2 = get_version(u'black-2')
|
B2 = get_version(u'black-2')
|
||||||
W2 = get_version(u'white-2')
|
W2 = get_version(u'white-2')
|
||||||
|
|
||||||
X = get_version(u'x')
|
X = get_version(u'x')
|
||||||
Y = get_version(u'y')
|
Y = get_version(u'y')
|
||||||
OR = get_version(u'omega-ruby')
|
OR = get_version(u'omega-ruby')
|
||||||
AS = get_version(u'alpha-sapphire')
|
AS = get_version(u'alpha-sapphire')
|
||||||
|
|
||||||
|
def normal_gift_data():
|
||||||
return [
|
return [
|
||||||
# Gen I
|
# Gen I
|
||||||
[ u'bulbasaur', [ R, B ], 5, u'pallet-town' ],
|
[ u'bulbasaur', [ R, B ], 5, u'pallet-town' ],
|
||||||
|
@ -65,14 +65,6 @@ def gift_data():
|
||||||
[ u'chikorita', [ G, S, C ], 5, u'new-bark-town' ],
|
[ u'chikorita', [ G, S, C ], 5, u'new-bark-town' ],
|
||||||
[ u'cyndaquil', [ G, S, C ], 5, u'new-bark-town' ],
|
[ u'cyndaquil', [ G, S, C ], 5, u'new-bark-town' ],
|
||||||
[ u'totodile', [ G, S, C ], 5, u'new-bark-town' ],
|
[ u'totodile', [ G, S, C ], 5, u'new-bark-town' ],
|
||||||
[ u'togepi', [ G, S, C ], 0, u'violet-city' ],
|
|
||||||
[ u'pichu', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'cleffa', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'igglybuff', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'tyrogue', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'smoochum', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'elekid', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'magby', [ C ], 0, u'johto-route-34' ],
|
|
||||||
[ u'spearow', [ G, S, C ], 10, u'goldenrod-city', u'north-gate' ],
|
[ u'spearow', [ G, S, C ], 10, u'goldenrod-city', u'north-gate' ],
|
||||||
[ u'eevee', [ G, S, C ], 20, u'goldenrod-city' ],
|
[ u'eevee', [ G, S, C ], 20, u'goldenrod-city' ],
|
||||||
[ u'shuckle', [ G, S, C ], 15, u'cianwood-city' ],
|
[ u'shuckle', [ G, S, C ], 15, u'cianwood-city' ],
|
||||||
|
@ -86,7 +78,6 @@ def gift_data():
|
||||||
[ u'treecko', [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
[ u'treecko', [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
||||||
[ u'torchic', [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
[ u'torchic', [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
||||||
[ u'mudkip' , [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
[ u'mudkip' , [ RU, SA, EM ], 5, u'hoenn-route-101' ],
|
||||||
[ u'wynaut', [ RU, SA, EM ], 0, u'lavaridge-town' ],
|
|
||||||
[ u'castform', [ RU, SA, EM ], 25, u'hoenn-route-119', u'weather-center' ],
|
[ u'castform', [ RU, SA, EM ], 25, u'hoenn-route-119', u'weather-center' ],
|
||||||
[ u'beldum', [ RU, SA, EM ], 5, u'mossdeep-city', u'stevens-house' ],
|
[ u'beldum', [ RU, SA, EM ], 5, u'mossdeep-city', u'stevens-house' ],
|
||||||
[ u'chikorita', [ EM ], 5, u'littleroot-town' ],
|
[ u'chikorita', [ EM ], 5, u'littleroot-town' ],
|
||||||
|
@ -104,7 +95,6 @@ def gift_data():
|
||||||
[ u'hitmonchan', [ FR, LG ], 25, u'saffron-city', u'fighting-dojo' ],
|
[ u'hitmonchan', [ FR, LG ], 25, u'saffron-city', u'fighting-dojo' ],
|
||||||
[ u'eevee', [ FR, LG ], 25, u'celadon-city', u'celadon-mansion' ],
|
[ u'eevee', [ FR, LG ], 25, u'celadon-city', u'celadon-mansion' ],
|
||||||
[ u'lapras', [ FR, LG ], 25, u'saffron-city', u'silph-co-7f' ],
|
[ u'lapras', [ FR, LG ], 25, u'saffron-city', u'silph-co-7f' ],
|
||||||
[ u'togepi', [ FR, LG ], 0, u'water-labyrinth' ],
|
|
||||||
|
|
||||||
# Gen IV
|
# Gen IV
|
||||||
[ u'turtwig', [ DI, PE ], 5, u'lake-verity', u'before-galactic-intervention' ],
|
[ u'turtwig', [ DI, PE ], 5, u'lake-verity', u'before-galactic-intervention' ],
|
||||||
|
@ -113,25 +103,18 @@ def gift_data():
|
||||||
[ u'turtwig', [ PT ], 5, u'sinnoh-route-201' ],
|
[ u'turtwig', [ PT ], 5, u'sinnoh-route-201' ],
|
||||||
[ u'chimchar', [ PT ], 5, u'sinnoh-route-201' ],
|
[ u'chimchar', [ PT ], 5, u'sinnoh-route-201' ],
|
||||||
[ u'piplup', [ PT ], 5, u'sinnoh-route-201' ],
|
[ u'piplup', [ PT ], 5, u'sinnoh-route-201' ],
|
||||||
[ u'togepi', [ DI, PE, PT ], 0, u'eterna-city' ],
|
|
||||||
[ u'eevee', [ DI, PE, ], 5, u'hearthome-city' ],
|
[ u'eevee', [ DI, PE, ], 5, u'hearthome-city' ],
|
||||||
[ u'eevee', [ PT ], 20, u'hearthome-city' ],
|
[ u'eevee', [ PT ], 20, u'hearthome-city' ],
|
||||||
[ u'happiny', [ DI, PE, ], 0, u'hearthome-city' ],
|
|
||||||
[ u'porygon', [ PT ], 25, u'veilstone-city' ],
|
[ u'porygon', [ PT ], 25, u'veilstone-city' ],
|
||||||
[ u'riolu', [ DI, PE, PT ], 0, u'iron-island', u'b2f-left' ],
|
|
||||||
|
|
||||||
[ u'chikorita', [ HG, SS ], 5, u'new-bark-town' ],
|
[ u'chikorita', [ HG, SS ], 5, u'new-bark-town' ],
|
||||||
[ u'cyndaquil', [ HG, SS ], 5, u'new-bark-town' ],
|
[ u'cyndaquil', [ HG, SS ], 5, u'new-bark-town' ],
|
||||||
[ u'totodile', [ HG, SS ], 5, u'new-bark-town' ],
|
[ u'totodile', [ HG, SS ], 5, u'new-bark-town' ],
|
||||||
[ u'togepi', [ HG, SS ], 0, u'violet-city' ],
|
|
||||||
[ u'spearow', [ HG, SS ], 20, u'goldenrod-city', u'north-gate' ],
|
[ u'spearow', [ HG, SS ], 20, u'goldenrod-city', u'north-gate' ],
|
||||||
[ u'eevee', [ HG, SS ], 5, u'goldenrod-city' ],
|
[ u'eevee', [ HG, SS ], 5, u'goldenrod-city' ],
|
||||||
[ u'shuckle', [ HG, SS ], 15, u'cianwood-city' ],
|
[ u'shuckle', [ HG, SS ], 15, u'cianwood-city' ],
|
||||||
[ u'dratini', [ HG, SS ], 15, u'dragons-den' ],
|
[ u'dratini', [ HG, SS ], 15, u'dragons-den' ],
|
||||||
[ u'tyrogue', [ HG, SS ], 10, u'mt-mortar', u'b1f' ],
|
[ u'tyrogue', [ HG, SS ], 10, u'mt-mortar', u'b1f' ],
|
||||||
[ u'mareep', [ HG, SS ], 0, u'violet-city' ],
|
|
||||||
[ u'wooper', [ HG, SS ], 0, u'violet-city' ],
|
|
||||||
[ u'slugma', [ HG, SS ], 0, u'violet-city' ],
|
|
||||||
[ u'bulbasaur', [ HG, SS ], 5, u'pallet-town' ],
|
[ u'bulbasaur', [ HG, SS ], 5, u'pallet-town' ],
|
||||||
[ u'charmander', [ HG, SS ], 5, u'pallet-town' ],
|
[ u'charmander', [ HG, SS ], 5, u'pallet-town' ],
|
||||||
[ u'squirtle', [ HG, SS ], 5, u'pallet-town' ],
|
[ u'squirtle', [ HG, SS ], 5, u'pallet-town' ],
|
||||||
|
@ -149,7 +132,6 @@ def gift_data():
|
||||||
[ u'zorua', [ BL, WH ], 10, u'castelia-city' ],
|
[ u'zorua', [ BL, WH ], 10, u'castelia-city' ],
|
||||||
[ u'tirtouga', [ BL, WH ], 25, u'relic-castle', u'a' ],
|
[ u'tirtouga', [ BL, WH ], 25, u'relic-castle', u'a' ],
|
||||||
[ u'archen', [ BL, WH ], 25, u'relic-castle', u'a' ],
|
[ u'archen', [ BL, WH ], 25, u'relic-castle', u'a' ],
|
||||||
[ u'larvesta', [ BL, WH ], 0, u'unova-route-18' ],
|
|
||||||
[ u'omanyte', [ BL, WH ], 25, u'twist-mountain' ],
|
[ u'omanyte', [ BL, WH ], 25, u'twist-mountain' ],
|
||||||
[ u'kabuto', [ BL, WH ], 25, u'twist-mountain' ],
|
[ u'kabuto', [ BL, WH ], 25, u'twist-mountain' ],
|
||||||
[ u'aerodactyl', [ BL, WH ], 25, u'twist-mountain' ],
|
[ u'aerodactyl', [ BL, WH ], 25, u'twist-mountain' ],
|
||||||
|
@ -175,7 +157,6 @@ def gift_data():
|
||||||
[ u'tirtouga', [ B2, W2 ], 25, u'join-avenue' ],
|
[ u'tirtouga', [ B2, W2 ], 25, u'join-avenue' ],
|
||||||
[ u'archen', [ B2, W2 ], 25, u'join-avenue' ],
|
[ u'archen', [ B2, W2 ], 25, u'join-avenue' ],
|
||||||
[ u'magikarp', [ B2, W2 ], 5, u'marvelous-bridge' ],
|
[ u'magikarp', [ B2, W2 ], 5, u'marvelous-bridge' ],
|
||||||
[ u'happiny', [ B2, W2 ], 0, u'nacrene-city' ],
|
|
||||||
[ u'tirtouga', [ B2, W2 ], 25, u'nacrene-city' ],
|
[ u'tirtouga', [ B2, W2 ], 25, u'nacrene-city' ],
|
||||||
[ u'archen', [ B2, W2 ], 25, u'nacrene-city' ],
|
[ u'archen', [ B2, W2 ], 25, u'nacrene-city' ],
|
||||||
[ u'omanyte', [ B2, W2 ], 25, u'twist-mountain' ],
|
[ u'omanyte', [ B2, W2 ], 25, u'twist-mountain' ],
|
||||||
|
@ -205,14 +186,12 @@ def gift_data():
|
||||||
[ u'torchic', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'torchic', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'mudkip', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'mudkip', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'pikachu', [ OR, AS ], 20, u'contest-hall' ], # suprisingly, this location exists already
|
[ u'pikachu', [ OR, AS ], 20, u'contest-hall' ], # suprisingly, this location exists already
|
||||||
[ u'wynaut', [ OR, AS ], 0, u'lavaridge-town' ],
|
|
||||||
[ u'latios', [ OR ], 30, u'southern-island' ], # eon tickets ignored here - they're not gifts?
|
[ u'latios', [ OR ], 30, u'southern-island' ], # eon tickets ignored here - they're not gifts?
|
||||||
[ u'latias', [ AS ], 30, u'southern-island' ],
|
[ u'latias', [ AS ], 30, u'southern-island' ],
|
||||||
[ u'castform', [ OR, AS ], 30, u'hoenn-route-119', u'weather-center' ],
|
[ u'castform', [ OR, AS ], 30, u'hoenn-route-119', u'weather-center' ],
|
||||||
[ u'chikorita', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'chikorita', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'cyndaquil', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'cyndaquil', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'totodile', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'totodile', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'togepi', [ OR, AS ], 0, u'lavaridge-town' ],
|
|
||||||
[ u'snivy', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'snivy', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'tepig', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'tepig', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
[ u'oshawott', [ OR, AS ], 5, u'hoenn-route-101' ],
|
[ u'oshawott', [ OR, AS ], 5, u'hoenn-route-101' ],
|
||||||
|
@ -222,21 +201,45 @@ def gift_data():
|
||||||
[ u'piplup', [ OR, AS ], 5, u'sinnoh-route-201' ],
|
[ u'piplup', [ OR, AS ], 5, u'sinnoh-route-201' ],
|
||||||
[ u'camerupt', [ OR, AS ], 40, u'battle-resort' ],
|
[ u'camerupt', [ OR, AS ], 40, u'battle-resort' ],
|
||||||
[ u'sharpedo', [ OR, AS ], 40, u'battle-resort' ],
|
[ u'sharpedo', [ OR, AS ], 40, u'battle-resort' ],
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def egg_gift_data():
|
||||||
|
return [
|
||||||
|
[ u'togepi', [ G, S, C ], 5, u'violet-city' ],
|
||||||
|
[ u'pichu', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'cleffa', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'igglybuff', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'tyrogue', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'smoochum', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'elekid', [ C ], 5, u'johto-route-34' ],
|
||||||
|
[ u'magby', [ C ], 5, u'johto-route-34' ],
|
||||||
|
|
||||||
gift_method = session.query(EncounterMethod).filter_by(identifier=u'gift').one()
|
[ u'wynaut', [ RU, SA, EM ], 5, u'lavaridge-town' ],
|
||||||
|
[ u'togepi', [ FR, LG ], 5, u'water-labyrinth' ],
|
||||||
|
|
||||||
for gift_data in gift_data():
|
[ u'togepi', [ DI, PE, PT ], 1, u'eterna-city' ],
|
||||||
pokemon_name = identifier_from_name(gift_data[0])
|
[ u'happiny', [ DI, PE, ], 1, u'hearthome-city' ],
|
||||||
versions = gift_data[1]
|
[ u'riolu', [ DI, PE, PT ], 1, u'iron-island', u'b2f-left' ],
|
||||||
level = identifier_from_name(str(gift_data[2]))
|
[ u'togepi', [ HG, SS ], 1, u'violet-city' ],
|
||||||
location_name = identifier_from_name(gift_data[3])
|
[ u'mareep', [ HG, SS ], 1, u'violet-city' ],
|
||||||
|
[ u'wooper', [ HG, SS ], 1, u'violet-city' ],
|
||||||
|
[ u'slugma', [ HG, SS ], 1, u'violet-city' ],
|
||||||
|
|
||||||
|
[ u'larvesta', [ BL, WH ], 1, u'unova-route-18' ],
|
||||||
|
[ u'happiny', [ B2, W2 ], 1, u'nacrene-city' ],
|
||||||
|
[ u'wynaut', [ OR, AS ], 1, u'lavaridge-town' ],
|
||||||
|
[ u'togepi', [ OR, AS ], 1, u'lavaridge-town' ],
|
||||||
|
]
|
||||||
|
|
||||||
|
def record_method_and_gifts(gift_method, gift_data):
|
||||||
|
for gift_datum in gift_data:
|
||||||
|
pokemon_name = identifier_from_name(gift_datum[0])
|
||||||
|
versions = gift_datum[1]
|
||||||
|
level = identifier_from_name(str(gift_datum[2]))
|
||||||
|
location_name = identifier_from_name(gift_datum[3])
|
||||||
area_name = None
|
area_name = None
|
||||||
if len(gift_data) > 4:
|
if len(gift_datum) > 4:
|
||||||
area_name = identifier_from_name(gift_data[4])
|
area_name = identifier_from_name(gift_datum[4])
|
||||||
|
|
||||||
|
|
||||||
pokemon = session.query(Pokemon ).filter_by(identifier=pokemon_name ).one()
|
pokemon = session.query(Pokemon ).filter_by(identifier=pokemon_name ).one()
|
||||||
location = session.query(Location ).filter_by(identifier=location_name ).one()
|
location = session.query(Location ).filter_by(identifier=location_name ).one()
|
||||||
|
@ -283,3 +286,9 @@ for gift_data in gift_data():
|
||||||
session.add(encounter)
|
session.add(encounter)
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
|
normal_gift_method = session.query(EncounterMethod).filter_by(identifier=u'gift').one()
|
||||||
|
record_method_and_gifts(normal_gift_method, normal_gift_data())
|
||||||
|
|
||||||
|
egg_gift_method = session.query(EncounterMethod).filter_by(identifier=u'gift-egg').one()
|
||||||
|
record_method_and_gifts(egg_gift_method, egg_gift_data())
|
||||||
|
|
Loading…
Reference in a new issue