… | |
… | |
1400 | # replace G<male|female> tags |
1400 | # replace G<male|female> tags |
1401 | || s{G<([^>|]*)\|([^>]*)>}{ |
1401 | || s{G<([^>|]*)\|([^>]*)>}{ |
1402 | $self->gender ? $2 : $1 |
1402 | $self->gender ? $2 : $1 |
1403 | }ge |
1403 | }ge |
1404 | # replace H<hint text> |
1404 | # replace H<hint text> |
1405 | || s/H<([^\>]*)>/<fg name="lightblue">[$1]<\/fg>/g; |
1405 | || s{H<([^\>]*)>} |
|
|
1406 | { |
|
|
1407 | ("<fg name=\"lightblue\">[$1 (Use hintmode to suppress hints)]</fg>", |
|
|
1408 | "<fg name=\"lightblue\">[Hint suppressed, see hintmode]</fg>", |
|
|
1409 | "") |
|
|
1410 | [$self->{hintmode}] |
|
|
1411 | }ge; |
1406 | |
1412 | |
1407 | # create single paragraphs (very hackish) |
1413 | # create single paragraphs (very hackish) |
1408 | s/(?<=\S)\n(?=\w)/ /g; |
1414 | s/(?<=\S)\n(?=\w)/ /g; |
1409 | |
1415 | |
|
|
1416 | # compress some whitespace |
|
|
1417 | 1 while s/\s*\n\s*\n\s*/\n/; |
|
|
1418 | |
|
|
1419 | s/^\s+//; |
|
|
1420 | s/\s+$//; |
|
|
1421 | |
1410 | $_ |
1422 | $_ |
|
|
1423 | } |
|
|
1424 | |
|
|
1425 | sub hintmode { |
|
|
1426 | $_[0]{hintmode} = $_[1] if @_ > 1; |
|
|
1427 | $_[0]{hintmode} |
1411 | } |
1428 | } |
1412 | |
1429 | |
1413 | =item $player->ext_reply ($msgid, %msg) |
1430 | =item $player->ext_reply ($msgid, %msg) |
1414 | |
1431 | |
1415 | Sends an ext reply to the player. |
1432 | Sends an ext reply to the player. |
… | |
… | |
2390 | sub cf::client::send_msg { |
2407 | sub cf::client::send_msg { |
2391 | my ($self, $color, $type, $msg, @extra) = @_; |
2408 | my ($self, $color, $type, $msg, @extra) = @_; |
2392 | |
2409 | |
2393 | $msg = $self->pl->expand_cfpod ($msg); |
2410 | $msg = $self->pl->expand_cfpod ($msg); |
2394 | |
2411 | |
|
|
2412 | return unless @extra || length $msg; |
|
|
2413 | |
2395 | if ($self->can_msg) { |
2414 | if ($self->can_msg) { |
2396 | $self->send_packet ("msg " . $self->{json_coder}->encode ([$color, $type, $msg, @extra])); |
2415 | $self->send_packet ("msg " . $self->{json_coder}->encode ([$color, $type, $msg, @extra])); |
2397 | } else { |
2416 | } else { |
2398 | # replace some tags by gcfclient-compatible ones |
2417 | # replace some tags by gcfclient-compatible ones |
2399 | for ($msg) { |
2418 | for ($msg) { |