--- deliantra/server/ext/doclet.ext 2012/11/10 02:41:38 1.1 +++ deliantra/server/ext/doclet.ext 2012/11/21 11:53:01 1.3 @@ -10,26 +10,38 @@ Guard::guard { delete $DOCLET{$category} } } +sub doclet($$$) { + my ($pl, $category, $item) = @_; + + if (my $cb = $DOCLET{$category}) { + $cb->($pl, $category, $item) + } else { + "No documentation found for $category/$item." + } +} + +our $SKILL_HANDLER = ext::doclet::register skill => sub { + my ($pl, $category, $name) = @_; + + my $skill = $pl->find_skill ($name); + + "B<$name>\n\n" + . ($skill ? $skill->msg : "You don't know anything about this skill.") +}; + cf::register_async_exticmd doclet => sub { - my ($ns, $reply, $category, $entry) = @_; + my ($ns, $reply, $category, $item) = @_; - cf::async { + $ns->async (sub { my $cfpod; if (my $pl = $ns->pl) { - - if (my $cb = $DOCLET{$category}) { - $cfpod = $cb->($pl, $category, $entry); - } else { - $cfpod = "No documentation found for $category/$entry."; - } - - $cfpod = $pl->expand_cfpod ($cfpod); + $cfpod = $pl->expand_cfpod (doclet $pl, $category, $item); } else { - $cfpod = "(Documentation not available before login.)"; + $cfpod = "(documentation not available before login)"; } $reply->($cfpod); - }; + }); };