ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.82 by root, Wed May 31 07:13:50 2006 UTC vs.
Revision 1.84 by elmex, Wed May 31 12:44:17 2006 UTC

78 use strict; 78 use strict;
79 79
80 my $recover = $BerkeleyDB::db_version >= 4.4 80 my $recover = $BerkeleyDB::db_version >= 4.4
81 ? eval "DB_REGISTER | DB_RECOVER" 81 ? eval "DB_REGISTER | DB_RECOVER"
82 : 0; 82 : 0;
83 warn $recover;
84 83
85 $DB_ENV = new BerkeleyDB::Env 84 $DB_ENV = new BerkeleyDB::Env
86 -Home => "$Crossfire::VARDIR/cfplus", 85 -Home => "$Crossfire::VARDIR/cfplus",
87 -Cachesize => 1_000_000, 86 -Cachesize => 1_000_000,
88 -ErrFile => "$Crossfire::VARDIR/cfplus/errorlog.txt", 87 -ErrFile => "$Crossfire::VARDIR/cfplus/errorlog.txt",
204 203
205package CFClient::Item; 204package CFClient::Item;
206 205
207use strict; 206use strict;
208use Crossfire::Protocol::Constants; 207use Crossfire::Protocol::Constants;
208
209my $last_enter_count = 1;
209 210
210sub desc_string { 211sub desc_string {
211 my ($self) = @_; 212 my ($self) = @_;
212 213
213 my $desc = 214 my $desc =
239 my $weight = ($self->{nrof} || 1) * $self->{weight}; 240 my $weight = ($self->{nrof} || 1) * $self->{weight};
240 241
241 $weight < 0 ? "?" : $weight * 0.001 242 $weight < 0 ? "?" : $weight * 0.001
242} 243}
243 244
245sub do_n_dialog {
246 my ($cb) = @_;
247
248 my $w = new CFClient::UI::FancyFrame;
249 $w->add (my $vb = new CFClient::UI::VBox x => "center", y => "center");
250 $vb->add (new CFClient::UI::Label text => "Enter item count:");
251 $vb->add (my $entry = new CFClient::UI::Entry
252 text => $last_enter_count,
253 on_activate => sub {
254 my ($entry) = @_;
255 $last_enter_count = $entry->get_text;
256 $cb->($last_enter_count);
257 $w->hide;
258 $w = undef;
259 }
260 );
261 $entry->focus_in;
262 $w->show;
263
264}
265
244sub update_widgets { 266sub update_widgets {
245 my ($self) = @_; 267 my ($self) = @_;
246 268
247 my $button_cb = sub { 269 my $button_cb = sub {
248 my (undef, $ev, $x, $y) = @_; 270 my (undef, $ev, $x, $y) = @_;
249 271
272 my $targ = $::CONN->{player}{tag};
273
274 if ($self->{container} == $::CONN->{player}{tag}) {
275 $targ = $::CONN->{open_container};
276 }
277
250 if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) { 278 if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) {
251 my $targ = $::CONN->{player}{tag};
252
253 if ($self->{container} == $::CONN->{player}{tag}) {
254 $targ = $::CONN->{open_container};
255 }
256
257 $::CONN->send ("move $targ $self->{tag} 0") 279 $::CONN->send ("move $targ $self->{tag} 0")
258 if $targ || !($self->{flags} & F_LOCKED); 280 if $targ || !($self->{flags} & F_LOCKED);
259 } elsif ($ev->{button} == 1) { 281 } elsif ($ev->{button} == 1) {
260 $::CONN->send ("examine $self->{tag}"); 282 $::CONN->send ("examine $self->{tag}");
261 } elsif ($ev->{button} == 2) { 283 } elsif ($ev->{button} == 2) {
271 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }], 293 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }],
272 ) 294 )
273 : ( 295 : (
274 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }], 296 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }],
275 ["drop", sub { $::CONN->send ("move $::CONN->{open_container} $self->{tag} 0") }], 297 ["drop", sub { $::CONN->send ("move $::CONN->{open_container} $self->{tag} 0") }],
298 ["move n",
299 sub {
300 do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") })
301 }
302 ]
276 ) 303 )
277 ), 304 ),
278 ); 305 );
279 306
280 CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); 307 CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines