--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/06/06 03:05:16 1.24
+++ deliantra/Deliantra-Client/DC/Protocol.pm 2006/06/11 18:43:09 1.31
@@ -400,8 +400,11 @@
sub spell_add {
my ($self, $spell) = @_;
- # TODO
- # create a widget dynamically, using spell face (CF::Protocol downloads them)
+ # try to create single paragraphs of multiple lines sent by the server
+ $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g;
+ $spell->{message} =~ s/\n+$//;
+ $spell->{message} ||= "Server did not provide a description for this spell.";
+
$::SETUP_SPELLS->add_spell ($spell);
$self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message});
@@ -488,7 +491,7 @@
my $row;
for (@{ $::CONN->{container}{0} }) {
- if ($row < 7) {
+ if ($row < 6) {
local $_->{face_widget}; # hack to force recreation of widget
local $_->{desc_widget}; # hack to force recreation of widget
CFClient::Item::update_widgets $_;
@@ -498,7 +501,10 @@
$row++;
} else {
- $::FLOORBOX->add (1, $row, new CFClient::UI::Label text => "More...");
+ $::FLOORBOX->add (1, $row, new CFClient::UI::Button
+ text => "More...",
+ on_activate => sub { $::INV_WINDOW->toggle_visibility },
+ );
last;
}
}
@@ -617,11 +623,31 @@
sub player_update {
my ($self, $player) = @_;
+
$::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000);
+}
+
+sub logged_in {
+ my ($self) = @_;
+
+ $self->send_ext_req (cfplus => "version", "1", sub {
+ $self->{cfplus_ext} = $_[0];
+
+ my @yesno = ("no", "yes");
+
+ $::SERVER_INFO->set_markup (
+ "server $self->{host}:$self->{port}\n"
+ . "protocol version $self->{version}\n"
+ . "minimap support $yesno[$self->{setup}{mapinfocmd} > 0]\n"
+ . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n"
+ . "cfplus support $yesno[$self->{cfplus_ext} > 0]\n"
+ . "map size $self->{mapw}×$self->{maph}\n"
+ );
+ });
- # do it here because it is ignored earlier, and there is no "login" event
$self->send_command ("output-sync $::CFG->{output_sync}");
$self->send_command ("output-count $::CFG->{output_count}");
+ $self->send_command ("pickup $::CFG->{pickup}");
}
1;