Merge pull request #238 from jrubinator/record-gift-pokemon

Record gift pokemon
This commit is contained in:
Andrew Ekstedt 2019-07-12 19:40:29 -07:00 committed by GitHub
commit db824220d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 689 additions and 1 deletions

View file

@ -33,3 +33,5 @@ encounter_method_id,local_language_id,name
16,9,Walking in red flowers
17,6,Auf unwegsamen Gelände laufen
17,9,Walking on rough terrain
18,9,Receive as a gift
19,9,Receive egg as a gift

1 encounter_method_id local_language_id name
33 16 9 Walking in red flowers
34 17 6 Auf unwegsamen Gelände laufen
35 17 9 Walking on rough terrain
36 18 9 Receive as a gift
37 19 9 Receive egg as a gift

View file

@ -16,3 +16,5 @@ id,identifier,order
15,purple-flowers,7
16,red-flowers,8
17,rough-terrain,9
18,gift,18
19,gift-egg,19

1 id identifier order
16 15 purple-flowers 7
17 16 red-flowers 8
18 17 rough-terrain 9
19 18 gift 18
20 19 gift-egg 19

View file

@ -488,3 +488,28 @@ id,version_group_id,encounter_method_id,slot,rarity
487,15,4,0,60
488,15,4,1,35
489,15,4,2,5
490,1,18,,100
491,2,18,,100
492,3,18,,100
493,4,18,,100
494,5,18,,100
495,6,18,,100
496,7,18,,100
497,8,18,,100
498,9,18,,100
499,10,18,,100
500,11,18,,100
501,14,18,,100
502,15,18,,100
503,16,18,,100
504,3,19,,100
505,4,19,,100
506,5,19,,100
507,6,19,,100
508,7,19,,100
509,8,19,,100
510,9,19,,100
511,10,19,,100
512,11,19,,100
513,14,19,,100
514,16,19,,100

1 id version_group_id encounter_method_id slot rarity
488 487 15 4 0 60
489 488 15 4 1 35
490 489 15 4 2 5
491 490 1 18 100
492 491 2 18 100
493 492 3 18 100
494 493 4 18 100
495 494 5 18 100
496 495 6 18 100
497 496 7 18 100
498 497 8 18 100
499 498 9 18 100
500 499 10 18 100
501 500 11 18 100
502 501 14 18 100
503 502 15 18 100
504 503 16 18 100
505 504 3 19 100
506 505 4 19 100
507 506 5 19 100
508 507 6 19 100
509 508 7 19 100
510 509 8 19 100
511 510 9 19 100
512 511 10 19 100
513 512 11 19 100
514 513 14 19 100
515 514 16 19 100

View file

@ -46577,3 +46577,258 @@ id,version_id,location_area_id,encounter_slot_id,pokemon_id,min_level,max_level
50287,11,343,228,19,26,26
50288,11,343,229,37,32,32
50289,11,343,230,19,26,26
50290,1,285,490,1,5,5
50291,2,285,490,1,5,5
50292,1,285,490,4,5,5
50293,2,285,490,4,5,5
50294,1,285,490,7,5,5
50295,2,285,490,7,5,5
50296,3,285,491,25,5,5
50297,3,281,491,1,10,10
50298,3,314,491,4,10,10
50299,3,282,491,7,10,10
50300,1,761,490,129,5,5
50301,2,761,490,129,5,5
50302,3,761,491,129,5,5
50303,1,762,490,106,30,30
50304,2,762,490,106,30,30
50305,3,762,491,106,30,30
50306,1,762,490,107,30,30
50307,2,762,490,107,30,30
50308,3,762,491,107,30,30
50309,1,763,490,133,25,25
50310,2,763,490,133,25,25
50311,3,763,491,133,25,25
50312,1,764,490,131,15,15
50313,2,764,490,131,15,15
50314,3,764,491,131,15,15
50315,4,184,492,152,5,5
50316,5,184,492,152,5,5
50317,6,184,493,152,5,5
50318,4,184,492,155,5,5
50319,5,184,492,155,5,5
50320,6,184,493,155,5,5
50321,4,184,492,158,5,5
50322,5,184,492,158,5,5
50323,6,184,493,158,5,5
50324,4,765,492,21,10,10
50325,5,765,492,21,10,10
50326,6,765,493,21,10,10
50327,4,766,492,133,20,20
50328,5,766,492,133,20,20
50329,6,766,493,133,20,20
50330,4,767,492,213,15,15
50331,5,767,492,213,15,15
50332,6,767,493,213,15,15
50333,6,250,493,147,15,15
50334,4,240,492,236,10,10
50335,5,240,492,236,10,10
50336,6,240,493,236,10,10
50337,7,393,494,252,5,5
50338,8,393,494,252,5,5
50339,9,393,495,252,5,5
50340,7,393,494,255,5,5
50341,8,393,494,255,5,5
50342,9,393,495,255,5,5
50343,7,393,494,258,5,5
50344,8,393,494,258,5,5
50345,9,393,495,258,5,5
50346,7,768,494,351,25,25
50347,8,768,494,351,25,25
50348,9,768,495,351,25,25
50349,7,769,494,374,5,5
50350,8,769,494,374,5,5
50351,9,769,495,374,5,5
50352,9,770,495,152,5,5
50353,9,770,495,155,5,5
50354,9,770,495,158,5,5
50355,10,285,496,1,5,5
50356,11,285,496,1,5,5
50357,10,285,496,4,5,5
50358,11,285,496,4,5,5
50359,10,285,496,7,5,5
50360,11,285,496,7,5,5
50361,10,761,496,129,5,5
50362,11,761,496,129,5,5
50363,10,762,496,106,25,25
50364,11,762,496,106,25,25
50365,10,762,496,107,25,25
50366,11,762,496,107,25,25
50367,10,763,496,133,25,25
50368,11,763,496,133,25,25
50369,10,764,496,131,25,25
50370,11,764,496,131,25,25
50371,12,135,497,387,5,5
50372,13,135,497,387,5,5
50373,12,135,497,390,5,5
50374,13,135,497,390,5,5
50375,12,135,497,393,5,5
50376,13,135,497,393,5,5
50377,14,141,498,387,5,5
50378,14,141,498,390,5,5
50379,14,141,498,393,5,5
50380,12,771,497,133,5,5
50381,13,771,497,133,5,5
50382,14,771,498,133,20,20
50383,14,772,498,137,25,25
50384,15,184,499,152,5,5
50385,16,184,499,152,5,5
50386,15,184,499,155,5,5
50387,16,184,499,155,5,5
50388,15,184,499,158,5,5
50389,16,184,499,158,5,5
50390,15,765,499,21,20,20
50391,16,765,499,21,20,20
50392,15,766,499,133,5,5
50393,16,766,499,133,5,5
50394,15,773,499,213,15,15
50395,16,773,499,213,15,15
50396,15,250,499,147,15,15
50397,16,250,499,147,15,15
50398,15,240,499,236,10,10
50399,16,240,499,236,10,10
50400,15,285,499,1,5,5
50401,16,285,499,1,5,5
50402,15,285,499,4,5,5
50403,16,285,499,4,5,5
50404,15,285,499,7,5,5
50405,16,285,499,7,5,5
50406,15,764,499,252,5,5
50407,16,764,499,252,5,5
50408,15,764,499,255,5,5
50409,16,764,499,255,5,5
50410,15,764,499,258,5,5
50411,16,764,499,258,5,5
50412,17,774,500,495,5,5
50413,18,774,500,495,5,5
50414,17,774,500,498,5,5
50415,18,774,500,498,5,5
50416,17,774,500,501,5,5
50417,18,774,500,501,5,5
50418,17,579,500,511,10,10
50419,18,579,500,511,10,10
50420,17,579,500,513,10,10
50421,18,579,500,513,10,10
50422,17,579,500,515,10,10
50423,18,579,500,515,10,10
50424,17,775,500,570,10,10
50425,18,775,500,570,10,10
50426,17,622,500,129,5,5
50427,18,622,500,129,5,5
50428,21,657,501,495,5,5
50429,22,657,501,495,5,5
50430,21,657,501,498,5,5
50431,22,657,501,498,5,5
50432,21,657,501,501,5,5
50433,22,657,501,501,5,5
50434,21,577,501,570,25,25
50435,22,577,501,570,25,25
50436,21,776,501,585,30,30
50437,22,776,501,585,30,30
50438,21,656,501,133,10,10
50439,22,656,501,133,10,10
50440,21,622,501,129,5,5
50441,22,622,501,129,5,5
50442,22,777,501,147,1,1
50443,21,777,501,443,1,1
50444,23,778,502,650,5,5
50445,24,778,502,650,5,5
50446,23,778,502,653,5,5
50447,24,778,502,653,5,5
50448,23,778,502,656,5,5
50449,24,778,502,656,5,5
50450,23,779,502,1,10,10
50451,24,779,502,1,10,10
50452,23,779,502,4,10,10
50453,24,779,502,4,10,10
50454,23,779,502,7,10,10
50455,24,779,502,7,10,10
50456,23,736,502,696,20,20
50457,24,736,502,696,20,20
50458,23,736,502,698,20,20
50459,24,736,502,698,20,20
50460,23,780,502,448,32,32
50461,24,780,502,448,32,32
50462,23,723,502,131,30,30
50463,24,723,502,131,30,30
50464,25,393,503,252,5,5
50465,26,393,503,252,5,5
50466,25,393,503,255,5,5
50467,26,393,503,255,5,5
50468,25,393,503,258,5,5
50469,26,393,503,258,5,5
50470,25,781,503,25,20,20
50471,26,781,503,25,20,20
50472,25,782,503,25,20,20
50473,26,782,503,25,20,20
50474,25,783,503,25,20,20
50475,26,783,503,25,20,20
50476,25,784,503,25,20,20
50477,26,784,503,25,20,20
50478,25,785,503,381,30,30
50479,26,785,503,380,30,30
50480,25,768,503,351,30,30
50481,26,768,503,351,30,30
50482,25,393,503,152,5,5
50483,26,393,503,152,5,5
50484,25,393,503,155,5,5
50485,26,393,503,155,5,5
50486,25,393,503,158,5,5
50487,26,393,503,158,5,5
50488,25,393,503,495,5,5
50489,26,393,503,495,5,5
50490,25,393,503,498,5,5
50491,26,393,503,498,5,5
50492,25,393,503,501,5,5
50493,26,393,503,501,5,5
50494,25,769,503,374,1,1
50495,26,769,503,374,1,1
50496,25,393,503,387,5,5
50497,26,393,503,387,5,5
50498,25,393,503,390,5,5
50499,26,393,503,390,5,5
50500,25,393,503,393,5,5
50501,26,393,503,393,5,5
50502,25,786,503,323,40,40
50503,26,786,503,323,40,40
50504,25,786,503,319,40,40
50505,26,786,503,319,40,40
50506,4,189,504,175,5,5
50507,5,189,504,175,5,5
50508,6,189,505,175,5,5
50509,6,205,505,172,5,5
50510,6,205,505,173,5,5
50511,6,205,505,174,5,5
50512,6,205,505,236,5,5
50513,6,205,505,238,5,5
50514,6,205,505,239,5,5
50515,6,205,505,240,5,5
50516,7,787,506,360,5,5
50517,8,787,506,360,5,5
50518,9,787,507,360,5,5
50519,10,518,508,175,5,5
50520,11,518,508,175,5,5
50521,12,788,509,175,1,1
50522,13,788,509,175,1,1
50523,14,788,510,175,1,1
50524,12,789,509,440,1,1
50525,13,789,509,440,1,1
50526,12,124,509,447,1,1
50527,13,124,509,447,1,1
50528,14,124,510,447,1,1
50529,15,790,511,175,1,1
50530,16,790,511,175,1,1
50531,15,791,511,179,1,1
50532,16,791,511,179,1,1
50533,15,791,511,194,1,1
50534,16,791,511,194,1,1
50535,15,791,511,218,1,1
50536,16,791,511,218,1,1
50537,17,653,512,636,1,1
50538,18,653,512,636,1,1
50539,21,792,513,440,1,1
50540,22,792,513,440,1,1
50541,25,787,514,360,1,1
50542,26,787,514,360,1,1
50543,25,787,514,175,1,1
50544,26,787,514,175,1,1

Can't render this file because it is too large.

View file

@ -618,3 +618,35 @@ location_area_id,local_language_id,name
756,9,Unknown Area 345
757,9,Unknown Area 347
758,9,Unknown Area 348
761,9,Pokemon Center
762,9,Fighting Dojo
763,9,Celadon Mansion rooftop
764,9,Silph Co. 7F
765,9,North Gate
766,9,Bill's house
767,9,Mania's house
768,9,Weather Institute
769,9,Steven's house
770,9,
771,9,
772,9,
773,9,Kirk's house
774,9,
775,9,Game Freak HQ 1F
776,9,Weather Institute
777,9,
778,9,
779,9,
780,9,
781,9,Contest Hall
782,9,Contest Hall
783,9,Contest Hall
784,9,Contest Hall
785,9,
786,9,
787,9,
788,9,West Gate
789,9,West Gate
790,9,Poke Mart
791,9,Pokemon Center
792,9,West Gate

1 location_area_id local_language_id name
618 756 9 Unknown Area 345
619 757 9 Unknown Area 347
620 758 9 Unknown Area 348
621 761 9 Pokemon Center
622 762 9 Fighting Dojo
623 763 9 Celadon Mansion rooftop
624 764 9 Silph Co. 7F
625 765 9 North Gate
626 766 9 Bill's house
627 767 9 Mania's house
628 768 9 Weather Institute
629 769 9 Steven's house
630 770 9
631 771 9
632 772 9
633 773 9 Kirk's house
634 774 9
635 775 9 Game Freak HQ 1F
636 776 9 Weather Institute
637 777 9
638 778 9
639 779 9
640 780 9
641 781 9 Contest Hall
642 782 9 Contest Hall
643 783 9 Contest Hall
644 784 9 Contest Hall
645 785 9
646 786 9
647 787 9
648 788 9 West Gate
649 789 9 West Gate
650 790 9 Poke Mart
651 791 9 Pokemon Center
652 792 9 West Gate

View file

@ -650,3 +650,35 @@ id,location_id,game_index,identifier
758,676,0,unknown-area-348
759,677,0,
760,661,0,
761,120,0,pokemon-center
762,234,0,fighting-dojo
763,67,0,celadon-mansion
764,234,0,silph-co-7f
765,229,0,north-gate
766,229,0,bills-house
767,70,0,manias-house
768,467,0,weather-institute
769,432,0,stevens-house
770,567,0,
771,169,0,
772,170,0,
773,70,0,kirks-house
774,346,0,
775,350,0,game-freak-hq-1f
776,361,0,weather-institute
777,536,0,
778,590,0,
779,599,0,
780,625,0,
781,430,0,contest-hall
782,571,0,contest-hall
783,570,0,contest-hall
784,431,0,contest-hall
785,578,0,
786,695,0,
787,569,0,
788,2,0,west-gate
789,169,0,west-gate
790,153,0,poke-mart
791,153,0,pokemon-center
792,349,0,west-gate

1 id location_id game_index identifier
650 758 676 0 unknown-area-348
651 759 677 0
652 760 661 0
653 761 120 0 pokemon-center
654 762 234 0 fighting-dojo
655 763 67 0 celadon-mansion
656 764 234 0 silph-co-7f
657 765 229 0 north-gate
658 766 229 0 bills-house
659 767 70 0 manias-house
660 768 467 0 weather-institute
661 769 432 0 stevens-house
662 770 567 0
663 771 169 0
664 772 170 0
665 773 70 0 kirks-house
666 774 346 0
667 775 350 0 game-freak-hq-1f
668 776 361 0 weather-institute
669 777 536 0
670 778 590 0
671 779 599 0
672 780 625 0
673 781 430 0 contest-hall
674 782 571 0 contest-hall
675 783 570 0 contest-hall
676 784 431 0 contest-hall
677 785 578 0
678 786 695 0
679 787 569 0
680 788 2 0 west-gate
681 789 169 0 west-gate
682 790 153 0 poke-mart
683 791 153 0 pokemon-center
684 792 349 0 west-gate

View file

@ -850,7 +850,17 @@ create_translation_table('encounter_method_prose', EncounterMethod, 'prose',
)
class EncounterSlot(TableBase):
u"""An abstract "slot" within a method, associated with both some set of conditions and a rarity."""
u"""An abstract "slot" within a method, associated with both some set of conditions and a rarity.
"slot" has a very specific meaning:
If during gameplay you know sufficient details about the current game state,
you can predict which slot (and therefore which pokemon) will spawn.
There are currently two reasons that "slot" might be empty:
1) The slot corresponds to a gift pokemon.
2) Red/Blue's Super Rod slots, which don't correspond to in-game slots.
See https://github.com/veekun/pokedex/issues/166#issuecomment-220101455
"""
__tablename__ = 'encounter_slots'
id = Column(Integer, primary_key=True, nullable=False,

View file

@ -28,6 +28,28 @@ def test_encounter_slots(session):
# Encounter slots all match the encounters they belong to
assert sanity_q.count() == 0
def test_encounter_regions(session):
"""Check that encounter locations match the region of the game they're from.
"""
sanity_q = session.query(tables.Encounter) \
.join((tables.Version, tables.Encounter.version)) \
.join((tables.VersionGroup, tables.Version.version_group)) \
.join((tables.LocationArea, tables.Encounter.location_area)) \
.join((tables.Location, tables.LocationArea.location)) \
.join((tables.Region, tables.Location.region)) \
.filter(~tables.VersionGroup.version_group_regions.any(tables.VersionGroupRegion.region_id == tables.Region.id))
for e in sanity_q.limit(20):
acceptable_regions = " or ".join(r.identifier for r in e.version.version_group.regions)
if e.location_area.location.region is not None:
print("{e} ({e.pokemon.identifier}, {e.slot.method.identifier}, {e.version.identifier}) is in {e.location_area.location.region.identifier} ({e.location_area.location.identifier}) but should be in {acceptable_regions} ({e.version.identifier})".format(e=e, acceptable_regions=acceptable_regions))
else:
print("{e} ({e.pokemon.identifier}, {e.slot.method.identifier}, {e.version.identifier}) is in a pseudo-location ({e.location_area.location.identifier}) that is not part of any region, but should be in {acceptable_regions} ({e.version.identifier})".format(e=e, acceptable_regions=acceptable_regions))
# Encounter regions match the games they belong to
assert sanity_q.count() == 0
@parametrize('cls', tables.mapped_classes)
def test_nonzero_autoincrement_ids(session, cls):
"""Check that autoincrementing ids don't contain zeroes

View file

@ -0,0 +1,308 @@
#!/usr/bin/env python2
"""
This is an unmaintained one-shot script, only included in the repo for
reference.
"""
from pokedex.db import connect, identifier_from_name
from pokedex.db.tables import Encounter, EncounterMethod, EncounterSlot, Language, Location, LocationArea, Pokemon, Version
session = connect()
def get_version(name):
return session.query(Version).filter_by(identifier=identifier_from_name(name)).one()
R = get_version(u'red')
B = get_version(u'blue')
Ye = get_version(u'yellow')
G = get_version(u'gold')
S = get_version(u'silver')
C = get_version(u'crystal')
RU = get_version(u'ruby')
SA = get_version(u'sapphire')
EM = get_version(u'emerald')
FR = get_version(u'firered')
LG = get_version(u'leafgreen')
DI = get_version(u'diamond')
PE = get_version(u'pearl')
PT = get_version(u'platinum')
HG = get_version(u'heartgold')
SS = get_version(u'soulsilver')
BL = get_version(u'black')
WH = get_version(u'white')
B2 = get_version(u'black-2')
W2 = get_version(u'white-2')
X = get_version(u'x')
Y = get_version(u'y')
OR = get_version(u'omega-ruby')
AS = get_version(u'alpha-sapphire')
def normal_gift_data():
return [
# Gen I
[ u'bulbasaur', [ R, B ], 5, u'pallet-town' ],
[ u'charmander', [ R, B ], 5, u'pallet-town' ],
[ u'squirtle', [ R, B ], 5, u'pallet-town' ],
[ u'pikachu', [ Ye ], 5, u'pallet-town' ],
[ u'bulbasaur', [ Ye ], 10, u'cerulean-city' ],
[ u'charmander', [ Ye ], 10, u'kanto-route-24' ],
[ u'squirtle', [ Ye ], 10, u'vermilion-city' ],
#[ u'aerodactyl', [ R, B, Ye ], 30, u'pewter-city', u'museum-of-science', u'Pewter Museum of Science' ],
[ u'magikarp', [ R, B, Ye ], 5, u'kanto-route-4', u'pokemon-center', u'Pokemon Center' ],
#[ u'omanyte', [ R, B, Ye ], 30, u'mt-moon', u'b2f' ],
#[ u'kabuto', [ R, B, Ye ], 30, u'mt-moon', u'b2f' ],
[ u'hitmonlee', [ R, B, Ye ], 30, u'saffron-city', u'fighting-dojo', u'Fighting Dojo' ],
[ u'hitmonchan', [ R, B, Ye ], 30, u'saffron-city', u'fighting-dojo', u'Fighting Dojo' ],
[ u'eevee', [ R, B, Ye ], 25, u'celadon-city', u'celadon-mansion', u'Celadon Mansion rooftop' ],
[ u'lapras', [ R, B, Ye ], 15, u'saffron-city', u'silph-co-7f', u'Silph Co. 7F' ],
# Gen II
[ u'chikorita', [ 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'spearow', [ G, S, C ], 10, u'goldenrod-city', u'north-gate', u'North Gate' ],
[ u'eevee', [ G, S, C ], 20, u'goldenrod-city', u'bills-house', u"Bill's house" ],
[ u'shuckle', [ G, S, C ], 15, u'cianwood-city', u'manias-house', u"Mania's house" ],
[ u'dratini', [ C ], 15, u'dragons-den' ],
[ u'tyrogue', [ G, S, C ], 10, u'mt-mortar', u'b1f' ],
# Gen III
# Note Lileep + Anorith are not listed because they are not *gifts*
# They're note quite encounters either
# but that's outta scope of gift logic
[ u'treecko', [ 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'castform', [ RU, SA, EM ], 25, u'hoenn-route-119', u'weather-institute', u'Weather Institute' ],
[ u'beldum', [ RU, SA, EM ], 5, u'mossdeep-city', u'stevens-house', u"Steven's house" ],
[ u'chikorita', [ EM ], 5, u'littleroot-town' ],
[ u'cyndaquil', [ EM ], 5, u'littleroot-town' ],
[ u'totodile', [ EM ], 5, u'littleroot-town' ],
[ u'bulbasaur', [ FR, LG ], 5, u'pallet-town' ],
[ u'charmander', [ FR, LG ], 5, u'pallet-town' ],
[ u'squirtle', [ FR, LG ], 5, u'pallet-town' ],
#[ u'aerodactyl', [ FR, LG ], 5, u'pewter-city', u'museum-of-science' ],
[ u'magikarp', [ FR, LG ], 5, u'kanto-route-4', u'pokemon-center' ],
#[ u'omanyte', [ FR, LG ], 5, u'mt-moon', u'b2f' ],
#[ u'kabuto', [ FR, LG ], 5, u'mt-moon', u'b2f' ],
[ u'hitmonlee', [ 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'lapras', [ FR, LG ], 25, u'saffron-city', u'silph-co-7f' ],
# Gen IV
[ u'turtwig', [ DI, PE ], 5, u'lake-verity', u'before-galactic-intervention' ],
[ u'chimchar', [ DI, PE ], 5, u'lake-verity', u'before-galactic-intervention' ],
[ u'piplup', [ DI, PE ], 5, u'lake-verity', u'before-galactic-intervention' ],
[ u'turtwig', [ PT ], 5, u'sinnoh-route-201' ],
[ u'chimchar', [ PT ], 5, u'sinnoh-route-201' ],
[ u'piplup', [ PT ], 5, u'sinnoh-route-201' ],
[ u'eevee', [ DI, PE, ], 5, u'hearthome-city' ],
[ u'eevee', [ PT ], 20, u'hearthome-city' ],
[ u'porygon', [ PT ], 25, u'veilstone-city' ],
[ u'chikorita', [ 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'spearow', [ HG, SS ], 20, u'goldenrod-city', u'north-gate' ],
[ u'eevee', [ HG, SS ], 5, u'goldenrod-city', u'bills-house' ],
[ u'shuckle', [ HG, SS ], 15, u'cianwood-city', u'kirks-house', u"Kirk's house" ],
[ u'dratini', [ HG, SS ], 15, u'dragons-den' ],
[ u'tyrogue', [ HG, SS ], 10, u'mt-mortar', u'b1f' ],
[ u'bulbasaur', [ HG, SS ], 5, u'pallet-town' ],
[ u'charmander', [ HG, SS ], 5, u'pallet-town' ],
[ u'squirtle', [ HG, SS ], 5, u'pallet-town' ],
[ u'treecko', [ HG, SS ], 5, u'saffron-city', u'silph-co-7f' ],
[ u'torchic', [ HG, SS ], 5, u'saffron-city', u'silph-co-7f' ],
[ u'mudkip' , [ HG, SS ], 5, u'saffron-city', u'silph-co-7f' ],
# Gen V
[ u'snivy', [ BL, WH ], 5, u'nuvema-town' ],
[ u'tepig', [ BL, WH ], 5, u'nuvema-town' ],
[ u'oshawott', [ BL, WH ], 5, u'nuvema-town' ],
[ u'pansage', [ BL, WH ], 10, u'dreamyard' ], # not the basement
[ u'pansear', [ BL, WH ], 10, u'dreamyard' ],
[ u'panpour', [ BL, WH ], 10, u'dreamyard' ],
[ u'zorua', [ BL, WH ], 10, u'castelia-city', u'game-freak-hq-1f', u'Game Freak HQ 1F' ],
#[ u'tirtouga', [ BL, WH ], 25, u'relic-castle', u'a' ],
#[ u'archen', [ BL, WH ], 25, u'relic-castle', u'a' ],
#[ u'omanyte', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'kabuto', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'aerodactyl', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'lileep', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'anorith', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'cranidos', [ BL, WH ], 25, u'twist-mountain' ],
#[ u'shieldon', [ BL, WH ], 25, u'twist-mountain' ],
[ u'magikarp', [ BL, WH ], 5, u'marvelous-bridge' ],
[ u'snivy', [ B2, W2 ], 5, u'aspertia-city' ],
[ u'tepig', [ B2, W2 ], 5, u'aspertia-city' ],
[ u'oshawott', [ B2, W2 ], 5, u'aspertia-city' ],
[ u'zorua', [ B2, W2 ], 25, u'driftveil-city' ],
[ u'deerling', [ B2, W2 ], 30, u'unova-route-6', u'weather-institute', u'Weather Institute' ],
[ u'eevee', [ B2, W2 ], 10, u'castelia-city' ],
#[ u'omanyte', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'kabuto', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'aerodactyl', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'lileep', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'anorith', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'cranidos', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'shieldon', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'tirtouga', [ B2, W2 ], 25, u'join-avenue' ],
#[ u'archen', [ B2, W2 ], 25, u'join-avenue' ],
[ u'magikarp', [ B2, W2 ], 5, u'marvelous-bridge' ],
#[ u'tirtouga', [ B2, W2 ], 25, u'nacrene-city', u'museum', u'Nacrene City Museum' ],
#[ u'archen', [ B2, W2 ], 25, u'nacrene-city', u'museum'],
#[ u'omanyte', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'kabuto', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'aerodactyl', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'lileep', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'anorith', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'cranidos', [ B2, W2 ], 25, u'twist-mountain' ],
#[ u'shieldon', [ B2, W2 ], 25, u'twist-mountain' ],
# These are shiny...
[ u'dratini', [ W2 ], 1, u'floccesy-town' ],
[ u'gible', [ B2 ], 1, u'floccesy-town' ],
# Gen VI
[ u'chespin', [ X, Y ], 5, u'aquacorde-town' ],
[ u'fennekin', [ X, Y ], 5, u'aquacorde-town' ],
[ u'froakie', [ X, Y ], 5, u'aquacorde-town' ],
[ u'bulbasaur', [ X, Y ], 10, u'lumiose-city' ],
[ u'charmander', [ X, Y ], 10, u'lumiose-city' ],
[ u'squirtle', [ X, Y ], 10, u'lumiose-city' ],
[ u'tyrunt', [ X, Y ], 20, u'glittering-cave', u'unknown-area-303' ], # 304 means ceiling
[ u'amaura', [ X, Y ], 20, u'glittering-cave', u'unknown-area-303' ],
[ u'lucario', [ X, Y ], 32, u'tower-of-mastery' ],
[ u'lapras', [ X, Y ], 30, u'kalos-route-12' ],
[ u'treecko', [ 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' ],
# cosplay pikachu is given to you the first time you participate in a contest
[ u'pikachu', [ OR, AS ], 20, u'slateport-city', u'contest-hall', u"Contest Hall" ],
[ u'pikachu', [ OR, AS ], 20, u'verdanturf-town', u'contest-hall', u"Contest Hall" ],
[ u'pikachu', [ OR, AS ], 20, u'fallarbor-town', u'contest-hall', u"Contest Hall" ],
[ u'pikachu', [ OR, AS ], 20, u'lilycove-city', u'contest-hall', u"Contest Hall" ],
[ u'latios', [ OR ], 30, u'southern-island' ], # eon tickets ignored here - they're not gifts?
[ u'latias', [ AS ], 30, u'southern-island' ],
[ u'castform', [ OR, AS ], 30, u'hoenn-route-119', u'weather-institute' ],
[ u'chikorita', [ 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'snivy', [ 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'beldum', [ OR, AS ], 1, u'mossdeep-city', u'stevens-house' ],
[ u'turtwig', [ OR, AS ], 5, u'hoenn-route-101' ],
[ u'chimchar', [ OR, AS ], 5, u'hoenn-route-101' ],
[ u'piplup', [ OR, AS ], 5, u'hoenn-route-101' ],
[ u'camerupt', [ 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' ],
[ u'wynaut', [ RU, SA, EM ], 5, u'lavaridge-town' ],
[ u'togepi', [ FR, LG ], 5, u'water-labyrinth' ],
[ u'togepi', [ DI, PE, PT ], 1, u'eterna-city', u'west-gate', u'West Gate' ],
[ u'happiny', [ DI, PE, ], 1, u'hearthome-city', u'west-gate', u'West Gate' ],
[ u'riolu', [ DI, PE, PT ], 1, u'iron-island', u'b2f-left' ],
[ u'togepi', [ HG, SS ], 1, u'violet-city', u'poke-mart', u'Poke Mart' ],
[ u'mareep', [ HG, SS ], 1, u'violet-city', u'pokemon-center', u'Pokemon Center' ],
[ u'wooper', [ HG, SS ], 1, u'violet-city', u'pokemon-center' ],
[ u'slugma', [ HG, SS ], 1, u'violet-city', u'pokemon-center' ],
[ u'larvesta', [ BL, WH ], 1, u'unova-route-18' ],
[ u'happiny', [ B2, W2 ], 1, u'nacrene-city', u'west-gate', u'West Gate' ],
[ 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):
en = session.query(Language).filter_by(identifier=u'en').one()
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
if len(gift_datum) > 4:
area_name = identifier_from_name(gift_datum[4])
pokemon = session.query(Pokemon ).filter_by(identifier=pokemon_name ).one()
location = session.query(Location ).filter_by(identifier=location_name ).one()
location_area = session.query(LocationArea).filter_by(identifier=area_name, location_id=location.id).first()
# Some of these don't exist yet
if not location_area:
location_area = LocationArea(
location_id = location.id,
game_index = 0, # cause who knows what this means
identifier = area_name
)
area_prose = None
if area_name != None:
area_prose = gift_datum[5]
location_area.name_map[en] = area_prose
session.add(location_area)
session.commit()
for version in versions:
encounter_slot = session.query(EncounterSlot).filter_by(
version_group_id = version.version_group_id,
encounter_method_id = gift_method.id
).first()
if not encounter_slot:
encounter_slot = EncounterSlot(
version_group_id = version.version_group_id,
encounter_method_id = gift_method.id,
# No priority over or under other events/conditions
slot = None,
# Rarity is meaningless for gifts, but say that it's
# 100% to help out code that expects rarity to be defined.
rarity = 100,
)
session.add(encounter_slot)
session.commit()
encounter_info = {
'version_id': version.id,
'location_area_id': location_area.id,
'encounter_slot_id': encounter_slot.id,
'pokemon_id': pokemon.id,
'min_level': level,
'max_level': level
}
encounter = session.query(Encounter).filter_by(**encounter_info).first()
if not encounter:
encounter = Encounter(**encounter_info)
session.add(encounter)
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())