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.124 by root, Fri Jul 20 16:32:04 2007 UTC

445 my @skills = keys %{ $self->{skill_info} }; 445 my @skills = keys %{ $self->{skill_info} };
446 446
447 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) { 447 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) {
448 $sktbl->clear; 448 $sktbl->clear;
449 449
450 my @add;
451
452 push @add,
450 $sktbl->add (0, 0, new CFPlus::UI::Label text => "Experience", align => 1); 453 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
451 $sktbl->add (1, 0, new CFPlus::UI::Label text => "Lvl.", align => 1); 454 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
452 $sktbl->add (2, 0, new CFPlus::UI::Label text => "Skill", expand => 1); 455 2, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
453 $sktbl->add (3, 0, new CFPlus::UI::Label text => "Experience", align => 1); 456 3, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
454 $sktbl->add (4, 0, new CFPlus::UI::Label text => "Lvl.", align => 1); 457 4, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
455 $sktbl->add (5, 0, new CFPlus::UI::Label text => "Skill", expand => 1); 458 5, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
459 ;
456 460
457 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 461 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
458 462
459 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 463 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); 464 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
488 } 492 }
489 493
490 1 494 1
491 }; 495 };
492 496
497 push @add,
493 $sktbl->add ($x * 3 + 0, $y, $self->{stat_widget_exp}{$idx} = new CFPlus::UI::Label 498 $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); 499 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 500 $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); 501 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, 502 $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); 503 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
504 ;
499 505
500 $x++ and ($x, $y) = (0, $y + 1); 506 $x++ and ($x, $y) = (0, $y + 1);
501 } 507 }
508
509 $sktbl->add_at (@add);
502 } 510 }
503 511
504 for (grep exists $stats->{$_}, @skills) { 512 for (grep exists $stats->{$_}, @skills) {
505 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1])); 513 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1]));
506 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1); 514 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1);
988 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub { 996 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub {
989 return unless $::CONN; 997 return unless $::CONN;
990 998
991 $::FLOORBOX->clear; 999 $::FLOORBOX->clear;
992 1000
1001 my @add;
1002
993 my $row; 1003 my $row;
994 for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { 1004 for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) {
995 if ($row < 6) { 1005 if ($row < 6) {
996 local $_->{face_widget}; # hack to force recreation of widget 1006 local $_->{face_widget}; # hack to force recreation of widget
997 local $_->{desc_widget}; # hack to force recreation of widget 1007 local $_->{desc_widget}; # hack to force recreation of widget
998 CFPlus::Item::update_widgets $_; 1008 CFPlus::Item::update_widgets $_;
999 1009
1010 push @add,
1000 $::FLOORBOX->add (0, $row, $_->{face_widget}); 1011 0, $row, $_->{face_widget},
1001 $::FLOORBOX->add (1, $row, $_->{desc_widget}); 1012 1, $row, $_->{desc_widget};
1002 1013
1003 $row++; 1014 $row++;
1004 } else { 1015 } else {
1005 $::FLOORBOX->add (1, $row, new CFPlus::UI::Button 1016 push @add, 1, $row, new CFPlus::UI::Button
1006 text => "More...", 1017 text => "More...",
1007 on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 }, 1018 on_activate => sub { ::toggle_player_page ($::INVENTORY_PAGE); 0 },
1008 ); 1019 ;
1009 last; 1020 last;
1010 } 1021 }
1011 } 1022 }
1012 if ($::CONN->{open_container}) { 1023 if ($::CONN->{open_container}) {
1013 $::FLOORBOX->add (1, $row++, new CFPlus::UI::Button 1024 push @add, 1, $row++, new CFPlus::UI::Button
1014 text => "Close container", 1025 text => "Close container",
1015 on_activate => sub { $::CONN->send ("apply $::CONN->{open_container}") } 1026 on_activate => sub { $::CONN->send ("apply $::CONN->{open_container}") }
1016 ); 1027 ;
1017 } 1028 }
1029
1030 $::FLOORBOX->add_at (@add);
1018 }); 1031 });
1019 1032
1020 $::WANT_REFRESH++; 1033 $::WANT_REFRESH++;
1021} 1034}
1022 1035

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines