Skip to content

Commit

Permalink
play: add some pokemon
Browse files Browse the repository at this point in the history
  • Loading branch information
Naramsim committed Aug 1, 2020
1 parent 4704431 commit 047575f
Show file tree
Hide file tree
Showing 9 changed files with 944 additions and 829 deletions.
28 changes: 14 additions & 14 deletions data/v2/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,21 +1264,21 @@ def csv_record_to_objects(info):
yield PokemonSpecies(
id=int(info[0]),
name=info[1],
generation_id=int(info[2]),
generation_id=int(info[2]) if info[2] != "" else None,
evolves_from_species=None,
evolution_chain_id=int(info[4]),
pokemon_color_id=int(info[5]),
pokemon_shape_id=int(info[6]),
evolution_chain_id=int(info[4]) if info[4] != "" else None,
pokemon_color_id=int(info[5]) if info[5] != "" else None,
pokemon_shape_id=int(info[6]) if info[6] != "" else None,
pokemon_habitat_id=int(info[7]) if info[7] != "" else None,
gender_rate=int(info[8]),
capture_rate=int(info[9]),
base_happiness=int(info[10]),
is_baby=bool(int(info[11])),
hatch_counter=int(info[12]),
has_gender_differences=bool(int(info[13])),
growth_rate_id=int(info[14]),
forms_switchable=bool(int(info[15])),
order=int(info[16]),
gender_rate=int(info[8]) if info[8] != "" else None,
capture_rate=int(info[9]) if info[9] != "" else None,
base_happiness=int(info[10]) if info[10] != "" else None,
is_baby=bool(int(info[11])) if info[11] != "" else None,
hatch_counter=int(info[12]) if info[12] != "" else None,
has_gender_differences=bool(int(info[13])) if info[13] != "" else None,
growth_rate_id=int(info[14]) if info[14] != "" else None,
forms_switchable=bool(int(info[15])) if info[15] != "" else None,
order=int(info[16]) if info[16] != "" else None,
)

build_generic((PokemonSpecies,), "pokemon_species.csv", csv_record_to_objects)
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def csv_record_to_objects(info):
height=int(info[3]) if info[3] != "" else None,
weight=int(info[4]) if info[4] != "" else None,
base_experience=int(info[5]) if info[5] != "" else None,
order=int(info[6]) if info[6] != "" else None,
order=int(info[6]) if info[6] != "" else -1,
is_default=bool(int(info[7])) if info[7] != "" else None,
)

Expand Down
1 change: 1 addition & 0 deletions data/v2/csv/generation_names.csv
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ generation_id,local_language_id,name
7,6,Generation VII
7,9,Generation VII
7,11,第七世代
8,9,Generation VIII
1 change: 1 addition & 0 deletions data/v2/csv/generations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ id,main_region_id,identifier
5,5,generation-v
6,6,generation-vi
7,7,generation-vii
8,8,generation-viii
3 changes: 0 additions & 3 deletions data/v2/csv/pokemon.csv
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,6 @@ id,identifier,species_id,height,weight,base_experience,order,is_default
888,zacian,888,28,1100,335,,1
889,zamazenta,889,29,2100,335,,1
890,eternatus,890,200,9500,345,,1
891,kubfu,891,6,120,,,1
892,urshifu,892,19,1050,,,1
893,zarude,893,18,700,,,1
10001,deoxys-attack,386,17,608,270,497,0
10002,deoxys-defense,386,17,608,270,498,0
10003,deoxys-speed,386,17,608,270,499,0
Expand Down
1,697 changes: 889 additions & 808 deletions data/v2/csv/pokemon_species.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/v2/csv/region_names.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ region_id,local_language_id,name
6,8,Kalos
6,9,Kalos
7,9,Alola
8,9,Galar
1 change: 1 addition & 0 deletions data/v2/csv/regions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ id,identifier
5,unova
6,kalos
7,alola
8,galar
33 changes: 33 additions & 0 deletions pokemon_v2/migrations/0007_auto_20200731_1914.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 2.1.11 on 2020-07-31 19:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('pokemon_v2', '0006_auto_20200725_2205'),
]

operations = [
migrations.AlterField(
model_name='pokemonspecies',
name='base_happiness',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='pokemonspecies',
name='capture_rate',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='pokemonspecies',
name='gender_rate',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='pokemonspecies',
name='hatch_counter',
field=models.IntegerField(blank=True, null=True),
),
]
8 changes: 4 additions & 4 deletions pokemon_v2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,15 +1627,15 @@ class PokemonSpecies(
on_delete=models.CASCADE,
)

gender_rate = models.IntegerField()
gender_rate = models.IntegerField(blank=True, null=True)

capture_rate = models.IntegerField()
capture_rate = models.IntegerField(blank=True, null=True)

base_happiness = models.IntegerField()
base_happiness = models.IntegerField(blank=True, null=True)

is_baby = models.BooleanField(default=False)

hatch_counter = models.IntegerField()
hatch_counter = models.IntegerField(blank=True, null=True)

has_gender_differences = models.BooleanField(default=False)

Expand Down

0 comments on commit 047575f

Please sign in to comment.