| 1 | package Games::Framework::RCP::Database::Result::Move; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | our $VERSION = '0.22'; | |
| 7 | |||
| 8 | 3 | ▶ | use base qw/DBIx::Class/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | __PACKAGE__->load_components(qw/UTF8Columns Core/); | |
| 11 | 3 | __PACKAGE__->table('moves'); | |
| 12 | 3 | __PACKAGE__->add_columns( | |
| 13 | id_move => { | ||
| 14 | data_type => 'integer', | ||
| 15 | is_nullable => 0, | ||
| 16 | is_auto_increment => 1, | ||
| 17 | comments => 'ID of the move.', | ||
| 18 | extra => {unsigned => 1}, | ||
| 19 | }, | ||
| 20 | name => { | ||
| 21 | data_type => 'varchar', | ||
| 22 | size => 64, | ||
| 23 | is_nullable => 0, | ||
| 24 | comments => 'Name of the move.', | ||
| 25 | }, | ||
| 26 | fkey_move_type => { | ||
| 27 | data_type => 'integer', | ||
| 28 | is_nullable => 0, | ||
| 29 | comments => 'ID of the move type.', | ||
| 30 | extra => {unsigned => 1}, | ||
| 31 | }, | ||
| 32 | power => { | ||
| 33 | data_type => 'varchar', | ||
| 34 | size => 8, | ||
| 35 | is_nullable => 1, | ||
| 36 | comments => 'Power of the move. Not all have power.', | ||
| 37 | }, | ||
| 38 | warmup => { | ||
| 39 | data_type => 'integer', | ||
| 40 | is_nullable => 1, | ||
| 41 | default_value => undef, | ||
| 42 | comments => 'How long before the move can be used to start?', | ||
| 43 | }, | ||
| 44 | cooldown => { | ||
| 45 | data_type => 'integer', | ||
| 46 | is_nullable => 1, | ||
| 47 | default_value => undef, | ||
| 48 | comments => 'How long before the move can be used again?', | ||
| 49 | }, | ||
| 50 | description => { | ||
| 51 | data_type => 'varchar', | ||
| 52 | size => 256, | ||
| 53 | is_nullable => 0, | ||
| 54 | comments => 'Description of the move.', | ||
| 55 | }, | ||
| 56 | ); | ||
| 57 | |||
| 58 | 3 | __PACKAGE__->utf8_columns(qw/name description power/); | |
| 59 | 3 | __PACKAGE__->set_primary_key('id_move'); | |
| 60 | 3 | __PACKAGE__->add_unique_constraint(['name']); | |
| 61 | |||
| 62 | 3 | __PACKAGE__->belongs_to(move_types => 'Games::Framework::RCP::Database::Result::MoveType', 'fkey_move_type'); | |
| 63 | |||
| 64 | 3 | __PACKAGE__->has_many(moves_with_flags => 'Games::Framework::RCP::Database::Result::MoveWithFlag', 'fkey_move'); | |
| 65 | 3 | __PACKAGE__->many_to_many(move_flags => 'moves_with_flags', 'moves'); | |
| 66 | |||
| 67 | 3 | __PACKAGE__->has_many(moves_with_costs => 'Games::Framework::RCP::Database::Result::MoveWithCost', 'fkey_move'); | |
| 68 | 3 | __PACKAGE__->many_to_many(move_costs => 'moves_with_costs', 'moves'); | |
| 69 | |||
| 70 | 3 | __PACKAGE__->has_many(class_moves => 'Games::Framework::RCP::Database::Result::ClassMove', 'fkey_move'); | |
| 71 | 3 | __PACKAGE__->many_to_many(classes => 'class_moves', 'moves'); | |
| 72 | |||
| 73 | 3 | __PACKAGE__->has_many(char_cooldowns => 'Games::Framework::RCP::Database::Result::CharCooldown', 'fkey_move'); | |
| 74 | 3 | __PACKAGE__->many_to_many(characters => 'char_cooldowns', 'moves'); | |
| 75 | |||
| 76 | 3 | __PACKAGE__->has_many(character_moves => 'Games::Framework::RCP::Database::Result::CharacterMove', 'fkey_move'); | |
| 77 | |||
| 78 | 2 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
documented
| |||
| 79 | 2 | my ($self, $sqlt_table) = @_; | |
| 80 | |||
| 81 | 2 | $sqlt_table->options({ENGINE => 'InnoDB'}); | |
| 82 | 2 | $sqlt_table->options({CHARSET => 'UTF8'}); | |
| 83 | 2 | $sqlt_table->comments('Every single move available in the game.'); | |
| 84 | } | ||
| 85 | |||
| 86 | 3 | 1; | |
| 87 | |||
| 88 | __END__ | ||