|
Revision 393, 1.2 KB
(checked in by eevee, 2 years ago)
|
|
Locations mini-commit.
- Redid location pages to match the new format.
- Removed incorrect header text from Pokemon pages.
- Fixed up EncounterSet?->simplest_method to return more display-friendly data (thus merging together buckets with the same rarity), and corrected the old documentation. Also removed old inaccessible code.
- Refactored sections into their own database table.
- Refactored method-cell code into its own macro.
|
| Line | |
|---|
| 1 | package Vee::Schema::LocationEncounters; |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | use base 'DBIx::Class'; |
|---|
| 6 | |
|---|
| 7 | =head1 NAME |
|---|
| 8 | |
|---|
| 9 | Vee::Schema::LocationEncounters - DBIC class for the C<location_encounters> table |
|---|
| 10 | |
|---|
| 11 | =cut |
|---|
| 12 | |
|---|
| 13 | __PACKAGE__->load_components('Core'); |
|---|
| 14 | __PACKAGE__->table('location_encounters'); |
|---|
| 15 | __PACKAGE__->add_columns(qw/ section_id rarity version pokemon_id method min_level max_level /); |
|---|
| 16 | __PACKAGE__->set_primary_key(qw/ section_id rarity /); |
|---|
| 17 | |
|---|
| 18 | __PACKAGE__->belongs_to(pokemon => 'Vee::Schema::Pokemon', 'pokemon_id'); |
|---|
| 19 | __PACKAGE__->belongs_to(section => 'Vee::Schema::LocationSections', 'section_id'); |
|---|
| 20 | |
|---|
| 21 | =head1 METHODS |
|---|
| 22 | |
|---|
| 23 | =head2 level |
|---|
| 24 | |
|---|
| 25 | Returns this encounter's level range formatted in a human-readable way, i.e. |
|---|
| 26 | "A - B", or just "A" if the range is actually just one level. |
|---|
| 27 | |
|---|
| 28 | =cut |
|---|
| 29 | |
|---|
| 30 | sub level { |
|---|
| 31 | my ($self) = @_; |
|---|
| 32 | |
|---|
| 33 | my $level; |
|---|
| 34 | my ($min, $max) = ($self->min_level, $self->max_level); |
|---|
| 35 | |
|---|
| 36 | if ($min == $max) { |
|---|
| 37 | $level = $min; |
|---|
| 38 | } else { |
|---|
| 39 | $level = $min . ' - ' . $max; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | return $level; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | =head1 SEE ALSO |
|---|
| 46 | |
|---|
| 47 | L<Vee::Schema>, L<DBIx::Class> |
|---|
| 48 | |
|---|
| 49 | =head1 AUTHOR |
|---|
| 50 | |
|---|
| 51 | Maintainer: Alex "Eevee" Munroe (C<veekun@veekun.com>) |
|---|
| 52 | |
|---|
| 53 | See the included F<AUTHORS> file for a full list of contributers. |
|---|
| 54 | |
|---|
| 55 | =head1 LICENSE |
|---|
| 56 | |
|---|
| 57 | See the included F<LICENSE> file. |
|---|
| 58 | |
|---|
| 59 | =cut |
|---|
| 60 | |
|---|
| 61 | 1; |
|---|