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.47 by root, Wed Jun 28 21:43:15 2006 UTC vs.
Revision 1.50 by elmex, Sun Jul 2 16:25:19 2006 UTC

569 } 569 }
570 570
571 $::INVR->set_items ($conn->{container}{$tag}); 571 $::INVR->set_items ($conn->{container}{$tag});
572} 572}
573 573
574sub update_container {
575 my ($tag) = @_;
576
577 $::INVR->set_items ($::CONN->{container}{$::CONN->{open_container}})
578 if $tag == $::CONN->{open_container};
579}
580
581sub container_add {
582 my ($self, $tag, $items) = @_;
583
584 $self->{update_container}{$tag}++;
585 $self->update_containers;
586}
587
588sub update_containers { 574sub update_containers {
589 my ($self) = @_; 575 my ($self) = @_;
590 576
591 $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub { 577 $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub {
592 for my $tag (keys %{ delete $self->{update_container} }) { 578 for my $tag (keys %{ delete $self->{update_container} }) {
593 if ($tag == 0) { 579 if ($tag == 0) {
594 update_floorbox; 580 update_floorbox;
595 update_container (0); 581 $::INVR->set_items ($self->{container}{0})
582 if $tag == $self->{open_container};
596 } elsif ($tag == $self->{player}{tag}) { 583 } elsif ($tag == $self->{player}{tag}) {
597 $::INV->set_items ($self->{container}{$tag}) 584 $::INV->set_items ($self->{container}{$tag})
598 } else { 585 } else {
599 update_container ($tag); 586 $::INVR->set_items ($self->{container}{$tag})
587 if $tag == $self->{open_container};
600 } 588 }
601 } 589 }
602 }); 590 });
603} 591}
604 592
593sub container_add {
594 my ($self, $tag, $items) = @_;
595
596 $self->{update_container}{$tag}++;
597 $self->update_containers;
598}
599
605sub container_clear { 600sub container_clear {
606 my ($self, $tag) = @_; 601 my ($self, $tag) = @_;
607 602
608 $self->{update_container}{$tag}++; 603 $self->{update_container}{$tag}++;
609 $self->update_containers; 604 $self->update_containers;
610} 605}
611 606
612sub item_delete { 607sub item_delete {
613 my ($self, @items) = @_; 608 my ($self, @items) = @_;
614 609
615 $self->{update_container}{$_->{tag}}++ 610 $self->{update_container}{$_->{container}}++
616 for @items; 611 for @items;
617 612
618 $self->update_containers; 613 $self->update_containers;
619} 614}
620 615
621sub item_update { 616sub item_update {
622 my ($self, $item) = @_; 617 my ($self, $item) = @_;
623 618
624 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; 619 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n";
625
626 if ($item->{tag} == $self->{player}{tag}) {
627 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $item->{weight} / 1000);
628 return;
629 }
630 620
631 CFClient::Item::update_widgets $item; 621 CFClient::Item::update_widgets $item;
632 622
633 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { 623 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) {
634 set_opencont ($::CONN, 0, "Floor"); 624 set_opencont ($::CONN, 0, "Floor");
648 } 638 }
649} 639}
650 640
651sub player_update { 641sub player_update {
652 my ($self, $player) = @_; 642 my ($self, $player) = @_;
653
654 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); 643 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000);
655} 644}
656 645
657sub update_server_info { 646sub update_server_info {
658 my ($self) = @_; 647 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines