| 613 | | =head2 strategery |
| 614 | | |
| 615 | | =cut |
| 616 | | |
| 617 | | sub strategery : Chained('pokemon_chain') : Args(0) { |
| 618 | | my ($self, $c) = @_; |
| 619 | | my $s = $c->stash; |
| 620 | | |
| 621 | | my $poke = $c->req->captures->[0]; |
| 622 | | my $gen = 'dp'; # TODO: CHEAP HACK PLZ MAKE THIS WORK RITE -- do by generation but split if versions disagree? |
| 623 | | |
| 624 | | my $row = get_row($c, 'Pokemon', $poke); |
| 625 | | $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; |
| 626 | | |
| 627 | | $s->{generation} = my $generation = ( grep { $Generations[$_]{maxid} >= $row->id } 0 .. $#Generations )[0]; |
| 628 | | |
| 629 | | calculate_stats($c, $row); |
| 630 | | |
| 631 | | my $moves_rs = $c->model('DBIC::PokeMoves')->search({ pokeid => $row->id, -and => \ "FIND_IN_SET('$gen', version)" }); |
| 632 | | my %moves; |
| 633 | | |
| 634 | | while (my $move_row = $moves_rs->next) { |
| 635 | | push @{ $moves{ $move_row->moveid } }, $move_row; |
| 636 | | } |
| 637 | | $s->{moves} = \%moves; |
| 638 | | |
| 639 | | $s->{this} = $row; |
| 640 | | |
| 641 | | $s->{page_title} = $row->name . ' - Strategic Overview'; |
| 642 | | $s->{crumbs} = [ |
| 643 | | '<a href="' . $c->uri('Dex') . '">Pokédex</a>', |
| 644 | | '<a href="' . $c->uri('Dex', 'pokemon_list') . '">Pokémon</a>', |
| 645 | | '<a href="' . $c->uri('Dex', 'pokemon', lc $row->name) . '">' . $row->name . '</a>' |
| 646 | | ]; |
| 647 | | |
| 648 | | $s->{template} = 'dex/page/pokemon/strategery.tt'; |
| 649 | | } |
| 650 | | |