Add special encounters for RBY. Helps #22

This commit is contained in:
Petr Viktorin 2011-09-25 01:17:01 +03:00
parent 8230f71f33
commit fdb8214e7d
7 changed files with 425 additions and 0 deletions

View file

@ -1 +1,56 @@
id,nickname,pokemon_form_id,ability_id,nature_id,item_id,level,gender_id,pokeball_id,personality,is_shiny,is_egg,original_trainer_id
1,,1,,,,5,,,,,0,
2,,2,,,,5,,,,,0,
3,,3,,,,5,,,,,0,
4,,25,,,,5,,,,,0,
5,,1,,,,10,,,,,0,
6,,4,,,,10,,,,,0,
7,,7,,,,10,,,,,0,
8,,107,,,,30,,,,,0,
9,,106,,,,30,,,,,0,
10,,131,,,,15,,,,,0,
11,,133,,,,25,,,,,0,
12,,138,,,,30,,,,,0,
13,,140,,,,30,,,,,0,
14,,142,,,,30,,,,,0,
15,,143,,,,30,,,,,0,
16,,143,,,,30,,,,,0,
17,,144,,,,50,,,,,0,
18,,145,,,,50,,,,,0,
19,,146,,,,50,,,,,0,
20,,150,,,,70,,,,,0,
21,,129,,,,,,,,,0,
22,DUX,83,,,,,,,,,0,1
23,MARC,108,,,,,,,,,0,1
24,MARCEL,122,,,,,,,,,0,1
25,MILES,122,,,,,,,,,0,1
26,LOLA,124,,,,,,,,,0,1
27,SPOT,29,,,,,,,,,0,1
28,TERRY,30,,,,,,,,,0,1
29,SPIKE,47,,,,,,,,,0,1
30,GURIO,51,,,,,,,,,0,1
31,RICKY,67,,,,,,,,,0,1
32,SAILOR,86,,,,,,,,,0,1
33,CEZANNE,87,,,,,,,,,0,1
34,STICKY,89,,,,,,,,,0,1
35,DORIS,101,,,,,,,,,0,1
36,BUFFY,112,,,,,,,,,0,1
37,CRINKLES,114,,,,,,,,,0,1
38,,30,,,,17,,,,,0,
39,,33,,,,17,,,,,0,
40,,35,,,,8,,,,,0,
41,,35,,,,12,,,,,0,
42,,37,,,,18,,,,,0,
43,,40,,,,22,,,,,0,
44,,63,,,,9,,,,,0,
45,,63,,,,6,,,,,0,
46,,63,,,,15,,,,,0,
47,,123,,,,25,,,,,0,
48,,123,,,,30,,,,,0,
49,,127,,,,20,,,,,0,
50,,127,,,,30,,,,,0,
51,,137,,,,26,,,,,0,
52,,137,,,,18,,,,,0,
53,,137,,,,26,,,,,0,
54,,147,,,,18,,,,,0,
55,,147,,,,24,,,,,0,

1 id nickname pokemon_form_id ability_id nature_id item_id level gender_id pokeball_id personality is_shiny is_egg original_trainer_id
2 1 1 5 0
3 2 2 5 0
4 3 3 5 0
5 4 25 5 0
6 5 1 10 0
7 6 4 10 0
8 7 7 10 0
9 8 107 30 0
10 9 106 30 0
11 10 131 15 0
12 11 133 25 0
13 12 138 30 0
14 13 140 30 0
15 14 142 30 0
16 15 143 30 0
17 16 143 30 0
18 17 144 50 0
19 18 145 50 0
20 19 146 50 0
21 20 150 70 0
22 21 129 0
23 22 DUX 83 0 1
24 23 MARC 108 0 1
25 24 MARCEL 122 0 1
26 25 MILES 122 0 1
27 26 LOLA 124 0 1
28 27 SPOT 29 0 1
29 28 TERRY 30 0 1
30 29 SPIKE 47 0 1
31 30 GURIO 51 0 1
32 31 RICKY 67 0 1
33 32 SAILOR 86 0 1
34 33 CEZANNE 87 0 1
35 34 STICKY 89 0 1
36 35 DORIS 101 0 1
37 36 BUFFY 112 0 1
38 37 CRINKLES 114 0 1
39 38 30 17 0
40 39 33 17 0
41 40 35 8 0
42 41 35 12 0
43 42 37 18 0
44 43 40 22 0
45 44 63 9 0
46 45 63 6 0
47 46 63 15 0
48 47 123 25 0
49 48 123 30 0
50 49 127 20 0
51 50 127 30 0
52 51 137 26 0
53 52 137 18 0
54 53 137 26 0
55 54 147 18 0
56 55 147 24 0

View file

@ -1 +1,96 @@
special_encounter_id,version_id
1,1
1,2
2,1
2,2
3,1
3,2
4,3
5,3
6,3
7,3
8,1
8,2
8,3
9,1
9,2
9,3
10,1
10,2
10,3
11,1
11,2
11,3
12,1
12,2
12,3
13,1
13,2
13,3
14,1
14,2
14,3
15,1
15,2
15,3
16,1
16,2
16,3
17,1
17,2
17,3
18,1
18,2
18,3
19,1
19,2
19,3
20,1
20,2
20,3
21,1
21,2
21,3
22,1
22,2
23,1
23,2
24,1
24,2
25,3
26,1
26,2
27,1
27,2
28,1
28,2
29,3
30,3
31,3
32,1
32,2
33,3
34,3
35,1
35,2
36,3
37,1
37,2
38,1
39,2
40,1
41,2
42,3
43,3
44,1
45,2
46,3
47,1
48,3
49,2
50,3
51,1
52,2
53,3
54,1
55,2

1 special_encounter_id version_id
2 1 1
3 1 2
4 2 1
5 2 2
6 3 1
7 3 2
8 4 3
9 5 3
10 6 3
11 7 3
12 8 1
13 8 2
14 8 3
15 9 1
16 9 2
17 9 3
18 10 1
19 10 2
20 10 3
21 11 1
22 11 2
23 11 3
24 12 1
25 12 2
26 12 3
27 13 1
28 13 2
29 13 3
30 14 1
31 14 2
32 14 3
33 15 1
34 15 2
35 15 3
36 16 1
37 16 2
38 16 3
39 17 1
40 17 2
41 17 3
42 18 1
43 18 2
44 18 3
45 19 1
46 19 2
47 19 3
48 20 1
49 20 2
50 20 3
51 21 1
52 21 2
53 21 3
54 22 1
55 22 2
56 23 1
57 23 2
58 24 1
59 24 2
60 25 3
61 26 1
62 26 2
63 27 1
64 27 2
65 28 1
66 28 2
67 29 3
68 30 3
69 31 3
70 32 1
71 32 2
72 33 3
73 34 3
74 35 1
75 35 2
76 36 3
77 37 1
78 37 2
79 38 1
80 39 2
81 40 1
82 41 2
83 42 3
84 43 3
85 44 1
86 45 2
87 46 3
88 47 1
89 48 3
90 49 2
91 50 3
92 51 1
93 52 2
94 53 3
95 54 1
96 55 2

View file

@ -1 +1,56 @@
id,type_id,event_pokemon_id,location_area_id,roam_region_id,cost,traded_species_id,traded_gender_id
1,1,1,554,,,,
2,1,2,554,,,,
3,1,3,554,,,,
4,1,4,554,,,,
5,2,5,281,,,,
6,2,6,552,,,,
7,2,7,557,,,,
8,2,8,576,,,,
9,2,9,576,,,,
10,2,10,576,,,,
11,2,11,283,,,,
12,3,12,279,,,,
13,3,13,279,,,,
14,3,14,279,,,,
15,4,15,276,,,,
16,4,16,309,,,,
17,4,17,577,,,,
18,4,18,330,,,,
19,4,19,318,,,,
20,4,20,325,,,,
21,5,21,298,,,,
22,6,22,557,,,,
23,6,23,311,,,,
24,6,24,530,,,,
25,6,25,530,,,,
26,6,26,281,,,,
27,6,27,299,,,,
28,6,28,305,,,,
29,6,29,311,,,,
30,6,30,305,,,,
31,6,31,299,,,,
32,6,32,279,,,,
33,6,33,279,,,,
34,6,34,279,,,,
35,6,35,279,,,,
36,6,36,279,,,,
37,6,37,279,,,,
38,7,38,283,,,,
39,7,39,283,,,,
40,7,40,283,,,,
41,7,41,283,,,,
42,7,42,283,,,,
43,7,43,283,,,,
44,7,44,283,,,,
45,7,45,283,,,,
46,7,46,283,,,,
47,7,47,283,,,,
48,7,48,283,,,,
49,7,49,283,,,,
50,7,50,283,,,,
51,7,51,283,,,,
52,7,52,283,,,,
53,7,53,283,,,,
54,7,54,283,,,,
55,7,55,283,,,,

1 id type_id event_pokemon_id location_area_id roam_region_id cost traded_species_id traded_gender_id
2 1 1 1 554
3 2 1 2 554
4 3 1 3 554
5 4 1 4 554
6 5 2 5 281
7 6 2 6 552
8 7 2 7 557
9 8 2 8 576
10 9 2 9 576
11 10 2 10 576
12 11 2 11 283
13 12 3 12 279
14 13 3 13 279
15 14 3 14 279
16 15 4 15 276
17 16 4 16 309
18 17 4 17 577
19 18 4 18 330
20 19 4 19 318
21 20 4 20 325
22 21 5 21 298
23 22 6 22 557
24 23 6 23 311
25 24 6 24 530
26 25 6 25 530
27 26 6 26 281
28 27 6 27 299
29 28 6 28 305
30 29 6 29 311
31 30 6 30 305
32 31 6 31 299
33 32 6 32 279
34 33 6 33 279
35 34 6 34 279
36 35 6 35 279
37 36 6 36 279
38 37 6 37 279
39 38 7 38 283
40 39 7 39 283
41 40 7 40 283
42 41 7 41 283
43 42 7 42 283
44 43 7 43 283
45 44 7 44 283
46 45 7 45 283
47 46 7 46 283
48 47 7 47 283
49 48 7 48 283
50 49 7 49 283
51 50 7 50 283
52 51 7 51 283
53 52 7 52 283
54 53 7 53 283
55 54 7 54 283
56 55 7 55 283

View file

@ -1 +1,2 @@
trainer_id,local_language_id,name
1,9,TRAINER

1 trainer_id local_language_id name
2 1 9 TRAINER

View file

@ -1 +1,2 @@
id,number,gender_id
1,,

1 id number gender_id
2 1

View file

@ -0,0 +1,52 @@
For use with load-events-special-encounters.py,Versions: RBY GSC RSE-CoXd-FL DPPt BW,,,,,,,,Stat order is HP/Atk/Def/Spd/SpA/SpD. Gen. I-II genes are Atk/Def/Spd/Sp.,,,,,,,,,Real World
Method,Version,Species/Form,Lv.,Item,Move(s),♂♀,⁂,Egg,Genes,Place,Trade for,Name,OT Name,OT №,Cost,Shadow mvs,Ribbons,Location,Distribution dates,Notes,Wonder Card title,Wonder Card text
starter,RB,"bulbasaur, ivysaur, venusaur",5,,,,,,,pallet-town,,,,,,,,,,choice of 1
starter,Y,pikachu,5,,,,,,,pallet-town,,,,,,,,,,"(Has happiness, unable to evolve, etc)"
gift,Y,bulbasaur,10,,,,,,,cerulean-city,,,,,,,,,,(Pikachu's happiness high)
gift,Y,charmander,10,,,,,,,kanto-route-24
gift,Y,squirtle,10,,,,,,,vermillion-city,,,,,,,,,,(Thunder Badge required)
gift,RBY,"hitmonchan, hitmonlee",30,,,,,,,saffron-city,,,,,,,,,,choice of 1; Fighting Dojo
gift,RBY,lapras,15,,,,,,,saffron-city,,,,,,,,,,Silph Co.
gift,RBY,eevee,25,,,,,,,celadon-city,,,,,,,,,,Celadon Mansion
fossil,RBY,"omanyte, kabuto",30,,,,,,,cinnabar-island,,,,,,,,,,choice of 1; Pokémon Lab; fossil from Mt. Moon
fossil,RBY,aerodactyl,30,,,,,,,cinnabar-island,,,,,,,,,,Pokémon Lab; fossil from behind Pewter Museum (need Cut)
overworld,RBY,snorlax,30,,,,,,,"kanto-route-12, kanto-route-16",,,,,,,,,,Nedd to be awakened by Poké Flute
overworld,RBY,articuno,50,,,,,,,seafoam-islands
overworld,RBY,zapdos,50,,,,,,,power-plant
overworld,RBY,moltres,50,,,,,,,kanto-victory-road-1 2f
overworld,RBY,mewtwo,70,,,,,,,cerulean-cave b1f
purchase,RBY,magikarp,,,,,,,,kanto-route-4,,,,,500
trade,RB,farfetchd,,,,,,,,vermillion-city,spearow,DUX,TRAINER
trade,RB,lickitung,,,,,,,,kanto-route-18,slowbro,MARC,TRAINER
trade,RB,mr-mime,,,,,,,,kanto-route-2,abra,MARCEL,TRAINER
trade,Y,mr-mime,,,,,,,,kanto-route-2,clefairy,MILES,TRAINER
trade,RB,jynx,,,,,,,,cerulean-city,poliwhirl,LOLA,TRAINER
trade,RB,nidoran-f,,,,,,,,kanto-route-5,nidoran-m,SPOT,TRAINER
trade,RB,nidorina,,,,,,,,kanto-route-11,nidorino,TERRY,TRAINER
trade,Y,parasect,,,,,,,,kanto-route-18,tangela,SPIKE,TRAINER
trade,Y,dugtrio,,,,,,,,kanto-route-11,lickitung,GURIO,TRAINER
trade,Y,machoke,,,,,,,,kanto-route-5,cubone,RICKY,TRAINER,,,,,,,(evolves immediately)
trade,RB,seel,,,,,,,,cinnabar-island,ponyta,SAILOR,TRAINER
trade,Y,dewgong,,,,,,,,cinnabar-island,growlithe,CEZANNE,TRAINER
trade,Y,muk,,,,,,,,cinnabar-island,kangaskhan,STICKY,TRAINER
trade,RB,electrode,,,,,,,,cinnabar-island,raichu,DORIS,TRAINER
trade,Y,rhydon,,,,,,,,cinnabar-island,golduck,BUFFY,TRAINER
trade,RB,tangela,,,,,,,,cinnabar-island,venonat,CRINKLES,TRAINER
prize,R,nidorina,17,,,,,,,celadon-city,,,,,1200
prize,B,nidorino,17,,,,,,,celadon-city,,,,,1200
prize,R,clefairy,8,,,,,,,celadon-city,,,,,500
prize,B,clefairy,12,,,,,,,celadon-city,,,,,750
prize,Y,vulpix,18,,,,,,,celadon-city,,,,,1000
prize,Y,wigglytuff,22,,,,,,,celadon-city,,,,,2680
prize,R,abra,9,,,,,,,celadon-city,,,,,180
prize,B,abra,6,,,,,,,celadon-city,,,,,120
prize,Y,abra,15,,,,,,,celadon-city,,,,,230
prize,R,scyther,25,,,,,,,celadon-city,,,,,5500
prize,Y,scyther,30,,,,,,,celadon-city,,,,,6500
prize,B,pinsir,20,,,,,,,celadon-city,,,,,2500
prize,Y,pinsir,30,,,,,,,celadon-city,,,,,6500
prize,R,porygon,26,,,,,,,celadon-city,,,,,9999
prize,B,porygon,18,,,,,,,celadon-city,,,,,4600
prize,Y,porygon,26,,,,,,,celadon-city,,,,,9999
prize,R,dratini,18,,,,,,,celadon-city,,,,,2800
prize,B,dratini,24,,,,,,,celadon-city,,,,,4600
Can't render this file because it has a wrong number of fields in line 2.

View file

@ -0,0 +1,166 @@
# Encoding: UTF-8
"""Load events and special encounters from a CSV file
This is an unmaintained one-shot script, only included in the repo for reference.
Loads the data from an ad-hoc spreadsheet format, because for getting this stuff
together, flat is definitely better than nested.
"""
from __future__ import unicode_literals
import sys
import csv
from sqlalchemy.sql.expression import func
from sqlalchemy.orm import subqueryload
import sqlalchemy.orm.exc
from pokedex.db import connect, tables, util, load
session = connect()
reader = ([c.decode('utf-8') for c in l] for l in csv.reader(open(sys.argv[1])))
reader.next() # discard line 1
column_names = reader.next()
print ','.join(column_names)
english = util.get(session, tables.Language, 'en')
def create_with_autoid(table):
autoid = (session.query(func.max(table.id)).one()[0] or 0) + 1
obj = table()
obj.id = autoid
return obj
# We need location_areas for places that don't have them yet
for location in session.query(tables.Location).options(subqueryload('areas')):
if not location.areas:
print 'Creating default area for', location.identifier
area = create_with_autoid(tables.LocationArea)
area.location = location
session.add(area)
def trainer(name, number):
if name is number is None:
return None
query = session.query(tables.Trainer).join(tables.Trainer.names)
query = query.filter(tables.Trainer.names_table.name == name)
query = query.filter(tables.Trainer.number == number)
try:
return query.one()
except sqlalchemy.orm.exc.NoResultFound:
trainer = create_with_autoid(tables.Trainer)
trainer_name = tables.Trainer.names_table()
trainer_name.local_language = english
trainer_name.foreign_id = trainer.id
trainer_name.name = name
trainer.number = number
session.add(trainer)
session.add(trainer_name)
return trainer
version_codes = (
# 2-letter codes first!
('Xd', 'xd'),
('Co', 'colosseum'),
('Pt', 'platinum'),
('Hg', 'heartgold'),
('Ss', 'soulsilver'),
('R', 'red'),
('B', 'blue'),
('Y', 'yellow'),
('G', 'gold'),
('S', 'silver'),
('C', 'crystal'),
('R', 'ruby'),
('S', 'sapphire'),
('E', 'emerald'),
('F', 'firered'),
('L', 'leafgreen'),
('D', 'diamond'),
('P', 'pearl'),
('B', 'black'),
('W', 'white'),
)
for line in reader:
print ','.join(line)
line_dict = dict(zip(column_names, line + [''] * 100))
all_places = line_dict.pop('Place').split(',')
for p_form_ident in line_dict.pop('Species/Form').split(','):
p_form_ident = p_form_ident.strip()
for place_ident in all_places:
place_ident = place_ident.strip()
dct = dict(line_dict)
encounter_type = util.get(session, tables.SpecialEncounterType, dct.pop('Method'))
species_ident, sp, form_ident = p_form_ident.partition(' ')
species = util.get(session, tables.PokemonSpecies, species_ident)
for pokemon_form in species.forms:
if pokemon_form.form_identifier == (form_ident or None):
break
else:
raise ValueError('No such pkmn form: %s' % p_form_ident)
if place_ident:
location_ident, sp, area_ident = place_ident.partition(' ')
location = util.get(session, tables.Location, location_ident)
for location_area in location.areas:
if location_area.identifier == (area_ident or None):
break
else:
raise ValueError('No such area: %s' % place_ident)
else:
location_area = None
se_pokemon = create_with_autoid(tables.EventPokemon)
se_pokemon.pokemon_form = pokemon_form
se_pokemon.is_egg = bool(dct.pop('Egg'))
se_pokemon.cost = dct.pop('Cost') or None
session.add(se_pokemon)
encounter = create_with_autoid(tables.SpecialEncounter)
encounter.event_pokemon = se_pokemon
encounter.type = encounter_type
encounter.location_area = location_area
se_pokemon.level = dct.pop('Lv.') or None
se_pokemon.nickname = dct.pop('Name') or None
session.add(encounter)
if encounter_type == 'starter':
print
dct.pop('Notes')
versions = dct.pop('Version')
trade_for = dct.pop('Trade for')
if trade_for:
encounter.trade_species = util.get(session,
tables.PokemonSpecies, trade_for)
se_pokemon.original_trainer = trainer(
dct.pop('OT Name') or None, dct.pop('OT №') or None)
for code, version_ident in version_codes:
part1, current_code, part2 = versions.partition(code)
versions = part1 + part2
if current_code:
entry = tables.SpecialEncounterVersion()
entry.encounter = encounter
entry.version = util.get(session, tables.Version, version_ident)
session.add(entry)
assert not versions, 'Leftover versions: %s' % versions
assert not any(dct.values()), 'stuff left over: %s' % ', '.join(
'%s=%s' % (k, v) for k, v in dct.items() if v)
print 'Dumping!'
load.dump(session, verbose=True, tables=[
'special_encounters',
'event_pokemon',
'special_encounter_versions',
'location_areas',
'trainers',
'trainer_names',
])
session.rollback()