ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.25 by root, Tue Jun 6 03:13:00 2006 UTC vs.
Revision 1.30 by root, Sun Jun 11 18:41:30 2006 UTC

398} 398}
399 399
400sub spell_add { 400sub 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}
497 $::FLOORBOX->add (1, $row, $_->{desc_widget}); 500 $::FLOORBOX->add (1, $row, $_->{desc_widget});
498 501
499 $row++; 502 $row++;
500 } else { 503 } else {
501 $::FLOORBOX->add (1, $row, new CFClient::UI::Button 504 $::FLOORBOX->add (1, $row, new CFClient::UI::Button
502 text => "More...", 505 text => "More...",
503 on_activate => sub { $::INV_WINDOW->toggle_visibility }, 506 on_activate => sub { $::INV_WINDOW->toggle_visibility },
504 ); 507 );
505 last; 508 last;
506 } 509 }
507 } 510 }
618 } 621 }
619} 622}
620 623
621sub player_update { 624sub 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);
628}
624 629
625 # do it here because it is ignored earlier, and there is no "login" event 630sub logged_in {
631 my ($self) = @_;
632
633 $self->send_ext_req (cfplus => "version", "1", sub {
634 $self->{cfplus_ext} = $_[0];
635 });
636
626 $self->send_command ("output-sync $::CFG->{output_sync}"); 637 $self->send_command ("output-sync $::CFG->{output_sync}");
627 $self->send_command ("output-count $::CFG->{output_count}"); 638 $self->send_command ("output-count $::CFG->{output_count}");
639 $self->send_command ("pickup $::CFG->{pickup}");
640
641 my @yesno = ("<span foreground='red'>no</span>", "<span foreground='green'>yes</span>");
642
643 $::SERVER_INFO->set_markup (
644 "server <tt>$self->{host}:$self->{port}</tt>\n"
645 . "protocol version <tt>$self->{version}</tt>\n"
646 . "minimap support $yesno[$self->{setup}{mapinfocmd} > 0]\n"
647 . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n"
648 . "cfplus support $yesno[$self->{cfplus_ext} > 0]\n"
649 . "map size $self->{mapw}×$self->{maph}\n"
650 );
628} 651}
629 652
6301; 6531;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines