ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.17 by root, Sat Jun 3 02:39:27 2006 UTC vs.
Revision 1.21 by root, Mon Jun 5 21:10:04 2006 UTC

3use utf8; 3use utf8;
4use strict; 4use strict;
5 5
6use Crossfire::Protocol::Constants; 6use Crossfire::Protocol::Constants;
7 7
8use CFClient;
8use CFClient::UI; 9use CFClient::UI;
9 10
10use base 'Crossfire::Protocol::Base'; 11use base 'Crossfire::Protocol::Base';
11 12
12sub new { 13sub new {
14 15
15 my $self = $class->SUPER::new (@_); 16 my $self = $class->SUPER::new (@_);
16 17
17 $self->{map_widget}->clr_commands; 18 $self->{map_widget}->clr_commands;
18 19
19 my $parser = new Pod::POM; 20 my $cmd_help = CFClient::load_pod CFClient::find_rcfile "pod/command_help.pod", command_help => 1, sub {
20 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); 21 my ($pom) = @_;
21 22
23 my @cmd_help;
24
22 for my $head2 ($pod->head1->[-2]->head2) { 25 for my $head2 ($pom->head1->[-2]->head2) {
23 $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x 26 $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
24 or next; 27 or next;
25 28
26 my $cmd = $1; 29 my $cmd = $1;
27 my @args = split /\|/, $2; 30 my @args = split /\|/, $2;
28 @args = (".*") unless @args; 31 @args = (".*") unless @args;
29 32
30 $_ = $_ eq ".*" ? "" : " $_" 33 $_ = $_ eq ".*" ? "" : " $_"
31 for @args; 34 for @args;
32 35
33 my $text = CFClient::pod_to_pango $head2->content; 36 my $text = CFClient::pod_to_pango $head2->content;
34 37
35 $self->{map_widget}->add_command ("$cmd$_", $text) 38 push @cmd_help, ["$cmd$_", $text]
36 for sort { (length $a) <=> (length $b) } 39 for sort { (length $a) <=> (length $b) }
37 @args; 40 @args;
41 }
42
43 \@cmd_help
38 } 44 };
45
46 $self->{map_widget}->add_command (@$_)
47 for @$cmd_help;
39 48
40 $self->{noface} = new_from_file CFClient::Texture 49 $self->{noface} = new_from_file CFClient::Texture
41 CFClient::find_rcfile "noface.png", minify => 1, mipmap => 1; 50 CFClient::find_rcfile "noface.png", minify => 1, mipmap => 1;
42 51
43 $self->{open_container} = 0; 52 $self->{open_container} = 0;
429 join "\n", map "$time $_", split /\n/, $text); 438 join "\n", map "$time $_", split /\n/, $text);
430 439
431 $self->{statusbox}->add ($text, 440 $self->{statusbox}->add ($text,
432 group => $text, 441 group => $text,
433 fg => $color[$color], 442 fg => $color[$color],
434 timeout => 10, 443 timeout => $color >= 2 ? 60 : 10,
435 tooltip_font => $::FONT_FIXED, 444 tooltip_font => $::FONT_FIXED,
436 ); 445 );
437} 446}
438 447
439sub drawextinfo { 448sub drawextinfo {
459} 468}
460 469
461sub addme_success { 470sub addme_success {
462 my ($self) = @_; 471 my ($self) = @_;
463 472
464 my $parser = new Pod::POM; 473 my $skill_help = CFClient::load_pod CFClient::find_rcfile "pod/skill_help.pod", skill_help => 1, sub {
465 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); 474 my ($pom) = @_;
466 475
467 my %skill_tooltip; 476 my %skill_help;
468 477
469 for my $head2 ($pod->head1->[-2]->head2) { 478 for my $head2 ($pom->head1->[3]->head2) {
470 $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; 479 $skill_help{$head2->title} = CFClient::pod_to_pango $head2->content;
480 }
481
482 \%skill_help
471 } 483 };
472 484
473 for my $skill (values %{$self->{skill_info}}) { 485 for my $skill (values %{$self->{skill_info}}) {
474 $self->{map_widget}->add_command ("ready_skill $skill", 486 $self->{map_widget}->add_command ("ready_skill $skill",
475 (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n") 487 (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n")
476 . $skill_tooltip{$skill}); 488 . $skill_help->{$skill});
477 $self->{map_widget}->add_command ("use_skill $skill", 489 $self->{map_widget}->add_command ("use_skill $skill",
478 (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n") 490 (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n")
479 . $skill_tooltip{$skill}); 491 . $skill_help->{$skill});
480 } 492 }
481} 493}
482 494
483sub eof { 495sub eof {
484 my ($self) = @_; 496 my ($self) = @_;
509 my ($face) = splice @{ $self->{face_prefetch} }, + rand @{ $self->{face_prefetch} }, 1, (); 521 my ($face) = splice @{ $self->{face_prefetch} }, + rand @{ $self->{face_prefetch} }, 1, ();
510 522
511 $self->send ("requestinfo image_sums $face $face"); 523 $self->send ("requestinfo image_sums $face $face");
512 524
513 $self->{statusbox}->add (CFClient::UI::Label::escape "prefetching $todo", 525 $self->{statusbox}->add (CFClient::UI::Label::escape "prefetching $todo",
514 group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); 526 group => "prefetch", timeout => 3, fg => [1, 1, 0, 0.5]);
515 } elsif (!exists $self->{num_faces}) { 527 } elsif (!exists $self->{num_faces}) {
516 $self->send ("requestinfo image_info"); 528 $self->send ("requestinfo image_info");
517 529
518 $self->{num_faces} = 0; 530 $self->{num_faces} = 0;
519 531
520 $self->{statusbox}->add (CFClient::UI::Label::escape "starting to prefetch", 532 $self->{statusbox}->add (CFClient::UI::Label::escape "starting to prefetch",
521 group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); 533 group => "prefetch", timeout => 3, fg => [1, 1, 0, 0.5]);
522 } 534 }
523} 535}
524 536
525sub update_floorbox { 537sub update_floorbox {
526 $CFClient::UI::ROOT->on_refresh ($::FLOORBOX => sub { 538 $CFClient::UI::ROOT->on_refresh ($::FLOORBOX => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines