… | |
… | |
1124 | } |
1124 | } |
1125 | |
1125 | |
1126 | \@paths |
1126 | \@paths |
1127 | } |
1127 | } |
1128 | |
1128 | |
1129 | =item $player->ext_reply ($msgid, $msgtype, %msg) |
1129 | =item $player->ext_reply ($msgid, %msg) |
1130 | |
1130 | |
1131 | Sends an ext reply to the player. |
1131 | Sends an ext reply to the player. |
1132 | |
1132 | |
1133 | =cut |
1133 | =cut |
1134 | |
1134 | |
1135 | sub ext_reply($$$%) { |
1135 | sub ext_reply($$%) { |
1136 | my ($self, $id, %msg) = @_; |
1136 | my ($self, $id, %msg) = @_; |
1137 | |
1137 | |
1138 | $msg{msgid} = $id; |
1138 | $msg{msgid} = $id; |
1139 | |
1139 | |
1140 | $self->send ("ext " . cf::to_json \%msg); |
1140 | $self->send ("ext " . cf::to_json \%msg); |
|
|
1141 | } |
|
|
1142 | |
|
|
1143 | =item $player->ext_event ($type, %msg) |
|
|
1144 | |
|
|
1145 | Sends an ext event to the client. |
|
|
1146 | |
|
|
1147 | =cut |
|
|
1148 | |
|
|
1149 | sub ext_event($$%) { |
|
|
1150 | my ($self, $type, %msg) = @_; |
|
|
1151 | |
|
|
1152 | $self->ns->ext_event ($type, %msg); |
1141 | } |
1153 | } |
1142 | |
1154 | |
1143 | package cf; |
1155 | package cf; |
1144 | |
1156 | |
1145 | =back |
1157 | =back |
… | |
… | |
1953 | |
1965 | |
1954 | return unless $self->type == cf::PLAYER; |
1966 | return unless $self->type == cf::PLAYER; |
1955 | |
1967 | |
1956 | if ($exit->slaying eq "/!") { |
1968 | if ($exit->slaying eq "/!") { |
1957 | #TODO: this should de-fi-ni-te-ly not be a sync-job |
1969 | #TODO: this should de-fi-ni-te-ly not be a sync-job |
|
|
1970 | # the problem is that $exit might not survive long enough |
|
|
1971 | # so it needs to be done right now, right here |
1958 | cf::sync_job { prepare_random_map $exit }; |
1972 | cf::sync_job { prepare_random_map $exit }; |
1959 | } |
1973 | } |
1960 | |
1974 | |
1961 | my $slaying = cf::map::normalise $exit->slaying, $exit->map && $exit->map->path; |
1975 | my $slaying = cf::map::normalise $exit->slaying, $exit->map && $exit->map->path; |
1962 | my $hp = $exit->stats->hp; |
1976 | my $hp = $exit->stats->hp; |
… | |
… | |
1970 | $self->goto ($slaying, $hp, $sp); |
1984 | $self->goto ($slaying, $hp, $sp); |
1971 | |
1985 | |
1972 | 1; |
1986 | 1; |
1973 | }) { |
1987 | }) { |
1974 | $self->message ("Something went wrong deep within the crossfire server. " |
1988 | $self->message ("Something went wrong deep within the crossfire server. " |
1975 | . "I'll try to bring you back to the map you were before. " |
1989 | . "I'll try to bring you back to the map you were before. " |
1976 | . "Please report this to the dungeon master!", |
1990 | . "Please report this to the dungeon master!", |
1977 | cf::NDI_UNIQUE | cf::NDI_RED); |
1991 | cf::NDI_UNIQUE | cf::NDI_RED); |
1978 | |
1992 | |
1979 | warn "ERROR in enter_exit: $@"; |
1993 | warn "ERROR in enter_exit: $@"; |
1980 | $self->leave_link; |
1994 | $self->leave_link; |
1981 | } |
1995 | } |
1982 | })->prio (1); |
1996 | })->prio (1); |
… | |
… | |
1998 | |
2012 | |
1999 | utf8::encode $text; |
2013 | utf8::encode $text; |
2000 | $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text); |
2014 | $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text); |
2001 | } |
2015 | } |
2002 | |
2016 | |
|
|
2017 | =item $client->ext_event ($type, %msg) |
|
|
2018 | |
|
|
2019 | Sends an exti event to the client. |
|
|
2020 | |
|
|
2021 | =cut |
|
|
2022 | |
|
|
2023 | sub cf::client::ext_event($$%) { |
|
|
2024 | my ($self, $type, %msg) = @_; |
|
|
2025 | |
|
|
2026 | $msg{msgtype} = "event_$type"; |
|
|
2027 | $self->send_packet ("ext " . cf::to_json \%msg); |
|
|
2028 | } |
2003 | |
2029 | |
2004 | =item $success = $client->query ($flags, "text", \&cb) |
2030 | =item $success = $client->query ($flags, "text", \&cb) |
2005 | |
2031 | |
2006 | Queues a query to the client, calling the given callback with |
2032 | Queues a query to the client, calling the given callback with |
2007 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |
2033 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |