Commit graph

1304 commits

Author SHA1 Message Date
Tim Goudriaan
f8e7637e9e Add S/M and US/UM pokedex numbers (#269)
Adds pokedex numbers for the Alola dex and all four island dexes, both original and updated.

Data courtesy of Bulbapedia.

Fixes #217.
2019-07-16 17:52:01 -07:00
Kip Yin
11f972f817 Catch StopIteration explicitly in group_by_object generator (#264)
Python 3.7 changed the behaviour of generators so that a StopIteration exception which bubbles up inside a generator is transformed into a RuntimeException. This means that when calling next() inside a generator, we have to explicitly catch the StopIteration and exit the function instead of relying on it to implicitly stop the generator. Otherwise the program will crash. Sigh.

For more information, see PEP 479.

https://www.python.org/dev/peps/pep-0479/
https://stackoverflow.com/questions/51700960/runtimeerror-generator-raised-stopiteration-every-time-i-try-to-run-app/51701040#51701040
2019-07-15 13:23:37 -07:00
Kip Yin
c63b6522bf Limit construct version to 2.5.3
This project uses `construct` 2.5 and lower, and the latest `construct` version (2.9)
is incompatible with 2.5.

Resolves #265
2019-07-15 13:04:05 -07:00
Andrew Ekstedt
39cecc2f4d Pin markdown version to avoid deprecation warnings
Will fix later. (#257)
2019-07-12 19:40:56 -07:00
Andrew Ekstedt
db824220d0
Merge pull request #238 from jrubinator/record-gift-pokemon
Record gift pokemon
2019-07-12 19:40:29 -07:00
Andrew Ekstedt
b6dfbbcd58 gift-pokemon: rerun script
This removes a few location areas that are no longer needed now that
we've dropped fossil pokemon.
2019-07-12 19:14:59 -07:00
Andrew Ekstedt
8161bd84e4 gift-pokemon: fix Cosplay Pikachu and Sinnoh starter gift locations
Cosplay Pikachu was listed as being encountered in contest-hall, but
that's a Sinnoh location. In OR/AS, the contest halls are not a
first-class location but rather just treated as part of the town or city
they are in. Cosplay Pikachu is given to the player after they
participate in their first contest, so its location can be any of the
four cities with a contest hall.

The Sinnoh starter that the player obtains in OR/AS is on Hoenn Route
101, not Sinnoh Route 201 (probably a copy/paste error).

Add a test to make sure that encounter regions always match the
region(s) that their game takes place in.
2019-07-12 18:48:07 -07:00
Andrew Ekstedt
2fefb9176b Fix documentation for Language.iso639 and iso3166
ISO 639 is the language code and ISO 3166 is the country code, not the
other way around.
2019-07-01 21:33:06 -07:00
Luccas Robert
ef6c588fc6 Add pt-BR to the languages table (#273, #274) 2019-07-01 21:30:33 -07:00
Andrew Ekstedt
53e0fc0085 gift-encounters: fix Yellow gift pokemon
They were being interpreted as being in Y instead.
2018-11-03 17:19:19 -07:00
Seth Taron
18925edcd3 Add Japanese generation names, and fix Gen VII
Add Japanese translations of the generation names, thanks to @SethETaron. I think this marks our first unofficial Japanese translation. 🎉

Also, fix some issues with Gen VII:

* generation names were missing for every language
* the identifier was incorrect — it was sun-moon instead of generation-vii

Fixes #250, #251, and #252.
2018-10-27 21:29:23 -07:00
Andrew Ekstedt
14bcc8f2bf Rerun gift encounters script 2018-10-27 15:19:59 -07:00
Andrew Ekstedt
ada0e9c545 Set rarity for gift encounter slots 2018-10-27 15:19:59 -07:00
Andrew Ekstedt
6fd43b097c Exclude fossil pokemon for now
Fossil pokémon don't fit with the rest of the gift pokemon: rather than
being given a pokémon directly, you get an item which can be exchanged
for a pokémon somewhere else ("revived"). To handle them properly we'd
have to add an item location table. I don't want to figure that out
right now, so just ignore the fossils for now.
2018-10-27 15:19:59 -07:00
Jonathan Rubin
4155bc4459 gift pokemon CSV updates - 3rd time is the charm
use `pokedex dump` to apply CSV changes
2018-10-06 14:38:06 -04:00
Andrew Ekstedt
1d3dd33cbb Sigh, fix Python 3 syntax
Python 3 doesn't allow the ur'' prefix for raw unicode strings.
We want a unicode string here so that we get a unicode regexp,
so drop the r and do the escaping explicitly (the regexp in question
is pretty simple, fortunately).
2018-09-29 11:56:40 -07:00
Andrew Ekstedt
9a8918135f Region-prefix some locations identifiers, and add a test
Unova Routes 19-23 were added in B/W 2 and i forgot to prefix them when
we added the locations. Kalos Victory Road used to have a prefix but it
got dropped when i re-ripped X/Y locations. Kalos Pokemon League gets a
prefix too, since both Sinnoh and Alola also have Pokemon Leagues.

Add a test to ensure that we don't forget again in the future.
2018-09-29 11:35:13 -07:00
Andrew Ekstedt
59fd27c574 Require location identifiers to be unique.
Also require location area identifiers to be unique to their location.

I almost added a duplicate pokemon-league location when adding S/M
locations. This should help.
2018-09-29 10:53:18 -07:00
Andrew Ekstedt
e6b64b8c5a Relax test for nullability of translation columns
The previous commit added a nullable subtitle field to location_names.
This caused a test in test_schema.py to fail because the name field
wasn't also nullable.

A comment above the test says, "If there's more than one text column in a
translation table they have to be nullable, to support missing
translations", but i don't think that logic holds in this case.

The idea is that we might have a translation for the subtitle, but not
the name, or vice versa, so both need to be nullable in case one or the
other is missing. But in this particular case that doesn't make sense:
if you don't have a name, you don't have a location; it may or may not
have a subtitle, but a location will always have a name.

Therefore, add an exception to the test.
2018-09-29 10:12:10 -07:00
Jonathan Rubin
10db4d9d23 gift-pokemon: Rerun with changes
Using the following steps:
* Unroll the previous commit with bulk CSV changes (b7500e92f0)
* remove and re-initialize the database
* follow the steps in that commit
* Only select location_area_prose in English
    (there's a bunch of czech translations tracked separately in pokedex/data/csv/translations/cs.csv)
2018-09-22 21:45:34 -04:00
Jonathan Rubin
305d4f5d0e gift-pokemon: Quoting on location_area_prose
This change implies no functionality, but it was easiest to just
make it - sqlite insists on quoting spaces, though it's not needed.

Not rolling it back, since theoretically someone could run into the
same thing again in the future.
2018-09-22 21:38:39 -04:00
Jonathan Rubin
203b903999 gift-pokemon: Add encounter_method_prose 2018-09-22 13:27:39 -04:00
Jonathan Rubin
5e8ec47256 gift-pokemon: Add new location_area_prose entries 2018-09-22 13:20:51 -04:00
Jonathan Rubin
618aa0064b 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)
2018-09-19 13:58:25 -04:00
Jonathan Rubin
b7500e92f0 gift-pokemon: CSV file updates
From sqlite:
.headers on
.mode csv
.output $filename
select * from $table
Then remove all the dumb carriage returns in vim
2018-09-19 13:58:25 -04:00
Jonathan Rubin
8694c8464a gift-pokemon: Document empty encounter_slots
I'm going to record gift-pokemon as having no encounter slot, which I
believe is correct by-and-large (since you always get the same mon).

There are a few randomized gift pokemon which do have some type
of encounter slot (eg. Crystal's Odd Egg). Those aren't tracked (yet).
2018-09-19 13:58:25 -04:00
Jonathan Rubin
61dfeed80f gift-pokemon: Gen VI 2018-09-19 13:58:25 -04:00
Jonathan Rubin
1846fec958 gift-pokemon: Generation V 2018-09-19 13:58:07 -04:00
Jonathan Rubin
7dcd72801c gift-pokemon: Generation IV 2018-09-19 13:58:07 -04:00
Jonathan Rubin
17c71e6240 gift-pokemon: Gen III
Both the new and the reboots
2018-09-19 13:58:07 -04:00
Jonathan Rubin
0f10d9a88a gift-pokemon: Gold, Silver, Crystal 2018-09-19 13:58:07 -04:00
Jonathan Rubin
d84c24fe6b gift-pokemon: Record red/blue/yellow pkmn 2018-09-19 13:58:07 -04:00
Jonathan Rubin
731cd771d4 gift-pokemon: Add gift encounter method 2018-09-19 13:58:07 -04:00
Andrew Ekstedt
083e43bb93 Add S/M locations
This commit adds Sun & Moon location names from the text dump, for all
official languages: the usual ja, en, fr, it, de, es, ko, and now
zh-Hans (simplified Chinese) and zh-Hant (traditional Chinese).

Fixes #230
Updates #198
2018-09-15 20:01:08 -07:00
Andrew Ekstedt
6d4d129c84 Add subtitle field to Location
Starting in Gen VI, locations have been able to have an optional
subtitle. In-game, the subtitle is displayed on a second line under the
main name.

In X/Y this is used to give some locations an alternate,
flavorful name; for example, Kalos Route 2 is also known as Avance
Trail. In S/M this is mainly used to divide some large locations like
Hau'oli City into separate sections: e.g., the Beachfront, the Shopping
District, and the Marina.

This commit just adds the column; there are no data changes.

I suppose we'll need to go back and re-rip X/Y location names now.
2018-09-15 20:01:08 -07:00
Andrew Ekstedt
f2d03da177 Add OR/AS locations
This commit adds OR/AS location names from the text dump, for all
official languages (ja, en, fr, it, de, ko).

It also updates the names of any pre-existing locations from R/S/E to
use the names from OR/AS. Mostly this only affects the French
translations, which i think were added manually.

"Inside of Truck" was renamed to "???" in all languages, which is dumb,
but whatever.

"Team Magma Hideout" is in fact a different location from the
already-existing "Magma Hideout" - Magma Hideout was from Emerald and
resided in Jagged Pass, while Team Aqua Hideout and Team Magma Hideout
are located outside Lilycove City.

Kalos locations are untouched. I assume they didn't change, but didn't
verify this.

Updates #141
2018-09-15 14:56:53 -07:00
thechief389
f413bf82f0 Fix error when no arguments are specified (#240)
Also, introduce a metavar for the command subparser, since it's currently a bit verbose.
2018-08-22 23:34:27 -07:00
skylar
d17a772b4f Resolve some Python 3 encoding issues on Windows (#244)
When you open a file in Python 3, it defaults to using the system charset to encode the file, which is typically UTF-8 on linux systems (good) but Windows-1251 on Windows (bad).

We need to add explicit encoding=utf-8 arguments to open() calls when we open CSV files for reading or writing. To complicate matters, the csv module works only with byte strings in Python 2, and only with unicode strings in Python 3, so we can't just blindly use `io.open` everywhere.
2018-08-22 23:01:58 -07:00
Andrew Ekstedt
51af10b995 Travis CI: test pokedex dump 2018-08-22 21:47:32 -07:00
Andrew Ekstedt
ffb0638ef5 Unbreak SaveFilePokemon slightly
The schema has changed a little in the past, uh, seven years.

Works well enough to parse and display one of my pokemon in the gts
plugin.

Updates veekun/spline-pokedex#72
2018-06-26 23:53:59 -07:00
Dan Keenan
57915f656b Fix TMs 93-100 refer to the wrong item in OR/AS
Fixes #206
2018-04-24 23:02:17 -07:00
Andrew Ekstedt
0c61702213 pass an explicit bind to table.create()
This isn't really necessary, since pokedex.db.connect sets
metadata.bind, but it's better to be explicit.
2018-03-30 15:07:10 -07:00
Andrew Ekstedt
417bd1afa2 fix pypy build
PyPy (>= 3.6) was consistently erroring out during `pokedex load`,
with the error

    OperationalError: (_sqlite3.OperationalError) cannot commit transaction - SQL statements in progress (Background on this error at: http://sqlalche.me/e/e3q8)

It turns out PyPy was not garbage collecting something, causing a
database cursor to be left open. See the giant comment block for
details.
2018-03-30 15:06:34 -07:00
Andrew Ekstedt
56cf0fd29d Squash a bunch of "non-unicode bind param" warnings 2018-03-30 12:14:55 -07:00
Andrew Ekstedt
e1bbe78b72 fix test suite under SQLAlchemy 1.2.x
* SQLAlchemy 1.0 introduced "baked queries" - a way to construct Query
 objects so that they can be cached and reused.

 * SQLAlchemy 1.2 changed lazyloaded columns to use baked queries under the
 hood.

 * Our MultilangQuery class attempts to set _default_language_id right
 before the query is executed by overriding the __iter__ method.

 * Baked queries bypass the __iter__ method and call a lower-level
 method, _execute_and_instances, directly.

 * This caused problems where _default_language_id wouldn't get set
 correctly on lazyloaded columns.

 * To fix, make MultilangQuery override the _execute_and_instances
 method instead of __iter__.

 * This is really just a stopgap: the root cause is that query params
 are not preserved across lazyloads.

Tested with SQLAlchemy 0.9.7, 1.1.18, and 1.2.5.

Updates #236.
2018-03-30 12:01:21 -07:00
Eevee (Lexy Munroe)
5f15698876 Update README now that Sun and Moon are, ah, done-ish 2017-11-27 10:44:48 -08:00
Eevee (Lexy Munroe)
a6b7b426c2 Remove some extraneous form names that broke lookup 2017-11-27 09:58:23 -08:00
Eevee (Lexy Munroe)
74e22520db Update Pokémon order 2017-11-25 14:11:46 -08:00
Eevee (Lexy Munroe)
1c982d748f Fix crash when looking up Salazzle 2017-11-25 14:07:25 -08:00
Eevee (Lexy Munroe)
591be9ab8b Populate pokemon_form_generations for USUM 2017-11-25 13:28:36 -08:00