--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/12/09 02:21:25 1.91 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2007/04/04 02:43:30 1.95 @@ -42,6 +42,23 @@ } sort { $a->{par} <=> $b->{par} } CFPlus::Pod::find command => "*"; + $self->connect_ext (event_capabilities => sub { + my ($cap) = @_; + + if (my $ts = $cap->{tileset}) { + if (my ($default) = grep $_->[2] & 1, @$ts) { + $self->{tileset} = $default; + $self->{tilesize} = $default->[3]; + $self->setup_req (tileset => $default->[0]); + + my $w = int $self->{mapw} * 32 / $self->{tilesize}; + my $h = int $self->{maph} * 32 / $self->{tilesize}; + + $self->setup_req (mapsize => "${w}x${h}"); + } + } + }); + $self->{map_widget}->add_command (@$_) for @cmd_help; @@ -630,6 +647,8 @@ [0.74, 0.65, 0.41], ); + my $fg = $color[$color % @color]; + $self->logprint ("info: ", $text); # try to create single paragraphs of multiple lines sent by the server @@ -639,12 +658,12 @@ $text =~ s/\[b\](.*?)\[\/b\]/\1<\/b>/g; $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/\2<\/span>/g; - ::message ({ fg => $color[$color], markup => $_ }) + ::message ({ fg => $fg, markup => $_ }) for split /\n/, $text; $self->{statusbox}->add ($text, group => $text, - fg => $color[$color], + fg => $fg, timeout => $color >= 2 ? 180 : 10, tooltip_font => $::FONT_FIXED, ); @@ -679,6 +698,7 @@ sub setup { my ($self, $setup) = @_; + $self->{map_widget}->set_tilesize ($self->{tilesize}); $::MAP->resize ($self->{mapw}, $self->{maph}); } @@ -928,6 +948,7 @@ $self->send_command ("output-sync $::CFG->{output_sync}"); $self->send_command ("output-count $::CFG->{output_count}"); + $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; $self->send_command ("pickup $::CFG->{pickup}"); } @@ -989,7 +1010,7 @@ @_, ); - Scalar::Util::weaken (my $this = $self); + CFPlus::weaken (my $this = $self); $self->connect (delete => sub { $this->destroy; 1 }); @@ -1043,7 +1064,7 @@ sub update_options { my ($self) = @_; - Scalar::Util::weaken $self; + CFPlus::weaken $self; $self->{options}->clear; $self->{options}->add ($self->{bye_button}); @@ -1062,7 +1083,7 @@ sub feed { my ($self, $msg) = @_; - Scalar::Util::weaken $self; + CFPlus::weaken $self; if ($msg->{msgtype} eq "reply") { $self->{kw}{$_} = 1 for @{$msg->{add_topics} || []};