… | |
… | |
398 | } |
398 | } |
399 | |
399 | |
400 | sub spell_add { |
400 | sub spell_add { |
401 | my ($self, $spell) = @_; |
401 | my ($self, $spell) = @_; |
402 | |
402 | |
403 | # TODO |
403 | # try to create single paragraphs of multiple lines sent by the server |
404 | # create a widget dynamically, using spell face (CF::Protocol downloads them) |
404 | $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; |
|
|
405 | $spell->{message} =~ s/\n+$//; |
|
|
406 | $spell->{message} ||= "Server did not provide a description for this spell."; |
|
|
407 | |
405 | $::SETUP_SPELLS->add_spell ($spell); |
408 | $::SETUP_SPELLS->add_spell ($spell); |
406 | |
409 | |
407 | $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
410 | $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
408 | $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
411 | $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
409 | } |
412 | } |
… | |
… | |
618 | } |
621 | } |
619 | } |
622 | } |
620 | |
623 | |
621 | sub player_update { |
624 | sub player_update { |
622 | my ($self, $player) = @_; |
625 | my ($self, $player) = @_; |
|
|
626 | |
623 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
627 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
624 | |
628 | |
625 | # do it here because it is ignored earlier, and there is no "login" event |
629 | # do it here because it is ignored earlier, and there is no "login" event |
626 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
630 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
627 | $self->send_command ("output-count $::CFG->{output_count}"); |
631 | $self->send_command ("output-count $::CFG->{output_count}"); |
|
|
632 | $self->send_command ("pickup $::CFG->{pickup}") |
628 | } |
633 | } |
629 | |
634 | |
630 | 1; |
635 | 1; |