Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions data/v2/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,16 +1002,16 @@ def csv_record_to_objects(info):
item = Item.objects.get(pk=int(info[1]))
yield Berry(
id=int(info[0]),
item_id=int(info[1]),
name=item.name[: item.name.index("-")],
berry_firmness_id=int(info[2]),
natural_gift_power=int(info[3]),
natural_gift_type_id=int(info[4]),
size=int(info[5]),
max_harvest=int(info[6]),
growth_time=int(info[7]),
soil_dryness=int(info[8]),
smoothness=int(info[9]),
item_id=int(info[1]) if info[1] and info[1].strip() else None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also here not allow null values. A berry should alwasy be linked with an item.

I don't want line such as

68,,,,,,,,,

to be possible to appear.

name=item.name[: item.name.index("-")] if "-" in item.name else item.name,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible I'd also strenghten the logic here, splitting on - is a bit weak. Better to be explicit and, if present, remove the whole -berry part.

berry_firmness_id=int(info[2]) if info[2] and info[2].strip() else None,
natural_gift_power=int(info[3]) if info[3] and info[3].strip() else None,
natural_gift_type_id=int(info[4]) if info[4] and info[4].strip() else None,
size=int(info[5]) if info[5] and info[5].strip() else None,
max_harvest=int(info[6]) if info[6] and info[6].strip() else None,
growth_time=int(info[7]) if info[7] and info[7].strip() else None,
soil_dryness=int(info[8]) if info[8] and info[8].strip() else None,
smoothness=int(info[9]) if info[9] and info[9].strip() else None,
)

build_generic((Berry,), "berries.csv", csv_record_to_objects)
Expand Down
4 changes: 4 additions & 0 deletions data/v2/csv/berries.csv
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ id,item_id,firmness_id,natural_gift_power,natural_gift_type_id,size,max_harvest,
62,187,5,80,8,267,5,24,7,60
63,188,2,80,16,33,5,24,7,60
64,189,1,80,17,52,5,24,7,60
65,724,,100,18,,8,72,,
66,725,,100,17,,8,72,,
67,2233,,17,,,,,,
68,2234,,,,,,,,
4 changes: 3 additions & 1 deletion data/v2/csv/items.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2174,4 +2174,6 @@ id,identifier,category_id,cost,fling_power,fling_effect_id
2229,laorigin-ball,34,0,,
2230,black-augurite,10,0,,
2231,peat-block,10,0,,
2232,metal-alloy,10,0,,
2232,metal-alloy,10,0,,
2233,hopo-berry,28,300,,
2234,roseli-berry,7,200,10,
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 5.2.10 on 2026-06-25 15:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("pokemon_v2", "0028_pokemonevolution_evolved_form_and_more"),
]

operations = [
migrations.AlterField(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need these? Can they not just be values like 0? (Note: berries are a weak domain of my pokemon knowledge)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Sword and Shield, the concept of crop cultivation has been removed, null values from my point of view seems more appropriate because if we use 0 it would say 'this berry has a natural gift of 0' for example. But this concept doesn't exist in SW, SV and after.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, better to allow null fileds in this case.

model_name="berry",
name="growth_time",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="berry",
name="max_harvest",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="berry",
name="natural_gift_power",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="berry",
name="size",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="berry",
name="smoothness",
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="berry",
name="soil_dryness",
field=models.IntegerField(blank=True, null=True),
),
]
Loading