--- deliantra/server/ext/commands.ext 2007/05/03 04:50:27 1.42 +++ deliantra/server/ext/commands.ext 2007/05/19 11:04:16 1.45 @@ -38,7 +38,7 @@ 1 } -sub ext::schmorp_irc::users; # HACK: TODO: replace by signal +sub ext::irc::users; # HACK: TODO: replace by signal sub who_listing(;$$) { my ($privileged, $select) = @_; @@ -75,7 +75,7 @@ . ($privileged ? " " . $pl->ns->host : "") } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl ), - eval { "* IRC: " . join ", ", ext::schmorp_irc::users }, + eval { "* IRC: " . join ", ", ext::irc::users }, ) } @@ -115,26 +115,28 @@ cf::register_command body => sub { my ($ob) = @_; - my @body_locations = ("in your range slot", "on your arm", "on your body", "on your head", - "around your neck", "in your skill slot", "on your finger", "around your shoulders", - "on your feet", "on your hands", "around your wrists", "around your waist"); - # Too hard to try and make a header that lines everything up, so just # give a description. (comment from C++) - $ob->reply (undef, "The first column is the name of the body location."); - $ob->reply (undef, "The second column is how many of those locations your body has."); - $ob->reply (undef, "The third column is how many slots in that location are available."); - - for (0 .. scalar @body_locations - 1) { - $ob->reply (undef, (sprintf "%-30s %5d %5d", $body_locations[$_], $ob->body_info($_), $ob->body_used($_))) - if $ob->body_info($_) or $ob->body_used($_); + my $reply = + "The first column is the name of the body location.\n" + . "The second column is how many of those locations your body has.\n" + . "The third column is how many slots in that location are available.\n"; + + $reply .= sprintf "%-20s %3s %5s\n", "Location", "You", "Avail"; + for (0 .. cf::NUM_BODY_LOCATIONS - 1) { + my $msg = cf::object::slot_nonuse_name $_; + $msg =~ s/^.*? a //; + $reply .= sprintf "%-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_) + if $ob->slot_info ($_) or $ob->slot_used ($_); } - $ob->reply (undef, "You are not allowed to wear armor") + $reply .= "You are not allowed to wear armor\n" unless $ob->flag (cf::FLAG_USE_ARMOUR); - $ob->reply (undef, "You are not allowed to use weapons") + $reply .= "You are not allowed to use weapons\n" unless $ob->flag (cf::FLAG_USE_WEAPON); + $ob->reply (undef, $reply); + 1 };