… | |
… | |
78 | }; |
78 | }; |
79 | |
79 | |
80 | cf::register_command body => sub { |
80 | cf::register_command body => sub { |
81 | my ($ob) = @_; |
81 | my ($ob) = @_; |
82 | |
82 | |
|
|
83 | my $observe = $ob->contr->observe; |
|
|
84 | |
83 | # Too hard to try and make a header that lines everything up, so just |
85 | # Too hard to try and make a header that lines everything up, so just |
84 | # give a description. (comment from C++) |
86 | # give a description. (comment from C++) |
85 | my $reply = |
87 | my $reply = |
86 | "The first column is the name of the body location.\r" |
88 | "The first column is the name of the body location.\r" |
87 | . "The second column is how many of those locations your body has.\r" |
89 | . "The second column is how many of those locations your body has.\r" |
… | |
… | |
89 | . "The last column shows the items currently using the slot\n\n"; |
91 | . "The last column shows the items currently using the slot\n\n"; |
90 | |
92 | |
91 | # first process all applied items and hash them into their slots |
93 | # first process all applied items and hash them into their slots |
92 | my @slot; |
94 | my @slot; |
93 | |
95 | |
94 | for my $item (grep $_->flag (cf::FLAG_APPLIED), $ob->inv) { |
96 | for my $item (grep $_->flag (cf::FLAG_APPLIED), $observe->inv) { |
95 | $item->slot_info ($_) |
97 | $item->slot_info ($_) |
96 | and push @{ $slot[$_] }, $item |
98 | and push @{ $slot[$_] }, $item |
97 | for 0 .. cf::NUM_BODY_LOCATIONS-1; |
99 | for 0 .. cf::NUM_BODY_LOCATIONS-1; |
98 | } |
100 | } |
99 | |
101 | |
… | |
… | |
101 | for (0 .. cf::NUM_BODY_LOCATIONS - 1) { |
103 | for (0 .. cf::NUM_BODY_LOCATIONS - 1) { |
102 | my $msg = cf::object::slot_nonuse_name $_; |
104 | my $msg = cf::object::slot_nonuse_name $_; |
103 | $msg =~ s/^.*? a //; |
105 | $msg =~ s/^.*? a //; |
104 | $reply .= sprintf " %-20s %3d %5d %s\n", |
106 | $reply .= sprintf " %-20s %3d %5d %s\n", |
105 | $msg, |
107 | $msg, |
106 | $ob->slot_info ($_), |
108 | $observe->slot_info ($_), |
107 | $ob->slot_used ($_), |
109 | $observe->slot_used ($_), |
108 | join ", ", map $_->query_short_name, @{ $slot[$_] } |
110 | join ", ", map $_->query_short_name, @{ $slot[$_] } |
109 | if $ob->slot_info ($_) || $ob->slot_used ($_); |
111 | if $observe->slot_info ($_) || $observe->slot_used ($_); |
110 | } |
112 | } |
111 | |
113 | |
112 | $reply .= "You are not allowed to wear armor\r" |
114 | $reply .= "You are not allowed to wear armor\r" |
113 | unless $ob->flag (cf::FLAG_USE_ARMOUR); |
115 | unless $observe->flag (cf::FLAG_USE_ARMOUR); |
114 | $reply .= "You are not allowed to use weapons\r" |
116 | $reply .= "You are not allowed to use weapons\r" |
115 | unless $ob->flag (cf::FLAG_USE_WEAPON); |
117 | unless $observe->flag (cf::FLAG_USE_WEAPON); |
116 | |
118 | |
117 | $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY); |
119 | $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY | cf::NDI_CLEAR); |
118 | }; |
120 | }; |
119 | |
121 | |
120 | cf::register_command mark => sub { |
122 | cf::register_command mark => sub { |
121 | my ($pl, $arg) = @_; |
123 | my ($pl, $arg) = @_; |
122 | |
124 | |