… | |
… | |
83 | # Too hard to try and make a header that lines everything up, so just |
83 | # Too hard to try and make a header that lines everything up, so just |
84 | # give a description. (comment from C++) |
84 | # give a description. (comment from C++) |
85 | my $reply = |
85 | my $reply = |
86 | "The first column is the name of the body location.\r" |
86 | "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" |
87 | . "The second column is how many of those locations your body has.\r" |
88 | . "The third column is how many slots in that location are available.\n\n"; |
88 | . "The third column is how many slots in that location are available.\r" |
|
|
89 | . "The last column shows the items currently using the slot\n\n"; |
89 | |
90 | |
|
|
91 | # first process all applied items and hash them into their slots |
|
|
92 | my @slot; |
|
|
93 | |
|
|
94 | for my $item (grep $_->flag (cf::FLAG_APPLIED), $ob->inv) { |
|
|
95 | $item->slot_info ($_) |
|
|
96 | and push @{ $slot[$_] }, $item |
|
|
97 | for 0 .. cf::NUM_BODY_LOCATIONS-1; |
|
|
98 | } |
|
|
99 | |
90 | $reply .= sprintf " %-20s %3s %5s\n", "Location", "You", "Avail"; |
100 | $reply .= sprintf " %-20s %3s %5s %s\n", "Location", "You", "Avail", "What"; |
91 | for (0 .. cf::NUM_BODY_LOCATIONS - 1) { |
101 | for (0 .. cf::NUM_BODY_LOCATIONS - 1) { |
92 | my $msg = cf::object::slot_nonuse_name $_; |
102 | my $msg = cf::object::slot_nonuse_name $_; |
93 | $msg =~ s/^.*? a //; |
103 | $msg =~ s/^.*? a //; |
94 | $reply .= sprintf " %-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_) |
104 | $reply .= sprintf " %-20s %3d %5d %s\n", |
|
|
105 | $msg, |
|
|
106 | $ob->slot_info ($_), |
|
|
107 | $ob->slot_used ($_), |
|
|
108 | join ", ", map $_->query_short_name, @{ $slot[$_] } |
95 | if $ob->slot_info ($_) or $ob->slot_used ($_); |
109 | if $ob->slot_info ($_) || $ob->slot_used ($_); |
96 | } |
110 | } |
97 | |
111 | |
98 | $reply .= "You are not allowed to wear armor\r" |
112 | $reply .= "You are not allowed to wear armor\r" |
99 | unless $ob->flag (cf::FLAG_USE_ARMOUR); |
113 | unless $ob->flag (cf::FLAG_USE_ARMOUR); |
100 | $reply .= "You are not allowed to use weapons\r" |
114 | $reply .= "You are not allowed to use weapons\r" |