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.225 by root, Sat Nov 10 18:29:32 2012 UTC vs.
Revision 1.227 by root, Tue Nov 20 14:32:12 2012 UTC

67 }); 67 });
68 68
69 () 69 ()
70 }); 70 });
71 71
72 $self->{map_widget}->clr_commands; 72 $::COMPLETER->reset;
73
74 my @cmd_help = map {
75 $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
76 or die "unparseable command help: $_->[DC::Pod::N_KW][0]";
77
78 my $cmd = $1;
79 my @args = split /\|/, $2;
80 @args = (".*") unless @args;
81
82 my (undef, @par) = DC::Pod::section_of $_;
83 my $text = DC::Pod::as_label @par;
84
85 $_ = $_ eq ".*" ? "" : " $_"
86 for @args;
87
88 map ["$cmd$_", $text],
89 sort { (length $a) <=> (length $b) }
90 @args
91 } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] }
92 DC::Pod::find command => "*";
93 73
94 $self->{json_coder} 74 $self->{json_coder}
95 ->convert_blessed 75 ->convert_blessed
96 ->filter_json_single_key_object ("\fw" => sub { 76 ->filter_json_single_key_object ("\fw" => sub {
97 $self->{widget}{$_[0]} 77 $self->{widget}{$_[0]}
114 $::INV->clear; 94 $::INV->clear;
115 $::INVR->clear; 95 $::INVR->clear;
116 $::INVR_HB->clear; 96 $::INVR_HB->clear;
117 $::FLOORBOX->clear; 97 $::FLOORBOX->clear;
118 }); 98 });
119
120 $self->{map_widget}->add_command (@$_)
121 for @cmd_help;
122 99
123 { 100 {
124 $self->{dialogue} = my $tex = $TEX_DIALOGUE; 101 $self->{dialogue} = my $tex = $TEX_DIALOGUE;
125 $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 102 $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}});
126 } 103 }
184} 161}
185 162
186sub ext_ambient_music { 163sub ext_ambient_music {
187 my ($self, $songs) = @_; 164 my ($self, $songs) = @_;
188 &::audio_music_set_ambient ($songs); 165 &::audio_music_set_ambient ($songs);
166}
167
168sub ext_command_list {
169 my ($self, @faces) = @_;
170
171 my $handler = $self->{command_facehandler} = {};
172 my $commands = $::COMPLETER->{command_list} = {};
173
174 for my $idx (@faces) {
175 $handler->{$idx} = $self->register_face_handler ($idx, sub {
176 my ($face) = @_;
177
178 $commands->{$idx} =
179 $face->{cache} ||= $self->{json_coder}->decode ($face->{data});
180 });
181 }
189} 182}
190 183
191############################################################################# 184#############################################################################
192 185
193sub widget_associate { 186sub widget_associate {
1168 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; 1161 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g;
1169 $spell->{message} =~ s/\n+$//; 1162 $spell->{message} =~ s/\n+$//;
1170 $spell->{message} ||= "Server did not provide a description for this spell."; 1163 $spell->{message} ||= "Server did not provide a description for this spell.";
1171 1164
1172 $::SPELL_LIST->add_spell ($spell); 1165 $::SPELL_LIST->add_spell ($spell);
1173 1166 delete $::COMPLETER->{command_list}{spells};
1174 $self->{map_widget}->add_command ("invoke $spell->{name}", DC::asxml $spell->{message});
1175 $self->{map_widget}->add_command ("cast $spell->{name}", DC::asxml $spell->{message});
1176} 1167}
1177 1168
1178sub spell_delete { 1169sub spell_delete {
1179 my ($self, $spell) = @_; 1170 my ($self, $spell) = @_;
1180 1171
1181 $::SPELL_LIST->remove_spell ($spell); 1172 $::SPELL_LIST->remove_spell ($spell);
1173 delete $::COMPLETER->{command_list}{spells};
1182} 1174}
1183 1175
1184sub setup { 1176sub setup {
1185 my ($self, $setup) = @_; 1177 my ($self, $setup) = @_;
1186 1178
1209} 1201}
1210 1202
1211sub eof { 1203sub eof {
1212 my ($self) = @_; 1204 my ($self) = @_;
1213 1205
1214 $self->{map_widget}->clr_commands; 1206 $::COMPLETER->reset;
1215 1207
1216 ::stop_game (); 1208 ::stop_game ();
1217} 1209}
1218 1210
1219sub update_floorbox { 1211sub update_floorbox {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines