… | |
… | |
569 | } |
569 | } |
570 | |
570 | |
571 | $::INVR->set_items ($conn->{container}{$tag}); |
571 | $::INVR->set_items ($conn->{container}{$tag}); |
572 | } |
572 | } |
573 | |
573 | |
574 | sub update_container { |
|
|
575 | my ($tag) = @_; |
|
|
576 | |
|
|
577 | $::INVR->set_items ($::CONN->{container}{$::CONN->{open_container}}) |
|
|
578 | if $tag == $::CONN->{open_container}; |
|
|
579 | } |
|
|
580 | |
|
|
581 | sub container_add { |
|
|
582 | my ($self, $tag, $items) = @_; |
|
|
583 | |
|
|
584 | $self->{update_container}{$tag}++; |
|
|
585 | $self->update_containers; |
|
|
586 | } |
|
|
587 | |
|
|
588 | sub update_containers { |
574 | sub 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 | |
|
|
593 | sub container_add { |
|
|
594 | my ($self, $tag, $items) = @_; |
|
|
595 | |
|
|
596 | $self->{update_container}{$tag}++; |
|
|
597 | $self->update_containers; |
|
|
598 | } |
|
|
599 | |
605 | sub container_clear { |
600 | sub 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 | |
612 | sub item_delete { |
607 | sub 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 | |