… | |
… | |
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 | |
… | |
… | |
275 | spell_list => $::SPELL_LIST, |
280 | spell_list => $::SPELL_LIST, |
276 | |
281 | |
277 | floorbox => $::FLOORBOX, |
282 | floorbox => $::FLOORBOX, |
278 | help_window => $::HELP_WINDOW, |
283 | help_window => $::HELP_WINDOW, |
279 | message_window => $::MESSAGE_WINDOW, |
284 | message_window => $::MESSAGE_WINDOW, |
|
|
285 | message_dist => $::MESSAGE_DIST, |
280 | statusbox => $::SDTATUSBOX, |
286 | statusbox => $::SDTATUSBOX, |
281 | |
287 | |
282 | inv => $::INV, |
288 | inv => $::INV, |
283 | invr => $::INVR, |
289 | invr => $::INVR, |
284 | invr_hb => $::INVR_HB, |
290 | invr_hb => $::INVR_HB, |
… | |
… | |
333 | |
339 | |
334 | # message window |
340 | # message window |
335 | sub ext_channel_info { |
341 | sub ext_channel_info { |
336 | my ($self, $info) = @_; |
342 | my ($self, $info) = @_; |
337 | $self->{channels}->{$info->{id}} = $info; |
343 | $self->{channels}->{$info->{id}} = $info; |
338 | $::MESSAGE_WINDOW->add_channel ($info); |
344 | $::MESSAGE_DIST->add_channel ($info); |
339 | } |
345 | } |
340 | |
346 | |
341 | ############################################################################# |
347 | ############################################################################# |
342 | |
348 | |
343 | sub logprint { |
349 | sub logprint { |
… | |
… | |
1025 | |
1031 | |
1026 | # handle some elements |
1032 | # handle some elements |
1027 | s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; |
1033 | s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; |
1028 | s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; |
1034 | s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; |
1029 | |
1035 | |
|
|
1036 | s/\s+$//; |
|
|
1037 | |
1030 | $_ |
1038 | $_ |
1031 | } |
1039 | } |
1032 | |
1040 | |
1033 | our %NAME_TO_COLOR = ( |
1041 | our %NAME_TO_COLOR = ( |
1034 | black => 0, |
1042 | black => 0, |
… | |
… | |
1139 | |
1147 | |
1140 | my %skill_help; |
1148 | my %skill_help; |
1141 | |
1149 | |
1142 | for my $node (DC::Pod::find skill_description => "*") { |
1150 | for my $node (DC::Pod::find skill_description => "*") { |
1143 | my (undef, @par) = DC::Pod::section_of $node; |
1151 | my (undef, @par) = DC::Pod::section_of $node; |
1144 | $skill_help{$node->{kw}[0]} = DC::Pod::as_label @par; |
1152 | $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par; |
1145 | }; |
1153 | }; |
1146 | |
1154 | |
1147 | for my $skill (values %{$self->{skill_info}}) { |
1155 | for my $skill (values %{$self->{skill_info}}) { |
1148 | $self->{map_widget}->add_command ("ready_skill $skill", |
1156 | $self->{map_widget}->add_command ("ready_skill $skill", |
1149 | (DC::asxml "Ready the skill '$skill'\n\n") |
1157 | (DC::asxml "Ready the skill '$skill'\n\n") |
… | |
… | |
1169 | $::FLOORBOX->clear; |
1177 | $::FLOORBOX->clear; |
1170 | |
1178 | |
1171 | my @add; |
1179 | my @add; |
1172 | |
1180 | |
1173 | my $row; |
1181 | my $row; |
1174 | 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; |
1175 | if ($row < 6) { |
1184 | if ($row < 6) { |
1176 | local $_->{face_widget}; # hack to force recreation of widget |
1185 | local $_->{face_widget}; # hack to force recreation of widget |
1177 | local $_->{desc_widget}; # hack to force recreation of widget |
1186 | local $_->{desc_widget}; # hack to force recreation of widget |
1178 | DC::Item::update_widgets $_; |
1187 | DC::Item::update_widgets $_; |
1179 | |
1188 | |
… | |
… | |
1206 | sub set_opencont { |
1215 | sub set_opencont { |
1207 | my ($conn, $tag, $name) = @_; |
1216 | my ($conn, $tag, $name) = @_; |
1208 | $conn->{open_container} = $tag; |
1217 | $conn->{open_container} = $tag; |
1209 | update_floorbox; |
1218 | update_floorbox; |
1210 | |
1219 | |
1211 | $::INVR_HB->clear (); |
1220 | $::INVR_HB->clear; |
1212 | $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); |
1221 | $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); |
1213 | |
1222 | |
1214 | if ($tag != 0) { # Floor isn't closable, is it? |
1223 | if ($tag != 0) { # Floor isn't closable, is it? |
1215 | $::INVR_HB->add (new DC::UI::Button |
1224 | $::INVR_HB->add (new DC::UI::Button |
1216 | text => "Close container", |
1225 | text => "Close container", |
… | |
… | |
1272 | } |
1281 | } |
1273 | |
1282 | |
1274 | sub item_update { |
1283 | sub item_update { |
1275 | my ($self, $item) = @_; |
1284 | my ($self, $item) = @_; |
1276 | |
1285 | |
1277 | #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"; |
1278 | |
1287 | |
1279 | DC::Item::update_widgets $item; |
1288 | DC::Item::update_widgets $item; |
1280 | |
1289 | |
1281 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
1290 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
1282 | set_opencont ($::CONN, 0, "Floor"); |
1291 | set_opencont ($::CONN, 0, "Floor"); |
1283 | |
1292 | |
1284 | } elsif ($item->{flags} & F_OPEN) { |
1293 | } elsif ($item->{flags} & F_OPEN) { |
1285 | set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item); |
1294 | set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item); |
… | |
… | |
1319 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1328 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1320 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1329 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1321 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1330 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1322 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1331 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1323 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1332 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1324 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1333 | . "client support $yesno[$self->{cfplus_ext} > 0]" |
1325 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1334 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1326 | . "map size $self->{mapw}×$self->{maph}\n" |
1335 | . "map size $self->{mapw}×$self->{maph}\n" |
1327 | ); |
1336 | ); |
1328 | |
1337 | |
1329 | } |
1338 | } |