--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/06/28 21:43:15 1.47 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2006/07/02 21:07:26 1.51 @@ -440,7 +440,7 @@ $spell->{message} =~ s/\n+$//; $spell->{message} ||= "Server did not provide a description for this spell."; - $::SETUP_SPELLS->add_spell ($spell); + $::SPELL_PAGE->add_spell ($spell); $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); @@ -448,7 +448,8 @@ sub spell_delete { my ($self, $spell) = @_; - $::SETUP_SPELLS->remove_spell ($spell); + + $::SPELL_PAGE->remove_spell ($spell); } sub addme_success { @@ -538,7 +539,7 @@ } else { $::FLOORBOX->add (1, $row, new CFClient::UI::Button text => "More...", - on_activate => sub { $::INV_WINDOW->toggle_visibility; 0 }, + on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 }, ); last; } @@ -571,20 +572,6 @@ $::INVR->set_items ($conn->{container}{$tag}); } -sub update_container { - my ($tag) = @_; - - $::INVR->set_items ($::CONN->{container}{$::CONN->{open_container}}) - if $tag == $::CONN->{open_container}; -} - -sub container_add { - my ($self, $tag, $items) = @_; - - $self->{update_container}{$tag}++; - $self->update_containers; -} - sub update_containers { my ($self) = @_; @@ -592,16 +579,25 @@ for my $tag (keys %{ delete $self->{update_container} }) { if ($tag == 0) { update_floorbox; - update_container (0); + $::INVR->set_items ($self->{container}{0}) + if $tag == $self->{open_container}; } elsif ($tag == $self->{player}{tag}) { $::INV->set_items ($self->{container}{$tag}) } else { - update_container ($tag); + $::INVR->set_items ($self->{container}{$tag}) + if $tag == $self->{open_container}; } } }); } +sub container_add { + my ($self, $tag, $items) = @_; + + $self->{update_container}{$tag}++; + $self->update_containers; +} + sub container_clear { my ($self, $tag) = @_; @@ -612,7 +608,7 @@ sub item_delete { my ($self, @items) = @_; - $self->{update_container}{$_->{tag}}++ + $self->{update_container}{$_->{container}}++ for @items; $self->update_containers; @@ -623,11 +619,6 @@ #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; - if ($item->{tag} == $self->{player}{tag}) { - $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $item->{weight} / 1000); - return; - } - CFClient::Item::update_widgets $item; if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { @@ -650,7 +641,6 @@ sub player_update { my ($self, $player) = @_; - $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); }