… | |
… | |
15 | |
15 | |
16 | my $self = $class->SUPER::new (@_); |
16 | my $self = $class->SUPER::new (@_); |
17 | |
17 | |
18 | $self->{map_widget}->clr_commands; |
18 | $self->{map_widget}->clr_commands; |
19 | |
19 | |
20 | my $pod = CFClient::load_pod CFClient::find_rcfile "pod/command_help.pod"; |
20 | my $cmd_help = CFClient::load_pod CFClient::find_rcfile "pod/command_help.pod", command_help => 1, sub { |
|
|
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; |
… | |
… | |
459 | } |
468 | } |
460 | |
469 | |
461 | sub addme_success { |
470 | sub addme_success { |
462 | my ($self) = @_; |
471 | my ($self) = @_; |
463 | |
472 | |
464 | my $pod = CFClient::load_pod CFClient::find_rcfile "pod/skill_help.pod"; |
473 | my $skill_help = CFClient::load_pod CFClient::find_rcfile "pod/skill_help.pod", skill_help => 1, sub { |
|
|
474 | my ($pom) = @_; |
465 | |
475 | |
466 | my %skill_tooltip; |
476 | my %skill_help; |
467 | |
477 | |
468 | for my $head2 ($pod->head1->[-2]->head2) { |
478 | for my $head2 ($pom->head1->[3]->head2) { |
469 | $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 |
470 | } |
483 | }; |
471 | |
484 | |
472 | for my $skill (values %{$self->{skill_info}}) { |
485 | for my $skill (values %{$self->{skill_info}}) { |
473 | $self->{map_widget}->add_command ("ready_skill $skill", |
486 | $self->{map_widget}->add_command ("ready_skill $skill", |
474 | (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n") |
487 | (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n") |
475 | . $skill_tooltip{$skill}); |
488 | . $skill_help->{$skill}); |
476 | $self->{map_widget}->add_command ("use_skill $skill", |
489 | $self->{map_widget}->add_command ("use_skill $skill", |
477 | (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n") |
490 | (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n") |
478 | . $skill_tooltip{$skill}); |
491 | . $skill_help->{$skill}); |
479 | } |
492 | } |
480 | } |
493 | } |
481 | |
494 | |
482 | sub eof { |
495 | sub eof { |
483 | my ($self) = @_; |
496 | my ($self) = @_; |