RCP/Database/Result/Item.pm

filter: Statementstmt 100% 37 / 37 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 42 / 42 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« RCP/Database/Result/HazardWithFlag.pm ↑ Summary RCP/Database/Result/ItemCategory.pm »
1 package Games::Framework::RCP::Database::Result::Item;
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.23';
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('items');
12 3 __PACKAGE__->add_columns(
13 id_item => {
14 data_type => 'integer',
15 is_nullable => 0,
16 is_auto_increment => 1,
17 comments => 'ID of the item.',
18 extra => {unsigned => 1},
19 },
20 name => {
21 data_type => 'varchar',
22 size => 64,
23 is_nullable => 0,
24 comments => 'Name of the item.',
25 },
26 ammo => {
27 data_type => 'integer',
28 is_nullable => 1,
29 default_value => 1,
30 comments => 'How many uses of the item are available?',
31 },
32 fkey_item_usage => {
33 data_type => 'integer',
34 is_nullable => 0,
35 comments => 'ID of the item usage.',
36 extra => {unsigned => 1},
37 },
38 fkey_item_category => {
39 data_type => 'integer',
40 is_nullable => 1,
41 default_value => undef,
42 comments => 'ID of the item category.',
43 extra => {unsigned => 1},
44 },
45 power => {
46 data_type => 'varchar',
47 size => 8,
48 is_nullable => 1,
49 comments => 'Power of the item. Not all have power.',
50 },
51 description => {
52 data_type => 'varchar',
53 size => 256,
54 is_nullable => 0,
55 comments => 'Description of the item.',
56 },
57 cooldown => {
58 data_type => 'integer',
59 is_nullable => 1,
60 default_value => undef,
61 comments => 'How long one must wait before using the item again.',
62 },
63 );
64  
65 3 __PACKAGE__->utf8_columns(qw/name description power/);
66 3 __PACKAGE__->set_primary_key('id_item');
67 3 __PACKAGE__->add_unique_constraint(['name']);
68  
69 3 __PACKAGE__->belongs_to(item_usage => 'Games::Framework::RCP::Database::Result::ItemUsage', 'fkey_item_usage');
70  
71 3 __PACKAGE__->belongs_to(item_category => 'Games::Framework::RCP::Database::Result::ItemCategory', 'fkey_item_category');
72  
73 3 __PACKAGE__->has_many(combined_items => 'Games::Framework::RCP::Database::Result::CombinedItem', 'fkey_item');
74 3 __PACKAGE__->has_many(original_item_1 => 'Games::Framework::RCP::Database::Result::CombinedItem', 'fkey_item_part_1');
75 3 __PACKAGE__->has_many(original_item_2 => 'Games::Framework::RCP::Database::Result::CombinedItem', 'fkey_item_part_2');
76  
77 3 __PACKAGE__->has_many(items_with_stats => 'Games::Framework::RCP::Database::Result::ItemWithStat', 'fkey_item');
78 3 __PACKAGE__->many_to_many(item_stats => 'items_with_stats', 'items');
79  
80 3 __PACKAGE__->has_many(items_with_statuses => 'Games::Framework::RCP::Database::Result::ItemWithStatus', 'fkey_item');
81 3 __PACKAGE__->many_to_many(status_effects => 'items_with_statuses', 'items');
82  
83 3 __PACKAGE__->has_many(character_inventories => 'Games::Framework::RCP::Database::Result::CharacterInventory', 'fkey_item');
84 3 __PACKAGE__->many_to_many(characters => 'character_inventories', 'items');
85  
86 3 __PACKAGE__->has_many(combatant_inventories => 'Games::Framework::RCP::Database::Result::CombatantInventory', 'fkey_item');
87 3 __PACKAGE__->many_to_many(combatants => 'combatant_inventories', 'items');
88  
89 3 __PACKAGE__->has_many(combatant_equip_histories => 'Games::Framework::RCP::Database::Result::CombatantEquipHistory', 'fkey_item');
90 3 __PACKAGE__->many_to_many(equip_histories => 'combatant_equip_histories', 'combatants');
91  
92 3 __PACKAGE__->has_many(floor_items => 'Games::Framework::RCP::Database::Result::FloorItem', 'fkey_item');
93  
94 2 ▶sub sqlt_deploy_hook {
Subroutine sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod documented
95 2 my ($self, $sqlt_table) = @_;
96
97 2 $sqlt_table->options({ENGINE => 'InnoDB'});
98 2 $sqlt_table->options({CHARSET => 'UTF8'});
99 2 $sqlt_table->comments('Every single item available in the game.');
100 }
101  
102 3 1;
103  
104 __END__
« RCP/Database/Result/HazardWithFlag.pm ↑ Summary RCP/Database/Result/ItemCategory.pm »