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

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.1 by root, Fri May 26 18:56:14 2006 UTC vs.
Revision 1.2 by root, Fri May 26 19:14:33 2006 UTC

1package CFClient::Protocol; 1package CFClient::Protocol;
2 2
3use utf8; 3use utf8;
4use strict; 4use strict;
5
6use Crossfire::Protocol::Constants;
5 7
6use CFClient::UI; 8use CFClient::UI;
7 9
8use base 'Crossfire::Protocol::Base'; 10use base 'Crossfire::Protocol::Base';
9 11
50} 52}
51 53
52sub stats_update { 54sub stats_update {
53 my ($self, $stats) = @_; 55 my ($self, $stats) = @_;
54 56
55 if (my $exp = $stats->{Crossfire::Protocol::Base::CS_STAT_EXP64}) { 57 if (my $exp = $stats->{CS_STAT_EXP64}) {
56 my $diff = $exp - $self->{prev_exp}; 58 my $diff = $exp - $self->{prev_exp};
57 $self->{statusbox}->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5) 59 $self->{statusbox}->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5)
58 if exists $self->{prev_exp} && $diff; 60 if exists $self->{prev_exp} && $diff;
59 $self->{prev_exp} = $exp; 61 $self->{prev_exp} = $exp;
60 } 62 }
64 66
65sub user_send { 67sub user_send {
66 my ($self, $command) = @_; 68 my ($self, $command) = @_;
67 69
68 $self->send_command ($command); 70 $self->send_command ($command);
69 status $command; 71 ::status $command;
70} 72}
71 73
72sub map_scroll { 74sub map_scroll {
73 my ($self, $dx, $dy) = @_; 75 my ($self, $dx, $dy) = @_;
74 76
329 $vbox->add (new CFClient::UI::Label 331 $vbox->add (new CFClient::UI::Label
330 max_w => $::WIDTH * 0.4, 332 max_w => $::WIDTH * 0.4,
331 ellipsise => 0, 333 ellipsise => 0,
332 text => $prompt); 334 text => $prompt);
333 335
334 if ($flags & Crossfire::Protocol::Base::CS_QUERY_YESNO) { 336 if ($flags & CS_QUERY_YESNO) {
335 $vbox->add (my $hbox = new CFClient::UI::HBox); 337 $vbox->add (my $hbox = new CFClient::UI::HBox);
336 $hbox->add (new CFClient::UI::Button 338 $hbox->add (new CFClient::UI::Button
337 text => "No", 339 text => "No",
338 connect_activate => sub { 340 connect_activate => sub {
339 $self->send ("reply n"); 341 $self->send ("reply n");
349 }, 351 },
350 ); 352 );
351 353
352 $dialog->focus_in; 354 $dialog->focus_in;
353 355
354 } elsif ($flags & Crossfire::Protocol::Base::CS_QUERY_SINGLECHAR) { 356 } elsif ($flags & CS_QUERY_SINGLECHAR) {
355 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; 357 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)";
356 $vbox->add (my $entry = new CFClient::UI::Entry 358 $vbox->add (my $entry = new CFClient::UI::Entry
357 connect_changed => sub { 359 connect_changed => sub {
358 $self->send ("reply $_[1]"); 360 $self->send ("reply $_[1]");
359 $dialog->destroy; 361 $dialog->destroy;
364 366
365 } else { 367 } else {
366 $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)"; 368 $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)";
367 369
368 $vbox->add (my $entry = new CFClient::UI::Entry 370 $vbox->add (my $entry = new CFClient::UI::Entry
369 $flags & Crossfire::Protocol::Base::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), 371 $flags & CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (),
370 connect_activate => sub { 372 connect_activate => sub {
371 $self->send ("reply $_[1]"); 373 $self->send ("reply $_[1]");
372 $dialog->destroy; 374 $dialog->destroy;
373 }, 375 },
374 ); 376 );
602 return; 604 return;
603 } 605 }
604 606
605 CFClient::Item::update_widgets $item; 607 CFClient::Item::update_widgets $item;
606 608
607 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & Crossfire::Protocol::Base::F_OPEN)) { 609 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) {
608 set_opencont ($::CONN, 0, "Floor"); 610 set_opencont ($::CONN, 0, "Floor");
609 611
610 } elsif ($item->{flags} & Crossfire::Protocol::Base::F_OPEN) { 612 } elsif ($item->{flags} & F_OPEN) {
611 set_opencont ($::CONN, $item->{tag}, CFClient::Item::desc_string $item); 613 set_opencont ($::CONN, $item->{tag}, CFClient::Item::desc_string $item);
612 } else { 614 } else {
613 if ($item->{container} == 0) { 615 if ($item->{container} == 0) {
614 update_floorbox; 616 update_floorbox;
615 update_container (0); 617 update_container (0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines