--- deliantra/Deliantra-Client/DC.pm 2006/05/31 07:40:33 1.83 +++ deliantra/Deliantra-Client/DC.pm 2006/05/31 12:44:17 1.84 @@ -206,6 +206,8 @@ use strict; use Crossfire::Protocol::Constants; +my $last_enter_count = 1; + sub desc_string { my ($self) = @_; @@ -240,19 +242,40 @@ $weight < 0 ? "?" : $weight * 0.001 } +sub do_n_dialog { + my ($cb) = @_; + + my $w = new CFClient::UI::FancyFrame; + $w->add (my $vb = new CFClient::UI::VBox x => "center", y => "center"); + $vb->add (new CFClient::UI::Label text => "Enter item count:"); + $vb->add (my $entry = new CFClient::UI::Entry + text => $last_enter_count, + on_activate => sub { + my ($entry) = @_; + $last_enter_count = $entry->get_text; + $cb->($last_enter_count); + $w->hide; + $w = undef; + } + ); + $entry->focus_in; + $w->show; + +} + sub update_widgets { my ($self) = @_; my $button_cb = sub { my (undef, $ev, $x, $y) = @_; - if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) { - my $targ = $::CONN->{player}{tag}; + my $targ = $::CONN->{player}{tag}; - if ($self->{container} == $::CONN->{player}{tag}) { - $targ = $::CONN->{open_container}; - } + if ($self->{container} == $::CONN->{player}{tag}) { + $targ = $::CONN->{open_container}; + } + if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) { $::CONN->send ("move $targ $self->{tag} 0") if $targ || !($self->{flags} & F_LOCKED); } elsif ($ev->{button} == 1) { @@ -272,6 +295,11 @@ : ( ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }], ["drop", sub { $::CONN->send ("move $::CONN->{open_container} $self->{tag} 0") }], + ["move n", + sub { + do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") }) + } + ] ) ), );