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.48 by root, Wed Jun 28 22:59:58 2006 UTC vs.
Revision 1.51 by root, Sun Jul 2 21:07:26 2006 UTC

438 # try to create single paragraphs of multiple lines sent by the server 438 # try to create single paragraphs of multiple lines sent by the server
439 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; 439 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g;
440 $spell->{message} =~ s/\n+$//; 440 $spell->{message} =~ s/\n+$//;
441 $spell->{message} ||= "Server did not provide a description for this spell."; 441 $spell->{message} ||= "Server did not provide a description for this spell.";
442 442
443 $::SETUP_SPELLS->add_spell ($spell); 443 $::SPELL_PAGE->add_spell ($spell);
444 444
445 $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); 445 $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message});
446 $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); 446 $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message});
447} 447}
448 448
449sub spell_delete { 449sub spell_delete {
450 my ($self, $spell) = @_; 450 my ($self, $spell) = @_;
451
451 $::SETUP_SPELLS->remove_spell ($spell); 452 $::SPELL_PAGE->remove_spell ($spell);
452} 453}
453 454
454sub addme_success { 455sub addme_success {
455 my ($self) = @_; 456 my ($self) = @_;
456 457
536 537
537 $row++; 538 $row++;
538 } else { 539 } else {
539 $::FLOORBOX->add (1, $row, new CFClient::UI::Button 540 $::FLOORBOX->add (1, $row, new CFClient::UI::Button
540 text => "More...", 541 text => "More...",
541 on_activate => sub { $::INV_WINDOW->toggle_visibility; 0 }, 542 on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 },
542 ); 543 );
543 last; 544 last;
544 } 545 }
545 } 546 }
546 }); 547 });
573 574
574sub update_containers { 575sub update_containers {
575 my ($self) = @_; 576 my ($self) = @_;
576 577
577 $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub { 578 $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub {
578 # TODO: scara had a bug where $self->{uipdate_container} was not defined
579 # but this should not possibly happen?
580 for my $tag (keys %{ delete $self->{update_container} }) { 579 for my $tag (keys %{ delete $self->{update_container} }) {
581 if ($tag == 0) { 580 if ($tag == 0) {
582 update_floorbox; 581 update_floorbox;
583 $::INVR->set_items ($self->{container}{0}) 582 $::INVR->set_items ($self->{container}{0})
584 if $tag == $self->{open_container}; 583 if $tag == $self->{open_container};
607} 606}
608 607
609sub item_delete { 608sub item_delete {
610 my ($self, @items) = @_; 609 my ($self, @items) = @_;
611 610
612 $self->{update_container}{$_->{tag}}++ 611 $self->{update_container}{$_->{container}}++
613 for @items; 612 for @items;
614 613
615 $self->update_containers; 614 $self->update_containers;
616} 615}
617 616
618sub item_update { 617sub item_update {
619 my ($self, $item) = @_; 618 my ($self, $item) = @_;
620 619
621 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; 620 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n";
622
623 if ($item->{tag} == $self->{player}{tag}) {
624 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $item->{weight} / 1000);
625 return;
626 }
627 621
628 CFClient::Item::update_widgets $item; 622 CFClient::Item::update_widgets $item;
629 623
630 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { 624 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) {
631 set_opencont ($::CONN, 0, "Floor"); 625 set_opencont ($::CONN, 0, "Floor");
645 } 639 }
646} 640}
647 641
648sub player_update { 642sub player_update {
649 my ($self, $player) = @_; 643 my ($self, $player) = @_;
650
651 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); 644 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000);
652} 645}
653 646
654sub update_server_info { 647sub update_server_info {
655 my ($self) = @_; 648 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines