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.188 by elmex, Sun Jan 6 16:28:49 2008 UTC vs.
Revision 1.196 by root, Thu May 8 21:30:23 2008 UTC

27 ); 27 );
28 28
29 $self->{map_widget}->clr_commands; 29 $self->{map_widget}->clr_commands;
30 30
31 my @cmd_help = map { 31 my @cmd_help = map {
32 $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x 32 $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
33 or die "unparseable command help: $_->{kw}[0]"; 33 or die "unparseable command help: $_->[DC::Pod::N_KW][0]";
34 34
35 my $cmd = $1; 35 my $cmd = $1;
36 my @args = split /\|/, $2; 36 my @args = split /\|/, $2;
37 @args = (".*") unless @args; 37 @args = (".*") unless @args;
38 38
43 for @args; 43 for @args;
44 44
45 map ["$cmd$_", $text], 45 map ["$cmd$_", $text],
46 sort { (length $a) <=> (length $b) } 46 sort { (length $a) <=> (length $b) }
47 @args 47 @args
48 } sort { $a->{par} <=> $b->{par} } 48 } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] }
49 DC::Pod::find command => "*"; 49 DC::Pod::find command => "*";
50 50
51 $self->{json_coder} 51 $self->{json_coder}
52 ->convert_blessed 52 ->convert_blessed
53 ->filter_json_single_key_object ("\fw" => sub { 53 ->filter_json_single_key_object ("\fw" => sub {
64 $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { 64 $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub {
65 for my $ws (values %{delete $self->{widgetset} || {}}) { 65 for my $ws (values %{delete $self->{widgetset} || {}}) {
66 $_->destroy 66 $_->destroy
67 for values %{delete $ws->{w} || {}}; 67 for values %{delete $ws->{w} || {}};
68 } 68 }
69
70 delete $self->{items};
71 $::INV->clear;
72 $::INVR_HB->clear;
73 $::FLOORBOX->clear;
69 }); 74 });
70 75
71 $self->{map_widget}->add_command (@$_) 76 $self->{map_widget}->add_command (@$_)
72 for @cmd_help; 77 for @cmd_help;
73 78
1026 1031
1027 # handle some elements 1032 # handle some elements
1028 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; 1033 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs;
1029 s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; 1034 s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs;
1030 1035
1036 s/\s+$//;
1037
1031 $_ 1038 $_
1032} 1039}
1033 1040
1034our %NAME_TO_COLOR = ( 1041our %NAME_TO_COLOR = (
1035 black => 0, 1042 black => 0,
1140 1147
1141 my %skill_help; 1148 my %skill_help;
1142 1149
1143 for my $node (DC::Pod::find skill_description => "*") { 1150 for my $node (DC::Pod::find skill_description => "*") {
1144 my (undef, @par) = DC::Pod::section_of $node; 1151 my (undef, @par) = DC::Pod::section_of $node;
1145 $skill_help{$node->{kw}[0]} = DC::Pod::as_label @par; 1152 $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par;
1146 }; 1153 };
1147 1154
1148 for my $skill (values %{$self->{skill_info}}) { 1155 for my $skill (values %{$self->{skill_info}}) {
1149 $self->{map_widget}->add_command ("ready_skill $skill", 1156 $self->{map_widget}->add_command ("ready_skill $skill",
1150 (DC::asxml "Ready the skill '$skill'\n\n") 1157 (DC::asxml "Ready the skill '$skill'\n\n")
1170 $::FLOORBOX->clear; 1177 $::FLOORBOX->clear;
1171 1178
1172 my @add; 1179 my @add;
1173 1180
1174 my $row; 1181 my $row;
1175 for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { 1182 for (sort { $b->{count} <=> $a->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) {
1183 next if $_->{tag} & 0x80000000;
1176 if ($row < 6) { 1184 if ($row < 6) {
1177 local $_->{face_widget}; # hack to force recreation of widget 1185 local $_->{face_widget}; # hack to force recreation of widget
1178 local $_->{desc_widget}; # hack to force recreation of widget 1186 local $_->{desc_widget}; # hack to force recreation of widget
1179 DC::Item::update_widgets $_; 1187 DC::Item::update_widgets $_;
1180 1188
1207sub set_opencont { 1215sub set_opencont {
1208 my ($conn, $tag, $name) = @_; 1216 my ($conn, $tag, $name) = @_;
1209 $conn->{open_container} = $tag; 1217 $conn->{open_container} = $tag;
1210 update_floorbox; 1218 update_floorbox;
1211 1219
1212 $::INVR_HB->clear (); 1220 $::INVR_HB->clear;
1213 $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); 1221 $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name);
1214 1222
1215 if ($tag != 0) { # Floor isn't closable, is it? 1223 if ($tag != 0) { # Floor isn't closable, is it?
1216 $::INVR_HB->add (new DC::UI::Button 1224 $::INVR_HB->add (new DC::UI::Button
1217 text => "Close container", 1225 text => "Close container",
1273} 1281}
1274 1282
1275sub item_update { 1283sub item_update {
1276 my ($self, $item) = @_; 1284 my ($self, $item) = @_;
1277 1285
1278 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; 1286 #print "item_update: $item->{tag} in $item->{container} pt($self->{player}{tag}) oc($::CONN->{open_container}) f($item->{flags})\n";
1279 1287
1280 DC::Item::update_widgets $item; 1288 DC::Item::update_widgets $item;
1281 1289
1282 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { 1290 if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) {
1283 set_opencont ($::CONN, 0, "Floor"); 1291 set_opencont ($::CONN, 0, "Floor");
1284 1292
1285 } elsif ($item->{flags} & F_OPEN) { 1293 } elsif ($item->{flags} & F_OPEN) {
1286 set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item); 1294 set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item);
1320 . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" 1328 . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n"
1321 . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" 1329 . "examine command support $yesno[$self->{setup}{excmd} > 0]\n"
1322 . "editing support $yesno[!!$self->{editor_support}]\n" 1330 . "editing support $yesno[!!$self->{editor_support}]\n"
1323 . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" 1331 . "map attributes $yesno[$self->{setup}{extmap} > 0]\n"
1324 . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" 1332 . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n"
1325 . "cfplus support $yesno[$self->{cfplus_ext} > 0]" 1333 . "client support $yesno[$self->{cfplus_ext} > 0]"
1326 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" 1334 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n"
1327 . "map size $self->{mapw}×$self->{maph}\n" 1335 . "map size $self->{mapw}×$self->{maph}\n"
1328 ); 1336 );
1329 1337
1330} 1338}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines