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.156 by root, Tue Aug 21 00:59:34 2007 UTC vs.
Revision 1.158 by root, Tue Aug 21 11:23:04 2007 UTC

66 66
67 $self->register_face_handler ($exp_table, sub { 67 $self->register_face_handler ($exp_table, sub {
68 my ($face) = @_; 68 my ($face) = @_;
69 69
70 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data}); 70 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
71 71 $_->() for values %{ $self->{on_exp_update} || {} };
72 #TODO: update all interested parties
73 }); 72 });
74 73
75 () 74 ()
76 }); 75 });
77 76
175 statusbox => $::SDTATUSBOX, 174 statusbox => $::SDTATUSBOX,
176 175
177 inv => $::INV, 176 inv => $::INV,
178 invr => $::INVR, 177 invr => $::INVR,
179 invr_hb => $::INVR_HB, 178 invr_hb => $::INVR_HB,
180
181 ); 179 );
182 180
183 while (my ($id, $name) = each %ass) { 181 while (my ($id, $name) = each %ass) {
184 $self->widget_associate (undef, $id => $wkw{$name}) 182 $self->widget_associate (undef, $id => $wkw{$name})
185 or warn "server failed to associate non-existent well-known widget $name\n"; 183 or warn "server failed to associate non-existent well-known widget $name\n";
448 $::GAUGES->{mana} ->set_value ($sp, $sp_m); 446 $::GAUGES->{mana} ->set_value ($sp, $sp_m);
449 $::GAUGES->{food} ->set_value ($fo, $fo_m); 447 $::GAUGES->{food} ->set_value ($fo, $fo_m);
450 $::GAUGES->{grace} ->set_value ($gr, $gr_m); 448 $::GAUGES->{grace} ->set_value ($gr, $gr_m);
451 $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64})) 449 $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))
452 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); 450 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")");
451 $::GAUGES->{prg} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64});
453 $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE}); 452 $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE});
454 my $title = $stats->{+CS_STAT_TITLE}; 453 my $title = $stats->{+CS_STAT_TITLE};
455 $title =~ s/^Player: //; 454 $title =~ s/^Player: //;
456 $::STATWIDS->{title} ->set_text ("Title: " . $title); 455 $::STATWIDS->{title} ->set_text ("Title: " . $title);
457 456
478 my @skills = keys %{ $self->{skill_info} }; 477 my @skills = keys %{ $self->{skill_info} };
479 478
480 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) { 479 if (grep +(exists $stats->{$_}) != (exists $prev->{$_}), @skills) {
481 $sktbl->clear; 480 $sktbl->clear;
482 481
483 my @add; 482 my $sw = $self->{skillwid}{""} ||= [
484
485 push @add,
486 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1), 483 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
487 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1), 484 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
485 2, 0, (new CFPlus::UI::Label text => "Progress", align => 0),
488 2, 0, (new CFPlus::UI::Label text => "Skill", expand => 1), 486 3, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
489 3, 0, (new CFPlus::UI::Label text => "Experience", align => 1), 487 4, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
490 4, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1), 488 5, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
489 6, 0, (new CFPlus::UI::Label text => "Progress", align => 0),
491 5, 0, (new CFPlus::UI::Label text => "Skill", expand => 1), 490 7, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
492 ; 491 ];
492
493 my @add = @$sw;
493 494
494 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 495 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
495 496
496 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 497 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
497 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 498 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
525 } 526 }
526 527
527 1 528 1
528 }; 529 };
529 530
531 my $sw = $self->{skillwid}{$idx} ||= [
532 # exp
533 (new CFPlus::UI::Label
534 align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP),
535
536 # level
537 (new CFPlus::UI::Label
538 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL),
539
540 # progress
541 (new CFPlus::UI::ExperienceProgress),
542
543 # label
544 (new CFPlus::UI::Label text => $name, on_button_down => $spell_cb,
545 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
546 ];
547
530 push @add, 548 push @add,
531 $x * 3 + 0, $y, ($self->{stat_widget_exp}{$idx} = new CFPlus::UI::Label 549 $x * 4 + 0, $y, $sw->[0],
532 align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP), 550 $x * 4 + 1, $y, $sw->[1],
533 $x * 3 + 1, $y, ($self->{stat_widget_lvl}{$idx} = new CFPlus::UI::Label 551 $x * 4 + 2, $y, $sw->[2],
534 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL), 552 $x * 4 + 3, $y, $sw->[3],
535 $x * 3 + 2, $y, (new CFPlus::UI::Label text => $name, on_button_down => $spell_cb,
536 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
537 ; 553 ;
538 554
539 $x++ and ($x, $y) = (0, $y + 1); 555 $x++ and ($x, $y) = (0, $y + 1);
540 } 556 }
541 557
542 $sktbl->add_at (@add); 558 $sktbl->add_at (@add);
543 } 559 }
544 560
545 for (grep exists $stats->{$_}, @skills) { 561 for (grep exists $stats->{$_}, @skills) {
562 my $sw = $self->{skillwid}{$_};
546 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1])); 563 $sw->[0]->set_text (::formsep ($stats->{$_}[1]));
547 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1); 564 $sw->[1]->set_text ($stats->{$_}[0] * 1);
565 $sw->[2]->set_value (@{$stats->{$_}});
548 } 566 }
549} 567}
550 568
551sub macro_send { 569sub macro_send {
552 my ($self, $macro) = @_; 570 my ($self, $macro) = @_;
927 945
928# call in non-void context registers a temporary 946# call in non-void context registers a temporary
929# hook with handle, otherwise its permanent 947# hook with handle, otherwise its permanent
930sub register_face_handler { 948sub register_face_handler {
931 my ($self, $num, $cb) = @_; 949 my ($self, $num, $cb) = @_;
950
951 return unless $num;
932 952
933 # invoke if available right now 953 # invoke if available right now
934 $cb->($self->{face}[$num], 0) 954 $cb->($self->{face}[$num], 0)
935 unless exists $self->{face}[$num]{loading}; 955 unless exists $self->{face}[$num]{loading};
936 956

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines