about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-25 00:05:38 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-25 00:05:38 -0400
commita65972d34188d14dca10193950732d506d931e8c (patch)
tree2212ac8682f97f07751370a898ad651af8b64a5b
parentb0dee0af0a4235eb9756532e807db5c8b701ce45 (diff)
downloadpokeviewer-a65972d34188d14dca10193950732d506d931e8c.tar.gz
pokeviewer-a65972d34188d14dca10193950732d506d931e8c.tar.bz2
pokeviewer-a65972d34188d14dca10193950732d506d931e8c.zip
Added met location data
Note that the met location for Pokémon from Orre is completely
incorrect.
-rw-r--r--app/assets/stylesheets/pokeviewer/pokemon.css.scss50
-rw-r--r--app/controllers/pokeviewer/pokemon_controller.rb2
-rw-r--r--app/jobs/pokeviewer/extract_save_data_job.rb7
-rw-r--r--app/models/pokeviewer/location.rb5
-rw-r--r--app/models/pokeviewer/pokemon.rb36
-rw-r--r--app/views/pokeviewer/pokemon/show.html.haml49
-rw-r--r--db/migrate/20170925013807_create_pokeviewer_locations.rb9
-rw-r--r--db/seeds.rb214
-rw-r--r--test/dummy/db/schema.rb8
9 files changed, 351 insertions, 29 deletions
diff --git a/app/assets/stylesheets/pokeviewer/pokemon.css.scss b/app/assets/stylesheets/pokeviewer/pokemon.css.scss index 332cb18..83fac45 100644 --- a/app/assets/stylesheets/pokeviewer/pokemon.css.scss +++ b/app/assets/stylesheets/pokeviewer/pokemon.css.scss
@@ -141,6 +141,9 @@
141 font-family: 'Power Green'; 141 font-family: 'Power Green';
142 display: flex; 142 display: flex;
143 margin: 1em; 143 margin: 1em;
144 border: 1px solid #777;
145 border-radius: 5px;
146 background-color: #fafafa;
144 147
145 .male { 148 .male {
146 color: blue; 149 color: blue;
@@ -155,16 +158,49 @@
155 white-space: pre; 158 white-space: pre;
156 } 159 }
157 160
158 .pokemon-ivs { 161 .pd-details {
159 margin: 0 1em; 162 color: white;
163 font-size: bold;
164 padding: .25em .5em;
165 }
166
167 .pd-contents {
168 p {
169 margin: .25em;
170 }
171 }
172
173 .pokemon-basics {
174 margin: .5em;
175 }
176
177 .pokemon-memo {
178 border-left: 1px solid #aaa;
179 background-color: #e7e8ff;
180
181 .pd-details {
182 background-color: #2068e0;
183 }
184 }
160 185
161 th { 186 .pokemon-stats {
162 text-align: center; 187 border-left: 1px solid #aaa;
163 padding-right: .5em; 188
189 .pd-details {
190 background-color: #d078f8;
164 } 191 }
165 192
166 td { 193 table {
167 text-align: right; 194 margin: 0 1em;
195
196 th {
197 text-align: center;
198 padding-right: .5em;
199 }
200
201 td {
202 text-align: right;
203 }
168 } 204 }
169 } 205 }
170} 206}
diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index ef421ac..44ee791 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb
@@ -7,7 +7,7 @@ module Pokeviewer
7 end 7 end
8 8
9 def show 9 def show
10 @pokemon = Pokemon.find_by_uuid params[:id] 10 @pokemon = Pokemon.find_by_uuid! params[:id]
11 end 11 end
12 end 12 end
13end 13end
diff --git a/app/jobs/pokeviewer/extract_save_data_job.rb b/app/jobs/pokeviewer/extract_save_data_job.rb index 3409a5f..be8f64d 100644 --- a/app/jobs/pokeviewer/extract_save_data_job.rb +++ b/app/jobs/pokeviewer/extract_save_data_job.rb
@@ -39,9 +39,16 @@ module Pokeviewer
39 39
40 if param["metLevel"] == 0 40 if param["metLevel"] == 0
41 r.met_type = :hatched 41 r.met_type = :hatched
42 r.met_location = param["metLocation"]
43 elsif param["metLocation"] == 254
44 r.met_type = :npc_trade
45 elsif param["metLocation"] == 255
46 r.met_type = :fateful_encounter
47 r.met_level = param["metLevel"]
42 else 48 else
43 r.met_type = :normal 49 r.met_type = :normal
44 r.met_level = param["metLevel"] 50 r.met_level = param["metLevel"]
51 r.met_location = param["metLocation"]
45 end 52 end
46 53
47 r.shiny = param["shiny"] 54 r.shiny = param["shiny"]
diff --git a/app/models/pokeviewer/location.rb b/app/models/pokeviewer/location.rb new file mode 100644 index 0000000..e497cbc --- /dev/null +++ b/app/models/pokeviewer/location.rb
@@ -0,0 +1,5 @@
1module Pokeviewer
2 class Location < ApplicationRecord
3 validates :name, presence: true
4 end
5end
diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index d14ea87..e493c66 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb
@@ -101,6 +101,42 @@ module Pokeviewer
101 end 101 end
102 end 102 end
103 103
104 def outsider?
105 (ot_name != trainer.name) or (ot_number != trainer.number)
106 end
107
108 def location
109 if (met_type == :normal) or (met_type == :hatched)
110 Location.find_by_id(met_location)
111 else
112 nil
113 end
114 end
115
116 def display_ot_number
117 ot_number.to_s.rjust(5, '0')
118 end
119
120 def display_met
121 if met_type == :normal
122 if outsider?
123 "Apparently met in #{location.name} at Lv. #{met_level}."
124 else
125 "Met in #{location.name} at Lv. #{met_level}."
126 end
127 elsif met_type == :hatched
128 if outsider?
129 "Apparently hatched in #{location.name} at Lv. 5."
130 else
131 "Hatched in #{location.name} at Lv. 5."
132 end
133 elsif met_type == :npc_trade
134 "Met in a trade."
135 elsif met_type == :fateful_encounter
136 "Obtained in a fateful encounter at Lv. #{met_level}."
137 end
138 end
139
104 private 140 private
105 141
106 def set_uuid 142 def set_uuid
diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index a38d641..18a6788 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml
@@ -7,24 +7,33 @@
7 .pokemon-ot 7 .pokemon-ot
8 OT/ 8 OT/
9 %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name 9 %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name
10 .pokemon-id= "ID/#{@pokemon.ot_number}" 10 .pokemon-id= "ID/#{@pokemon.display_ot_number}"
11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" 11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}"
12 %table.pokemon-ivs 12 .pokemon-memo
13 %tr 13 .pd-details Trainer Memo
14 %th HP 14 .pd-contents
15 %td= @pokemon.revisions.last.hp 15 %p
16 %tr 16 %span.pokemon-nature<= @pokemon.nature.titlecase
17 %th Attack 17 nature.
18 %td= @pokemon.revisions.last.attack 18 %p= @pokemon.display_met
19 %tr 19 .pokemon-stats
20 %th Defense 20 .pd-details Stats
21 %td= @pokemon.revisions.last.defense 21 %table.pd-contents
22 %tr 22 %tr
23 %th Sp. Atk 23 %th HP
24 %td= @pokemon.revisions.last.special_attack 24 %td= @pokemon.revisions.last.hp
25 %tr 25 %tr
26 %th Sp. Def 26 %th Attack
27 %td= @pokemon.revisions.last.special_defense 27 %td= @pokemon.revisions.last.attack
28 %tr 28 %tr
29 %th Speed 29 %th Defense
30 %td= @pokemon.revisions.last.speed 30 %td= @pokemon.revisions.last.defense
31 %tr
32 %th Sp. Atk
33 %td= @pokemon.revisions.last.special_attack
34 %tr
35 %th Sp. Def
36 %td= @pokemon.revisions.last.special_defense
37 %tr
38 %th Speed
39 %td= @pokemon.revisions.last.speed
diff --git a/db/migrate/20170925013807_create_pokeviewer_locations.rb b/db/migrate/20170925013807_create_pokeviewer_locations.rb new file mode 100644 index 0000000..9070077 --- /dev/null +++ b/db/migrate/20170925013807_create_pokeviewer_locations.rb
@@ -0,0 +1,9 @@
1class CreatePokeviewerLocations < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_locations do |t|
4 t.string :name, null: false
5
6 t.timestamps
7 end
8 end
9end
diff --git a/db/seeds.rb b/db/seeds.rb index 7fd61a0..221538e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb
@@ -740,4 +740,218 @@ module Pokeviewer
740 Move.create(id: 3, name: "Double Slap", pp: 10) 740 Move.create(id: 3, name: "Double Slap", pp: 10)
741 Move.create(id: 2, name: "Karate Chop", pp: 25) 741 Move.create(id: 2, name: "Karate Chop", pp: 25)
742 Move.create(id: 1, name: "Pound", pp: 35) 742 Move.create(id: 1, name: "Pound", pp: 35)
743
744 Location.create(id: 0, name: "Littleroot Town")
745 Location.create(id: 1, name: "Oldale Town")
746 Location.create(id: 2, name: "Dewford Town")
747 Location.create(id: 3, name: "Lavaridge Town")
748 Location.create(id: 4, name: "Fallarbor Town")
749 Location.create(id: 5, name: "Verdanturf Town")
750 Location.create(id: 6, name: "Pacifidlog Town")
751 Location.create(id: 7, name: "Petalburg City")
752 Location.create(id: 8, name: "Slateport City")
753 Location.create(id: 9, name: "Mauville City")
754 Location.create(id: 10, name: "Rustboro City")
755 Location.create(id: 11, name: "Fortree City")
756 Location.create(id: 12, name: "Lilycove City")
757 Location.create(id: 13, name: "Mossdeep City")
758 Location.create(id: 14, name: "Sootopolis City")
759 Location.create(id: 15, name: "Ever Grande City")
760 Location.create(id: 16, name: "Route 101")
761 Location.create(id: 17, name: "Route 102")
762 Location.create(id: 18, name: "Route 103")
763 Location.create(id: 19, name: "Route 104")
764 Location.create(id: 20, name: "Route 105")
765 Location.create(id: 21, name: "Route 106")
766 Location.create(id: 22, name: "Route 107")
767 Location.create(id: 23, name: "Route 108")
768 Location.create(id: 24, name: "Route 109")
769 Location.create(id: 25, name: "Route 110")
770 Location.create(id: 26, name: "Route 111")
771 Location.create(id: 27, name: "Route 112")
772 Location.create(id: 28, name: "Route 113")
773 Location.create(id: 29, name: "Route 114")
774 Location.create(id: 30, name: "Route 115")
775 Location.create(id: 31, name: "Route 116")
776 Location.create(id: 32, name: "Route 117")
777 Location.create(id: 33, name: "Route 118")
778 Location.create(id: 34, name: "Route 119")
779 Location.create(id: 35, name: "Route 120")
780 Location.create(id: 36, name: "Route 121")
781 Location.create(id: 37, name: "Route 122")
782 Location.create(id: 38, name: "Route 123")
783 Location.create(id: 39, name: "Route 124")
784 Location.create(id: 40, name: "Route 125")
785 Location.create(id: 41, name: "Route 126")
786 Location.create(id: 42, name: "Route 127")
787 Location.create(id: 43, name: "Route 128")
788 Location.create(id: 44, name: "Route 129")
789 Location.create(id: 45, name: "Route 130")
790 Location.create(id: 46, name: "Route 131")
791 Location.create(id: 47, name: "Route 132")
792 Location.create(id: 48, name: "Route 133")
793 Location.create(id: 49, name: "Route 134")
794 Location.create(id: 50, name: "Underwater")
795 Location.create(id: 51, name: "Underwater")
796 Location.create(id: 52, name: "Underwater")
797 Location.create(id: 53, name: "Underwater")
798 Location.create(id: 54, name: "Underwater")
799 Location.create(id: 55, name: "Granite Cave")
800 Location.create(id: 56, name: "Mt. Chimney")
801 Location.create(id: 57, name: "Safari Zone")
802 Location.create(id: 58, name: "Battle Frontier")
803 Location.create(id: 59, name: "Petalburg Woods")
804 Location.create(id: 60, name: "Rusturf Tunnel")
805 Location.create(id: 61, name: "Abandoned Ship")
806 Location.create(id: 62, name: "New Mauville")
807 Location.create(id: 63, name: "Meteor Falls")
808 Location.create(id: 64, name: "Meteor Falls")
809 Location.create(id: 65, name: "Mt. Pyre")
810 Location.create(id: 66, name: "Hideout")
811 Location.create(id: 67, name: "Shoal Cave")
812 Location.create(id: 68, name: "Seafloor Cavern")
813 Location.create(id: 69, name: "Underwater")
814 Location.create(id: 70, name: "Victory Road")
815 Location.create(id: 71, name: "Mirage Island")
816 Location.create(id: 72, name: "Cave of Origin")
817 Location.create(id: 73, name: "Southern Island")
818 Location.create(id: 74, name: "Fiery Path")
819 Location.create(id: 75, name: "Fiery Path")
820 Location.create(id: 76, name: "Jagged Pass")
821 Location.create(id: 77, name: "Jagged Pass")
822 Location.create(id: 78, name: "Sealed Chamber")
823 Location.create(id: 79, name: "Underwater")
824 Location.create(id: 80, name: "Scorched Slab")
825 Location.create(id: 81, name: "Island Cave")
826 Location.create(id: 82, name: "Desert Ruins")
827 Location.create(id: 83, name: "Ancient Tomb")
828 Location.create(id: 84, name: "Inside of Truck")
829 Location.create(id: 85, name: "Sky Pillar")
830 Location.create(id: 86, name: "Secret Base")
831 Location.create(id: 87, name: "Ferry")
832 Location.create(id: 88, name: "Pallet Town")
833 Location.create(id: 89, name: "Viridian City")
834 Location.create(id: 90, name: "Pewter City")
835 Location.create(id: 91, name: "Cerulean City")
836 Location.create(id: 92, name: "Lavender Town")
837 Location.create(id: 93, name: "Vermilion City")
838 Location.create(id: 94, name: "Celadon City")
839 Location.create(id: 95, name: "Fuchsia City")
840 Location.create(id: 96, name: "Cinnabar Island")
841 Location.create(id: 97, name: "Indigo Plateau")
842 Location.create(id: 98, name: "Saffron City")
843 Location.create(id: 99, name: "Route 4")
844 Location.create(id: 100, name: "Route 10")
845 Location.create(id: 101, name: "Route 1")
846 Location.create(id: 102, name: "Route 2")
847 Location.create(id: 103, name: "Route 3")
848 Location.create(id: 104, name: "Route 4")
849 Location.create(id: 105, name: "Route 5")
850 Location.create(id: 106, name: "Route 6")
851 Location.create(id: 107, name: "Route 7")
852 Location.create(id: 108, name: "Route 8")
853 Location.create(id: 109, name: "Route 9")
854 Location.create(id: 110, name: "Route 10")
855 Location.create(id: 111, name: "Route 11")
856 Location.create(id: 112, name: "Route 12")
857 Location.create(id: 113, name: "Route 13")
858 Location.create(id: 114, name: "Route 14")
859 Location.create(id: 115, name: "Route 15")
860 Location.create(id: 116, name: "Route 16")
861 Location.create(id: 117, name: "Route 17")
862 Location.create(id: 118, name: "Route 18")
863 Location.create(id: 119, name: "Route 19")
864 Location.create(id: 120, name: "Route 20")
865 Location.create(id: 121, name: "Route 21")
866 Location.create(id: 122, name: "Route 22")
867 Location.create(id: 123, name: "Route 23")
868 Location.create(id: 124, name: "Route 24")
869 Location.create(id: 125, name: "Route 25")
870 Location.create(id: 126, name: "Viridian Forest")
871 Location.create(id: 127, name: "Mt. Moon")
872 Location.create(id: 128, name: "S.S. Anne")
873 Location.create(id: 129, name: "Underground Path")
874 Location.create(id: 130, name: "Underground Path")
875 Location.create(id: 131, name: "Diglett's Cave")
876 Location.create(id: 132, name: "Victory Road")
877 Location.create(id: 133, name: "Rocket Hideout")
878 Location.create(id: 134, name: "Silph Co.")
879 Location.create(id: 135, name: "Pokémon Mansion")
880 Location.create(id: 136, name: "Safari Zone")
881 Location.create(id: 137, name: "Pokémon League")
882 Location.create(id: 138, name: "Rock Tunnel")
883 Location.create(id: 139, name: "Seafoam Islands")
884 Location.create(id: 140, name: "Pokémon Tower")
885 Location.create(id: 141, name: "Cerulean Cave")
886 Location.create(id: 142, name: "Power Plant")
887 Location.create(id: 143, name: "One Island")
888 Location.create(id: 144, name: "Two Island")
889 Location.create(id: 145, name: "Three Island")
890 Location.create(id: 146, name: "Four Island")
891 Location.create(id: 147, name: "Five Island")
892 Location.create(id: 148, name: "Seven Island")
893 Location.create(id: 149, name: "Six Island")
894 Location.create(id: 150, name: "Kindle Road")
895 Location.create(id: 151, name: "Treasure Beach")
896 Location.create(id: 152, name: "Cape Brink")
897 Location.create(id: 153, name: "Bond Bridge")
898 Location.create(id: 154, name: "Three Isle Port")
899 Location.create(id: 155, name: "Sevii Isle 6")
900 Location.create(id: 156, name: "Sevii Isle 7")
901 Location.create(id: 157, name: "Sevii Isle 8")
902 Location.create(id: 158, name: "Sevii Isle 9")
903 Location.create(id: 159, name: "Resort Gorgeous")
904 Location.create(id: 160, name: "Water Labyrinth")
905 Location.create(id: 161, name: "Five Isle Meadow")
906 Location.create(id: 162, name: "Memorial Pillar")
907 Location.create(id: 163, name: "Outcast Island")
908 Location.create(id: 164, name: "Green Path")
909 Location.create(id: 165, name: "Water Path")
910 Location.create(id: 166, name: "Ruin Valley")
911 Location.create(id: 167, name: "Trainer Tower")
912 Location.create(id: 168, name: "Canyon Entrance")
913 Location.create(id: 169, name: "Sevault Canyon")
914 Location.create(id: 170, name: "Tanoby Ruins")
915 Location.create(id: 171, name: "Sevii Isle 22")
916 Location.create(id: 172, name: "Sevii Isle 23")
917 Location.create(id: 173, name: "Sevii Isle 24")
918 Location.create(id: 174, name: "Navel Rock")
919 Location.create(id: 175, name: "Mt. Ember")
920 Location.create(id: 176, name: "Berry Forest")
921 Location.create(id: 177, name: "Icefall Cave")
922 Location.create(id: 178, name: "Rocket Warehouse")
923 Location.create(id: 179, name: "Trainer Tower")
924 Location.create(id: 180, name: "Dotted Hole")
925 Location.create(id: 181, name: "Lost Cave")
926 Location.create(id: 182, name: "Pattern Bush")
927 Location.create(id: 183, name: "Altering Cave")
928 Location.create(id: 184, name: "Tanoby Chambers")
929 Location.create(id: 185, name: "Three Isle Path")
930 Location.create(id: 186, name: "Tanoby Key")
931 Location.create(id: 187, name: "Birth Island")
932 Location.create(id: 188, name: "Monean Chamber")
933 Location.create(id: 189, name: "Liptoo Chamber")
934 Location.create(id: 190, name: "Weepth Chamber")
935 Location.create(id: 191, name: "Dilford Chamber")
936 Location.create(id: 192, name: "Scufib Chamber")
937 Location.create(id: 193, name: "Rixy Chamber")
938 Location.create(id: 194, name: "Viapois Chamber")
939 Location.create(id: 195, name: "Ember Spa")
940 Location.create(id: 196, name: "Celadon Dept.")
941 Location.create(id: 197, name: "Aqua Hideout")
942 Location.create(id: 198, name: "Magma Hideout")
943 Location.create(id: 199, name: "Mirage Tower")
944 Location.create(id: 200, name: "Birth Island")
945 Location.create(id: 201, name: "Faraway Island")
946 Location.create(id: 202, name: "Artisan Cave")
947 Location.create(id: 203, name: "Marine Cave")
948 Location.create(id: 204, name: "Underwater")
949 Location.create(id: 205, name: "Terra Cave")
950 Location.create(id: 206, name: "Underwater")
951 Location.create(id: 207, name: "Underwater")
952 Location.create(id: 208, name: "Underwater")
953 Location.create(id: 209, name: "Desert Underpass")
954 Location.create(id: 210, name: "Altering Cave")
955 Location.create(id: 211, name: "Navel Rock")
956 Location.create(id: 212, name: "Trainer Hill")
743end 957end
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index e7322e9..fa3b3f7 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb
@@ -10,7 +10,7 @@
10# 10#
11# It's strongly recommended that you check this file into your version control system. 11# It's strongly recommended that you check this file into your version control system.
12 12
13ActiveRecord::Schema.define(version: 20170924224550) do 13ActiveRecord::Schema.define(version: 20170925013807) do
14 14
15 create_table "pokeviewer_boxes", force: :cascade do |t| 15 create_table "pokeviewer_boxes", force: :cascade do |t|
16 t.integer "trainer_id", null: false 16 t.integer "trainer_id", null: false
@@ -22,6 +22,12 @@ ActiveRecord::Schema.define(version: 20170924224550) do
22 t.index ["trainer_id"], name: "index_pokeviewer_boxes_on_trainer_id" 22 t.index ["trainer_id"], name: "index_pokeviewer_boxes_on_trainer_id"
23 end 23 end
24 24
25 create_table "pokeviewer_locations", force: :cascade do |t|
26 t.string "name", null: false
27 t.datetime "created_at", null: false
28 t.datetime "updated_at", null: false
29 end
30
25 create_table "pokeviewer_moves", force: :cascade do |t| 31 create_table "pokeviewer_moves", force: :cascade do |t|
26 t.string "name", limit: 191, null: false 32 t.string "name", limit: 191, null: false
27 t.integer "pp", null: false 33 t.integer "pp", null: false