… | |
… | |
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 | |
449 | sub spell_delete { |
449 | sub 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 | |
454 | sub addme_success { |
455 | sub 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 | }); |
… | |
… | |
616 | sub item_update { |
617 | sub item_update { |
617 | my ($self, $item) = @_; |
618 | my ($self, $item) = @_; |
618 | |
619 | |
619 | #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"; |
620 | |
621 | |
621 | if ($item->{tag} == $self->{player}{tag}) { |
|
|
622 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $item->{weight} / 1000); |
|
|
623 | return; |
|
|
624 | } |
|
|
625 | |
|
|
626 | CFClient::Item::update_widgets $item; |
622 | CFClient::Item::update_widgets $item; |
627 | |
623 | |
628 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
624 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
629 | set_opencont ($::CONN, 0, "Floor"); |
625 | set_opencont ($::CONN, 0, "Floor"); |
630 | |
626 | |
… | |
… | |
643 | } |
639 | } |
644 | } |
640 | } |
645 | |
641 | |
646 | sub player_update { |
642 | sub player_update { |
647 | my ($self, $player) = @_; |
643 | my ($self, $player) = @_; |
648 | |
|
|
649 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
644 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
650 | } |
645 | } |
651 | |
646 | |
652 | sub update_server_info { |
647 | sub update_server_info { |
653 | my ($self) = @_; |
648 | my ($self) = @_; |