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.157 by root, Tue Aug 21 02:39:17 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
483 my @add; 482 my @add;
484 483
485 push @add, 484 push @add,
486 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1), 485 0, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
487 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1), 486 1, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
487 2, 0, (new CFPlus::UI::Label text => "Progress", align => 0),
488 2, 0, (new CFPlus::UI::Label text => "Skill", expand => 1), 488 3, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
489 3, 0, (new CFPlus::UI::Label text => "Experience", align => 1), 489 4, 0, (new CFPlus::UI::Label text => "Experience", align => 1),
490 4, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1), 490 5, 0, (new CFPlus::UI::Label text => "Lvl.", align => 1),
491 6, 0, (new CFPlus::UI::Label text => "Progress", align => 0),
491 5, 0, (new CFPlus::UI::Label text => "Skill", expand => 1), 492 7, 0, (new CFPlus::UI::Label text => "Skill", expand => 1),
492 ; 493 ;
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);
526 527
527 1 528 1
528 }; 529 };
529 530
530 push @add, 531 push @add,
531 $x * 3 + 0, $y, ($self->{stat_widget_exp}{$idx} = new CFPlus::UI::Label 532 $x * 4 + 0, $y, ($self->{stat_widget_exp}{$idx} ||= new CFPlus::UI::Label
532 align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP), 533 align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP),
533 $x * 3 + 1, $y, ($self->{stat_widget_lvl}{$idx} = new CFPlus::UI::Label 534 $x * 4 + 1, $y, ($self->{stat_widget_lvl}{$idx} ||= new CFPlus::UI::Label
534 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL), 535 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL),
536 $x * 4 + 2, $y, ($self->{stat_widget_prg}{$idx} ||= new CFPlus::UI::ExperienceProgress),
535 $x * 3 + 2, $y, (new CFPlus::UI::Label text => $name, on_button_down => $spell_cb, 537 $x * 4 + 3, $y, ($self->{stat_widget_lbl}{$idx} ||= 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), 538 can_events => 1, can_hover => 1, tooltip => (CFPlus::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
537 ; 539 ;
538 540
539 $x++ and ($x, $y) = (0, $y + 1); 541 $x++ and ($x, $y) = (0, $y + 1);
540 } 542 }
543 } 545 }
544 546
545 for (grep exists $stats->{$_}, @skills) { 547 for (grep exists $stats->{$_}, @skills) {
546 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1])); 548 $self->{stat_widget_exp}{$_}->set_text (::formsep ($stats->{$_}[1]));
547 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1); 549 $self->{stat_widget_lvl}{$_}->set_text ($stats->{$_}[0] * 1);
550 $self->{stat_widget_prg}{$_}->set_value (@{$stats->{$_}});
548 } 551 }
549} 552}
550 553
551sub macro_send { 554sub macro_send {
552 my ($self, $macro) = @_; 555 my ($self, $macro) = @_;
927 930
928# call in non-void context registers a temporary 931# call in non-void context registers a temporary
929# hook with handle, otherwise its permanent 932# hook with handle, otherwise its permanent
930sub register_face_handler { 933sub register_face_handler {
931 my ($self, $num, $cb) = @_; 934 my ($self, $num, $cb) = @_;
935
936 return unless $num;
932 937
933 # invoke if available right now 938 # invoke if available right now
934 $cb->($self->{face}[$num], 0) 939 $cb->($self->{face}[$num], 0)
935 unless exists $self->{face}[$num]{loading}; 940 unless exists $self->{face}[$num]{loading};
936 941

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines