--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/05/26 18:56:14 1.1 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2006/05/27 08:45:23 1.4 @@ -3,6 +3,8 @@ use utf8; use strict; +use Crossfire::Protocol::Constants; + use CFClient::UI; use base 'Crossfire::Protocol::Base'; @@ -52,9 +54,9 @@ sub stats_update { my ($self, $stats) = @_; - if (my $exp = $stats->{Crossfire::Protocol::Base::CS_STAT_EXP64}) { + if (my $exp = $stats->{+CS_STAT_EXP64}) { my $diff = $exp - $self->{prev_exp}; - $self->{statusbox}->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5) + $::STATUSBOX->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5) if exists $self->{prev_exp} && $diff; $self->{prev_exp} = $exp; } @@ -66,7 +68,7 @@ my ($self, $command) = @_; $self->send_command ($command); - status $command; + ::status $command; } sub map_scroll { @@ -331,7 +333,7 @@ ellipsise => 0, text => $prompt); - if ($flags & Crossfire::Protocol::Base::CS_QUERY_YESNO) { + if ($flags & CS_QUERY_YESNO) { $vbox->add (my $hbox = new CFClient::UI::HBox); $hbox->add (new CFClient::UI::Button text => "No", @@ -351,7 +353,7 @@ $dialog->focus_in; - } elsif ($flags & Crossfire::Protocol::Base::CS_QUERY_SINGLECHAR) { + } elsif ($flags & CS_QUERY_SINGLECHAR) { $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; $vbox->add (my $entry = new CFClient::UI::Entry connect_changed => sub { @@ -366,7 +368,7 @@ $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)"; $vbox->add (my $entry = new CFClient::UI::Entry - $flags & Crossfire::Protocol::Base::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), + $flags & CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), connect_activate => sub { $self->send ("reply $_[1]"); $dialog->destroy; @@ -407,7 +409,7 @@ $self->{logview}->add_paragraph ($color[$color], join "\n", map "$time $_", split /\n/, $text); - $self->{statusbox}->add ($text, + $::STATUSBOX->add ($text, group => $text, fg => $color[$color], timeout => 10, @@ -489,14 +491,14 @@ $self->send ("requestinfo image_sums $face $face"); - $self->{statusbox}->add (CFClient::UI::Label::escape "prefetching $todo", + $::STATUSBOX->add (CFClient::UI::Label::escape "prefetching $todo", group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); } elsif (!exists $self->{num_faces}) { $self->send ("requestinfo image_info"); $self->{num_faces} = 0; - $self->{statusbox}->add (CFClient::UI::Label::escape "starting to prefetch", + $::STATUSBOX->add (CFClient::UI::Label::escape "starting to prefetch", group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); } } @@ -604,10 +606,10 @@ CFClient::Item::update_widgets $item; - if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & Crossfire::Protocol::Base::F_OPEN)) { + if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { set_opencont ($::CONN, 0, "Floor"); - } elsif ($item->{flags} & Crossfire::Protocol::Base::F_OPEN) { + } elsif ($item->{flags} & F_OPEN) { set_opencont ($::CONN, $item->{tag}, CFClient::Item::desc_string $item); } else { if ($item->{container} == 0) { @@ -619,4 +621,9 @@ } } +sub player_update { + my ($self, $player) = @_; + $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); +} + 1;