--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/07/22 12:18:02 1.62 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2006/07/23 08:58:44 1.64 @@ -244,7 +244,7 @@ $::STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); $::STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); - $::STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); + $self->update_weight; $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$RES_TBL{$_}}) for keys %RES_TBL; @@ -604,7 +604,7 @@ $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/\2<\/span>/g; $self->{logview}->add_paragraph ($color[$color], $_) - for map "$time $_", split /\n/, $text; + for map "$time $_", split /\n/, $text; $self->{logview}->scroll_to_bottom; $self->{statusbox}->add ($text, @@ -834,7 +834,19 @@ sub player_update { my ($self, $player) = @_; - $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); + + $self->update_weight; +} + +sub update_weight { + my ($self) = @_; + + my $weight = .001 * $self->{player}{weight}; + my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; + + $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); + $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); + $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); } sub update_server_info { @@ -914,11 +926,14 @@ force_h => $::HEIGHT * 0.7, title => "NPC Dialog", kw => { hi => 0, yes => 0, no => 0 }, + has_close_button => 1, @_, ); Scalar::Util::weaken (my $this = $self); + $self->connect (delete => sub { $this->destroy; 1 }); + # better use a pane... $self->add (my $hbox = new CFClient::UI::HBox); $hbox->add ($self->{textview} = new CFClient::UI::TextScroller expand => 1); @@ -949,7 +964,7 @@ $self->{bye_button} = new CFClient::UI::Button text => "Bye (close)", tooltip => "Use this button to end talking to the NPC. This also closes the dialog window.", - on_activate => sub { $this->destroy; 0 }, + on_activate => sub { $this->destroy; 1 }, ; $self->update_options;