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.65 by root, Sun Jul 23 16:11:12 2006 UTC vs.
Revision 1.68 by elmex, Sun Jul 30 12:51:32 2006 UTC

32 @args = (".*") unless @args; 32 @args = (".*") unless @args;
33 33
34 $_ = $_ eq ".*" ? "" : " $_" 34 $_ = $_ eq ".*" ? "" : " $_"
35 for @args; 35 for @args;
36 36
37 my $text = CFClient::Pod::as_xml $head2->content; 37 my $text = CFClient::Pod::as_markup $head2->content;
38 38
39 push @cmd_help, ["$cmd$_", $text] 39 push @cmd_help, ["$cmd$_", $text]
40 for sort { (length $a) <=> (length $b) } 40 for sort { (length $a) <=> (length $b) }
41 @args; 41 @args;
42 } 42 }
261 $sktbl->add (2, 0, new CFClient::UI::Label text => "Skill", expand => 1); 261 $sktbl->add (2, 0, new CFClient::UI::Label text => "Skill", expand => 1);
262 $sktbl->add (3, 0, new CFClient::UI::Label text => "Experience", align => 1); 262 $sktbl->add (3, 0, new CFClient::UI::Label text => "Experience", align => 1);
263 $sktbl->add (4, 0, new CFClient::UI::Label text => "Lvl.", align => 1); 263 $sktbl->add (4, 0, new CFClient::UI::Label text => "Lvl.", align => 1);
264 $sktbl->add (5, 0, new CFClient::UI::Label text => "Skill", expand => 1); 264 $sktbl->add (5, 0, new CFClient::UI::Label text => "Skill", expand => 1);
265 265
266 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
267
268 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
269 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
270 my @TOOLTIP_NAME = (tooltip => "<b>Name</b>. The name of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
271
266 my ($x, $y) = (0, 1); 272 my ($x, $y) = (0, 1);
267 for ( 273 for (
268 sort { $stats->{$b->[0]}[1] <=> $stats->{$a->[0]}[1] or $a->[1] cmp $b->[1] } 274 sort { $stats->{$b->[0]}[1] <=> $stats->{$a->[0]}[1] or $a->[1] cmp $b->[1] }
269 map [$_, $self->{skill_info}{$_}], 275 map [$_, $self->{skill_info}{$_}],
270 grep exists $stats->{$_}, 276 grep exists $stats->{$_},
271 @skills 277 @skills
272 ) { 278 ) {
273 my ($idx, $name) = @$_; 279 my ($idx, $name) = @$_;
274 280
281 my $spell_cb = sub {
282 my ($widget, $ev) = @_;
283
284 if ($ev->{button} == 1) {
285 $::CONN->user_send ("ready_skill $name");
286 } elsif ($ev->{button} == 2) {
287 $::CONN->user_send ("use_skill $name");
288 } elsif ($ev->{button} == 3) {
289 (new CFClient::UI::Menu
290 items => [
291 ["bind <i>ready_skill $name</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["ready_skill $name"]) }],
292 ["bind <i>use_skill $name</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["use_skill $name"]) }],
293 ],
294 )->popup ($ev);
295 } else {
296 return 0;
297 }
298
299 1
300 };
301
275 $sktbl->add ($x * 3 + 0, $y, $self->{stat_widget_exp}{$idx} = new CFClient::UI::Label 302 $sktbl->add ($x * 3 + 0, $y, $self->{stat_widget_exp}{$idx} = new CFClient::UI::Label
276 text => "0", align => 1, font => $::FONT_FIXED, fg => [1, 1, 0]); 303 text => "0", align => 1, font => $::FONT_FIXED, fg => [1, 1, 0], on_button_down => $spell_cb, @TOOLTIP_EXP);
277 $sktbl->add ($x * 3 + 1, $y, $self->{stat_widget_lvl}{$idx} = new CFClient::UI::Label 304 $sktbl->add ($x * 3 + 1, $y, $self->{stat_widget_lvl}{$idx} = new CFClient::UI::Label
278 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4); 305 text => "0", align => 1, font => $::FONT_FIXED, fg => [0, 1, 0], padding_x => 4, on_button_down => $spell_cb, @TOOLTIP_LVL);
279 $sktbl->add ($x * 3 + 2, $y, new CFClient::UI::Label text => $name); 306 $sktbl->add ($x * 3 + 2, $y, new CFClient::UI::Label text => $name, on_button_down => $spell_cb, @TOOLTIP_NAME);
280 307
281 $x++ and ($x, $y) = (0, $y + 1); 308 $x++ and ($x, $y) = (0, $y + 1);
282 } 309 }
283 } 310 }
284 311
602 629
603 $text = CFClient::asxml $text; 630 $text = CFClient::asxml $text;
604 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; 631 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
605 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; 632 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
606 633
607 $self->{logview}->add_paragraph ($color[$color], $_) 634 $self->{logview}->add_paragraph ({ fg => $color[$color], markup => $_ })
608 for map "<span foreground='#ffffff'>$time</span> $_", split /\n/, $text; 635 for map "<span foreground='#ffffff'>$time</span> $_", split /\n/, $text;
609 $self->{logview}->scroll_to_bottom; 636 $self->{logview}->scroll_to_bottom;
610 637
611 $self->{statusbox}->add ($text, 638 $self->{statusbox}->add ($text,
612 group => $text, 639 group => $text,
623} 650}
624 651
625sub spell_add { 652sub spell_add {
626 my ($self, $spell) = @_; 653 my ($self, $spell) = @_;
627 654
628 # try to create single paragraphs of multiple lines sent by the server 655 # try to create single paragraphs out of the multiple lines sent by the server
629 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; 656 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g;
630 $spell->{message} =~ s/\n+$//; 657 $spell->{message} =~ s/\n+$//;
631 $spell->{message} ||= "Server did not provide a description for this spell."; 658 $spell->{message} ||= "Server did not provide a description for this spell.";
632 659
633 $::SPELL_PAGE->add_spell ($spell); 660 $::SPELL_PAGE->add_spell ($spell);
649 my ($pom) = @_; 676 my ($pom) = @_;
650 677
651 my %skill_help; 678 my %skill_help;
652 679
653 for my $head2 ($pom->head1->[3]->head2) { 680 for my $head2 ($pom->head1->[3]->head2) {
654 $skill_help{$head2->title} = CFClient::Pod::as_xml $head2->content; 681 $skill_help{$head2->title} = CFClient::Pod::as_markup $head2->content;
655 } 682 }
656 683
657 \%skill_help 684 \%skill_help
658 }; 685 };
659 686
974 $self->{conn}->connect_ext ($self->{token} => sub { $this->feed (@_) }); 1001 $self->{conn}->connect_ext ($self->{token} => sub { $this->feed (@_) });
975 $self->{conn}->send ("ext npc_dialog_begin $self->{token} $self->{dx} $self->{dy}"); 1002 $self->{conn}->send ("ext npc_dialog_begin $self->{token} $self->{dx} $self->{dy}");
976 1003
977 $self->{entry}->grab_focus; 1004 $self->{entry}->grab_focus;
978 1005
979 $self->{textview}->add_paragraph ([1, 1, 0, 1], "<small>[starting conversation with <b>$self->{title}</b>]</small>\n\n"); 1006 $self->{textview}->add_paragraph ({
1007 fg => [1, 1, 0, 1],
1008 markup => "<small>[starting conversation with <b>$self->{title}</b>]</small>\n\n",
1009 });
980 1010
981 $self->show; 1011 $self->show;
982 $self 1012 $self
983}; 1013};
984 1014
1034 }; 1064 };
1035 1065
1036 chr 0xfffc 1066 chr 0xfffc
1037 }giex; 1067 }giex;
1038 1068
1039 $self->{textview}->add_paragraph ([1, 1, 1, 1], [$msg, @link]); 1069 $self->{textview}->add_paragraph ({ markup => $msg, widget => \@link });
1040 $self->{textview}->scroll_to_bottom; 1070 $self->{textview}->scroll_to_bottom;
1041 $self->update_options; 1071 $self->update_options;
1042 } else { 1072 } else {
1043 $self->destroy; 1073 $self->destroy;
1044 } 1074 }
1047} 1077}
1048 1078
1049sub send { 1079sub send {
1050 my ($self, $msg) = @_; 1080 my ($self, $msg) = @_;
1051 1081
1052 $self->{textview}->add_paragraph ([1, 1, 0, 1], "\n" . CFClient::asxml $msg); 1082 $self->{textview}->add_paragraph ({ markup => "\n" . CFClient::asxml $msg });
1053 $self->{textview}->scroll_to_bottom; 1083 $self->{textview}->scroll_to_bottom;
1054 1084
1055 utf8::encode $msg; 1085 utf8::encode $msg;
1056 $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg"); 1086 $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg");
1057} 1087}
1066 $self->{conn}->disconnect_ext ($self->{token}); 1096 $self->{conn}->disconnect_ext ($self->{token});
1067 1097
1068 $self->SUPER::destroy; 1098 $self->SUPER::destroy;
1069} 1099}
1070 1100
10711; 11011

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines