From 6e2f7af7b27dff00d3ed62a42407db57ab46696e Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Mon, 26 Mar 2012 22:36:05 -0700 Subject: [PATCH 1/2] Add Pal Park data. --- pokedex/data/csv/pal_park.csv | 494 ++++++++++++++++++++++++++++++++++ pokedex/db/tables.py | 20 ++ scripts/palpark.py | 67 +++++ 3 files changed, 581 insertions(+) create mode 100644 pokedex/data/csv/pal_park.csv create mode 100755 scripts/palpark.py diff --git a/pokedex/data/csv/pal_park.csv b/pokedex/data/csv/pal_park.csv new file mode 100644 index 0000000..b3965c0 --- /dev/null +++ b/pokedex/data/csv/pal_park.csv @@ -0,0 +1,494 @@ +species_id,area,base_score,rate +1,field,50,30 +2,field,80,10 +3,field,90,3 +4,field,50,30 +5,field,80,10 +6,field,90,3 +7,pond,50,30 +8,pond,80,10 +9,pond,90,3 +10,forest,30,50 +11,forest,50,30 +12,forest,70,20 +13,forest,30,50 +14,forest,50,30 +15,forest,70,20 +16,field,30,50 +17,field,50,30 +18,field,70,20 +19,field,30,50 +20,field,50,30 +21,field,30,50 +22,field,50,30 +23,forest,30,50 +24,forest,50,30 +25,forest,80,10 +26,forest,90,3 +27,mountain,50,30 +28,mountain,70,20 +29,field,30,50 +30,field,50,30 +31,field,70,20 +32,field,30,50 +33,field,50,30 +34,field,70,20 +35,mountain,80,10 +36,mountain,90,3 +37,field,70,20 +38,field,80,10 +39,field,80,10 +40,field,90,3 +41,mountain,30,50 +42,mountain,50,30 +43,forest,30,50 +44,forest,50,30 +45,forest,70,20 +46,forest,30,50 +47,forest,50,30 +48,forest,30,50 +49,forest,50,30 +50,mountain,30,50 +51,mountain,50,30 +52,field,50,30 +53,field,70,20 +54,pond,50,30 +55,pond,70,20 +56,mountain,50,30 +57,mountain,70,20 +58,field,70,20 +59,field,80,10 +60,pond,50,30 +61,pond,80,10 +62,pond,90,3 +63,field,50,30 +64,field,80,10 +65,field,90,3 +66,mountain,50,30 +67,mountain,80,10 +68,mountain,90,3 +69,forest,30,50 +70,forest,50,30 +71,forest,70,20 +72,sea,30,50 +73,sea,50,30 +74,mountain,30,50 +75,mountain,50,30 +76,mountain,70,20 +77,field,50,30 +78,field,70,20 +79,pond,50,30 +80,pond,70,20 +81,mountain,50,30 +82,mountain,70,20 +83,field,70,20 +84,field,50,30 +85,field,70,20 +86,sea,50,30 +87,sea,70,20 +88,field,50,30 +89,field,70,20 +90,sea,50,30 +91,sea,70,20 +92,forest,50,30 +93,forest,80,10 +94,forest,90,3 +95,mountain,80,10 +96,forest,50,30 +97,forest,70,20 +98,sea,50,30 +99,sea,70,20 +100,field,50,30 +101,field,70,20 +102,forest,50,30 +103,forest,70,20 +104,mountain,50,30 +105,mountain,70,20 +106,mountain,80,10 +107,mountain,80,10 +108,field,70,20 +109,mountain,50,30 +110,mountain,70,20 +111,mountain,50,30 +112,mountain,70,20 +113,field,90,3 +114,forest,50,30 +115,field,70,20 +116,sea,50,30 +117,sea,70,20 +118,pond,50,30 +119,pond,70,20 +120,sea,50,30 +121,sea,70,20 +122,field,70,20 +123,field,70,20 +124,field,70,20 +125,mountain,70,20 +126,mountain,70,20 +127,forest,70,20 +128,field,70,20 +129,pond,30,50 +130,pond,90,3 +131,sea,90,3 +132,field,70,20 +133,field,90,3 +134,field,90,3 +135,field,90,3 +136,field,90,3 +137,field,80,10 +138,sea,50,30 +139,sea,70,20 +140,sea,50,30 +141,sea,70,20 +142,mountain,70,20 +143,field,80,10 +144,mountain,90,3 +145,mountain,90,3 +146,mountain,90,3 +147,pond,70,20 +148,pond,80,10 +149,mountain,90,3 +150,field,90,3 +151,forest,100,1 +152,field,50,30 +153,field,80,10 +154,field,90,3 +155,field,50,30 +156,field,80,10 +157,field,90,3 +158,pond,50,30 +159,pond,80,10 +160,mountain,90,3 +161,field,30,50 +162,field,50,30 +163,forest,30,50 +164,forest,50,30 +165,field,30,50 +166,field,50,30 +167,field,30,50 +168,field,50,30 +169,mountain,90,3 +170,sea,50,30 +171,sea,70,20 +172,field,80,10 +173,field,80,10 +174,field,80,10 +175,field,80,10 +176,field,90,3 +177,forest,50,30 +178,forest,70,20 +179,field,50,30 +180,field,70,20 +181,field,80,10 +182,forest,80,10 +183,pond,50,30 +184,pond,70,20 +185,mountain,70,20 +186,pond,80,10 +187,field,50,30 +188,field,70,20 +189,field,80,10 +190,forest,70,20 +191,field,50,30 +192,field,70,20 +193,field,80,10 +194,pond,50,30 +195,pond,70,20 +196,field,90,3 +197,field,90,3 +198,forest,70,20 +199,pond,80,10 +200,forest,70,20 +201,forest,70,20 +202,field,80,10 +203,field,70,20 +204,forest,50,30 +205,forest,70,20 +206,forest,90,3 +207,mountain,50,30 +208,mountain,90,3 +209,field,50,30 +210,field,70,20 +211,sea,80,10 +212,field,90,3 +213,sea,80,10 +214,forest,80,10 +215,mountain,50,30 +216,forest,50,30 +217,forest,70,20 +218,mountain,50,30 +219,mountain,70,20 +220,mountain,50,30 +221,mountain,70,20 +222,sea,70,20 +223,sea,50,30 +224,sea,70,20 +225,mountain,70,20 +226,sea,70,20 +227,mountain,70,20 +228,mountain,50,30 +229,mountain,70,20 +230,sea,80,10 +231,mountain,50,30 +232,mountain,70,20 +233,field,80,10 +234,field,50,30 +235,field,80,10 +236,mountain,80,10 +237,mountain,80,10 +238,field,80,10 +239,mountain,80,10 +240,mountain,80,10 +241,field,70,20 +242,field,90,3 +243,mountain,90,3 +244,mountain,90,3 +245,mountain,90,3 +246,mountain,70,20 +247,mountain,80,10 +248,mountain,90,3 +249,mountain,90,3 +250,mountain,90,3 +251,forest,100,1 +252,forest,50,30 +253,forest,80,10 +254,forest,90,3 +255,field,50,30 +256,field,80,10 +257,field,90,3 +258,pond,50,30 +259,pond,80,10 +260,pond,90,3 +261,field,30,50 +262,field,50,30 +263,field,30,50 +264,field,50,30 +265,forest,30,50 +266,forest,50,30 +267,forest,70,20 +268,forest,50,30 +269,forest,70,20 +270,pond,30,50 +271,pond,50,30 +272,pond,80,10 +273,forest,30,50 +274,forest,50,30 +275,forest,80,10 +276,field,30,50 +277,field,50,30 +278,sea,30,50 +279,sea,50,30 +280,field,50,30 +281,field,70,20 +282,field,80,10 +283,pond,50,30 +284,pond,70,20 +285,forest,50,30 +286,forest,70,20 +287,forest,50,30 +288,forest,70,20 +289,forest,80,10 +290,forest,50,30 +291,forest,70,20 +292,forest,80,10 +293,mountain,50,30 +294,mountain,70,20 +295,mountain,80,10 +296,mountain,50,30 +297,mountain,70,20 +298,pond,80,10 +299,mountain,70,20 +300,field,50,30 +301,field,70,20 +302,mountain,70,20 +303,mountain,70,20 +304,mountain,50,30 +305,mountain,70,20 +306,mountain,80,10 +307,mountain,50,30 +308,mountain,70,20 +309,field,50,30 +310,field,70,20 +311,field,90,3 +312,field,90,3 +313,mountain,70,20 +314,mountain,70,20 +315,field,70,20 +316,forest,50,30 +317,forest,70,20 +318,sea,50,30 +319,sea,70,20 +320,sea,50,30 +321,sea,80,10 +322,mountain,50,30 +323,mountain,70,20 +324,mountain,70,20 +325,field,50,30 +326,field,70,20 +327,field,50,30 +328,mountain,50,30 +329,mountain,70,20 +330,mountain,80,10 +331,mountain,50,30 +332,mountain,70,20 +333,field,50,30 +334,field,80,10 +335,field,70,20 +336,forest,70,20 +337,mountain,70,20 +338,mountain,70,20 +339,pond,50,30 +340,pond,70,20 +341,pond,50,30 +342,pond,70,20 +343,mountain,50,30 +344,mountain,70,20 +345,sea,70,20 +346,sea,80,10 +347,sea,70,20 +348,sea,80,10 +349,sea,70,20 +350,sea,90,3 +351,field,80,10 +352,forest,70,20 +353,forest,50,30 +354,forest,70,20 +355,forest,50,30 +356,forest,70,20 +357,forest,70,20 +358,mountain,80,10 +359,mountain,80,10 +360,field,80,10 +361,mountain,50,30 +362,mountain,70,20 +363,sea,50,30 +364,sea,70,20 +365,sea,80,10 +366,sea,50,30 +367,sea,80,10 +368,sea,80,10 +369,sea,80,10 +370,sea,50,30 +371,mountain,50,30 +372,mountain,70,20 +373,mountain,80,10 +374,mountain,70,20 +375,mountain,80,10 +376,mountain,90,3 +377,mountain,90,3 +378,mountain,90,3 +379,mountain,90,3 +380,field,90,3 +381,field,90,3 +382,sea,90,3 +383,mountain,90,3 +384,field,90,3 +385,mountain,100,1 +386,mountain,100,1 +387,forest,50,30 +388,forest,80,10 +389,forest,90,3 +390,field,50,30 +391,field,80,10 +392,field,90,3 +393,pond,50,30 +394,pond,80,10 +395,pond,90,3 +396,field,30,50 +397,field,50,30 +398,field,70,20 +399,field,30,50 +400,field,50,30 +401,forest,50,30 +402,forest,70,20 +403,field,50,30 +404,field,70,20 +405,field,80,10 +406,field,80,10 +407,field,80,10 +408,mountain,70,20 +409,mountain,80,10 +410,mountain,70,20 +411,mountain,80,10 +412,forest,50,30 +413,forest,70,20 +414,forest,70,20 +415,forest,50,30 +416,forest,70,20 +417,forest,50,30 +418,forest,70,20 +419,mountain,70,20 +420,mountain,80,10 +421,field,90,3 +422,sea,50,30 +423,sea,70,20 +424,pond,50,30 +425,pond,70,20 +426,forest,80,10 +427,field,50,30 +428,field,70,20 +429,forest,80,10 +430,forest,80,10 +431,field,50,30 +432,field,70,20 +433,field,70,20 +434,mountain,80,10 +435,mountain,50,30 +436,mountain,70,20 +437,mountain,80,10 +438,field,90,3 +439,field,90,3 +440,field,50,30 +441,field,70,20 +442,field,80,10 +443,mountain,50,30 +444,mountain,70,20 +445,pond,50,30 +446,pond,70,20 +447,field,70,20 +448,field,50,30 +449,field,70,20 +450,sea,80,10 +451,sea,50,30 +452,sea,70,20 +453,forest,90,3 +454,mountain,50,30 +455,mountain,70,20 +456,mountain,80,10 +457,mountain,90,3 +458,mountain,90,3 +459,mountain,50,30 +460,mountain,70,20 +461,mountain,80,10 +462,mountain,80,10 +463,field,80,10 +464,mountain,80,10 +465,forest,80,10 +466,mountain,80,10 +467,mountain,80,10 +468,field,80,10 +469,field,80,10 +470,field,90,3 +471,field,90,3 +472,mountain,80,10 +473,mountain,80,10 +474,field,80,10 +475,field,80,10 +476,mountain,80,10 +477,forest,80,10 +478,mountain,80,10 +479,field,90,3 +480,field,90,3 +481,field,90,3 +482,field,90,3 +483,mountain,90,3 +484,mountain,90,3 +485,mountain,90,3 +486,mountain,90,3 +487,mountain,90,3 +488,forest,90,3 +489,sea,90,3 +490,sea,100,1 +491,mountain,100,1 +492,field,100,1 +493,mountain,100,1 diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 0e8ca3f..417ce7e 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -1020,6 +1020,23 @@ class NaturePokeathlonStat(TableBase): max_change = Column(Integer, nullable=False, info=dict(description="Maximum change")) +class PalPark(TableBase): + u"""Pal Park encounter info + """ + + __tablename__ = 'pal_park' + __singlename__ = 'pal_park' + + species_id = Column(Integer, ForeignKey('pokemon_species.id'), primary_key=True, + info=dict(description="ID of the Pokémon species this data pertains to")) + + area = Column(Enum('forest', 'field', 'mountain', 'pond', 'sea', name='pal_park_areas'), nullable=False, + info=dict(description="The area in which this Pokémon can be found")) + base_score = Column(Integer, nullable=False, + info=dict(description="Value used in calculating the player's score in a Pal Park run")) + rate = Column(Integer, nullable=False, + info=dict(description="Base rate for encountering this Pokémon")) + class PokeathlonStat(TableBase): u"""A Pokéathlon stat, such as "Stamina" or "Jump". """ @@ -2090,6 +2107,9 @@ PokemonSpecies.generation = relationship(Generation, PokemonSpecies.shape = relationship(PokemonShape, innerjoin=True, backref='species') +PokemonSpecies.pal_park = relationship(PalPark, + uselist=False, + backref='species') PokemonSpeciesFlavorText.version = relationship(Version, innerjoin=True, lazy='joined') PokemonSpeciesFlavorText.language = relationship(Language, innerjoin=True, lazy='joined') diff --git a/scripts/palpark.py b/scripts/palpark.py new file mode 100755 index 0000000..0440d5f --- /dev/null +++ b/scripts/palpark.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python2 + +"""Dump /arc/ppark.narc. + +This is an unmaintained one-shot script, only included in the repo for +reference. + +""" + + +import sys +from struct import pack, unpack +import binascii + +import pokedex.db +from pokedex.db.tables import PalPark + +types = [ + '', + 'grass', + 'fire', + 'water', + 'bug', + 'normal', + 'poison', + 'electric', + 'ground', + 'fighting', + 'psychic', + 'rock', + 'ghost', + 'ice', + 'steel', + 'dragon', + 'dark', + 'flying', +] + +areas = { + 1: 'forest', + 2: 'mountain', + 3: 'field', + 0x200: 'pond', + 0x400: 'sea', +} + +session = pokedex.db.connect()() + +with open(sys.argv[1], "rb") as f: + f.seek(0x3C) + for i in range(0xb8e // 6): + data = f.read(6) + area, score, rate, t1, t2 = unpack(" Date: Sat, 2 Jun 2012 00:17:53 -0700 Subject: [PATCH 2/2] Turn PalPark.area Enum into a table. --- pokedex/data/csv/pal_park.csv | 988 +++++++++++------------ pokedex/data/csv/pal_park_area_names.csv | 6 + pokedex/data/csv/pal_park_areas.csv | 6 + pokedex/db/tables.py | 22 +- 4 files changed, 527 insertions(+), 495 deletions(-) create mode 100644 pokedex/data/csv/pal_park_area_names.csv create mode 100644 pokedex/data/csv/pal_park_areas.csv diff --git a/pokedex/data/csv/pal_park.csv b/pokedex/data/csv/pal_park.csv index b3965c0..4088728 100644 --- a/pokedex/data/csv/pal_park.csv +++ b/pokedex/data/csv/pal_park.csv @@ -1,494 +1,494 @@ -species_id,area,base_score,rate -1,field,50,30 -2,field,80,10 -3,field,90,3 -4,field,50,30 -5,field,80,10 -6,field,90,3 -7,pond,50,30 -8,pond,80,10 -9,pond,90,3 -10,forest,30,50 -11,forest,50,30 -12,forest,70,20 -13,forest,30,50 -14,forest,50,30 -15,forest,70,20 -16,field,30,50 -17,field,50,30 -18,field,70,20 -19,field,30,50 -20,field,50,30 -21,field,30,50 -22,field,50,30 -23,forest,30,50 -24,forest,50,30 -25,forest,80,10 -26,forest,90,3 -27,mountain,50,30 -28,mountain,70,20 -29,field,30,50 -30,field,50,30 -31,field,70,20 -32,field,30,50 -33,field,50,30 -34,field,70,20 -35,mountain,80,10 -36,mountain,90,3 -37,field,70,20 -38,field,80,10 -39,field,80,10 -40,field,90,3 -41,mountain,30,50 -42,mountain,50,30 -43,forest,30,50 -44,forest,50,30 -45,forest,70,20 -46,forest,30,50 -47,forest,50,30 -48,forest,30,50 -49,forest,50,30 -50,mountain,30,50 -51,mountain,50,30 -52,field,50,30 -53,field,70,20 -54,pond,50,30 -55,pond,70,20 -56,mountain,50,30 -57,mountain,70,20 -58,field,70,20 -59,field,80,10 -60,pond,50,30 -61,pond,80,10 -62,pond,90,3 -63,field,50,30 -64,field,80,10 -65,field,90,3 -66,mountain,50,30 -67,mountain,80,10 -68,mountain,90,3 -69,forest,30,50 -70,forest,50,30 -71,forest,70,20 -72,sea,30,50 -73,sea,50,30 -74,mountain,30,50 -75,mountain,50,30 -76,mountain,70,20 -77,field,50,30 -78,field,70,20 -79,pond,50,30 -80,pond,70,20 -81,mountain,50,30 -82,mountain,70,20 -83,field,70,20 -84,field,50,30 -85,field,70,20 -86,sea,50,30 -87,sea,70,20 -88,field,50,30 -89,field,70,20 -90,sea,50,30 -91,sea,70,20 -92,forest,50,30 -93,forest,80,10 -94,forest,90,3 -95,mountain,80,10 -96,forest,50,30 -97,forest,70,20 -98,sea,50,30 -99,sea,70,20 -100,field,50,30 -101,field,70,20 -102,forest,50,30 -103,forest,70,20 -104,mountain,50,30 -105,mountain,70,20 -106,mountain,80,10 -107,mountain,80,10 -108,field,70,20 -109,mountain,50,30 -110,mountain,70,20 -111,mountain,50,30 -112,mountain,70,20 -113,field,90,3 -114,forest,50,30 -115,field,70,20 -116,sea,50,30 -117,sea,70,20 -118,pond,50,30 -119,pond,70,20 -120,sea,50,30 -121,sea,70,20 -122,field,70,20 -123,field,70,20 -124,field,70,20 -125,mountain,70,20 -126,mountain,70,20 -127,forest,70,20 -128,field,70,20 -129,pond,30,50 -130,pond,90,3 -131,sea,90,3 -132,field,70,20 -133,field,90,3 -134,field,90,3 -135,field,90,3 -136,field,90,3 -137,field,80,10 -138,sea,50,30 -139,sea,70,20 -140,sea,50,30 -141,sea,70,20 -142,mountain,70,20 -143,field,80,10 -144,mountain,90,3 -145,mountain,90,3 -146,mountain,90,3 -147,pond,70,20 -148,pond,80,10 -149,mountain,90,3 -150,field,90,3 -151,forest,100,1 -152,field,50,30 -153,field,80,10 -154,field,90,3 -155,field,50,30 -156,field,80,10 -157,field,90,3 -158,pond,50,30 -159,pond,80,10 -160,mountain,90,3 -161,field,30,50 -162,field,50,30 -163,forest,30,50 -164,forest,50,30 -165,field,30,50 -166,field,50,30 -167,field,30,50 -168,field,50,30 -169,mountain,90,3 -170,sea,50,30 -171,sea,70,20 -172,field,80,10 -173,field,80,10 -174,field,80,10 -175,field,80,10 -176,field,90,3 -177,forest,50,30 -178,forest,70,20 -179,field,50,30 -180,field,70,20 -181,field,80,10 -182,forest,80,10 -183,pond,50,30 -184,pond,70,20 -185,mountain,70,20 -186,pond,80,10 -187,field,50,30 -188,field,70,20 -189,field,80,10 -190,forest,70,20 -191,field,50,30 -192,field,70,20 -193,field,80,10 -194,pond,50,30 -195,pond,70,20 -196,field,90,3 -197,field,90,3 -198,forest,70,20 -199,pond,80,10 -200,forest,70,20 -201,forest,70,20 -202,field,80,10 -203,field,70,20 -204,forest,50,30 -205,forest,70,20 -206,forest,90,3 -207,mountain,50,30 -208,mountain,90,3 -209,field,50,30 -210,field,70,20 -211,sea,80,10 -212,field,90,3 -213,sea,80,10 -214,forest,80,10 -215,mountain,50,30 -216,forest,50,30 -217,forest,70,20 -218,mountain,50,30 -219,mountain,70,20 -220,mountain,50,30 -221,mountain,70,20 -222,sea,70,20 -223,sea,50,30 -224,sea,70,20 -225,mountain,70,20 -226,sea,70,20 -227,mountain,70,20 -228,mountain,50,30 -229,mountain,70,20 -230,sea,80,10 -231,mountain,50,30 -232,mountain,70,20 -233,field,80,10 -234,field,50,30 -235,field,80,10 -236,mountain,80,10 -237,mountain,80,10 -238,field,80,10 -239,mountain,80,10 -240,mountain,80,10 -241,field,70,20 -242,field,90,3 -243,mountain,90,3 -244,mountain,90,3 -245,mountain,90,3 -246,mountain,70,20 -247,mountain,80,10 -248,mountain,90,3 -249,mountain,90,3 -250,mountain,90,3 -251,forest,100,1 -252,forest,50,30 -253,forest,80,10 -254,forest,90,3 -255,field,50,30 -256,field,80,10 -257,field,90,3 -258,pond,50,30 -259,pond,80,10 -260,pond,90,3 -261,field,30,50 -262,field,50,30 -263,field,30,50 -264,field,50,30 -265,forest,30,50 -266,forest,50,30 -267,forest,70,20 -268,forest,50,30 -269,forest,70,20 -270,pond,30,50 -271,pond,50,30 -272,pond,80,10 -273,forest,30,50 -274,forest,50,30 -275,forest,80,10 -276,field,30,50 -277,field,50,30 -278,sea,30,50 -279,sea,50,30 -280,field,50,30 -281,field,70,20 -282,field,80,10 -283,pond,50,30 -284,pond,70,20 -285,forest,50,30 -286,forest,70,20 -287,forest,50,30 -288,forest,70,20 -289,forest,80,10 -290,forest,50,30 -291,forest,70,20 -292,forest,80,10 -293,mountain,50,30 -294,mountain,70,20 -295,mountain,80,10 -296,mountain,50,30 -297,mountain,70,20 -298,pond,80,10 -299,mountain,70,20 -300,field,50,30 -301,field,70,20 -302,mountain,70,20 -303,mountain,70,20 -304,mountain,50,30 -305,mountain,70,20 -306,mountain,80,10 -307,mountain,50,30 -308,mountain,70,20 -309,field,50,30 -310,field,70,20 -311,field,90,3 -312,field,90,3 -313,mountain,70,20 -314,mountain,70,20 -315,field,70,20 -316,forest,50,30 -317,forest,70,20 -318,sea,50,30 -319,sea,70,20 -320,sea,50,30 -321,sea,80,10 -322,mountain,50,30 -323,mountain,70,20 -324,mountain,70,20 -325,field,50,30 -326,field,70,20 -327,field,50,30 -328,mountain,50,30 -329,mountain,70,20 -330,mountain,80,10 -331,mountain,50,30 -332,mountain,70,20 -333,field,50,30 -334,field,80,10 -335,field,70,20 -336,forest,70,20 -337,mountain,70,20 -338,mountain,70,20 -339,pond,50,30 -340,pond,70,20 -341,pond,50,30 -342,pond,70,20 -343,mountain,50,30 -344,mountain,70,20 -345,sea,70,20 -346,sea,80,10 -347,sea,70,20 -348,sea,80,10 -349,sea,70,20 -350,sea,90,3 -351,field,80,10 -352,forest,70,20 -353,forest,50,30 -354,forest,70,20 -355,forest,50,30 -356,forest,70,20 -357,forest,70,20 -358,mountain,80,10 -359,mountain,80,10 -360,field,80,10 -361,mountain,50,30 -362,mountain,70,20 -363,sea,50,30 -364,sea,70,20 -365,sea,80,10 -366,sea,50,30 -367,sea,80,10 -368,sea,80,10 -369,sea,80,10 -370,sea,50,30 -371,mountain,50,30 -372,mountain,70,20 -373,mountain,80,10 -374,mountain,70,20 -375,mountain,80,10 -376,mountain,90,3 -377,mountain,90,3 -378,mountain,90,3 -379,mountain,90,3 -380,field,90,3 -381,field,90,3 -382,sea,90,3 -383,mountain,90,3 -384,field,90,3 -385,mountain,100,1 -386,mountain,100,1 -387,forest,50,30 -388,forest,80,10 -389,forest,90,3 -390,field,50,30 -391,field,80,10 -392,field,90,3 -393,pond,50,30 -394,pond,80,10 -395,pond,90,3 -396,field,30,50 -397,field,50,30 -398,field,70,20 -399,field,30,50 -400,field,50,30 -401,forest,50,30 -402,forest,70,20 -403,field,50,30 -404,field,70,20 -405,field,80,10 -406,field,80,10 -407,field,80,10 -408,mountain,70,20 -409,mountain,80,10 -410,mountain,70,20 -411,mountain,80,10 -412,forest,50,30 -413,forest,70,20 -414,forest,70,20 -415,forest,50,30 -416,forest,70,20 -417,forest,50,30 -418,forest,70,20 -419,mountain,70,20 -420,mountain,80,10 -421,field,90,3 -422,sea,50,30 -423,sea,70,20 -424,pond,50,30 -425,pond,70,20 -426,forest,80,10 -427,field,50,30 -428,field,70,20 -429,forest,80,10 -430,forest,80,10 -431,field,50,30 -432,field,70,20 -433,field,70,20 -434,mountain,80,10 -435,mountain,50,30 -436,mountain,70,20 -437,mountain,80,10 -438,field,90,3 -439,field,90,3 -440,field,50,30 -441,field,70,20 -442,field,80,10 -443,mountain,50,30 -444,mountain,70,20 -445,pond,50,30 -446,pond,70,20 -447,field,70,20 -448,field,50,30 -449,field,70,20 -450,sea,80,10 -451,sea,50,30 -452,sea,70,20 -453,forest,90,3 -454,mountain,50,30 -455,mountain,70,20 -456,mountain,80,10 -457,mountain,90,3 -458,mountain,90,3 -459,mountain,50,30 -460,mountain,70,20 -461,mountain,80,10 -462,mountain,80,10 -463,field,80,10 -464,mountain,80,10 -465,forest,80,10 -466,mountain,80,10 -467,mountain,80,10 -468,field,80,10 -469,field,80,10 -470,field,90,3 -471,field,90,3 -472,mountain,80,10 -473,mountain,80,10 -474,field,80,10 -475,field,80,10 -476,mountain,80,10 -477,forest,80,10 -478,mountain,80,10 -479,field,90,3 -480,field,90,3 -481,field,90,3 -482,field,90,3 -483,mountain,90,3 -484,mountain,90,3 -485,mountain,90,3 -486,mountain,90,3 -487,mountain,90,3 -488,forest,90,3 -489,sea,90,3 -490,sea,100,1 -491,mountain,100,1 -492,field,100,1 -493,mountain,100,1 +species_id,area_id,base_score,rate +1,2,50,30 +2,2,80,10 +3,2,90,3 +4,2,50,30 +5,2,80,10 +6,2,90,3 +7,4,50,30 +8,4,80,10 +9,4,90,3 +10,1,30,50 +11,1,50,30 +12,1,70,20 +13,1,30,50 +14,1,50,30 +15,1,70,20 +16,2,30,50 +17,2,50,30 +18,2,70,20 +19,2,30,50 +20,2,50,30 +21,2,30,50 +22,2,50,30 +23,1,30,50 +24,1,50,30 +25,1,80,10 +26,1,90,3 +27,3,50,30 +28,3,70,20 +29,2,30,50 +30,2,50,30 +31,2,70,20 +32,2,30,50 +33,2,50,30 +34,2,70,20 +35,3,80,10 +36,3,90,3 +37,2,70,20 +38,2,80,10 +39,2,80,10 +40,2,90,3 +41,3,30,50 +42,3,50,30 +43,1,30,50 +44,1,50,30 +45,1,70,20 +46,1,30,50 +47,1,50,30 +48,1,30,50 +49,1,50,30 +50,3,30,50 +51,3,50,30 +52,2,50,30 +53,2,70,20 +54,4,50,30 +55,4,70,20 +56,3,50,30 +57,3,70,20 +58,2,70,20 +59,2,80,10 +60,4,50,30 +61,4,80,10 +62,4,90,3 +63,2,50,30 +64,2,80,10 +65,2,90,3 +66,3,50,30 +67,3,80,10 +68,3,90,3 +69,1,30,50 +70,1,50,30 +71,1,70,20 +72,5,30,50 +73,5,50,30 +74,3,30,50 +75,3,50,30 +76,3,70,20 +77,2,50,30 +78,2,70,20 +79,4,50,30 +80,4,70,20 +81,3,50,30 +82,3,70,20 +83,2,70,20 +84,2,50,30 +85,2,70,20 +86,5,50,30 +87,5,70,20 +88,2,50,30 +89,2,70,20 +90,5,50,30 +91,5,70,20 +92,1,50,30 +93,1,80,10 +94,1,90,3 +95,3,80,10 +96,1,50,30 +97,1,70,20 +98,5,50,30 +99,5,70,20 +100,2,50,30 +101,2,70,20 +102,1,50,30 +103,1,70,20 +104,3,50,30 +105,3,70,20 +106,3,80,10 +107,3,80,10 +108,2,70,20 +109,3,50,30 +110,3,70,20 +111,3,50,30 +112,3,70,20 +113,2,90,3 +114,1,50,30 +115,2,70,20 +116,5,50,30 +117,5,70,20 +118,4,50,30 +119,4,70,20 +120,5,50,30 +121,5,70,20 +122,2,70,20 +123,2,70,20 +124,2,70,20 +125,3,70,20 +126,3,70,20 +127,1,70,20 +128,2,70,20 +129,4,30,50 +130,4,90,3 +131,5,90,3 +132,2,70,20 +133,2,90,3 +134,2,90,3 +135,2,90,3 +136,2,90,3 +137,2,80,10 +138,5,50,30 +139,5,70,20 +140,5,50,30 +141,5,70,20 +142,3,70,20 +143,2,80,10 +144,3,90,3 +145,3,90,3 +146,3,90,3 +147,4,70,20 +148,4,80,10 +149,3,90,3 +150,2,90,3 +151,1,100,1 +152,2,50,30 +153,2,80,10 +154,2,90,3 +155,2,50,30 +156,2,80,10 +157,2,90,3 +158,4,50,30 +159,4,80,10 +160,3,90,3 +161,2,30,50 +162,2,50,30 +163,1,30,50 +164,1,50,30 +165,2,30,50 +166,2,50,30 +167,2,30,50 +168,2,50,30 +169,3,90,3 +170,5,50,30 +171,5,70,20 +172,2,80,10 +173,2,80,10 +174,2,80,10 +175,2,80,10 +176,2,90,3 +177,1,50,30 +178,1,70,20 +179,2,50,30 +180,2,70,20 +181,2,80,10 +182,1,80,10 +183,4,50,30 +184,4,70,20 +185,3,70,20 +186,4,80,10 +187,2,50,30 +188,2,70,20 +189,2,80,10 +190,1,70,20 +191,2,50,30 +192,2,70,20 +193,2,80,10 +194,4,50,30 +195,4,70,20 +196,2,90,3 +197,2,90,3 +198,1,70,20 +199,4,80,10 +200,1,70,20 +201,1,70,20 +202,2,80,10 +203,2,70,20 +204,1,50,30 +205,1,70,20 +206,1,90,3 +207,3,50,30 +208,3,90,3 +209,2,50,30 +210,2,70,20 +211,5,80,10 +212,2,90,3 +213,5,80,10 +214,1,80,10 +215,3,50,30 +216,1,50,30 +217,1,70,20 +218,3,50,30 +219,3,70,20 +220,3,50,30 +221,3,70,20 +222,5,70,20 +223,5,50,30 +224,5,70,20 +225,3,70,20 +226,5,70,20 +227,3,70,20 +228,3,50,30 +229,3,70,20 +230,5,80,10 +231,3,50,30 +232,3,70,20 +233,2,80,10 +234,2,50,30 +235,2,80,10 +236,3,80,10 +237,3,80,10 +238,2,80,10 +239,3,80,10 +240,3,80,10 +241,2,70,20 +242,2,90,3 +243,3,90,3 +244,3,90,3 +245,3,90,3 +246,3,70,20 +247,3,80,10 +248,3,90,3 +249,3,90,3 +250,3,90,3 +251,1,100,1 +252,1,50,30 +253,1,80,10 +254,1,90,3 +255,2,50,30 +256,2,80,10 +257,2,90,3 +258,4,50,30 +259,4,80,10 +260,4,90,3 +261,2,30,50 +262,2,50,30 +263,2,30,50 +264,2,50,30 +265,1,30,50 +266,1,50,30 +267,1,70,20 +268,1,50,30 +269,1,70,20 +270,4,30,50 +271,4,50,30 +272,4,80,10 +273,1,30,50 +274,1,50,30 +275,1,80,10 +276,2,30,50 +277,2,50,30 +278,5,30,50 +279,5,50,30 +280,2,50,30 +281,2,70,20 +282,2,80,10 +283,4,50,30 +284,4,70,20 +285,1,50,30 +286,1,70,20 +287,1,50,30 +288,1,70,20 +289,1,80,10 +290,1,50,30 +291,1,70,20 +292,1,80,10 +293,3,50,30 +294,3,70,20 +295,3,80,10 +296,3,50,30 +297,3,70,20 +298,4,80,10 +299,3,70,20 +300,2,50,30 +301,2,70,20 +302,3,70,20 +303,3,70,20 +304,3,50,30 +305,3,70,20 +306,3,80,10 +307,3,50,30 +308,3,70,20 +309,2,50,30 +310,2,70,20 +311,2,90,3 +312,2,90,3 +313,3,70,20 +314,3,70,20 +315,2,70,20 +316,1,50,30 +317,1,70,20 +318,5,50,30 +319,5,70,20 +320,5,50,30 +321,5,80,10 +322,3,50,30 +323,3,70,20 +324,3,70,20 +325,2,50,30 +326,2,70,20 +327,2,50,30 +328,3,50,30 +329,3,70,20 +330,3,80,10 +331,3,50,30 +332,3,70,20 +333,2,50,30 +334,2,80,10 +335,2,70,20 +336,1,70,20 +337,3,70,20 +338,3,70,20 +339,4,50,30 +340,4,70,20 +341,4,50,30 +342,4,70,20 +343,3,50,30 +344,3,70,20 +345,5,70,20 +346,5,80,10 +347,5,70,20 +348,5,80,10 +349,5,70,20 +350,5,90,3 +351,2,80,10 +352,1,70,20 +353,1,50,30 +354,1,70,20 +355,1,50,30 +356,1,70,20 +357,1,70,20 +358,3,80,10 +359,3,80,10 +360,2,80,10 +361,3,50,30 +362,3,70,20 +363,5,50,30 +364,5,70,20 +365,5,80,10 +366,5,50,30 +367,5,80,10 +368,5,80,10 +369,5,80,10 +370,5,50,30 +371,3,50,30 +372,3,70,20 +373,3,80,10 +374,3,70,20 +375,3,80,10 +376,3,90,3 +377,3,90,3 +378,3,90,3 +379,3,90,3 +380,2,90,3 +381,2,90,3 +382,5,90,3 +383,3,90,3 +384,2,90,3 +385,3,100,1 +386,3,100,1 +387,1,50,30 +388,1,80,10 +389,1,90,3 +390,2,50,30 +391,2,80,10 +392,2,90,3 +393,4,50,30 +394,4,80,10 +395,4,90,3 +396,2,30,50 +397,2,50,30 +398,2,70,20 +399,2,30,50 +400,2,50,30 +401,1,50,30 +402,1,70,20 +403,2,50,30 +404,2,70,20 +405,2,80,10 +406,2,80,10 +407,2,80,10 +408,3,70,20 +409,3,80,10 +410,3,70,20 +411,3,80,10 +412,1,50,30 +413,1,70,20 +414,1,70,20 +415,1,50,30 +416,1,70,20 +417,1,50,30 +418,1,70,20 +419,3,70,20 +420,3,80,10 +421,2,90,3 +422,5,50,30 +423,5,70,20 +424,4,50,30 +425,4,70,20 +426,1,80,10 +427,2,50,30 +428,2,70,20 +429,1,80,10 +430,1,80,10 +431,2,50,30 +432,2,70,20 +433,2,70,20 +434,3,80,10 +435,3,50,30 +436,3,70,20 +437,3,80,10 +438,2,90,3 +439,2,90,3 +440,2,50,30 +441,2,70,20 +442,2,80,10 +443,3,50,30 +444,3,70,20 +445,4,50,30 +446,4,70,20 +447,2,70,20 +448,2,50,30 +449,2,70,20 +450,5,80,10 +451,5,50,30 +452,5,70,20 +453,1,90,3 +454,3,50,30 +455,3,70,20 +456,3,80,10 +457,3,90,3 +458,3,90,3 +459,3,50,30 +460,3,70,20 +461,3,80,10 +462,3,80,10 +463,2,80,10 +464,3,80,10 +465,1,80,10 +466,3,80,10 +467,3,80,10 +468,2,80,10 +469,2,80,10 +470,2,90,3 +471,2,90,3 +472,3,80,10 +473,3,80,10 +474,2,80,10 +475,2,80,10 +476,3,80,10 +477,1,80,10 +478,3,80,10 +479,2,90,3 +480,2,90,3 +481,2,90,3 +482,2,90,3 +483,3,90,3 +484,3,90,3 +485,3,90,3 +486,3,90,3 +487,3,90,3 +488,1,90,3 +489,5,90,3 +490,5,100,1 +491,3,100,1 +492,2,100,1 +493,3,100,1 diff --git a/pokedex/data/csv/pal_park_area_names.csv b/pokedex/data/csv/pal_park_area_names.csv new file mode 100644 index 0000000..c0dfd97 --- /dev/null +++ b/pokedex/data/csv/pal_park_area_names.csv @@ -0,0 +1,6 @@ +pal_park_area_id,local_language_id,name +1,9,Forest +2,9,Field +3,9,Mountain +4,9,Pond +5,9,Sea diff --git a/pokedex/data/csv/pal_park_areas.csv b/pokedex/data/csv/pal_park_areas.csv new file mode 100644 index 0000000..a600f39 --- /dev/null +++ b/pokedex/data/csv/pal_park_areas.csv @@ -0,0 +1,6 @@ +id,identifier +1,forest +2,field +3,mountain +4,pond +5,sea diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 417ce7e..a7f241f 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -1030,13 +1030,29 @@ class PalPark(TableBase): species_id = Column(Integer, ForeignKey('pokemon_species.id'), primary_key=True, info=dict(description="ID of the Pokémon species this data pertains to")) - area = Column(Enum('forest', 'field', 'mountain', 'pond', 'sea', name='pal_park_areas'), nullable=False, + area_id = Column(Integer, ForeignKey('pal_park_areas.id'), nullable=False, info=dict(description="The area in which this Pokémon can be found")) base_score = Column(Integer, nullable=False, info=dict(description="Value used in calculating the player's score in a Pal Park run")) rate = Column(Integer, nullable=False, info=dict(description="Base rate for encountering this Pokémon")) +class PalParkArea(TableBase): + u"""Pal Park areas enum + """ + __tablename__ = 'pal_park_areas' + __singlename__ = 'pal_park_area' + + id = Column(Integer, primary_key=True, nullable=False, + info=dict(description="A numeric ID")) + identifier = Column(Unicode(8), nullable=False, + info=dict(description="An identifier")) + +create_translation_table('pal_park_area_names', PalParkArea, 'names', + name = Column(Unicode(8), nullable=False, index=True, + info=dict(description="The name", format='plaintext', official=False)), +) + class PokeathlonStat(TableBase): u"""A Pokéathlon stat, such as "Stamina" or "Jump". """ @@ -1921,6 +1937,10 @@ NaturePokeathlonStat.pokeathlon_stat = relationship(PokeathlonStat, backref='nature_effects') +PalPark.area = relationship(PalParkArea, + innerjoin=True, lazy='joined') + + Pokedex.region = relationship(Region, innerjoin=True, backref='pokedexes')