… | |
… | |
39 | map ["$cmd$_", $text], |
39 | map ["$cmd$_", $text], |
40 | sort { (length $a) <=> (length $b) } |
40 | sort { (length $a) <=> (length $b) } |
41 | @args |
41 | @args |
42 | } sort { $a->{par} <=> $b->{par} } |
42 | } sort { $a->{par} <=> $b->{par} } |
43 | CFPlus::Pod::find command => "*"; |
43 | CFPlus::Pod::find command => "*"; |
|
|
44 | |
|
|
45 | $self->connect_ext (event_capabilities => sub { |
|
|
46 | my ($cap) = @_; |
|
|
47 | |
|
|
48 | if (my $ts = $cap->{tileset}) { |
|
|
49 | if (my ($default) = grep $_->[2] & 1, @$ts) { |
|
|
50 | $self->{tileset} = $default; |
|
|
51 | $self->{tilesize} = $default->[3]; |
|
|
52 | $self->setup_req (tileset => $default->[0]); |
|
|
53 | |
|
|
54 | my $w = int $self->{mapw} * 32 / $self->{tilesize}; |
|
|
55 | my $h = int $self->{maph} * 32 / $self->{tilesize}; |
|
|
56 | |
|
|
57 | $self->setup_req (mapsize => "${w}x${h}"); |
|
|
58 | } |
|
|
59 | } |
|
|
60 | }); |
44 | |
61 | |
45 | $self->{map_widget}->add_command (@$_) |
62 | $self->{map_widget}->add_command (@$_) |
46 | for @cmd_help; |
63 | for @cmd_help; |
47 | |
64 | |
48 | $self->{noface} = new_from_file CFPlus::Texture |
65 | $self->{noface} = new_from_file CFPlus::Texture |
… | |
… | |
628 | [0.75, 0.61, 0.20], |
645 | [0.75, 0.61, 0.20], |
629 | [0.99, 0.77, 0.26], |
646 | [0.99, 0.77, 0.26], |
630 | [0.74, 0.65, 0.41], |
647 | [0.74, 0.65, 0.41], |
631 | ); |
648 | ); |
632 | |
649 | |
|
|
650 | my $fg = $color[$color % @color]; |
|
|
651 | |
633 | $self->logprint ("info: ", $text); |
652 | $self->logprint ("info: ", $text); |
634 | |
653 | |
635 | # try to create single paragraphs of multiple lines sent by the server |
654 | # try to create single paragraphs of multiple lines sent by the server |
636 | $text =~ s/(?<=\S)\n(?=\w)/ /g; |
655 | $text =~ s/(?<=\S)\n(?=\w)/ /g; |
637 | |
656 | |
638 | $text = CFPlus::asxml $text; |
657 | $text = CFPlus::asxml $text; |
639 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
658 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
640 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
659 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
641 | |
660 | |
642 | ::message ({ fg => $color[$color], markup => $_ }) |
661 | ::message ({ fg => $fg, markup => $_ }) |
643 | for split /\n/, $text; |
662 | for split /\n/, $text; |
644 | |
663 | |
645 | $self->{statusbox}->add ($text, |
664 | $self->{statusbox}->add ($text, |
646 | group => $text, |
665 | group => $text, |
647 | fg => $color[$color], |
666 | fg => $fg, |
648 | timeout => $color >= 2 ? 180 : 10, |
667 | timeout => $color >= 2 ? 180 : 10, |
649 | tooltip_font => $::FONT_FIXED, |
668 | tooltip_font => $::FONT_FIXED, |
650 | ); |
669 | ); |
651 | } |
670 | } |
652 | |
671 | |
… | |
… | |
677 | } |
696 | } |
678 | |
697 | |
679 | sub setup { |
698 | sub setup { |
680 | my ($self, $setup) = @_; |
699 | my ($self, $setup) = @_; |
681 | |
700 | |
|
|
701 | $self->{map_widget}->set_tilesize ($self->{tilesize}); |
682 | $::MAP->resize ($self->{mapw}, $self->{maph}); |
702 | $::MAP->resize ($self->{mapw}, $self->{maph}); |
683 | } |
703 | } |
684 | |
704 | |
685 | sub addme_success { |
705 | sub addme_success { |
686 | my ($self) = @_; |
706 | my ($self) = @_; |
… | |
… | |
926 | |
946 | |
927 | $self->update_server_info; |
947 | $self->update_server_info; |
928 | |
948 | |
929 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
949 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
930 | $self->send_command ("output-count $::CFG->{output_count}"); |
950 | $self->send_command ("output-count $::CFG->{output_count}"); |
|
|
951 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
931 | $self->send_command ("pickup $::CFG->{pickup}"); |
952 | $self->send_command ("pickup $::CFG->{pickup}"); |
932 | } |
953 | } |
933 | |
954 | |
934 | sub buildat { |
955 | sub buildat { |
935 | my ($self, $builditem, $x, $y) = @_; |
956 | my ($self, $builditem, $x, $y) = @_; |