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.123 by root, Thu Jul 19 16:44:14 2007 UTC vs.
Revision 1.125 by root, Sat Jul 21 15:04:27 2007 UTC

209 my ($arg) = @_; 209 my ($arg) = @_;
210 210
211 my $w = $self->{widget}{$arg->{id}} 211 my $w = $self->{widget}{$arg->{id}}
212 or return; 212 or return;
213 213
214 $w->{$arg->{name}} = $arg->{value}; 214 $w->{$_->[0]} = $_->[1]
215 for @{ $arg->{attr} };
215 }); 216 });
216 217
217 # widget get 218 # widget get
218 $self->connect_ext (w_g => sub { 219 $self->connect_ext (w_g => sub {
219 my ($arg) = @_; 220 my ($arg) = @_;
220 221
221 my $w = $self->{widget}{$arg->{id}} 222 my $w = $self->{widget}{$arg->{id}}
222 or return; 223 or return;
223 224
224 $self->send_exti_msg (w_r => rid => $arg->{rid}, res => [$w->{$arg->{name}}]); 225 $self->send_exti_msg (w_r => rid => $arg->{rid}, res => [map $w->{$_}, @{$arg->{attr}}]);
225 }); 226 });
226 227
227 # destroy widgets on logout 228 # destroy widgets on logout
228 $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { 229 $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub {
229 for my $ws (values %{delete $self->{widgetset} || {}}) { 230 for my $ws (values %{delete $self->{widgetset} || {}}) {
445 my @skills = keys %{ $self->{skill_info} }; 446 my @skills = keys %{ $self->{skill_info} };
446 447
447 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) { 448 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) {
448 $sktbl->clear; 449 $sktbl->clear;
449 450
451 my @add;
452
453 push @add,
450 $sktbl->add (0, 0, new CFPlus::UI::Label text => "Experience", align => 1); 454 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
451 $sktbl->add (1, 0, new CFPlus::UI::Label text => "Lvl.", align => 1); 455 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
452 $sktbl->add (2, 0, new CFPlus::UI::Label text => "Skill", expand => 1); 456 2, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
453 $sktbl->add (3, 0, new CFPlus::UI::Label text => "Experience", align => 1); 457 3, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
454 $sktbl->add (4, 0, new CFPlus::UI::Label text => "Lvl.", align => 1); 458 4, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
455 $sktbl->add (5, 0, new CFPlus::UI::Label text => "Skill", expand => 1); 459 5, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
460 ;
456 461
457 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 462 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
458 463
459 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 464 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
460 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 465 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
488 } 493 }
489 494
490 1 495 1
491 }; 496 };
492 497
498 push @add,
493 $sktbl->add ($x * 3 + 0, $y, $self->{stat_widget_exp}{$idx} = new CFPlus::UI::Label 499 $x * 3 + 0, $y, ($self->{stat_widget_exp}{$idx} = new CFPlus::UI::Label
494 text => "0", align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP); 500 align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP),
495 $sktbl->add ($x * 3 + 1, $y, $self->{stat_widget_lvl}{$idx} = new CFPlus::UI::Label 501 $x * 3 + 1, $y, ($self->{stat_widget_lvl}{$idx} = new CFPlus::UI::Label
496 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL); 502 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL),
497 $sktbl->add ($x * 3 + 2, $y, new CFPlus::UI::Label text => $name, on_button_down => $spell_cb, 503 $x * 3 + 2, $y, (new CFPlus::UI::Label text => $name, on_button_down => $spell_cb,
498 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL); 504 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
505 ;
499 506
500 $x++ and ($x, $y) = (0, $y + 1); 507 $x++ and ($x, $y) = (0, $y + 1);
501 } 508 }
509
510 $sktbl->add_at (@add);
502 } 511 }
503 512
504 for (grep exists $stats->{$_}, @skills) { 513 for (grep exists $stats->{$_}, @skills) {
505 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1])); 514 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1]));
506 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1); 515 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1);
988 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub { 997 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub {
989 return unless $::CONN; 998 return unless $::CONN;
990 999
991 $::FLOORBOX->clear; 1000 $::FLOORBOX->clear;
992 1001
1002 my @add;
1003
993 my $row; 1004 my $row;
994 for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { 1005 for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) {
995 if ($row < 6) { 1006 if ($row < 6) {
996 local $_->{face_widget}; # hack to force recreation of widget 1007 local $_->{face_widget}; # hack to force recreation of widget
997 local $_->{desc_widget}; # hack to force recreation of widget 1008 local $_->{desc_widget}; # hack to force recreation of widget
998 CFPlus::Item::update_widgets $_; 1009 CFPlus::Item::update_widgets $_;
999 1010
1011 push @add,
1000 $::FLOORBOX->add (0, $row, $_->{face_widget}); 1012 0, $row, $_->{face_widget},
1001 $::FLOORBOX->add (1, $row, $_->{desc_widget}); 1013 1, $row, $_->{desc_widget};
1002 1014
1003 $row++; 1015 $row++;
1004 } else { 1016 } else {
1005 $::FLOORBOX->add (1, $row, new CFPlus::UI::Button 1017 push @add, 1, $row, new CFPlus::UI::Button
1006 text => "More...", 1018 text => "More...",
1007 on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 }, 1019 on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 },
1008 ); 1020 ;
1009 last; 1021 last;
1010 } 1022 }
1011 } 1023 }
1012 if ($::CONN->{open_container}) { 1024 if ($::CONN->{open_container}) {
1013 $::FLOORBOX->add (1, $row++, new CFPlus::UI::Button 1025 push @add, 1, $row++, new CFPlus::UI::Button
1014 text => "Close container", 1026 text => "Close container",
1015 on_activate => sub { $::CONN->send ("apply $::CONN->{open_container}") } 1027 on_activate => sub { $::CONN->send ("apply $::CONN->{open_container}") }
1016 ); 1028 ;
1017 } 1029 }
1030
1031 $::FLOORBOX->add_at (@add);
1018 }); 1032 });
1019 1033
1020 $::WANT_REFRESH++; 1034 $::WANT_REFRESH++;
1021} 1035}
1022 1036

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines