| 725 | | =head2 map |
| 726 | | |
| 727 | | =cut |
| 728 | | |
| 729 | | sub map : Chained('pokemon_chain') : Args(0) { |
| 730 | | my ($self, $c) = @_; |
| 731 | | my $s = $c->stash; |
| 732 | | |
| 733 | | my $poke = $c->req->captures->[0]; |
| 734 | | my $gen = 'dp'; # TODO: CHEAP HACK PLZ MAKE THIS WORK RITE -- do by generation but split if versions disagree? |
| 735 | | |
| 736 | | my $row = get_row($c, 'Pokemon', $poke); |
| 737 | | $c->vee_abort('There is no such Pokémon ', $poke, '. If you are messing with my URLs, please stop. If you came here via a link, please inform its owner that it is invalid.') unless $row; |
| 738 | | |
| 739 | | $s->{encounters} = get_locations($row); |
| 740 | | $s->{location_coords} = { |
| 741 | | map { $_->name => $_->coordinates } |
| 742 | | $c->model('DBIC::Locations')->search(undef) |
| 743 | | }; |
| 744 | | |
| 745 | | $s->{this} = $row; |
| 746 | | |
| 747 | | $s->{page_title} = $row->name . ' - Location Map'; |
| 748 | | $s->{crumbs} = [ |
| 749 | | '<a href="' . $c->uri('Dex') . '">Pokédex</a>', |
| 750 | | '<a href="' . $c->uri('Dex', 'pokemon_list') . '">Pokémon</a>', |
| 751 | | '<a href="' . $c->uri('Dex', 'pokemon', lc $row->name) . '">' . $row->name . '</a>', |
| 752 | | 'Location Map', |
| 753 | | ]; |
| 754 | | |
| 755 | | $s->{template} = 'dex/page/pokemon/map.tt'; |
| 756 | | } |
| 757 | | |