… | |
… | |
651 | |
651 | |
652 | sub update_containers { |
652 | sub update_containers { |
653 | my ($self) = @_; |
653 | my ($self) = @_; |
654 | |
654 | |
655 | $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub { |
655 | $CFClient::UI::ROOT->on_refresh ("update_containers_$self" => sub { |
656 | for my $tag (keys %{ delete $self->{update_container} }) { |
656 | my $todo = delete $self->{update_container} |
|
|
657 | or return; |
|
|
658 | |
|
|
659 | for my $tag (keys %$todo) { |
657 | if ($tag == 0) { |
660 | if ($tag == 0) { |
658 | update_floorbox; |
661 | update_floorbox; |
659 | $::INVR->set_items ($self->{container}{0}) |
662 | $::INVR->set_items ($self->{container}{0}) |
660 | if $tag == $self->{open_container}; |
663 | if $tag == $self->{open_container}; |
661 | } elsif ($tag == $self->{player}{tag}) { |
664 | } elsif ($tag == $self->{player}{tag}) { |
… | |
… | |
705 | set_opencont ($::CONN, $item->{tag}, CFClient::Item::desc_string $item); |
708 | set_opencont ($::CONN, $item->{tag}, CFClient::Item::desc_string $item); |
706 | |
709 | |
707 | } else { |
710 | } else { |
708 | $self->{update_container}{$item->{container}}++; |
711 | $self->{update_container}{$item->{container}}++; |
709 | $self->update_containers; |
712 | $self->update_containers; |
710 | # if ($item->{container} == 0) { |
|
|
711 | # update_floorbox; |
|
|
712 | # update_container (0); |
|
|
713 | # } elsif ($item->{container} == $self->{player}{tag}) { |
|
|
714 | # $::INV->set_items ($self->{container}{$item->{container}}) |
|
|
715 | # } |
|
|
716 | } |
713 | } |
717 | } |
714 | } |
718 | |
715 | |
719 | sub player_update { |
716 | sub player_update { |
720 | my ($self, $player) = @_; |
717 | my ($self, $player) = @_; |
… | |
… | |
922 | sub destroy { |
919 | sub destroy { |
923 | my ($self) = @_; |
920 | my ($self) = @_; |
924 | |
921 | |
925 | #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1 |
922 | #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1 |
926 | |
923 | |
|
|
924 | $self->{conn}->send ("ext npc_dialog_end $self->{token}") if $self->{token}; |
927 | delete $self->{conn}{npc_dialog}; |
925 | delete $self->{conn}{npc_dialog}; |
928 | $self->{conn}->disconnect_ext ($self->{token}); |
926 | $self->{conn}->disconnect_ext ($self->{token}); |
929 | |
927 | |
930 | $self->SUPER::destroy; |
928 | $self->SUPER::destroy; |
931 | } |
929 | } |